replace printf with error statements (#68)

Co-authored-by: neelimap <neelimaps@neominds.in>
Reviewed-on: http://13.234.246.121:3000/Neominds/ossl35vx69/pulls/68
Co-authored-by: Neelima P S <neelima.ps@neominds.in>
Co-committed-by: Neelima P S <neelima.ps@neominds.in>
This commit is contained in:
2026-07-30 20:45:01 +05:30
committed by neelimap
co-authored by neelimap
parent 8687d25f7c
commit 5fa0d78215
6 changed files with 83 additions and 31 deletions
@@ -1,6 +1,6 @@
/* /*
* Generated by util/mkerr.pl DO NOT EDIT * Generated by util/mkerr.pl DO NOT EDIT
* Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
* *
* Licensed under the Apache License 2.0 (the "License"). You may not use * Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy * this file except in compliance with the License. You can obtain a copy
@@ -15,6 +15,8 @@
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
static const ERR_STRING_DATA CRYPTO_str_reasons[] = { static const ERR_STRING_DATA CRYPTO_str_reasons[] = {
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_ADD_DELETE_HOOK_FAILED),
"failed to add delete hook"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_BAD_ALGORITHM_NAME), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_BAD_ALGORITHM_NAME),
"bad algorithm name"}, "bad algorithm name"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_CONFLICTING_NAMES), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_CONFLICTING_NAMES),
@@ -32,11 +34,15 @@ static const ERR_STRING_DATA CRYPTO_str_reasons[] = {
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_INTEGER_OVERFLOW), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_INTEGER_OVERFLOW),
"integer overflow"}, "integer overflow"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_INVALID_NEGATIVE_VALUE), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_INVALID_NEGATIVE_VALUE),
"invalid negative value"}, "invalid negative value"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_INVALID_NULL_ARGUMENT), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_INVALID_NULL_ARGUMENT),
"invalid null argument"}, "invalid null argument"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_INVALID_OSSL_PARAM_TYPE), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_INVALID_OSSL_PARAM_TYPE),
"invalid ossl param type"}, "invalid ossl param type"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_INVALID_PARAMETER),
"invalid parameter(s)"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_MEMORY_ALLOCATION_FAILED),
"failed to allocate memory"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_NO_PARAMS_TO_MERGE), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_NO_PARAMS_TO_MERGE),
"no params to merge"}, "no params to merge"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL),
@@ -57,12 +63,20 @@ static const ERR_STRING_DATA CRYPTO_str_reasons[] = {
"param value too large for destination"}, "param value too large for destination"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_PROVIDER_ALREADY_EXISTS), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_PROVIDER_ALREADY_EXISTS),
"provider already exists"}, "provider already exists"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_PROVIDER_LOAD_FAILED),
"provider load failed"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_PROVIDER_SECTION_ERROR), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_PROVIDER_SECTION_ERROR),
"provider section error"}, "provider section error"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_RANDOM_SECTION_ERROR), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_RANDOM_SECTION_ERROR),
"random section error"}, "random section error"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_RCU_LOCK_IS_NULL),
"RCU lock is NULL"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_SECURE_MALLOC_FAILURE), {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_SECURE_MALLOC_FAILURE),
"secure malloc failure"}, "secure malloc failure"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_SEMAPHORE_CREATION_FAILED),
"semaphore creation failed"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_STDERR_STDOUT_OPEN_FAILED),
"failed to open file for stdout and stderr"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_STRING_TOO_LONG), "string too long"}, {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_STRING_TOO_LONG), "string too long"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_TOO_MANY_BYTES), "too many bytes"}, {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_TOO_MANY_BYTES), "too many bytes"},
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_TOO_MANY_NAMES), "too many names"}, {ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_TOO_MANY_NAMES), "too many names"},
@@ -1,4 +1,4 @@
# Copyright 1999-2025 The OpenSSL Project Authors. All Rights Reserved. # Copyright 1999-2026 The OpenSSL Project Authors. All Rights Reserved.
# #
# Licensed under the Apache License 2.0 (the "License"). You may not use # Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy # this file except in compliance with the License. You can obtain a copy
@@ -480,6 +480,7 @@ CRMF_R_UNSUPPORTED_CIPHER:114:unsupported cipher
CRMF_R_UNSUPPORTED_METHOD_FOR_CREATING_POPO:115:\ CRMF_R_UNSUPPORTED_METHOD_FOR_CREATING_POPO:115:\
unsupported method for creating popo unsupported method for creating popo
CRMF_R_UNSUPPORTED_POPO_METHOD:116:unsupported popo method CRMF_R_UNSUPPORTED_POPO_METHOD:116:unsupported popo method
CRYPTO_R_ADD_DELETE_HOOK_FAILED:135:failed to add delete hook
CRYPTO_R_BAD_ALGORITHM_NAME:117:bad algorithm name CRYPTO_R_BAD_ALGORITHM_NAME:117:bad algorithm name
CRYPTO_R_CONFLICTING_NAMES:118:conflicting names CRYPTO_R_CONFLICTING_NAMES:118:conflicting names
CRYPTO_R_HEX_STRING_TOO_SHORT:121:hex string too short CRYPTO_R_HEX_STRING_TOO_SHORT:121:hex string too short
@@ -491,6 +492,8 @@ CRYPTO_R_INTEGER_OVERFLOW:127:integer overflow
CRYPTO_R_INVALID_NEGATIVE_VALUE:122:invalid negative value CRYPTO_R_INVALID_NEGATIVE_VALUE:122:invalid negative value
CRYPTO_R_INVALID_NULL_ARGUMENT:109:invalid null argument CRYPTO_R_INVALID_NULL_ARGUMENT:109:invalid null argument
CRYPTO_R_INVALID_OSSL_PARAM_TYPE:110:invalid ossl param type CRYPTO_R_INVALID_OSSL_PARAM_TYPE:110:invalid ossl param type
CRYPTO_R_INVALID_PARAMETER:136:invalid parameter(s)
CRYPTO_R_MEMORY_ALLOCATION_FAILED:137:failed to allocate memory
CRYPTO_R_NO_PARAMS_TO_MERGE:131:no params to merge CRYPTO_R_NO_PARAMS_TO_MERGE:131:no params to merge
CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL:128:no space for terminating null CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL:128:no space for terminating null
CRYPTO_R_ODD_NUMBER_OF_DIGITS:103:odd number of digits CRYPTO_R_ODD_NUMBER_OF_DIGITS:103:odd number of digits
@@ -505,9 +508,13 @@ CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT:130:\
CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION:126:\ CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION:126:\
param value too large for destination param value too large for destination
CRYPTO_R_PROVIDER_ALREADY_EXISTS:104:provider already exists CRYPTO_R_PROVIDER_ALREADY_EXISTS:104:provider already exists
CRYPTO_R_PROVIDER_LOAD_FAILED:133:provider load failed
CRYPTO_R_PROVIDER_SECTION_ERROR:105:provider section error CRYPTO_R_PROVIDER_SECTION_ERROR:105:provider section error
CRYPTO_R_RANDOM_SECTION_ERROR:119:random section error CRYPTO_R_RANDOM_SECTION_ERROR:119:random section error
CRYPTO_R_RCU_LOCK_IS_NULL:139:RCU lock is NULL
CRYPTO_R_SECURE_MALLOC_FAILURE:111:secure malloc failure CRYPTO_R_SECURE_MALLOC_FAILURE:111:secure malloc failure
CRYPTO_R_SEMAPHORE_CREATION_FAILED:138:semaphore creation failed
CRYPTO_R_STDERR_STDOUT_OPEN_FAILED:134:failed to open file for stdout and stderr
CRYPTO_R_STRING_TOO_LONG:112:string too long CRYPTO_R_STRING_TOO_LONG:112:string too long
CRYPTO_R_TOO_MANY_BYTES:113:too many bytes CRYPTO_R_TOO_MANY_BYTES:113:too many bytes
CRYPTO_R_TOO_MANY_NAMES:132:too many names CRYPTO_R_TOO_MANY_NAMES:132:too many names
@@ -803,6 +810,12 @@ EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED:179:\
pkey application asn1 method already registered pkey application asn1 method already registered
EVP_R_PRIVATE_KEY_DECODE_ERROR:145:private key decode error EVP_R_PRIVATE_KEY_DECODE_ERROR:145:private key decode error
EVP_R_PRIVATE_KEY_ENCODE_ERROR:146:private key encode error EVP_R_PRIVATE_KEY_ENCODE_ERROR:146:private key encode error
EVP_R_PROVIDER_ASYM_CIPHER_FAILURE:232:provider asym cipher failure
EVP_R_PROVIDER_ASYM_CIPHER_NOT_SUPPORTED:235:provider asym cipher not supported
EVP_R_PROVIDER_KEYMGMT_FAILURE:233:provider keymgmt failure
EVP_R_PROVIDER_KEYMGMT_NOT_SUPPORTED:236:provider keymgmt not supported
EVP_R_PROVIDER_SIGNATURE_FAILURE:234:provider signature failure
EVP_R_PROVIDER_SIGNATURE_NOT_SUPPORTED:237:provider signature not supported
EVP_R_PUBLIC_KEY_NOT_RSA:106:public key not rsa EVP_R_PUBLIC_KEY_NOT_RSA:106:public key not rsa
EVP_R_SETTING_XOF_FAILED:227:setting xof failed EVP_R_SETTING_XOF_FAILED:227:setting xof failed
EVP_R_SET_DEFAULT_PROPERTY_FAILURE:209:set default property failure EVP_R_SET_DEFAULT_PROPERTY_FAILURE:209:set default property failure
@@ -1070,6 +1083,7 @@ PROV_R_FAILED_TO_SIGN:175:failed to sign
PROV_R_FINAL_CALL_OUT_OF_ORDER:237:final call out of order PROV_R_FINAL_CALL_OUT_OF_ORDER:237:final call out of order
PROV_R_FIPS_MODULE_CONDITIONAL_ERROR:227:fips module conditional error PROV_R_FIPS_MODULE_CONDITIONAL_ERROR:227:fips module conditional error
PROV_R_FIPS_MODULE_ENTERING_ERROR_STATE:224:fips module entering error state PROV_R_FIPS_MODULE_ENTERING_ERROR_STATE:224:fips module entering error state
PROV_R_FIPS_MODULE_IMPORT_PCT_ERROR:253:fips module import pct error
PROV_R_FIPS_MODULE_IN_ERROR_STATE:225:fips module in error state PROV_R_FIPS_MODULE_IN_ERROR_STATE:225:fips module in error state
PROV_R_GENERATE_ERROR:191:generate error PROV_R_GENERATE_ERROR:191:generate error
PROV_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE:165:\ PROV_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE:165:\
@@ -836,11 +836,15 @@ int ipcrypto_init_internal(SEM_ID semId)
legacy = OSSL_PROVIDER_load(NULL, "legacy"); legacy = OSSL_PROVIDER_load(NULL, "legacy");
if (legacy == NULL) { if (legacy == NULL) {
printf("Failed to load Legacy provider\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PROVIDER_LOAD_FAILED);
ERR_add_error_data(1, "Failed to load Legacy provider\n");
ERR_print_errors_fp(stderr);
} }
deflt = OSSL_PROVIDER_load(NULL, "default"); deflt = OSSL_PROVIDER_load(NULL, "default");
if (deflt == NULL) { if (deflt == NULL) {
printf("Failed to load Default provider\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_PROVIDER_LOAD_FAILED);
ERR_add_error_data(1, "Failed to load Default provider\n");
ERR_print_errors_fp(stderr);
OSSL_PROVIDER_unload(legacy); OSSL_PROVIDER_unload(legacy);
} }
@@ -856,7 +860,9 @@ int ipcrypto_init_internal(SEM_ID semId)
fperr = fdopen(fderr, "w"); fperr = fdopen(fderr, "w");
if (!fpout || !fderr) if (!fpout || !fderr)
{ {
printf ("Failed to open file for stdout and stderr\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_STDERR_STDOUT_OPEN_FAILED);
ERR_add_error_data(1, "Failed to open file for stdout and stderr\n");
ERR_print_errors_fp(stderr);
return -1; return -1;
} }
@@ -878,7 +884,9 @@ int ipcrypto_init_internal(SEM_ID semId)
*/ */
if (taskDeleteHookAdd ((FUNCPTR) openSSLTaskDeleteHook) != OK) { if (taskDeleteHookAdd ((FUNCPTR) openSSLTaskDeleteHook) != OK) {
printf ("ipcrypto_init_internal() failed to add delete hook"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_ADD_DELETE_HOOK_FAILED);
ERR_add_error_data(1, "ipcrypto_init_internal() failed to add delete hook");
ERR_print_errors_fp(stderr);
return -1; return -1;
} }
@@ -1,5 +1,6 @@
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include <openssl/vxrcu.h> #include <openssl/vxrcu.h>
#include <openssl/err.h>
static CRYPTO_RWLOCK_VX *local_rcu_rwlock = NULL; static CRYPTO_RWLOCK_VX *local_rcu_rwlock = NULL;
static int is_rwlock_init = 0; static int is_rwlock_init = 0;
@@ -11,7 +12,9 @@ int CRYPTO_atomic_load_int(int *val, int *ret, CRYPTO_RWLOCK *lock)
if (!val || !ret || !lock) if (!val || !ret || !lock)
{ {
printf ("CRYPTO_atomic_load_int:: invalid parameter(s)\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_INVALID_PARAMETER);
ERR_add_error_data(1, "CRYPTO_atomic_load_int:: invalid parameter(s)\n");
ERR_print_errors_fp(stderr);
return 0; return 0;
} }
@@ -29,7 +32,9 @@ int CRYPTO_atomic_store(uint64_t *dst, uint64_t val, CRYPTO_RWLOCK *lock)
if (!dst || !lock) if (!dst || !lock)
{ {
printf ("CRYPTO_atomic_store:: invalid parameter(s)\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_INVALID_PARAMETER);
ERR_add_error_data(1, "CRYPTO_atomic_store:: invalid parameter(s)\n");
ERR_print_errors_fp(stderr);
return 0; return 0;
} }
@@ -47,13 +52,19 @@ CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers, OSSL_LIB_CTX *ctx)
CRYPTO_RCU_LOCK *lock = OPENSSL_malloc (sizeof(CRYPTO_RCU_LOCK)); CRYPTO_RCU_LOCK *lock = OPENSSL_malloc (sizeof(CRYPTO_RCU_LOCK));
if (!lock) if (!lock)
{ {
printf ("ossl_rcu_lock_new:: Failed to allocate memory for RCU lock\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_MEMORY_ALLOCATION_FAILED);
ERR_add_error_data(1, "ossl_rcu_lock_new:: Failed to allocate memory for RCU lock\n");
ERR_print_errors_fp(stderr);
return NULL; return NULL;
} }
lock->writer_lock = semMCreate (SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE); lock->writer_lock = semMCreate (SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE);
if (!(lock->writer_lock)) if (!(lock->writer_lock))
printf ("ossl_rcu_lock_new:: semMCreate failed for writer_lock\n"); {
ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_SEMAPHORE_CREATION_FAILED);
ERR_add_error_data(1, "ossl_rcu_lock_new:: semMCreate failed for writer_lock\n");
ERR_print_errors_fp(stderr);
}
lock->active_readers = 0; lock->active_readers = 0;
@@ -62,7 +73,9 @@ CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers, OSSL_LIB_CTX *ctx)
local_rcu_rwlock = OPENSSL_malloc (sizeof (CRYPTO_RWLOCK_VX)); local_rcu_rwlock = OPENSSL_malloc (sizeof (CRYPTO_RWLOCK_VX));
if (!local_rcu_rwlock) if (!local_rcu_rwlock)
{ {
printf ("ossl_rcu_lock_new:: Failed to allocate memory\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_MEMORY_ALLOCATION_FAILED);
ERR_add_error_data(1, "ossl_rcu_lock_new:: Failed to allocate memory\n");
ERR_print_errors_fp(stderr);
return NULL; return NULL;
} }
@@ -70,7 +83,11 @@ CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers, OSSL_LIB_CTX *ctx)
local_rcu_rwlock->sem = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE); local_rcu_rwlock->sem = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE);
if (!(local_rcu_rwlock->sem)) if (!(local_rcu_rwlock->sem))
printf ("ossl_rcu_lock_new:: semMCreate failed for local_rcu_rwlock\n"); {
ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_SEMAPHORE_CREATION_FAILED);
ERR_add_error_data(1, "ossl_rcu_lock_new:: semMCreate failed for local_rcu_rwlock\n");
ERR_print_errors_fp(stderr);
}
is_rwlock_init = 1; is_rwlock_init = 1;
} }
@@ -90,7 +107,9 @@ void ossl_rcu_lock_free(CRYPTO_RCU_LOCK *lock)
if (!lock) if (!lock)
{ {
printf ("ossl_rcu_lock_free:: RCU lock is NULL\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_RCU_LOCK_IS_NULL);
ERR_add_error_data(1, "ossl_rcu_lock_free:: RCU lock is NULL\n");
ERR_print_errors_fp(stderr);
return; return;
} }
@@ -166,14 +185,18 @@ int ossl_rcu_call(CRYPTO_RCU_LOCK *lock, rcu_cb_fn cb, void *data)
{ {
if (!lock || !cb) if (!lock || !cb)
{ {
printf ("ossl_rcu_call:: invalid parameter(s)\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_INVALID_PARAMETER);
ERR_add_error_data(1, "ossl_rcu_call:: invalid parameter(s)\n");
ERR_print_errors_fp(stderr);
return 0; return 0;
} }
struct rcu_cb_item *new = OPENSSL_zalloc(sizeof(*new)); struct rcu_cb_item *new = OPENSSL_zalloc(sizeof(*new));
if (!new) if (!new)
{ {
printf ("ossl_rcu_call:: memory allocation for RCU callback failed\n"); ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_MEMORY_ALLOCATION_FAILED);
ERR_add_error_data(1, "ossl_rcu_call:: memory allocation for RCU callback failed\n");
ERR_print_errors_fp(stderr);
return 0; return 0;
} }
@@ -1,6 +1,6 @@
/* /*
* Generated by util/mkerr.pl DO NOT EDIT * Generated by util/mkerr.pl DO NOT EDIT
* Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * Copyright 1995-2026 The OpenSSL Project Authors. All Rights Reserved.
* *
* Licensed under the Apache License 2.0 (the "License"). You may not use * Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy * this file except in compliance with the License. You can obtain a copy
@@ -21,6 +21,7 @@
/* /*
* CRYPTO reason codes. * CRYPTO reason codes.
*/ */
# define CRYPTO_R_ADD_DELETE_HOOK_FAILED 135
# define CRYPTO_R_BAD_ALGORITHM_NAME 117 # define CRYPTO_R_BAD_ALGORITHM_NAME 117
# define CRYPTO_R_CONFLICTING_NAMES 118 # define CRYPTO_R_CONFLICTING_NAMES 118
# define CRYPTO_R_HEX_STRING_TOO_SHORT 121 # define CRYPTO_R_HEX_STRING_TOO_SHORT 121
@@ -32,6 +33,8 @@
# define CRYPTO_R_INVALID_NEGATIVE_VALUE 122 # define CRYPTO_R_INVALID_NEGATIVE_VALUE 122
# define CRYPTO_R_INVALID_NULL_ARGUMENT 109 # define CRYPTO_R_INVALID_NULL_ARGUMENT 109
# define CRYPTO_R_INVALID_OSSL_PARAM_TYPE 110 # define CRYPTO_R_INVALID_OSSL_PARAM_TYPE 110
# define CRYPTO_R_INVALID_PARAMETER 136
# define CRYPTO_R_MEMORY_ALLOCATION_FAILED 137
# define CRYPTO_R_NO_PARAMS_TO_MERGE 131 # define CRYPTO_R_NO_PARAMS_TO_MERGE 131
# define CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL 128 # define CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL 128
# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103 # define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103
@@ -42,9 +45,13 @@
# define CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT 130 # define CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT 130
# define CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION 126 # define CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION 126
# define CRYPTO_R_PROVIDER_ALREADY_EXISTS 104 # define CRYPTO_R_PROVIDER_ALREADY_EXISTS 104
# define CRYPTO_R_PROVIDER_LOAD_FAILED 133
# define CRYPTO_R_PROVIDER_SECTION_ERROR 105 # define CRYPTO_R_PROVIDER_SECTION_ERROR 105
# define CRYPTO_R_RANDOM_SECTION_ERROR 119 # define CRYPTO_R_RANDOM_SECTION_ERROR 119
# define CRYPTO_R_RCU_LOCK_IS_NULL 139
# define CRYPTO_R_SECURE_MALLOC_FAILURE 111 # define CRYPTO_R_SECURE_MALLOC_FAILURE 111
# define CRYPTO_R_SEMAPHORE_CREATION_FAILED 138
# define CRYPTO_R_STDERR_STDOUT_OPEN_FAILED 134
# define CRYPTO_R_STRING_TOO_LONG 112 # define CRYPTO_R_STRING_TOO_LONG 112
# define CRYPTO_R_TOO_MANY_BYTES 113 # define CRYPTO_R_TOO_MANY_BYTES 113
# define CRYPTO_R_TOO_MANY_NAMES 132 # define CRYPTO_R_TOO_MANY_NAMES 132
@@ -201,17 +201,3 @@ UINT8* collectEntropyFromInterruptJitter(void) {
return result; return result;
} }
void seedOpenSSLWithJitterEntropy(void) {
sysTimestampEnable();
UINT8 *entropy = collectEntropyFromInterruptJitter();
if (entropy) {
/* Add 32 bytes of entropy with estimated 256 bits of randomness */
RAND_add(entropy, ENTROPY_BUFFER_SIZE, ENTROPY_BUFFER_SIZE * 8.0);
free(entropy);
printf("OpenSSL RNG seeded with interrupt jitter entropy\n");
} else {
printf("Failed to collect entropy from interrupt jitter\n");
}
}