mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-08 23:13:38 +08:00
Add sm2 and otp command
try `gmssl sm2 -help` and `gmssl otp -help`
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
#include "../ec/ec_lcl.h"
|
||||
#include "sm2_lcl.h"
|
||||
|
||||
|
||||
@@ -119,3 +120,15 @@ int SM2_ciphertext_size(const EC_KEY *ec_key, size_t inlen)
|
||||
ret = ASN1_object_size(1, len, V_ASN1_SEQUENCE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
SM2CiphertextValue *d2i_SM2CiphertextValue_fp(FILE *fp, SM2CiphertextValue **a)
|
||||
{
|
||||
return ASN1_item_d2i_fp(ASN1_ITEM_rptr(SM2CiphertextValue), fp, a);
|
||||
}
|
||||
|
||||
int i2d_SM2CiphertextValue_fp(FILE *fp, SM2CiphertextValue *a)
|
||||
{
|
||||
return ASN1_item_i2d_fp(ASN1_ITEM_rptr(SM2CiphertextValue), fp, a);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -59,20 +59,25 @@
|
||||
|
||||
|
||||
static const EC_KEY_METHOD gmssl_ec_key_method = {
|
||||
"GmSSL EC_KEY method",
|
||||
EC_KEY_METHOD_SM2,
|
||||
0,0,0,0,0,0,
|
||||
ossl_ec_key_gen,
|
||||
NULL,
|
||||
SM2_sign_ex,
|
||||
SM2_sign_setup,
|
||||
SM2_do_sign_ex,
|
||||
SM2_verify,
|
||||
SM2_do_verify,
|
||||
SM2_encrypt,
|
||||
NULL,
|
||||
SM2_decrypt,
|
||||
NULL,
|
||||
"SM2 method", /* name */
|
||||
EC_KEY_METHOD_SM2, /* flags */
|
||||
NULL, /* init */
|
||||
NULL, /* finish */
|
||||
0, /* copy */
|
||||
0, /* set_group */
|
||||
0, /* set_private */
|
||||
0, /* set_public */
|
||||
ossl_ec_key_gen, /* keygen */
|
||||
NULL, /* compute_key */
|
||||
SM2_sign_ex, /* sign */
|
||||
SM2_sign_setup, /* sign_setup */
|
||||
SM2_do_sign_ex, /* sign_sig */
|
||||
SM2_verify, /* verify */
|
||||
SM2_do_verify, /* verify_sig */
|
||||
SM2_encrypt, /* encrypt */
|
||||
NULL, /* do_encrypt */
|
||||
SM2_decrypt, /* decrypt */
|
||||
NULL, /* do_decrypt */
|
||||
};
|
||||
|
||||
const EC_KEY_METHOD *EC_KEY_GmSSL(void)
|
||||
|
||||
Reference in New Issue
Block a user