-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathprotected_update_rsa_step2.sh
37 lines (26 loc) · 1.91 KB
/
protected_update_rsa_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
36
37
#!/bin/bash
source config.sh
#### Configurable Variables Start
## Target OID for metadata protected update, manifest and final fragment
# Target OID
TARGET_OID=e0fc
# Manifest used for metadata protected update (To Creation)
# Sample manifest and fragment for int-E0E8 conf-F1D4 ver=03 tested on psoc62
MANIFEST="8443A10126A10442E0E8589E8601F6F6842219010D03821841128282205825821829582042BC68B42F712DB27FF63064FB4B585F0012E0C59EAFF271AB6EE52B54DF9EC282018343A1010A81825854A30442F1D4013A000100B7058244746573745840EFED5B9D6DE6BBC577B082EF4D83C92931B089C4E2659A67BE844E14205B93798CAE77020D205BB87AC6E7B96D27D70CCB36988B6E41670E969FD8F2D28C0A72F6F6824042E0FC5840301D796B5A04C7D3AB9B92C833D62E6F7A0A1DD05EB31DDD6C630F629CCB04009F740C9925DD28040A6184DD4B65EF371D48209E5AD9FE273EFAEEA26FE332F4"
FINAL_FRAGMENT="75AD1023D2162CD6D8B8E1295545410613CD96AB8BFA1D443B7DACAECB1F82C5EAA379A2F1F2C1E056C7F7519F9FDE861EDDC0E4B741A7D7262F6DA769F0F5D078197B404ED49EC51EAAF3EA7ECAAAB7EF2115E59E9BDC1BB9A72B0F5004E49CEADC9635FFF656DD1D879C915D5809FA3BB0D94B083E69A18B535FB429202A1AD777AB26E801C16257B0A13B88C69053E538E2B25F3609A4F11A95D0CEB33CBA473BD122EB5FA9B1C24E1DFEAA6FE13D498E7BD571948E61597AE0D82CD785EC0F9F82F2E2EF638717D43A9378154107A22A77180535D4D364D4FB1BFB76208419E2B6323C46898B598ECD7E32E03772619A75FAC3708FF5178F7F492B6A16D94DBA832D22259BABDD48B2B0BE2351B84C9EAD430E"
#### Configurable Variables End
# Perform multiple sequential read
echo "Prepare binary shared secret."
echo $MANIFEST | xxd -r -p > manifest_rsa.dat
xxd manifest.dat
echo "Prepare binary data to be init."
echo $FINAL_FRAGMENT | xxd -r -p > final_fragment_rsa.dat
xxd final_fragment.dat
for i in $(seq 1 1); do
echo "test $i"
echo "Protected RSA Key Update for 0x$TARGET_OID"
$EXEPATH/trustm_protected_update_rsakey -k 0x$TARGET_OID -m manifest_rsa.dat -f final_fragment_rsa.dat
echo "read out metadata for 0x$TARGET_OID"
$EXEPATH/trustm_metadata -r 0x$TARGET_OID -X
sleep 1
done