mbedtls/library
Manuel Pégourié-Gonnard 8c76a9489e aria: turn macro into static inline function
Besides documenting types better and so on, this give the compiler more room
to optimise either for size or performance.

Here are some before/after measurements of:
- size of aria.o in bytes (less is better)
- instruction count for the selftest function (less is better)
with various -O flags.

Before:
O	aria.o	ins
s	10896	37,256
2	11176	37,199
3	12248	27,752

After:
O	aria.o	ins
s	8784	41,408
2	11112	37,001
3	13096	27,438

The new version allows the compiler to reach smaller size with -Os while
maintaining (actually slightly improving) performance with -O2 and -O3.

Measurements were done on x86_64 (but since this is mainly about inlining
code, this should transpose well to other platforms) using the following
helper program and script, after disabling CBC, CFB and CTR in config.h, in
order to focus on the core functions.

==> st.c <==
 #include "mbedtls/aria.h"

int main( void ) {
    return mbedtls_aria_self_test( 0 );
}

==> p.sh <==
 #!/bin/sh

set -eu

ccount () {
    (
    valgrind --tool=callgrind --dump-line=no --callgrind-out-file=/dev/null --collect-atstart=no --toggle-collect=main $1
    ) 2>&1 | sed -n -e 's/.*refs: *\([0-9,]*\)/\1/p'
}

printf "O\taria.o\tins\n"
for O in s 2 3; do
    GCC="gcc -Wall -Wextra -Werror -Iinclude"

    $GCC -O$O -c library/aria.c
    $GCC -O1 st.c aria.o -o st
   ./st

    SIZE=$( du -b aria.o | cut -f1 )
    INS=$( ccount ./st )

    printf "$O\t$SIZE\t$INS\n"
done
2018-02-27 12:39:12 +01:00
..
.gitignore
aes.c Merge remote-tracking branch 'upstream-public/pr/964' into development 2018-01-02 16:24:29 +01:00
aesni.c
arc4.c
aria.c aria: turn macro into static inline function 2018-02-27 12:39:12 +01:00
asn1parse.c
asn1write.c
base64.c
bignum.c Zeroize stack before returning from mpi_fill_random 2017-10-18 12:41:30 +01:00
blowfish.c
camellia.c
ccm.c
certs.c
cipher_wrap.c ARIA ciphersuites for TLS 1.2 2018-02-27 12:39:12 +01:00
cipher.c fix bug in get_one_and_zeros_padding() 2017-12-23 23:40:08 +01:00
cmac.c Merge remote-tracking branch 'upstream-public/pr/866' into development 2018-01-02 15:55:55 +01:00
CMakeLists.txt ARIA build integration 2018-02-27 12:39:12 +01:00
ctr_drbg.c ctr_drbg: Typo fix in the file description comment. 2018-02-10 11:11:41 +02:00
debug.c
des.c
dhm.c Merge remote-tracking branch 'upstream-restricted/pr/410' into development-restricted 2018-01-26 18:43:04 +00:00
ecdh.c Address PR cpomments reviews 2017-10-10 19:04:27 +03:00
ecdsa.c Merge remote-tracking branch 'upstream-public/pr/1027' into development 2018-01-09 10:42:03 +00:00
ecjpake.c Add support for alternative ECJPAKE implementation 2018-01-24 10:36:22 +00:00
ecp_curves.c
ecp.c Fix information leak in ecp_gen_keypair_base 2017-10-17 15:19:38 +01:00
entropy_poll.c
entropy.c Merge branch 'development' into development-restricted 2018-01-25 17:28:31 +00:00
error.c something to do with whitespaces 2018-02-27 12:39:12 +01:00
gcm.c Merge remote-tracking branch 'upstream-public/pr/964' into development 2018-01-02 16:24:29 +01:00
havege.c
hmac_drbg.c
Makefile ARIA build integration 2018-02-27 12:39:12 +01:00
md2.c MD: Make deprecated functions not inline 2018-02-22 10:24:30 +00:00
md4.c MD: Make deprecated functions not inline 2018-02-22 10:24:30 +00:00
md5.c MD: Make deprecated functions not inline 2018-02-22 10:24:30 +00:00
md_wrap.c New MD API: rename functions from _ext to _ret 2018-01-22 11:54:42 +01:00
md.c Merge branch 'development' into development-restricted 2018-01-25 17:28:31 +00:00
memory_buffer_alloc.c
net_sockets.c Merge remote-tracking branch 'upstream-public/pr/895' into development 2017-11-29 20:49:21 +01:00
oid.c pkcs5v2: add support for additional hmacSHA algorithms 2018-02-08 17:18:15 +08:00
padlock.c
pem.c Merge branch 'development' into development-restricted 2018-01-25 17:28:31 +00:00
pk_wrap.c Merge branch 'development' into iotssl-1619 2017-12-22 10:24:32 +00:00
pk.c
pkcs5.c pkcs5v2: add support for additional hmacSHA algorithms 2018-02-08 17:18:15 +08:00
pkcs11.c
pkcs12.c
pkparse.c Merge branch 'pr_1135' into development-proposed 2018-02-14 17:20:42 +01:00
pkwrite.c
platform.c Fix undefined function in platform.c 2017-12-20 12:52:49 +01:00
ripemd160.c MD: Make deprecated functions not inline 2018-02-22 10:24:30 +00:00
rsa_internal.c Add explicit type cast to avoid truncation warning 2018-01-03 09:27:40 +00:00
rsa.c Merge branch 'development' into development-restricted 2018-01-25 17:28:31 +00:00
sha1.c MD: Make deprecated functions not inline 2018-02-22 10:24:30 +00:00
sha256.c MD: Make deprecated functions not inline 2018-02-22 10:24:30 +00:00
sha512.c MD: Make deprecated functions not inline 2018-02-22 10:24:30 +00:00
ssl_cache.c Address PR review comments 2017-10-29 17:53:52 +02:00
ssl_ciphersuites.c Add remaining ARIA suites to priority list 2018-02-27 12:39:12 +01:00
ssl_cli.c Merge branch 'development' into iotssl-1251-2.7 2018-01-19 11:25:10 +01:00
ssl_cookie.c
ssl_srv.c Merge remote-tracking branch 'upstream-restricted/pr/410' into development-restricted 2018-01-26 18:43:04 +00:00
ssl_ticket.c
ssl_tls.c ARIA ciphersuites for TLS 1.2 2018-02-27 12:39:12 +01:00
threading.c
timing.c Fix alarm(0) failure on mingw32 2018-01-29 10:24:50 +01:00
version_features.c MBEDTLS_ARIA_ALT added as a feature 2018-02-27 12:39:12 +01:00
version.c
x509_create.c
x509_crl.c
x509_crt.c Fix handshake failure in suite B 2018-02-06 15:59:38 +02:00
x509_csr.c
x509.c Correctly handle leap year in x509_date_is_valid() 2017-10-12 23:21:37 +01:00
x509write_crt.c New MD API: rename functions from _ext to _ret 2018-01-22 11:54:42 +01:00
x509write_csr.c
xtea.c