1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00
Commit Graph

56 Commits

Author SHA1 Message Date
20935ebd34 Fix buffer size in an AES example 2019-09-26 11:22:02 +02:00
3abbcedc68 Remove mbedtls_param_failed from programs
All sample and test programs had a definition of mbedtls_param_failed.
This was necessary because we wanted to be able to build them in a
configuration with MBEDTLS_CHECK_PARAMS set but without a definition
of MBEDTLS_PARAM_FAILED. Now that we activate the sample definition of
MBEDTLS_PARAM_FAILED in config.h when testing with
MBEDTLS_CHECK_PARAMS set, this boilerplate code is no longer needed.
2019-06-13 16:51:59 +02:00
3ef6a6dc5c Fix const-ness in mbedtls_param_failed()
The previous prototype gave warnings are the strings produced by #cond and
__FILE__ are const, so we shouldn't implicitly cast them to non-const.

While at it modifying most example programs:
- include the header that has the function declaration, so that the definition
  can be checked to match by the compiler
- fix whitespace
- make it work even if PLATFORM_C is not defined:
    - CHECK_PARAMS is not documented as depending on PLATFORM_C and there is
      no reason why it should
    - so, remove the corresponding #if defined in each program...
    - and add missing #defines for mbedtls_exit when needed

The result has been tested (make all test with -Werror) with the following
configurations:

- full with    CHECK_PARAMS with    PLATFORM_C
- full with    CHECK_PARAMS without PLATFORM_C
- full without CHECK_PARAMS without PLATFORM_C
- full without CHECK_PARAMS with    PLATFORM_C

Additionally, it has been manually tested that adding

    mbedtls_aes_init( NULL );

near the normal call to mbedtls_aes_init() in programs/aes/aescrypt2.c has the
expected effect when running the program.
2018-12-11 12:28:56 +01:00
2c21073789 Remove leftover from testing 2018-12-11 12:28:56 +01:00
63cb97e562 Add handlers for parameter validation in the sample programs
The sample programs require an additional handler function of
mbedtls_param_failed() to handle any failed parameter validation checks enabled
by the MBEDTLS_CHECK_PARAMS config.h option.
2018-12-11 12:28:56 +01:00
0b44d5cc79 Zeroize sensitive data in aescrypt2 and crypt_and_hash examples
This commit replaces multiple `memset()` calls in the example
programs aes/aescrypt2.c and aes/crypt_and_hash.c by calls to
the reliable zeroization function `mbedtls_zeroize()`.

