]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix test_tortls.c to no longer test failing crypto_rand.
authorNick Mathewson <nickm@torproject.org>
Thu, 26 Nov 2015 14:34:44 +0000 (09:34 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 26 Nov 2015 14:34:44 +0000 (09:34 -0500)
(crypto_rand is no longer allowed to fail.)

Closes bug 17686; bug not in any released tor.  (No backport, since
the tortls tests aren't in 0.2.7)

src/test/test_tortls.c

index b1d91a61c7c2b227641a76c777f536b0184616a5..94d74c3a7c1f27ab422e113ca6ae5d8aea592102 100644 (file)
@@ -2579,7 +2579,6 @@ test_tortls_context_new(void *ignored)
 
 static int fixed_crypto_pk_get_evp_pkey_result_index = 0;
 static EVP_PKEY *fixed_crypto_pk_get_evp_pkey_result[5];
-static int fixed_crypto_rand_result;
 
 static EVP_PKEY *
 fixed_crypto_pk_get_evp_pkey_(crypto_pk_t *env, int private)
@@ -2590,13 +2589,6 @@ fixed_crypto_pk_get_evp_pkey_(crypto_pk_t *env, int private)
                                fixed_crypto_pk_get_evp_pkey_result_index++];
 }
 
-static int
-fixed_crypto_rand(char *to, size_t n)
-{
-  (void)to;
-  (void)n;
-  return fixed_crypto_rand_result;
-}
 
 static void
 test_tortls_create_certificate(void *ignored)
@@ -2626,16 +2618,7 @@ test_tortls_create_certificate(void *ignored)
   ret = tor_tls_create_certificate(pk1, pk2, "hello", "hello2", 1);
   tt_assert(!ret);
 
-  MOCK(crypto_rand, fixed_crypto_rand);
-  fixed_crypto_rand_result = -1;
-  fixed_crypto_pk_get_evp_pkey_result_index = 0;
-  fixed_crypto_pk_get_evp_pkey_result[0] = tor_malloc_zero(sizeof(EVP_PKEY));
-  fixed_crypto_pk_get_evp_pkey_result[1] = tor_malloc_zero(sizeof(EVP_PKEY));
-  ret = tor_tls_create_certificate(pk1, pk2, "hello", "hello2", 1);
-  tt_assert(!ret);
-
  done:
-  UNMOCK(crypto_rand);
   UNMOCK(crypto_pk_get_evp_pkey_);
   crypto_pk_free(pk1);
   crypto_pk_free(pk2);