# HG changeset patch # User Matt Johnston # Date 1103473412 0 # Node ID c2b93763dac950105a1ba3030631faa3e1a64d93 # Parent 7ed585a2c53b0579c5eda2fbfda6c65b70456031 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. diff -r 7ed585a2c53b -r c2b93763dac9 Makefile.in --- 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) diff -r 7ed585a2c53b -r c2b93763dac9 crypt_cipher_descriptor.c --- 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}, +}; diff -r 7ed585a2c53b -r c2b93763dac9 crypt_hash_descriptor.c --- 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}, +}; diff -r 7ed585a2c53b -r c2b93763dac9 md5.c --- 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, diff -r 7ed585a2c53b -r c2b93763dac9 mycrypt_custom.h --- 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 diff -r 7ed585a2c53b -r c2b93763dac9 mycrypt_hash.h --- 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 *); diff -r 7ed585a2c53b -r c2b93763dac9 mycrypt_pk.h --- 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 diff -r 7ed585a2c53b -r c2b93763dac9 sha1.c --- 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,