changeset 147:c2b93763dac9 libtomcrypt

Fixes for it to compile and work nicely with Dropbear. In particular, OS X's 'ar' doesn't seem to like arrays which don't have initialising values.
author Matt Johnston <matt@ucc.asn.au>
date Sun, 19 Dec 2004 16:23:32 +0000
parents 7ed585a2c53b
children 8fc624ea2521
files Makefile.in crypt_cipher_descriptor.c crypt_hash_descriptor.c md5.c mycrypt_custom.h mycrypt_hash.h mycrypt_pk.h sha1.c
diffstat 8 files changed, 32 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Sun Dec 19 11:47:33 2004 +0000
+++ b/Makefile.in	Sun Dec 19 16:23:32 2004 +0000
@@ -6,6 +6,9 @@
 # The version
 VERSION=0.99
 
+VPATH=@srcdir@
+srcdir=@srcdir@
+
 # Compiler and Linker Names
 #CC=gcc
 #LD=ld
@@ -111,15 +114,6 @@
 \
 hmac_done.o  hmac_file.o  hmac_init.o  hmac_memory.o  hmac_process.o  hmac_test.o \
 \
-pkcs_1_mgf1.o pkcs_1_oaep_encode.o pkcs_1_oaep_decode.o  \
-pkcs_1_pss_encode.o pkcs_1_pss_decode.o pkcs_1_i2osp.o pkcs_1_os2ip.o \
-pkcs_1_v15_es_encode.o pkcs_1_v15_es_decode.o pkcs_1_v15_sa_encode.o pkcs_1_v15_sa_decode.o \
-\
-pkcs_5_1.o pkcs_5_2.o \
-\
-der_encode_integer.o der_decode_integer.o der_length_integer.o \
-der_put_multi_integer.o der_get_multi_integer.o \
-\
 burn_stack.o zeromem.o \
 \
 $(MPIOBJECT)
--- a/crypt_cipher_descriptor.c	Sun Dec 19 11:47:33 2004 +0000
+++ b/crypt_cipher_descriptor.c	Sun Dec 19 16:23:32 2004 +0000
@@ -10,5 +10,12 @@
  */
 #include "mycrypt.h"
 
-struct _cipher_descriptor cipher_descriptor[TAB_SIZE];
-
+struct _cipher_descriptor cipher_descriptor[TAB_SIZE] = {
+	/* This is ugly, but OS X's ar seems broken and leaves the 
+	 * cipher_descriptor symbol out of the .a if we don't
+	 * initialise it here. */
+	{NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL},
+	{NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL},
+	{NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL},
+	{NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL},
+};
--- a/crypt_hash_descriptor.c	Sun Dec 19 11:47:33 2004 +0000
+++ b/crypt_hash_descriptor.c	Sun Dec 19 16:23:32 2004 +0000
@@ -10,5 +10,10 @@
  */
 #include "mycrypt.h"
 
-struct _hash_descriptor hash_descriptor[TAB_SIZE];
-
+struct _hash_descriptor hash_descriptor[TAB_SIZE] = {
+	/* OS X has a broken ar, so we need to initialise. */
+	{NULL, 0, 0, 0, NULL, NULL, NULL, NULL},
+	{NULL, 0, 0, 0, NULL, NULL, NULL, NULL},
+	{NULL, 0, 0, 0, NULL, NULL, NULL, NULL},
+	{NULL, 0, 0, 0, NULL, NULL, NULL, NULL},
+};
--- a/md5.c	Sun Dec 19 11:47:33 2004 +0000
+++ b/md5.c	Sun Dec 19 16:23:32 2004 +0000
@@ -23,10 +23,13 @@
     64,
 
     /* DER identifier */
+#if 0
+	/* matt */
     { 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 
       0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 
       0x04, 0x10 },
     18,
+#endif
 
     &md5_init,
     &md5_process,
--- a/mycrypt_custom.h	Sun Dec 19 11:47:33 2004 +0000
+++ b/mycrypt_custom.h	Sun Dec 19 16:23:32 2004 +0000
@@ -74,6 +74,7 @@
 /* Various tidbits of modern neatoness */
 #define BASE64
 
+#define FORTUNA_POOLS 0
 
 #endif
 
--- a/mycrypt_hash.h	Sun Dec 19 11:47:33 2004 +0000
+++ b/mycrypt_hash.h	Sun Dec 19 16:23:32 2004 +0000
@@ -127,8 +127,11 @@
     unsigned char ID;
     unsigned long hashsize;       /* digest output size in bytes  */
     unsigned long blocksize;      /* the block size the hash uses */
+#if 0
+	/*matt - we don't need these and they make the intialisers more ugly.*/
     unsigned char DER[64];        /* DER encoded identifier */
     unsigned long DERlen;         /* length of DER encoding */
+#endif
     int (*init)(hash_state *);
     int (*process)(hash_state *, const unsigned char *, unsigned long);
     int (*done)(hash_state *, unsigned char *);
--- a/mycrypt_pk.h	Sun Dec 19 11:47:33 2004 +0000
+++ b/mycrypt_pk.h	Sun Dec 19 16:23:32 2004 +0000
@@ -276,10 +276,13 @@
 
 #endif
 
+/* ifdef added by matt - a bit of a hack */
+#ifdef MPI
 /* DER handling */
 int der_encode_integer(mp_int *num, unsigned char *out, unsigned long *outlen);
 int der_decode_integer(const unsigned char *in, unsigned long *inlen, mp_int *num);
 int der_length_integer(mp_int *num, unsigned long *len);
 int der_put_multi_integer(unsigned char *dst, unsigned long *outlen, mp_int *num, ...);
 int der_get_multi_integer(const unsigned char *src, unsigned long *inlen,  mp_int *num, ...);
+#endif
 
--- a/sha1.c	Sun Dec 19 11:47:33 2004 +0000
+++ b/sha1.c	Sun Dec 19 16:23:32 2004 +0000
@@ -21,10 +21,13 @@
     20,
     64,
 
+#if 0
+	/* matt */
     /* DER identifier */
     { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 
       0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14 },
     15,
+#endif
 
     &sha1_init,
     &sha1_process,