Skip to content

Commit 5a03383

Browse files
Add a build directory for libbearssl.a (#4736)
Simple git submodule and makefile for building the bearssl library from source in the Arduino tree.
1 parent 529baab commit 5a03383

File tree

7 files changed

+76
-0
lines changed

7 files changed

+76
-0
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "lwip2"]
22
path = tools/sdk/lwip2/builder
33
url = https://github.com/d-a-v/esp82xx-nonos-linklayer.git
4+
[submodule "tools/sdk/ssl/bearssl"]
5+
path = tools/sdk/ssl/bearssl
6+
url = https://github.com/earlephilhower/bearssl-esp8266

cores/esp8266/Esp-version.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <core_version.h>
2424
#include <lwip/init.h> // LWIP_VERSION_*
2525
#include <lwipopts.h> // LWIP_HASH_STR (lwip2)
26+
#include <bearssl/bearssl_git.h> // BEARSSL_GIT short hash
2627

2728
#define STRHELPER(x) #x
2829
#define STR(x) STRHELPER(x) // stringifier
@@ -31,6 +32,7 @@ static const char arduino_esp8266_git_ver [] PROGMEM = STR(ARDUINO_ESP8266_GIT_D
3132
#if LWIP_VERSION_MAJOR != 1
3233
static const char lwip2_version [] PROGMEM = "/lwIP:" STR(LWIP_VERSION_MAJOR) "." STR(LWIP_VERSION_MINOR) "." STR(LWIP_VERSION_REVISION);
3334
#endif
35+
static const char bearssl_version [] PROGMEM = "/BearSSL:" STR(BEARSSL_GIT);
3436

3537
String EspClass::getFullVersion()
3638
{
@@ -50,5 +52,6 @@ String EspClass::getFullVersion()
5052
#ifdef LWIP_HASH_STR
5153
+ "(" + F(LWIP_HASH_STR) + ")"
5254
#endif
55+
+ FPSTR(bearssl_version)
5356
;
5457
}
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Do not edit -- Automatically generated by tools/sdk/ssl/bearssl/Makefile
2+
#define BEARSSL_GIT 94e9704

tools/sdk/lib/libbearssl.a

10.7 KB
Binary file not shown.

tools/sdk/ssl/Makefile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
3+
VER_H=../include/bearssl/bearssl_git.h
4+
5+
all T0 clean: bearssl/README.txt
6+
PATH=$(PATH):$(PWD)/../../xtensa-lx106-elf/bin/ && cd bearssl && make CONF=esp8266 $@
7+
8+
install: all version-header
9+
cp bearssl/esp8266/libbearssl.a ../lib/.
10+
cp bearssl/inc/bearssl*.h ../include/bearssl/.
11+
12+
bearssl/README.txt:
13+
git submodule update --init --recursive bearssl
14+
cd bearssl && git remote add bearssl https://www.bearssl.org/git/BearSSL
15+
16+
merge-upstream:
17+
cd bearssl && git pull bearssl master
18+
19+
version-header:
20+
echo "// Do not edit -- Automatically generated by tools/sdk/ssl/bearssl/Makefile" > $(VER_H)
21+
echo -n "#define BEARSSL_GIT " >> $(VER_H)
22+
cd bearssl && git rev-parse --short HEAD >> ../$(VER_H)

tools/sdk/ssl/README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# BearSSL ESP8266 builder
2+
3+
This directory contains the git submodule for the ESP8266 ported bearssl low-level library, a port of [BearSSL](https://www.bearssl.org)
4+
5+
If you are only working on the `BearSSL::` namespace functions in the
6+
Arduino `ESP8266WiFi` library (`BearSSL::WiFiClientSecure`,
7+
`BearSSL::WiFiServerSecure`, etc.) you do _NOT_ need to work in this
8+
directory.
9+
10+
Normal users can simply use the libbearssl.a file already included in
11+
the `Arduino` repo. Experienced users looking to work on the underlying
12+
BearSSL-ESP8266 ported library can use this directory to automate the
13+
build flow.
14+
15+
16+
## Prerequisites
17+
The tools directory needs to be populated (i.e. Arduino IDE should be able
18+
to compile an executable probect. `get.py` should ensure this).
19+
20+
### UNIX-like system (Linux, Mac):
21+
If you need to change the *.t0 (Forth-like language) you will need a
22+
.NET-compatible runtime (such as `mono` under Linux) to rebuild the
23+
resulant `.c` files.
24+
25+
### For Windows (untested)
26+
Microsoft's .NET runtime must be installed to run the `.t0`->`.c` workflow.
27+
28+
29+
## Building
30+
* `make all`: Init the submodule, if needed, then build _but do not install_ the library
31+
* `make install`: Init the submodule, if needed, then build and copy the library to the standard location in `tools/sdk/lib`
32+
33+
## Editing the library
34+
`https://github.com/earlephilhower/bearssl-esp8266` is the current repository
35+
for this library. A `git remote` to the original BearSSL sources from
36+
`https://bearssl.org/git/BearSSL` is added on submodule init. You can either
37+
manually do pulls, or `make merge-upstream` to bring in any BearSSL upstream
38+
changes.
39+
40+
Documentation in the library README-esp8266 and git log describes the changes done.
41+
42+
43+
Feel free to drop me a line at <earlephilhower@yahoo.com> if you have questions.
44+
45+
-Earle F. Philhower, III

tools/sdk/ssl/bearssl

Submodule bearssl added at 94e9704

0 commit comments

Comments
 (0)