forked from MicrochipTech/cryptoauth-openssl-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
118 lines (95 loc) · 3.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#
# Makefile
#
#
# Support for submodule repository operations including:
# init, build, clean, dclean, install
#
OPENSSL_VER= _1_0_2
OPENSSL= openssl$(OPENSSL_VER)
CWD:= $(shell pwd)
UNAME_S:= $(shell uname -s)
ARCH:= $(shell arch)
#HW= -DECC_DEBUG
#HW= -DUSE_SLOT2_FOR_CERT -DUSE_ECCX08 -DECC_DEBUG
HW= -DUSE_ECCX08 -DECC_DEBUG
CFLAGS_EXT=
ifeq ($(UNAME_S),Darwin)
OPENSSL_OS= darwin64-x86_64-cc
else
ifeq ($(ARCH),armv7l)
OPENSSL_OS= debug-linux-generic32
else
ifeq ($(UNAME_S),Linux)
OPENSSL_OS= debug-linux-x86_64
else
#error Not supported OS
endif
endif
endif
.PHONY: init_submodule \
tgt_openssl tgt_engine_atecc \
init_openssl patch_openssl build_openssl install_openssl clean_openssl dclean_openssl test_openssl \
build_engine_atecc clean_engine_atecc install_engine_atecc \
tgt_tlsdemo clean_tlsdemo
all: init_submodule tgt_openssl tgt_engine_atecc tgt_tlsdemo
tgt_engine_atecc: build_engine_atecc install_engine_atecc
tgt_openssl: init_openssl patch_openssl build_openssl install_openssl
clean: clean_openssl clean_engine_atecc clean_tlsdemo
dclean: dclean_openssl
test: test_openssl
install: install_openssl install_engine_atecc
# OpenSSL
init_openssl:
@echo "initializing OpenSSL"
@echo $(UNAME_S)
cd $(OPENSSL);./Configure $(OPENSSL_OS) --shared --openssldir=$(CWD)/install_dir -DTLS_DEBUG -DSSL_DEBUG -DKSSL_DEBUG -DCIPHER_DEBUG -DOPENSSL_ALGORITHM_DEFINES -DOPENSSL_NO_SHA512; cd -
ifeq ($(findstring ECC_DEBUG,$(HW)),ECC_DEBUG)
cd $(OPENSSL); sed -i'' -e 's/\-O0 -g/\-O0 -g/g' Makefile; cd -
endif
patch_openssl:
@echo "Patching OpenSSL"
# These next few lines make the patch procedure idempotent
cd $(OPENSSL);git checkout crypto/ecdh/ecdh.h;cd -
cd $(OPENSSL);git checkout crypto/ecdh/ech_key.c;cd -
cd $(OPENSSL);git checkout crypto/ecdh/ech_locl.h;cd -
cd $(OPENSSL);git checkout ssl/s3_srvr.c;cd -
cd $(OPENSSL);git checkout ssl/t1_lib.c;cd -
cd $(OPENSSL);patch -p1 -i ../patches/ecdhe_patch.diff
# patch $(OPENSSL)/ssl/t1_lib.c patches/Fix_OPENSSL_NO_SHA512$(OPENSSL_VER).patch
build_openssl:
@echo "Building OpenSSL"
make -w -C $(OPENSSL)
install_openssl: #Note this is hacked to copy over working OpenSSL include dir
mkdir -p ${CWD}/install_dir/install_dir
make -w -C $(OPENSSL) install
rm -f ${CWD}/install_dir/install_dir/openssl.cnf
ln -s ${CWD}/openssl.cnf ${CWD}/install_dir/install_dir/openssl.cnf
clean_openssl:
- make -w -C $(OPENSSL) $(OPENSSL_VER)=$(OPENSSL_VER) clean
dclean_openssl:
- make -w -C $(OPENSSL) dclean
test_openssl:
make -w -C $(OPENSSL) test
init_submodule:
@echo "initializing submodules"
-git submodule init
-git submodule update
@echo "completed submodule init"
#OpenSSL main branch
tgt_openssl_main:
@echo "Cloning OpenSSL from main"
- git clone https://github.com/openssl/openssl.git openssl_main
make -w OPENSSL_VER=_main HW='$(HW)' CFLAGS_EXT='-DOPENSSL_DEVEL'
# ENGINE_ATECC
build_engine_atecc:
make -w -C engine_atecc OPENSSL_VER=$(OPENSSL_VER) HW='$(HW)' CFLAGS_EXT='$(CFLAGS_EXT)' gnu
clean_engine_atecc:
make -w -C engine_atecc clean
install_engine_atecc:
make -w -C engine_atecc install
# TLS demo client/server
tgt_tlsdemo:
make -w -C client-server OPENSSL_VER=$(OPENSSL_VER) HW='$(HW)'
clean_tlsdemo:
make -w -C client-server clean