From 3508579f4c100d3dcd6a606fd75816027ab624ef Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 20 Jan 2020 09:33:14 -0700 Subject: [PATCH] add check on NETX duo build and return value of opening driver --- wolfcrypt/src/random.c | 2 +- wolfcrypt/src/wc_port.c | 3 ++- wolfssl/wolfio.h | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 50cfab564..056baa536 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -2324,7 +2324,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) word32 len = sz; ret = g_sce_trng.p_api->open(g_sce_trng.p_ctrl, g_sce_trng.p_cfg); - if (ret != SSP_SUCCESS) { + if (ret != SSP_SUCCESS && ret != SSP_ERR_CRYPTO_ALREADY_OPEN) { /* error opening TRNG driver */ return -1; } diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index 2265416c8..860422fcb 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -229,7 +229,8 @@ int wolfCrypt_Init(void) #endif #ifdef WOLFSSL_SCE - if ((ret = g_sce.p_api->open(g_sce.p_ctrl, g_sce.p_cfg)) != SSP_SUCCESS) { + ret = (int)g_sce.p_api->open(g_sce.p_ctrl, g_sce.p_cfg); + if (ret != SSP_SUCCESS && ret != SSP_ERR_CRYPTO_ALREADY_OPEN) { WOLFSSL_MSG("Error opening SCE\n"); return -1; /* FATAL_ERROR */ } diff --git a/wolfssl/wolfio.h b/wolfssl/wolfio.h index d0d17a093..b6487c20b 100644 --- a/wolfssl/wolfio.h +++ b/wolfssl/wolfio.h @@ -83,7 +83,11 @@ #elif defined(WOLFSSL_IAR_ARM) /* nothing */ #elif defined(HAVE_NETX_BSD) - #include "nx_bsd.h" + #ifdef NETX_DUO + #include "nxd_bsd.h" + #else + #include "nx_bsd.h" + #endif #elif defined(WOLFSSL_VXWORKS) #include #include