Addressed review comments

This commit is contained in:
Hideki Miyazaki
2019-01-17 12:25:28 +09:00
parent 2753d2d548
commit 4a5c380f32
7 changed files with 27 additions and 43 deletions

View File

@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>
#include <wolfcrypt/benchmark/benchmark.h>
#include "sdkconfig.h" #include "sdkconfig.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
@ -36,15 +37,8 @@
/* proto-type */ /* proto-type */
extern void wolf_benchmark_task(); extern void wolf_benchmark_task();
extern int benchmark_init();
extern int benchmark_test(void *args);
#ifdef WOLFSSL_ESPWROOM32SE
const static char* TAG = "wolfbenchmark";
#else
const char* TAG = "wolfbenchmark";
#endif
static const char* const TAG = "wolfbenchmark";
char* __argv[22]; char* __argv[22];
@ -53,17 +47,12 @@ char* __argv[22];
#include "wolfssl/wolfcrypt/port/atmel/atmel.h" #include "wolfssl/wolfcrypt/port/atmel/atmel.h"
int atcatls_set_callbacks(struct WOLFSSL_CTX* ctx);
/* when you need to use a custom slot allocation, */ /* when you need to use a custom slot allocation, */
/* enable the definition CUSTOM_SLOT_ALLOCAION. */ /* enable the definition CUSTOM_SLOT_ALLOCAION. */
#if defined(CUSTOM_SLOT_ALLOCATION) #if defined(CUSTOM_SLOT_ALLOCATION)
static byte mSlotList[ATECC_MAX_SLOT]; static byte mSlotList[ATECC_MAX_SLOT];
int atmel_set_slot_allocator(atmel_slot_alloc_cb alloc, atmel_slot_dealloc_cb dealloc);
/* initialize slot array */ /* initialize slot array */
void my_atmel_slotInit() void my_atmel_slotInit()
{ {

View File

@ -40,15 +40,13 @@
#include <wolfssl/wolfcrypt/mem_track.h> #include <wolfssl/wolfcrypt/mem_track.h>
#endif #endif
#ifdef WOLFSSL_ESPWROOM32SE static const char* const TAG = "tls_client";
static const char* TAG = "tls_client";
#else #if defined(DEBUG_WOLFSSL)
const char* TAG = "tls_client";
#endif
static void ShowCiphers(void) static void ShowCiphers(void)
{ {
static char ciphers[4096]; char ciphers[4096];
int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers)); int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers));
@ -56,13 +54,13 @@ static void ShowCiphers(void)
printf("%s\n", ciphers); printf("%s\n", ciphers);
} }
#endif
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \ #if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
&& defined(WOLFSSL_ATECC508A) && defined(WOLFSSL_ATECC508A)
#include "wolfssl/wolfcrypt/port/atmel/atmel.h" #include "wolfssl/wolfcrypt/port/atmel/atmel.h"
int atcatls_set_callbacks(struct WOLFSSL_CTX* ctx);
/* when you want to use custome slot allocation */ /* when you want to use custome slot allocation */
/* enable the definition CUSTOM_SLOT_ALLOCATION.*/ /* enable the definition CUSTOM_SLOT_ALLOCATION.*/
@ -147,8 +145,6 @@ void tls_smp_client_task()
WOLFSSL_MSG("Debug ON"); WOLFSSL_MSG("Debug ON");
wolfSSL_Debugging_ON(); wolfSSL_Debugging_ON();
ShowCiphers(); ShowCiphers();
#else
(void)ShowCiphers;
#endif #endif
/* Initialize wolfSSL */ /* Initialize wolfSSL */
wolfSSL_Init(); wolfSSL_Init();

View File

