Skip to content

Commit bbdf366

Browse files
committed
openssl: sync openssl wrap layer from esp-idf and add openssl_demo
1 parent ae29bf8 commit bbdf366

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+8880
-914
lines changed

examples/openssl_demo/Makefile

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#############################################################
2+
# Required variables for each makefile
3+
# Discard this section from all parent makefiles
4+
# Expected variables (with automatic defaults):
5+
# CSRCS (all "C" files in the dir)
6+
# SUBDIRS (all subdirs with a Makefile)
7+
# GEN_LIBS - list of libs to be generated ()
8+
# GEN_IMAGES - list of object file images to be generated ()
9+
# GEN_BINS - list of binaries to be generated ()
10+
# COMPONENTS_xxx - a list of libs/objs in the form
11+
# subdir/lib to be extracted and rolled up into
12+
# a generated lib/image xxx.a ()
13+
#
14+
TARGET = eagle
15+
#FLAVOR = release
16+
FLAVOR = debug
17+
18+
#EXTRA_CCFLAGS += -u
19+
20+
ifndef PDIR # {
21+
GEN_IMAGES= eagle.app.v6.out
22+
GEN_BINS= eagle.app.v6.bin
23+
SPECIAL_MKTARGETS=$(APP_MKTARGETS)
24+
SUBDIRS= \
25+
user \
26+
programs
27+
28+
endif # } PDIR
29+
30+
LDDIR = $(SDK_PATH)/ld
31+
32+
CCFLAGS += -Os
33+
34+
TARGET_LDFLAGS = \
35+
-nostdlib \
36+
-Wl,-EL \
37+
--longcalls \
38+
--text-section-literals
39+
40+
ifeq ($(FLAVOR),debug)
41+
TARGET_LDFLAGS += -g -O2
42+
endif
43+
44+
ifeq ($(FLAVOR),release)
45+
TARGET_LDFLAGS += -g -O0
46+
endif
47+
48+
COMPONENTS_eagle.app.v6 = \
49+
user/libuser.a \
50+
programs/openssl_demo.a
51+
52+
LINKFLAGS_eagle.app.v6 = \
53+
-L$(SDK_PATH)/lib \
54+
-Wl,--gc-sections \
55+
-nostdlib \
56+
-T$(LD_FILE) \
57+
-Wl,--no-check-sections \
58+
-u call_user_start \
59+
-Wl,-static \
60+
-Wl,--start-group \
61+
-lcirom \
62+
-lgcc \
63+
-lhal \
64+
-lcrypto \
65+
-lfreertos \
66+
-llwip \
67+
-lmain \
68+
-lnet80211 \
69+
-lphy \
70+
-lpp \
71+
-lmbedtls \
72+
-lopenssl \
73+
-lwpa \
74+
$(DEP_LIBS_eagle.app.v6)\
75+
-Wl,--end-group
76+
77+
DEPENDS_eagle.app.v6 = \
78+
$(LD_FILE) \
79+
$(LDDIR)/eagle.rom.addr.v6.ld
80+
81+
#############################################################
82+
# Configuration i.e. compile options etc.
83+
# Target specific stuff (defines etc.) goes in here!
84+
# Generally values applying to a tree are captured in the
85+
# makefile at its root level - these are then overridden
86+
# for a subtree within the makefile rooted therein
87+
#
88+
89+
#UNIVERSAL_TARGET_DEFINES = \
90+
91+
# Other potential configuration flags include:
92+
# -DTXRX_TXBUF_DEBUG
93+
# -DTXRX_RXBUF_DEBUG
94+
# -DWLAN_CONFIG_CCX
95+
CONFIGURATION_DEFINES = -DICACHE_FLASH
96+
97+
DEFINES += \
98+
$(UNIVERSAL_TARGET_DEFINES) \
99+
$(CONFIGURATION_DEFINES)
100+
101+
DDEFINES += \
102+
$(UNIVERSAL_TARGET_DEFINES) \
103+
$(CONFIGURATION_DEFINES)
104+
105+
106+
#############################################################
107+
# Recursion Magic - Don't touch this!!
108+
#
109+
# Each subtree potentially has an include directory
110+
# corresponding to the common APIs applicable to modules
111+
# rooted at that subtree. Accordingly, the INCLUDE PATH
112+
# of a module can only contain the include directories up
113+
# its parent path, and not its siblings
114+
#
115+
# Required for each makefile to inherit from the parent
116+
#
117+
118+
INCLUDES := $(INCLUDES) -I $(PDIR)include -I include -I $(SDK_PATH)/include/openssl
119+
sinclude $(SDK_PATH)/Makefile
120+
121+
.PHONY: FORCE
122+
FORCE:
123+

