diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md index 0957bb8d0..69da1accb 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md @@ -10,11 +10,11 @@ The Example contains of wolfSSL tls client demo. Target host ip address : the host that you want to connect to.(default is 127.0.0.1) Note: the example program uses 11111 port. If you want to use different port - , you need to modifiy DEFAULT_PORT definition in the code. + , you need to modify DEFAULT_PORT definition in the code. When you want to test the wolfSSL client -1. "make falsh monitor" to load the firmware and see the context +1. "make flash monitor" to load the firmware and see the context 2. You can use /examples/server/server program for test. e.g. Launch ./examples/server/server -v 4 -b -i diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c index 115b62453..2f5f405c1 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c @@ -61,7 +61,7 @@ static void ShowCiphers(void) #include "wolfssl/wolfcrypt/port/atmel/atmel.h" -/* when you want to use custome slot allocation */ +/* when you want to use custom slot allocation */ /* enable the definition CUSTOM_SLOT_ALLOCATION.*/ #if defined(CUSTOM_SLOT_ALLOCATION) @@ -235,7 +235,7 @@ void tls_smp_client_task() #if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \ && defined(WOLFSSL_ATECC508A) atcatls_set_callbacks(ctx); - /* when using custome slot-allocation */ + /* when using custom slot-allocation */ #if defined(CUSTOM_SLOT_ALLOCATION) my_atmel_slotInit(); atmel_set_slot_allocator(my_atmel_alloc, my_atmel_free); diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md index 5b9a952bd..3f3eace57 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md @@ -4,7 +4,7 @@ The Example contains of wolfSSL test program. When you want to run the benchmark program 1. "make menuconfig" to configure the program,first -1. "make flash" to compile and load the firemware -2. "make monitor" to see the message +2. "make flash" to compile and load the firmware +3. "make monitor" to see the message See the README.md file in the upper level 'examples' directory for more information about examples. diff --git a/IDE/Espressif/ESP-IDF/test/test_wolfssl.c b/IDE/Espressif/ESP-IDF/test/test_wolfssl.c index b919e3de2..b0f817bab 100644 --- a/IDE/Espressif/ESP-IDF/test/test_wolfssl.c +++ b/IDE/Espressif/ESP-IDF/test/test_wolfssl.c @@ -59,7 +59,7 @@ static void esp32TimerStart() static uint64_t esp32elapsedTime() { - /* retturn elapsed time since wc_esp32AesTimeStart() is called in us */ + /* return elapsed time since wc_esp32AesTimeStart() is called in us */ return esp_timer_get_time() - startTime; } @@ -367,7 +367,7 @@ int mp_unitest_mul(const char* strZ, const char* strX, const char* strY, int ver } TEST_ASSERT_EQUAL_STRING_MESSAGE(strZ, bufZ, - "mp_mulmod returns an unexptected result."); + "mp_mulmod returns an unexpected result."); XFREE(bufZ, NULL, DYNAMIC_TYPE_TMP_BUFFER); return 0; @@ -448,7 +448,7 @@ int mp_unitest_mulmod(const char* strZ, const char* strX, const char* strY, } TEST_ASSERT_EQUAL_STRING_MESSAGE(strZ, bufZ, - "mp_mulmod returns an unexptected result."); + "mp_mulmod returns an unexpected result."); XFREE(bufZ, NULL, DYNAMIC_TYPE_TMP_BUFFER); return 0; @@ -529,7 +529,7 @@ int mp_unitest_exptmod(const char* strZ, const char* strX, const char* strY, } TEST_ASSERT_EQUAL_STRING_MESSAGE(strZ, bufZ, - "mp_exptmod returns an unexptected result."); + "mp_exptmod returns an unexpected result."); XFREE(bufZ, NULL, DYNAMIC_TYPE_TMP_BUFFER); return 0; @@ -1124,7 +1124,7 @@ TEST_CASE("wolfssl aes sha256 rsa multi-thread test ", "[wolfssl]") vTaskDelay(15000/portTICK_PERIOD_MS); exit_loop = true; - /* wait until ras test finishes */ + /* wait until rsa test finishes */ while(rsa_elapsedTime<=0){ vTaskDelay(1); } ESP_LOGI(TAG, "Waiting another %llu s. rsa test would take more time to finish.", diff --git a/wolfcrypt/src/port/Espressif/esp32_aes.c b/wolfcrypt/src/port/Espressif/esp32_aes.c index 579abafae..7531d232e 100644 --- a/wolfcrypt/src/port/Espressif/esp32_aes.c +++ b/wolfcrypt/src/port/Espressif/esp32_aes.c @@ -47,7 +47,7 @@ static int espaes_CryptHwMutexInit = 0; static int esp_aes_hw_InUse() { int ret = 0; - + ESP_LOGV(TAG, "enter esp_aes_hw_InUse"); if(espaes_CryptHwMutexInit == 0) { @@ -94,7 +94,7 @@ static void esp_aes_hw_Set_KeyMode(Aes *ctx, ESP32_AESPROCESS mode) { int i; word32 mode_ = 0; - + ESP_LOGV(TAG, "enter esp_aes_hw_Set_KeyMode"); /* check mode */ @@ -131,13 +131,13 @@ static void esp_aes_hw_Set_KeyMode(Aes *ctx, ESP32_AESPROCESS mode) } /* - * Porcess a one block of AES + * Process a one block of AES */ static void esp_aes_bk(const byte* in, byte* out) { const word32 *inwords = (const word32 *)in; word32 *outwords = (word32 *)out; - + ESP_LOGV(TAG, "enter esp_aes_bk"); /* copy text for encrypting/decrypting blocks */ @@ -220,7 +220,7 @@ int wc_esp32AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz) word32 blocks = (sz / AES_BLOCK_SIZE); byte *iv; byte temp_block[AES_BLOCK_SIZE]; - + ESP_LOGV(TAG, "enter wc_esp32AesCbcEncrypt"); iv = (byte*)aes->reg; @@ -268,7 +268,7 @@ int wc_esp32AesCbcDecrypt(Aes* aes, byte* out, const byte* in, word32 sz) byte temp_block[AES_BLOCK_SIZE]; ESP_LOGV(TAG, "enter wc_esp32AesCbcDecrypt"); - + iv = (byte*)aes->reg; esp_aes_hw_InUse(); diff --git a/wolfcrypt/src/port/Espressif/esp32_mp.c b/wolfcrypt/src/port/Espressif/esp32_mp.c index 923db88c5..3b527e57f 100644 --- a/wolfcrypt/src/port/Espressif/esp32_mp.c +++ b/wolfcrypt/src/port/Espressif/esp32_mp.c @@ -100,7 +100,7 @@ static void esp_mp_hw_unlock( void ) /* unlock */ esp_CryptHwMutexUnLock(&mp_mutex); } -/* this is based on an aricle by Cetin Kaya Koc, A New Algorighm for Inversion*/ +/* this is based on an article by Cetin Kaya Koc, A New Algorithm for Inversion*/ /* mod p^k, June 28 2017. */ static int esp_calc_Mdash(mp_int *M, word32 k, mp_digit* md) { @@ -269,7 +269,7 @@ int esp_mp_mul(fp_int* X, fp_int* Y, fp_int* Z) DPORT_REG_WRITE(RSA_MULT_MODE_REG, (hwWords_sz >> 3) - 1 + 8); /* step.2 write X, M and r_inv into memory */ esp_mpint_to_memblock(RSA_MEM_X_BLOCK_BASE, X, Xs, hwWords_sz); - /* Y(let-extened) */ + /* Y(let-extend) */ esp_mpint_to_memblock(RSA_MEM_Z_BLOCK_BASE + (hwWords_sz<<2), Y, Ys, hwWords_sz); /* step.3 start process */ process_start(RSA_MULT_START_REG); @@ -373,7 +373,7 @@ int esp_mp_mulmod(fp_int* X, fp_int* Y, fp_int* M, fp_int* Z) esp_mpint_to_memblock(RSA_MEM_M_BLOCK_BASE, M, Ms, hwWords_sz); esp_mpint_to_memblock(RSA_MEM_Z_BLOCK_BASE, &r_inv, mp_count_bits(&r_inv), hwWords_sz); - /* step.3 wirite M' into memory */ + /* step.3 write M' into memory */ DPORT_REG_WRITE(RSA_M_DASH_REG, mp); /* step.4 start process */ process_start(RSA_MULT_START_REG); @@ -438,11 +438,11 @@ int esp_mp_exptmod(fp_int* X, fp_int* Y, word32 Ys, fp_int* M, fp_int* Z) } /* calculate r_inv = R^2 mode M * where: R = b^n, and b = 2^32 - * accordinalry R^2 = 2^(n*32*2) + * accordingly R^2 = 2^(n*32*2) */ ret = mp_init(&r_inv); if(ret == 0 && (ret = esp_get_rinv(&r_inv, M, (hwWords_sz<<6))) != MP_OKAY) { - ESP_LOGE(TAG, "calcurate r_inv failed."); + ESP_LOGE(TAG, "calculate r_inv failed."); mp_clear(&r_inv); return ret; } @@ -466,7 +466,7 @@ int esp_mp_exptmod(fp_int* X, fp_int* Y, word32 Ys, fp_int* M, fp_int* Z) * of the number. * 3. Write M' to M_PRIME_REG * 4. Write 1 to MODEXP_START_REG - * 5. Wait for the operation to be done. Poll INTERRUPT_REG unitl it reads 1. + * 5. Wait for the operation to be done. Poll INTERRUPT_REG until it reads 1. * (Or until the INTER interrupt is generated.) * 6. Read the result Z(=Y) from Z_MEM * 7. Write 1 to INTERRUPT_REG to clear the interrupt. @@ -481,7 +481,7 @@ int esp_mp_exptmod(fp_int* X, fp_int* Y, word32 Ys, fp_int* M, fp_int* Z) esp_mpint_to_memblock(RSA_MEM_M_BLOCK_BASE, M, Ms, hwWords_sz); esp_mpint_to_memblock(RSA_MEM_Z_BLOCK_BASE, &r_inv, mp_count_bits(&r_inv), hwWords_sz); - /* step.3 wirite M' into meory */ + /* step.3 write M' into memory */ DPORT_REG_WRITE(RSA_M_DASH_REG, mp); /* step.4 start process */ process_start(RSA_START_MODEXP_REG); diff --git a/wolfcrypt/src/port/Espressif/esp32_sha.c b/wolfcrypt/src/port/Espressif/esp32_sha.c index ab1dc0259..4f5309307 100644 --- a/wolfcrypt/src/port/Espressif/esp32_sha.c +++ b/wolfcrypt/src/port/Espressif/esp32_sha.c @@ -118,7 +118,7 @@ int esp_sha_try_hw_lock(WC_ESP32SHA* ctx) int ret = 0; ESP_LOGV(TAG, "enter esp_sha_hw_lock"); - + /* Init mutex */ #if defined(SINGLE_THREADED) if(ctx->mode == ESP32_SHA_INIT) { @@ -151,7 +151,7 @@ int esp_sha_try_hw_lock(WC_ESP32SHA* ctx) ctx->mode = ESP32_SHA_HW; } else { ESP_LOGI(TAG, "someone used. hw is locked....."); - ESP_LOGI(TAG, "the rest of operaion will use sw implementation for this sha"); + ESP_LOGI(TAG, "the rest of operation will use sw implementation for this sha"); ctx->mode = ESP32_SHA_SW; return 0; } @@ -209,7 +209,7 @@ static void esp_process_block(WC_ESP32SHA* ctx, word32 address, const word32* data, word32 len) { int i; - + ESP_LOGV(TAG, "enter esp_process_block"); /* check if there are any busy engine */ @@ -224,7 +224,7 @@ static void esp_process_block(WC_ESP32SHA* ctx, word32 address, ESP_LOGV(TAG, "leave esp_process_block"); } /* -* retreive sha digest from memory +* retrieve sha digest from memory */ static void esp_digest_state(WC_ESP32SHA* ctx, byte* hash, enum SHA_TYPE sha_type) { @@ -239,7 +239,7 @@ static void esp_digest_state(WC_ESP32SHA* ctx, byte* hash, enum SHA_TYPE sha_typ ESP_LOGE(TAG, "unexpected error. sha_type is invalid."); return; } - + SHA_LOAD_REG += (sha_type << 4); SHA_BUSY_REG += (sha_type << 4); @@ -284,9 +284,9 @@ int esp_sha_process(struct wc_Sha* sha) int ret = 0; ESP_LOGV(TAG, "enter esp_sha_process"); - + word32 SHA_START_REG = SHA_1_START_REG; - + esp_process_block(&sha->ctx, SHA_START_REG, sha->buffer, WC_SHA_BLOCK_SIZE); @@ -299,7 +299,7 @@ int esp_sha_process(struct wc_Sha* sha) int esp_sha_digest_process(struct wc_Sha* sha, byte blockproc) { int ret = 0; - + ESP_LOGV(TAG, "enter esp_sha_digest_process"); if(blockproc) { @@ -326,9 +326,9 @@ int esp_sha256_process(struct wc_Sha256* sha) { int ret = 0; word32 SHA_START_REG = SHA_1_START_REG; - + ESP_LOGV(TAG, "enter esp_sha256_process"); - + /* start register offset */ SHA_START_REG += (SHA2_256 << 4); @@ -345,7 +345,7 @@ int esp_sha256_process(struct wc_Sha256* sha) int esp_sha256_digest_process(struct wc_Sha256* sha, byte blockproc) { int ret = 0; - + ESP_LOGV(TAG, "enter esp_sha256_digest_process"); if(blockproc) { @@ -398,21 +398,21 @@ void esp_sha512_block(struct wc_Sha512* sha, const word32* data, byte isfinal) ESP_LOGV(TAG, "leave esp_sha512_block"); } /* -* sha512 proess. this is used for sha384 too. +* sha512 process. this is used for sha384 too. */ int esp_sha512_process(struct wc_Sha512* sha) { word32 *data = (word32*)sha->buffer; - + ESP_LOGV(TAG, "enter esp_sha512_process"); - + esp_sha512_block(sha, data, 0); ESP_LOGV(TAG, "leave esp_sha512_process"); return 0; } /* -* retreive sha512 digest. this is used for sha384 too. +* retrieve sha512 digest. this is used for sha384 too. */ int esp_sha512_digest_process(struct wc_Sha512* sha, byte blockproc) { diff --git a/wolfcrypt/src/port/Espressif/esp32_util.c b/wolfcrypt/src/port/Espressif/esp32_util.c index fcbaf6581..6d32a55e6 100644 --- a/wolfcrypt/src/port/Espressif/esp32_util.c +++ b/wolfcrypt/src/port/Espressif/esp32_util.c @@ -60,7 +60,7 @@ void wc_esp32TimerStart() uint64_t wc_esp32elapsedTime() { - /* retturn elapsed time since wc_esp32AesTimeStart() is called in us */ + /* return elapsed time since wc_esp32AesTimeStart() is called in us */ return esp_timer_get_time() - startTime; }