Skip to content

Commit dd55964

Browse files
authored
Merge branch 'master' into nostopall
2 parents 5a1b247 + 8bfc2e9 commit dd55964

17 files changed

+106
-13
lines changed

cores/esp8266/WString.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ String &String::copy(const char *cstr, unsigned int length) {
260260
return *this;
261261
}
262262
setLen(length);
263-
memmove_P(wbuffer(), cstr, length + 1);
263+
memmove_P(wbuffer(), cstr, length);
264+
wbuffer()[length] = 0;
264265
return *this;
265266
}
266267

@@ -270,7 +271,8 @@ String &String::copy(const __FlashStringHelper *pstr, unsigned int length) {
270271
return *this;
271272
}
272273
setLen(length);
273-
memcpy_P(wbuffer(), (PGM_P)pstr, length + 1); // We know wbuffer() cannot ever be in PROGMEM, so memcpy safe here
274+
memcpy_P(wbuffer(), (PGM_P)pstr, length); // We know wbuffer() cannot ever be in PROGMEM, so memcpy safe here
275+
wbuffer()[length] = 0;
274276
return *this;
275277
}
276278

@@ -411,8 +413,9 @@ bool String::concat(const __FlashStringHelper *str) {
411413
unsigned int newlen = len() + length;
412414
if (!reserve(newlen))
413415
return false;
414-
memcpy_P(wbuffer() + len(), (PGM_P)str, length + 1);
416+
memcpy_P(wbuffer() + len(), (PGM_P)str, length);
415417
setLen(newlen);
418+
wbuffer()[newlen] = 0;
416419
return true;
417420
}
418421

cores/esp8266/uart.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ uart_init(int uart_nr, int baudrate, int config, int mode, int tx_pin, size_t rx
696696
}
697697

698698
uart_set_baudrate(uart, baudrate);
699-
if(uart->uart_nr == UART0 && invert)
699+
if((uart->uart_nr == UART0 || uart->uart_nr == UART1) && invert)
700700
{
701701
config |= BIT(UCDTRI) | BIT(UCRTSI) | BIT(UCTXI) | BIT(UCDSRI) | BIT(UCCTSI) | BIT(UCRXI);
702702
}

