From d70fcb96ac3ed2d6182a966010f4bcdc7e898a67 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sat, 12 Mar 2011 17:27:03 +0000 Subject: [PATCH] Fix warnings: signed/unisgned comparison, shadowing (in some cases global functions such as rand() ). --- apps/s_client.c | 4 ++-- apps/srp.c | 10 +++++----- crypto/srp/srp_lib.c | 4 ++-- crypto/srp/srp_vfy.c | 6 +++--- ssl/tls_srp.c | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/s_client.c b/apps/s_client.c index 5e2a5efc95..8a57dcfc9f 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -403,11 +403,11 @@ static int SRP_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) BIGNUM *r = BN_new(); int ret = g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && - BN_is_prime(N,SRP_NUMBER_ITERATIONS_FOR_PRIME,NULL,bn_ctx,NULL) && + BN_is_prime_ex(N,SRP_NUMBER_ITERATIONS_FOR_PRIME,bn_ctx,NULL) && p != NULL && BN_rshift1(p, N) && /* p = (N-1)/2 */ - BN_is_prime(p,SRP_NUMBER_ITERATIONS_FOR_PRIME,NULL,bn_ctx,NULL) && + BN_is_prime_ex(p,SRP_NUMBER_ITERATIONS_FOR_PRIME,bn_ctx,NULL) && r != NULL && /* verify g^((N-1)/2) == -1 (mod N) */ diff --git a/apps/srp.c b/apps/srp.c index 5e1b23c869..e397011c0e 100644 --- a/apps/srp.c +++ b/apps/srp.c @@ -140,12 +140,12 @@ static int get_index(CA_DB *db, char* id, char type) return -1 ; } -static void print_entry(CA_DB *db, BIO * bio, int index, int verbose, char * s) +static void print_entry(CA_DB *db, BIO * bio, int indx, int verbose, char * s) { - if (index >= 0 && verbose) + if (indx >= 0 && verbose) { int j; - char **pp=sk_OPENSSL_PSTRING_value(db->db->data,index); + char **pp=sk_OPENSSL_PSTRING_value(db->db->data,indx); BIO_printf(bio,"%s \"%s\"\n",s,pp[DB_srpid]); for (j = 0; j < DB_NUMBER; j++) { @@ -696,10 +696,10 @@ bad: } else { - char ** pp = sk_OPENSSL_PSTRING_value(db->db->data,userindex); + char ** xpp = sk_OPENSSL_PSTRING_value(db->db->data,userindex); BIO_printf(bio_err,"user \"%s\" revoked. t\n",user); - pp[DB_srptype][0] = 'R' ; + xpp[DB_srptype][0] = 'R' ; doupdatedb = 1; } diff --git a/crypto/srp/srp_lib.c b/crypto/srp/srp_lib.c index dbf464bbf4..9f6318281d 100644 --- a/crypto/srp/srp_lib.c +++ b/crypto/srp/srp_lib.c @@ -326,7 +326,7 @@ int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N) */ char * SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N) { - int i; + size_t i; if ((g == NULL) || (N == NULL)) return 0; @@ -343,7 +343,7 @@ char * SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N) SRP_gN *SRP_get_default_gN(const char * id) { - int i; + size_t i; if (id == NULL) return knowngN; diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c index 8b96a20d56..ba3dca074e 100644 --- a/crypto/srp/srp_vfy.c +++ b/crypto/srp/srp_vfy.c @@ -414,14 +414,14 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) else if (pp[DB_srptype][0] == DB_SRP_VALID) { /* it is a user .... */ - SRP_gN *gN; - if ((gN = SRP_get_gN_by_id(pp[DB_srpgN],SRP_gN_tab))!=NULL) + SRP_gN *lgN; + if ((lgN = SRP_get_gN_by_id(pp[DB_srpgN],SRP_gN_tab))!=NULL) { error_code = SRP_ERR_MEMORY; if ((user_pwd = SRP_user_pwd_new()) == NULL) goto err; - SRP_user_pwd_set_gN(user_pwd,gN->g,gN->N); + SRP_user_pwd_set_gN(user_pwd,lgN->g,lgN->N); if (!SRP_user_pwd_set_ids(user_pwd, pp[DB_srpid], pp[DB_srpinfo])) goto err; diff --git a/ssl/tls_srp.c b/ssl/tls_srp.c index de5ee99a74..e6c109b6a4 100644 --- a/ssl/tls_srp.c +++ b/ssl/tls_srp.c @@ -414,7 +414,7 @@ err: int SRP_Calc_A_param(SSL *s) { - unsigned char rand[SSL_MAX_MASTER_KEY_LENGTH]; + unsigned char rnd[SSL_MAX_MASTER_KEY_LENGTH]; if (BN_num_bits(s->srp_ctx.N) < s->srp_ctx.strength) return 0; @@ -423,10 +423,10 @@ int SRP_Calc_A_param(SSL *s) !SRP_check_known_gN_param(s->srp_ctx.g,s->srp_ctx.N)) return 0; - if (RAND_bytes(rand, sizeof(rand)) <= 0) + if (RAND_bytes(rnd, sizeof(rnd)) <= 0) return 0; - s->srp_ctx.a = BN_bin2bn(rand,sizeof(rand), s->srp_ctx.a); - OPENSSL_cleanse(rand,sizeof(rand)); + s->srp_ctx.a = BN_bin2bn(rnd,sizeof(rnd), s->srp_ctx.a); + OPENSSL_cleanse(rnd,sizeof(rnd)); if (!(s->srp_ctx.A = SRP_Calc_A(s->srp_ctx.a,s->srp_ctx.N,s->srp_ctx.g))) return 0; -- 2.25.1