diff options
author | Rich Salz <rsalz@openssl.org> | 2015-01-24 16:57:19 +0100 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-01-24 16:58:38 +0100 |
commit | a2b18e657ea1a932d125154f4e13ab2258796d90 (patch) | |
tree | bdfcb8bbe1d673b3bce209ef289520e11a109464 /crypto | |
parent | Fix segfault with empty fields as last in the config. (diff) | |
download | openssl-a2b18e657ea1a932d125154f4e13ab2258796d90.tar.xz openssl-a2b18e657ea1a932d125154f4e13ab2258796d90.zip |
ifdef cleanup, part 4a: '#ifdef undef'
This removes all code surrounded by '#ifdef undef'
One case is left: memmove() replaced by open-coded for loop,
in crypto/stack/stack.c That needs further review.
Also removed a couple of instances of /* dead code */ if I saw them
while doing the main removal.
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bn/bntest.c | 5 | ||||
-rw-r--r-- | crypto/des/cfb64ede.c | 10 | ||||
-rw-r--r-- | crypto/des/ofb64ede.c | 12 | ||||
-rw-r--r-- | crypto/des/rpc_enc.c | 20 | ||||
-rw-r--r-- | crypto/evp/encode.c | 32 | ||||
-rw-r--r-- | crypto/evp/p_sign.c | 12 | ||||
-rw-r--r-- | crypto/idea/idea_lcl.h | 64 | ||||
-rw-r--r-- | crypto/rand/randtest.c | 10 | ||||
-rw-r--r-- | crypto/rc2/rc2test.c | 121 | ||||
-rw-r--r-- | crypto/rc5/rc5test.c | 56 | ||||
-rw-r--r-- | crypto/threads/mttest.c | 45 | ||||
-rw-r--r-- | crypto/x509v3/v3_info.c | 3 |
12 files changed, 0 insertions, 390 deletions
diff --git a/crypto/bn/bntest.c b/crypto/bn/bntest.c index 2d891a7ad1..e03c808554 100644 --- a/crypto/bn/bntest.c +++ b/crypto/bn/bntest.c @@ -812,11 +812,6 @@ int test_mont(BIO *bp, BN_CTX *ctx) BN_from_montgomery(A, c, mont, ctx); if (bp != NULL) { if (!results) { -#ifdef undef - fprintf(stderr, "%d * %d %% %d\n", - BN_num_bits(a), - BN_num_bits(b), BN_num_bits(&mont->N)); -#endif BN_print(bp, a); BIO_puts(bp, " * "); BN_print(bp, b); diff --git a/crypto/des/cfb64ede.c b/crypto/des/cfb64ede.c index 5d709c12d3..ba4f00b3b5 100644 --- a/crypto/des/cfb64ede.c +++ b/crypto/des/cfb64ede.c @@ -127,16 +127,6 @@ void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, *num = n; } -#ifdef undef /* MACRO */ -void DES_ede2_cfb64_encrypt(unsigned char *in, unsigned char *out, - long length, DES_key_schedule ks1, - DES_key_schedule ks2, DES_cblock (*ivec), - int *num, int enc) -{ - DES_ede3_cfb64_encrypt(in, out, length, ks1, ks2, ks1, ivec, num, enc); -} -#endif - /* * This is compatible with the single key CFB-r for DES, even thought that's * not what EVP needs. diff --git a/crypto/des/ofb64ede.c b/crypto/des/ofb64ede.c index 45c67505a6..215b38dff5 100644 --- a/crypto/des/ofb64ede.c +++ b/crypto/des/ofb64ede.c @@ -102,8 +102,6 @@ void DES_ede3_ofb64_encrypt(register const unsigned char *in, n = (n + 1) & 0x07; } if (save) { -/*- v0=ti[0]; - v1=ti[1];*/ iv = &(*ivec)[0]; l2c(v0, iv); l2c(v1, iv); @@ -111,13 +109,3 @@ void DES_ede3_ofb64_encrypt(register const unsigned char *in, v0 = v1 = ti[0] = ti[1] = 0; *num = n; } - -#ifdef undef /* MACRO */ -void DES_ede2_ofb64_encrypt(register unsigned char *in, - register unsigned char *out, long length, - DES_key_schedule k1, DES_key_schedule k2, - DES_cblock (*ivec), int *num) -{ - DES_ede3_ofb64_encrypt(in, out, length, k1, k2, k1, ivec, num); -} -#endif diff --git a/crypto/des/rpc_enc.c b/crypto/des/rpc_enc.c index f5a84c5b05..a5cd7dd283 100644 --- a/crypto/des/rpc_enc.c +++ b/crypto/des/rpc_enc.c @@ -75,26 +75,6 @@ int _des_crypt(char *buf, int len, struct desparams *desp) else { DES_ncbc_encrypt(desp->UDES.UDES_buf, desp->UDES.UDES_buf, len, &ks, &desp->des_ivec, enc); -#ifdef undef - /* - * len will always be %8 if called from common_crypt in secure_rpc. - * Libdes's cbc encrypt does not copy back the iv, so we have to do - * it here. - */ - /* It does now :-) eay 20/09/95 */ - - a = (char *)&(desp->UDES.UDES_buf[len - 8]); - b = (char *)&(desp->des_ivec[0]); - - *(a++) = *(b++); - *(a++) = *(b++); - *(a++) = *(b++); - *(a++) = *(b++); - *(a++) = *(b++); - *(a++) = *(b++); - *(a++) = *(b++); - *(a++) = *(b++); -#endif } return (1); } diff --git a/crypto/evp/encode.c b/crypto/evp/encode.c index 53cc586396..682a914ff3 100644 --- a/crypto/evp/encode.c +++ b/crypto/evp/encode.c @@ -418,35 +418,3 @@ int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) } else return (1); } - -#ifdef undef -int EVP_DecodeValid(unsigned char *buf, int len) -{ - int i, num = 0, bad = 0; - - if (len == 0) - return (-1); - while (conv_ascii2bin(*buf) == B64_WS) { - buf++; - len--; - if (len == 0) - return (-1); - } - - for (i = len; i >= 4; i -= 4) { - if ((conv_ascii2bin(buf[0]) >= 0x40) || - (conv_ascii2bin(buf[1]) >= 0x40) || - (conv_ascii2bin(buf[2]) >= 0x40) || - (conv_ascii2bin(buf[3]) >= 0x40)) - return (-1); - buf += 4; - num += 1 + (buf[2] != '=') + (buf[3] != '='); - } - if ((i == 1) && (conv_ascii2bin(buf[0]) == B64_EOLN)) - return (num); - if ((i == 2) && (conv_ascii2bin(buf[0]) == B64_EOLN) && - (conv_ascii2bin(buf[0]) == B64_EOLN)) - return (num); - return (1); -} -#endif diff --git a/crypto/evp/p_sign.c b/crypto/evp/p_sign.c index 8345f9497e..541c6e70c7 100644 --- a/crypto/evp/p_sign.c +++ b/crypto/evp/p_sign.c @@ -62,18 +62,6 @@ #include <openssl/objects.h> #include <openssl/x509.h> -#ifdef undef -void EVP_SignInit(EVP_MD_CTX *ctx, EVP_MD *type) -{ - EVP_DigestInit_ex(ctx, type); -} - -void EVP_SignUpdate(EVP_MD_CTX *ctx, unsigned char *data, unsigned int count) -{ - EVP_DigestUpdate(ctx, data, count); -} -#endif - int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, EVP_PKEY *pkey) { diff --git a/crypto/idea/idea_lcl.h b/crypto/idea/idea_lcl.h index e40695384d..ffb06a146f 100644 --- a/crypto/idea/idea_lcl.h +++ b/crypto/idea/idea_lcl.h @@ -71,18 +71,6 @@ if (ul != 0) \ else \ r=(-(int)a-b+1); /* assuming a or b is 0 and in range */ -#ifdef undef -# define idea_mul(r,a,b,ul,sl) \ -if (a == 0) r=(0x10001-b)&0xffff; \ -else if (b == 0) r=(0x10001-a)&0xffff; \ -else { \ - ul=(unsigned long)a*b; \ - sl=(ul&0xffff)-(ul>>16); \ - if (sl <= 0) sl+=0x10001; \ - r=sl; \ - } -#endif - /* * 7/12/95 - Many thanks to Rhys Weatherley <rweather@us.oracle.com> for * pointing out that I was assuming little endian byte order for all @@ -144,58 +132,6 @@ else { \ #define n2s(c,l) (l =((IDEA_INT)(*((c)++)))<< 8L, \ l|=((IDEA_INT)(*((c)++))) ) -#ifdef undef -/* NOTE - c is not incremented as per c2l */ -# define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c))))<<24; \ - case 7: l2|=((unsigned long)(*(--(c))))<<16; \ - case 6: l2|=((unsigned long)(*(--(c))))<< 8; \ - case 5: l2|=((unsigned long)(*(--(c)))); \ - case 4: l1 =((unsigned long)(*(--(c))))<<24; \ - case 3: l1|=((unsigned long)(*(--(c))))<<16; \ - case 2: l1|=((unsigned long)(*(--(c))))<< 8; \ - case 1: l1|=((unsigned long)(*(--(c)))); \ - } \ - } - -/* NOTE - c is not incremented as per l2c */ -# define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ - } - -# undef c2s -# define c2s(c,l) (l =((unsigned long)(*((c)++))) , \ - l|=((unsigned long)(*((c)++)))<< 8L) - -# undef s2c -# define s2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff)) - -# undef c2l -# define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ - l|=((unsigned long)(*((c)++)))<< 8L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<<24L) - -# undef l2c -# define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24L)&0xff)) -#endif #define E_IDEA(num) \ x1&=0xffff; \ diff --git a/crypto/rand/randtest.c b/crypto/rand/randtest.c index 91bcac9906..3c2628cb15 100644 --- a/crypto/rand/randtest.c +++ b/crypto/rand/randtest.c @@ -133,16 +133,6 @@ int main(int argc, char **argv) printf("test 1 done\n"); /* test 2 */ -#ifdef undef - d = 0; - for (i = 0; i < 16; i++) - d += n2[i] * n2[i]; - d = d * 16.0 / 5000.0 - 5000.0; - if (!((1.03 < d) && (d < 57.4))) { - printf("test 2 failed, X=%.2f\n", d); - err++; - } -#endif d = 0; for (i = 0; i < 16; i++) d += n2[i] * n2[i]; diff --git a/crypto/rc2/rc2test.c b/crypto/rc2/rc2test.c index e61df342ea..f7eae13c26 100644 --- a/crypto/rc2/rc2test.c +++ b/crypto/rc2/rc2test.c @@ -101,50 +101,6 @@ static unsigned char RC2cipher[4][8] = { {0x50, 0xDC, 0x01, 0x62, 0xBD, 0x75, 0x7F, 0x31}, }; -/************/ -# ifdef undef -unsigned char k[16] = { - 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, - 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08 -}; - -unsigned char in[8] = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03 }; -unsigned char c[8] = { 0x11, 0xFB, 0xED, 0x2B, 0x01, 0x98, 0x6D, 0xE5 }; - -unsigned char out[80]; - -char *text = "Hello to all people out there"; - -static unsigned char cfb_key[16] = { - 0xe1, 0xf0, 0xc3, 0xd2, 0xa5, 0xb4, 0x87, 0x96, - 0x69, 0x78, 0x4b, 0x5a, 0x2d, 0x3c, 0x0f, 0x1e, -}; -static unsigned char cfb_iv[80] = - { 0x34, 0x12, 0x78, 0x56, 0xab, 0x90, 0xef, 0xcd }; -static unsigned char cfb_buf1[40], cfb_buf2[40], cfb_tmp[8]; -# define CFB_TEST_SIZE 24 -static unsigned char plain[CFB_TEST_SIZE] = { - 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, - 0x69, 0x6d, 0x65, 0x20, 0x66, 0x6f, - 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 -}; - -static unsigned char cfb_cipher64[CFB_TEST_SIZE] = { - 0x59, 0xD8, 0xE2, 0x65, 0x00, 0x58, 0x6C, 0x3F, - 0x2C, 0x17, 0x25, 0xD0, 0x1A, 0x38, 0xB7, 0x2A, - 0x39, 0x61, 0x37, 0xDC, 0x79, 0xFB, 0x9F, 0x45 -/*- 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38, - 0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9, - 0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/ -}; - -/* - * static int cfb64_test(unsigned char *cfb_cipher); - */ -static char *pt(unsigned char *p); -# endif - int main(int argc, char *argv[]) { int i, n, err = 0; @@ -185,27 +141,6 @@ int main(int argc, char *argv[]) if (err == 0) printf("ecb RC2 ok\n"); -# ifdef undef - memcpy(iv, k, 8); - idea_cbc_encrypt((unsigned char *)text, out, strlen(text) + 1, &key, iv, - 1); - memcpy(iv, k, 8); - idea_cbc_encrypt(out, out, 8, &dkey, iv, 0); - idea_cbc_encrypt(&(out[8]), &(out[8]), strlen(text) + 1 - 8, &dkey, iv, - 0); - if (memcmp(text, out, strlen(text) + 1) != 0) { - printf("cbc idea bad\n"); - err = 4; - } else - printf("cbc idea ok\n"); - - printf("cfb64 idea "); - if (cfb64_test(cfb_cipher64)) { - printf("bad\n"); - err = 5; - } else - printf("ok\n"); -# endif # ifdef OPENSSL_SYS_NETWARE if (err) @@ -215,60 +150,4 @@ int main(int argc, char *argv[]) return (err); } -# ifdef undef -static int cfb64_test(unsigned char *cfb_cipher) -{ - IDEA_KEY_SCHEDULE eks, dks; - int err = 0, i, n; - - idea_set_encrypt_key(cfb_key, &eks); - idea_set_decrypt_key(&eks, &dks); - memcpy(cfb_tmp, cfb_iv, 8); - n = 0; - idea_cfb64_encrypt(plain, cfb_buf1, (long)12, &eks, - cfb_tmp, &n, IDEA_ENCRYPT); - idea_cfb64_encrypt(&(plain[12]), &(cfb_buf1[12]), - (long)CFB_TEST_SIZE - 12, &eks, - cfb_tmp, &n, IDEA_ENCRYPT); - if (memcmp(cfb_cipher, cfb_buf1, CFB_TEST_SIZE) != 0) { - err = 1; - printf("idea_cfb64_encrypt encrypt error\n"); - for (i = 0; i < CFB_TEST_SIZE; i += 8) - printf("%s\n", pt(&(cfb_buf1[i]))); - } - memcpy(cfb_tmp, cfb_iv, 8); - n = 0; - idea_cfb64_encrypt(cfb_buf1, cfb_buf2, (long)17, &eks, - cfb_tmp, &n, IDEA_DECRYPT); - idea_cfb64_encrypt(&(cfb_buf1[17]), &(cfb_buf2[17]), - (long)CFB_TEST_SIZE - 17, &dks, - cfb_tmp, &n, IDEA_DECRYPT); - if (memcmp(plain, cfb_buf2, CFB_TEST_SIZE) != 0) { - err = 1; - printf("idea_cfb_encrypt decrypt error\n"); - for (i = 0; i < 24; i += 8) - printf("%s\n", pt(&(cfb_buf2[i]))); - } - return (err); -} - -static char *pt(unsigned char *p) -{ - static char bufs[10][20]; - static int bnum = 0; - char *ret; - int i; - static char *f = "0123456789ABCDEF"; - - ret = &(bufs[bnum++][0]); - bnum %= 10; - for (i = 0; i < 8; i++) { - ret[i * 2] = f[(p[i] >> 4) & 0xf]; - ret[i * 2 + 1] = f[p[i] & 0xf]; - } - ret[16] = '\0'; - return (ret); -} - -# endif #endif diff --git a/crypto/rc5/rc5test.c b/crypto/rc5/rc5test.c index b29a436cec..5ed4d21105 100644 --- a/crypto/rc5/rc5test.c +++ b/crypto/rc5/rc5test.c @@ -322,60 +322,4 @@ int main(int argc, char *argv[]) return (err); } -# ifdef undef -static int cfb64_test(unsigned char *cfb_cipher) -{ - IDEA_KEY_SCHEDULE eks, dks; - int err = 0, i, n; - - idea_set_encrypt_key(cfb_key, &eks); - idea_set_decrypt_key(&eks, &dks); - memcpy(cfb_tmp, cfb_iv, 8); - n = 0; - idea_cfb64_encrypt(plain, cfb_buf1, (long)12, &eks, - cfb_tmp, &n, IDEA_ENCRYPT); - idea_cfb64_encrypt(&(plain[12]), &(cfb_buf1[12]), - (long)CFB_TEST_SIZE - 12, &eks, - cfb_tmp, &n, IDEA_ENCRYPT); - if (memcmp(cfb_cipher, cfb_buf1, CFB_TEST_SIZE) != 0) { - err = 1; - printf("idea_cfb64_encrypt encrypt error\n"); - for (i = 0; i < CFB_TEST_SIZE; i += 8) - printf("%s\n", pt(&(cfb_buf1[i]))); - } - memcpy(cfb_tmp, cfb_iv, 8); - n = 0; - idea_cfb64_encrypt(cfb_buf1, cfb_buf2, (long)17, &eks, - cfb_tmp, &n, IDEA_DECRYPT); - idea_cfb64_encrypt(&(cfb_buf1[17]), &(cfb_buf2[17]), - (long)CFB_TEST_SIZE - 17, &dks, - cfb_tmp, &n, IDEA_DECRYPT); - if (memcmp(plain, cfb_buf2, CFB_TEST_SIZE) != 0) { - err = 1; - printf("idea_cfb_encrypt decrypt error\n"); - for (i = 0; i < 24; i += 8) - printf("%s\n", pt(&(cfb_buf2[i]))); - } - return (err); -} - -static char *pt(unsigned char *p) -{ - static char bufs[10][20]; - static int bnum = 0; - char *ret; - int i; - static char *f = "0123456789ABCDEF"; - - ret = &(bufs[bnum++][0]); - bnum %= 10; - for (i = 0; i < 8; i++) { - ret[i * 2] = f[(p[i] >> 4) & 0xf]; - ret[i * 2 + 1] = f[p[i] & 0xf]; - } - ret[16] = '\0'; - return (ret); -} - -# endif #endif diff --git a/crypto/threads/mttest.c b/crypto/threads/mttest.c index 60b0c06417..ea3784c72f 100644 --- a/crypto/threads/mttest.c +++ b/crypto/threads/mttest.c @@ -529,11 +529,6 @@ int doit(char *ctx[4]) return (1); } else { done |= C_DONE; -#ifdef undef - fprintf(stdout, "CLIENT:from server:"); - fwrite(cbuf, 1, i, stdout); - fflush(stdout); -#endif } } } @@ -560,11 +555,6 @@ int doit(char *ctx[4]) } else { s_write = 1; s_w = 1; -#ifdef undef - fprintf(stdout, "SERVER:from client:"); - fwrite(sbuf, 1, i, stdout); - fflush(stdout); -#endif } } else { i = BIO_write(s_bio, "hello from server\n", 18); @@ -602,9 +592,6 @@ int doit(char *ctx[4]) SSL_set_shutdown(c_ssl, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); SSL_set_shutdown(s_ssl, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); -#ifdef undef - fprintf(stdout, "DONE\n"); -#endif err: /* * We have to set the BIO's to NULL otherwise they will be free()ed @@ -791,30 +778,10 @@ void thread_cleanup(void) void solaris_locking_callback(int mode, int type, char *file, int line) { -# ifdef undef - fprintf(stderr, "thread=%4d mode=%s lock=%s %s:%d\n", - CRYPTO_thread_id(), - (mode & CRYPTO_LOCK) ? "l" : "u", - (type & CRYPTO_READ) ? "r" : "w", file, line); -# endif - - /*- - if (CRYPTO_LOCK_SSL_CERT == type) - fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", - CRYPTO_thread_id(), - mode,file,line); - */ if (mode & CRYPTO_LOCK) { - /*- - if (mode & CRYPTO_READ) - rw_rdlock(&(lock_cs[type])); - else - rw_wrlock(&(lock_cs[type])); */ - mutex_lock(&(lock_cs[type])); lock_count[type]++; } else { -/* rw_unlock(&(lock_cs[type])); */ mutex_unlock(&(lock_cs[type])); } } @@ -977,18 +944,6 @@ void thread_cleanup(void) void pthreads_locking_callback(int mode, int type, char *file, int line) { -# ifdef undef - fprintf(stderr, "thread=%4d mode=%s lock=%s %s:%d\n", - CRYPTO_thread_id(), - (mode & CRYPTO_LOCK) ? "l" : "u", - (type & CRYPTO_READ) ? "r" : "w", file, line); -# endif -/*- - if (CRYPTO_LOCK_SSL_CERT == type) - fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", - CRYPTO_thread_id(), - mode,file,line); -*/ if (mode & CRYPTO_LOCK) { pthread_mutex_lock(&(lock_cs[type])); lock_count[type]++; diff --git a/crypto/x509v3/v3_info.c b/crypto/x509v3/v3_info.c index e052a34b94..a377c92b76 100644 --- a/crypto/x509v3/v3_info.c +++ b/crypto/x509v3/v3_info.c @@ -203,8 +203,5 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION *a) { i2a_ASN1_OBJECT(bp, a->method); -#ifdef UNDEF - i2a_GENERAL_NAME(bp, a->location); -#endif return 2; } |