Following the license change, modify the boilerplates in crypto/kdf/
[openssl.git] / crypto / kdf / scrypt.c
index 3f4cf385dbfed32f2f12d8f36fd557ebb24a944b..6b35b77fd9bec6a6b79567c49310166f2af037dd 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
  *
- * Licensed under the OpenSSL license (the "License").  You may not use
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
@@ -58,8 +58,10 @@ static int pkey_scrypt_init(EVP_PKEY_CTX *ctx)
     SCRYPT_PKEY_CTX *kctx;
 
     kctx = OPENSSL_zalloc(sizeof(*kctx));
-    if (kctx == NULL)
+    if (kctx == NULL) {
+        KDFerr(KDF_F_PKEY_SCRYPT_INIT, ERR_R_MALLOC_FAILURE);
         return 0;
+    }
 
     /* Default values are the most conservative recommendation given in the
      * original paper of C. Percival. Derivation uses roughly 1 GiB of memory
@@ -102,8 +104,10 @@ static int pkey_scrypt_set_membuf(unsigned char **buffer, size_t *buflen,
     } else {
         *buffer = OPENSSL_malloc(1);
     }
-    if (*buffer == NULL)
+    if (*buffer == NULL) {
+        KDFerr(KDF_F_PKEY_SCRYPT_SET_MEMBUF, ERR_R_MALLOC_FAILURE);
         return 0;
+    }
 
     *buflen = new_buflen;
     return 1;