Move digests to providers
[openssl.git] / providers / default / digests / blake2s.c
similarity index 95%
rename from crypto/blake2/blake2s.c
rename to providers/default/digests/blake2s.c
index 121f0d1a85663d015bf0a0d1fa2c5ada74732eb7..a9c757ea620ee81c64776f6dccd3c71e96c5abb6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
  *
  * 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
@@ -17,9 +17,8 @@
 #include <assert.h>
 #include <string.h>
 #include <openssl/crypto.h>
-
-#include "blake2_locl.h"
 #include "blake2_impl.h"
+#include "internal/blake2.h"
 
 static const uint32_t blake2s_IV[8] =
 {
@@ -115,7 +114,7 @@ void blake2s_param_set_salt(BLAKE2S_PARAM *P, const uint8_t *salt, size_t len)
  * Initialize the hashing context with the given parameter block.
  * Always returns 1.
  */
-int BLAKE2s_Init(BLAKE2S_CTX *c, const BLAKE2S_PARAM *P)
+int blake2s_init(BLAKE2S_CTX *c, const BLAKE2S_PARAM *P)
 {
     blake2s_init_param(c, P);
     return 1;
@@ -125,7 +124,7 @@ int BLAKE2s_Init(BLAKE2S_CTX *c, const BLAKE2S_PARAM *P)
  * Initialize the hashing context with the given parameter block and key.
  * Always returns 1.
  */
-int BLAKE2s_Init_key(BLAKE2S_CTX *c, const BLAKE2S_PARAM *P, const void *key)
+int blake2s_init_key(BLAKE2S_CTX *c, const BLAKE2S_PARAM *P, const void *key)
 {
     blake2s_init_param(c, P);
 
@@ -134,7 +133,7 @@ int BLAKE2s_Init_key(BLAKE2S_CTX *c, const BLAKE2S_PARAM *P, const void *key)
         uint8_t block[BLAKE2S_BLOCKBYTES] = {0};
 
         memcpy(block, key, P->key_length);
-        BLAKE2s_Update(c, block, BLAKE2S_BLOCKBYTES);
+        blake2s_update(c, block, BLAKE2S_BLOCKBYTES);
         OPENSSL_cleanse(block, BLAKE2S_BLOCKBYTES);
     }
 
@@ -244,7 +243,7 @@ static void blake2s_compress(BLAKE2S_CTX *S,
 }
 
 /* Absorb the input data into the hash state.  Always returns 1. */
-int BLAKE2s_Update(BLAKE2S_CTX *c, const void *data, size_t datalen)
+int blake2s_update(BLAKE2S_CTX *c, const void *data, size_t datalen)
 {
     const uint8_t *in = data;
     size_t fill;
@@ -292,7 +291,7 @@ int BLAKE2s_Update(BLAKE2S_CTX *c, const void *data, size_t datalen)
  * Calculate the final hash and save it in md.
  * Always returns 1.
  */
-int BLAKE2s_Final(unsigned char *md, BLAKE2S_CTX *c)
+int blake2s_final(unsigned char *md, BLAKE2S_CTX *c)
 {
     uint8_t outbuffer[BLAKE2S_OUTBYTES] = {0};
     uint8_t *target = outbuffer;