Gilles Peskine
2d2778650b
Normalize whitespace
...
Normalize whitespace to Mbed TLS standards. There are only whitespace
changes in this commit.
2018-09-12 16:15:52 +03:00
Gilles Peskine
781afb4b07
Merge remote-tracking branch 'psa/pr/45' into feature-psa
2018-09-12 16:13:49 +03:00
Gilles Peskine
6de7a179c8
Fix file permissions
...
Some files were marked as executable but shouldn't have been.
2018-09-12 16:13:49 +03:00
itayzafrir
27fbaf7781
Fixed test sign_deterministic, macro PSA_ASYMMETRIC_SIGN_OUTPUT_SIZE
...
Arguments in the wrong order
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
aa5aea0bac
fix spaces and add braces
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
e9664c30f0
space and style fixes
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
9627241beb
change macro PSA_HASH_BLOCK_SIZE to function psa_get_hash_block_size
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
5ca6547b77
Renamed hmac_ctx to opad and removed null check.
...
this array is now part of the struct and not dynamically allocated
so it can't be null.
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
caec7f0c49
Fix rename issue missed by re-base
2018-09-12 16:13:49 +03:00
Gilles Peskine
d223b52a9a
psa_hmac_start: reduce stack usage
...
Store the temporary key in the long-key case (where the key is first
hashed) directly into ipad. This reduces the stack usage a little, at
a slight cost in complexity.
2018-09-12 16:13:49 +03:00
Gilles Peskine
6a0a44e167
HMAC: clean up local variables containing key material
...
In psa_mac_start, the hash of the key and ipad contain material that
can be used to make HMAC calculations with the key, therefore they
must be wiped.
In psa_mac_finish_internal, tmp contains an intermediate value which
could reveal the HMAC. This is definitely sensitive in the verify case,
and marginally sensitive in the finish case (it isn't if the hash
function is ideal, but it could make things worse if the hash function
is partially broken).
2018-09-12 16:13:49 +03:00
Gilles Peskine
c102e3ce4b
psa_hmac_start: simplify key_length logic in hash-the-key case
2018-09-12 16:13:49 +03:00
Gilles Peskine
e1bc6800cc
psa_hmac_start: remove useless casts
2018-09-12 16:13:49 +03:00
Gilles Peskine
7e454bc19f
Split out CMAC and HMAC code into auxiliary functions
...
Split algorithm-specific code out of psa_mac_start. This makes the
function easier to read.
The behavior is mostly unchanged. In a few cases, errors before
setting a key trigger a context wipe where they didn't. This is a
marginal performance loss but only cases that are an error in caller
code.
2018-09-12 16:13:49 +03:00
Gilles Peskine
99bc649760
Normalize whitespace to Mbed TLS standards
...
Only whitespace changes in this commit.
2018-09-12 16:13:49 +03:00
Gilles Peskine
ef057ac8ed
Remove dead code
...
Remove an unused function and an unused variable. Now the code builds
with gcc -Wall -Wextra -Werror.
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
084832d65f
replace get_block_size_from_hash_algorithm with PSA_HASH_BLOCK_SIZE macro
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
9e2ffe83ac
change type of hash block to uint8_t
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
1e2b046026
adding more test cases for hmac
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
35dfbf4601
change hmac context to use statically allocated memory
...
1. removed dynamic allocation of stack context
2. moved ipad to stack
3. added defines for maximal sizes
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
0c9ec53a10
remove reliance on md_info context for hash information
...
1. remove reliance on md_info context for hash information by decoding locally
2. remove block_size field in context as this is dynamically computed
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
eeace0bf7f
Code style fix : changed keylen to key_length
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
7810be273a
Code correction: remove unneeded sizeof
2018-09-12 16:13:49 +03:00
Nir Sonnenschein
dcd636a73f
Commit changes to hmac to not use MD abstraction
...
this PR is part of efforts to use "lower level" mbedTLS APIs vs "higher level" abstract APIs.
2018-09-12 16:13:49 +03:00
itayzafrir
3e02b3b280
On target testing tests adaptation
...
Updated all psa crypto tests to use the new test format
2018-09-12 16:13:39 +03:00
Ron Eldor
54a7c620bb
Minor style changes
...
1. Rephrase error description.
2. fix alignment of error list.
2018-09-12 14:43:44 +03:00
Manuel Pégourié-Gonnard
5a481f1940
Update error.h count for SSL
2018-09-12 12:33:32 +02:00
Manuel Pégourié-Gonnard
12e4a8be2a
Improve documentation wording and formatting
2018-09-12 10:58:26 +02:00
Manuel Pégourié-Gonnard
1c1c20ed4d
Fix some whitespace issues
2018-09-12 10:34:43 +02:00
Jaeden Amero
ff215726b4
rsa: pss: Use size_t when computing signatures
...
Functions like `mbedtls_md_get_size()` and `mgf_mask()` work with
`size_t`. Use local variables with `size_t` to match.
2018-09-11 14:36:03 +01:00
Manuel Pégourié-Gonnard
125af948c3
Merge branch 'development-restricted' into iotssl-1260-non-blocking-ecc-restricted
...
* development-restricted: (578 commits)
Update library version number to 2.13.1
Don't define _POSIX_C_SOURCE in header file
Don't declare and define gmtime()-mutex on Windows platforms
Correct preprocessor guards determining use of gmtime()
Correct documentation of mbedtls_platform_gmtime_r()
Correct typo in documentation of mbedtls_platform_gmtime_r()
Correct POSIX version check to determine presence of gmtime_r()
Improve documentation of mbedtls_platform_gmtime_r()
platform_utils.{c/h} -> platform_util.{c/h}
Don't include platform_time.h if !MBEDTLS_HAVE_TIME
Improve wording of documentation of MBEDTLS_PLATFORM_GMTIME_R_ALT
Fix typo in documentation of MBEDTLS_PLATFORM_GMTIME_R_ALT
Replace 'thread safe' by 'thread-safe' in the documentation
Improve documentation of MBEDTLS_HAVE_TIME_DATE
ChangeLog: Add missing renamings gmtime -> gmtime_r
Improve documentation of MBEDTLS_HAVE_TIME_DATE
Minor documentation improvements
Style: Add missing period in documentation in threading.h
Rename mbedtls_platform_gmtime() to mbedtls_platform_gmtime_r()
Guard decl and use of gmtime mutex by HAVE_TIME_DATE and !GMTIME_ALT
...
2018-09-11 12:39:14 +02:00
Simon Butcher
53546ea099
Update library version number to 2.13.1
2018-09-06 19:10:26 +01:00
Simon Butcher
5d40f67138
Merge remote-tracking branch 'public/pr/1927' into development-restricted
2018-09-06 16:24:48 +01:00
Hanno Becker
d2ef25478e
Don't define _POSIX_C_SOURCE in header file
2018-09-06 14:53:25 +01:00
Hanno Becker
f5106d54eb
Don't declare and define gmtime()-mutex on Windows platforms
2018-09-06 12:09:56 +01:00
Hanno Becker
323d8019bf
Correct preprocessor guards determining use of gmtime()
...
The previous code erroneously used gmtime_r() to implement
mbedtls_platform_gmtime() in case of a non-windows, non-unix system.
2018-09-06 11:30:57 +01:00
Hanno Becker
03b2bd4a06
Correct documentation of mbedtls_platform_gmtime_r()
...
Previous documentation stated that gmtime_r() was from the standard library,
but it's POSIX.
2018-09-06 09:08:55 +01:00
Hanno Becker
a50fed9910
Correct typo in documentation of mbedtls_platform_gmtime_r()
2018-09-06 09:08:39 +01:00
Hanno Becker
6f70581c4a
Correct POSIX version check to determine presence of gmtime_r()
...
Recent versions of POSIX move gmtime_r to the base.
2018-09-06 09:06:33 +01:00
Hanno Becker
c52ef407ba
Improve documentation of mbedtls_platform_gmtime_r()
2018-09-05 16:36:31 +01:00
Hanno Becker
7dd82b4f51
platform_utils.{c/h} -> platform_util.{c/h}
2018-09-05 16:26:04 +01:00
Hanno Becker
5a7fe14590
Don't include platform_time.h if !MBEDTLS_HAVE_TIME
...
platform_time.h includes time.h, which is not assumed to be present
on a system where MBEDTLS_HAVE_TIME is not defined.
2018-09-05 16:24:44 +01:00
Hanno Becker
9fbbf1c1f0
Improve wording of documentation of MBEDTLS_PLATFORM_GMTIME_R_ALT
2018-09-05 16:23:02 +01:00
Hanno Becker
c9468885a8
Fix typo in documentation of MBEDTLS_PLATFORM_GMTIME_R_ALT
2018-09-05 16:22:10 +01:00
Hanno Becker
921b76d056
Replace 'thread safe' by 'thread-safe' in the documentation
2018-09-05 16:21:36 +01:00
Hanno Becker
9a51d01984
Improve documentation of MBEDTLS_HAVE_TIME_DATE
2018-09-05 16:20:09 +01:00
Hanno Becker
acef292eac
ChangeLog: Add missing renamings gmtime -> gmtime_r
2018-09-05 16:19:07 +01:00
Hanno Becker
4e67cca1d9
Improve documentation of MBEDTLS_HAVE_TIME_DATE
2018-09-05 16:18:38 +01:00
Hanno Becker
48a816ff26
Minor documentation improvements
2018-09-05 15:22:22 +01:00
Hanno Becker
651d586ccf
Style: Add missing period in documentation in threading.h
2018-09-05 15:17:43 +01:00