Skip to content

[features] cycle counter instrumented library #10

@enrikb

Description

@enrikb

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions