unified build scheme: add build.info files
[openssl.git] / crypto / evp / scrypt.c
index 09dfdf25157d21b01b96c073a3d6d57511313638..158816c9d9251d83697b7c1e630eb9cfccebf35a 100644 (file)
@@ -1,4 +1,3 @@
-/* scrypt.c */
 /*
  * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
  * 2015.
@@ -64,6 +63,8 @@
 #include <openssl/err.h>
 #include <internal/numbers.h>
 
+#ifndef OPENSSL_NO_SCRYPT
+
 #define R(a,b) (((a) << (b)) | ((a) >> (32 - (b))))
 static void salsa208_word_specification(uint32_t inout[16])
 {
@@ -137,7 +138,7 @@ static void scryptROMix(unsigned char *B, uint64_t r, uint64_t N,
         *pV = *pB++;
         *pV |= *pB++ << 8;
         *pV |= *pB++ << 16;
-        *pV |= *pB++ << 24;
+        *pV |= (uint32_t)*pB++ << 24;
     }
 
     for (i = 1; i < N; i++, pV += 32 * r)
@@ -266,7 +267,7 @@ int EVP_PBE_scrypt(const char *pass, size_t passlen,
         return 1;
 
     B = OPENSSL_malloc(Blen + Vlen);
-    if (B == 0)
+    if (B == NULL)
         return 0;
     X = (uint32_t *)(B + Blen);
     T = X + 32 * r;
@@ -296,3 +297,4 @@ int EVP_PBE_scrypt(const char *pass, size_t passlen,
     OPENSSL_clear_free(B, Blen + Vlen);
     return rv;
 }
+#endif