aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-10-25 02:21:25 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-10-25 02:21:25 -0400
commit3c17d3d5f3e34a9302212856b019ddb7842a8a66 (patch)
tree21fd82f88a71f98db461af149925fdcd879f0a99
parent2d7121606c4acb06f5891442bd55b0af750c1466 (diff)
make ossl updates work
-rw-r--r--Taskfile.yaml1
-rw-r--r--src/providers/openssl-helpers.c21
-rw-r--r--src/providers/openssl.c2
3 files changed, 14 insertions, 10 deletions
diff --git a/Taskfile.yaml b/Taskfile.yaml
index 7430244..ea12599 100644
--- a/Taskfile.yaml
+++ b/Taskfile.yaml
@@ -98,6 +98,7 @@ tasks:
silent: true
- cmd: cmake --install {{ .CMAKE_BUILD_DIR }} {{ .CLI_ARGS }}
+ #Test executable and library must be built for tests to run
memcheck:
desc: 'Runs Valgrind memcheck in debug mode against the nctest executable (Linux only)'
platforms:
diff --git a/src/providers/openssl-helpers.c b/src/providers/openssl-helpers.c
index 6037a2f..42e98c3 100644
--- a/src/providers/openssl-helpers.c
+++ b/src/providers/openssl-helpers.c
@@ -37,7 +37,7 @@ typedef enum {
struct ossl_evp_state {
void* _context;
- void* _cipher;
+ void* _providerHandle;
OSSL_PARAM params[2];
@@ -82,6 +82,7 @@ _IMPLSTB cstatus_t _osslEvpUpdate(const struct ossl_evp_state* state, cspan_t da
int result;
DEBUG_ASSERT(state != NULL);
+ DEBUG_ASSERT(state->_context != NULL);
result = 0;
@@ -174,11 +175,11 @@ _IMPLSTB void _osslEvpFree(struct ossl_evp_state* state)
{
case EvpStateTypeDigest:
if (state->_context) EVP_MD_CTX_free(state->_context);
- if (state->_cipher) EVP_MD_free(state->_cipher);
+ if (state->_providerHandle) EVP_MD_free(state->_providerHandle);
break;
case EvpStateTypeMac:
if (state->_context) EVP_MAC_CTX_free(state->_context);
- if (state->_cipher) EVP_MAC_free(state->_cipher);
+ if (state->_providerHandle) EVP_MAC_free(state->_providerHandle);
break;
}
}
@@ -197,16 +198,16 @@ _IMPLSTB cstatus_t _osslEvpInit(
switch (type)
{
case EvpStateTypeDigest:
- state->_cipher = EVP_MD_fetch(NULL, providerName, NULL);
+ state->_providerHandle = EVP_MD_fetch(NULL, providerName, NULL);
state->_context = EVP_MD_CTX_new();
break;
case EvpStateTypeMac:
- state->_cipher = EVP_MAC_fetch(NULL, providerName, NULL);
+ state->_providerHandle = EVP_MAC_fetch(NULL, providerName, NULL);
- if (state->_cipher)
+ if (state->_providerHandle)
{
- state->_context = EVP_MAC_CTX_new((EVP_MAC*)(state->_cipher));
+ state->_context = EVP_MAC_CTX_new((EVP_MAC*)(state->_providerHandle));
}
break;
@@ -218,7 +219,7 @@ _IMPLSTB cstatus_t _osslEvpInit(
* Ensure allocations succeded, otherwise free the context
* and return a failure status.
*/
- if (state->_cipher == NULL || state->_context == NULL)
+ if (state->_providerHandle == NULL || state->_context == NULL)
{
return CSTATUS_FAIL;
}
@@ -230,8 +231,8 @@ _IMPLSTB cstatus_t _osslEvpInit(
{
if (
!EVP_DigestInit_ex(
- state->_context,
- state->_cipher,
+ (EVP_MD_CTX*)state->_context,
+ (EVP_MD*)state->_providerHandle,
NULL
)
)
diff --git a/src/providers/openssl.c b/src/providers/openssl.c
index 7167fac..4b41f1a 100644
--- a/src/providers/openssl.c
+++ b/src/providers/openssl.c
@@ -93,6 +93,8 @@
goto Cleanup;
}
+ result = CSTATUS_OK;
+
Cleanup:
_osslEvpFree(&evpState);