Skip to content

Commit b9cdb39

Browse files
committed
Remove warmup found in separate PR 9227
1 parent 9cb1c88 commit b9cdb39

File tree

3 files changed

+0
-117
lines changed

3 files changed

+0
-117
lines changed

.wolfssl_known_macro_extras

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ NO_TKERNEL_MEM_POOL
438438
NO_TLSX_PSKKEM_PLAIN_ANNOUNCE
439439
NO_VERIFY_OID
440440
NO_WC_SSIZE_TYPE
441-
NO_WOLFCRYPT_WARMUP
442441
NO_WOLFSSL_ALLOC_ALIGN
443442
NO_WOLFSSL_AUTOSAR_CRYIF
444443
NO_WOLFSSL_AUTOSAR_CRYPTO

wolfcrypt/src/port/Espressif/esp32_util.c

Lines changed: 0 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@
6060
#include <wolfssl/wolfcrypt/types.h>
6161
#include <wolfssl/version.h>
6262

63-
#ifndef NO_WOLFCRYPT_WARMUP
64-
#define HAVE_WOLFCRYPT_WARMUP
65-
#if !defined(NO_AES) && defined(HAVE_AESGCM)
66-
#include <wolfssl/wolfcrypt/aes.h>
67-
#endif
68-
#endif
6963
/*
7064
** Version / Platform info.
7165
**
@@ -383,113 +377,6 @@ static int ShowExtendedSystemInfo_platform_espressif(void)
383377
*******************************************************************************
384378
*/
385379

386-
/*
387-
** All platforms: Warmup wolfssl
388-
*/
389-
esp_err_t esp_sdk_wolfssl_warmup(void)
390-
{
391-
esp_err_t ret = ESP_OK;
392-
int ret_i = 0; /* intermediate wolfssl results*/
393-
#ifdef NO_WOLFCRYPT_WARMUP
394-
ESP_LOGW(TAG, "esp_sdk_wolfssl_warmup called with NO_WOLFCRYPT_WARMUP");
395-
#else
396-
/* Even though some [name]_NO_MALLOC may defined, there's always the host
397-
* freeRTOS heap. So here, we'll initialize things early on to attempt
398-
* having the heap allocate long term items near the edge of free memory,
399-
* rather than in the middle. */
400-
WC_RNG rng;
401-
int rng_inited = 0;
402-
unsigned char dummy;
403-
#if !defined(NO_AES) && defined(HAVE_AESGCM)
404-
Aes aes;
405-
unsigned char key16[WC_AES_BLOCK_SIZE];
406-
unsigned char out[WC_AES_BLOCK_SIZE];
407-
unsigned char in[WC_AES_BLOCK_SIZE];
408-
unsigned char iv[WC_AES_BLOCK_SIZE];
409-
int devId;
410-
int aes_inited = 0;
411-
#endif /* NO_AES && HAVE_AESGCM declarations */
412-
413-
#if defined(DEBUG_WOLFSSL_MALLOC_VERBOSE)
414-
ESP_LOGI(TAG, "Warming up RNG");
415-
#endif
416-
417-
ret_i = wc_InitRng(&rng);
418-
if (ret_i == 0) {
419-
rng_inited = 1;
420-
/* forces Hash_DRBG/SHA */
421-
ret_i = wc_RNG_GenerateBlock(&rng, &dummy, sizeof(dummy));
422-
if (ret_i != 0) {
423-
ESP_LOGE(TAG, "esp_sdk_wolfssl_warmup wc_RNG_GenerateBlock failed");
424-
}
425-
}
426-
if (ret_i != 0) {
427-
ret = ESP_FAIL;
428-
ESP_LOGE(TAG, "esp_sdk_wolfssl_warmup RNG warmup failed");
429-
}
430-
if (rng_inited == 1) {
431-
ret_i = wc_FreeRng(&rng);
432-
if (ret_i != 0) {
433-
ret = ESP_FAIL;
434-
ESP_LOGE(TAG, "esp_sdk_wolfssl_warmup wc_FreeRng failed");
435-
}
436-
}
437-
438-
#if !defined(NO_AES) && defined(HAVE_AESGCM)
439-
#if defined(DEBUG_WOLFSSL_MALLOC_VERBOSE)
440-
ESP_LOGI(TAG, "Warming up AES");
441-
#endif
442-
XMEMSET(key16, 0, (word32)sizeof(key16));
443-
XMEMSET(iv, 0, (word32)sizeof(iv));
444-
XMEMSET(in, 0, (word32)sizeof(in));
445-
#ifdef INVALID_DEVID
446-
devId = INVALID_DEVID; /* software by default */
447-
#else
448-
devId = 0;
449-
#endif
450-
451-
ret_i = wc_AesInit(&aes, NULL, devId);
452-
if (ret_i == 0) {
453-
aes_inited = 1;
454-
/* Set an ECB key (no IV). This avoids pulling in GCM/GHASH. */
455-
ret_i = wc_AesSetKey(&aes, key16, (word32)sizeof(key16), NULL,
456-
AES_ENCRYPTION);
457-
}
458-
if (ret_i == 0) {
459-
#ifdef WOLFSSL_AES_DIRECT
460-
/* Single direct block encrypt to exercise the core/driver. */
461-
ret_i = wc_AesEncryptDirect(&aes, out, in);
462-
#elif !defined(NO_AES_CBC)
463-
/* One-block CBC (tiny; no padding; does not pull GCM). */
464-
ret_i = wc_AesSetIV(&aes, iv);
465-
if (ret_i == 0) {
466-
ret_i = wc_AesCbcEncrypt(&aes, out, in, (word32)sizeof(in));
467-
}
468-
#elif defined(WOLFSSL_AES_COUNTER)
469-
/* As another lightweight option, CTR one-block. */
470-
ret_i = wc_AesSetIV(&aes, iv);
471-
if (ret_i == 0) {
472-
ret_i = wc_AesCtrEncrypt(&aes, out, in, (word32)sizeof(in));
473-
}
474-
#else
475-
/* No small mode available; setting key already did most of the warmup. */
476-
ret_i = 0;
477-
#endif /* WOLFSSL_AES_DIRECT, NO_AES_CBC, HAVE_AES_CTR, etc*/
478-
}
479-
if (ret_i != 0) {
480-
ret = ESP_FAIL;
481-
ESP_LOGE(TAG, "AES warmup failed during esp_sdk_wolfssl_warmup");
482-
}
483-
if (aes_inited == 1) {
484-
wc_AesFree(&aes);
485-
}
486-
487-
#endif /* !NO_AES && HAVE_AESGCM */
488-
#endif /* !NO_WOLFCRYPT_WARMUP */
489-
490-
return ret;
491-
}
492-
493380
/*
494381
** All platforms: git details
495382
*/

wolfssl/wolfcrypt/port/Espressif/esp-sdk-lib.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@
151151
extern "C" {
152152
#endif
153153

154-
#define HAVE_WOLFCRYPT_WARMUP
155-
WOLFSSL_LOCAL esp_err_t esp_sdk_wolfssl_warmup(void);
156-
157154
WOLFSSL_LOCAL esp_err_t esp_sdk_time_mem_init(void);
158155

159156
WOLFSSL_LOCAL esp_err_t sdk_var_whereis(const char* v_name, void* v);

0 commit comments

Comments
 (0)