1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 12:00:59 +00:00

add set -e to shell scripts

This commit is contained in:
Pavol Rusnak 2016-07-03 13:53:20 +02:00
parent fdbae0b0e0
commit 3ce756b692
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
set -e
IMAGETAG=trezor-mcu-build IMAGETAG=trezor-mcu-build
FIRMWARETAG=${1:-master} FIRMWARETAG=${1:-master}

View File

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
set -e
IMAGETAG=trezor-mcu-build IMAGETAG=trezor-mcu-build
FIRMWARETAG=${1:-master} FIRMWARETAG=${1:-master}

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "Please provide filename as argument" echo "Please provide filename as argument"

9
firmware/u2f/genkeys.sh Normal file → Executable file
View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
cat > u2f_keys.h <<EOF cat > u2f_keys.h <<EOF
#ifndef __U2F_KEYS_H_INCLUDED__ #ifndef __U2F_KEYS_H_INCLUDED__
@ -13,13 +14,13 @@ if [ \! -e trezordevkey.pem ]; then
openssl ecparam -genkey -out trezordevkey.pem -name prime256v1 openssl ecparam -genkey -out trezordevkey.pem -name prime256v1
fi fi
openssl ec -in trezordevkey.pem -text | openssl ec -in trezordevkey.pem -text |
perl -e '$key = "\t"; while (<>) { perl -e '$key = "\t"; while (<>) {
if (/priv:/) { $priv = 1 } if (/priv:/) { $priv = 1 }
elsif (/pub:/) { $priv = 0 } elsif (/pub:/) { $priv = 0 }
elsif ($priv) { elsif ($priv) {
while ($_ =~ s/.*?([0-9a-f]{2})//) { while ($_ =~ s/.*?([0-9a-f]{2})//) {
$key .= "0x$1,"; $key .= "0x$1,";
if ($num++ % 8 == 7) { $key .= "\n\t"; } if ($num++ % 8 == 7) { $key .= "\n\t"; }
else {$key .= " ";} else {$key .= " ";}
} }
} }
@ -32,7 +33,7 @@ cat >> u2f_keys.h <<EOF
const uint8_t U2F_ATT_CERT[] = { const uint8_t U2F_ATT_CERT[] = {
EOF EOF
openssl req -new -key trezordevkey.pem -out trezordevcert.req -subj "/CN=Trezor U2F" openssl req -new -key trezordevkey.pem -out trezordevcert.req -subj "/CN=Trezor U2F"
openssl x509 -req -in trezordevcert.req -signkey trezordevkey.pem -days 3650 -out trezordevcert.pem openssl x509 -req -in trezordevcert.req -signkey trezordevkey.pem -days 3650 -out trezordevcert.pem
openssl x509 -in trezordevcert.pem -outform der | od -tx1 -w12 -Anone | perl -pe 's/ ([0-9a-f]{2})/ 0x$1,/g; $_ =~ s/^ /\t/;' >> u2f_keys.h openssl x509 -in trezordevcert.pem -outform der | od -tx1 -w12 -Anone | perl -pe 's/ ([0-9a-f]{2})/ 0x$1,/g; $_ =~ s/^ /\t/;' >> u2f_keys.h