@ -1,6 +1,6 @@
/* server-tls-callback.c /* server-tls-callback.c
* *
* Copyright (C) 2006-2018 wolfSSL Inc. * Copyright (C) 2006-2019 wolfSSL Inc.
* *
* This file is part of wolfSSL. (formerly known as CyaSSL) * This file is part of wolfSSL. (formerly known as CyaSSL)
* *
@ -42,11 +42,9 @@
#include <wolfssl/wolfcrypt/mem_track.h> #include <wolfssl/wolfcrypt/mem_track.h>
#endif #endif
#if defined(WOLFSSL_ESPWROOM32SE) static const char* const TAG = "tls_server";
static const char* TAG = "tls_server";
#else #if defined(DEBUG_WOLFSSL)
const char* TAG = "tls_server";
#endif
static void ShowCiphers(void) static void ShowCiphers(void)
{ {
@ -58,6 +56,8 @@ static void ShowCiphers(void)
printf("%s\n", ciphers); printf("%s\n", ciphers);
} }
#endif
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \ #if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
&& defined(WOLFSSL_ATECC508A) && defined(WOLFSSL_ATECC508A)
@ -146,8 +146,6 @@ void tls_smp_server_task()
WOLFSSL_MSG("Debug ON"); WOLFSSL_MSG("Debug ON");
wolfSSL_Debugging_ON(); wolfSSL_Debugging_ON();
ShowCiphers(); ShowCiphers();
#else
(void)ShowCiphers;
#endif #endif
/* Initialize wolfSSL */ /* Initialize wolfSSL */

View File

@ -11,6 +11,7 @@ set(INCLUDE_PATH ${WOLFSSL_ROOT})
set(COMPONENT_SRCDIRS "./src/" set(COMPONENT_SRCDIRS "./src/"
"./wolfcrypt/src/" "./wolfcrypt/src/"
"./wolfcrypt/src/port/Espressif/" "./wolfcrypt/src/port/Espressif/"
"./wolfcrypt/src/port/atmel/"
) )
set(COMPONENT_REQUIRES lwip) set(COMPONENT_REQUIRES lwip)

View File

@ -44,10 +44,16 @@
#define CURVE25519_SMALL #define CURVE25519_SMALL
#define HAVE_ED25519 #define HAVE_ED25519
/* when you want to use a custom slot allocation for ATECC608A */ /* esp32-wroom-32se specific definition */
/* unless your configuration is unusual, you can use default */ #if defined(WOLFSSL_ESPWROOM32SE)
/* implementation. */ #define WOLFSSL_ATECC508A
/* #define CUSTOM_SLOT_ALLOCATION */ #define HAVE_PK_CALLBACKS
/* when you want to use a custom slot allocation for ATECC608A */
/* unless your configuration is unusual, you can use default */
/* implementation. */
/* #define CUSTOM_SLOT_ALLOCATION */
#endif
/* debug options */ /* debug options */
/* #define DEBUG_WOLFSSL */ /* #define DEBUG_WOLFSSL */

View File

@ -1,6 +1,6 @@
/* logging.c /* logging.c
* *
* Copyright (C) 2006-2017 wolfSSL Inc. * Copyright (C) 2006-2019 wolfSSL Inc.
* *
* This file is part of wolfSSL. * This file is part of wolfSSL.
* *
@ -255,8 +255,7 @@ static void wolfssl_log(const int logLevel, const char *const logMessage)
#elif defined(WOLFSSL_APACHE_MYNEWT) #elif defined(WOLFSSL_APACHE_MYNEWT)
LOG_DEBUG(&mynewt_log, LOG_MODULE_DEFAULT, "%s\n", logMessage); LOG_DEBUG(&mynewt_log, LOG_MODULE_DEFAULT, "%s\n", logMessage);
#elif defined(WOLFSSL_ESPIDF) #elif defined(WOLFSSL_ESPIDF)
extern char* TAG; ESP_LOGI("wolfssl", "%s", logMessage);
ESP_LOGI(TAG, "%s", logMessage);
#else #else
fprintf(stderr, "%s\n", logMessage); fprintf(stderr, "%s\n", logMessage);
#endif #endif

View File

@ -241,11 +241,6 @@
#define WOLFSSL_ESP32WROOM32_CRYPT #define WOLFSSL_ESP32WROOM32_CRYPT
#endif #endif
#endif #endif
#if defined(WOLFSSL_ESPWROOM32SE)
/* esp32-wroom-32se specific definition */
#define WOLFSSL_ATECC508A
#define HAVE_PK_CALLBACKS
#endif
#if !defined(WOLFSSL_USER_SETTINGS) #if !defined(WOLFSSL_USER_SETTINGS)
#define HAVE_ECC #define HAVE_ECC
#endif /* !WOLFSSL_USER_SETTINGS */ #endif /* !WOLFSSL_USER_SETTINGS */