1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Merge branch 'master' into master

This commit is contained in:
david gauchard 2022-06-15 23:56:51 +02:00 committed by GitHub
commit 80c685df80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 126 additions and 28 deletions

View File

@ -260,7 +260,8 @@ String &String::copy(const char *cstr, unsigned int length) {
return *this; return *this;
} }
setLen(length); setLen(length);
memmove_P(wbuffer(), cstr, length + 1); memmove_P(wbuffer(), cstr, length);
wbuffer()[length] = 0;
return *this; return *this;
} }
@ -270,7 +271,8 @@ String &String::copy(const __FlashStringHelper *pstr, unsigned int length) {
return *this; return *this;
} }
setLen(length); setLen(length);
memcpy_P(wbuffer(), (PGM_P)pstr, length + 1); // We know wbuffer() cannot ever be in PROGMEM, so memcpy safe here memcpy_P(wbuffer(), (PGM_P)pstr, length); // We know wbuffer() cannot ever be in PROGMEM, so memcpy safe here
wbuffer()[length] = 0;
return *this; return *this;
} }
@ -411,8 +413,9 @@ bool String::concat(const __FlashStringHelper *str) {
unsigned int newlen = len() + length; unsigned int newlen = len() + length;
if (!reserve(newlen)) if (!reserve(newlen))
return false; return false;
memcpy_P(wbuffer() + len(), (PGM_P)str, length + 1); memcpy_P(wbuffer() + len(), (PGM_P)str, length);
setLen(newlen); setLen(newlen);
wbuffer()[newlen] = 0;
return true; return true;
} }

View File

@ -696,7 +696,7 @@ uart_init(int uart_nr, int baudrate, int config, int mode, int tx_pin, size_t rx
} }
uart_set_baudrate(uart, baudrate); uart_set_baudrate(uart, baudrate);
if(uart->uart_nr == UART0 && invert) if((uart->uart_nr == UART0 || uart->uart_nr == UART1) && invert)
{ {
config |= BIT(UCDTRI) | BIT(UCRTSI) | BIT(UCTXI) | BIT(UCDSRI) | BIT(UCCTSI) | BIT(UCRXI); config |= BIT(UCDTRI) | BIT(UCRTSI) | BIT(UCTXI) | BIT(UCDSRI) | BIT(UCCTSI) | BIT(UCRXI);
} }

View File

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

View File

