mirror of
https://github.com/BLAKE2/BLAKE2
synced 2024-09-16 08:31:34 +02:00
unkeyed api
This commit is contained in:
parent
ee9e22ba34
commit
5522bb2325
15
ref/blake2.h
15
ref/blake2.h
@ -164,13 +164,16 @@ extern "C" {
|
||||
int blake2bp_update( blake2bp_state *S, const void *in, size_t inlen );
|
||||
int blake2bp_final( blake2bp_state *S, void *out, size_t outlen );
|
||||
|
||||
int blake2xs_init( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||
int blake2xs_update( blake2xs_state *S, const void *in, size_t inlen );
|
||||
int blake2xs_final(blake2xs_state *S, void *out, size_t outlen);
|
||||
/* Variable output length API */
|
||||
int blake2xs_init( blake2xs_state *S, const size_t outlen );
|
||||
int blake2xs_init_key( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||
int blake2xs_update( blake2xs_state *S, const void *in, size_t inlen );
|
||||
int blake2xs_final(blake2xs_state *S, void *out, size_t outlen);
|
||||
|
||||
int blake2xb_init( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||
int blake2xb_update( blake2xb_state *S, const void *in, size_t inlen );
|
||||
int blake2xb_final(blake2xb_state *S, void *out, size_t outlen);
|
||||
int blake2xb_init( blake2xb_state *S, const size_t outlen );
|
||||
int blake2xb_init_key( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||
int blake2xb_update( blake2xb_state *S, const void *in, size_t inlen );
|
||||
int blake2xb_final(blake2xb_state *S, void *out, size_t outlen);
|
||||
|
||||
/* Simple API */
|
||||
int blake2s( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
BLAKE2 reference source code package - reference C implementations
|
||||
|
||||
Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
|
||||
Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
|
||||
|
||||
|
||||
Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
|
||||
Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
|
||||
|
||||
You may use this under the terms of the CC0, the OpenSSL Licence, or
|
||||
the Apache Public License 2.0, at your option. The terms of these
|
||||
licenses can be found at:
|
||||
|
||||
|
||||
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
More information about the BLAKE2 hash function can be found at
|
||||
https://blake2.net.
|
||||
*/
|
||||
@ -23,8 +23,11 @@
|
||||
#include "blake2.h"
|
||||
#include "blake2-impl.h"
|
||||
|
||||
int blake2xb_init( blake2xb_state *S, const size_t outlen ) {
|
||||
return blake2xb_init_key(S, outlen, NULL, 0);
|
||||
}
|
||||
|
||||
int blake2xb_init( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen)
|
||||
int blake2xb_init_key( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen)
|
||||
{
|
||||
if ( outlen == 0 || outlen > 0xFFFFFFFFUL ) {
|
||||
return -1;
|
||||
@ -150,7 +153,7 @@ int blake2xb(void *out, size_t outlen, const void *in, size_t inlen, const void
|
||||
return -1;
|
||||
|
||||
/* Initialize the root block structure */
|
||||
if (blake2xb_init(S, outlen, key, keylen) < 0) {
|
||||
if (blake2xb_init_key(S, outlen, key, keylen) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -204,7 +207,7 @@ int main( void )
|
||||
size_t mlen = BLAKE2_KAT_LENGTH;
|
||||
int err = 0;
|
||||
|
||||
if( (err = blake2xb_init(&S, outlen, key, BLAKE2B_KEYBYTES)) < 0 ) {
|
||||
if( (err = blake2xb_init_key(&S, outlen, key, BLAKE2B_KEYBYTES)) < 0 ) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
BLAKE2 reference source code package - reference C implementations
|
||||
|
||||
Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
|
||||
Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
|
||||
|
||||
|
||||
Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
|
||||
Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
|
||||
|
||||
You may use this under the terms of the CC0, the OpenSSL Licence, or
|
||||
the Apache Public License 2.0, at your option. The terms of these
|
||||
licenses can be found at:
|
||||
|
||||
|
||||
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
More information about the BLAKE2 hash function can be found at
|
||||
https://blake2.net.
|
||||
*/
|
||||
@ -23,8 +23,11 @@
|
||||
#include "blake2.h"
|
||||
#include "blake2-impl.h"
|
||||
|
||||
int blake2xs_init( blake2xs_state *S, const size_t outlen ) {
|
||||
return blake2xs_init_key(S, outlen, NULL, 0);
|
||||
}
|
||||
|
||||
int blake2xs_init( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen )
|
||||
int blake2xs_init_key( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen )
|
||||
{
|
||||
if ( outlen == 0 || outlen > 0xFFFFUL ) {
|
||||
return -1;
|
||||
@ -34,7 +37,7 @@ int blake2xs_init( blake2xs_state *S, const size_t outlen, const void *key, size
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (NULL == key & keylen > 0) {
|
||||
if (NULL == key && keylen > 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -148,7 +151,7 @@ int blake2xs(void *out, size_t outlen, const void *in, size_t inlen, const void
|
||||
return -1;
|
||||
|
||||
/* Initialize the root block structure */
|
||||
if (blake2xs_init(S, outlen, key, keylen) < 0) {
|
||||
if (blake2xs_init_key(S, outlen, key, keylen) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -202,7 +205,7 @@ int main( void )
|
||||
size_t mlen = BLAKE2_KAT_LENGTH;
|
||||
int err = 0;
|
||||
|
||||
if( (err = blake2xs_init(&S, outlen, key, BLAKE2S_KEYBYTES)) < 0 ) {
|
||||
if( (err = blake2xs_init_key(&S, outlen, key, BLAKE2S_KEYBYTES)) < 0 ) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
15
sse/blake2.h
15
sse/blake2.h
@ -164,13 +164,16 @@ extern "C" {
|
||||
int blake2bp_update( blake2bp_state *S, const void *in, size_t inlen );
|
||||
int blake2bp_final( blake2bp_state *S, void *out, size_t outlen );
|
||||
|
||||
int blake2xs_init( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||
int blake2xs_update( blake2xs_state *S, const void *in, size_t inlen );
|
||||
int blake2xs_final(blake2xs_state *S, void *out, size_t outlen);
|
||||
/* Variable output length API */
|
||||
int blake2xs_init( blake2xs_state *S, const size_t outlen );
|
||||
int blake2xs_init_key( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||
int blake2xs_update( blake2xs_state *S, const void *in, size_t inlen );
|
||||
int blake2xs_final(blake2xs_state *S, void *out, size_t outlen);
|
||||
|
||||
int blake2xb_init( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||
int blake2xb_update( blake2xb_state *S, const void *in, size_t inlen );
|
||||
int blake2xb_final(blake2xb_state *S, void *out, size_t outlen);
|
||||
int blake2xb_init( blake2xb_state *S, const size_t outlen );
|
||||
int blake2xb_init_key( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||
int blake2xb_update( blake2xb_state *S, const void *in, size_t inlen );
|
||||
int blake2xb_final(blake2xb_state *S, void *out, size_t outlen);
|
||||
|
||||
/* Simple API */
|
||||
int blake2s( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
BLAKE2 reference source code package - reference C implementations
|
||||
|
||||
Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
|
||||
Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
|
||||
|
||||
|
||||
Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
|
||||
Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
|
||||
|
||||
You may use this under the terms of the CC0, the OpenSSL Licence, or
|
||||
the Apache Public License 2.0, at your option. The terms of these
|
||||
licenses can be found at:
|
||||
|
||||
|
||||
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
More information about the BLAKE2 hash function can be found at
|
||||
https://blake2.net.
|
||||
*/
|
||||
@ -23,8 +23,11 @@
|
||||
#include "blake2.h"
|
||||
#include "blake2-impl.h"
|
||||
|
||||
int blake2xb_init( blake2xb_state *S, const size_t outlen ) {
|
||||
return blake2xb_init_key(S, outlen, NULL, 0);
|
||||
}
|
||||
|
||||
int blake2xb_init( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen)
|
||||
int blake2xb_init_key( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen)
|
||||
{
|
||||
if ( outlen == 0 || outlen > 0xFFFFFFFFUL ) {
|
||||
return -1;
|
||||
@ -150,7 +153,7 @@ int blake2xb(void *out, size_t outlen, const void *in, size_t inlen, const void
|
||||
return -1;
|
||||
|
||||
/* Initialize the root block structure */
|
||||
if (blake2xb_init(S, outlen, key, keylen) < 0) {
|
||||
if (blake2xb_init_key(S, outlen, key, keylen) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -204,7 +207,7 @@ int main( void )
|
||||
size_t mlen = BLAKE2_KAT_LENGTH;
|
||||
int err = 0;
|
||||
|
||||
if( (err = blake2xb_init(&S, outlen, key, BLAKE2B_KEYBYTES)) < 0 ) {
|
||||
if( (err = blake2xb_init_key(&S, outlen, key, BLAKE2B_KEYBYTES)) < 0 ) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,11 @@
|
||||
#include "blake2.h"
|
||||
#include "blake2-impl.h"
|
||||
|
||||
int blake2xs_init( blake2xs_state *S, const size_t outlen ) {
|
||||
return blake2xs_init_key(S, outlen, NULL, 0);
|
||||
}
|
||||
|
||||
int blake2xs_init( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen )
|
||||
int blake2xs_init_key( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen )
|
||||
{
|
||||
if ( outlen == 0 || outlen > 0xFFFFUL ) {
|
||||
return -1;
|
||||
@ -34,7 +37,7 @@ int blake2xs_init( blake2xs_state *S, const size_t outlen, const void *key, size
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (NULL == key & keylen > 0) {
|
||||
if (NULL == key && keylen > 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -148,7 +151,7 @@ int blake2xs(void *out, size_t outlen, const void *in, size_t inlen, const void
|
||||
return -1;
|
||||
|
||||
/* Initialize the root block structure */
|
||||
if (blake2xs_init(S, outlen, key, keylen) < 0) {
|
||||
if (blake2xs_init_key(S, outlen, key, keylen) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -202,7 +205,7 @@ int main( void )
|
||||
size_t mlen = BLAKE2_KAT_LENGTH;
|
||||
int err = 0;
|
||||
|
||||
if( (err = blake2xs_init(&S, outlen, key, BLAKE2S_KEYBYTES)) < 0 ) {
|
||||
if( (err = blake2xs_init_key(&S, outlen, key, BLAKE2S_KEYBYTES)) < 0 ) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user