generated from ThalesGroup/template-project
-
Notifications
You must be signed in to change notification settings - Fork 1
/
package.sh
executable file
·282 lines (239 loc) · 8.39 KB
/
package.sh
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#!/bin/sh
##############################################################################
#
# This file is part of the "Luna OpenSSL for PQC" project.
#
# The " Luna OpenSSL for PQC " project is provided under the MIT license (see the
# following Web site for further details: https://mit-license.org/ ).
#
# Copyright © 2024 Thales Group
#
##############################################################################
#
# Description: Script to create a tar ball to be sent to customers
#
# as of openssl3, stop supporting 1.0.2
# as of openssl 3.2.1, stop supporting 32-bit
PACKAGE=package
VERSION=$(cat VERSION)
GEMENGINE=$PACKAGE/gemengine-$VERSION
SAMPLES=gem-samples
WIN_OPENSSL_VERSION=1.1.1w
WIN_OPENSSL_VERSION_2=3.2.1
# package the provider code when it is ready for GA
WANT_PROVIDER="1"
# option "--source-only" creates a package with source code only
# meaning binaries are empty directories/files
SOURCE_ONLY="0"
if [ ! "$1" = "" ] ; then
if [ "$1" = "--source-only" ] ; then
SOURCE_ONLY="1"
else
echo "ERROR: unknown option $1"
exit 1
fi
fi
echo "SOURCE_ONLY = $SOURCE_ONLY"
ginstall()
{
echo "install $@"
install "$@"
if [ $? -ne 0 ]; then
echo "ERROR: unable to create package!"
exit 1
fi
}
if [ -f "$PACKAGE/gemengine-$VERSION.tar.gz" ]; then
rm "$PACKAGE/gemengine-$VERSION.tar.gz"
if [ -f "$PACKAGE/gemengine-$VERSION.tar.gz" ]; then
echo "ERROR: Failed to remove older $PACKAGE/gemengine-$VERSION.tar.gz"
exit
fi
fi
if [ -d "$PACKAGE" ]; then
rm -rf $PACKAGE
if [ $? -ne 0 ]; then
echo "ERROR: Unable to clean $PACKAGE."
exit 1
fi
fi
mkdir -p -m 775 $GEMENGINE
#Install VERSION file
ginstall -o root -g root -m 0444 VERSION $GEMENGINE/VERSION
#Install the engine
mkdir -p -m 775 $GEMENGINE/engine
for file in e_gem.c e_gem.h e_gem.ec e_gem_err.c e_gem_err.h e_gem_compat.c e_gem_compat.h engine.mak makefile.in gem.def ; do
ginstall -o root -g root -m 0644 engine/$file $GEMENGINE/engine
done
ginstall -o root -g root -m 0755 engine/configure $GEMENGINE/engine
#Install the lunaProvider
if [ "$WANT_PROVIDER" = "1" ]; then
mkdir -p -m 775 $GEMENGINE/lunaProvider/include/pkcs11
mkdir -p -m 775 $GEMENGINE/lunaProvider/oqsprov2
LUNAPROV_FILES="include/pkcs11/pkcs11.h \
include/pkcs11/pkcs11f.h \
include/pkcs11/pkcs11t.h \
lunaPqcKem.c \
lunaPqcSig.c \
lunaProvider.c \
lunaRsaEnc.c \
lunaRsaGen.c \
lunaRsaSig.c \
luna_prov_minimal.h \
lunaDsaSig.c \
lunaprov.def \
oqsprov2/LICENSE-oqsprov.txt \
oqsprov2/oqs_decode_der2key.c \
oqsprov2/oqs_encode_key2any.c \
oqsprov2/oqs_endecoder_common.c \
oqsprov2/oqs_endecoder_local.h \
oqsprov2/oqs_kmgmt.c \
oqsprov2/oqsdecoders.inc \
oqsprov2/oqsencoders.inc \
oqsprov2/oqsprov.c \
oqsprov2/oqsprov_bio.c \
oqsprov2/oqsprov_keys.c \
oqsprov2/oqs_sig.c \
oqsprov2/oqsprov_capabilities.c \
oqsprov2/oqs_kem.c \
oqsprov2/oqs_prov.h \
pqcdefs.h \
lunaCommon.h \
provider.mak \
lunaDsaGen.c \
lunaEcGen.c \
lunaEcdh.c \
lunaEcx.c \
lunaEcxGen.c \
lunaEddsaSig.c \
lunaEcSig.c \
makefile.in \
lunaCommon.c \
lunaprov_deps.c \
lunaprov_deps.def \
lunaFileStore.h \
lunaFileAny2obj.c \
lunaFileStore.c"
for file in $LUNAPROV_FILES ; do
ginstall -o root -g root -m 0644 lunaProvider/$file $GEMENGINE/lunaProvider/$file
done
ginstall -o root -g root -m 0755 lunaProvider/configure $GEMENGINE/lunaProvider
mkdir -p -m 775 $GEMENGINE/tests/
TESTS_FILES="tmpdsaparam.pem \
t_openssl_common.include \
t_openssl_dsa.makefile \
t_openssl_ec.makefile \
t_openssl_ed.makefile \
t_openssl_pqc.makefile \
t_openssl_rsa.makefile \
ext_ca.cnf \
ext_root.cnf \
ext_server.cnf \
ext_client_ca.cnf \
ext_client.cnf \
message20.txt \
message32.txt \
message48.txt \
message64.txt \
t_openssl_tls.makefile \
t_openssl_suite1.makefile"
for file in $TESTS_FILES ; do
ginstall -o root -g root -m 0644 tests/$file $GEMENGINE/tests/$file
done
fi
#Install builds
for flavour in rhel ; do
for bits in 64; do
for stream in 3.2 1.1.1 ; do
target=$flavour/$bits/$stream
if [ ! "$SOURCE_ONLY" = "1" ] ; then
mkdir -p -m 775 $GEMENGINE/builds/linux/$target
if [ "$stream" = "1.0.2" ]; then
ginstall -o root -g root -m 0755 builds/linux/$target/libgem.so $GEMENGINE/builds/linux/$target
fi
if [ "$stream" = "1.1.1" ]; then
ginstall -o root -g root -m 0755 builds/linux/$target/gem.so $GEMENGINE/builds/linux/$target
fi
# NOTE: stream 3.0 implies provider added, 3.2 implies pqc added
if [ "$stream" = "3.0" -o "$stream" = "3.2" ]; then
ginstall -o root -g root -m 0755 builds/linux/$target/gem.so $GEMENGINE/builds/linux/$target
if [ "$WANT_PROVIDER" = "1" ]; then
ginstall -o root -g root -m 0755 builds/linux/$target/lunaprov.so $GEMENGINE/builds/linux/$target
fi
fi
ginstall -o root -g root -m 0755 builds/linux/$target/sautil $GEMENGINE/builds/linux/$target
fi
done
done
done
#install gembuild
ginstall -o root -g root -m 0755 gembuild $GEMENGINE/
#Install windows make files:
ginstall -o root -g root -m 0755 obuild8.makefile $GEMENGINE
#obsolete:ginstall -o root -g root -m 0755 obuild8-fips.makefile $GEMENGINE
ginstall -o root -g root -m 0755 obuild8-ossl3.makefile $GEMENGINE
ginstall -o root -g root -m 0644 win-cl-ssl.mk $GEMENGINE
#Install sautil
mkdir -p -m 775 $GEMENGINE/$SAMPLES/sautil
for file in makefile sautil sautil.c sautil.h sautil.mak; do
ginstall -o root -g root -m 0644 $SAMPLES/sautil/$file $GEMENGINE/$SAMPLES/sautil
done
ginstall -o root -g root -m 0644 engine/e_gem.h $GEMENGINE/$SAMPLES/sautil
ginstall -o root -g root -m 0755 $SAMPLES/sautil/configure.sh $GEMENGINE/$SAMPLES/sautil
#Install engineperf
mkdir -p -m 775 $GEMENGINE/$SAMPLES/engineperf
for file in engineperf.c engineperf.h engineperf.mak engineperf-test.bat engineperf-test.sh makefile; do
ginstall -o root -g root -m 0644 $SAMPLES/engineperf/$file $GEMENGINE/$SAMPLES/engineperf
done
ginstall -o root -g root -m 0644 engine/e_gem.h $GEMENGINE/$SAMPLES/engineperf
ginstall -o root -g root -m 0755 $SAMPLES/engineperf/configure.sh $GEMENGINE/$SAMPLES/engineperf
mkdir -p -m 775 $GEMENGINE/$SAMPLES/passdll
for file in makefile sample_passdll.c sample_passdll.def sample_passdll.mak; do
ginstall -o root -g root -m 0644 $SAMPLES/passdll/$file $GEMENGINE/$SAMPLES/passdll
done
ginstall -o root -g root -m 0644 engine/e_gem.h $GEMENGINE/$SAMPLES/passdll
ginstall -o root -g root -m 0755 $SAMPLES/passdll/configure.sh $GEMENGINE/$SAMPLES/passdll
#Install github licence files
for file in CONTRIBUTING.md LICENSE README.md SECURITY.md LICENCE-FOR-OPENSSL.txt ; do
ginstall -o root -g root -m 0644 $file $GEMENGINE
done
#Install coverity related files
for file in build.sh generate.sh ; do
ginstall -o root -g root -m 0755 $file $GEMENGINE
done
# obsolete: README-KEYSECURE
for file in README-GEMBUILD README-GEM-CONFIG README-OPENSSL-CONFIG README-CMS README-DSA README-ECDSA README-RSA README-ENGINEPERF README-OBUILD README-OPENSSH README-PASSDLL README-SAUTIL README-APACHE README-BIND ; do
ginstall -o root -g root -m 0644 docs/$file $GEMENGINE/docs
done
for file in README-PQC README-PQC-BUILD README-PQC-CONFIG ; do
ginstall -o root -g root -m 0644 docs/$file $GEMENGINE/docs
done
#Install windows binaries
if [ ! "$SOURCE_ONLY" = "1" ] ; then
mkdir -p -m 775 $GEMENGINE/builds/win
for bus in 64; do
ginstall -o root -g root -m 0644 LUNAlocal/sautil-win${bus}-openssl-${WIN_OPENSSL_VERSION}.tar.gz $GEMENGINE/builds/win
ginstall -o root -g root -m 0644 LUNAlocal/ssl-win${bus}-openssl-${WIN_OPENSSL_VERSION}.tar.gz $GEMENGINE/builds/win
ginstall -o root -g root -m 0644 LUNAlocal/sautil-win${bus}-openssl-${WIN_OPENSSL_VERSION_2}.tar.gz $GEMENGINE/builds/win
ginstall -o root -g root -m 0644 LUNAlocal/ssl-win${bus}-openssl-${WIN_OPENSSL_VERSION_2}.tar.gz $GEMENGINE/builds/win
done
fi
#mkdir -p -m 775 $GEMENGINE/keysecure
#ginstall -o root -g root -m 0644 keysecure/GemKS_setup.sh $GEMENGINE/keysecure
#ginstall -o root -g root -m 0644 keysecure/GemKS.properties $GEMENGINE/keysecure
#Install apache
mkdir -p -m 775 $GEMENGINE/apache
ginstall -o root -g root -m 0644 apache/*.conf $GEMENGINE/apache/
ginstall -o root -g root -m 0755 Optimize.sh $GEMENGINE
#Install dnssec
mkdir -p -m 775 $GEMENGINE/dnssec
ginstall -o root -g root -m 0755 dnssec/* $GEMENGINE/dnssec/
cd $PACKAGE
tar cvfz "gemengine-$VERSION.tar.gz" "gemengine-$VERSION"
if [ ! -f "gemengine-$VERSION.tar.gz" ]; then
echo "ERROR: Failed to generate newer gemengine-$VERSION.tar.gz"
exit
fi
echo
echo "Generated $GEMENGINE.tar.gz."
echo