Add sm2 and otp command

try `gmssl sm2 -help` and `gmssl otp -help`
This commit is contained in:
Zhi Guan
2018-12-19 10:01:38 +08:00
parent 5bc22a1f3e
commit 74a729aa77
17 changed files with 376 additions and 5597 deletions

View File

@@ -1074,6 +1074,11 @@ int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);
*/
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);
#ifndef OPENSSL_NO_STDIO
int i2d_ECDSA_SIG_fp(FILE *fp, ECDSA_SIG *a);
ECDSA_SIG *d2i_ECDSA_SIG_fp(FILE *fp, ECDSA_SIG **a);
#endif
/** Accessor for r and s fields of ECDSA_SIG
* \param sig pointer to ECDSA_SIG pointer
* \param pr pointer to BIGNUM pointer for r (may be NULL)
@@ -1515,6 +1520,7 @@ int ERR_load_EC_strings(void);
# define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 240
# define EC_F_EC_POINT_SET_TO_INFINITY 241
# define EC_F_EC_PRE_COMP_NEW 242
# define EC_F_EC_SCHNORR_SIGN 279
# define EC_F_EC_TYPE1CURVE_TATE 243
# define EC_F_EC_WNAF_MUL 244
# define EC_F_EC_WNAF_PRECOMPUTE_MULT 245

View File

@@ -41,9 +41,9 @@ extern "C" {
*/
# define OPENSSL_VERSION_NUMBER 0x1010004fL
# ifdef OPENSSL_FIPS
# define OPENSSL_VERSION_TEXT "GmSSL 2.4.2 - OpenSSL 1.1.0d-fips 6 Dec 2018"
# define OPENSSL_VERSION_TEXT "GmSSL 2.4.2 - OpenSSL 1.1.0d-fips 19 Dec 2018"
# else
# define OPENSSL_VERSION_TEXT "GmSSL 2.4.2 - OpenSSL 1.1.0d 6 Dec 2018"
# define OPENSSL_VERSION_TEXT "GmSSL 2.4.2 - OpenSSL 1.1.0d 19 Dec 2018"
# endif
/*-

View File

@@ -109,6 +109,11 @@ int SM2_verify(int type, const unsigned char *dgst, int dgstlen,
typedef struct SM2CiphertextValue_st SM2CiphertextValue;
DECLARE_ASN1_FUNCTIONS(SM2CiphertextValue)
#ifndef OPENSSL_NO_STDIO
SM2CiphertextValue *d2i_SM2CiphertextValue_fp(FILE *fp, SM2CiphertextValue **a);
int i2d_SM2CiphertextValue_fp(FILE *fp, SM2CiphertextValue *a);
#endif
int i2o_SM2CiphertextValue(const EC_GROUP *group, const SM2CiphertextValue *cv,
unsigned char **pout);
SM2CiphertextValue *o2i_SM2CiphertextValue(const EC_GROUP *group, const EVP_MD *md,
@@ -127,7 +132,6 @@ int SM2_decrypt(int type, const unsigned char *in, size_t inlen,
#define SM2_decrypt_with_recommended(in,inlen,out,outlen,ec_key) \
SM2_decrypt(NID_sm3,in,inlen,out,outlen,ec_key)
/* SM2 Key Exchange */
int SM2_compute_share_key(unsigned char *out, size_t *outlen,