Commit graph

5184 commits

Author SHA1 Message Date
Simon Butcher
c61351df72 Fix issues in CMAC in repeated updates
Successive calls to mbedtls_cipher_cmac_update() which weren't block aligned
were failing, which is fixed by this commit.
2016-10-13 13:53:12 +01:00
Simon Butcher
b93fdddf67 Revise Changelog to clarify and add credit 2016-10-13 13:53:12 +01:00
Simon Butcher
dcb9892939 Update Changelog for fixes to X.509 sample apps 2016-10-13 13:52:39 +01:00
Simon Butcher
e19acd5e79 Add extra compilation conditions to X.509 samples
The sample applications programs/pkey/cert_req.c and
programs/pkey/cert_write.c use the library functions
mbedtls_pk_write_csr_pem() and mbedtls_pk_write_crt_pem() respectively which
are dependent on the configuration option MBEDTLS_PEM_WRITE_C. If the option
isn't defined the build breaks.

This change adds the compilation condition MBEDTLS_PEM_WRITE_C to these
sample application.
2016-10-13 13:52:00 +01:00
Simon Butcher
ad882673dc Fix bracketing in cmac.c
The bracketing in some expressions where an assignment was being made in an if statement in cmac.c had been accidentally broken and was causing compiler warnings with armcc.
2016-10-13 13:52:00 +01:00
Simon Butcher
eb02fb5ad4 Update Changelog for fix #559 2016-10-13 13:52:00 +01:00
Simon Butcher
41dba28a2a Add extra compilation conditions to gen_key.c #559
The sample application programs/pkey/gen_key.c uses the library function
mbedtls_pk_write_key_pem() which is dependent on the configuration option
MBEDTLS_PEM_WRITE_C. If the option isn't defined the build breaks.

This change adds the compilation condition MBEDTLS_PEM_WRITE_C to the gen_key.c
sample application.
2016-10-13 13:51:13 +01:00
Andres AG
8254b6c9f3 Clean up of formatting, and potential integer overflow fix 2016-10-13 13:51:13 +01:00
Simon Butcher
2127932fb8 Fixes following review
Fixes issue of not zeroing entire block on reset and conditional compilation.
2016-10-13 13:51:12 +01:00
Simon Butcher
ea680197f8 Minor fixes to formatting and compilation conditions 2016-10-13 13:51:12 +01:00
Simon Butcher
f394e09431 Clean up and minor fixes following review
Minor fixes following review including:
    * formatting changes including indentation and code style
    * corrections
    * removal of debug code
    * clarification of code through variable renaming
    * memory leak
    * compiler warnings
