mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-09 15:33:58 +08:00
sm2 test vector
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user