]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Contributed by Daniel Kahn Gillmor:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Wed, 23 Mar 2011 10:34:47 +0000 (11:34 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Wed, 23 Mar 2011 10:34:47 +0000 (11:34 +0100)
* testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
meta-hash-test.c, meta-cipher-test.c, and meta-armor-test.c.

* nettle.texinfo: Document nettle_hashes and nettle_ciphers.

* nettle-meta.h: Declare algorithm lists nettle_ciphers,
nettle_hashes, nettle_armors.

* Makefile.in (nettle_SOURCES): Added nettle-meta-hashes.c,
nettle-meta-ciphers.c, and nettle-meta-armors.c.

* nettle-meta-armors.c: New file.
* nettle-meta-ciphers.c: New file.
* nettle-meta-hashes.c: New file.

Rev: nettle/ChangeLog:1.159
Rev: nettle/Makefile.in:1.32
Rev: nettle/nettle-meta-armors.c:1.1
Rev: nettle/nettle-meta-ciphers.c:1.1
Rev: nettle/nettle-meta-hashes.c:1.1
Rev: nettle/nettle-meta.h:1.10
Rev: nettle/nettle.texinfo:1.22

ChangeLog
Makefile.in
nettle-meta-armors.c [new file with mode: 0644]
nettle-meta-ciphers.c [new file with mode: 0644]
nettle-meta-hashes.c [new file with mode: 0644]
nettle-meta.h
nettle.texinfo

index 13441372120a08168e4af6af96550014afa3af21..f0f8bf360d46ffcfe1c0dee3d1ad2612e1de31bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2011-03-23  Niels Möller  <nisse@lysator.liu.se>
+
+       Contributed by Daniel Kahn Gillmor:
+       * testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
+       meta-hash-test.c, meta-cipher-test.c, and meta-armor-test.c.
+
+       * testsuite/meta-hash-test.c: New file.
+       * testsuite/meta-cipher-test.c: New file.
+       * testsuite/meta-armor-test.c: New file.
+
+       * nettle.texinfo: Document nettle_hashes and nettle_ciphers.
+
+       * nettle-meta.h: Declare algorithm lists nettle_ciphers,
+       nettle_hashes, nettle_armors.
+
+       * Makefile.in (nettle_SOURCES): Added nettle-meta-hashes.c,
+       nettle-meta-ciphers.c, and nettle-meta-armors.c.
+
+       * nettle-meta-armors.c: New file.
+       * nettle-meta-ciphers.c: New file.
+       * nettle-meta-hashes.c: New file.
+
 2011-02-18  Niels Möller  <nisse@lysator.liu.se>
 
        * arcfour.c (arcfour_stream): Deleted function. It's not very
index 1020fd7b9420ad545715d390e3489a17f1a59b48..d71a712734458a2f00d4457abf3be6d8662061fc 100644 (file)
@@ -75,6 +75,8 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
                 twofish.c twofish-meta.c \
                 yarrow256.c yarrow_key_event.c \
                 buffer.c buffer-init.c realloc.c \
+                nettle-meta-hashes.c nettle-meta-ciphers.c \
+                nettle-meta-armors.c \
                 nettle-internal.c write-be32.c
 
 hogweed_SOURCES = sexp.c sexp-format.c \
diff --git a/nettle-meta-armors.c b/nettle-meta-armors.c
new file mode 100644 (file)
index 0000000..360006d
--- /dev/null
@@ -0,0 +1,34 @@
+/* nettle-meta-armors.c */
+
+/* nettle, low-level cryptographics library
+ *
+ * Copyright (C) 2011 Daniel Kahn Gillmor
+ * 
+ * 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
+ * the Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ * 
+ * The nettle library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the nettle library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stddef.h>
+#include "nettle-meta.h"
+
+const struct nettle_armor * const nettle_armors[] = {
+  &nettle_base64,
+  &nettle_base16,
+  NULL
+};
diff --git a/nettle-meta-ciphers.c b/nettle-meta-ciphers.c
new file mode 100644 (file)
index 0000000..1f07595
--- /dev/null
@@ -0,0 +1,50 @@
+/* nettle-meta-ciphers.c */
+
+/* nettle, low-level cryptographics library
+ *  
+ * Copyright (C) 2011 Daniel Kahn Gillmor
+ * 
+ * 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
+ * the Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ * 
+ * The nettle library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the nettle library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stddef.h>
+#include "nettle-meta.h"
+
+const struct nettle_cipher * const nettle_ciphers[] = {
+  &nettle_aes128,
+  &nettle_aes192,
+  &nettle_aes256,
+  &nettle_arcfour128,
+  &nettle_camellia128,
+  &nettle_camellia192,
+  &nettle_camellia256,
+  &nettle_cast128,
+  &nettle_serpent128,
+  &nettle_serpent192,
+  &nettle_serpent256,
+  &nettle_twofish128,
+  &nettle_twofish192,
+  &nettle_twofish256,
+  &nettle_arctwo40,
+  &nettle_arctwo64,
+  &nettle_arctwo128,
+  &nettle_arctwo_gutmann128,
+  NULL
+};
diff --git a/nettle-meta-hashes.c b/nettle-meta-hashes.c
new file mode 100644 (file)
index 0000000..9007ea1
--- /dev/null
@@ -0,0 +1,40 @@
+/* nettle-meta-hashes.c */
+
+/* nettle, low-level cryptographics library
+ *  
+ * Copyright (C) 2011 Daniel Kahn Gillmor
+ * 
+ * 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
+ * the Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ * 
+ * The nettle library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the nettle library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stddef.h>
+#include "nettle-meta.h"
+
+const struct nettle_hash * const nettle_hashes[] = {
+  &nettle_md2,
+  &nettle_md4,
+  &nettle_md5,
+  &nettle_sha1,
+  &nettle_sha224,
+  &nettle_sha256,
+  &nettle_sha384,
+  &nettle_sha512,
+  NULL
+};
index 2a00954614e79fc29588ebbe74d9b38ece70473a..0fbfc031411606f121d5a7a5637d3a758761730e 100644 (file)
@@ -96,6 +96,9 @@ struct nettle_cipher
   (nettle_crypt_func *) name##_decrypt,                        \
 }
 
+/* null-terminated list of ciphers implemented by this version of nettle */
+extern const struct nettle_cipher * const nettle_ciphers[];
+
 extern const struct nettle_cipher nettle_aes128;
 extern const struct nettle_cipher nettle_aes192;
 extern const struct nettle_cipher nettle_aes256;
@@ -149,6 +152,9 @@ struct nettle_hash
  (nettle_hash_digest_func *) name##_digest     \
 } 
 
