This commit is contained in:
guanzhi
2017-05-15 19:29:17 +08:00
parent 79e2936664
commit 463db17a86
8 changed files with 5709 additions and 5260 deletions

View File

@@ -86,7 +86,14 @@ int EC_KEY_set_ECCPUBLICKEYBLOB(EC_KEY *ec_key, const ECCPUBLICKEYBLOB *blob)
return 0;
}
#if 1
nbytes = 64;
#else
/* we assume that the coordinates are stored in big-endian format.
* but if it is not
*/
nbytes = (blob->BitLen + 7)/8;
#endif
if (!(x = BN_bin2bn(blob->XCoordinate, nbytes, NULL))) {
GMAPIerr(GMAPI_F_EC_KEY_SET_ECCPUBLICKEYBLOB, ERR_R_BN_LIB);

View File

@@ -54,11 +54,6 @@
int SM2_get_public_key_data(EC_KEY *ec_key, unsigned char *out, size_t *outlen);
int SM2_compute_message_digest(const EVP_MD *id_md, const EVP_MD *msg_md,
const unsigned char *msg, size_t msglen, const char *id, size_t idlen,
unsigned char *out, size_t *outlen,
EC_KEY *ec_key);
struct SM2CiphertextValue_st {
BIGNUM *xCoordinate;
BIGNUM *yCoordinate;
@@ -97,11 +92,5 @@ struct sm2_kap_ctx_st {
};
int i2o_SM2CiphertextValue(const EC_GROUP *group, const SM2CiphertextValue *cv,
unsigned char **pout);
SM2CiphertextValue *o2i_SM2CiphertextValue(const EC_GROUP *group, const EVP_MD *md,
SM2CiphertextValue **cv, const unsigned char **pin, long len);