Skip to content

s2n_override_openssl_random_test, Ubuntu 14.04, LibreSSL 2.2.0 #97

@mcarpenter

Description

@mcarpenter

After building LibreSSL with -fPIC (cf. issue #94) the build of s2n itself fails during the unit tests. I have seen two different failures after repeated build attempts.

One of them (s2n_client_extensions_test) is sporadic and mlock() related and I see a note for that in the USAGE docs so I won't consider that further here.

The other failure that I've seen is s2n_override_openssl_random_test. This fails on every invocation at test 20:

$ LD_LIBRARY_PATH=../../lib ./s2n_override_openssl_random_test
Running s2n_override_openssl_random_test.c                 ... FAILED test 20
(mock_called) == (1) is not true  (s2n_override_openssl_random_test.c line 114)
Error Message: 'no error'

Relevant lines from the test:

109     EXPECT_EQUAL(mock_called, 0);
110 
111     EXPECT_TRUE(DH_generate_key(dh_params.dh) == 1);
112 
113     /* Verify that our mock random is called and that over-riding works */
114     EXPECT_EQUAL(mock_called, 1);

from which I gather that mock_openssl_compat_rand() is not being called.

This can happen if it is actually being called but it returns early if the call to s2n_get_urandom_data() fails so this is my primary suspect for now.

 39 static int mock_openssl_compat_rand(unsigned char *buf, int num)
 40 {
 41     struct s2n_blob blob = {.data = buf, .size = num };
 42 
 43     int r = s2n_get_urandom_data(&blob);
 44     if (r < 0) {
 45         return 0;
 46     }
 47 
 48     mock_called = 1;

I'm out of time today! Will try to debug more tomorrow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions