Commit graph

9604 commits

Author SHA1 Message Date
Hanno Becker c957e3b5f8 Remove redundant length check during record header parsing
The check is in terms of the internal input buffer length and is
hence likely to be originally intended to protect against overflow
of the input buffer when fetching data from the underlying
transport in mbedtls_ssl_fetch_input(). For locality of reasoning,
it's better to perform such a check close to where it's needed,
and in fact, mbedtls_ssl_fetch_input() _does_ contain an equivalent
bounds check, too, rendering the bounds check in question redundant.
2019-08-14 14:33:39 +01:00
Hanno Becker e2b786d40f Remove misleading comment in mbedtls_ssl_decrypt_buf()
The comment doesn't seem to relate to the code that follows.
2019-08-14 14:33:09 +01:00
Hanno Becker 47ebaa2205 Remove assertion in mbedtls_ssl_decrypt_buf()
mbedtls_ssl_decrypt_buf() asserts that the passed transform is not NULL,
but the function is only invoked in a single place, and this invocation
is clearly visible to be within a branch ensuring that the incoming
transform isn't NULL. Remove the assertion for the benefit of code-size.
2019-08-14 14:32:39 +01:00
Hanno Becker d96e10bf23 Check architectural bound for max record payload len in one place
The previous code performed architectural maximum record length checks
both before and after record decryption. Since MBEDTLS_SSL_IN_CONTENT_LEN
bounds the maximum length of the record plaintext, it suffices to check
only once after (potential) decryption.

This must not be confused with the internal check that the record
length is small enough to make the record fit into the internal input
buffer; this is done in mbedtls_ssl_fetch_input().
2019-08-14 14:31:58 +01:00
Hanno Becker 3be264e2c3 Remove redundant length-0 checks for incoming unprotected records 2019-08-14 14:30:51 +01:00
Jarno Lamsa 31c3b14e37 Documentation fixes according to review
Improve grammar and replace the word 'fresh' with
an explanation what is going to be verified.
2019-08-14 12:00:03 +03:00
Hanno Becker 1f3fe87da3 Remove unused label in ssl_client2/ssl_server2 2019-08-06 11:27:34 +03:00
Hanno Becker 9548f114f3 Add missing word in documentation of mbedtls_ssl_check_record() 2019-08-06 11:27:19 +03:00
Hanno Becker 91f8327e40 cli/srv ex: Add dbg msg if record checking gives inconsistent result 2019-08-06 11:26:55 +03:00
Hanno Becker b7d1dffcc9 Fix minor issues in documentation of mbedtls_ssl_check_record() 2019-08-06 11:26:34 +03:00
Hanno Becker 19f1ef7a10 State that record checking is DTLS only and doesn't check content type 2019-08-06 11:26:05 +03:00
Hanno Becker 7132c4a6c8 Update version_features.c 2019-08-06 11:25:45 +03:00
Hanno Becker 4b6649e67c Pass dgrams to mbedtls_ssl_check_record in ssl_client2/server2 2019-08-06 10:53:28 +03:00
Hanno Becker dcc94e61da Add IO wrappers to ssl_server2 as interm's between NET and SSL layer 2019-08-06 10:29:31 +03:00
Hanno Becker 8b1af2f89c Add IO wrappers to ssl_client2 as interm's between NET and SSL layer 2019-08-06 10:26:33 +03:00
Hanno Becker cfe457921a Introduce configuration option and API for SSL record checking 2019-08-06 10:09:08 +03:00
Gilles Peskine 01655daeee
Merge pull request #2417 from RonEld/2734
Update soon to be expired crl
2019-08-03 13:38:14 +02:00
Gilles Peskine 82966d26c3
Merge pull request #2734 from hanno-arm/skip_test
Add TEST_ASSUME macro to allow skipping tests at runtime
2019-08-03 13:37:51 +02:00
Gilles Peskine 83d49bb84e
Merge pull request #2760 from dgreen-arm/fix-rev-parse-in-abi-script
Change worktree_rev to HEAD for rev-parse
2019-08-03 13:36:52 +02:00
Darryl Green 762351be1b Change worktree_rev to HEAD for rev-parse
Due to how the checking script is run in docker, worktree_rev is
ambiguous when running rev-parse. We're running it in the checked
out worktree, so we can use HEAD instead, which is unambiguous.
2019-07-25 14:33:33 +01:00
Ron Eldor 991a05b411 Add support for all SHA modes in cert_write
Add support for `MBEDTLS_SHA_224` and `MBEDTLS_SHA_384` in
`cert_write`, to support generating such certificates in
`tests/data_files/Makefile`.
2019-07-14 09:17:57 +03:00
Jaeden Amero ff645d9838 Merge remote-tracking branch 'origin/pr/2727' into development
* origin/pr/2727:
  tests: Limit each log to 10 GiB
