提交 944fcfc6 编写于 作者: P PW Hu

Fix incorrect return check of BN_bn2nativepad

Reviewed-by: NKurt Roeckx <kurt@roeckx.be>
Reviewed-by: NPaul Dale <pauli@openssl.org>
Reviewed-by: NTomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16943)
上级 a87c3247
......@@ -465,8 +465,8 @@ static int default_fixup_args(enum state state,
ERR_raise(ERR_LIB_EVP, ERR_R_MALLOC_FAILURE);
return 0;
}
if (!BN_bn2nativepad(ctx->p2,
ctx->allocated_buf, ctx->buflen)) {
if (BN_bn2nativepad(ctx->p2,
ctx->allocated_buf, ctx->buflen) < 0) {
OPENSSL_free(ctx->allocated_buf);
ctx->allocated_buf = NULL;
return 0;
......
......@@ -88,7 +88,7 @@ static int get_ulong_via_BN(const OSSL_PARAM *p, unsigned long *goal)
int ret = 1; /* Ever so hopeful */
if (!TEST_true(OSSL_PARAM_get_BN(p, &n))
|| !TEST_true(BN_bn2nativepad(n, (unsigned char *)goal, sizeof(*goal))))
|| !TEST_int_ge(BN_bn2nativepad(n, (unsigned char *)goal, sizeof(*goal)), 0))
ret = 0;
BN_free(n);
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册