From: Loup Vaillant Date: Sat, 11 Nov 2017 18:17:03 +0000 (+0100) Subject: Renamed crypto_poly1305_auth to crypto_poly1305 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=75d509e790fb9bd09ed27c766d4e0bb59144c0d8;p=Monocypher.git Renamed crypto_poly1305_auth to crypto_poly1305 --- diff --git a/doc/man/man3/crypto_poly1305_auth.3monocypher b/doc/man/man3/crypto_poly1305.3monocypher similarity index 97% rename from doc/man/man3/crypto_poly1305_auth.3monocypher rename to doc/man/man3/crypto_poly1305.3monocypher index dbece62..92640ce 100644 --- a/doc/man/man3/crypto_poly1305_auth.3monocypher +++ b/doc/man/man3/crypto_poly1305.3monocypher @@ -2,7 +2,7 @@ .Dt CRYPTO_POLY1305_AUTH 3MONOCYPHER .Os .Sh NAME -.Nm crypto_poly1305_auth , +.Nm crypto_poly1305 , .Nm crypto_poly1305_init , .Nm crypto_poly1305_update , .Nm crypto_poly1305_final @@ -10,7 +10,7 @@ .Sh SYNOPSIS .In monocypher.h .Ft void -.Fo crypto_poly1305_auth +.Fo crypto_poly1305 .Fa "uint8_t mac[16]" .Fa "const uint8_t *message" .Fa "size_t message_size" @@ -45,7 +45,7 @@ Poly1305 is a low-level primitive. Consider using authenticated encryption, implemented by .Xr crypto_lock 3monocypher . .Ss Direct interface -.Fn crypto_poly1305_auth +.Fn crypto_poly1305 produces a message authentication code for the given message and authentication key. The authentication key must be used only once. @@ -84,7 +84,7 @@ To authenticate a message: const uint8_t msg[500]; /* Message to authenticate */ const uint8_t key[ 32]; /* Random secret key (use only once) */ uint8_t mac[ 16]; /* Message authentication code (MAC) */ -crypto_poly1305_auth(mac, msg, 500, key); +crypto_poly1305(mac, msg, 500, key); crypto_wipe(key, 32); /* The key should be wiped after use */ .Ed .Pp @@ -94,7 +94,7 @@ const uint8_t msg [500]; /* Message to verify */ const uint8_t key [ 32]; /* The above key */ const uint8_t mac [ 16]; /* The above MAC */ uint8_t real_mac[ 16]; /* The actual MAC */ -crypto_poly1305_auth(real_mac, msg, 500, key); +crypto_poly1305(real_mac, msg, 500, key); crypto_wipe(key, 32); /* Wipe right away */ if (crypto_verify16(mac, real_mac)) { /* The message is corrupted */ diff --git a/doc/man/man3/crypto_poly1305_final.3monocypher b/doc/man/man3/crypto_poly1305_final.3monocypher index d516dbd..861ea25 120000 --- a/doc/man/man3/crypto_poly1305_final.3monocypher +++ b/doc/man/man3/crypto_poly1305_final.3monocypher @@ -1 +1 @@ -crypto_poly1305_auth.3monocypher \ No newline at end of file +crypto_poly1305.3monocypher \ No newline at end of file diff --git a/doc/man/man3/crypto_poly1305_init.3monocypher b/doc/man/man3/crypto_poly1305_init.3monocypher index d516dbd..861ea25 120000 --- a/doc/man/man3/crypto_poly1305_init.3monocypher +++ b/doc/man/man3/crypto_poly1305_init.3monocypher @@ -1 +1 @@ -crypto_poly1305_auth.3monocypher \ No newline at end of file +crypto_poly1305.3monocypher \ No newline at end of file diff --git a/doc/man/man3/crypto_poly1305_update.3monocypher b/doc/man/man3/crypto_poly1305_update.3monocypher index d516dbd..861ea25 120000 --- a/doc/man/man3/crypto_poly1305_update.3monocypher +++ b/doc/man/man3/crypto_poly1305_update.3monocypher @@ -1 +1 @@ -crypto_poly1305_auth.3monocypher \ No newline at end of file +crypto_poly1305.3monocypher \ No newline at end of file diff --git a/doc/man/man3/intro.3monocypher b/doc/man/man3/intro.3monocypher index afb41de..0e01de8 100644 --- a/doc/man/man3/intro.3monocypher +++ b/doc/man/man3/intro.3monocypher @@ -87,7 +87,7 @@ the chances of leaks. .Xr crypto_lock_final 3monocypher , .Xr crypto_lock_init 3monocypher , .Xr crypto_lock_update 3monocypher , -.Xr crypto_poly1305_auth 3monocypher , +.Xr crypto_poly1305 3monocypher , .Xr crypto_poly1305_final 3monocypher , .Xr crypto_poly1305_init 3monocypher , .Xr crypto_poly1305_update 3monocypher , diff --git a/src/monocypher.c b/src/monocypher.c index 5b263dd..9f4b258 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -426,8 +426,8 @@ void crypto_poly1305_final(crypto_poly1305_ctx *ctx, u8 mac[16]) crypto_wipe(ctx, sizeof(*ctx)); } -void crypto_poly1305_auth(u8 mac[16], const u8 *message, - size_t message_size, const u8 key[32]) +void crypto_poly1305(u8 mac[16], const u8 *message, + size_t message_size, const u8 key[32]) { crypto_poly1305_ctx ctx; crypto_poly1305_init (&ctx, key); diff --git a/src/monocypher.h b/src/monocypher.h index de439bf..713d225 100644 --- a/src/monocypher.h +++ b/src/monocypher.h @@ -69,9 +69,12 @@ void crypto_poly1305_update(crypto_poly1305_ctx *ctx, void crypto_poly1305_final(crypto_poly1305_ctx *ctx, uint8_t mac[16]); -void crypto_poly1305_auth(uint8_t mac[16], - const uint8_t *message, size_t message_size, - const uint8_t key[32]); +void crypto_poly1305(uint8_t mac[16], + const uint8_t *message, size_t message_size, + const uint8_t key[32]); + +// Deprecated name +#define crypto_poly1305_auth crypto_poly1305 //////////////// /// Blake2 b /// diff --git a/tests/speed.c b/tests/speed.c index 64fac0f..a03818a 100644 --- a/tests/speed.c +++ b/tests/speed.c @@ -89,7 +89,7 @@ static u64 poly1305(void) static u8 out [ 16]; TIMING_START { - crypto_poly1305_auth(out, in, SIZE, key); + crypto_poly1305(out, in, SIZE, key); } TIMING_END; } diff --git a/tests/test.c b/tests/test.c index de98836..ecaaad7 100644 --- a/tests/test.c +++ b/tests/test.c @@ -111,7 +111,7 @@ static void poly1305(const vector in[], vector *out) { const vector *key = in; const vector *msg = in + 1; - crypto_poly1305_auth(out->buf, msg->buf, msg->size, key->buf); + crypto_poly1305(out->buf, msg->buf, msg->size, key->buf); } static void blake2b(const vector in[], vector *out) @@ -348,7 +348,7 @@ static int p_poly1305() crypto_poly1305_final(&ctx, mac_chunk); // Authenticate all at once - crypto_poly1305_auth(mac_whole, input, offset, key); + crypto_poly1305(mac_whole, input, offset, key); // Compare the results (must be the same) status |= memcmp(mac_chunk, mac_whole, 16); @@ -367,8 +367,8 @@ static int p_poly1305_overlap() u8 input[INPUT_SIZE]; p_random(input, INPUT_SIZE); u8 key [32]; p_random(key , 32); u8 mac [16]; - crypto_poly1305_auth(mac , input + 16, POLY1305_BLOCK_SIZE, key); - crypto_poly1305_auth(input+i, input + 16, POLY1305_BLOCK_SIZE, key); + crypto_poly1305(mac , input + 16, POLY1305_BLOCK_SIZE, key); + crypto_poly1305(input+i, input + 16, POLY1305_BLOCK_SIZE, key); status |= memcmp(mac, input + i, 16); } printf("%s: Poly1305 (overlaping i/o)\n", status != 0 ? "FAILED" : "OK");