The manual says that the return value of BN_ucmp() is -1, 0 or 1.
But in fact the function can return other values now.
If a->top != b->top, difference between the two is returned.

Signed-off-by: Yanchuan Nian <ycn...@gmail.com>
---
 crypto/bn/bn_lib.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index f77fdb7..9ec1dc1 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -647,7 +647,8 @@ int BN_ucmp(const BIGNUM *a, const BIGNUM *b)
        bn_check_top(b);
 
        i=a->top-b->top;
-       if (i != 0) return(i);
+       if (i != 0)
+               return((i > 0) ? 1 : -1);
        ap=a->d;
        bp=b->d;
        for (i=a->top-1; i>=0; i--)
-- 
1.7.4.4

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to