Skip to content

Commit 3e3b673

Browse files
authored
Merge pull request #9123 from gojimmypi/pr-espressif-certs-test
Exclude wolfssl certs_test.h from Espressif user_settings.h
2 parents 342c37d + c22354e commit 3e3b673

7 files changed

Lines changed: 60 additions & 102 deletions

File tree

‎IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/include/user_settings.h‎

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
/* This user_settings.h is for Espressif ESP-IDF
3232
*
33-
* Standardized wolfSSL Espressif ESP32 + ESP8266 user_settings.h V5.7.0-1
33+
* Standardized wolfSSL Espressif ESP32 + ESP8266 user_settings.h V5.8.2-1 certs
3434
*
3535
* Do not include any wolfssl headers here.
3636
*
@@ -257,11 +257,6 @@
257257
#define WOLFSSL_AES_DIRECT
258258
#endif
259259

260-
/* Pick a cert buffer size: */
261-
/* #define USE_CERT_BUFFERS_2048 */
262-
/* #define USE_CERT_BUFFERS_1024 */
263-
#define USE_CERT_BUFFERS_2048
264-
265260
/* The Espressif sdkconfig will have chipset info.
266261
**
267262
** Some possible values:
@@ -377,10 +372,6 @@
377372
/* #define DEBUG_WOLFSSL */
378373
#define DEBUG_WOLFSSL_MALLOC
379374

380-
/* See test.c that sets cert buffers; we'll set them here: */
381-
#define USE_CERT_BUFFERS_256
382-
#define USE_CERT_BUFFERS_2048
383-
384375
/* RSA_LOW_MEM: Half as much memory but twice as slow. */
385376
#define RSA_LOW_MEM
386377

@@ -678,9 +669,6 @@
678669

679670
#undef HAVE_AESGCM
680671
#define HAVE_AESGCM
681-
#else
682-
/* default settings */
683-
#define USE_CERT_BUFFERS_2048
684672
#endif
685673

686674
/* Chipset detection from sdkconfig.h
@@ -1058,10 +1046,9 @@ Turn on timer debugging (used when CPU cycles not available)
10581046
#error "USE_CERT_BUFFERS_1024 is already defined. Pick one."
10591047
#endif
10601048

1061-
/* Be sure to include in app when using example certs: */
1062-
#include <wolfssl/certs_test.h>
1049+
/* Be sure to include in app, not here, when using example certs: */
1050+
/* #include <wolfssl/certs_test.h> */
10631051

1064-
#define USE_CERT_BUFFERS_256
10651052
#define CTX_CA_CERT ca_cert_der_2048
10661053
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
10671054
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
@@ -1085,10 +1072,9 @@ Turn on timer debugging (used when CPU cycles not available)
10851072
#error "USE_CERT_BUFFERS_2048 is already defined. Pick one."
10861073
#endif
10871074

1088-
/* Be sure to include in app when using example certs: */
1089-
#include <wolfssl/certs_test.h>
1075+
/* Be sure to include in app, not here, when using example certs: */
1076+
/* #include <wolfssl/certs_test.h> */
10901077

1091-
#define USE_CERT_BUFFERS_256
10921078
#define CTX_CA_CERT ca_cert_der_1024
10931079
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_1024
10941080
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
@@ -1108,7 +1094,6 @@ Turn on timer debugging (used when CPU cycles not available)
11081094
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
11091095
#else
11101096
/* Optionally define custom cert arrays, sizes, and types here */
1111-
#error "Must define USE_CERT_BUFFERS_2048 or USE_CERT_BUFFERS_1024"
11121097
#endif
11131098
#endif /* Conditional key and cert constant names */
11141099

