[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Sat Jan 24 15:58:46 UTC 2015


The branch master has been updated
       via  a2b18e657ea1a932d125154f4e13ab2258796d90 (commit)
      from  2747d73c1466c487daf64a1234b6fe2e8a62ac75 (commit)


- Log -----------------------------------------------------------------
commit a2b18e657ea1a932d125154f4e13ab2258796d90
Author: Rich Salz <rsalz at openssl.org>
Date:   Sat Jan 24 10:57:19 2015 -0500

    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 at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 CHANGES                       |    4 ++
 apps/crl.c                    |    9 ---
 apps/dh.c                     |    9 ---
 apps/sess_id.c                |   20 -------
 crypto/bn/bntest.c            |    5 --
 crypto/des/cfb64ede.c         |   10 ----
 crypto/des/ofb64ede.c         |   12 ----
 crypto/des/rpc_enc.c          |   20 -------
 crypto/evp/encode.c           |   32 -----------
 crypto/evp/p_sign.c           |   12 ----
 crypto/idea/idea_lcl.h        |   64 ----------------------
 crypto/rand/randtest.c        |   10 ----
 crypto/rc2/rc2test.c          |  121 -----------------------------------------
 crypto/rc5/rc5test.c          |   56 -------------------
 crypto/threads/mttest.c       |   45 ---------------
 crypto/x509v3/v3_info.c       |    3 -
 demos/engines/rsaref/rsaref.c |   52 ------------------
 17 files changed, 4 insertions(+), 480 deletions(-)

diff --git a/CHANGES b/CHANGES
index 1a8538d..26ea797 100644
--- a/CHANGES
+++ b/CHANGES
@@ -48,6 +48,10 @@
         Remove MS_STATIC; it's a relic from platforms <32 bits.
      [Rich Salz]
 
+  *) Start cleaning up dead code
+        Remove all but one '#ifdef undef' which is to be looked at.
+     [Rich Salz]
+
   *) Experimental support for a new, fast, unbiased prime candidate generator,
      bn_probable_prime_dh_coprime(). Not currently used by any prime generator.
      [Felix Laurie von Massenbach <felix at erbridge.co.uk>]
diff --git a/apps/crl.c b/apps/crl.c
index c9c3a5f..6819faa 100644
--- a/apps/crl.c
+++ b/apps/crl.c
@@ -152,15 +152,6 @@ int MAIN(int argc, char **argv)
     argv++;
     num = 0;
     while (argc >= 1) {
-#ifdef undef
-        if (strcmp(*argv, "-p") == 0) {
-            if (--argc < 1)
-                goto bad;
-            if (!args_from_file(++argv, Nargc, Nargv)) {
-                goto end;
-            }
-        */}
-#endif
         if (strcmp(*argv, "-inform") == 0) {
             if (--argc < 1)
                 goto bad;
diff --git a/apps/dh.c b/apps/dh.c
index 48fecc9..cdb5f4a 100644
--- a/apps/dh.c
+++ b/apps/dh.c
@@ -233,15 +233,6 @@ int MAIN(int argc, char **argv)
 
     if (text) {
         DHparams_print(out, dh);
-# ifdef undef
-        printf("p=");
-        BN_print(stdout, dh->p);
-        printf("\ng=");
-        BN_print(stdout, dh->g);
-        printf("\n");
-        if (dh->length != 0)
-            printf("recommended private length=%ld\n", dh->length);
-# endif
     }
 
     if (check) {
diff --git a/apps/sess_id.c b/apps/sess_id.c
index be10076..fcb0911 100644
--- a/apps/sess_id.c
+++ b/apps/sess_id.c
@@ -168,26 +168,6 @@ int MAIN(int argc, char **argv)
         }
         SSL_SESSION_set1_id_context(x, (unsigned char *)context, ctx_len);
     }
-#ifdef undef
-    /* just testing for memory leaks :-) */
-    {
-        SSL_SESSION *s;
-        char buf[1024 * 10], *p;
-        int i;
-
-        s = SSL_SESSION_new();
-
-        p = &buf;
-        i = i2d_SSL_SESSION(x, &p);
-        p = &buf;
-        d2i_SSL_SESSION(&s, &p, (long)i);
-        p = &buf;
-        d2i_SSL_SESSION(&s, &p, (long)i);
-        p = &buf;
-        d2i_SSL_SESSION(&s, &p, (long)i);
-        SSL_SESSION_free(s);
-    }
-#endif
 
     if (!noout || text) {
         out = BIO_new(BIO_s_file());
diff --git a/crypto/bn/bntest.c b/crypto/bn/bntest.c
index 2d891a7..e03c808 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 5d709c1..ba4f00b 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 45c6750..215b38d 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 f5a84c5..a5cd7dd 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 53cc586..682a914 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 8345f94..541c6e7 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 e406953..ffb06a1 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 at 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 91bcac9..3c2628c 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 e61df34..f7eae13 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 b29a436..5ed4d21 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 60b0c06..ea3784c 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 e052a34..a377c92 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;
 }
diff --git a/demos/engines/rsaref/rsaref.c b/demos/engines/rsaref/rsaref.c
index 498cc70..b6429de 100644
--- a/demos/engines/rsaref/rsaref.c
+++ b/demos/engines/rsaref/rsaref.c
@@ -324,31 +324,6 @@ static int RSAref_bn2bin(BIGNUM *from, unsigned char *to, int max)
     return (1);
 }
 
