The branch openssl-3.0 has been updated
       via  1585f190290187c2601489f11b6907a8fa2e1109 (commit)
      from  0b5a0043f9c09a7afff7ae18559ee984226ea25b (commit)


- Log -----------------------------------------------------------------
commit 1585f190290187c2601489f11b6907a8fa2e1109
Author: PW Hu <[email protected]>
Date:   Mon Nov 1 15:08:51 2021 +0800

    Fix incorrect return check of BN_bn2nativepad
    
    Reviewed-by: Kurt Roeckx <[email protected]>
    Reviewed-by: Paul Dale <[email protected]>
    Reviewed-by: Tomas Mraz <[email protected]>
    (Merged from https://github.com/openssl/openssl/pull/16943)
    
    (cherry picked from commit 944fcfc69d16dfd20decdd9cd105436f0043dbe0)

-----------------------------------------------------------------------

Summary of changes:
 crypto/evp/ctrl_params_translate.c | 4 ++--
 test/keymgmt_internal_test.c       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/crypto/evp/ctrl_params_translate.c 
b/crypto/evp/ctrl_params_translate.c
index b17ce3cbf9..d17017a78e 100644
--- a/crypto/evp/ctrl_params_translate.c
+++ b/crypto/evp/ctrl_params_translate.c
@@ -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;
diff --git a/test/keymgmt_internal_test.c b/test/keymgmt_internal_test.c
index 40fc464bc2..dd0de2f599 100644
--- a/test/keymgmt_internal_test.c
+++ b/test/keymgmt_internal_test.c
@@ -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;

Reply via email to