Commit graph

1569 commits

Author SHA1 Message Date
Simon Butcher fc794ff2b7 Merge branch 'iotssl-1071-ca-flags'
Fixes a regression introduced by an earlier commit that modified
x509_crt_verify_top() to ensure that valid certificates that are after past or
future valid in the chain are processed. However the change introduced a change
in behaviour that caused the verification flags MBEDTLS_X509_BADCERT_EXPIRED and
MBEDTLS_BADCERT_FUTURE to always be set whenever there is a failure in the
verification regardless of the cause.

The fix maintains both behaviours:

 * Ensure that valid certificates after future and past are verified
 * Ensure that the correct verification flags are set.
2017-02-27 19:06:05 +00:00
Simon Butcher 0278a38f10 Merge branch 'iotssl-1077-dos-crl'
Modifies the function mbedtls_x509_crl_parse() to ensure that a CRL in PEM
format with trailing characters after the footer does not result in the
execution of an infinite loop.
2017-02-26 01:16:02 +00:00
Simon Butcher 9cfdf2caa7 Merge branch 'development-restricted' 2017-02-15 23:55:22 +02:00
Andres Amaya Garcia 6a54336897 Fix integer overflows in buffer bound checks
Fix potential integer overflows in the following functions:
  * mbedtls_md2_update() to be bypassed and cause
  * mbedtls_cipher_update()
  * mbedtls_ctr_drbg_reseed()
This overflows would mainly be exploitable in 32-bit systems and could
cause buffer bound checks to be bypassed.
2017-02-15 23:31:07 +02:00
Andres AG 49d29337fa Add tests for overreads in pem_read_buffer() 2017-02-15 23:31:07 +02:00
Andres AG 13fb6e7271 Add DTLS test to check 6 byte record ctr is cmp
Add a test to ssl-opt.sh to ensure that in DTLS a 6 byte record counter
is compared in ssl_check_ctr_renegotiate() instead of a 8 byte one as in
the TLS case. Because currently there are no testing facilities to check
that renegotiation routines are triggered after X number of input/output
messages, the test consists on setting a renegotiation period that
cannot be represented in 6 bytes, but whose least-significant byte is 2.
If the library behaves correctly, the renegotiation routines will be
executed after two exchanged.
2017-02-15 23:26:35 +02:00
Simon Butcher ba6aa63578 Fix all.sh test builds with recent glibc and clang
Fixes strict C99 builds in all.sh with glibc version >2.19 where platform support
wasn't being compiled in automatically.

Also fixes C99 syntax with armclang.
2017-02-15 23:25:08 +02:00
Simon Butcher 53716395b2 Clarify use of armcc in all.sh 2017-02-15 23:23:22 +02:00
Andres AG 0911f0880c Add -march argument to armc6 build tests 2017-02-15 23:23:22 +02:00
Andres AG 7f08d7a35a Modify output_env.sh to make it extensible 2017-02-15 23:23:22 +02:00
Andres AG 9e3fba09fd Add ARM Compiler 6 build tests to all.sh 2017-02-15 23:23:22 +02:00
Janos Follath 4c006cdb1c Update library version number to 2.4.1 2017-02-15 22:55:55 +02:00
Simon B 8477d37ee6 Remove need for elevated command line in Windows
Changes use of mklink in Windows test builds, to create junctions instead of
directory symbolic links. This removes the need for an elevated command prompt
when running cmake to create the Visual Studio project files.
2017-02-15 09:08:26 +00:00
Simon Butcher 1e6f5ac127 Make mingw test build a requirement of all.sh
Changed the mingw test build to be a required test of the all.sh script.
2017-02-15 09:08:26 +00:00
Simon Butcher 4ae4fdcd99 Fix mingw test build to avoid executing the tests
Changed the mingw build target to avoid building mingw test suites and
then attempting to run them which was failing on Linux.
2017-02-15 09:08:26 +00:00
Simon Butcher 9510cc1a18 Make the test builds much stricter for warnings
Tighten up the test options in all.sh, test-ref-configs.pl and curves.pl
to ensure the builds are strict for all warnings, warnings are treated
as errors, and that wherever possible builds are strict to the C99
standard. (Note that builds that use the Unix sockets API cannot be).
2017-02-15 09:08:26 +00:00
Andres AG 342889fdbe Remove unused var warnings in windows unittests 2017-02-15 09:08:26 +00:00
Simon B 24d9a4cf8d Fix config of compiler warning flags with MSVC
Compiler warnings were being configured twice and not suppressed on the
test suites with Microsoft Visual Studio.
2017-02-15 09:08:26 +00:00
Andres AG b9d3db68c6 Use MAKEFLAGS to pass args to make in all.sh
Modify the script at tests/scripts/all.sh to export the variable
MAKEFLAGS with -j if it was not set before. This should decrease the
total runtime of tests/scripts/all.sh by letting make run multiple jobs
in parallel. Also, add a check at the top of the script to cause a
failure if the environment is not Linux.
2017-02-15 09:08:26 +00:00
Andres Amaya Garcia f7cf56fa45 Fix integer overflows in buffer bound checks
Fix potential integer overflows in the following functions:
  * mbedtls_md2_update() to be bypassed and cause
  * mbedtls_cipher_update()
  * mbedtls_ctr_drbg_reseed()
