Skip to content

Commit 1551076

Browse files
committed
Remove default private key and certificate (esp8266#3)
1 parent 34ff442 commit 1551076

File tree

4 files changed

+7
-104
lines changed

4 files changed

+7
-104
lines changed

ssl/cert.h

-43
This file was deleted.

ssl/loader.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ int load_key_certs(SSL_CTX *ssl_ctx)
434434
else if (!(options & SSL_NO_DEFAULT_KEY))
435435
{
436436
#if defined(CONFIG_SSL_USE_DEFAULT_KEY) || defined(CONFIG_SSL_SKELETON_MODE)
437-
static const /* saves a few more bytes */
438-
#include "private_key.h"
437+
extern const unsigned char* default_private_key;
438+
extern const unsigned int default_private_key_len;
439439

440440
ssl_obj_memory_load(ssl_ctx, SSL_OBJ_RSA_KEY, default_private_key,
441441
default_private_key_len, NULL);
@@ -462,9 +462,9 @@ int load_key_certs(SSL_CTX *ssl_ctx)
462462
else if (!(options & SSL_NO_DEFAULT_KEY))
463463
{
464464
#if defined(CONFIG_SSL_USE_DEFAULT_KEY) || defined(CONFIG_SSL_SKELETON_MODE)
465-
static const /* saves a few bytes and RAM */
466-
#include "cert.h"
467-
ssl_obj_memory_load(ssl_ctx, SSL_OBJ_X509_CERT,
465+
extern const unsigned char* default_certificate;
466+
extern const unsigned int default_certificate_len;
467+
ssl_obj_memory_load(ssl_ctx, SSL_OBJ_X509_CERT,
468468
default_certificate, default_certificate_len, NULL);
469469
#endif
470470
}

ssl/private_key.h

-54
This file was deleted.

ssl/tls1.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -650,13 +650,13 @@ static void increment_write_sequence(SSL *ssl)
650650
static void add_hmac_digest(SSL *ssl, int mode, uint8_t *hmac_header,
651651
const uint8_t *buf, int buf_len, uint8_t *hmac_buf)
652652
{
653-
const prefix_size = 8 + SSL_RECORD_SIZE;
653+
const size_t prefix_size = 8 + SSL_RECORD_SIZE;
654654
bool hmac_inplace = (uint32_t)buf - (uint32_t)ssl->bm_data >= prefix_size;
655655
uint8_t tmp[prefix_size];
656656
int hmac_len = buf_len + prefix_size;
657657
uint8_t *t_buf;
658658
if (hmac_inplace) {
659-
t_buf = buf - prefix_size;
659+
t_buf = ((uint8_t*)buf) - prefix_size;
660660
memcpy(tmp, t_buf, prefix_size);
661661
} else {
662662
t_buf = (uint8_t *)malloc(hmac_len+10);

0 commit comments

Comments
 (0)