2016-10-13 13:51:12 +01:00
Simon Butcher
5805fbedcb Fix CMAC interface for doxygen
Parameters didn't match the function definition.
2016-10-13 13:51:12 +01:00
Simon Butcher
08e890004c Fix naming in cmac.h to comply with check-names.sh 2016-10-13 13:51:12 +01:00
Simon Butcher
8a1a68cb2b Regenerate error.c file to remove CMAC 2016-10-13 13:51:12 +01:00
Simon Butcher
e5796c1fbc Add CMAC to ChangeLog 2016-10-13 13:51:12 +01:00
Simon Butcher
59b4c888fe Clean up comment formatting in md.h 2016-10-13 13:51:12 +01:00
Simon Butcher
53b5e9c0a9 Remove CMAC as a separate and independent error group 2016-10-13 13:51:12 +01:00
Simon Butcher
32bb5af7e1 Add CMAC functions to the benchmark sample application 2016-10-13 13:51:11 +01:00
Simon Butcher
937fddbfcb Introduce a CMAC specific test suite 2016-10-13 13:51:11 +01:00
Simon Butcher
0c79073a8b Refactor and change CMAC interface
Change the CMAC interface to match the mbedtls_md_hmac_xxxx() interface. This
changes the overall design of the CMAC interface to make it more consistent with
the existing HMAC interface, and will allow incremental updates of input data
rather than requiring all data to be presented at once, which is what the
current interface requires.
2016-10-13 13:51:11 +01:00
Brian Murray
57104fb773 Specify AES-CMAC-PRF buffer output size in comment 2016-10-13 13:51:11 +01:00
Brian Murray
7b07e0e4b4 Fix build failure for thread config 2016-10-13 13:51:11 +01:00
Brian Murray
5168618294 Minor fixes to comments 2016-10-13 13:51:11 +01:00
Brian Murray
3d64431a33 Minor CMAC fixes for merge 2016-10-13 13:51:11 +01:00
Brian Murray
0b21cdf7bc cleaned up indentation and braket issues in mbedtls_cmac_verify 2016-10-13 13:51:11 +01:00
Brian Murray
ba426948b2 Minor change to pass build tests 2016-10-13 13:51:10 +01:00
Brian Murray
bbed660aa1 Changed test function to inline to pass tests/scripts/check-names.sh 2016-10-13 13:51:10 +01:00
Brian Murray
fe9ff01c49 Fixed some build warnings 2016-10-13 13:51:10 +01:00
Brian Murray
4e067035b7 Do not zeroize null pointer 2016-10-13 13:51:10 +01:00
Brian Murray
cdd1f6d96c Removed unneed memsets and fixed spacing 2016-10-13 13:51:10 +01:00
Brian Murray
6eae89bb6f No CMAC minimum tag length is specified by NIST SP800-38B A
Minor Typo Changes
2016-10-13 13:51:10 +01:00
Brian Murray
e260feacbe cmac.c whitespace cleanup 2016-10-13 13:51:10 +01:00
Brian Murray
db5c70e080 better handling of failed calloc 2016-10-13 13:51:10 +01:00
Brian Murray
86ff986884 selftest supports cmac if only MBEDTLS_DES_C is defined
Other minor typo fixes
2016-10-13 13:51:10 +01:00
Brian Murray
3d3c9b8be7 More cleanup of CMAC self tests 2016-10-13 13:51:09 +01:00
Brian Murray
afdb60f84f Only compile AES CMAC PRF support if MBEDTLS_AES_C is defined and other cleanups 2016-10-13 13:51:09 +01:00
Brian Murray
d666eb5c11 More cleanup of CMAC selftests 2016-10-13 13:51:09 +01:00
Brian Murray
3c0412a443 Fixed CMAC tag length 2016-10-13 13:51:09 +01:00
Brian Murray
029d79bf25 Updated comments for CMAC in config.h 2016-10-13 13:51:09 +01:00
Brian Murray
7c6476c330 CMAC support for cipher with 64bit blocks (DES/3DES) 2016-10-13 13:51:09 +01:00
Brian Murray
5a8c004f79 Added cmac.o to libary/Makefile 2016-10-13 13:51:09 +01:00
Manuel Pégourié-Gonnard
2b0e21f130 cmac: more cosmetic changes 2016-10-13 13:51:09 +01:00
Manuel Pégourié-Gonnard
a878d3b6e3 cmac: avoid useless wrapping of function
probably a leftover from an earlier stage
2016-10-13 13:51:09 +01:00
Manuel Pégourié-Gonnard
5f8639fea2 cmac: reduce visibility of macros
The #undef is usefull for people who want to to amalgamated releases
2016-10-13 13:51:09 +01:00
Manuel Pégourié-Gonnard
59ae4bad18 cmac: some more padding-related tune-ups
- use one less temporary buffer
- pedantic: in_len + 15 was a potential overflow
- use a more explicit name instead of 'flag'
- Mn was a bit misleading
2016-10-13 13:51:08 +01:00
Manuel Pégourié-Gonnard
da8724fbc6 cmac: clean up padding function and comments 2016-10-13 13:51:08 +01:00
Manuel Pégourié-Gonnard
89b8d83723 cmac: make subkey gen more constant-time
The previous version had secret-dependent memory accesses. While it was
probably not an issue in practice cause the two bytes of the array are
probably on the same cache line anyway, as a matter of principle this should
be avoided.
2016-10-13 13:51:08 +01:00
Manuel Pégourié-Gonnard
28ea791521 cmac: zeroize sensitive intermediate values 2016-10-13 13:51:08 +01:00
Manuel Pégourié-Gonnard
756bcf7631 cmac: factor multiply by u to its own function
We're doing exactly the same operation for K1 and K2.
2016-10-13 13:51:08 +01:00
Manuel Pégourié-Gonnard
a4dfa0550f cmac: fix whitespace/codingstyle issues 2016-10-13 13:51:08 +01:00