This overflows would mainly be exploitable in 32-bit systems and could
cause buffer bound checks to be bypassed.
2017-02-08 12:04:24 +00:00
Andres AG f535662894 Add tests for overreads in pem_read_buffer() 2017-02-08 12:03:46 +00:00
Simon Butcher 1d4db5b7b5 Merge 'iotssl-1099-incorrect-renego-dtls'
Fix an incorrect condition in ssl_check_ctr_renegotiate() that compared
64 bits of record counter instead of 48 bits as described in RFC 6347
Section 4.3.1. This would cause the function's return value to be
occasionally incorrect and the renegotiation routines to be triggered
at unexpected times.
2017-02-02 23:47:08 +00:00
Andres AG 9060d4da08 Fix generate_code.pl to handle escaped : 2017-02-02 14:38:13 +00:00
Andres AG 9f430c15d8 Add tests for out flags from x509_crt_verify_top()
The tests load certificate chains from files. The CA chains contain a
past or future certificate and an invalid certificate. The test then
checks that the flags set are MBEDTLS_X509_BADCERT_EXPIRED or
MBEDTLS_X509_BADCERT_FUTURE.
2017-01-20 13:52:01 +00:00
Andres AG a39db394db Add test for infinite loop in CRL parse 2017-01-19 17:10:51 +00:00
Andres AG 692ad84e5c Add DTLS test to check 6 byte record ctr is cmp
Add a test to ssl-opt.sh to ensure that in DTLS a 6 byte record counter
is compared in ssl_check_ctr_renegotiate() instead of a 8 byte one as in
the TLS case. Because currently there are no testing facilities to check
that renegotiation routines are triggered after X number of input/output
messages, the test consists on setting a renegotiation period that
cannot be represented in 6 bytes, but whose least-significant byte is 2.
If the library behaves correctly, the renegotiation routines will be
executed after two exchanged.
2017-01-19 16:30:57 +00:00
Simon Butcher cb587009d6 Fix all.sh test builds with recent glibc and clang
Fixes strict C99 builds in all.sh with glibc version >2.19 where platform support
wasn't being compiled in automatically.

Also fixes C99 syntax with armclang.
2017-01-06 16:14:44 +00:00
Simon Butcher 105e856143 Merge branch 'gcc-compiler-warnings' 2017-01-05 18:26:40 +00:00
Simon Butcher 49f00bd81d Clarify use of armcc in all.sh 2017-01-05 16:20:56 +00:00
Andres AG a5cd973047 Add -march argument to armc6 build tests 2017-01-05 10:15:00 +00:00
Andres AG 31f9b5bdd8 Modify output_env.sh to make it extensible 2017-01-05 10:14:51 +00:00
Andres AG 87bb577cfb Add ARM Compiler 6 build tests to all.sh 2017-01-03 10:12:11 +00:00
Simon Butcher 710dd4fdd6 Merge branch 'speedup_tests'
Pull Request #533 - Use MAKEFLAGS to pass args to make in all.sh

