8000 Revert to upstream alternative stack, prepare for Arduino cont contex… · Adam5Wu/bearssl-esp8266@7ac44d7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ac44d7

Browse files
committed
Revert to upstream alternative stack, prepare for Arduino cont context relocation
1 parent b2939e9 commit 7ac44d7

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![License](https://img.shields.io/github/license/Adam5Wu/bearssl-esp8266.svg)](./LICENSE.txt)
66

77
BearSSL port for ESP8266.
8-
Reverted custom stack proxy, works better with AsyncTCP.
8+
With small patches, works better with AsyncTCP.
99

1010
* [Upstream Project](https://github.com/earlephilhower/bearssl-esp8266)
1111
* [Modifications of this fork](MODIFICATIONS.md)

src/inner.h

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/*
22
* Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>
33
*
4-
* Permission is hereby granted, free of charge, to any person obtaining
4+
* Permission is hereby granted, free of charge, to any person obtaining
55
* a copy of this software and associated documentation files (the
66
* "Software"), to deal in the Software without restriction, including
77
* without limitation the rights to use, copy, modify, merge, publish,
88
* distribute, sublicense, and/or sell copies of the Software, and to
99
* permit persons to whom the Software is furnished to do so, subject to
1010
* the following conditions:
1111
*
12-
* The above copyright notice and this permission notice shall be
12+
* The above copyright notice and this permission notice shall be
1313
* included in all copies or substantial portions of the Software.
1414
*
15-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1616
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1818
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
1919
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2020
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
@@ -2351,15 +2351,14 @@ br_cpuid(uint32_t mask_eax, uint32_t mask_ebx,
23512351

23522352
#endif
23532353

2354-
#if defined(ESP8266) && ESP8266_ALTSTACK
2354+
#ifdef ESP8266
23552355

23562356
#ifdef __cplusplus
23572357
extern "C" {
23582358
#endif
23592359

23602360
#define _debugBearSSL (0)
23612361
extern void optimistic_yield(uint32_t);
2362-
extern void system_soft_wdt_feed();
23632362
extern void br_stack_proxy_enter();
23642363
extern void *br_stack_proxy_alloc(size_t bytes);
23652364
extern void br_stack_proxy_exit();
@@ -2370,7 +2369,7 @@ br_cpuid(uint32_t mask_eax, uint32_t mask_ebx,
23702369
#define STACK_PROXY_EXIT() { if (_debugBearSSL) { char b[64]; sprintf(b, "EXIT: %s:%s\n", __FILE__, __FUNCTION__ ); _BearSSLSerialPrint(b); } br_stack_proxy_exit(); }
23712370
#define STACK_PROXY_ALLOC(type, name, count) \
23722371
type *name = (type *)br_stack_proxy_alloc(sizeof(type) * (count));\
2373-
if (!name) name = (type *)alloca(sizeof(type) * (count));
2372+
if (!name) name = (type *)alloca(sizeof(type) * (count));
23742373
#define dumpstack() if (_debugBearSSL) _BearSSLCheckStack(__FUNCTION__, __FILE__, __LINE__); else {}
23752374

23762375
#ifdef __cplusplus
@@ -2383,13 +2382,6 @@ br_cpuid(uint32_t mask_eax, uint32_t mask_ebx,
23832382
#define STACK_PROXY_ALLOC(type, name, count) type name[count]
23842383
#define dumpstack()
23852384
#define optimistic_yield(ignored)
2386-
2387-
#if defined(ESP8266)
2388-
extern void system_soft_wdt_feed();
2389-
#else
2390-
#define system_soft_wdt_feed()
2391-
#endif
2392-
23932385
#endif
23942386

23952387

src/port/esp8266_stack_proxy.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,11 @@ void *br_stack_proxy_alloc(size_t bytes)
7373
return (void*)ptr;
7474
}
7575
// If we're here, the 2nd stack allocation failed. Record if in debug mode
76-
#if DEBUG_BEARSSL
77-
{
76+
if (_debugBearSSL) {
7877
char a[32];
7978
sprintf(a,"stack2 alloc %d fail\n", bytes);
8079
_BearSSLSerialPrint(a);
8180
}
82-
#endif
8381
return NULL;
8482
}
8583

0 commit comments

Comments
 (0)
0