From 1e2ab2c7c82e00c9d562b45ebe66cebac4a43d02 Mon Sep 17 00:00:00 2001 From: Thomas Cook Date: Thu, 23 Apr 2026 04:34:09 -0400 Subject: [PATCH] more pr fixes --- wolfcrypt/src/port/nxp/rng_port.c | 53 --------------------------- wolfcrypt/src/random.c | 11 +++--- wolfcrypt/src/wc_port.c | 8 ---- wolfssl/wolfcrypt/port/nxp/rng_port.h | 27 -------------- 4 files changed, 6 insertions(+), 93 deletions(-) delete mode 100644 wolfcrypt/src/port/nxp/rng_port.c delete mode 100644 wolfssl/wolfcrypt/port/nxp/rng_port.h diff --git a/wolfcrypt/src/port/nxp/rng_port.c b/wolfcrypt/src/port/nxp/rng_port.c deleted file mode 100644 index f1afccff2d..0000000000 --- a/wolfcrypt/src/port/nxp/rng_port.c +++ /dev/null @@ -1,53 +0,0 @@ -/* rng_port.c - * - * Copyright (C) 2006-2026 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ - -#ifdef HAVE_CONFIG_H - #include -#endif - -#include - - -#ifdef WOLFSSL_NXP_RNG_1 - -#include -#include -#include "fsl_rng.h" - -int wc_nxp_rng_init(void) -{ - CLOCK_EnableClock(kCLOCK_Rng); - RESET_PeripheralReset(kRNG_RST_SHIFT_RSTn); - - RNG_Init(RNG); - - return 0; -} - -int wc_nxp_rng_get_random_data(byte* output, word32 sz) -{ - if (RNG_GetRandomData(RNG, output, sz) != kStatus_Success) - return RNG_FAILURE_E; - - return 0; -} - -#endif /* WOLFSSL_NXP_RNG_1 */ diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 3abe56d69b..4c10633bec 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -169,10 +169,6 @@ This library contains implementation for the random number generator. #include #endif -#if defined(WOLFSSL_NXP_RNG_1) - #include "wolfssl/wolfcrypt/port/nxp/rng_port.h" -#endif - #if FIPS_VERSION3_GE(6,0,0) const unsigned int wolfCrypt_FIPS_drbg_ro_sanity[2] = { 0x1a2b3c4d, 0x00000011 }; @@ -3533,6 +3529,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) } #elif defined(WOLFSSL_NXP_RNG_1) + #include "fsl_rng.h" int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz){ (void)os; @@ -3540,7 +3537,11 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) if (output == NULL) { return BUFFER_E; } - return wc_nxp_rng_get_random_data(output, sz); + + if (RNG_GetRandomData(RNG, output, sz) != kStatus_Success) + return RNG_FAILURE_E; + + return 0; } #elif defined(DOLPHIN_EMULATOR) || defined (WOLFSSL_NDS) diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index c72852ae10..70fb1dc680 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -99,9 +99,6 @@ #include #endif -#ifdef WOLFSSL_NXP_RNG_1 - #include -#endif #ifdef WOLFSSL_NXP_CASPER #include #endif @@ -451,11 +448,6 @@ int wolfCrypt_Init(void) } #endif -#ifdef WOLFSSL_NXP_RNG_1 - if ((ret = wc_nxp_rng_init()) != 0) { - return ret; - } -#endif #ifdef WOLFSSL_NXP_CASPER if ((ret = wc_casper_init()) != 0) { return ret; diff --git a/wolfssl/wolfcrypt/port/nxp/rng_port.h b/wolfssl/wolfcrypt/port/nxp/rng_port.h deleted file mode 100644 index 99e0f96b02..0000000000 --- a/wolfssl/wolfcrypt/port/nxp/rng_port.h +++ /dev/null @@ -1,27 +0,0 @@ -/* rng_port.h - * - * Copyright (C) 2006-2026 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ -#ifndef _RNG_PORT_H_ -#define _RNG_PORT_H_ - -int wc_nxp_rng_init(void); -int wc_nxp_rng_get_random_data(byte* output, word32 sz); - -#endif