Skip to content

OpenVMS rand_vms.c dependency #18727

@mgdaniel

Description

@mgdaniel

Hello again Richard (I'm guessing).

Building on VMS V8.4 introduces a dependency on SYS$GETTIM_PREC that precludes an executable from running on say V8.3 (and there are lots of VMS systems about that have not moved to V8.4 for various reasons). To address this dependency I suggest adopting the approach used for SYS$GET_ENTROPY, that is, dynamically loading the SYS$GETTIM_PREC address at runtime. If it cannot be found (e.g. on V8.3) then just setting the address to be SYS$GETTIM (which is always available). This will extend the availability of OpenSSL builds provided by say VSI, to a significantly broader range of VMS systems.

#define PUBLIC_VECTORS "SYS$LIBRARY:SYS$PUBLIC_VECTORS.EXE"
#define GET_GETTIM_PREC "SYS$GETTIM_PREC"

static void (*get_gettim_prec_address)(void*) = NULL;
static void init_get_gettim_prec_address(void)
{
    get_gettim_prec_address = dlsym(dlopen(PUBLIC_VECTORS, 0), GET_GETTIM_PREC);
    if (get_gettim_prec_address == NULL) get_gettim_prec_address = (void*)sys$gettim;
}

#undef PUBLIC_VECTORS

Then for rand_pool_add_nonce_data()

data.pid = getpid();
data.tid = CRYPTO_THREAD_get_current_id();
if (get_gettim_prec_address == NULL) init_get_gettim_prec_address();
get_gettim_prec_address((void*)&data.time);

and rand_pool_add_additional_data()

data.tid = CRYPTO_THREAD_get_current_id();
if (get_gettim_prec_address == NULL) init_get_gettim_prec_address();
get_gettim_prec_address((void*)&data.time);

This has been tested under OpenSSL 1.1.1l on VMS V8.4 and V8.3.

The full modified OpenSSL 1.1.1l rand_vms.c for comparison purposes can be found at

https://wasd.vsm.com.au/wasd_root/src/openssl-1_1_1l/crypto/rand/rand_vms.c

Metadata

Metadata

Assignees

No one assigned

    Labels

    triaged: bugThe issue/pr is/fixes a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions