-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
518909e
commit 5c08f71
Showing
6 changed files
with
128 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash | ||
# | ||
function run_on_board() { | ||
# GPIO2: RST | ||
# GPIO3: BOOT (input) | ||
|
||
if ! (st-flash reset &>/dev/null); then | ||
echo -n "No data." | ||
else | ||
echo "2" > /sys/class/gpio/export | ||
echo "3" > /sys/class/gpio/export | ||
echo "out" > /sys/class/gpio/gpio2/direction | ||
echo "in" > /sys/class/gpio/gpio3/direction | ||
echo "1" > /sys/class/gpio/gpio2/value # Release reset | ||
sleep .2 | ||
st-flash --connect-under-reset write factory.bin 0x8000000 | ||
echo "0" > /sys/class/gpio/gpio0/value # Keep reset low | ||
sleep 1 | ||
echo "1" > /sys/class/gpio/gpio0/value # Release reset | ||
time $(while grep "0" /sys/class/gpio/gpio3/value; do true; done) | ||
fi | ||
} | ||
|
||
function set_benchmark { | ||
NAME=$1 | ||
shift | ||
CONFIG=$@ | ||
make clean &>/dev/null | ||
make distclean &>/dev/null | ||
make keysclean &>/dev/null | ||
make $@ &>/dev/null | ||
make $@ stack-usage &>/dev/null | ||
make $@ image-header-size &>/dev/null | ||
# Name | ||
echo -n "| " | ||
echo -n $NAME | ||
echo -n " | " | ||
# Configuration | ||
echo -n $CONFIG | tr -d '\n' | ||
echo -n " | " | ||
# Bootloader size | ||
echo -n `ls -l wolfboot.bin | cut -d " " -f 5 | tr -d '\n'` | ||
echo -n " | " | ||
# Stack size | ||
cat .stack_usage | tr -d '\n' | ||
echo -n " | " | ||
# Image header size | ||
cat .image_header_size | tr -d '\n' | ||
echo -n " | " | ||
# Boot time | ||
run_on_board 2>&1 | ||
echo " |" | ||
} | ||
|
||
# Output benchmark results in a Markdown table | ||
echo "| Name | Configuration | Bootloader size | Stack size | Image header size | Boot time |" | ||
echo "|------|---------------|-----------------|------------|-------------------|-----------|" | ||
|
||
set_benchmark "no sign" SIGN=NONE | ||
set_benchmark "ed25519 with sha384, small" SIGN=ED25519 HASH=SHA384 NO_ASM=1 | ||
set_benchmark "ed25519 with sha384" SIGN=ED25519 HASH=SHA384 | ||
set_benchmark "ed25519 fast" SIGN=ED25519 NO_ASM=0 | ||
set_benchmark "ed25519 small" SIGN=ED25519 NO_ASM=1 | ||
set_benchmark "LMS 1-10-8" SIGN=LMS LMS_LEVELS=1 LMS_HEIGHT=10 LMS_WINTERNITZ=8 IMAGE_HEADER_SIZE=4096 IMAGE_SIGNATURE_SIZE=1456 | ||
set_benchmark "ed448" SIGN=ED448 | ||
set_benchmark "ecdsa384 with sha384" SIGN=ECC384 HASH=SHA384 | ||
set_benchmark "rsa2048" SIGN=RSA2048 | ||
set_benchmark "rsa3072" SIGN=RSA3072 | ||
set_benchmark "rsa4096" SIGN=RSA4096 | ||
set_benchmark "ecdsa256" SIGN=ECC256 | ||
set_benchmark "ecdsa256, no asm" SIGN=ECC256 NO_ASM=1 | ||
set_benchmark "ecdsa384" SIGN=ECC384 | ||
set_benchmark "ecdsa384, no asm" SIGN=ECC384 NO_ASM=1 | ||
set_benchmark "ecdsa521" SIGN=ECC521 | ||
set_benchmark "ecdsa521, no asm" SIGN=ECC521 NO_ASM=1 | ||
|