‎IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/include/user_settings.h‎

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
/* This user_settings.h is for Espressif ESP-IDF
3232
*
33-
* Standardized wolfSSL Espressif ESP32 + ESP8266 user_settings.h V5.7.0-1
33+
* Standardized wolfSSL Espressif ESP32 + ESP8266 user_settings.h V5.8.2-1 certs
3434
*
3535
* Do not include any wolfssl headers here.
3636
*
@@ -257,11 +257,6 @@
257257
#define WOLFSSL_AES_DIRECT
258258
#endif
259259

260-
/* Pick a cert buffer size: */
261-
/* #define USE_CERT_BUFFERS_2048 */
262-
/* #define USE_CERT_BUFFERS_1024 */
263-
#define USE_CERT_BUFFERS_2048
264-
265260
/* The Espressif sdkconfig will have chipset info.
266261
**
267262
** Some possible values:
@@ -377,10 +372,6 @@
377372
/* #define DEBUG_WOLFSSL */
378373
#define DEBUG_WOLFSSL_MALLOC
379374

380-
/* See test.c that sets cert buffers; we'll set them here: */
381-
#define USE_CERT_BUFFERS_256
382-
#define USE_CERT_BUFFERS_2048
383-
384375
/* RSA_LOW_MEM: Half as much memory but twice as slow. */
385376
#define RSA_LOW_MEM
386377

@@ -678,9 +669,6 @@
678669

679670
#undef HAVE_AESGCM
680671
#define HAVE_AESGCM
681-
#else
682-
/* default settings */
683-
#define USE_CERT_BUFFERS_2048
684672
#endif
685673

686674
/* Chipset detection from sdkconfig.h
@@ -1058,10 +1046,9 @@ Turn on timer debugging (used when CPU cycles not available)
10581046
#error "USE_CERT_BUFFERS_1024 is already defined. Pick one."
10591047
#endif
10601048

1061-
/* Be sure to include in app when using example certs: */
1062-
#include <wolfssl/certs_test.h>
1049+
/* Be sure to include in app, not here, when using example certs: */
1050+
/* #include <wolfssl/certs_test.h> */
10631051

1064-
#define USE_CERT_BUFFERS_256
10651052
#define CTX_CA_CERT ca_cert_der_2048
10661053
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
10671054
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
@@ -1085,10 +1072,9 @@ Turn on timer debugging (used when CPU cycles not available)
10851072
#error "USE_CERT_BUFFERS_2048 is already defined. Pick one."
10861073
#endif
10871074

1088-
/* Be sure to include in app when using example certs: */
1089-
#include <wolfssl/certs_test.h>
1075+
/* Be sure to include in app, not here, when using example certs: */
1076+
/* #include <wolfssl/certs_test.h> */
10901077

1091-
#define USE_CERT_BUFFERS_256
10921078
#define CTX_CA_CERT ca_cert_der_1024
10931079
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_1024
10941080
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
@@ -1108,7 +1094,6 @@ Turn on timer debugging (used when CPU cycles not available)
11081094
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
11091095
#else
11101096
/* Optionally define custom cert arrays, sizes, and types here */
1111-
#error "Must define USE_CERT_BUFFERS_2048 or USE_CERT_BUFFERS_1024"
11121097
#endif
11131098
#endif /* Conditional key and cert constant names */
11141099

‎IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/include/user_settings.h‎

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
/* This user_settings.h is for Espressif ESP-IDF
3232
*
33-
* Standardized wolfSSL Espressif ESP32 + ESP8266 user_settings.h V5.7.0-1
33+
* Standardized wolfSSL Espressif ESP32 + ESP8266 user_settings.h V5.8.2-1 certs
3434
*
3535
* Do not include any wolfssl headers here.
3636
*
@@ -257,11 +257,6 @@
257257
#define WOLFSSL_AES_DIRECT
258258
#endif
259259

260-
/* Pick a cert buffer size: */
261-
/* #define USE_CERT_BUFFERS_2048 */
262-
/* #define USE_CERT_BUFFERS_1024 */
263-
#define USE_CERT_BUFFERS_2048
264-
265260
/* The Espressif sdkconfig will have chipset info.
266261
**
267262
** Some possible values:
@@ -377,10 +372,6 @@
377372
/* #define DEBUG_WOLFSSL */
378373
#define DEBUG_WOLFSSL_MALLOC
379374

