Don't free the BIGNUM passed to BN_mpi2bn
[openssl.git] / crypto / bn / bn_intern.c
index 139d11b78e2b7758419ae6b716f0271a5d2678fd..abc8fc45a1780728b7e1d32e569d27de24e34256 100644 (file)
@@ -52,7 +52,7 @@
  *
  */
 
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
 #include "bn_lcl.h"
 
 /*
@@ -74,7 +74,7 @@ signed char *bn_compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len)
 
     if (BN_is_zero(scalar)) {
         r = OPENSSL_malloc(1);
-        if (!r) {
+        if (r == NULL) {
             BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
             goto err;
         }
@@ -211,8 +211,8 @@ int bn_copy_words(BN_ULONG *out, const BIGNUM *in, int size)
     if (in->top > size)
         return 0;
 
-    memset(out, 0, sizeof(BN_ULONG) * size);
-    memcpy(out, in->d, sizeof(BN_ULONG) * in->top);
+    memset(out, 0, sizeof(*out) * size);
+    memcpy(out, in->d, sizeof(*out) * in->top);
     return 1;
 }