mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 07:54:27 +01:00
Merge pull request #5744 from mpg/benchmark-ecc-heap-2.28
[backport 2.28] Improve benchmarking of ECC heap usage
This commit is contained in:
commit
8e9e1f6819
@ -152,11 +152,12 @@ do { \
|
|||||||
* Updated manually as the output of the following command:
|
* Updated manually as the output of the following command:
|
||||||
*
|
*
|
||||||
* sed -n 's/.*[T]IME_PUBLIC.*"\(.*\)",/\1/p' programs/test/benchmark.c |
|
* sed -n 's/.*[T]IME_PUBLIC.*"\(.*\)",/\1/p' programs/test/benchmark.c |
|
||||||
* awk '{print length+2}' | sort -rn | head -n1
|
* awk '{print length+3}' | sort -rn | head -n1
|
||||||
*
|
*
|
||||||
* This computes the maximum length of a title +2 (because we appends "/s").
|
* This computes the maximum length of a title +3, because we appends "/s" and
|
||||||
* (If the value is too small, the only consequence is poor alignement.) */
|
* want at least one space. (If the value is too small, the only consequence
|
||||||
#define TITLE_SPACE 16
|
* is poor alignement.) */
|
||||||
|
#define TITLE_SPACE 17
|
||||||
|
|
||||||
#define MEMORY_MEASURE_INIT \
|
#define MEMORY_MEASURE_INIT \
|
||||||
size_t max_used, max_blocks, max_bytes; \
|
size_t max_used, max_blocks, max_bytes; \
|
||||||
|
@ -54,32 +54,45 @@ cat << EOF >$CONFIG_H
|
|||||||
|
|
||||||
#define MBEDTLS_BIGNUM_C
|
#define MBEDTLS_BIGNUM_C
|
||||||
#define MBEDTLS_ECP_C
|
#define MBEDTLS_ECP_C
|
||||||
|
#define MBEDTLS_ECP_NO_INTERNAL_RNG
|
||||||
#define MBEDTLS_ASN1_PARSE_C
|
#define MBEDTLS_ASN1_PARSE_C
|
||||||
#define MBEDTLS_ASN1_WRITE_C
|
#define MBEDTLS_ASN1_WRITE_C
|
||||||
#define MBEDTLS_ECDSA_C
|
#define MBEDTLS_ECDSA_C
|
||||||
|
#define MBEDTLS_SHA256_C // ECDSA benchmark needs it
|
||||||
|
#define MBEDTLS_SHA224_C // SHA256 requires this for now
|
||||||
#define MBEDTLS_ECDH_C
|
#define MBEDTLS_ECDH_C
|
||||||
|
|
||||||
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
|
// NIST curves >= 256 bits
|
||||||
#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
|
|
||||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||||
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
||||||
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
|
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
|
||||||
|
// SECP "koblitz-like" curve >= 256 bits
|
||||||
|
#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
|
||||||
|
// Brainpool curves (no specialised "mod p" routine)
|
||||||
|
#define MBEDTLS_ECP_DP_BP256R1_ENABLED
|
||||||
|
#define MBEDTLS_ECP_DP_BP384R1_ENABLED
|
||||||
|
#define MBEDTLS_ECP_DP_BP512R1_ENABLED
|
||||||
|
// Montgomery curves
|
||||||
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
|
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
|
||||||
|
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
|
||||||
|
|
||||||
#include "check_config.h"
|
#include "check_config.h"
|
||||||
|
|
||||||
//#define MBEDTLS_ECP_WINDOW_SIZE 6
|
#define MBEDTLS_HAVE_ASM // just make things a bit faster
|
||||||
|
#define MBEDTLS_ECP_NIST_OPTIM // faster and less allocations
|
||||||
|
|
||||||
|
//#define MBEDTLS_ECP_WINDOW_SIZE 4
|
||||||
//#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1
|
//#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
for F in 0 1; do
|
for F in 0 1; do
|
||||||
for W in 2 3 4 5 6; do
|
for W in 2 3 4; do
|
||||||
scripts/config.py set MBEDTLS_ECP_WINDOW_SIZE $W
|
scripts/config.py set MBEDTLS_ECP_WINDOW_SIZE $W
|
||||||
scripts/config.py set MBEDTLS_ECP_FIXED_POINT_OPTIM $F
|
scripts/config.py set MBEDTLS_ECP_FIXED_POINT_OPTIM $F
|
||||||
make benchmark >/dev/null 2>&1
|
make benchmark >/dev/null 2>&1
|
||||||
echo "fixed point optim = $F, max window size = $W"
|
echo "fixed point optim = $F, max window size = $W"
|
||||||
echo "--------------------------------------------"
|
echo "--------------------------------------------"
|
||||||
programs/test/benchmark
|
programs/test/benchmark ecdh ecdsa
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user