memset, memcpy, sizeof consistency fixes
[openssl.git] / crypto / bn / bn_lcl.h
index ba22f3a125c8f0c021b71ad8e425e8e7a10cd007..196df7ea10aeb726cf7c12e02659af910d2d6635 100644 (file)
@@ -167,10 +167,10 @@ int RAND_pseudo_bytes(unsigned char *buf, int num);
                          * *genuinely* constant variables that aren't mutable \
                          * wouldn't be constructed with top!=dmax. */ \
                         BN_ULONG *_not_const; \
-                        memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
-                        RAND_pseudo_bytes(&_tmp_char, 1); \
-                        memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \
-                                (_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
+                        memcpy(&_not_const, &_bnum1->d, sizeof(_not_const)); \
+                        RAND_bytes(&_tmp_char, 1); /* Debug only - safe to ignore error return */\
+                        memset(_not_const + _bnum1->top, _tmp_char, \
+                                sizeof(*_not_const) * (_bnum1->dmax - _bnum1->top)); \
                 } \
         } while(0)
 #   ifdef BN_DEBUG_TRIX