Resolve conflicts

This commit is contained in:
Kris Kennaway 2001-05-20 03:17:35 +00:00
parent 1a92411c80
commit f06df90bde
6 changed files with 49 additions and 27 deletions

View File

@ -833,6 +833,7 @@ int MAIN(int argc, char **argv)
} }
#endif #endif
#ifndef NO_DSA
dsa_c[R_DSA_512][0]=count/1000; dsa_c[R_DSA_512][0]=count/1000;
dsa_c[R_DSA_512][1]=count/1000/2; dsa_c[R_DSA_512][1]=count/1000/2;
for (i=1; i<DSA_NUM; i++) for (i=1; i<DSA_NUM; i++)
@ -850,6 +851,7 @@ int MAIN(int argc, char **argv)
} }
} }
} }
#endif
#define COND(d) (count < (d)) #define COND(d) (count < (d))
#define COUNT(d) (d) #define COUNT(d) (d)
@ -1175,7 +1177,7 @@ int MAIN(int argc, char **argv)
{ {
BIO_printf(bio_err,"RSA verify failure. No RSA verify will be done.\n"); BIO_printf(bio_err,"RSA verify failure. No RSA verify will be done.\n");
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
dsa_doit[j] = 0; rsa_doit[j] = 0;
} }
else else
{ {

View File

@ -148,14 +148,14 @@ void des_ecb_encrypt(const_des_cblock *input,des_cblock *output,
Data is a pointer to 2 unsigned long's and ks is the Data is a pointer to 2 unsigned long's and ks is the
des_key_schedule to use. enc, is non zero specifies encryption, des_key_schedule to use. enc, is non zero specifies encryption,
zero if decryption. */ zero if decryption. */
void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); void des_encrypt1(DES_LONG *data,des_key_schedule ks, int enc);
/* This functions is the same as des_encrypt() except that the DES /* This functions is the same as des_encrypt1() except that the DES
initial permutation (IP) and final permutation (FP) have been left initial permutation (IP) and final permutation (FP) have been left
out. As for des_encrypt(), you should not use this function. out. As for des_encrypt1(), you should not use this function.
It is used by the routines in the library that implement triple DES. It is used by the routines in the library that implement triple DES.
IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same
as des_encrypt() des_encrypt() des_encrypt() except faster :-). */ as des_encrypt1() des_encrypt1() des_encrypt1() except faster :-). */
void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc);
void des_encrypt3(DES_LONG *data, des_key_schedule ks1, void des_encrypt3(DES_LONG *data, des_key_schedule ks1,

View File

@ -444,13 +444,14 @@ err:
static int RSA_eay_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa) static int RSA_eay_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa)
{ {
BIGNUM r1,m1; BIGNUM r1,m1,vrfy;
int ret=0; int ret=0;
BN_CTX *ctx; BN_CTX *ctx;
if ((ctx=BN_CTX_new()) == NULL) goto err; if ((ctx=BN_CTX_new()) == NULL) goto err;
BN_init(&m1); BN_init(&m1);
BN_init(&r1); BN_init(&r1);
BN_init(&vrfy);
if (rsa->flags & RSA_FLAG_CACHE_PRIVATE) if (rsa->flags & RSA_FLAG_CACHE_PRIVATE)
{ {
@ -531,10 +532,19 @@ static int RSA_eay_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa)
if (!BN_mul(&r1,r0,rsa->q,ctx)) goto err; if (!BN_mul(&r1,r0,rsa->q,ctx)) goto err;
if (!BN_add(r0,&r1,&m1)) goto err; if (!BN_add(r0,&r1,&m1)) goto err;
if (rsa->e && rsa->n)
{
if (!rsa->meth->bn_mod_exp(&vrfy,r0,rsa->e,rsa->n,ctx,NULL)) goto err;
if (BN_cmp(I, &vrfy) != 0)
{
if (!rsa->meth->bn_mod_exp(r0,I,rsa->d,rsa->n,ctx,NULL)) goto err;
}
}
ret=1; ret=1;
err: err:
BN_clear_free(&m1); BN_clear_free(&m1);
BN_clear_free(&r1); BN_clear_free(&r1);
BN_clear_free(&vrfy);
BN_CTX_free(ctx); BN_CTX_free(ctx);
return(ret); return(ret);
} }

View File

@ -146,13 +146,13 @@ RSA *RSA_new_method(RSA_METHOD *meth)
ret->blinding=NULL; ret->blinding=NULL;
ret->bignum_data=NULL; ret->bignum_data=NULL;
ret->flags=ret->meth->flags; ret->flags=ret->meth->flags;
CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data);
if ((ret->meth->init != NULL) && !ret->meth->init(ret)) if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{ {
CRYPTO_free_ex_data(rsa_meth,ret,&ret->ex_data);
OPENSSL_free(ret); OPENSSL_free(ret);
ret=NULL; ret=NULL;
} }
else
CRYPTO_new_ex_data(rsa_meth,ret,&ret->ex_data);
return(ret); return(ret);
} }
@ -175,11 +175,11 @@ void RSA_free(RSA *r)
} }
#endif #endif
CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data);
if (r->meth->finish != NULL) if (r->meth->finish != NULL)
r->meth->finish(r); r->meth->finish(r);
CRYPTO_free_ex_data(rsa_meth,r,&r->ex_data);
if (r->n != NULL) BN_clear_free(r->n); if (r->n != NULL) BN_clear_free(r->n);
if (r->e != NULL) BN_clear_free(r->e); if (r->e != NULL) BN_clear_free(r->e);
if (r->d != NULL) BN_clear_free(r->d); if (r->d != NULL) BN_clear_free(r->d);
@ -273,7 +273,7 @@ int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)
BN_CTX_start(ctx); BN_CTX_start(ctx);
A = BN_CTX_get(ctx); A = BN_CTX_get(ctx);
if (!BN_rand(A,BN_num_bits(rsa->n)-1,1,0)) goto err; if (!BN_rand_range(A,rsa->n)) goto err;
if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err; if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err;
if (!rsa->meth->bn_mod_exp(A,A,rsa->e,rsa->n,ctx,rsa->_method_mod_n)) if (!rsa->meth->bn_mod_exp(A,A,rsa->e,rsa->n,ctx,rsa->_method_mod_n))

