summaryrefslogtreecommitdiffstats
path: root/providers/implementations/exchange/ecx_exch.c
diff options
context:
space:
mode:
Diffstat (limited to 'providers/implementations/exchange/ecx_exch.c')
-rw-r--r--providers/implementations/exchange/ecx_exch.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/providers/implementations/exchange/ecx_exch.c b/providers/implementations/exchange/ecx_exch.c
index 4840b8802f..2a7ea2b8e1 100644
--- a/providers/implementations/exchange/ecx_exch.c
+++ b/providers/implementations/exchange/ecx_exch.c
@@ -15,6 +15,7 @@
#include "internal/cryptlib.h"
#include "crypto/ecx.h"
#include "prov/implementations.h"
+#include "prov/providercommon.h"
#include "prov/providercommonerr.h"
#ifdef S390X_EC_ASM
# include "s390x_arch.h"
@@ -42,8 +43,12 @@ typedef struct {
static void *ecx_newctx(void *provctx, size_t keylen)
{
- PROV_ECX_CTX *ctx = OPENSSL_zalloc(sizeof(PROV_ECX_CTX));
+ PROV_ECX_CTX *ctx;
+ if (!ossl_prov_is_running())
+ return NULL;
+
+ ctx = OPENSSL_zalloc(sizeof(PROV_ECX_CTX));
if (ctx == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
return NULL;
@@ -69,6 +74,9 @@ static int ecx_init(void *vecxctx, void *vkey)
PROV_ECX_CTX *ecxctx = (PROV_ECX_CTX *)vecxctx;
ECX_KEY *key = vkey;
+ if (!ossl_prov_is_running())
+ return 0;
+
if (ecxctx == NULL
|| key == NULL
|| key->keylen != ecxctx->keylen
@@ -88,6 +96,9 @@ static int ecx_set_peer(void *vecxctx, void *vkey)
PROV_ECX_CTX *ecxctx = (PROV_ECX_CTX *)vecxctx;
ECX_KEY *key = vkey;
+ if (!ossl_prov_is_running())
+ return 0;
+
if (ecxctx == NULL
|| key == NULL
|| key->keylen != ecxctx->keylen
@@ -106,6 +117,9 @@ static int ecx_derive(void *vecxctx, unsigned char *secret, size_t *secretlen,
{
PROV_ECX_CTX *ecxctx = (PROV_ECX_CTX *)vecxctx;
+ if (!ossl_prov_is_running())
+ return 0;
+
if (ecxctx->key == NULL
|| ecxctx->key->privkey == NULL
|| ecxctx->peerkey == NULL) {
@@ -179,6 +193,9 @@ static void *ecx_dupctx(void *vecxctx)
PROV_ECX_CTX *srcctx = (PROV_ECX_CTX *)vecxctx;
PROV_ECX_CTX *dstctx;
+ if (!ossl_prov_is_running())
+ return NULL;
+
dstctx = OPENSSL_zalloc(sizeof(*srcctx));
if (dstctx == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);