Fix warnings: signed/unisgned comparison, shadowing (in some cases global
authorDr. Stephen Henson <steve@openssl.org>
Sat, 12 Mar 2011 17:27:03 +0000 (17:27 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 12 Mar 2011 17:27:03 +0000 (17:27 +0000)
functions such as rand() ).

apps/s_client.c
apps/srp.c
crypto/srp/srp_lib.c
crypto/srp/srp_vfy.c
ssl/tls_srp.c

index 5e2a5ef..8a57dcf 100644 (file)
@@ -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) */
index 5e1b23c..e397011 100644 (file)
@@ -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;
                                }
index dbf464b..9f63182 100644 (file)
@@ -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;
index 8b96a20..ba3dca0 100644 (file)
@@ -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;
index de5ee99..e6c109b 100644 (file)
@@ -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;