While not a security issue because the code is in the example
programs, it's bad practice and should be fixed.
2018-10-12 16:54:29 +01:00
2c92949e0a Merge remote-tracking branch 'public/pr/1198' into development 2018-07-24 17:20:17 +01:00
2682edf205 Fix build using -std=c99
In each place where POSIX/GNU functions are used, the file must declare
that it wants POSIX functionality before including any system headers.
2018-06-25 12:00:26 +01:00
7d42965ea8 Fix typo in platform macro defines for examples 2018-06-14 23:01:55 +01:00
388c1b124e Fix ret code in aescrypt2.c 2018-06-14 22:59:57 +01:00
840bace417 Correct comment 2017-07-28 22:28:08 +01:00
ce37e6269e Reliably zeroize sensitive data in AES sample application
The AES sample application programs/aes/aescrypt2 could miss zeroizing
the stack-based key buffer in case of an error during operation. This
commit fixes this and also clears another temporary buffer as well as
all command line arguments (one of which might be the key) before exit.
2017-07-28 22:28:08 +01:00
0e7d38739f Fix warning on implicit casting in aescrypt.c (#584) 2016-08-30 14:25:24 +01:00
37ff14062e Change main license to Apache 2.0 2015-09-04 14:21:07 +02:00
6fb8187279 Update date in copyright line 2015-07-28 17:11:58 +02:00
2cf5a7c98e The Great Renaming
A simple execution of tmp/invoke-rename.pl
2015-04-08 13:25:31 +02:00
abb674467b Rename md_init_ctx() to md_setup() 2015-03-25 21:55:56 +01:00
4063ceb281 Make hmac_ctx optional
Note from future self: actually md_init_ctx will be re-introduced with the
same signature later, and a new function with the additional argument will be
added.
2015-03-25 21:55:56 +01:00
003b3b132e Remove use of xxx_hmac() in program 2015-03-25 21:55:56 +01:00
7f8099773e Rename include directory to mbedtls 2015-03-10 11:23:56 +00:00
fe44643b0e Rename website and repository 2015-03-06 13:17:10 +00:00
013bffe5a7 Style: add spaces before line continuation 2015-02-13 14:09:44 +00:00
85b05ec389 Cleanup programs further
removed casting of main args to void
2015-02-13 13:50:05 +00:00
18b78c7498 cleanup programs
Clean up the contents of programs, add more guards to includes, move all
defines to the top of the top of files, remove some unused includes
2015-02-13 13:50:05 +00:00
860b51642d Fix url again 2015-01-28 17:12:07 +00:00
cc334eff3e aescrypt2.c local char array not initial
I change the main() function to a normal function, use many threads call it. so, in concurrent situation, these initial operation is necessary.
2015-01-28 15:28:30 +01:00
7c9e75a836 Remove a few useless #defines 2015-01-28 15:28:29 +01:00
f90016aade Use platform layer in programs for consistency. 2015-01-28 15:28:28 +01:00
085ab040aa Fix website url to use https. 2015-01-23 11:06:27 +00:00
9698f5852c Remove maintainer line. 2015-01-23 10:59:00 +00:00
19f6b5dfaa Remove redundant "all rights reserved" 2015-01-23 10:54:00 +00:00
a658a4051b Update copyright 2015-01-23 09:55:24 +00:00
967a2a5f8c Change name to mbed TLS in the copyright notice 2015-01-22 14:28:16 +00:00
14e8be4d33 Adapted programs / test suites to _init() and _free() 2014-07-09 10:19:23 +02:00
8cfd9d8c59 Adapt programs / test suites to _init() and _free() 2014-07-09 10:19:23 +02:00
cef4ad2509 Adapt sources to configurable config.h name 2014-04-30 16:40:20 +02:00
291f9af935 Make all hash checking in programs constant-time 2013-10-31 14:22:27 +01:00
60b1d10131 Fixed spelling / typos (from PowerDNS:codespell) 2013-10-29 10:02:51 +01:00
abd6e02b7b Rm _CRT_SECURE_NO_DEPRECATE for programs
(Already in config.h.)
2013-09-20 16:51:13 +02:00
d2681d82e2 Renamed sha2.{c,h} to sha256.{c,h} and sha4.{c,h} to sha512.{c,h} 2013-06-30 14:49:12 +02:00
9e36f0475f SHA2 renamed to SHA256, SHA4 renamed to SHA512 and functions accordingly
The SHA4 name was not clear with regards to the new SHA-3 standard. So
SHA2 and SHA4 have been renamed to better represent what they are:
SHA256 and SHA512 modules.
2013-06-30 14:34:05 +02:00
cce9d77745 - Lots of minimal changes to better support WINCE as a build target 2011-11-18 14:26:47 +00:00
5690efccc4 - Fixed a whole bunch of dependencies on defines between files, examples and tests 2011-05-26 13:16:06 +00:00
494c0b8d36 - Changed define from WIN32 to _WIN32 to also support 64-bit windows platforms 2011-04-24 15:30:07 +00:00
23986e5d5d - Major type rewrite of int to size_t for most variables and arguments used for buffer lengths and loops 2011-04-24 08:57:21 +00:00
6d44032cba - Do not close NULL stream 2011-02-06 12:49:19 +00:00
20a7808d13 - Addec crypt_and_hash example program of the generic hash and cipher layers 2011-01-21 09:32:12 +00:00
b96f154e51 - Fixed copyright message 2010-07-18 20:36:00 +00:00
84f12b76fc - Updated Copyright to correct entity 2010-07-18 10:13:04 +00:00
fc8c4360b8 - Updated copyright line to 2010 2010-03-21 17:37:16 +00:00