mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-26 11:47:13 +09:00
Wrap crypto_generichash() and add necessary macros.
The streaming API will be wrapped next.
This commit is contained in:
@@ -24,6 +24,7 @@ libsodium_la_SOURCES = \
|
||||
crypto_core/salsa2012/ref/api.h \
|
||||
crypto_core/salsa208/ref/core_salsa208.c \
|
||||
crypto_core/salsa208/ref/api.h \
|
||||
crypto_generichash/crypto_generichash.c \
|
||||
crypto_generichash/blake2/ref/api.h \
|
||||
crypto_generichash/blake2/ref/blake2-impl.h \
|
||||
crypto_generichash/blake2/ref/blake2.h \
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
#include "crypto_generichash.h"
|
||||
|
||||
int
|
||||
crypto_generichash(unsigned char *out, const unsigned char *in,
|
||||
const unsigned char *key,
|
||||
size_t outlen, unsigned long long inlen, size_t keylen)
|
||||
{
|
||||
return crypto_generichash_blake2b(out, in, key, outlen, inlen, keylen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ SODIUM_EXPORT = \
|
||||
sodium/crypto_core_salsa20.h \
|
||||
sodium/crypto_core_salsa2012.h \
|
||||
sodium/crypto_core_salsa208.h \
|
||||
sodium/crypto_generichash.h \
|
||||
sodium/crypto_generichash_blake2b.h \
|
||||
sodium/crypto_hash.h \
|
||||
sodium/crypto_hash_sha256.h \
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef crypto_generichash_H
|
||||
#define crypto_generichash_H
|
||||
|
||||
#include "crypto_generichash_blake2b.h"
|
||||
|
||||
#define crypto_generichash_BYTES_MIN crypto_generichash_blake2b_BYTES_MIN
|
||||
#define crypto_generichash_BYTES_MAX crypto_generichash_blake2b_BYTES_MAX
|
||||
#define crypto_generichash_KEYBYTES_MIN crypto_generichash_blake2b_KEYBYTES_MIN
|
||||
#define crypto_generichash_KEYBYTES_MAX crypto_generichash_blake2b_KEYBYTES_MAX
|
||||
#define crypto_generichash_PRIMITIVE "blake2b"
|
||||
|
||||
int crypto_generichash(unsigned char *out, const unsigned char *in,
|
||||
const unsigned char *key,
|
||||
size_t outlen, unsigned long long inlen,
|
||||
size_t keylen);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
#ifndef crypto_generichash_blake2b_H
|
||||
#define crypto_generichash_blake2b_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define crypto_generichash_blake2b_BYTES_MIN 1U
|
||||
#define crypto_generichash_blake2b_BYTES_MAX 64U
|
||||
#define crypto_generichash_blake2b_KEYBYTES_MIN 0U
|
||||
#define crypto_generichash_blake2b_KEYBYTES_MAX 64U
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
extern int crypto_generichash_blake2b_ref(unsigned char *out,
|
||||
const unsigned char *in,
|
||||
const unsigned char *key,
|
||||
size_t outlen, unsigned long long inlen,
|
||||
size_t keylen);
|
||||
int crypto_generichash_blake2b_ref(unsigned char *out,
|
||||
const unsigned char *in,
|
||||
const unsigned char *key,
|
||||
size_t outlen,
|
||||
unsigned long long inlen,
|
||||
size_t keylen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user