Modify the script at tests/scripts/all.sh to export the variable
MAKEFLAGS with -j if it was not set before. This should decrease the
total runtime of tests/scripts/all.sh by letting make run multiple jobs
in parallel. Also, add a check at the top of the script to cause a
failure if the environment is not Linux.w
2016-12-30 19:09:40 +00:00
Janos Follath 1808dc01bd Update library version number to 2.4.1 2016-12-13 16:00:52 +00:00
Andres AG 9c94b6951c Add tests for overreads in pem_read_buffer() 2016-11-21 11:03:40 +00:00
Simon B d473c1f359 Remove need for elevated command line in Windows
Changes use of mklink in Windows test builds, to create junctions instead of
directory symbolic links. This removes the need for an elevated command prompt
when running cmake to create the Visual Studio project files.
2016-11-17 16:04:33 +00:00
Simon Butcher 002bc6262b Make mingw test build a requirement of all.sh
Changed the mingw test build to be a required test of the all.sh script.
2016-11-17 09:27:45 +00:00
Simon Butcher 91aef33832 Fix mingw test build to avoid executing the tests
Changed the mingw build target to avoid building mingw test suites and
then attempting to run them which was failing on Linux.
2016-11-17 09:22:47 +00:00
Simon Butcher f95c1764fa Make the test builds much stricter for warnings
Tighten up the test options in all.sh, test-ref-configs.pl and curves.pl
to ensure the builds are strict for all warnings, warnings are treated
as errors, and that wherever possible builds are strict to the C99
standard. (Note that builds that use the Unix sockets API cannot be).
2016-11-17 09:22:46 +00:00
Andres AG ea67eeb4e8 Remove unused var warnings in windows unittests 2016-11-10 17:22:12 +00:00
Simon B 9b3e3c4942 Fix config of compiler warning flags with MSVC
Compiler warnings were being configured twice and not suppressed on the
test suites with Microsoft Visual Studio.
2016-11-10 15:37:33 +00:00
Simon Butcher 16c54ee9c8 Update library version number to 2.4.0 2016-10-16 19:34:39 +01:00
Simon Butcher 8e00410402 Merge fix for AEAD Random IVs 2016-10-14 00:48:33 +01:00
Simon Butcher 9800a058ae Merge branch 'development' 2016-10-13 17:25:56 +01:00
Simon Butcher 99000142cb Merge fix for IE Certificate Compatibility 2016-10-13 17:21:01 +01:00
Simon Butcher 488c08c00b Merge branch fixing date validity in X.509 2016-10-13 16:13:09 +01:00
Janos Follath f45dab1939 Fix global variable shadowing 2016-10-13 13:54:48 +01:00
Simon Butcher 6437b221a3 Fix stdio redirection memory leak in test suites 2016-10-13 13:54:48 +01:00
Janos Follath e5dc202469 Restore P>Q in RSA key generation (#558)
The PKCS#1 standard says nothing about the relation between P and Q
but many libraries guarantee P>Q and mbed TLS did so too in earlier
versions.

This commit restores this behaviour.
2016-10-13 13:54:48 +01:00
Janos Follath d7b9049806 Fix memory leaks in CMAC tests 2016-10-13 13:53:56 +01:00
Andres AG fe4db8f575 Fix memory leak in test_suite_cmac.function 2016-10-13 13:53:56 +01:00
Andres AG f04f54d432 Add seed cmdline arg to test scripts 2016-10-13 13:53:33 +01:00
Janos Follath 2d9c46767a Fix minor style issues in test framework 2016-10-13 13:53:13 +01:00
Simon Butcher 33388669ec 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-13 13:53:13 +01:00
Simon Butcher 8739aa9403 Fix exit and formatting in CMAC test suite
Minor fixes following review.
2016-10-13 13:53:13 +01:00
Simon Butcher 03faeac7ec Add CMAC test suite to CMakeLists.txt 2016-10-13 13:53:13 +01:00
Simon Butcher c3db62fd51 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-13 13:53: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 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 937fddbfcb Introduce a CMAC specific test suite 2016-10-13 13:51:11 +01:00
Andres AG 42547d0cf7 Set selftest verbose flag to boost coverage 2016-10-13 13:48:48 +01:00
Andres AG 84c46db746 Fix scripts to support multiple openssl and gnutls 2016-10-13 13:48:48 +01:00
Andres AG 3616f6f261 Rename net.{c,h} to net_sockets.{c,h}
The library/net.c and its corresponding include/mbedtls/net.h file are
renamed to library/net_sockets.c and include/mbedtls/net_sockets.h
respectively. This is to avoid naming collisions in projects which also
have files with the common name 'net'.
2016-10-13 13:48:48 +01:00
Simon Butcher 1c8b33ad19 Merge branch 'development' 2016-10-13 13:40:41 +01:00
Janos Follath e709f7c9e0 Fix global variable shadowing 2016-10-13 13:20:12 +01:00
Simon Butcher e019296ab7 Fix stdio redirection memory leak in test suites 2016-10-13 10:03:08 +01:00
Janos Follath ef44178474 Restore P>Q in RSA key generation (#558)
The PKCS#1 standard says nothing about the relation between P and Q
but many libraries guarantee P>Q and mbed TLS did so too in earlier
versions.

This commit restores this behaviour.
2016-10-13 00:25:07 +01:00
Janos Follath 99d09d2747 Fix memory leaks in CMAC tests 2016-10-12 15:32:54 +01:00
Andres AG c4424c0a69 Fix memory leak in test_suite_cmac.function 2016-10-12 15:32:53 +01:00
Janos Follath d444358247 Fix memory leaks in CMAC tests 2016-10-12 14:31:01 +01:00
Andres AG 8abc6b86f9 Fix memory leak in test_suite_cmac.function 2016-10-12 00:40:16 +01:00
Andres AG c47857dbf4 Add seed cmdline arg to test scripts 2016-10-12 00:36:31 +01:00
Andres AG 7770ea82d5 Add seed cmdline arg to test scripts 2016-10-12 00:32:17 +01:00
Andres AG e0af995f12 Add test for bounds in X509 DER write funcs 2016-10-11 14:07:48 +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
Andres AG a592dcc1c6 Clean up of formatting, and potential integer overflow fix 2016-10-06 15:23:39 +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 d812fa69d9 Introduce a CMAC specific test suite 2016-10-05 14:19:18 +01:00
Andres AG 4b76aecaf3 Add check for validity of date in x509_get_time() 2016-09-28 14:32:54 +01:00
Andres AG 93012e8bce Set selftest verbose flag to boost coverage 2016-09-27 17:29:22 +01:00
Andres AG b2fdd04f6a Fix scripts to support multiple openssl and gnutls 2016-09-27 16:04:44 +01:00
Andres AG 788aa4a812 Rename net.{c,h} to net_sockets.{c,h}
The library/net.c and its corresponding include/mbedtls/net.h file are
renamed to library/net_sockets.c and include/mbedtls/net_sockets.h
respectively. This is to avoid naming collisions in projects which also
have files with the common name 'net'.
2016-09-26 23:23:52 +01:00
Andres AG 38495a3824 Use MAKEFLAGS to pass args to make in all.sh
Modify the script at tests/scripts/all.sh to export the variable
MAKEFLAGS with -j if it was not set before. This should decrease the
total runtime of tests/scripts/all.sh by letting make run multiple jobs
in parallel. Also, add a check at the top of the script to cause a
failure if the environment is not Linux.
2016-09-22 17:01:13 +01:00
Simon Butcher 41eeccf76b Fix merge of OpenSSL/GNUTLS version options in all.sh 2016-09-15 20:45:53 +01:00
Andres AG f181e25e5b Remove specific GnuTLS and OpenSSL version requirements 2016-09-15 20:45:53 +01:00
Andres AG f07314e787 Allow cmake 'out-of-source' builds
Allow mbed TLS to be build in a subdirectory. Also add a test in
all.sh
2016-09-15 20:45:53 +01:00
Andres AG d9eba4ba3d Allow alternate openssl and gnutls in all.sh
Allow the user to specify alternative openssl, gnutls-cli and
gnutls-serv binaries to execute legacy tests in all.sh.
2016-09-15 20:45:53 +01:00
Simon Butcher b7f45c54a7 Fixes for entropy test suite for some configurations
Changes to allow the entropy tests to work for configurations without an
entropy seed file (MBEDTLS_ENTROPY_NV_SEED), and with no entropy sources
configured (MBEDTLS_TEST_NULL_ENTROPY).
2016-09-15 18:42:26 +01:00
Simon Butcher 8e3afc7332 Removes duplicated selftests from all.sh
All selftests are now called from the test suites so don't need to be executed
explicitly in tests/scripts/all.sh
2016-09-15 17:13:08 +01:00
Andres AG dc192215f4 Allow cmake 'out-of-source' builds
Allow mbed TLS to be build in a subdirectory. Also add a test in
all.sh
2016-09-06 20:38:40 +01:00
Simon Butcher ac22d1113c Remove references to PolarSSL in compat.sh
Removed references to PolarSSL for mbed TLS for clarity.
2016-09-05 13:17:25 +01:00
Simon Butcher 7dda0dd038 Fix typo in dependency in test_suite_debug.data 2016-09-04 15:14:38 +01:00
palaviv f180df99a9 Added needed ECDSA dependencies to test_suite_x509parse.data 2016-09-04 15:14:38 +01:00
palaviv 00cb9c5c08 Added needed HASH dependencies to tests/suites/test_suite_pkparse.data 2016-09-04 15:14:38 +01:00
palaviv 1472f11608 Added needed HASH dependencies to test_suite_debug.data 2016-09-04 15:14:38 +01:00
palaviv a07ecda04e Added needed HASH dependencies to test_suite_x509parse.data 2016-09-04 15:14:38 +01:00
Janos Follath 74537a69fd ECJPAKE: Fix intermittently failing tests
In some tests in ssl-opt.sh the client finishes sooner and the server
gets killed before it could reach certain errors. Consequently the
the script doesn't find the error it is looking for and the test fails.

To resolve this issue, we introduce a per-test option to wait after the
client finishes.
2016-09-03 18:19:12 +03:00
Andres AG e7723ec284 Make entropy bias self test poll multiple times
Instead of polling the hardware entropy source a single time and
comparing the output with itself, the source is polled at least twice
and make sure that the separate outputs are different.
2016-08-30 16:50:48 +01:00
Andres AG b34e42e69e Add a new self test to entropy module
The self test is a quick way to check at startup whether the entropy
sources are functioning correctly. The self test only polls 8 bytes
from the default entropy source and performs the following checks:

- The bytes are not all 0x00 or 0xFF.
- The hardware does not return an error when polled.
- The entropy does not provide data in a patter. Only check pattern
  at byte, word and long word sizes.
2016-08-30 16:50:48 +01:00
Andres AG 99b257ca19 Fix memory leak in test_suite_md.function 2016-08-26 17:21:14 +01:00
Paul Bakker 4b8bc5228a Removed running selftest program from basic-build-test.sh
All self tests are run in the unit test framework as well.
2016-08-25 16:36:35 +01:00
Paul Bakker 03091e1e6a Remove stale Makefile lines for old test suite 2016-08-25 16:36:35 +01:00
Paul Bakker 50157ff5ab Add new timing test suite that runs the timing self test 2016-08-25 16:36:35 +01:00
Paul Bakker 81c60910e1 Run PKCS#5 selftest in test suites 2016-08-25 16:36:35 +01:00
Simon Butcher 80cd444978 Adds missing dependency to AES special case tests
Added MBEDTLS_AES_C to the AES cipher special behaviours test case.
2016-08-25 15:42:28 +01:00
Paul Bakker 5c57e02b1d Fix style issues in test_suite_md.function 2016-08-25 15:42:28 +01:00
Paul Bakker 6a9c725652 Add Cipher layer corner case test coverage 2016-08-25 15:42:28 +01:00
Paul Bakker 185ccf7070 Add coverage for CTR-DRBG corner case function behaviours 2016-08-25 15:42:28 +01:00
Paul Bakker ec5ceb65d6 Test invalid bit value in mbedtls_mpi_set_bit() 2016-08-25 15:42:28 +01:00
Paul Bakker c7d6bd4b5f Add mbedtls_asn1_write_len() support for 3 and 4 byte lengths
As a consequence also adds coverage for reading 3 and 4 byte lengths
(which were not covered before)
2016-08-25 15:42:27 +01:00
Paul Bakker 5e8b77cd8c Test result of mbedtls_asn1_write_len() through mbedtls_asn1_get_len() 2016-08-25 15:42:27 +01:00
Paul Bakker 58bfb83bb0 Add buffer length tests for mbedtls_asn1_write_len() 2016-08-25 15:42:27 +01:00
Paul Bakker e325db9055 Add explicit test coverage for mbedtls_asn1_write_len() 2016-08-25 15:42:27 +01:00
Paul Bakker 97c53c2867 Add coverage testing of mbedtls_md_clone() (and wraps)
+13 functions, +57 lines
2016-08-25 15:42:27 +01:00
Paul Bakker e35afa28f7 Update *_multi tests in test_suite_md to do more than 1 step 2016-08-25 15:42:27 +01:00
Simon Butcher 4df5eaf2b0 Fixes build configuration for armcc test build in all.sh
In the test script tests/scripts/all.sh the armcc build is a baremetal build
and doesn't use MBEDTLS_HAVE_TIME therefore the test configuration
MBEDTLS_PLATFORM_TIME_ALT which is dependent on it must be unset.
2016-08-24 22:58:31 +03:00
Simon Butcher a4ed19c7c0 Fixes test script all.sh to output errors from armcc
The test script tests/scripts/all.sh exits on first error, although it also
attempted to redirect error output from armcc and then output it after armcc
had completed. This never occurred because as soon as armcc failed the script
would end and the redirected output wouldn't be displayed.

This change removes that redirection.
2016-08-24 22:37:43 +03:00
Janos Follath b72c67804a Add script to print build environment info. (#539)
* Add script to print build environment info.

The new script is also included in:
- all.sh
- basic-build-test.sh

* Tidy up environment reporting script.

Changes include:
- making the echo calls portable
- removing unnecessary brackets
- using more efficient checks for the existance of commands
- correcting typos and copyright year

* Update references to output_env.sh
2016-07-19 14:54:17 +01:00
Simon Butcher b92834324f Fixes all.sh for full config
MBEDTLS_PLATFORM_TIME_ALT was accidentally left in the full config test
leading to linker problems.
2016-07-13 14:47:07 +01:00
Simon Butcher 905cef6c2c Changed library version number to 2.3.0 2016-06-27 19:36:45 +01:00
Simon Butcher 1c71965d46 Fixes armcc builds in all.sh
MBEDTLS_NV_SEED needs to be disabled in builds without filesystem IO.
2016-06-27 19:02:12 +01:00
Simon Butcher eebf1b9380 Various fixes for NV SEED feature in all.sh 2016-06-27 01:42:39 +01:00
Simon Butcher 284b4c9927 Fixes all.sh script for filesystem IO test build
MBEDTLS_ENTROPY_NV_SEED is dependent on platform code unless an
alternative implementation is provided,  therefore needs to be disabled
in the disabled filesystem IO build.
2016-06-26 15:44:34 +01:00
Simon Butcher ab069c6b46 Merge branch 'development' into development-restricted 2016-06-23 21:42:26 +01:00
Simon Butcher 71ebc58932 Changes to check-names.sh script to accept yotta constants 2016-06-23 20:02:07 +01:00
Simon Butcher 02c4a38013 Corrects missing dependency for MBEDTLS_CIPHER_MODE_CBC in some tests 2016-06-23 02:41:31 +01:00
Janos Follath 15ab7ed0f3 Merge branch 'development' into development-restricted
Conflicts:
	programs/pkey/rsa_decrypt.c
	programs/pkey/rsa_encrypt.c
	programs/test/selftest.c
2016-06-14 09:20:46 +01:00
Simon Butcher ab5df40054 Rename the 'no entropy' feature to MBEDTLS_TEST_NULL_ENTROPY
Following review and for clarity, changed the name of the feature to 'null
entropy'.
2016-06-11 02:31:21 +01:00
Paul Bakker bd43f6c009 Fix dependency on MBEDTLS_ENTROPY_SHA512_ACCUMULATOR in test suite 2016-06-10 19:42:15 +01:00
Paul Bakker 5a0392a5c0 Fix dependency guard for test 2016-06-10 19:42:15 +01:00
Paul Bakker b3dc822846 Properly gate NV_SEED additions in test suite 2016-06-10 19:42:15 +01:00
Paul Bakker 1779026037 Add test cases for NV seed functionality
A standard 'test' that writes a seed file is added so that regular tests
still can succeed. This is in lieu of a 'SUITE_PRE_CODE' kind of
arrangement where a suite can run code before (and after) all other code
runs.

A test is added that checks if we can read and write the standard NV
seed file

A test is added that actually checks if the entropy and seed file values
that are the result of just using the NV seed are the same as the manual
calculation.
2016-06-10 19:42:15 +01:00
Janos Follath d2e7ff746d Fix test message for entropy safety switch. 2016-06-09 14:12:02 +01:00
Janos Follath 06c54000f3 Add test for the entropy safety switch feature. 2016-06-09 13:57:40 +01:00
Janos Follath c4191e475b Make basic-build-test.sh clean up after itself. 2016-06-07 14:52:35 +01:00
Janos Follath 04b591ee79 Merge branch 'development' for weekly test report. 2016-05-31 10:18:41 +01:00
Simon Butcher 9c22e7311c Merge branch 'development' 2016-05-24 13:25:46 +01:00
Simon Butcher 65b1fa6b07 Fixes warnings found by Clang static analyser
Also removes annotations in the code to avoid warnings which don't appear to
be needed.
2016-05-23 23:18:26 +01:00
Simon Butcher 3c0d7b8bdc Adds check for valgrind to ssl-opt.sh (#488)
Provides graceful exit rather than fail silently if valgrind isn't installed.
2016-05-23 14:29:33 +01:00
Simon Butcher 58eddef8b2 Updates copyright and attribution in comment header in ssl-opt.sh 2016-05-23 14:29:32 +01:00
Simon Butcher cbb9075c54 Adds parallel builds to basic-build-test.sh
To speed up test time, added parallel builds
2016-05-23 14:29:32 +01:00
Simon Butcher a410af537a Fixes RC4 config dependencies in tests in ssl-opt.h
Adds dependencies on MBEDTLS_REMOVE_ARC4_CIPHERSUITES for tests that
require RC4 to be disabled (the default config).
2016-05-23 14:29:32 +01:00
Paul Bakker 362689d5a7 Split test into valgrind and no-valgrind version
Running valgrind on: "DTLS client reconnect from same port: reconnect,
nbio" results in timeouts.

New version added that runs only under valgrind. Original only runs when
valgrind is not used
2016-05-23 14:29:32 +01:00
Paul Bakker 1f65092d28 Add fix to ignore valgrind messages related to compressed debug symbols
The glibc package recently enabled compressed debug symbols but valgrind doesn't
support them yet.

Results in messages like:
 --14923-- WARNING: Serious error when reading debug info
 --14923-- When reading debug info from /lib/x86_64-linux-gnu/ld-2.21.so:
 --14923-- Ignoring non-Dwarf2/3/4 block in .debug_info

First line has 'error' in it which triggers some of the ssl-opt tests
2016-05-23 14:29:32 +01:00
Paul Bakker 774180e14e Fix memory-leak in verbose test framework in case of unexpected input 2016-05-23 14:29:31 +01:00
Paul Bakker 26b60bf7d1 Fox verbose test framework not to duplicate strings if not verbose 2016-05-23 14:29:31 +01:00
Paul Bakker a30a72f80f Fix verbose test framework mote to use unmet_dep_count for index 2016-05-23 14:29:31 +01:00
Simon Butcher ae79124905 Disables backtrace config from basic-build-test.sh
The configuration MBEDTLS_MEMORY_BACKTRACE is intended for debug and
is not necessary for test coverage. Because it causes timing problems
in some tests the configuration has been removed as it's not present in
equivalent tests in the all.sh test script.
2016-05-23 14:29:30 +01:00
Simon Butcher a557cfb9ad Widens test bounds on memory alloc tests 2016-05-23 14:29:30 +01:00
Paul Bakker acaac8510e Add option to preserve all logs in ssl-opt.sh
Useful to also allow saving of correct logs in order to compare
differences with failed logs
2016-05-23 14:29:30 +01:00
Paul Bakker e20310a9fc Add option to print test numbers in ssl-opt.sh output
Allows for easy selection of tests based on numbers for use with the
'-n' option
2016-05-23 14:29:30 +01:00
Paul Bakker b7584a5e37 Add ability to only run select numbered tests in ssl-opt.sh
In order to reduce debugging time, allows you to only run interesting
tests (by number) from the commandline.

e.g. the command 'tests/ssl-opt.sh -n 246,258' will only run test 246
and 258 (as per the number in the log file names)
2016-05-23 14:29:30 +01:00
Simon Butcher 4ec1e8193e Widens test parameters in memory alloc tests 2016-05-23 14:29:30 +01:00
SimonB 214f5c0af2 Additional tests to test stack buffer allocator
Adds additional tests to the test suite for
memory_buffer_alloc.c
2016-05-23 14:29:29 +01:00
SimonB 4a3b023172 Adds line numbering in errors for test helpers
Adds to the 'generate_code.pl' tool, support to insert line numbers
before test suite helper code.
2016-05-23 14:29:29 +01:00
SimonB 20273ddc4c Adds reporting of file/line no. in failed tests
Tests in tests/suites will now report the file and line number of
failed test assertions.
2016-05-23 14:29:29 +01:00
SimonB 525b792823 Fixes off by 1 error reported in line number errors 2016-05-23 14:29:29 +01:00
SimonB ab07135165 Adds line number substitution in test cases
Expanded generate_code.pl to substitute !LINE_NO! in test cases.
2016-05-23 14:29:29 +01:00
Nicholas Wilson b19bac4d82 Allow test suites to be run on Windows
For a start, they don't even compile with Visual Studio due to strcasecmp
being missing.  Secondly, on Windows Perl scripts aren't executable and have
to be run using the Perl interpreter directly; thankfully CMake is able to
find cygwin Perl straight away without problems.
2016-05-23 14:29:28 +01:00
Simon Butcher 94bafdf834 Merge branch 'development' 2016-05-18 18:40:46 +01:00
Simon Butcher edb7fd9d76 Fixes stdlib.h dependencies in test suites
Moved stdlib.h in test suites, so platforms that don't support
MBEDTLS_PLATFORM_C would build.
2016-05-17 13:35:51 +01:00
Simon Butcher c21bec8af4 Merge branch 'development' 2016-05-16 16:15:20 +01:00
Paul Bakker b8c8018343 Split test into valgrind and no-valgrind version
Running valgrind on: "DTLS client reconnect from same port: reconnect,
nbio" results in timeouts.

New version added that runs only under valgrind. Original only runs when
valgrind is not used
2016-05-13 10:33:25 +01:00
Paul Bakker 629c1ad398 Add fix to ignore valgrind messages related to compressed debug symbols
The glibc package recently enabled compressed debug symbols but valgrind doesn't
support them yet.

Results in messages like:
 --14923-- WARNING: Serious error when reading debug info
 --14923-- When reading debug info from /lib/x86_64-linux-gnu/ld-2.21.so:
 --14923-- Ignoring non-Dwarf2/3/4 block in .debug_info

First line has 'error' in it which triggers some of the ssl-opt tests
2016-05-13 10:30:46 +01:00
Paul Bakker 53f01199e2 Fix memory-leak in verbose test framework in case of unexpected input 2016-05-12 15:59:48 +01:00
Paul Bakker 2a259c63e3 Fox verbose test framework not to duplicate strings if not verbose 2016-05-12 15:55:37 +01:00
Paul Bakker 6e51915187 Fix verbose test framework mote to use unmet_dep_count for index 2016-05-12 15:52:48 +01:00
Paul Bakker 324258fdc8 Merge pull request #353 from NWilson/win-tests
Allow test suites to be run on Windows
2016-05-11 20:09:13 +02:00
Simon Butcher bc4d9c1faa Disables backtrace config from basic-build-test.sh
The configuration MBEDTLS_MEMORY_BACKTRACE is intended for debug and
is not necessary for test coverage. Because it causes timing problems
in some tests the configuration has been removed as it's not present in
equivalent tests in the all.sh test script.
2016-05-10 21:20:32 +01:00
Simon Butcher 699d7193a1 Disables backtrace config from basic-build-test.sh
The configuration MBEDTLS_MEMORY_BACKTRACE is intended for debug and
is not necessary for test coverage. Because it causes timing problems
in some tests the configuration has been removed as it's not present in
equivalent tests in the all.sh test script.
2016-05-10 21:16:54 +01:00
Simon Butcher 938f65c452 Merge 'development' into development 2016-05-10 20:58:54 +01:00
Simon Butcher e9f25c8a60 Widens test bounds on memory alloc tests 2016-05-10 20:57:03 +01:00
Janos Follath 00efff7469 Add a test for SSLv3 with extensions, server side
This test verifies if the server parses or sends extensions when
the protocol is SSLv3.
2016-05-06 13:57:19 +01:00
Simon Butcher d96924de9c Widens test parameters in memory alloc tests 2016-05-06 00:22:18 +01:00
SimonB a0ed709f05 Additional tests to test stack buffer allocator
Adds additional tests to the test suite for
memory_buffer_alloc.c
2016-05-05 14:25:03 +01:00
SimonB 37f2620db6 Adds line numbering in errors for test helpers
Adds to the 'generate_code.pl' tool, support to insert line numbers
before test suite helper code.
2016-05-05 14:25:03 +01:00
SimonB 31a6c49139 Adds reporting of file/line no. in failed tests
Tests in tests/suites will now report the file and line number of
failed test assertions.
2016-05-05 14:25:03 +01:00
SimonB 43dba3d94e Fixes off by 1 error reported in line number errors 2016-05-05 14:25:03 +01:00
SimonB c1d2eb3fd6 Adds line number substitution in test cases
Expanded generate_code.pl to substitute !LINE_NO! in test cases.
2016-05-05 14:25:03 +01:00
Simon Butcher e4a46f696f Merge branch 'development' 2016-04-27 18:44:37 +01:00
Simon Butcher b2d5dd105d Fixes X509 sample app and SSL test suite
Fixes the X.509 cert_app and the SSL test suite for the non-default
configs which don't build with if MBEDTLS_PLATFORM_C isn't defined.
2016-04-27 13:35:37 +01:00
SimonB 1594210a49 Adds better support to debug generated code
The commit adds to the generate_code.pl script support to add #line directives
to generated code to allow build breaks to be more easily found from the
generated code.
2016-04-26 14:46:56 +01:00
Janos Follath 35d48cb338 Fix missing cleanup in all.sh 2016-04-22 14:45:00 +01:00
Simon Butcher 956420d6e6 Merge branch 'development' 2016-04-19 19:29:09 +01:00
Janos Follath 55abc21521 Fix ci break in builds without platform.h 2016-04-19 15:15:53 +01:00
Simon Butcher 2300776816 Merge branch 'development' 2016-04-19 10:39:36 +01:00
Janos Follath f5e254a9ff Remove unused code from PKCS1v15 test suite 2016-04-18 10:00:55 +01:00
SimonB 8ca7bc42d0 Adds verbose mode to the test suites
Added a verbose option to the generated test suites which can list the
dependencies not met for skipped test cases.
Also clarifies internal interfaces between the main_test.function and test code,
and fixed a bug on calculating available tests in run-test-suites.pl.
2016-04-17 23:24:50 +01:00
SimonB 098a3b5025 Makes basic-build-test.sh test the full config
Previously the test worked on the default configuration which missed deprecated
or legacy features. This change tests the full configuration and all available
tests.
2016-04-16 21:56:59 +01:00
SimonB 2e23c82753 Adds check to avoid overwriting files
Adds check to avoid accidental overwriting of config.h or the yotta module, as
well as a force option to override any changes.
2016-04-16 21:54:39 +01:00
Simon Butcher 3f5c875654 Adds test for odd bit length RSA key size
Also tidy up ChangeLog following review.
2016-04-15 19:06:59 +01:00
Simon Butcher 0914ac47d2 Add missing config dependencies to PKCS1 V15 tests 2016-04-13 14:49:25 +01:00
Simon Butcher f8758b8bdc Adds test_suite_pkcs1_v15 to tests/Makefile 2016-04-12 11:31:00 +01:00
Janos Follath e6aef9fa70 Add tests to cover PKCS1 v1.5 signature functions.
The reported memory leak should have been spotted by
make memcheck
But it wasn't. Keeping the tests for better coverage.
2016-04-11 23:32:26 +01:00
Simon Butcher 58ec0a6af3 Merge branch 'development-restricted' 2016-04-10 15:43:15 +01:00
Simon Butcher 1cabdd573d Merge branch 'development' 2016-04-10 15:41:58 +01:00