Commit graph

4840 commits

Author SHA1 Message Date
Andres AG 8abc6b86f9 Fix memory leak in test_suite_cmac.function 2016-10-12 00:40:16 +01:00
Janos Follath 1aae658d76 Add safety check to sample mutex implementation
Due to inconsistent freeing strategy in pkparse.c the sample mutex
implementation in threading.c could lead to undefined behaviour by
destroying the same mutex several times.

This fix prevents mutexes from being destroyed several times in the
sample threading implementation.
2016-10-12 00:32:17 +01:00
Andres AG 7770ea82d5 Add seed cmdline arg to test scripts 2016-10-12 00:32:17 +01:00
Janos Follath e3d882ad4a Remove unnecessary flag from CMAC context 2016-10-11 13:38:36 +01:00
Simon Butcher 851ae29a5d Revise Changelog to clarify and add credit 2016-10-11 12:28:04 +01:00
Janos Follath 8ca53b51c5 Fix minor style issues in test framework 2016-10-11 12:25:34 +01:00
Simon Butcher 2573136fa8 Fix to test output in test suites
Fixes the test suites to consistently use mbedtls_fprintf to output to
stdout or stderr.

Also redirects output from the tests to /dev/null to avoid confusing
output if the test suite code or library outputs anything to stdout.
2016-10-11 12:25:34 +01:00
Simon Butcher bd8d221920 Fix exit and formatting in CMAC test suite
Minor fixes following review.
2016-10-11 12:25:04 +01:00
Simon Butcher 53da6ae842 Add CMAC test suite to CMakeLists.txt 2016-10-11 12:25:04 +01:00
Simon Butcher 33183fd408 Extend test coverage of CMAC
Expands tests to include NULL tests and successive calls to
mbedtls_cipher_cmac_update() and mbedtls_cipher_cmac_reset().
2016-10-11 12:25:04 +01:00
Simon Butcher 6b0774ab1a 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-11 12:25:04 +01:00
Simon Butcher b98eaff408 Revise Changelog to clarify and add credit 2016-10-11 10:13:52 +01:00
Simon Butcher df6c3e8e48 Merge branch 'iotssl-825-double-free-quickfix'
Conflicts:
	ChangeLog
2016-10-11 00:07:14 +01:00
Simon Butcher f77309cb35 Update Changelog for fixes to X.509 sample apps 2016-10-10 09:05:26 +01:00
Simon Butcher 203a6934e7 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-10 09:05:26 +01:00
Simon Butcher 420be4ea04 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-07 12:55:43 +01:00
Simon Butcher f73fd701c0 Update Changelog for fix #559 2016-10-07 11:17:44 +01:00
Simon Butcher 604d399a5c 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-07 08:48:47 +01:00
Andres AG a592dcc1c6 Clean up of formatting, and potential integer overflow fix 2016-10-06 15:23:39 +01:00
Simon Butcher d241f1cf17 Fixes following review
Fixes issue of not zeroing entire block on reset and conditional compilation.
2016-10-06 12:53:33 +01:00
Simon Butcher b981b16379 Minor fixes to formatting and compilation conditions 2016-10-06 12:51:24 +01:00
Simon Butcher 69283e51d5 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-06 12:49:58 +01:00
Simon Butcher 94ffde7b0a Fix CMAC interface for doxygen
Parameters didn't match the function definition.
2016-10-05 15:33:53 +01:00
Simon Butcher 8308a445d8 Fix naming in cmac.h to comply with check-names.sh 2016-10-05 15:12:59 +01:00
Simon Butcher 7ca3109614 Regenerate error.c file to remove CMAC 2016-10-05 14:39:15 +01:00
Simon Butcher 21c54816f5 Add CMAC to ChangeLog 2016-10-05 14:19:18 +01:00
Simon Butcher 01ba45b139 Clean up comment formatting in md.h 2016-10-05 14:19:18 +01:00
Simon Butcher 37a064af76 Remove CMAC as a separate and independent error group 2016-10-05 14:19:18 +01:00
Simon Butcher 549dc3d75e Add CMAC functions to the benchmark sample application 2016-10-05 14:19:18 +01:00
Simon Butcher d812fa69d9 Introduce a CMAC specific test suite 2016-10-05 14:19:18 +01:00
Simon Butcher 327398ad3a 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-05 14:19:18 +01:00
Brian Murray 2898f79795 Specify AES-CMAC-PRF buffer output size in comment 2016-10-05 14:19:17 +01:00
Brian Murray 8b4111c516 Fix build failure for thread config 2016-10-05 14:19:17 +01:00
Brian Murray 72b69e3808 Minor fixes to comments 2016-10-05 14:19:17 +01:00
Brian Murray 53e23b684f Minor CMAC fixes for merge 2016-10-05 14:19:17 +01:00
Brian Murray 9ce2e091de cleaned up indentation and braket issues in mbedtls_cmac_verify 2016-10-05 14:19:17 +01:00
Brian Murray 06acc18f44 Minor change to pass build tests 2016-10-05 14:19:17 +01:00
Brian Murray ae1cb12d82 Changed test function to inline to pass tests/scripts/check-names.sh 2016-10-05 14:19:17 +01:00
Brian Murray 0cf14c10d4 Fixed some build warnings 2016-10-05 14:19:17 +01:00
Brian Murray 6a3c0d2d67 Do not zeroize null pointer 2016-10-05 14:19:17 +01:00
Brian Murray 4b64ab6664 Removed unneed memsets and fixed spacing 2016-10-05 14:19:16 +01:00
Brian Murray 87e4040bb9 No CMAC minimum tag length is specified by NIST SP800-38B A
Minor Typo Changes
2016-10-05 14:19:16 +01:00
Brian Murray 617634e656 cmac.c whitespace cleanup 2016-10-05 14:19:16 +01:00
Brian Murray 2cfa5072ed better handling of failed calloc 2016-10-05 14:19:16 +01:00
Brian Murray 57863ad7ed selftest supports cmac if only MBEDTLS_DES_C is defined
Other minor typo fixes
2016-10-05 14:19:16 +01:00
Brian Murray 9044b0295c More cleanup of CMAC self tests 2016-10-05 14:19:16 +01:00
Brian Murray b439d4556d Only compile AES CMAC PRF support if MBEDTLS_AES_C is defined and other cleanups 2016-10-05 14:19:16 +01:00
Brian Murray 0f6af73599 More cleanup of CMAC selftests 2016-10-05 14:19:15 +01:00
Brian Murray 00dc5f0fc8 Fixed CMAC tag length 2016-10-05 14:19:15 +01:00
Brian Murray f13d3db373 Updated comments for CMAC in config.h 2016-10-05 14:19:15 +01:00