Skip to content

Commit e610950

Browse files
author
lolololol
committed
updated emu_load
1 parent 6695e31 commit e610950

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

experiments/teacup/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# teacup
22

33
Camellia sinensis is a species of evergreen shrub or small tree in the flowering plant family Theaceae. Its leaves and leaf buds are used to produce the popular beverage tea. Common names include tea plant, tea shrub, and tea tree (unrelated to Melaleuca alternifolia, the source of tea tree oil, or the genus Leptospermum commonly called tea tree).
4+
5+
arm-none-eabi-gcc -nostdlib -o hello.elf hello.c

experiments/teacup/earlgrey/emu_loader.py renamed to experiments/teacup/emu_loader.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import sparkgap.filemanager
55
import sys
66
import rainbow
7+
from rainbow import HammingWeight,TraceConfig
78
from rainbow.generics import rainbow_arm
8-
from rainbow.utils import hw
99
import numpy as np
1010
import gc
1111
import random
@@ -17,19 +17,19 @@
1717

1818
cs = None
1919

20-
KEY_ADDR = 0x18904
21-
DATA_ADDR = 0x188fc
20+
KEY_ADDR = 0x92dc
21+
DATA_ADDR = 0x92d4
2222

2323
for i in range(0,50):
2424
# print("Emulating run %d..." % i)
25-
emu = rainbow_arm(sca_mode=True)
25+
emu = rainbow_arm(trace_config=TraceConfig(register=HammingWeight()))
2626
emu.load(sys.argv[1])
2727
rand_input = np.array([random.randint(0,0xFF) for i in range(0,8)],dtype=np.uint8)
2828
emu[DATA_ADDR] = bytes(rand_input[0:4])
2929
emu[DATA_ADDR + 4] = bytes(rand_input[4:8])
30-
emu.start(emu.functions["doXTEA"] , 0x84c8)
31-
new_trace = np.fromiter(map(hw, emu.sca_values_trace),dtype=np.float32)
32-
rand_output = emu[0x18d64:0x18d64+8]
30+
emu.start(emu.functions["doXTEA"] , 0x82a8)
31+
new_trace = np.fromiter(map(lambda event: event["register"], emu.trace),dtype=np.float32)
32+
rand_output = emu[0x92ec:0x92ec+8]
3333
if cs is None:
3434
cs = sparkgap.filemanager.CaptureSet(tracecount=50,samplecount=len(new_trace),in_len=8,out_len=8)
3535
cs.addTrace(new_trace,rand_input,rand_output)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)