View File

@ -65,6 +65,7 @@
static int ssl23_num_ciphers(void ); static int ssl23_num_ciphers(void );
static SSL_CIPHER *ssl23_get_cipher(unsigned int u); static SSL_CIPHER *ssl23_get_cipher(unsigned int u);
static int ssl23_read(SSL *s, void *buf, int len); static int ssl23_read(SSL *s, void *buf, int len);
static int ssl23_peek(SSL *s, void *buf, int len);
static int ssl23_write(SSL *s, const void *buf, int len); static int ssl23_write(SSL *s, const void *buf, int len);
static long ssl23_default_timeout(void ); static long ssl23_default_timeout(void );
static int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p); static int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
@ -79,7 +80,7 @@ static SSL_METHOD SSLv23_data= {
ssl_undefined_function, ssl_undefined_function,
ssl_undefined_function, ssl_undefined_function,
ssl23_read, ssl23_read,
(int (*)(struct ssl_st *, char *, int))ssl_undefined_function, ssl23_peek,
ssl23_write, ssl23_write,
ssl_undefined_function, ssl_undefined_function,
ssl_undefined_function, ssl_undefined_function,
@ -171,13 +172,6 @@ static int ssl23_read(SSL *s, void *buf, int len)
{ {
int n; int n;
#if 0
if (s->shutdown & SSL_RECEIVED_SHUTDOWN)
{
s->rwstate=SSL_NOTHING;
return(0);
}
#endif
clear_sys_error(); clear_sys_error();
if (SSL_in_init(s) && (!s->in_handshake)) if (SSL_in_init(s) && (!s->in_handshake))
{ {
@ -197,17 +191,33 @@ static int ssl23_read(SSL *s, void *buf, int len)
} }
} }
static int ssl23_peek(SSL *s, void *buf, int len)
{
int n;
clear_sys_error();
if (SSL_in_init(s) && (!s->in_handshake))
{
n=s->handshake_func(s);
if (n < 0) return(n);
if (n == 0)
{
SSLerr(SSL_F_SSL23_PEEK,SSL_R_SSL_HANDSHAKE_FAILURE);
return(-1);
}
return(SSL_peek(s,buf,len));
}
else
{
ssl_undefined_function(s);
return(-1);
}
}
static int ssl23_write(SSL *s, const void *buf, int len) static int ssl23_write(SSL *s, const void *buf, int len)
{ {
int n; int n;
#if 0
if (s->shutdown & SSL_SENT_SHUTDOWN)
{
s->rwstate=SSL_NOTHING;
return(0);
}
#endif
clear_sys_error(); clear_sys_error();
if (SSL_in_init(s) && (!s->in_handshake)) if (SSL_in_init(s) && (!s->in_handshake))
{ {

View File

@ -301,7 +301,7 @@ int ssl2_read(SSL *s, void *buf, int len)
return ssl2_read_internal(s, buf, len, 0); return ssl2_read_internal(s, buf, len, 0);
} }
int ssl2_peek(SSL *s, char *buf, int len) int ssl2_peek(SSL *s, void *buf, int len)
{ {
return ssl2_read_internal(s, buf, len, 1); return ssl2_read_internal(s, buf, len, 1);
} }