From f922dac87d859cc7419207301533fe89582ac3ea Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 6 Sep 2018 10:36:11 +0800 Subject: Add missing SM2err and fix doc nits Reviewed-by: Tim Hudson Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/7113) --- crypto/sm2/sm2_err.c | 1 + crypto/sm2/sm2_pmeth.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'crypto/sm2') diff --git a/crypto/sm2/sm2_err.c b/crypto/sm2/sm2_err.c index c2a96c15d9..653c6797f8 100644 --- a/crypto/sm2/sm2_err.c +++ b/crypto/sm2/sm2_err.c @@ -14,6 +14,7 @@ #ifndef OPENSSL_NO_ERR static const ERR_STRING_DATA SM2_str_functs[] = { + {ERR_PACK(ERR_LIB_SM2, SM2_F_PKEY_SM2_COPY, 0), "pkey_sm2_copy"}, {ERR_PACK(ERR_LIB_SM2, SM2_F_PKEY_SM2_CTRL, 0), "pkey_sm2_ctrl"}, {ERR_PACK(ERR_LIB_SM2, SM2_F_PKEY_SM2_CTRL_STR, 0), "pkey_sm2_ctrl_str"}, {ERR_PACK(ERR_LIB_SM2, SM2_F_PKEY_SM2_DIGEST_CUSTOM, 0), diff --git a/crypto/sm2/sm2_pmeth.c b/crypto/sm2/sm2_pmeth.c index 4b61e243aa..3e420658d2 100644 --- a/crypto/sm2/sm2_pmeth.c +++ b/crypto/sm2/sm2_pmeth.c @@ -72,6 +72,7 @@ static int pkey_sm2_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) if (sctx->id != NULL) { dctx->id = OPENSSL_malloc(sctx->id_len); if (dctx->id == NULL) { + SM2err(SM2_F_PKEY_SM2_COPY, ERR_R_MALLOC_FAILURE); pkey_sm2_cleanup(dst); return 0; } @@ -195,8 +196,10 @@ static int pkey_sm2_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) case EVP_PKEY_CTRL_SET1_ID: if (p1 > 0) { tmp_id = OPENSSL_malloc(p1); - if (tmp_id == NULL) + if (tmp_id == NULL) { + SM2err(SM2_F_PKEY_SM2_CTRL, ERR_R_MALLOC_FAILURE); return 0; + } memcpy(tmp_id, p2, p1); OPENSSL_free(smctx->id); smctx->id = tmp_id; -- cgit v1.2.3