fixing keylength bug at the right place:
authorMartin Willi <martin@strongswan.org>
Wed, 12 Nov 2008 08:27:48 +0000 (08:27 -0000)
committerMartin Willi <martin@strongswan.org>
Wed, 12 Nov 2008 08:27:48 +0000 (08:27 -0000)
we usually don't touch output parameters if operations fails

src/charon/config/proposal.c
src/charon/sa/keymat.c

index 1421d5e..11143a4 100644 (file)
@@ -210,21 +210,13 @@ static bool get_algorithm(private_proposal_t *this, transform_type_t type,
                                                  u_int16_t *alg, u_int16_t *key_size)
 {
        enumerator_t *enumerator;
-       bool found;
+       bool found = FALSE;
        
        enumerator = create_enumerator(this, type);
        if (enumerator->enumerate(enumerator, alg, key_size))
        {
                found = TRUE;
        }
-       else
-       {
-               if (key_size)
-               {
-                       *key_size = 0;
-               }
-               found = FALSE;
-       }
        enumerator->destroy(enumerator);
        return found;
 }
index c2a899d..c65bfc3 100644 (file)
@@ -357,7 +357,7 @@ static bool derive_child_keys(private_keymat_t *this,
                                                          chunk_t *encr_i, chunk_t *integ_i,
                                                          chunk_t *encr_r, chunk_t *integ_r)
 {
-       u_int16_t enc_alg, int_alg, enc_size, int_size;
+       u_int16_t enc_alg, int_alg, enc_size = 0, int_size = 0;
        chunk_t seed, secret = chunk_empty;
        prf_plus_t *prf_plus;