add SM2 default ID, fixed the SM2_do_encrypt() memory leak

This commit is contained in:
Zhi Guan
2016-04-10 01:42:54 +02:00
parent 70118dbcae
commit 37ac6cd45a
7 changed files with 10 additions and 98 deletions

View File

@@ -670,13 +670,16 @@ static int pkey_sm2_ctrl_digestinit(EVP_PKEY_CTX *pk_ctx, EVP_MD_CTX *md_ctx)
fprintf(stderr, "%s() called\n", __FUNCTION__);
/*
if (!(id = SM2_get_id(ec_key))) {
fprintf(stderr, "error: %s %d\n", __FILE__, __LINE__);
id = "alice@pku.edu.cn";
//return 0;
}
*/
//FIXME: check this function
if (!SM2_compute_id_digest(zid, &zidlen, md, id, strlen(id), ec_key)) {
if (!SM2_compute_id_digest(zid, &zidlen, md, ec_key)) {
fprintf(stderr, "error: %s %d\n", __FILE__, __LINE__);
return 0;
}