2019-07-11 16:19:02 +01:00
Jaeden Amero 8306508250 Merge remote-tracking branch 'origin/pr/2660' into development
* origin/pr/2660:
  Fix parsing issue when int parameter is in base 16
  Refactor receive_uint32()
  Refactor get_byte function
  Make the script portable to both pythons
  Update the test encoding to support python3
  update the test script
2019-07-11 16:17:38 +01:00
Jaeden Amero 072959f5c2 Merge remote-tracking branch 'origin/pr/1622' into development
* origin/pr/1622: (29 commits)
  Do not build fuzz on windows
  No booleans and import config
  Removing space before opening parenthesis
  Style corrections
  Syntax fix
  Fixes warnings from MSVC
  Add a linker flag to enable gcov in basic-build-test.sh
  checks MBEDTLS_PEM_PARSE_C
  Restore programs/fuzz/Makefile after in-tree cmake
  Move fuzz directory to programs
  Documentation for corpus generation
  Restore tests/fuzz/Makefile after in-tree cmake
  Adding ifdefs to avoid warnings for unused globals
  Adds LDFLAGS fsanitize=address
  Ignore compiled object files and executables
  Also clean the fuzz subdirectory
  copyediting README.md
  Protecting client/server fuzz targts with ifdefs
  Makefile support 1
  Fuzz README and direct compilation
  ...
2019-07-11 16:17:18 +01:00
Philippe Antoine a864db0dd6 Do not build fuzz on windows 2019-07-10 20:37:57 +02:00
Ron Eldor 9eeb8611b1 Update certificates to expire in 2029
Update certificates that expire on 2021, to prolong their validity,
to make tests pass three years ahead.
2019-07-10 16:46:34 +03:00
Philippe Antoine 42a2ce8255 No booleans and import config 2019-07-10 14:26:31 +02:00
Philippe Antoine a82fdd4763 Removing space before opening parenthesis 2019-07-10 13:53:40 +02:00
Philippe Antoine b3d3127d01 Style corrections 2019-07-10 13:34:51 +02:00
Jaeden Amero 74a87f8b29 Merge remote-tracking branch 'origin/pr/2738' into development
* origin/pr/2738:
  Test with MBEDTLS_ECP_RESTARTABLE
2019-07-10 07:55:25 +01:00
Jaeden Amero 5db519b59a Merge remote-tracking branch 'origin/pr/2730' into development
* origin/pr/2730:
  Allow TODO in code
  Use the docstring in the command line help
2019-07-10 07:55:25 +01:00
Jaeden Amero 98c234ff62 Merge remote-tracking branch 'origin/pr/2729' into development
* origin/pr/2729:
  Split _abi_compliance_command into smaller functions
  Record the commits that were compared
  Document how to build the typical argument for -s
  Allow running /somewhere/else/path/to/abi_check.py
2019-07-10 07:55:25 +01:00
Jaeden Amero 01604a334a Merge remote-tracking branch 'origin/pr/2726' into development
* origin/pr/2726:
  Warn if VLAs are used
  Remove redundant compiler flag
  Consistently spell -Wextra
  Allow declarations after statements
2019-07-10 07:55:25 +01:00
Jaeden Amero 58259fe10c Merge remote-tracking branch 'origin/pr/2721' into development
* origin/pr/2721:
  ChangeLog: Add ChangeLog entry for #2681
