提交 06cf881a 编写于 作者: R Rich Salz

Final (for me, for now) dead code cleanup

This is a final pass looking for '#if 0'/'#if 1' controls and
removing the appropriate pieces.
Reviewed-by: NAndy Polyakov <appro@openssl.org>
上级 3ffbe008
......@@ -222,28 +222,7 @@ int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
break;
}
}
#if 0
memcpy(rp, ap, sizeof(*rp) * (max - i));
#else
if (rp != ap) {
for (;;) {
if (!dif--)
break;
rp[0] = ap[0];
if (!dif--)
break;
rp[1] = ap[1];
if (!dif--)
break;
rp[2] = ap[2];
if (!dif--)
break;
rp[3] = ap[3];
rp += 4;
ap += 4;
}
}
#endif
r->top = max;
r->neg = 0;
......
......@@ -384,29 +384,6 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
b->dmax = words;
}
/* None of this should be necessary because of what b->top means! */
#if 0
/*
* NB: bn_wexpand() calls this only if the BIGNUM really has to grow
*/
if (b->top < b->dmax) {
int i;
BN_ULONG *A = &(b->d[b->top]);
for (i = (b->dmax - b->top) >> 3; i > 0; i--, A += 8) {
A[0] = 0;
A[1] = 0;
A[2] = 0;
A[3] = 0;
A[4] = 0;
A[5] = 0;
A[6] = 0;
A[7] = 0;
}
for (i = (b->dmax - b->top) & 7; i > 0; i--, A++)
A[0] = 0;
assert(A == &(b->d[b->dmax]));
}
#endif
bn_check_top(b);
return b;
}
......
......@@ -116,14 +116,6 @@
#include "cryptlib.h"
#include "bn_lcl.h"
#if 0 /* now just a #define */
int BN_mod(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
{
return (BN_div(NULL, rem, m, d, ctx));
/* note that rem->neg == m->neg (unless the remainder is zero) */
}
#endif
int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
{
/*
......
......@@ -149,7 +149,6 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
goto err;
}
#if 1
if (pseudorand == 2) {
/*
* generate patterns that are more likely to trigger BN library bugs
......@@ -167,7 +166,6 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
buf[i] = 255;
}
}
#endif
if (top != -1) {
if (top) {
......@@ -206,12 +204,10 @@ int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom)
return bnrand(1, rnd, bits, top, bottom);
}
#if 1
int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
{
return bnrand(2, rnd, bits, top, bottom);
}
#endif
/* random number r: 0 <= r < range */
static int bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range)
......
......@@ -195,7 +195,6 @@ int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
goto err;
r->neg = 0;
#if 1
j = 0;
while (BN_ucmp(r, &(recp->N)) >= 0) {
if (j++ > 2) {
......@@ -207,7 +206,6 @@ int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
if (!BN_add_word(d, 1))
goto err;
}
#endif
r->neg = BN_is_zero(r) ? 0 : m->neg;
d->neg = m->neg ^ recp->N.neg;
......
......@@ -287,49 +287,6 @@ int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc)
}
/* also CRL Entry Extensions */
#if 0
ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
void *data, STACK_OF(ASN1_OBJECT) *sk)
{
int i;
unsigned char *p, *b = NULL;
if (data) {
if ((i = i2d(data, NULL)) <= 0)
goto err;
if (!(b = p = OPENSSL_malloc((unsigned int)i)))
goto err;
if (i2d(data, &p) <= 0)
goto err;
} else if (sk) {
if ((i = i2d_ASN1_SET_OF_ASN1_OBJECT(sk, NULL,
(I2D_OF(ASN1_OBJECT)) i2d,
V_ASN1_SEQUENCE,
V_ASN1_UNIVERSAL,
IS_SEQUENCE)) <= 0)
goto err;
if (!(b = p = OPENSSL_malloc((unsigned int)i)))
goto err;
if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk, &p, (I2D_OF(ASN1_OBJECT)) i2d,
V_ASN1_SEQUENCE,
V_ASN1_UNIVERSAL, IS_SEQUENCE) <= 0)
goto err;
} else {
OCSPerr(OCSP_F_ASN1_STRING_ENCODE, OCSP_R_BAD_DATA);
goto err;
}
if (!s && !(s = ASN1_STRING_new()))
goto err;
if (!(ASN1_STRING_set(s, b, i)))
goto err;
OPENSSL_free(b);
return s;
err:
if (b)
OPENSSL_free(b);
return NULL;
}
#endif
/* Nonce handling functions */
......
......@@ -145,12 +145,6 @@ static int null_callback(int ok, X509_STORE_CTX *e)
return ok;
}
#if 0
static int x509_subject_cmp(X509 **a, X509 **b)
{
return X509_subject_name_cmp(*a, *b);
}
#endif
/* Return 1 is a certificate is self signed */
static int cert_self_signed(X509 *x)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册