libraries/ESP8266WebServer/src/Parsing-impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ typename ESP8266WebServerTemplate<ServerType>::ClientFuture ESP8266WebServerTemp
182182
if (!isForm) {
183183
if (contentLength) {
184184
// add key=value: plain={body} (post json or other data)
185-
RequestArgument& arg = _currentArgs[_currentArgCount++];
185+
RequestArgument& arg = _currentArgs[_currentArgCount];
186186
arg.key = F("plain");
187187
arg.value = plainBuf;
188188
_currentArgsHavePlain = 1;

tools/sdk/include/bearssl/bearssl.h

+13
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@
137137
#include "bearssl_x509.h"
138138
#include "bearssl_pem.h"
139139

140+
#ifdef __cplusplus
141+
extern "C" {
142+
#endif
143+
140144
/** \brief Type for a configuration option.
141145
*
142146
* A "configuration option" is a value that is selected when the BearSSL
@@ -167,4 +171,13 @@ typedef struct {
167171
*/
168172
const br_config_option *br_get_config(void);
169173

174+
/* ======================================================================= */
175+
176+
/** \brief Version feature: support for time callback. */
177+
#define BR_FEATURE_X509_TIME_CALLBACK 1
178+
179+
#ifdef __cplusplus
180+
}
181+
#endif
182+
170183
#endif
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// Do not edit -- Automatically generated by tools/sdk/ssl/bearssl/Makefile
2-
#define BEARSSL_GIT 6105635
2+
#define BEARSSL_GIT 9fe3977

tools/sdk/include/bearssl/bearssl_x509.h

+80-3
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,52 @@ typedef struct {
625625

626626
} br_name_element;
627627

628+
/**
629+
* \brief Callback for validity date checks.
630+
*
631+
* The function receives as parameter an arbitrary user-provided context,
632+
* and the notBefore and notAfter dates specified in an X.509 certificate,
633+
* both expressed as a number of days and a number of seconds:
634+
*
635+
* - Days are counted in a proleptic Gregorian calendar since
636+
* January 1st, 0 AD. Year "0 AD" is the one that preceded "1 AD";
637+
* it is also traditionally known as "1 BC".
638+
*
639+
* - Seconds are counted since midnight, from 0 to 86400 (a count of
640+
* 86400 is possible only if a leap second happened).
641+
*
642+
* Each date and time is understood in the UTC time zone. The "Unix
643+
* Epoch" (January 1st, 1970, 00:00 UTC) corresponds to days=719528 and
644+
* seconds=0; the "Windows Epoch" (January 1st, 1601, 00:00 UTC) is
645+
* days=584754, seconds=0.
646+
*
647+
* This function must return -1 if the current date is strictly before
648+
* the "notBefore" time, or +1 if the current date is strictly after the
649+
* "notAfter" time. If neither condition holds, then the function returns
650+
* 0, which means that the current date falls within the validity range of
651+
* the certificate. If the function returns a value distinct from -1, 0
652+
* and +1, then this is interpreted as an unavailability of the current
653+
* time, which normally ends the validation process with a
654+
* `BR_ERR_X509_TIME_UNKNOWN` error.
655+
*
656+
* During path validation, this callback will be invoked for each
657+
* considered X.509 certificate. Validation fails if any of the calls
658+
* returns a non-zero value.
659+
*
660+
* The context value is an abritrary pointer set by the caller when
661+
* configuring this callback.
662+
*
663+
* \param tctx context pointer.
664+
* \param not_before_days notBefore date (days since Jan 1st, 0 AD).
665+
* \param not_before_seconds notBefore time (seconds, at most 86400).
666+
* \param not_after_days notAfter date (days since Jan 1st, 0 AD).
667+
* \param not_after_seconds notAfter time (seconds, at most 86400).
668+
* \return -1, 0 or +1.
669+
*/
670+
typedef int (*br_x509_time_check)(void *tctx,
671+
uint32_t not_before_days, uint32_t not_before_seconds,
672+
uint32_t not_after_days, uint32_t not_after_seconds);
673+
628674
/**
629675
* \brief The "minimal" X.509 engine structure.
630676
*
@@ -647,8 +693,8 @@ typedef struct {
647693
uint32_t *rp;
648694
const unsigned char *ip;
649695
} cpu;
650-
uint32_t dp_stack[32];
651-
uint32_t rp_stack[32];
696+
uint32_t dp_stack[31];
697+
uint32_t rp_stack[31];
652698
int err;
653699

654700
/* Server name to match with the SAN / CN of the EE certificate. */
@@ -730,6 +776,12 @@ typedef struct {
730776
br_name_element *name_elts;
731777
size_t num_name_elts;
732778

779+
/*
780+
* Callback function (and context) to get the current date.
781+
*/
782+
void *itime_ctx;
783+
br_x509_time_check itime;
784+
733785
/*
734786
* Public key cryptography implementations (signature verification).
735787
*/
@@ -890,7 +942,10 @@ void br_x509_minimal_init_full(br_x509_minimal_context *ctx,
890942
* - Seconds are counted since midnight, from 0 to 86400 (a count of
891943
* 86400 is possible only if a leap second happened).
892944
*
893-
* The validation date and time is understood in the UTC time zone.
945+
* The validation date and time is understood in the UTC time zone. The
946+
* "Unix Epoch" (January 1st, 1970, 00:00 UTC) corresponds to days=719528
947+
* and seconds=0; the "Windows Epoch" (January 1st, 1601, 00:00 UTC) is
948+
* days=584754, seconds=0.
894949
*
895950
* If the validation date and time are not explicitly set, but BearSSL
896951
* was compiled with support for the system clock on the underlying
@@ -908,6 +963,28 @@ br_x509_minimal_set_time(br_x509_minimal_context *ctx,
908963
{
909964
ctx->days = days;
910965
ctx->seconds = seconds;
966+
ctx->itime = 0;
967+
}
968+
969+
/**
970+
* \brief Set the validity range callback function for the X.509
971+
* "minimal" engine.
972+
*
973+
* The provided function will be invoked to check whether the validation
974+
* date is within the validity range for a given X.509 certificate; a
975+
* call will be issued for each considered certificate. The provided
976+
* context pointer (itime_ctx) will be passed as first parameter to the
977+
* callback.
978+
*
979+
* \param tctx context for callback invocation.
980+
* \param cb callback function.
981+
*/
982+
static inline void
983+
br_x509_minimal_set_time_callback(br_x509_minimal_context *ctx,
984+
void *itime_ctx, br_x509_time_check itime)
985+
{
986+
ctx->itime_ctx = itime_ctx;
987+
ctx->itime = itime;
911988
}
912989

913990
/**

tools/sdk/lib/libbearssl.a

4.54 KB
Binary file not shown.

tools/sdk/lib/liblwip2-1460-feat.a

64 Bytes
Binary file not shown.

tools/sdk/lib/liblwip2-1460.a

16 Bytes
Binary file not shown.

tools/sdk/lib/liblwip2-536-feat.a

64 Bytes
Binary file not shown.

tools/sdk/lib/liblwip2-536.a

16 Bytes
Binary file not shown.

tools/sdk/lib/liblwip6-1460-feat.a

68 Bytes
Binary file not shown.

tools/sdk/lib/liblwip6-536-feat.a

68 Bytes
Binary file not shown.

tools/sdk/lwip2/builder

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// generated by makefiles/make-lwip2-hash
22
#ifndef LWIP_HASH_H
33
#define LWIP_HASH_H
4-
#define LWIP_HASH_STR "STABLE-2_1_3_RELEASE/glue:1.2-61-g679577b"
4+
#define LWIP_HASH_STR "STABLE-2_1_3_RELEASE/glue:1.2-63-gb5def38"
55
#endif // LWIP_HASH_H

tools/sdk/lwip2/include/lwip/arch.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ typedef uintptr_t mem_ptr_t;
190190
* sys/types or unistd.h are available).
191191
* Being like that, we define it to 'int' if SSIZE_MAX is not defined.
192192
*/
193-
#if !defined(SSIZE_MAX) || !defined(_SSIZE_T_DECLARED)
193+
#ifdef SSIZE_MAX
194194
/* If SSIZE_MAX is defined, unistd.h should provide the type as well */
195195
#ifndef LWIP_NO_UNISTD_H
196196
#define LWIP_NO_UNISTD_H 0

0 commit comments

Comments
 (0)