diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 58132e35..99ad68d4 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -10,6 +10,7 @@ libsodium_la_SOURCES = \ crypto_auth/hmacsha512256/ref/api.h \ crypto_auth/hmacsha512256/ref/hmac_hmacsha512256.c \ crypto_auth/hmacsha512256/ref/verify_hmacsha512256.c \ + crypto_box/crypto_box.c \ crypto_box/curve25519xsalsa20poly1305/ref/api.h \ crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c \ crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c \ diff --git a/src/libsodium/crypto_box/crypto_box.c b/src/libsodium/crypto_box/crypto_box.c new file mode 100644 index 00000000..cbdaded7 --- /dev/null +++ b/src/libsodium/crypto_box/crypto_box.c @@ -0,0 +1,41 @@ + +#include "crypto_box.h" + +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) +{ + 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) +{ + 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) +{ + 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) +{ + 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) +{ + return crypto_box_curve25519xsalsa20poly1305_open(m, c, clen, n, pk, sk); +} diff --git a/src/libsodium/include/sodium/crypto_box.h b/src/libsodium/include/sodium/crypto_box.h index ecca5b37..e132f5bf 100644 --- a/src/libsodium/include/sodium/crypto_box.h +++ b/src/libsodium/include/sodium/crypto_box.h @@ -3,12 +3,6 @@ #include "crypto_box_curve25519xsalsa20poly1305.h" -#define crypto_box crypto_box_curve25519xsalsa20poly1305 -#define crypto_box_open crypto_box_curve25519xsalsa20poly1305_open -#define crypto_box_keypair crypto_box_curve25519xsalsa20poly1305_keypair -#define crypto_box_beforenm crypto_box_curve25519xsalsa20poly1305_beforenm -#define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_afternm -#define crypto_box_open_afternm crypto_box_curve25519xsalsa20poly1305_open_afternm #define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES #define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES #define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES @@ -18,4 +12,25 @@ #define crypto_box_MACBYTES crypto_box_curve25519xsalsa20poly1305_MACBYTES #define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305" +int crypto_box_keypair(unsigned char *pk, unsigned char *sk); + +int crypto_box_beforenm(unsigned char *k, const unsigned char *pk, + const unsigned char *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_open_afternm(unsigned char *m, const unsigned char *c, + unsigned long long clen, const unsigned char *n, + const unsigned char *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_open(unsigned char *m, const unsigned char *c, + unsigned long long clen, const unsigned char *n, + const unsigned char *pk, const unsigned char *sk); + #endif