]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Delete old salsa20 compatibility aliases.
authorNiels Möller <nisse@lysator.liu.se>
Mon, 28 Apr 2025 18:03:32 +0000 (20:03 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 28 Apr 2025 18:03:32 +0000 (20:03 +0200)
ChangeLog
salsa20.h
testsuite/salsa20-test.c

index 8e5a6836bddb0ff8f70bda63870f52482c4ba3b4..df9ad2a7bfa7ef038b9bd421fcb2fe2f2a653333 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-04-28  Niels Möller  <nisse@lysator.liu.se>
+
+       * salsa20.h (salsa20_set_iv, SALSA20_IV_SIZE): Delete backwards
+       compatibility aliases.
+       * testsuite/salsa20-test.c: Update to consistently use "nonce"
+       names.
+
 2025-04-27  Niels Möller  <nisse@lysator.liu.se>
 
        * powerpc64/p8/sha256-compress-n.asm: Use 64-bit unsigned compare
index 9f731f26ed29a3faa5b9c8ae12dbc1f121be5515..f8b1aad066c2923ef1fe34e30284ff6d7d900244 100644 (file)
--- a/salsa20.h
+++ b/salsa20.h
@@ -50,15 +50,11 @@ extern "C" {
 
 #define salsa20r12_crypt nettle_salsa20r12_crypt
 
-/* Alias for backwards compatibility */
-#define salsa20_set_iv nettle_salsa20_set_nonce
-
 /* In octets.*/
 #define SALSA20_128_KEY_SIZE 16
 #define SALSA20_256_KEY_SIZE 32
 #define SALSA20_BLOCK_SIZE 64
 #define SALSA20_NONCE_SIZE 8
-#define SALSA20_IV_SIZE SALSA20_NONCE_SIZE
 
 /* Aliases */
 #define SALSA20_MIN_KEY_SIZE 16
index d633c3a5e0945b1e612370ee5d7436a40a1ac916..8f7ae029fc425482710b3d9c0f2f56fd688237c0 100644 (file)
@@ -30,12 +30,12 @@ test_salsa20_stream(const struct tstring *key,
   uint8_t xor[SALSA20_BLOCK_SIZE];
   size_t j;
 
-  ASSERT (iv->length == SALSA20_IV_SIZE);
+  ASSERT (iv->length == SALSA20_NONCE_SIZE);
   ASSERT (ciphertext->length == 4*SALSA20_BLOCK_SIZE);
   ASSERT (xor_ref->length == SALSA20_BLOCK_SIZE);
 
   salsa20_set_key(&ctx, key->length, key->data);
-  salsa20_set_iv(&ctx, iv->data);
+  salsa20_set_nonce(&ctx, iv->data);
   memset(stream, 0, STREAM_LENGTH + 1);
   salsa20_crypt(&ctx, STREAM_LENGTH, stream, stream);
   if (stream[STREAM_LENGTH])
@@ -92,7 +92,7 @@ test_salsa20_stream(const struct tstring *key,
   for (j = 1; j <= STREAM_LENGTH; j++)
     {
       memset(data, 0, STREAM_LENGTH + 1);
-      salsa20_set_iv(&ctx, iv->data);
+      salsa20_set_nonce(&ctx, iv->data);
       salsa20_crypt(&ctx, j, data, data);
 
       if (!MEMEQ(j, data, stream))
@@ -192,7 +192,7 @@ typedef void salsa20_func(struct salsa20_ctx *ctx,
 static void
 _test_salsa20(salsa20_func *crypt,
              const struct tstring *key,
-             const struct tstring *iv,
+             const struct tstring *nonce,
              const struct tstring *cleartext,
              const struct tstring *ciphertext)
 {
@@ -203,12 +203,12 @@ _test_salsa20(salsa20_func *crypt,
   ASSERT (cleartext->length == ciphertext->length);
   length = cleartext->length;
 
-  ASSERT (iv->length == SALSA20_IV_SIZE);
+  ASSERT (nonce->length == SALSA20_NONCE_SIZE);
 
   data = xalloc(length + 1);
 
   salsa20_set_key(&ctx, key->length, key->data);
-  salsa20_set_iv(&ctx, iv->data);
+  salsa20_set_nonce(&ctx, nonce->data);
   data[length] = 17;
   crypt(&ctx, length, data, cleartext->data);
   if (data[length] != 17)
@@ -231,7 +231,7 @@ _test_salsa20(salsa20_func *crypt,
       FAIL();
     }
   salsa20_set_key(&ctx, key->length, key->data);
-  salsa20_set_iv(&ctx, iv->data);
+  salsa20_set_nonce(&ctx, nonce->data);
   crypt(&ctx, length, data, data);
 
   if (!MEMEQ(length, data, cleartext->data))
@@ -249,11 +249,11 @@ _test_salsa20(salsa20_func *crypt,
   free(data);
 }
 
-#define test_salsa20(key, iv, cleartext, ciphertext) \
-  _test_salsa20 (salsa20_crypt, (key), (iv), (cleartext), (ciphertext))
+#define test_salsa20(key, nonce, cleartext, ciphertext) \
+  _test_salsa20 (salsa20_crypt, (key), (nonce), (cleartext), (ciphertext))
 
-#define test_salsa20r12(key, iv, cleartext, ciphertext) \
-  _test_salsa20 (salsa20r12_crypt, (key), (iv), (cleartext), (ciphertext))
+#define test_salsa20r12(key, nonce, cleartext, ciphertext) \
+  _test_salsa20 (salsa20r12_crypt, (key), (nonce), (cleartext), (ciphertext))
 
   
 void