Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions KeysInUse/keysinuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ static void keysinuse_init_internal()

lh_keysinuse_ctx_imp_lock = CRYPTO_THREAD_lock_new();
lh_keysinuse_ctx_imp = lh_SCOSSL_KEYSINUSE_CTX_IMP_new(scossl_keysinuse_ctx_hash, scossl_keysinuse_ctx_cmp);
if (lh_keysinuse_ctx_imp_lock == NULL || lh_keysinuse_ctx_imp == NULL)
{
goto cleanup;
}

#ifndef KEYSINUSE_LOG_SYSLOG
if (!keysinuse_init_logging())
Expand Down
11 changes: 8 additions & 3 deletions ScosslCommon/src/scossl_aes_aead.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ SCOSSL_STATUS scossl_aes_gcm_init_ctx(SCOSSL_CIPHER_GCM_CTX *ctx, const unsigned
ctx->useInvocation = 0;
ctx->ivlen = SCOSSL_GCM_DEFAULT_IV_LENGTH;

if (iv != NULL && (ctx->iv = OPENSSL_memdup(iv, ctx->ivlen)) == NULL)
if (iv != NULL)
{
return SCOSSL_FAILURE;
OPENSSL_free(ctx->iv);

if ((ctx->iv = OPENSSL_memdup(iv, ctx->ivlen)) == NULL)
{
return SCOSSL_FAILURE;
}
}

return SCOSSL_SUCCESS;
Expand Down Expand Up @@ -431,7 +436,7 @@ void scossl_aes_ccm_init_ctx(SCOSSL_CIPHER_CCM_CTX *ctx,
const unsigned char *iv)
{
ctx->ivlen = SCOSSL_CCM_MIN_IV_LENGTH;
if (iv)
if (iv != NULL)
{
memcpy(ctx->iv, iv, ctx->ivlen);
}
Expand Down
10 changes: 10 additions & 0 deletions ScosslCommon/src/scossl_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ void SCOSSL_set_trace_level(int trace_level, int ossl_ERR_level)

void SCOSSL_set_trace_log_filename(const char *filename)
{
if( _loggingLock == NULL )
{
return;
}

if( _traceLogFilename )
{
OPENSSL_free(_traceLogFilename);
Expand Down Expand Up @@ -239,6 +244,11 @@ static void _scossl_log_bytes_valist(
char errStringBuf[SCOSSL_TRACELOG_PARA_LENGTH];
char paraBuf[SCOSSL_TRACELOG_PARA_LENGTH];
char *trace_level_prefix = "";

if( _loggingLock == NULL )
{
return;
}

if( SYMCRYPT_MAX(_traceLogLevel, _osslERRLogLevel) < trace_level )
{
Expand Down
7 changes: 6 additions & 1 deletion ScosslCommon/src/scossl_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ SCOSSL_MAC_CTX *scossl_mac_dupctx(SCOSSL_MAC_CTX *ctx)
}
}

copyCtx->mdName = OPENSSL_strdup(ctx->mdName);
if (ctx->mdName != NULL &&
(copyCtx->mdName = OPENSSL_strdup(ctx->mdName)) == NULL)
{
goto cleanup;
}

copyCtx->libctx = ctx->libctx;
}

Expand Down
19 changes: 7 additions & 12 deletions ScosslCommon/src/scossl_tls1prf.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@ _Use_decl_annotations_
SCOSSL_TLS1_PRF_CTX *scossl_tls1prf_dupctx(SCOSSL_TLS1_PRF_CTX *ctx)
{
SCOSSL_TLS1_PRF_CTX *copyCtx = OPENSSL_malloc(sizeof(SCOSSL_TLS1_PRF_CTX));

if (copyCtx != NULL)
{
if (ctx->pbSecret == NULL)
{
copyCtx->pbSecret = NULL;
}
else if ((copyCtx->pbSecret = OPENSSL_memdup(ctx->pbSecret, ctx->cbSecret)) == NULL)
*copyCtx = *ctx;
copyCtx->pbSecret = NULL;

if (ctx->pbSecret != NULL &&
(copyCtx->pbSecret = OPENSSL_memdup(ctx->pbSecret, ctx->cbSecret)) == NULL)
{
scossl_tls1prf_freectx(copyCtx);
return NULL;
copyCtx = NULL;
}

copyCtx->isTlsPrf1_1 = ctx->isTlsPrf1_1;
copyCtx->pHmac = ctx->pHmac;
copyCtx->cbSecret = ctx->cbSecret;
copyCtx->cbSeed = ctx->cbSeed;
memcpy(copyCtx->seed, ctx->seed, ctx->cbSeed);
}

return copyCtx;
Expand Down
Loading