examples/openssl_demo/gen_misc.sh

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
#!/bin/bash
2+
3+
echo "gen_misc.sh version 20150911"
4+
echo ""
5+
6+
if [ $SDK_PATH ]; then
7+
echo "SDK_PATH:"
8+
echo "$SDK_PATH"
9+
echo ""
10+
else
11+
echo "ERROR: Please export SDK_PATH in gen_misc.sh firstly, exit!!!"
12+
exit
13+
fi
14+
15+
if [ $BIN_PATH ]; then
16+
echo "BIN_PATH:"
17+
echo "$BIN_PATH"
18+
echo ""
19+
else
20+
echo "ERROR: Please export BIN_PATH in gen_misc.sh firstly, exit!!!"
21+
exit
22+
fi
23+
24+
echo "Please check SDK_PATH & BIN_PATH, enter (Y/y) to continue:"
25+
read input
26+
27+
if [[ $input != Y ]] && [[ $input != y ]]; then
28+
exit
29+
fi
30+
31+
echo ""
32+
33+
echo "Please follow below steps(1-5) to generate specific bin(s):"
34+
echo "STEP 1: use boot_v1.2+ by default"
35+
boot=new
36+
37+
echo "boot mode: $boot"
38+
echo ""
39+
40+
echo "STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)"
41+
echo "enter (0/1/2, default 0):"
42+
read input
43+
44+
if [ -z "$input" ]; then
45+
if [ $boot != none ]; then
46+
boot=none
47+
echo "ignore boot"
48+
fi
49+
app=0
50+
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
51+
elif [ $input == 1 ]; then
52+
if [ $boot == none ]; then
53+
app=0
54+
echo "choose no boot before"
55+
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
56+
else
57+
app=1
58+
echo "generate bin: user1.bin"
59+
fi
60+
elif [ $input == 2 ]; then
61+
if [ $boot == none ]; then
62+
app=0
63+
echo "choose no boot before"
64+
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
65+
else
66+
app=2
67+
echo "generate bin: user2.bin"
68+
fi
69+
else
70+
if [ $boot != none ]; then
71+
boot=none
72+
echo "ignore boot"
73+
fi
74+
app=0
75+
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
76+
fi
77+
78+
echo ""
79+
80+
echo "STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)"
81+
echo "enter (0/1/2/3, default 2):"
82+
read input
83+
84+
if [ -z "$input" ]; then
85+
spi_speed=40
86+
elif [ $input == 0 ]; then
87+
spi_speed=20
88+
elif [ $input == 1 ]; then
89+
spi_speed=26.7
90+
elif [ $input == 3 ]; then
91+
spi_speed=80
92+
else
93+
spi_speed=40
94+
fi
95+
96+
echo "spi speed: $spi_speed MHz"
97+
echo ""
98+
99+
echo "STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)"
100+
echo "enter (0/1/2/3, default 0):"
101+
read input
102+
103+
if [ -z "$input" ]; then
104+
spi_mode=QIO
105+
elif [ $input == 1 ]; then
106+
spi_mode=QOUT
107+
elif [ $input == 2 ]; then
108+
spi_mode=DIO
109+
elif [ $input == 3 ]; then
110+
spi_mode=DOUT
111+
else
112+
spi_mode=QIO
113+
fi
114+
115+
echo "spi mode: $spi_mode"
116+
echo ""
117+
118+
echo "STEP 5: choose spi size and map"
119+
echo " 0= 512KB( 256KB+ 256KB)"
120+
echo " 2=1024KB( 512KB+ 512KB)"
121+
echo " 3=2048KB( 512KB+ 512KB)"
122+
echo " 4=4096KB( 512KB+ 512KB)"
123+
echo " 5=2048KB(1024KB+1024KB)"
124+
echo " 6=4096KB(1024KB+1024KB)"
125+
echo "enter (0/2/3/4/5/6, default 0):"
126+
read input
127+
128+
if [ -z "$input" ]; then
129+
spi_size_map=0
130+
echo "spi size: 512KB"
131+
echo "spi ota map: 256KB + 256KB"
132+
elif [ $input == 2 ]; then
133+
spi_size_map=2
134+
echo "spi size: 1024KB"
135+
echo "spi ota map: 512KB + 512KB"
136+
elif [ $input == 3 ]; then
137+
spi_size_map=3
138+
echo "spi size: 2048KB"
139+
echo "spi ota map: 512KB + 512KB"
140+
elif [ $input == 4 ]; then
141+
spi_size_map=4
142+
echo "spi size: 4096KB"
143+
echo "spi ota map: 512KB + 512KB"
144+
elif [ $input == 5 ]; then
145+
spi_size_map=5
146+
echo "spi size: 2048KB"
147+
echo "spi ota map: 1024KB + 1024KB"
148+
elif [ $input == 6 ]; then
149+
spi_size_map=6
150+
echo "spi size: 4096KB"
151+
echo "spi ota map: 1024KB + 1024KB"
152+
else
153+
spi_size_map=0
154+
echo "spi size: 512KB"
155+
echo "spi ota map: 256KB + 256KB"
156+
fi
157+
158+
echo ""
159+
160+
echo "start..."
161+
echo ""
162+
163+
make clean
164+
165+
make BOOT=$boot APP=$app SPI_SPEED=$spi_speed SPI_MODE=$spi_mode SPI_SIZE_MAP=$spi_size_map
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef _OPENSSL_DEMO_H_
2+
#define _OPENSSL_DEMO_H_
3+
4+
void user_conn_init(void);
5+
6+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* ESPRSSIF MIT License
3+
*
4+
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
5+
*
6+
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
7+
* it is free of charge, to any person obtaining a copy of this software and associated
8+
* documentation files (the "Software"), to deal in the Software without restriction, including
9+
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11+
* to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all copies or
14+
* substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
*
23+
*/
24+
25+
#ifndef __USER_CONFIG_H__
26+
#define __USER_CONFIG_H__
27+
28+
#include "openssl_demo.h"
29+
30+
#define SSID "UTT-750"
31+
#define PASSWORD "espressif"
32+
33+
#endif
34+
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
#############################################################
3+
# Required variables for each makefile
4+
# Discard this section from all parent makefiles
5+
# Expected variables (with automatic defaults):
6+
# CSRCS (all "C" files in the dir)
7+
# SUBDIRS (all subdirs with a Makefile)
8+
# GEN_LIBS - list of libs to be generated ()
9+
# GEN_IMAGES - list of images to be generated ()
10+
# COMPONENTS_xxx - a list of libs/objs in the form
11+
# subdir/lib to be extracted and rolled up into
12+
# a generated lib/image xxx.a ()
13+
#
14+
ifndef PDIR
15+
16+
UP_EXTRACT_DIR = ..
17+
GEN_LIBS = openssl_demo.a
18+
19+
endif
20+
21+
22+
#############################################################
23+
# Configuration i.e. compile options etc.
24+
# Target specific stuff (defines etc.) goes in here!
25+
# Generally values applying to a tree are captured in the
26+
# makefile at its root level - these are then overridden
27+
# for a subtree within the makefile rooted therein
28+
#
29+
#DEFINES +=
30+
31+
#############################################################
32+
# Recursion Magic - Don't touch this!!
33+
#
34+
# Each subtree potentially has an include directory
35+
# corresponding to the common APIs applicable to modules
36+
# rooted at that subtree. Accordingly, the INCLUDE PATH
37+
# of a module can only contain the include directories up
38+
# its parent path, and not its siblings
39+
#
40+
# Required for each makefile to inherit from the parent
41+
#
42+
43+
INCLUDES := $(INCLUDES) -I $(PDIR)include
44+
INCLUDES += -I ./
45+
PDIR := ../$(PDIR)
46+
sinclude $(PDIR)Makefile
47+

0 commit comments

Comments
 (0)