]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Delete name mangling of internal Chacha symbols
authorNiels Möller <nisse@lysator.liu.se>
Mon, 30 Nov 2020 12:44:17 +0000 (13:44 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 30 Nov 2020 12:44:17 +0000 (13:44 +0100)
ChangeLog
chacha-core-internal.c
chacha-crypt.c
chacha-internal.h
chacha-poly1305.c
testsuite/chacha-test.c

index 2a355ba5a05b6b1b953ecd92626feb0fe0408ced..1dce809442f368064ea83d8be0326a66800c1ef3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
        * aes-internal.h: Delete name mangling of internal symbols. Update
        all internal references to use _nettle prefix.
        * camellia-internal.h: Likewise.
+       * chacha-internal.h: Likewise.
        * ctr-internal.h: Likewise.
        * dsa-internal.h: Likewise.
 
index 0905834e356c834b06e3026e24e73f899dbcae49..23e6833408493174265c73d811f63172dc9ed390 100644 (file)
@@ -96,7 +96,7 @@ _nettle_chacha_core_c(uint32_t *dst, const uint32_t *src, unsigned rounds);
   } while(0)
 
 void
-_chacha_core(uint32_t *dst, const uint32_t *src, unsigned rounds)
+_nettle_chacha_core(uint32_t *dst, const uint32_t *src, unsigned rounds)
 {
   uint32_t x[_CHACHA_STATE_LENGTH];
   unsigned i;
index 0d6ecee128a00bf5b7adce0f8bfde1f1301cbf4f..58d0b0c287e03d32990e111c765c084a067ea76a 100644 (file)
 #define CHACHA_ROUNDS 20
 
 #if HAVE_NATIVE_chacha_3core
-#undef _chacha_crypt_3core
-#undef _chacha_crypt32_3core
-#define _chacha_crypt_3core chacha_crypt
-#define _chacha_crypt32_3core chacha_crypt32
+#define _nettle_chacha_crypt_3core chacha_crypt
+#define _nettle_chacha_crypt32_3core chacha_crypt32
 #elif HAVE_NATIVE_chacha_2core
-#undef _chacha_crypt_2core
-#undef _chacha_crypt32_2core
-#define _chacha_crypt_2core chacha_crypt
-#define _chacha_crypt32_2core chacha_crypt32
+#define _nettle_chacha_crypt_2core chacha_crypt
+#define _nettle_chacha_crypt32_2core chacha_crypt32
 #elif !(HAVE_NATIVE_fat_chacha_3core || HAVE_NATIVE_fat_chacha_2core)
-#undef _chacha_crypt_1core
-#undef _chacha_crypt32_1core
-#define _chacha_crypt_1core chacha_crypt
-#define _chacha_crypt32_1core chacha_crypt32
+#define _nettle_chacha_crypt_1core chacha_crypt
+#define _nettle_chacha_crypt32_1core chacha_crypt32
 #endif
 
 #if HAVE_NATIVE_chacha_3core || HAVE_NATIVE_fat_chacha_3core
 void
-_chacha_crypt_3core(struct chacha_ctx *ctx,
-                   size_t length,
-                   uint8_t *dst,
-                   const uint8_t *src)
+_nettle_chacha_crypt_3core(struct chacha_ctx *ctx,
+                          size_t length,
+                          uint8_t *dst,
+                          const uint8_t *src)
 {
   uint32_t x[3*_CHACHA_STATE_LENGTH];
 
@@ -85,7 +79,7 @@ _chacha_crypt_3core(struct chacha_ctx *ctx,
 
   while (length > 2*CHACHA_BLOCK_SIZE)
     {
-      _chacha_3core (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_3core (x, ctx->state, CHACHA_ROUNDS);
       ctx->state[12] += 3;
       ctx->state[13] += (ctx->state[12] < 3);
       if (length <= 3*CHACHA_BLOCK_SIZE)
@@ -101,12 +95,12 @@ _chacha_crypt_3core(struct chacha_ctx *ctx,
     }
   if (length <= CHACHA_BLOCK_SIZE)
     {
-      _chacha_core (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_core (x, ctx->state, CHACHA_ROUNDS);
       ctx->state[13] += (++ctx->state[12] == 0);
     }
   else
     {
-      _chacha_3core (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_3core (x, ctx->state, CHACHA_ROUNDS);
       ctx->state[12] += 2;
       ctx->state[13] += (ctx->state[12] < 2);
     }
@@ -116,10 +110,10 @@ _chacha_crypt_3core(struct chacha_ctx *ctx,
 
 #if HAVE_NATIVE_chacha_2core || HAVE_NATIVE_fat_chacha_2core
 void
-_chacha_crypt_2core(struct chacha_ctx *ctx,
-                   size_t length,
-                   uint8_t *dst,
-                   const uint8_t *src)
+_nettle_chacha_crypt_2core(struct chacha_ctx *ctx,
+                          size_t length,
+                          uint8_t *dst,
+                          const uint8_t *src)
 {
   uint32_t x[2*_CHACHA_STATE_LENGTH];
 
@@ -128,7 +122,7 @@ _chacha_crypt_2core(struct chacha_ctx *ctx,
 
   while (length > CHACHA_BLOCK_SIZE)
     {
-      _chacha_2core (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_2core (x, ctx->state, CHACHA_ROUNDS);
       ctx->state[12] += 2;
       ctx->state[13] += (ctx->state[12] < 2);
       if (length <= 2*CHACHA_BLOCK_SIZE)
@@ -143,7 +137,7 @@ _chacha_crypt_2core(struct chacha_ctx *ctx,
       src += 2*CHACHA_BLOCK_SIZE;
     }
 
-  _chacha_core (x, ctx->state, CHACHA_ROUNDS);
+  _nettle_chacha_core (x, ctx->state, CHACHA_ROUNDS);
   memxor3 (dst, src, x, length);
   ctx->state[13] += (++ctx->state[12] == 0);
 }
@@ -151,10 +145,10 @@ _chacha_crypt_2core(struct chacha_ctx *ctx,
 
 #if !(HAVE_NATIVE_chacha_3core || HAVE_NATIVE_chacha_2core)
 void
-_chacha_crypt_1core(struct chacha_ctx *ctx,
-                   size_t length,
-                   uint8_t *dst,
-                   const uint8_t *src)
+_nettle_chacha_crypt_1core(struct chacha_ctx *ctx,
+                          size_t length,
+                          uint8_t *dst,
+                          const uint8_t *src)
 {
   if (!length)
     return;
@@ -163,7 +157,7 @@ _chacha_crypt_1core(struct chacha_ctx *ctx,
     {
       uint32_t x[_CHACHA_STATE_LENGTH];
 
-      _chacha_core (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_core (x, ctx->state, CHACHA_ROUNDS);
 
       ctx->state[13] += (++ctx->state[12] == 0);
 
@@ -185,10 +179,10 @@ _chacha_crypt_1core(struct chacha_ctx *ctx,
 
 #if HAVE_NATIVE_chacha_3core || HAVE_NATIVE_fat_chacha_3core
 void
-_chacha_crypt32_3core(struct chacha_ctx *ctx,
-                     size_t length,
-                     uint8_t *dst,
-                     const uint8_t *src)
+_nettle_chacha_crypt32_3core(struct chacha_ctx *ctx,
+                            size_t length,
+                            uint8_t *dst,
+                            const uint8_t *src)
 {
   uint32_t x[3*_CHACHA_STATE_LENGTH];
 
@@ -197,7 +191,7 @@ _chacha_crypt32_3core(struct chacha_ctx *ctx,
 
   while (length > 2*CHACHA_BLOCK_SIZE)
     {
-      _chacha_3core32 (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_3core32 (x, ctx->state, CHACHA_ROUNDS);
       ctx->state[12] += 3;
       ctx->state[13] += (ctx->state[12] < 3);
       if (length <= 3*CHACHA_BLOCK_SIZE)
@@ -213,12 +207,12 @@ _chacha_crypt32_3core(struct chacha_ctx *ctx,
     }
   if (length <= CHACHA_BLOCK_SIZE)
     {
-      _chacha_core (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_core (x, ctx->state, CHACHA_ROUNDS);
       ctx->state[13] += (++ctx->state[12] == 0);
     }
   else
     {
-      _chacha_3core32 (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_3core32 (x, ctx->state, CHACHA_ROUNDS);
       ctx->state[12] += 2;
       ctx->state[13] += (ctx->state[12] < 2);
     }
@@ -228,10 +222,10 @@ _chacha_crypt32_3core(struct chacha_ctx *ctx,
 
 #if HAVE_NATIVE_chacha_2core || HAVE_NATIVE_fat_chacha_2core
 void
-_chacha_crypt32_2core(struct chacha_ctx *ctx,
-                   size_t length,
-                   uint8_t *dst,
-                   const uint8_t *src)
+_nettle_chacha_crypt32_2core(struct chacha_ctx *ctx,
+                            size_t length,
+                            uint8_t *dst,
+                            const uint8_t *src)
 {
   uint32_t x[2*_CHACHA_STATE_LENGTH];
 
@@ -240,7 +234,7 @@ _chacha_crypt32_2core(struct chacha_ctx *ctx,
 
   while (length > CHACHA_BLOCK_SIZE)
     {
-      _chacha_2core32 (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_2core32 (x, ctx->state, CHACHA_ROUNDS);
       ctx->state[12] += 2;
       if (length <= 2*CHACHA_BLOCK_SIZE)
        {
@@ -254,7 +248,7 @@ _chacha_crypt32_2core(struct chacha_ctx *ctx,
       src += 2*CHACHA_BLOCK_SIZE;
     }
 
-  _chacha_core (x, ctx->state, CHACHA_ROUNDS);
+  _nettle_chacha_core (x, ctx->state, CHACHA_ROUNDS);
   memxor3 (dst, src, x, length);
   ++ctx->state[12];
 }
@@ -262,10 +256,10 @@ _chacha_crypt32_2core(struct chacha_ctx *ctx,
 
 #if !(HAVE_NATIVE_chacha_3core || HAVE_NATIVE_chacha_2core)
 void
-_chacha_crypt32_1core(struct chacha_ctx *ctx,
-                     size_t length,
-                     uint8_t *dst,
-                     const uint8_t *src)
+_nettle_chacha_crypt32_1core(struct chacha_ctx *ctx,
+                            size_t length,
+                            uint8_t *dst,
+                            const uint8_t *src)
 {
   if (!length)
     return;
@@ -274,7 +268,7 @@ _chacha_crypt32_1core(struct chacha_ctx *ctx,
     {
       uint32_t x[_CHACHA_STATE_LENGTH];
 
-      _chacha_core (x, ctx->state, CHACHA_ROUNDS);
+      _nettle_chacha_core (x, ctx->state, CHACHA_ROUNDS);
 
       ++ctx->state[12];
 
index 0f790459f6b5472c100e742dc8b1d655e91f4e5e..d92a67792e79c10ca3194d95b66efccb0dfd7a3b 100644 (file)
 #include "nettle-types.h"
 #include "chacha.h"
 
-#define _chacha_core _nettle_chacha_core
-#define _chacha_2core _nettle_chacha_2core
-#define _chacha_2core32 _nettle_chacha_2core32
-#define _chacha_3core _nettle_chacha_3core
-#define _chacha_3core32 _nettle_chacha_3core32
-#define _chacha_crypt_1core _nettle_chacha_crypt_1core
-#define _chacha_crypt_2core _nettle_chacha_crypt_2core
-#define _chacha_crypt_3core _nettle_chacha_crypt_3core
-#define _chacha_crypt32_1core _nettle_chacha_crypt32_1core
-#define _chacha_crypt32_2core _nettle_chacha_crypt32_2core
-#define _chacha_crypt32_3core _nettle_chacha_crypt32_3core
-
 void
-_chacha_core(uint32_t *dst, const uint32_t *src, unsigned rounds);
+_nettle_chacha_core(uint32_t *dst, const uint32_t *src, unsigned rounds);
 
 /* Functions available only in some configurations */
 void
-_chacha_2core(uint32_t *dst, const uint32_t *src, unsigned rounds);
+_nettle_chacha_2core(uint32_t *dst, const uint32_t *src, unsigned rounds);
 
 void
-_chacha_2core32(uint32_t *dst, const uint32_t *src, unsigned rounds);
+_nettle_chacha_2core32(uint32_t *dst, const uint32_t *src, unsigned rounds);
 
 void
-_chacha_3core(uint32_t *dst, const uint32_t *src, unsigned rounds);
+_nettle_chacha_3core(uint32_t *dst, const uint32_t *src, unsigned rounds);
 
 void
-_chacha_3core32(uint32_t *dst, const uint32_t *src, unsigned rounds);
+_nettle_chacha_3core32(uint32_t *dst, const uint32_t *src, unsigned rounds);
 
 void
-_chacha_crypt_1core(struct chacha_ctx *ctx,
-                   size_t length,
-                   uint8_t *dst,
-                   const uint8_t *src);
+_nettle_chacha_crypt_1core(struct chacha_ctx *ctx,
+                          size_t length,
+                          uint8_t *dst,
+                          const uint8_t *src);
 
 void
-_chacha_crypt_2core(struct chacha_ctx *ctx,
-                   size_t length,
-                   uint8_t *dst,
-                   const uint8_t *src);
+_nettle_chacha_crypt_2core(struct chacha_ctx *ctx,
+                          size_t length,
+                          uint8_t *dst,
+                          const uint8_t *src);
 
 void
-_chacha_crypt_3core(struct chacha_ctx *ctx,
-                   size_t length,
-                   uint8_t *dst,
-                   const uint8_t *src);
+_nettle_chacha_crypt_3core(struct chacha_ctx *ctx,
+                          size_t length,
+                          uint8_t *dst,
+                          const uint8_t *src);
 
 void
-_chacha_crypt32_1core(struct chacha_ctx *ctx,
-                     size_t length,
-                     uint8_t *dst,
-                     const uint8_t *src);
+_nettle_chacha_crypt32_1core(struct chacha_ctx *ctx,
+                            size_t length,
+                            uint8_t *dst,
+                            const uint8_t *src);
 
 void
-_chacha_crypt32_2core(struct chacha_ctx *ctx,
-                     size_t length,
-                     uint8_t *dst,
-                     const uint8_t *src);
+_nettle_chacha_crypt32_2core(struct chacha_ctx *ctx,
+                            size_t length,
+                            uint8_t *dst,
+                            const uint8_t *src);
 
 void
-_chacha_crypt32_3core(struct chacha_ctx *ctx,
-                     size_t length,
-                     uint8_t *dst,
-                     const uint8_t *src);
+_nettle_chacha_crypt32_3core(struct chacha_ctx *ctx,
+                            size_t length,
+                            uint8_t *dst,
+                            const uint8_t *src);
 
 #endif /* NETTLE_CHACHA_INTERNAL_H_INCLUDED */
index 47ca86bb360d4e4a817f96bcc949215e3cd8e44b..3eb37cd52fe8f2c501dd411b07d85a1319137b1b 100644 (file)
@@ -80,7 +80,7 @@ chacha_poly1305_set_nonce (struct chacha_poly1305_ctx *ctx,
 
   chacha_set_nonce96 (&ctx->chacha, nonce);
   /* Generate authentication key */
-  _chacha_core (u.x, ctx->chacha.state, CHACHA_ROUNDS);
+  _nettle_chacha_core (u.x, ctx->chacha.state, CHACHA_ROUNDS);
   _poly1305_set_key (&ctx->poly1305, u.subkey);
   /* For final poly1305 processing */
   memcpy (ctx->s.b, u.subkey + 16, 16);
index f51ff19fd16090ebe26532101b091d69e4a5bd29..5efe4ee2a0e0cf3308b140ca061c06680c0a8966 100644 (file)
@@ -193,8 +193,8 @@ _test_chacha(const struct tstring *key, const struct tstring *nonce,
     }
   else
     {
-      /* Uses the _chacha_core function to be able to test different
-        numbers of rounds. */
+      /* Uses the _nettle_chacha_core function to be able to test
+        different numbers of rounds. */
       uint32_t out[_CHACHA_STATE_LENGTH];
       ASSERT (expected->length == CHACHA_BLOCK_SIZE);
       ASSERT (nonce->length == CHACHA_NONCE_SIZE);
@@ -202,7 +202,7 @@ _test_chacha(const struct tstring *key, const struct tstring *nonce,
       chacha_set_nonce(&ctx, nonce->data);
       if (counter)
            chacha_set_counter(&ctx, counter->data);
-      _chacha_core (out, ctx.state, rounds);
+      _nettle_chacha_core (out, ctx.state, rounds);
 
       if (!MEMEQ(CHACHA_BLOCK_SIZE, out, expected->data))
        {