mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-09 23:43:41 +08:00
SM2 KAP (Key Agreement Protocol), not tested
This commit is contained in:
@@ -7,21 +7,24 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/sm3.h>
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
#include <openssl/rsa.h>
|
||||
#endif
|
||||
|
||||
|
||||
static int init(EVP_MD_CTX *ctx)
|
||||
{ return sm3_init(ctx->md_data); }
|
||||
{
|
||||
return sm3_init(ctx->md_data);
|
||||
}
|
||||
|
||||
static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
|
||||
{ return sm3_update(ctx->md_data, data, count); }
|
||||
static int update(EVP_MD_CTX *ctx, const void *in, size_t inlen)
|
||||
{
|
||||
return sm3_update(ctx->md_data, in, inlen);
|
||||
}
|
||||
|
||||
static int final(EVP_MD_CTX *ctx, unsigned char *md)
|
||||
{ return sm3_final(ctx->md_data, md); }
|
||||
|
||||
static const EVP_MD sm3_md=
|
||||
{
|
||||
return sm3_final(ctx->md_data, md);
|
||||
}
|
||||
|
||||
static const EVP_MD sm3_md = {
|
||||
NID_sm3,
|
||||
NID_sm2sign_with_sm3,
|
||||
SM3_DIGEST_LENGTH,
|
||||
@@ -33,11 +36,12 @@ static const EVP_MD sm3_md=
|
||||
NULL,
|
||||
EVP_PKEY_RSA_method,
|
||||
SM3_BLOCK_SIZE,
|
||||
sizeof(EVP_MD *)+sizeof(sm3_ctx_t),
|
||||
sizeof(EVP_MD *) + sizeof(sm3_ctx_t),
|
||||
};
|
||||
|
||||
const EVP_MD *EVP_sm3(void)
|
||||
{
|
||||
return(&sm3_md);
|
||||
return &sm3_md;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user