forked from Infineon/linux-optiga-trust-m
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotected_update_ecc_step2.sh
35 lines (25 loc) · 1.55 KB
/
protected_update_ecc_step2.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
#!/bin/bash
source config.sh
#### Configurable Variables Start
## Target OID for ECC Key protected update, manifest and final fragment
# Target OID
TARGET_OID=e0f1
# Sample Manifest and Fragment int-E0E8, Conf-F1D4, Ver=03, Target OID = E0F1 used for data protected update
MANIFEST="8443A10126A10442E0E8589C8601F6F68422186603820310828220582582182958201C337C807648D4ADC4CD15B1C7F6F7B0E0824899DD0A106489D0E3AF8E02804382018343A1010A81825854A30442F1D4013A000100B70582447465737458405095AA49287E21357E4CDD4D11FB59355945EDEB7C2D5C1220996495C6EDCB0E3FFD8DECDF2C82549939B7CEB26D5A801704FB7FDD219C16806143E88236E87DF6F6824042E0F15840872952130C10E0265EA1B3EA4E75CBE216F74A2410FC51E6B4DDABBD14746A0395BD86F120D4577629335D73D6E7030294F2573B520ED1F62702D032774FC5AF"
FINAL_FRAGMENT="C34D379891E9D307E88CE57BF5E6E53DEE2BC1E9B38E51F5FCABB37FC6169F2CDAAC7D724A4B8257C84C047AC0080A399E2BA4A07E697C6F4945CA2C22CC5F680DFD2069C521F65986E3A830D334B7110FC53436C414DE2CFB6DA418DC6507AC862C9DDB59497FB01A686C7BDCE5"
#### Configurable Variables End
# Perform multiple sequential read
echo "Prepare binary shared secret."
echo $MANIFEST | xxd -r -p > manifestecc.dat
#~ xxd manifest.dat
echo "Prepare binary data to be init."
echo $FINAL_FRAGMENT | xxd -r -p > final_fragment_ecc.dat
#~ xxd final_fragment.dat
for i in $(seq 1 1); do
echo "test $i"
echo "Protected ECC Key Update for 0x$TARGET_OID"
$EXEPATH/trustm_protected_update_ecckey -k 0x$TARGET_OID -m manifestecc.dat -f final_fragment_ecc.dat
echo "read out metadata for 0x$TARGET_OID"
$EXEPATH/trustm_metadata -r 0x$TARGET_OID -X
sleep 1
done