Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / mbedtls / repo / tests / data_files / dir-maxpath / long.sh
1 #!/bin/sh
2
3 set -eu
4
5 : ${OPENSSL:=openssl}
6 NB=20
7
8 OPT="-days 3653 -sha256"
9
10 # generate self-signed root
11 $OPENSSL ecparam -name prime256v1 -genkey -out 00.key
12 $OPENSSL req -new -x509 -subj "/C=UK/O=mbed TLS/CN=CA00" $OPT \
13              -key 00.key -out 00.crt
14
15 # cXX.pem is the chain starting at XX
16 cp 00.crt c00.pem
17
18 # generate long chain
19 i=1
20 while [ $i -le $NB ]; do
21     UP=$( printf "%02d" $((i-1)) )
22     ME=$( printf "%02d" $i )
23
24     $OPENSSL ecparam -name prime256v1 -genkey -out ${ME}.key
25     $OPENSSL req -new -subj "/C=UK/O=mbed TLS/CN=CA${ME}" \
26                  -key ${ME}.key -out ${ME}.csr
27     $OPENSSL x509 -req -CA ${UP}.crt -CAkey ${UP}.key -set_serial 1 $OPT \
28                   -extfile int.opensslconf -extensions int \
29                   -in ${ME}.csr -out ${ME}.crt
30
31     cat ${ME}.crt c${UP}.pem > c${ME}.pem
32
33     rm ${ME}.csr
34     i=$((i+1))
35 done