Remove OPENSSL_assert() usage from crypto/bn
authorMatt Caswell <matt@openssl.org>
Wed, 21 Jun 2017 14:52:52 +0000 (15:52 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 21 Aug 2017 07:44:44 +0000 (08:44 +0100)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3740)

crypto/bn/bn_lcl.h
crypto/bn/bn_nist.c

index 7828232540d5da3de1631afb1978b1fbc8436c96..91718795201a7d5564847cb6031babed3b67992a 100644 (file)
@@ -145,7 +145,7 @@ extern "C" {
  */
 
 # ifdef BN_DEBUG
  */
 
 # ifdef BN_DEBUG
-
+#  include <assert.h>
 #  ifdef BN_DEBUG_RAND
 #   define bn_pollute(a) \
         do { \
 #  ifdef BN_DEBUG_RAND
 #   define bn_pollute(a) \
         do { \
@@ -169,8 +169,8 @@ extern "C" {
         do { \
                 const BIGNUM *_bnum2 = (a); \
                 if (_bnum2 != NULL) { \
         do { \
                 const BIGNUM *_bnum2 = (a); \
                 if (_bnum2 != NULL) { \
-                        OPENSSL_assert(((_bnum2->top == 0) && !_bnum2->neg) || \
-                                (_bnum2->top && (_bnum2->d[_bnum2->top - 1] != 0))); \
+                        assert(((_bnum2->top == 0) && !_bnum2->neg) || \
+                               (_bnum2->top && (_bnum2->d[_bnum2->top - 1] != 0))); \
                         bn_pollute(_bnum2); \
                 } \
         } while(0)
                         bn_pollute(_bnum2); \
                 } \
         } while(0)
@@ -181,8 +181,8 @@ extern "C" {
 #  define bn_wcheck_size(bn, words) \
         do { \
                 const BIGNUM *_bnum2 = (bn); \
 #  define bn_wcheck_size(bn, words) \
         do { \
                 const BIGNUM *_bnum2 = (bn); \
-                OPENSSL_assert((words) <= (_bnum2)->dmax && \
-                        (words) >= (_bnum2)->top); \
+                assert((words) <= (_bnum2)->dmax && \
+                       (words) >= (_bnum2)->top); \
                 /* avoid unused variable warning with NDEBUG */ \
                 (void)(_bnum2); \
         } while(0)
                 /* avoid unused variable warning with NDEBUG */ \
                 (void)(_bnum2); \
         } while(0)
index 53598f97eff5ba0d17d7b7404be3555bb57eef45..fcc2b77f45a05ab28121049eb70291c3388911ae 100644 (file)
@@ -254,7 +254,7 @@ static void nist_cp_bn_0(BN_ULONG *dst, const BN_ULONG *src, int top, int max)
     int i;
 
 #ifdef BN_DEBUG
     int i;
 
 #ifdef BN_DEBUG
-    OPENSSL_assert(top <= max);
+    assert(top <= max);
 #endif
     for (i = 0; i < top; i++)
         dst[i] = src[i];
 #endif
     for (i = 0; i < top; i++)
         dst[i] = src[i];