380-
/* See test.c that sets cert buffers; we'll set them here: */
381-
#define USE_CERT_BUFFERS_256
382-
#define USE_CERT_BUFFERS_2048
383-
384375
/* RSA_LOW_MEM: Half as much memory but twice as slow. */
385376
#define RSA_LOW_MEM
386377

@@ -678,9 +669,6 @@
678669

679670
#undef HAVE_AESGCM
680671
#define HAVE_AESGCM
681-
#else
682-
/* default settings */
683-
#define USE_CERT_BUFFERS_2048
684672
#endif
685673

686674
/* Chipset detection from sdkconfig.h
@@ -1058,10 +1046,9 @@ Turn on timer debugging (used when CPU cycles not available)
10581046
#error "USE_CERT_BUFFERS_1024 is already defined. Pick one."
10591047
#endif
10601048

1061-
/* Be sure to include in app when using example certs: */
1062-
#include <wolfssl/certs_test.h>
1049+
/* Be sure to include in app, not here, when using example certs: */
1050+
/* #include <wolfssl/certs_test.h> */
10631051

1064-
#define USE_CERT_BUFFERS_256
10651052
#define CTX_CA_CERT ca_cert_der_2048
10661053
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
10671054
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
@@ -1085,10 +1072,9 @@ Turn on timer debugging (used when CPU cycles not available)
10851072
#error "USE_CERT_BUFFERS_2048 is already defined. Pick one."
10861073
#endif
10871074

1088-
/* Be sure to include in app when using example certs: */
1089-
#include <wolfssl/certs_test.h>
1075+
/* Be sure to include in app, not here, when using example certs: */
1076+
/* #include <wolfssl/certs_test.h> */
10901077

1091-
#define USE_CERT_BUFFERS_256
10921078
#define CTX_CA_CERT ca_cert_der_1024
10931079
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_1024
10941080
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
@@ -1108,7 +1094,6 @@ Turn on timer debugging (used when CPU cycles not available)
11081094
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
11091095
#else
11101096
/* Optionally define custom cert arrays, sizes, and types here */
1111-
#error "Must define USE_CERT_BUFFERS_2048 or USE_CERT_BUFFERS_1024"
11121097
#endif
11131098
#endif /* Conditional key and cert constant names */
11141099

‎IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/client-tls.h‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,23 @@
2121
#ifndef _CLIENT_TLS_H_
2222
#define _CLIENT_TLS_H_
2323

24-
/* Local project, auto-generated configuration */
25-
#include "sdkconfig.h"
24+
/* This example uses wolfssl test certificates */
25+
#if 1
26+
/* See wolfssl/certs_test.h */
27+
#if defined(CONFIG_IDF_TARGET_ESP32C2) || \
28+
defined(CONFIG_IDF_TARGET_ESP8684) || \
29+
defined(CONFIG_IDF_TARGET_ESP8266)
30+
/* Use smaller certs for low-memory devices */
31+
#define USE_CERT_BUFFERS_1024
32+
#else
33+
#define USE_CERT_BUFFERS_2048
34+
#endif
35+
36+
/* always include smallest testing 32 byte RSA/ECC keys */
37+
#define USE_CERT_BUFFERS_256
38+
#else
39+
/* define your own certificate macros; see user_settings.h */
40+
#endif
2641

2742
#include <wolfssl/wolfcrypt/settings.h>
2843
#include <wolfssl/ssl.h>

‎IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/include/user_settings.h‎

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
/* This user_settings.h is for Espressif ESP-IDF
3232
*
33-
* Standardized wolfSSL Espressif ESP32 + ESP8266 user_settings.h V5.7.0-1
33+
* Standardized wolfSSL Espressif ESP32 + ESP8266 user_settings.h V5.8.2-1 certs
3434
*
3535
* Do not include any wolfssl headers here.
3636
*
@@ -257,11 +257,6 @@
257257
#define WOLFSSL_AES_DIRECT
258258
#endif
259259

260-
/* Pick a cert buffer size: */
261-
/* #define USE_CERT_BUFFERS_2048 */
262-
/* #define USE_CERT_BUFFERS_1024 */
263-
#define USE_CERT_BUFFERS_2048
264-
265260
/* The Espressif sdkconfig will have chipset info.
266261
**
267262
** Some possible values:
@@ -377,10 +372,6 @@
377372
/* #define DEBUG_WOLFSSL */
378373
#define DEBUG_WOLFSSL_MALLOC
379374