+/* null-terminated list of digests implemented by this version of nettle */
+extern const struct nettle_hash * const nettle_hashes[];
+
 extern const struct nettle_hash nettle_md2;
 extern const struct nettle_hash nettle_md4;
 extern const struct nettle_hash nettle_md5;
@@ -207,6 +213,9 @@ struct nettle_armor
   (nettle_armor_decode_final_func *) name##_decode_final,      \
 }
 
+/* null-terminated list of armor schemes implemented by this version of nettle */
+extern const struct nettle_armor * const nettle_armors[];
+
 extern const struct nettle_armor nettle_base64;
 extern const struct nettle_armor nettle_base16;
 
index 797ea06968d3102734bec32cfcc93b5cf57d8f46..ec35e255a17c73c86b6942f9b1de00448051ac1f 100644 (file)
@@ -683,6 +683,12 @@ The last three attributes are function pointers, of types
 @deftypevrx {Constant Struct} {struct nettle_hash} nettle_sha512
 
 These are all the hash functions that Nettle implements.
+
+Nettle also exports a list of all these hashes.  This list can be used
+to dynamically enumerate or search the supported algorithms:
+
+@deftypevrx {Constant Struct} {struct nettle_hash **} nettle_hashes
+
 @end deftypevr
 
 @node Cipher functions, Cipher modes, Hash functions, Reference
@@ -1330,6 +1336,13 @@ struct, which is of size @code{context_size}.
 
 Nettle includes such structs for all the @emph{regular} ciphers, i.e.
 ones without weak keys or other oddities.
+
+Nettle also exports a list of all these ciphers without weak keys or
+other oddities.  This list can be used to dynamically enumerate or
+search the supported algorithms:
+
+@deftypevrx {Constant Struct} {struct nettle_cipher **} nettle_ciphers
+
 @end deftypevr
 
 @node Cipher modes, Keyed hash functions, Cipher functions, Reference