-#ifdef undef
-/* unsigned char *from:  [max]    */
-static BIGNUM *RSAref_bin2bn(unsigned char *from, BIGNUM *to, int max)
-{
-    int i;
-    BIGNUM *ret;
-
-    for (i = 0; i < max; i++)
-        if (from[i])
-            break;
-
-    ret = BN_bin2bn(&(from[i]), max - i, to);
-    return (ret);
-}
-
-static int RSAref_Public_ref2eay(RSArefPublicKey * from, RSA *to)
-{
-    to->n = RSAref_bin2bn(from->m, NULL, RSAref_MAX_LEN);
-    to->e = RSAref_bin2bn(from->e, NULL, RSAref_MAX_LEN);
-    if ((to->n == NULL) || (to->e == NULL))
-        return (0);
-    return (1);
-}
-#endif
-
 static int RSAref_Public_eay2ref(RSA *from, R_RSA_PUBLIC_KEY * to)
 {
     to->bits = BN_num_bits(from->n);
@@ -359,33 +334,6 @@ static int RSAref_Public_eay2ref(RSA *from, R_RSA_PUBLIC_KEY * to)
     return (1);
 }
 
-#ifdef undef
-static int RSAref_Private_ref2eay(RSArefPrivateKey * from, RSA *to)
-{
-    if ((to->n = RSAref_bin2bn(from->m, NULL, RSAref_MAX_LEN)) == NULL)
-        return (0);
-    if ((to->e = RSAref_bin2bn(from->e, NULL, RSAref_MAX_LEN)) == NULL)
-        return (0);
-    if ((to->d = RSAref_bin2bn(from->d, NULL, RSAref_MAX_LEN)) == NULL)
-        return (0);
-    if ((to->p =
-         RSAref_bin2bn(from->prime[0], NULL, RSAref_MAX_PLEN)) == NULL)
-        return (0);
-    if ((to->q =
-         RSAref_bin2bn(from->prime[1], NULL, RSAref_MAX_PLEN)) == NULL)
-        return (0);
-    if ((to->dmp1 = RSAref_bin2bn(from->pexp[0], NULL, RSAref_MAX_PLEN))
-        == NULL)
-        return (0);
-    if ((to->dmq1 = RSAref_bin2bn(from->pexp[1], NULL, RSAref_MAX_PLEN))
-        == NULL)
-        return (0);
-    if ((to->iqmp = RSAref_bin2bn(from->coef, NULL, RSAref_MAX_PLEN)) == NULL)
-        return (0);
-    return (1);
-}
-#endif
-
 static int RSAref_Private_eay2ref(RSA *from, R_RSA_PRIVATE_KEY * to)
 {
     to->bits = BN_num_bits(from->n);


More information about the openssl-commits mailing list