380-
/* See test.c that sets cert buffers; we'll set them here: */
381-
#define USE_CERT_BUFFERS_256
382-
#define USE_CERT_BUFFERS_2048
383-
384375
/* RSA_LOW_MEM: Half as much memory but twice as slow. */
385376
#define RSA_LOW_MEM
386377

@@ -678,9 +669,6 @@
678669

679670
#undef HAVE_AESGCM
680671
#define HAVE_AESGCM
681-
#else
682-
/* default settings */
683-
#define USE_CERT_BUFFERS_2048
684672
#endif
685673

686674
/* Chipset detection from sdkconfig.h
@@ -1058,10 +1046,9 @@ Turn on timer debugging (used when CPU cycles not available)
10581046
#error "USE_CERT_BUFFERS_1024 is already defined. Pick one."
10591047
#endif
10601048

1061-
/* Be sure to include in app when using example certs: */
1062-
#include <wolfssl/certs_test.h>
1049+
/* Be sure to include in app, not here, when using example certs: */
1050+
/* #include <wolfssl/certs_test.h> */
10631051

1064-
#define USE_CERT_BUFFERS_256
10651052
#define CTX_CA_CERT ca_cert_der_2048
10661053
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
10671054
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
@@ -1085,10 +1072,9 @@ Turn on timer debugging (used when CPU cycles not available)
10851072
#error "USE_CERT_BUFFERS_2048 is already defined. Pick one."
10861073
#endif
10871074

1088-
/* Be sure to include in app when using example certs: */
1089-
#include <wolfssl/certs_test.h>
1075+
/* Be sure to include in app, not here, when using example certs: */
1076+
/* #include <wolfssl/certs_test.h> */
10901077

1091-
#define USE_CERT_BUFFERS_256
10921078
#define CTX_CA_CERT ca_cert_der_1024
10931079
#define CTX_CA_CERT_SIZE sizeof_ca_cert_der_1024
10941080
#define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
@@ -1108,7 +1094,6 @@ Turn on timer debugging (used when CPU cycles not available)
11081094
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
11091095
#else
11101096
/* Optionally define custom cert arrays, sizes, and types here */
1111-
#error "Must define USE_CERT_BUFFERS_2048 or USE_CERT_BUFFERS_1024"
11121097
#endif
11131098
#endif /* Conditional key and cert constant names */
11141099

‎IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/server-tls.h‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@
2121
#ifndef _SERVER_TLS_
2222
#define _SERVER_TLS_
2323

24+
/* This example uses wolfssl test certificates */
25+
#if 1
26+
/* See wolfssl/certs_test.h */
27+
#if defined(CONFIG_IDF_TARGET_ESP32C2) || \
28+
defined(CONFIG_IDF_TARGET_ESP8684) || \
29+
defined(CONFIG_IDF_TARGET_ESP8266)
30+
/* Use smaller certs for low-memory devices */
31+
#define USE_CERT_BUFFERS_1024
32+
#else
33+
#define USE_CERT_BUFFERS_2048
34+
#endif
35+
36+
/* always include smallest testing 32 byte RSA/ECC keys */
37+
#define USE_CERT_BUFFERS_256
38+
#else
39+
/* define your own certificate macros; see user_settings.h */
40+
#endif
41+
2442
#include <wolfssl/wolfcrypt/settings.h> /* includes wolfSSL user-settings.h */
2543
#include <wolfssl/ssl.h>
2644
#include "sdkconfig.h"

0 commit comments

Comments
 (0)