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

[features] cycle counter instrumented library #10

Open
enrikb opened this issue Oct 27, 2020 · 1 comment
Open

[features] cycle counter instrumented library #10

enrikb opened this issue Oct 27, 2020 · 1 comment

Comments

@enrikb
Copy link
Contributor

enrikb commented Oct 27, 2020

Even though QEMU does not implement the cortex M4 DWT cycle counter, real hardware often does.
I have successfully tested the commented out cycle counter code from qemu-test on a real STM32F411 board. Of course, the cycle count for sign() is not constant, as the message length varies.
So, now it would be nice to have a feature in salty to enable cycle counting in 'the right places'.
As a starting point, dedicated tests for low level calls would be fine, too.

** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
enabled cycle counter
keypair.sign took 5539346 cycles
keypair.sign took 5539196 cycles
keypair.sign took 5539230 cycles
keypair.sign took 5539254 cycles
keypair.sign took 5873812 cycles
keypair.sign took 5564848 cycles
All tests passed, including RFC 8032 test vectors!

(As a quick test, I wrapped all regular sign() calls with the counting code.)

@nickray
Copy link
Member

nickray commented Oct 28, 2020

There's also the problem of caches, e.g. try and time signing the same message twice.

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

No branches or pull requests

2 participants