diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 99ad68d4..01160669 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -30,6 +30,7 @@ libsodium_la_SOURCES = \ crypto_generichash/blake2/ref/blake2b-ref.c \ crypto_generichash/blake2/ref/blake2s-ref.c \ crypto_generichash/blake2/ref/generichash_blake2b.c \ + crypto_hash/crypto_hash.c \ crypto_hash/sha256/ref/api.h \ crypto_hash/sha256/ref/hash_sha256.c \ crypto_hash/sha512/ref/api.h \ diff --git a/src/libsodium/crypto_auth/crypto_auth.c b/src/libsodium/crypto_auth/crypto_auth.c index 57b3a005..cd07db54 100644 --- a/src/libsodium/crypto_auth/crypto_auth.c +++ b/src/libsodium/crypto_auth/crypto_auth.c @@ -1,14 +1,16 @@ #include "crypto_auth.h" -int crypto_auth(unsigned char *out, const unsigned char *in, - unsigned long long inlen, const unsigned char *k) +int +crypto_auth(unsigned char *out, const unsigned char *in, + unsigned long long inlen, const unsigned char *k) { return crypto_auth_hmacsha512256(out, in, inlen, k); } -int crypto_auth_verify(const unsigned char *h, const unsigned char *in, - unsigned long long inlen,const unsigned char *k) +int +crypto_auth_verify(const unsigned char *h, const unsigned char *in, + unsigned long long inlen,const unsigned char *k) { return crypto_auth_hmacsha512256_verify(h, in, inlen, k); } diff --git a/src/libsodium/crypto_box/crypto_box.c b/src/libsodium/crypto_box/crypto_box.c index cbdaded7..651bd4e2 100644 --- a/src/libsodium/crypto_box/crypto_box.c +++ b/src/libsodium/crypto_box/crypto_box.c @@ -1,41 +1,47 @@ #include "crypto_box.h" -int crypto_box_keypair(unsigned char *pk, unsigned char *sk) +int +crypto_box_keypair(unsigned char *pk, unsigned char *sk) { return crypto_box_curve25519xsalsa20poly1305_keypair(pk, sk); } -int crypto_box_beforenm(unsigned char *k, const unsigned char *pk, - const unsigned char *sk) +int +crypto_box_beforenm(unsigned char *k, const unsigned char *pk, + const unsigned char *sk) { return crypto_box_curve25519xsalsa20poly1305_beforenm(k, pk, sk); } -int crypto_box_afternm(unsigned char *c, const unsigned char *m, - unsigned long long mlen, const unsigned char *n, - const unsigned char *k) +int +crypto_box_afternm(unsigned char *c, const unsigned char *m, + unsigned long long mlen, const unsigned char *n, + const unsigned char *k) { return crypto_box_curve25519xsalsa20poly1305_afternm(c, m, mlen, n, k); } -int crypto_box_open_afternm(unsigned char *m, const unsigned char *c, - unsigned long long clen, const unsigned char *n, - const unsigned char *k) +int +crypto_box_open_afternm(unsigned char *m, const unsigned char *c, + unsigned long long clen, const unsigned char *n, + const unsigned char *k) { return crypto_box_curve25519xsalsa20poly1305_open_afternm(m, c, clen, m, k); } -int crypto_box(unsigned char *c, const unsigned char *m, - unsigned long long mlen, const unsigned char *n, - const unsigned char *pk, const unsigned char *sk) +int +crypto_box(unsigned char *c, const unsigned char *m, + unsigned long long mlen, const unsigned char *n, + const unsigned char *pk, const unsigned char *sk) { return crypto_box_curve25519xsalsa20poly1305(c, m, mlen, n, pk, sk); } -int crypto_box_open(unsigned char *m, const unsigned char *c, - unsigned long long clen, const unsigned char *n, - const unsigned char *pk, const unsigned char *sk) +int +crypto_box_open(unsigned char *m, const unsigned char *c, + unsigned long long clen, const unsigned char *n, + const unsigned char *pk, const unsigned char *sk) { return crypto_box_curve25519xsalsa20poly1305_open(m, c, clen, n, pk, sk); } diff --git a/src/libsodium/crypto_hash/crypto_hash.c b/src/libsodium/crypto_hash/crypto_hash.c new file mode 100644 index 00000000..2718b494 --- /dev/null +++ b/src/libsodium/crypto_hash/crypto_hash.c @@ -0,0 +1,9 @@ + +#include "crypto_hash.h" + +int +crypto_hash(unsigned char *out, const unsigned char *in, + unsigned long long inlen) +{ + return crypto_hash_sha512(out, in, inlen); +} diff --git a/src/libsodium/include/sodium/crypto_hash.h b/src/libsodium/include/sodium/crypto_hash.h index b4822e7e..41dfe8a2 100644 --- a/src/libsodium/include/sodium/crypto_hash.h +++ b/src/libsodium/include/sodium/crypto_hash.h @@ -3,8 +3,10 @@ #include "crypto_hash_sha512.h" -#define crypto_hash crypto_hash_sha512 #define crypto_hash_BYTES crypto_hash_sha512_BYTES #define crypto_hash_PRIMITIVE "sha512" +int crypto_hash(unsigned char *out, const unsigned char *in, + unsigned long long inlen); + #endif