The branch master has been updated
       via  aedc5a819ee3f5267a7ec5c795b97481a1c63dc6 (commit)
       via  944fcfc69d16dfd20decdd9cd105436f0043dbe0 (commit)
      from  a87c3247ca641f2593391bf44d47e3dccc7f8d73 (commit)


- Log -----------------------------------------------------------------
commit aedc5a819ee3f5267a7ec5c795b97481a1c63dc6
Author: PW Hu <[email protected]>
Date:   Mon Nov 1 16:40:27 2021 +0800

    update doc: BN_bn2lebinpad() and 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)

commit 944fcfc69d16dfd20decdd9cd105436f0043dbe0
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)

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

Summary of changes:
 crypto/evp/ctrl_params_translate.c | 4 ++--
 doc/man3/BN_bn2bin.pod             | 2 +-
 test/keymgmt_internal_test.c       | 2 +-
 3 files changed, 4 insertions(+), 4 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/doc/man3/BN_bn2bin.pod b/doc/man3/BN_bn2bin.pod
index 9637655127..e75b9fffb5 100644
--- a/doc/man3/BN_bn2bin.pod
+++ b/doc/man3/BN_bn2bin.pod
@@ -91,7 +91,7 @@ if B<ret> is NULL.
 BN_bn2bin() returns the length of the big-endian number placed at B<to>.
 BN_bin2bn() returns the B<BIGNUM>, NULL on error.
 
-BN_bn2binpad() returns the number of bytes written or -1 if the supplied
+BN_bn2binpad(), BN_bn2lebinpad(), and BN_bn2nativepad() return the number of 
bytes written or -1 if the supplied
 buffer is too small.
 
 BN_bn2hex() and BN_bn2dec() return a NUL-terminated string, or NULL
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