sm2 test vector

This commit is contained in:
Zhi Guan
2016-05-02 17:56:14 +02:00
parent d8072491bc
commit addcac4896
34 changed files with 1245 additions and 3023 deletions

View File

@@ -177,7 +177,7 @@ void OpenSSL_add_all_ciphers(void)
#endif
#ifndef OPENSSL_NO_ZUC
EVP_add_cipher(EVP_zuc());
EVP_add_cipher(EVP_zuc());
#endif
#ifndef OPENSSL_NO_AES

View File

@@ -219,8 +219,8 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) {
ctx->update = type->update;
ctx->md_data = OPENSSL_malloc(type->ctx_size);
//fprintf(stderr, "%s %d\n", __FILE__, __LINE__);
if (ctx->md_data == NULL) {
fprintf(stderr, "%s %d\n", __FILE__, __LINE__);
EVPerr(EVP_F_EVP_DIGESTINIT_EX, ERR_R_MALLOC_FAILURE);
return 0;
}

View File

@@ -23,6 +23,11 @@ static int zuc_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
return 1;
}
/*
* FIXME:
* evp_enc.c assert block_size in {1, 8, 16}, 4 not ok!
*/
static const EVP_CIPHER zuc_cipher = {
NID_zuc, /* nid */
4, /* block_size */

View File

@@ -210,6 +210,9 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
#endif
/* we assume block size is a power of 2 in *cryptUpdate */
OPENSSL_assert(ctx->cipher->block_size == 1
#ifndef OPENSSL_NO_GMSSL
|| ctx->cipher->block_size == 4
#endif
|| ctx->cipher->block_size == 8
|| ctx->cipher->block_size == 16);