@@ -2516,6 +2516,7 @@ static const unsigned char test_PRNG_kat0_aes256[128] = {
2516
2516
2517
2517
static void test_crypto_prng (abts_case * tc , apr_crypto_cipher_e cipher , const unsigned char * test_PRNG_kat0 )
2518
2518
{
2519
+ char errbuf [128 ];
2519
2520
unsigned char randbytes [128 ], seed [APR_CRYPTO_PRNG_SEED_SIZE ];
2520
2521
apr_crypto_prng_t * cprng = NULL ;
2521
2522
apr_pool_t * pool = NULL ;
@@ -2527,9 +2528,18 @@ static void test_crypto_prng(abts_case *tc, apr_crypto_cipher_e cipher, const un
2527
2528
ABTS_PTR_NOTNULL (tc , pool );
2528
2529
2529
2530
rv = apr_crypto_prng_init (pool , NULL , cipher , 0 , NULL , 0 );
2531
+
2532
+ if (APR_EDSOOPEN == rv ) {
2533
+ ABTS_NOT_IMPL (tc ,
2534
+ apr_psprintf (pool , "Crypto driver default DSO could not be opened" ));
2535
+ return ;
2536
+ }
2537
+
2530
2538
ABTS_ASSERT (tc , "apr_crypto_prng_init returned APR_EREINIT" , rv != APR_EREINIT );
2531
2539
ABTS_ASSERT (tc , "apr_crypto_prng_init returned APR_ENOTIMPL" , rv != APR_ENOTIMPL );
2532
- ABTS_ASSERT (tc , "apr_crypto_prng_init failed" , rv == APR_SUCCESS || rv == APR_ENOCIPHER );
2540
+ ABTS_ASSERT (tc , apr_psprintf (pool , "apr_crypto_prng_init failed: %s" ,
2541
+ apr_strerror (rv , errbuf , sizeof (errbuf ))),
2542
+ rv == APR_SUCCESS || rv == APR_ENOCIPHER );
2533
2543
if (rv != APR_SUCCESS ) {
2534
2544
apr_pool_destroy (pool );
2535
2545
return ;
@@ -2545,7 +2555,9 @@ static void test_crypto_prng(abts_case *tc, apr_crypto_cipher_e cipher, const un
2545
2555
ABTS_ASSERT (tc , "apr_crypto_prng_create returned APR_ENOTIMPL" , rv != APR_ENOTIMPL );
2546
2556
ABTS_ASSERT (tc , "apr_crypto_prng_create returned APR_ENOCIPHER" , rv != APR_ENOCIPHER );
2547
2557
ABTS_ASSERT (tc , "apr_crypto_prng_create returned APR_EDSOOPEN" , rv != APR_EDSOOPEN );
2548
- ABTS_ASSERT (tc , "apr_crypto_prng_create failed" , rv == APR_SUCCESS );
2558
+ ABTS_ASSERT (tc , apr_psprintf (pool , "apr_crypto_prng_create failed: %s" ,
2559
+ apr_strerror (rv , errbuf , sizeof (errbuf ))),
2560
+ rv == APR_SUCCESS );
2549
2561
if (rv != APR_SUCCESS ) {
2550
2562
break ;
2551
2563
}
@@ -2598,6 +2610,7 @@ static void test_crypto_prng_chacha20(abts_case *tc, void *data)
2598
2610
#if APR_HAS_FORK
2599
2611
static void test_crypto_fork_random (abts_case * tc , void * data )
2600
2612
{
2613
+ char errbuf [128 ];
2601
2614
unsigned char randbytes [1024 ];
2602
2615
apr_pool_t * pool = NULL ;
2603
2616
apr_file_t * pread = NULL ;
@@ -2611,9 +2624,18 @@ static void test_crypto_fork_random(abts_case *tc, void *data)
2611
2624
ABTS_PTR_NOTNULL (tc , pool );
2612
2625
2613
2626
rv = apr_crypto_prng_init (pool , NULL , APR_CRYPTO_CIPHER_AUTO , 0 , NULL , 0 );
2627
+
2628
+ if (APR_EDSOOPEN == rv ) {
2629
+ ABTS_NOT_IMPL (tc ,
2630
+ apr_psprintf (pool , "Crypto driver default DSO could not be opened" ));
2631
+ return ;
2632
+ }
2633
+
2614
2634
ABTS_ASSERT (tc , "apr_crypto_prng_init returned APR_EREINIT" , rv != APR_EREINIT );
2615
2635
ABTS_ASSERT (tc , "apr_crypto_prng_init returned APR_ENOTIMPL" , rv != APR_ENOTIMPL );
2616
- ABTS_ASSERT (tc , "apr_crypto_prng_init failed" , rv == APR_SUCCESS );
2636
+ ABTS_ASSERT (tc , apr_psprintf (pool , "apr_crypto_prng_init failed: %s" ,
2637
+ apr_strerror (rv , errbuf , sizeof (errbuf ))),
2638
+ rv == APR_SUCCESS );
2617
2639
2618
2640
rv = apr_file_pipe_create (& pread , & pwrite , p );
2619
2641
ABTS_INT_EQUAL (tc , APR_SUCCESS , rv );
@@ -2681,6 +2703,7 @@ static void *APR_THREAD_FUNC thread_func(apr_thread_t *thd, void *data)
2681
2703
2682
2704
static void test_crypto_thread_random (abts_case * tc , void * data )
2683
2705
{
2706
+ char errbuf [128 ];
2684
2707
static unsigned char zerobytes [800 ];
2685
2708
unsigned char * randbytes [NUM_THREADS ];
2686
2709
apr_thread_t * threads [NUM_THREADS ];
@@ -2694,9 +2717,18 @@ static void test_crypto_thread_random(abts_case *tc, void *data)
2694
2717
ABTS_PTR_NOTNULL (tc , pool );
2695
2718
2696
2719
rv = apr_crypto_prng_init (pool , NULL , APR_CRYPTO_CIPHER_AUTO , 0 , NULL , flags );
2720
+
2721
+ if (APR_EDSOOPEN == rv ) {
2722
+ ABTS_NOT_IMPL (tc ,
2723
+ apr_psprintf (pool , "Crypto driver default DSO could not be opened" ));
2724
+ return ;
2725
+ }
2726
+
2697
2727
ABTS_ASSERT (tc , "apr_crypto_prng_init returned APR_EREINIT" , rv != APR_EREINIT );
2698
2728
ABTS_ASSERT (tc , "apr_crypto_prng_init returned APR_ENOTIMPL" , rv != APR_ENOTIMPL );
2699
- ABTS_ASSERT (tc , "apr_crypto_prng_init failed" , rv == APR_SUCCESS );
2729
+ ABTS_ASSERT (tc , apr_psprintf (pool , "apr_crypto_prng_init failed: %s" ,
2730
+ apr_strerror (rv , errbuf , sizeof (errbuf ))),
2731
+ rv == APR_SUCCESS );
2700
2732
2701
2733
for (i = 0 ; i < NUM_THREADS ; ++ i ) {
2702
2734
randbytes [i ] = apr_pcalloc (pool , 800 );
0 commit comments