Skip to content

Add a build directory for libbearssl.a #4736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lwip2"]
path = tools/sdk/lwip2/builder
url = https://github.com/d-a-v/esp82xx-nonos-linklayer.git
[submodule "tools/sdk/ssl/bearssl"]
path = tools/sdk/ssl/bearssl
url = https://github.com/earlephilhower/bearssl-esp8266
3 changes: 3 additions & 0 deletions cores/esp8266/Esp-version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <core_version.h>
#include <lwip/init.h> // LWIP_VERSION_*
#include <lwipopts.h> // LWIP_HASH_STR (lwip2)
#include <bearssl/bearssl_git.h> // BEARSSL_GIT short hash

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

String EspClass::getFullVersion()
{
Expand All @@ -50,5 +52,6 @@ String EspClass::getFullVersion()
#ifdef LWIP_HASH_STR
+ "(" + F(LWIP_HASH_STR) + ")"
#endif
+ FPSTR(bearssl_version)
;
}
2 changes: 2 additions & 0 deletions tools/sdk/include/bearssl/bearssl_git.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Do not edit -- Automatically generated by tools/sdk/ssl/bearssl/Makefile
#define BEARSSL_GIT 94e9704
Binary file modified tools/sdk/lib/libbearssl.a
Binary file not shown.
22 changes: 22 additions & 0 deletions tools/sdk/ssl/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@


VER_H=../include/bearssl/bearssl_git.h

all T0 clean: bearssl/README.txt
PATH=$(PATH):$(PWD)/../../xtensa-lx106-elf/bin/ && cd bearssl && make CONF=esp8266 $@

install: all version-header
cp bearssl/esp8266/libbearssl.a ../lib/.
cp bearssl/inc/bearssl*.h ../include/bearssl/.

bearssl/README.txt:
git submodule update --init --recursive bearssl
cd bearssl && git remote add bearssl https://www.bearssl.org/git/BearSSL

merge-upstream:
cd bearssl && git pull bearssl master

version-header:
echo "// Do not edit -- Automatically generated by tools/sdk/ssl/bearssl/Makefile" > $(VER_H)
echo -n "#define BEARSSL_GIT " >> $(VER_H)
cd bearssl && git rev-parse --short HEAD >> ../$(VER_H)
45 changes: 45 additions & 0 deletions tools/sdk/ssl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# BearSSL ESP8266 builder

This directory contains the git submodule for the ESP8266 ported bearssl low-level library, a port of [BearSSL](https://www.bearssl.org)

If you are only working on the `BearSSL::` namespace functions in the
Arduino `ESP8266WiFi` library (`BearSSL::WiFiClientSecure`,
`BearSSL::WiFiServerSecure`, etc.) you do _NOT_ need to work in this
directory.

Normal users can simply use the libbearssl.a file already included in
the `Arduino` repo. Experienced users looking to work on the underlying
BearSSL-ESP8266 ported library can use this directory to automate the
build flow.


## Prerequisites
The tools directory needs to be populated (i.e. Arduino IDE should be able
to compile an executable probect. `get.py` should ensure this).

### UNIX-like system (Linux, Mac):
If you need to change the *.t0 (Forth-like language) you will need a
.NET-compatible runtime (such as `mono` under Linux) to rebuild the
resulant `.c` files.

### For Windows (untested)
Microsoft's .NET runtime must be installed to run the `.t0`->`.c` workflow.


## Building
* `make all`: Init the submodule, if needed, then build _but do not install_ the library
* `make install`: Init the submodule, if needed, then build and copy the library to the standard location in `tools/sdk/lib`

## Editing the library
`https://github.com/earlephilhower/bearssl-esp8266` is the current repository
for this library. A `git remote` to the original BearSSL sources from
`https://bearssl.org/git/BearSSL` is added on submodule init. You can either
manually do pulls, or `make merge-upstream` to bring in any BearSSL upstream
changes.

Documentation in the library README-esp8266 and git log describes the changes done.


Feel free to drop me a line at <[email protected]> if you have questions.

-Earle F. Philhower, III
1 change: 1 addition & 0 deletions tools/sdk/ssl/bearssl
Submodule bearssl added at 94e970