From f95a79065bf5f840790c963a8f5de0df7c81f947 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 21 Nov 2015 12:56:46 +0100 Subject: [PATCH] api.h removal --- src/libsodium/Makefile.am | 2 -- .../ref/after_curve25519xsalsa20poly1305.c | 6 +++--- .../curve25519xsalsa20poly1305/ref/api.h | 20 ------------------- .../ref/before_curve25519xsalsa20poly1305.c | 4 ++-- .../ref/box_curve25519xsalsa20poly1305.c | 18 ++++++++--------- .../ref/keypair_curve25519xsalsa20poly1305.c | 6 +++--- src/libsodium/crypto_sign/ed25519/ref10/api.h | 15 -------------- .../crypto_sign/ed25519/ref10/keypair.c | 14 ++++++------- .../crypto_sign/ed25519/ref10/open.c | 16 ++++++++------- .../crypto_sign/ed25519/ref10/sign.c | 19 +++++++++--------- 10 files changed, 43 insertions(+), 77 deletions(-) delete mode 100644 src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h delete mode 100644 src/libsodium/crypto_sign/ed25519/ref10/api.h diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 33f09966..d8beed58 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -17,7 +17,6 @@ libsodium_la_SOURCES = \ crypto_box/crypto_box_easy.c \ crypto_box/crypto_box_seal.c \ crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c \ - crypto_box/curve25519xsalsa20poly1305/ref/api.h \ crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c \ crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c \ crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c \ @@ -70,7 +69,6 @@ libsodium_la_SOURCES = \ crypto_sign/ed25519/ref10/base.h \ crypto_sign/ed25519/ref10/base2.h \ crypto_sign/ed25519/sign_ed25519_api.c \ - crypto_sign/ed25519/ref10/api.h \ crypto_sign/ed25519/ref10/d.h \ crypto_sign/ed25519/ref10/d2.h \ crypto_sign/ed25519/ref10/fe.h \ diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c index a830936b..c35ca2e5 100644 --- a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c @@ -1,7 +1,7 @@ -#include "api.h" +#include "crypto_box_curve25519xsalsa20poly1305.h" #include "crypto_secretbox_xsalsa20poly1305.h" -int crypto_box_afternm( +int crypto_box_curve25519xsalsa20poly1305_afternm( unsigned char *c, const unsigned char *m,unsigned long long mlen, const unsigned char *n, @@ -11,7 +11,7 @@ int crypto_box_afternm( return crypto_secretbox_xsalsa20poly1305(c,m,mlen,n,k); } -int crypto_box_open_afternm( +int crypto_box_curve25519xsalsa20poly1305_open_afternm( unsigned char *m, const unsigned char *c,unsigned long long clen, const unsigned char *n, diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h deleted file mode 100644 index 7f320c6f..00000000 --- a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h +++ /dev/null @@ -1,20 +0,0 @@ - -#include "crypto_box_curve25519xsalsa20poly1305.h" - -#define crypto_box crypto_box_curve25519xsalsa20poly1305 -#define crypto_box_open crypto_box_curve25519xsalsa20poly1305_open -#define crypto_box_seed_keypair crypto_box_curve25519xsalsa20poly1305_seed_keypair -#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_SEEDBYTES crypto_box_curve25519xsalsa20poly1305_SEEDBYTES -#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES -#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES -#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES -#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES -#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES -#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES -#define crypto_box_MACBYTES (crypto_box_ZEROBYTES - crypto_box_BOXZEROBYTES) -#define crypto_box_IMPLEMENTATION crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION -#define crypto_box_VERSION crypto_box_curve25519xsalsa20poly1305_VERSION diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c index d8e2f7b3..2440c82e 100644 --- a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c @@ -1,4 +1,4 @@ -#include "api.h" +#include "crypto_box_curve25519xsalsa20poly1305.h" #include "crypto_core_hsalsa20.h" #include "crypto_scalarmult_curve25519.h" @@ -7,7 +7,7 @@ static const unsigned char sigma[16] = { }; static const unsigned char n[16] = {0}; -int crypto_box_beforenm( +int crypto_box_curve25519xsalsa20poly1305_beforenm( unsigned char *k, const unsigned char *pk, const unsigned char *sk diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c index dc616799..fdaa5e01 100644 --- a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c @@ -1,7 +1,7 @@ -#include "api.h" +#include "crypto_box_curve25519xsalsa20poly1305.h" #include "utils.h" -int crypto_box( +int crypto_box_curve25519xsalsa20poly1305( unsigned char *c, const unsigned char *m,unsigned long long mlen, const unsigned char *n, @@ -9,19 +9,19 @@ int crypto_box( const unsigned char *sk ) { - unsigned char k[crypto_box_BEFORENMBYTES]; + unsigned char k[crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES]; int ret; - if (crypto_box_beforenm(k,pk,sk) != 0) { + if (crypto_box_curve25519xsalsa20poly1305_beforenm(k,pk,sk) != 0) { return -1; } - ret = crypto_box_afternm(c,m,mlen,n,k); + ret = crypto_box_curve25519xsalsa20poly1305_afternm(c,m,mlen,n,k); sodium_memzero(k, sizeof k); return ret; } -int crypto_box_open( +int crypto_box_curve25519xsalsa20poly1305_open( unsigned char *m, const unsigned char *c,unsigned long long clen, const unsigned char *n, @@ -29,13 +29,13 @@ int crypto_box_open( const unsigned char *sk ) { - unsigned char k[crypto_box_BEFORENMBYTES]; + unsigned char k[crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES]; int ret; - if (crypto_box_beforenm(k,pk,sk) != 0) { + if (crypto_box_curve25519xsalsa20poly1305_beforenm(k,pk,sk) != 0) { return -1; } - ret = crypto_box_open_afternm(m,c,clen,n,k); + ret = crypto_box_curve25519xsalsa20poly1305_open_afternm(m,c,clen,n,k); sodium_memzero(k, sizeof k); return ret; diff --git a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c index 64ec31e9..60efce46 100644 --- a/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c +++ b/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c @@ -1,12 +1,12 @@ #include +#include "crypto_box_curve25519xsalsa20poly1305.h" #include "crypto_hash_sha512.h" #include "crypto_scalarmult_curve25519.h" -#include "api.h" #include "randombytes.h" #include "utils.h" -int crypto_box_seed_keypair( +int crypto_box_curve25519xsalsa20poly1305_seed_keypair( unsigned char *pk, unsigned char *sk, const unsigned char *seed @@ -19,7 +19,7 @@ int crypto_box_seed_keypair( return crypto_scalarmult_curve25519_base(pk,sk); } -int crypto_box_keypair( +int crypto_box_curve25519xsalsa20poly1305_keypair( unsigned char *pk, unsigned char *sk ) diff --git a/src/libsodium/crypto_sign/ed25519/ref10/api.h b/src/libsodium/crypto_sign/ed25519/ref10/api.h deleted file mode 100644 index 0106cf13..00000000 --- a/src/libsodium/crypto_sign/ed25519/ref10/api.h +++ /dev/null @@ -1,15 +0,0 @@ - -#include "crypto_sign_ed25519.h" - -#define crypto_sign crypto_sign_ed25519 -#define crypto_sign_detached crypto_sign_ed25519_detached -#define crypto_sign_open crypto_sign_ed25519_open -#define crypto_sign_verify_detached crypto_sign_ed25519_verify_detached -#define crypto_sign_keypair crypto_sign_ed25519_keypair -#define crypto_sign_seed_keypair crypto_sign_ed25519_seed_keypair -#define crypto_sign_BYTES crypto_sign_ed25519_BYTES -#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES -#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES -#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES -#define crypto_sign_IMPLEMENTATION crypto_sign_ed25519_IMPLEMENTATION -#define crypto_sign_VERSION crypto_sign_ed25519_VERSION diff --git a/src/libsodium/crypto_sign/ed25519/ref10/keypair.c b/src/libsodium/crypto_sign/ed25519/ref10/keypair.c index b6335f39..8beb1d63 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/keypair.c @@ -1,16 +1,16 @@ #include -#include "api.h" +#include "crypto_sign_ed25519.h" #include "crypto_hash_sha512.h" #include "crypto_scalarmult_curve25519.h" -#include "randombytes.h" -#include "utils.h" #include "fe.h" #include "ge.h" +#include "randombytes.h" +#include "utils.h" -int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk, - const unsigned char *seed) +int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk, + const unsigned char *seed) { ge_p3 A; @@ -27,13 +27,13 @@ int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk, return 0; } -int crypto_sign_keypair(unsigned char *pk, unsigned char *sk) +int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk) { unsigned char seed[32]; int ret; randombytes_buf(seed, sizeof seed); - ret = crypto_sign_seed_keypair(pk, sk, seed); + ret = crypto_sign_ed25519_seed_keypair(pk, sk, seed); sodium_memzero(seed, sizeof seed); return ret; diff --git a/src/libsodium/crypto_sign/ed25519/ref10/open.c b/src/libsodium/crypto_sign/ed25519/ref10/open.c index cf265ec6..2ee48ba8 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/open.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/open.c @@ -3,16 +3,18 @@ #include #include -#include "api.h" #include "crypto_hash_sha512.h" +#include "crypto_sign_ed25519.h" #include "crypto_verify_32.h" #include "ge.h" #include "sc.h" #include "utils.h" int -crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m, - unsigned long long mlen, const unsigned char *pk) +crypto_sign_ed25519_verify_detached(const unsigned char *sig, + const unsigned char *m, + unsigned long long mlen, + const unsigned char *pk) { crypto_hash_sha512_state hs; unsigned char h[64]; @@ -49,9 +51,9 @@ crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m, } int -crypto_sign_open(unsigned char *m, unsigned long long *mlen_p, - const unsigned char *sm, unsigned long long smlen, - const unsigned char *pk) +crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p, + const unsigned char *sm, unsigned long long smlen, + const unsigned char *pk) { unsigned long long mlen; @@ -59,7 +61,7 @@ crypto_sign_open(unsigned char *m, unsigned long long *mlen_p, goto badsig; } mlen = smlen - 64; - if (crypto_sign_verify_detached(sm, sm + 64, mlen, pk) != 0) { + if (crypto_sign_ed25519_verify_detached(sm, sm + 64, mlen, pk) != 0) { memset(m, 0, mlen); goto badsig; } diff --git a/src/libsodium/crypto_sign/ed25519/ref10/sign.c b/src/libsodium/crypto_sign/ed25519/ref10/sign.c index 8e2a134b..f3f51865 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/sign.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/sign.c @@ -1,16 +1,16 @@ #include -#include "api.h" #include "crypto_hash_sha512.h" +#include "crypto_sign_ed25519.h" #include "ge.h" #include "sc.h" #include "utils.h" int -crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p, - const unsigned char *m, unsigned long long mlen, - const unsigned char *sk) +crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p, + const unsigned char *m, unsigned long long mlen, + const unsigned char *sk) { crypto_hash_sha512_state hs; unsigned char az[64]; @@ -51,16 +51,17 @@ crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p, } int -crypto_sign(unsigned char *sm, unsigned long long *smlen_p, - const unsigned char *m, unsigned long long mlen, - const unsigned char *sk) +crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p, + const unsigned char *m, unsigned long long mlen, + const unsigned char *sk) { unsigned long long siglen; memmove(sm + crypto_sign_ed25519_BYTES, m, mlen); /* LCOV_EXCL_START */ - if (crypto_sign_detached(sm, &siglen, sm + crypto_sign_ed25519_BYTES, - mlen, sk) != 0 || + if (crypto_sign_ed25519_detached(sm, &siglen, + sm + crypto_sign_ed25519_BYTES, + mlen, sk) != 0 || siglen != crypto_sign_ed25519_BYTES) { if (smlen_p != NULL) { *smlen_p = 0;