Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SecAESSTM32 causes exceptions with default addresses #56

Closed
schaefflerf opened this issue Nov 15, 2023 · 1 comment · Fixed by #57
Closed

SecAESSTM32 causes exceptions with default addresses #56

schaefflerf opened this issue Nov 15, 2023 · 1 comment · Fixed by #57

Comments

@schaefflerf
Copy link

The default settings of SecAESSTM32/go.py causes following exception:

8000482 add r3, pc ;
8000484 ldr r2, [r3, r2] ;
8000486 ldr r3, [r2] ;Traceback (most recent call last):
File "/home/user/.local/lib/python3.10/site-packages/rainbow/rainbow.py", line 275, in start
self.emu.emu_start(begin, end, timeout=timeout, count=count)
File "/home/user/.local/lib/python3.10/site-packages/unicorn/unicorn.py", line 547, in emu_start
raise UcError(status)
unicorn.unicorn.UcError: Invalid memory read (UC_ERR_READ_UNMAPPED)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/mnt/c/Users/user/Desktop/rainbow/rainbow/examples/SecAESSTM32/go.py", line 76, in
f_aes(e, key, randbytes(16))
File "/mnt/c/Users/user/Desktop/rainbow/rainbow/examples/SecAESSTM32/go.py", line 47, in f_aes
e.start(e.functions['aes'] | 1, 0)
File "/home/user/.local/lib/python3.10/site-packages/rainbow/generics/arm.py", line 47, in start
return super().start(begin | self.thumb_bit, *args, **kwargs)
File "/home/userr/.local/lib/python3.10/site-packages/rainbow/rainbow.py", line 279, in start
raise RuntimeError(f"Emulation crashed at 0x{pc:X}") from e
RuntimeError: Emulation crashed at 0x8000486

Changing key_p = 0xcafe1000 for example to key_p =0x8001165 fixes the problem and the GUI runs. But i guess it is still not the expected output.

Output after fix:
(more output above...)
80012E2 mov r0, r5 ;
80012E4 add sp, #0x24 ;
80012E6 pop.w {r4, r5, r6, r7, r8, sb, sl, fp, pc};ERROR !
Nope :
b'00000000000000000000000000000000'
b'cfc7b7a45573d5b37f691be60a8a9c72'
WARNING: could not determine DPI

If you can help me out i would appreciate it!

Greetings

@yhql
Copy link
Collaborator

yhql commented Nov 15, 2023

Hello and thanks for reporting all these, now #57 should explain the problem and fix it

@yhql yhql closed this as completed in #57 Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants