X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=crypto%2Falgtables.c;h=e0d6cc8bb3fddb2bc75f6e4bb288e6eba873907b;hb=68c9013db490dfa7fbaa4f1d4bd7c282cdd77825;hp=8f796ce2333b726053f7df0bb928201e863c04b9;hpb=fa11284b9469c1c79af7f8f129da934c1ebcf594;p=chiark-tcl.git
diff --git a/crypto/algtables.c b/crypto/algtables.c
index 8f796ce..e0d6cc8 100644
--- a/crypto/algtables.c
+++ b/crypto/algtables.c
@@ -1,10 +1,23 @@
/*
+ * crypto - Tcl bindings for parts of the `nettle' crypto library
+ * Copyright 2006-2012 Ian Jackson
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library; if not, see .
*/
-#include
-#include
-#include "hbytes.h"
+#include "chiark_tcl_crypto.h"
#include
#include
@@ -16,9 +29,9 @@
#define NETTLE_BLOCKCIPHERS \
DO(serpent, SERPENT) \
DO(twofish, TWOFISH) \
- DO(aes, AES) \
+/* DO(aes, AES) */ \
DO(blowfish, BLOWFISH) \
- ALIAS(rijndael, aes, AES)
+ /* ALIAS(rijndael, aes, AES)*/
#define ALIAS(alias,name,NAME)
#define DO(name,NAME) \
@@ -26,16 +39,16 @@
name##_set_key(sch, keylen, key); \
} \
static void alg_##name##_encr(const void *sch, const void *in, void *out) { \
- ##name##_encrypt((void*)sch, NAME##_BLOCK_SIZE, out, in); \
+ name##_encrypt((void*)sch, NAME##_BLOCK_SIZE, out, in); \
} \
static void alg_##name##_decr(const void *sch, const void *in, void *out) { \
- ##name##_decrypt((void*)sch, NAME##_BLOCK_SIZE, out, in); \
+ name##_decrypt((void*)sch, NAME##_BLOCK_SIZE, out, in); \
}
NETTLE_BLOCKCIPHERS
#undef DO
#undef ALIAS
-const BlockCipherAlgInfo blockcipheralginfos[]= {
+const BlockCipherAlgInfo cht_blockcipheralginfo_entries[]= {
#define ALIAS(alias,name,NAME) \
{ #alias, NAME##_BLOCK_SIZE, sizeof(struct name##_ctx), \
NAME##_MIN_KEY_SIZE, NAME##_MAX_KEY_SIZE, \
@@ -49,7 +62,7 @@ const BlockCipherAlgInfo blockcipheralginfos[]= {
{ 0 }
};
-const BlockCipherPropInfo blockcipherpropinfos[]= {
+const BlockCipherPropInfo cht_blockcipherpropinfo_entries[]= {
{ "blocklen", offsetof(BlockCipherAlgInfo, blocksize) },
{ "minkeylen", offsetof(BlockCipherAlgInfo, key_min) },
{ "maxkeylen", offsetof(BlockCipherAlgInfo, key_max) },
@@ -80,13 +93,13 @@ const BlockCipherPropInfo blockcipherpropinfos[]= {
NETTLE_DIGESTS
#undef DO
-const HashAlgPropInfo hashalgpropinfos[]= {
+const HashAlgPropInfo cht_hashalgpropinfo_entries[]= {
{ "hashlen", offsetof(HashAlgInfo, hashsize) },
{ "blocklen", offsetof(HashAlgInfo, blocksize) },
{ 0 }
};
-const HashAlgInfo hashalginfos[]= {
+const HashAlgInfo cht_hashalginfo_entries[]= {
#define DO(name,NAME) \
{ #name, NAME##_DIGEST_SIZE, NAME##_DATA_SIZE, sizeof(struct name##_ctx), \
alg_##name##_init, alg_##name##_update, alg_##name##_final, \