blake2b: add support for parameter setting and keyed hash
[oweals/openssl.git] / crypto / blake2 / m_blake2b.c
index a37ab89ef2bcff720a77c96fe9741b8086aac2c6..2fb80f8b4e437e3a5d7ff04c41ff8238747799f1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2018 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
@@ -25,7 +25,9 @@
 
 static int init(EVP_MD_CTX *ctx)
 {
-    return BLAKE2b_Init(EVP_MD_CTX_md_data(ctx));
+    BLAKE2B_PARAM P;
+    blake2b_param_init(&P);
+    return BLAKE2b_Init(EVP_MD_CTX_md_data(ctx), &P);
 }
 
 static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
@@ -49,7 +51,7 @@ static const EVP_MD blake2b_md = {
     NULL,
     NULL,
     BLAKE2B_BLOCKBYTES,
-    sizeof(EVP_MD *) + sizeof(BLAKE2B_CTX),
+    sizeof(BLAKE2B_CTX),
 };
 
 const EVP_MD *EVP_blake2b512(void)