From cee5299a9cce65e736a1c8d6368b03e5ab4c1c9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Thu, 6 Feb 2014 15:07:40 +0100
Subject: [PATCH] Deleted _NETTLE_CIPHER.

---
 ChangeLog         |  9 ++++++---
 nettle-internal.c |  9 ++++++++-
 nettle-meta.h     | 13 +------------
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6e21454a..24dcf9e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,17 @@
 2014-02-06  Niels Möller  <nisse@lysator.liu.se>
 
+	* nettle-meta.h (_NETTLE_CIPHER_SEP, _NETTLE_CIPHER_SEP_SET_KEY)
+	(_NETTLE_CIPHER_FIX, _NETTLE_CIPHER): Deleted unused macros.
+
+	* nettle-internal.c (nettle_blowfish128): Deleted only use of
+	_NETTLE_CIPHER.
+
 	* blowfish.c (blowfish128_set_key): New function.
 	* blowfish.h (BLOWFISH128_KEY_SIZE): New constant.
 
 	* cast128-meta.c (nettle_cast128): Deleted only use of
 	_NETTLE_CIPHER_FIX.
 
-	* nettle-meta.h (_NETTLE_CIPHER_SEP, _NETTLE_CIPHER_SEP_SET_KEY)
-	(_NETTLE_CIPHER_FIX): Deleted unused macros.
-
 	* examples/nettle-benchmark.c (time_cipher): Fixed memset calls.
 
 2014-01-30  Niels Möller  <nisse@lysator.liu.se>
diff --git a/nettle-internal.c b/nettle-internal.c
index ba24dee2..6733a3f1 100644
--- a/nettle-internal.c
+++ b/nettle-internal.c
@@ -64,7 +64,14 @@ nettle_des3 = {
 /* NOTE: This is not as nice as one might think, as we pretend
    blowfish_set_key has no return value. */
 const struct nettle_cipher
-nettle_blowfish128 = _NETTLE_CIPHER(blowfish, BLOWFISH, 128);
+nettle_blowfish128 =
+  { "blowfish128", sizeof(struct blowfish_ctx),
+    BLOWFISH_BLOCK_SIZE, BLOWFISH128_KEY_SIZE,
+    (nettle_set_key_func *) blowfish128_set_key,
+    (nettle_set_key_func *) blowfish128_set_key,
+    (nettle_crypt_func *) blowfish_encrypt,
+    (nettle_crypt_func *) blowfish_decrypt
+  };
 
 /* Sets a fix zero iv. For benchmarking only. */
 static void
diff --git a/nettle-meta.h b/nettle-meta.h
index 8e08cb76..c4c79159 100644
--- a/nettle-meta.h
+++ b/nettle-meta.h
@@ -5,7 +5,7 @@
 
 /* nettle, low-level cryptographics library
  *
- * Copyright (C) 2002 Niels Möller
+ * Copyright (C) 2002, 2014 Niels Möller
  *  
  * The nettle library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -52,17 +52,6 @@ struct nettle_cipher
   nettle_crypt_func *decrypt;
 };
 
-#define _NETTLE_CIPHER(name, NAME, key_size) {	\
-  #name #key_size,				\
-  sizeof(struct name##_ctx),			\
-  NAME##_BLOCK_SIZE,				\
-  key_size / 8,					\
-  (nettle_set_key_func *) name##_set_key,	\
-  (nettle_set_key_func *) name##_set_key,	\
-  (nettle_crypt_func *) name##_encrypt,		\
-  (nettle_crypt_func *) name##_decrypt,		\
-}
-
 /* null-terminated list of ciphers implemented by this version of nettle */
 extern const struct nettle_cipher * const nettle_ciphers[];
 
-- 
GitLab