You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2021/09/12 13:28:15 UTC
svn commit: r1893275 - /apr/apr/trunk/test/testcrypto.c
Author: ylavic
Date: Sun Sep 12 13:28:15 2021
New Revision: 1893275
URL: http://svn.apache.org/viewvc?rev=1893275&view=rev
Log:
testcrypto: really change one bit of the seed (only) in test_crypto_prng().
Modified:
apr/apr/trunk/test/testcrypto.c
Modified: apr/apr/trunk/test/testcrypto.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testcrypto.c?rev=1893275&r1=1893274&r2=1893275&view=diff
==============================================================================
--- apr/apr/trunk/test/testcrypto.c (original)
+++ apr/apr/trunk/test/testcrypto.c Sun Sep 12 13:28:15 2021
@@ -2460,14 +2460,14 @@ static void test_crypto_prng(abts_case *
break;
}
- /* Second time and more, change one bit of the seed */
+ /* Second time and more, set one random bit of the seed */
if (i != 0) {
- unsigned char pos = 0;
- rv = apr_generate_random_bytes(&pos, sizeof pos);
+ unsigned char rnd;
+ rv = apr_generate_random_bytes(&rnd, sizeof rnd);
ABTS_ASSERT(tc, "apr_generate_random_bytes failed",
rv == APR_SUCCESS);
+ seed[rnd % APR_CRYPTO_PRNG_SEED_SIZE] = (unsigned char)(1u << (rnd % 8));
- seed[pos % APR_CRYPTO_PRNG_SEED_SIZE] = 1;
rv = apr_crypto_prng_reseed(cprng, seed);
ABTS_ASSERT(tc, "apr_crypto_prng_reseed failed",
rv == APR_SUCCESS);