@ -137,6 +137,10 @@
#include "bearssl_x509.h" #include "bearssl_x509.h"
#include "bearssl_pem.h" #include "bearssl_pem.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \brief Type for a configuration option. /** \brief Type for a configuration option.
* *
* A "configuration option" is a value that is selected when the BearSSL * A "configuration option" is a value that is selected when the BearSSL
@ -167,4 +171,13 @@ typedef struct {
*/ */
const br_config_option *br_get_config(void); const br_config_option *br_get_config(void);
/* ======================================================================= */
/** \brief Version feature: support for time callback. */
#define BR_FEATURE_X509_TIME_CALLBACK 1
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -1,2 +1,2 @@
// Do not edit -- Automatically generated by tools/sdk/ssl/bearssl/Makefile // Do not edit -- Automatically generated by tools/sdk/ssl/bearssl/Makefile
#define BEARSSL_GIT 6105635 #define BEARSSL_GIT 9fe3977

View File

@ -625,6 +625,52 @@ typedef struct {
} br_name_element; } br_name_element;
/**
* \brief Callback for validity date checks.
*
* The function receives as parameter an arbitrary user-provided context,
* and the notBefore and notAfter dates specified in an X.509 certificate,
* both expressed as a number of days and a number of seconds:
*
* - Days are counted in a proleptic Gregorian calendar since
* January 1st, 0 AD. Year "0 AD" is the one that preceded "1 AD";
* it is also traditionally known as "1 BC".
*
* - Seconds are counted since midnight, from 0 to 86400 (a count of
* 86400 is possible only if a leap second happened).
*
* Each date and time is understood in the UTC time zone. The "Unix
* Epoch" (January 1st, 1970, 00:00 UTC) corresponds to days=719528 and
* seconds=0; the "Windows Epoch" (January 1st, 1601, 00:00 UTC) is
* days=584754, seconds=0.
*
* This function must return -1 if the current date is strictly before
* the "notBefore" time, or +1 if the current date is strictly after the
* "notAfter" time. If neither condition holds, then the function returns
* 0, which means that the current date falls within the validity range of
* the certificate. If the function returns a value distinct from -1, 0
* and +1, then this is interpreted as an unavailability of the current
* time, which normally ends the validation process with a
* `BR_ERR_X509_TIME_UNKNOWN` error.
*
* During path validation, this callback will be invoked for each
* considered X.509 certificate. Validation fails if any of the calls
* returns a non-zero value.
*
* The context value is an abritrary pointer set by the caller when
* configuring this callback.
*
* \param tctx context pointer.
* \param not_before_days notBefore date (days since Jan 1st, 0 AD).
* \param not_before_seconds notBefore time (seconds, at most 86400).
* \param not_after_days notAfter date (days since Jan 1st, 0 AD).
* \param not_after_seconds notAfter time (seconds, at most 86400).
* \return -1, 0 or +1.
*/
typedef int (*br_x509_time_check)(void *tctx,
uint32_t not_before_days, uint32_t not_before_seconds,
uint32_t not_after_days, uint32_t not_after_seconds);
/** /**
* \brief The "minimal" X.509 engine structure. * \brief The "minimal" X.509 engine structure.
* *
@ -647,8 +693,8 @@ typedef struct {
uint32_t *rp; uint32_t *rp;
const unsigned char *ip; const unsigned char *ip;
} cpu; } cpu;
uint32_t dp_stack[32]; uint32_t dp_stack[31];
uint32_t rp_stack[32]; uint32_t rp_stack[31];
int err; int err;
/* Server name to match with the SAN / CN of the EE certificate. */ /* Server name to match with the SAN / CN of the EE certificate. */
@ -730,6 +776,12 @@ typedef struct {
br_name_element *name_elts; br_name_element *name_elts;
size_t num_name_elts; size_t num_name_elts;
/*
* Callback function (and context) to get the current date.
*/
void *itime_ctx;
br_x509_time_check itime;
/* /*
* Public key cryptography implementations (signature verification). * Public key cryptography implementations (signature verification).
*/ */
@ -890,7 +942,10 @@ void br_x509_minimal_init_full(br_x509_minimal_context *ctx,
* - Seconds are counted since midnight, from 0 to 86400 (a count of * - Seconds are counted since midnight, from 0 to 86400 (a count of
* 86400 is possible only if a leap second happened). * 86400 is possible only if a leap second happened).
* *
* The validation date and time is understood in the UTC time zone. * The validation date and time is understood in the UTC time zone. The
* "Unix Epoch" (January 1st, 1970, 00:00 UTC) corresponds to days=719528
* and seconds=0; the "Windows Epoch" (January 1st, 1601, 00:00 UTC) is
* days=584754, seconds=0.
* *
* If the validation date and time are not explicitly set, but BearSSL * If the validation date and time are not explicitly set, but BearSSL
* was compiled with support for the system clock on the underlying * 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,
{ {
ctx->days = days; ctx->days = days;
ctx->seconds = seconds; ctx->seconds = seconds;
ctx->itime = 0;
}
/**
* \brief Set the validity range callback function for the X.509
* "minimal" engine.
*
* The provided function will be invoked to check whether the validation
* date is within the validity range for a given X.509 certificate; a
* call will be issued for each considered certificate. The provided
* context pointer (itime_ctx) will be passed as first parameter to the
* callback.
*
* \param tctx context for callback invocation.
* \param cb callback function.
*/
static inline void
br_x509_minimal_set_time_callback(br_x509_minimal_context *ctx,
void *itime_ctx, br_x509_time_check itime)
{
ctx->itime_ctx = itime_ctx;
ctx->itime = itime;
} }
/** /**

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
Subproject commit 66f84a603ee3070467f119b5e2be5209ec22351f Subproject commit b5def382d6ec666dc423611d09f137aa45147f25

View File

@ -1,5 +1,5 @@
// generated by makefiles/make-lwip2-hash // generated by makefiles/make-lwip2-hash
#ifndef LWIP_HASH_H #ifndef LWIP_HASH_H
#define LWIP_HASH_H #define LWIP_HASH_H
#define LWIP_HASH_STR "STABLE-2_1_3_RELEASE/glue:1.2-61-g679577b" #define LWIP_HASH_STR "STABLE-2_1_3_RELEASE/glue:1.2-63-gb5def38"
#endif // LWIP_HASH_H #endif // LWIP_HASH_H

View File

@ -190,7 +190,7 @@ typedef uintptr_t mem_ptr_t;
* sys/types or unistd.h are available). * sys/types or unistd.h are available).
* Being like that, we define it to 'int' if SSIZE_MAX is not defined. * Being like that, we define it to 'int' if SSIZE_MAX is not defined.
*/ */
#if !defined(SSIZE_MAX) || !defined(_SSIZE_T_DECLARED) #ifdef SSIZE_MAX
/* If SSIZE_MAX is defined, unistd.h should provide the type as well */ /* If SSIZE_MAX is defined, unistd.h should provide the type as well */
#ifndef LWIP_NO_UNISTD_H #ifndef LWIP_NO_UNISTD_H
#define LWIP_NO_UNISTD_H 0 #define LWIP_NO_UNISTD_H 0

@ -1 +1 @@
Subproject commit 6105635531027f5b298aa656d44be2289b2d434f Subproject commit 9fe3977fc33d2a0dc6d26fd4bdec054d5cb889d3

View File

@ -6,17 +6,17 @@
# First parameter is pyserial path, second is esptool path, then a series of command arguments # First parameter is pyserial path, second is esptool path, then a series of command arguments
# i.e. upload.py tools/pyserial tools/esptool write_flash file 0x0 # i.e. upload.py tools/pyserial tools/esptool write_flash file 0x0
import sys
import os import os
import sys
import tempfile import tempfile
sys.argv.pop(0) # Remove executable name sys.argv.pop(0) # Remove executable name
toolspath = os.path.dirname(os.path.realpath(__file__)).replace('\\', '/') # CWD in UNIX format toolspath = os.path.dirname(os.path.realpath(__file__))
try: try:
sys.path.insert(0, toolspath + "/pyserial") # Add pyserial dir to search path sys.path.insert(0, os.path.join(toolspath, "pyserial")) # Add pyserial dir to search path
sys.path.insert(0, toolspath + "/esptool") # Add esptool dir to search path sys.path.insert(0, os.path.join(toolspath, "esptool")) # Add esptool dir to search path
import esptool # If this fails, we can't continue and will bomb below import esptool # If this fails, we can't continue and will bomb below
except Exception: except ImportError:
sys.stderr.write("pyserial or esptool directories not found next to this upload.py tool.\n") sys.stderr.write("pyserial or esptool directories not found next to this upload.py tool.\n")
sys.exit(1) sys.exit(1)
@ -26,7 +26,7 @@ write_addr = '0x0'
erase_addr = '' erase_addr = ''
erase_len = '' erase_len = ''
while len(sys.argv): while sys.argv:
thisarg = sys.argv.pop(0) thisarg = sys.argv.pop(0)
# We silently replace the 921kbaud setting with 460k to enable backward # We silently replace the 921kbaud setting with 460k to enable backward
@ -45,25 +45,30 @@ while len(sys.argv):
elif thisarg == 'write_flash': elif thisarg == 'write_flash':
write_addr = sys.argv.pop(0) write_addr = sys.argv.pop(0)
binary = sys.argv.pop(0) binary = sys.argv.pop(0)
elif len(thisarg): elif thisarg:
cmdline = cmdline + [thisarg] cmdline = cmdline + [thisarg]
cmdline = cmdline + ['write_flash'] cmdline = cmdline + ['write_flash']
if len(write_option): if write_option:
cmdline = cmdline + [write_option] cmdline = cmdline + [write_option]
cmdline = cmdline + ['--flash_size', 'detect'] cmdline = cmdline + ['--flash_size', 'detect']
cmdline = cmdline + [write_addr, binary] cmdline = cmdline + [write_addr, binary]
erase_file = '' erase_file = ''
if len(erase_addr): if erase_addr:
# Generate temporary empty (0xff) file # Generate temporary empty (0xff) file
eraser = tempfile.mkstemp() eraser = tempfile.mkstemp()
erase_file = eraser[1] erase_file = eraser[1]
os.write(eraser[0], bytearray([255] * int(erase_len, 0))) os.write(eraser[0], bytearray([0xff] * int(erase_len, 0)))
os.close(eraser[0]) os.close(eraser[0])
cmdline = cmdline + [erase_addr, erase_file] cmdline = cmdline + [erase_addr, erase_file]
try:
esptool.main(cmdline) esptool.main(cmdline)
except esptool.FatalError as e:
if len(erase_file): sys.stderr.write('\nA fatal esptool.py error occurred: %s' % e)
finally:
if erase_file:
os.remove(erase_file) os.remove(erase_file)
if sys.exc_info:
sys.exit(2)