2019-07-10 07:55:24 +01:00
Jaeden Amero 150d7749ea Merge remote-tracking branch 'origin/pr/2719' into development
* origin/pr/2719:
  Deref pointer when using sizeof in x509_get_other_name
2019-07-10 07:55:09 +01:00
Jaeden Amero 0b8b5e3393 Merge remote-tracking branch 'origin/pr/2706' into development
* origin/pr/2706:
  Update Mbed Crypto to contain mbed-crypto#152
  CMake: Add a subdirectory build regression test
  README: Enable builds as a CMake subproject
  ChangeLog: Enable builds as a CMake subproject
  Remove use of CMAKE_SOURCE_DIR
2019-07-10 07:54:49 +01:00
Jaeden Amero 6d77d20f3a Merge remote-tracking branch 'origin/pr/2632' into development
* origin/pr/2632:
  Adapt ChangeLog
  Avoid use of large stack buffers in mbedtls_x509_write_crt_pem()
  Improve documentation of mbedtls_pem_write_buffer()
  Perform CRT writing in-place on the output buffer
  Adapt x509write_crt.c to coding style
2019-07-10 07:54:37 +01:00
Jaeden Amero f473fa8fd7 Merge remote-tracking branch 'origin/pr/2455' into development
* origin/pr/2455:
  change .gitignore line endings to UNIX
  Update ChangeLog
  mention .gitignore changes in ChangeLog
  add Visual Studio filters to .gitignore
  update .gitignore to include Visual Studio artifacts
2019-07-10 07:54:06 +01:00
Jaeden Amero b348a3b258 Merge remote-tracking branch 'origin/pr/2314' into development
* origin/pr/2314:
  Improve compatibility with firewalled networks
  Dockerfile: apt -> apt-get
  Change Docker container to bionic
  Clean up file prologue comments
  Add docker-based test scripts
2019-07-10 07:48:31 +01:00
Philippe Antoine 2321945e44 Syntax fix 2019-07-10 08:26:04 +02:00
Philippe Antoine 3e408d59c4 Fixes warnings from MSVC 2019-07-10 01:09:50 +02:00
Philippe Antoine 702c65922f Add a linker flag to enable gcov in basic-build-test.sh 2019-07-09 17:44:53 +02:00
Ron Eldor b7c9626e76 Update soon to be expired crl
Update crl.pem, as it will expire on November 25 2019.
Resolves #2357.
2019-07-09 16:48:09 +03:00
Jaeden Amero 482a479ef0 Merge remote-tracking branch 'origin/pr/2699' into development
* origin/pr/2699:
  Update crypto submodule to a revision with the HAVEGE header changes
  Fix misuse of signed ints in the HAVEGE module
2019-07-05 15:41:39 +01:00
Gilles Peskine 06e752b2c2 Update crypto submodule to a revision with the HAVEGE header changes 2019-07-05 16:36:40 +02:00
Jaeden Amero 0f220ec73b Test with MBEDTLS_ECP_RESTARTABLE
We accidentally disabled testing with MBEDTLS_ECP_RESTARTABLE. Re-enable
testing with restartable ECP when MBEDTLS_USE_PSA_CRYPTO is not set.

Fixes 971dea3745 ("Enable USE_PSA_CRYPTO with config.pl full")
2019-07-05 15:14:57 +01:00
Hanno Becker e69d0150d7 Add TEST_ASSUME macro to allow skipping tests at runtime
This commit adds a macro TEST_ASSUME to the test infrastructure
which allows to skip tests based on unmet conditions determined
at runtime.
2019-07-05 13:39:09 +01:00
Gilles Peskine 55b49ee10f Allow TODO in code
Don't reject TODO in code. Fix #2587
2019-07-04 19:39:06 +02:00
Gilles Peskine 7dfcfceb49 Use the docstring in the command line help 2019-07-04 19:39:06 +02:00
Gilles Peskine ada828f36a Split _abi_compliance_command into smaller functions
This makes the code easier to read and pacifies pylint.
2019-07-04 19:20:35 +02:00