aboutsummaryrefslogtreecommitdiff
path: root/programs/ssl/ssl_server.c
AgeCommit message (Collapse)AuthorFilesLines
2023-11-02update headersDave Rodgman1-13/+1
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-12Update spelling "mbed TLS" to "Mbed TLS"Gilles Peskine1-1/+1
The official spelling of the trade mark changed from all-lowercase "mbed" to normal proper noun capitalization "Mbed" a few years ago. We've been using the new spelling in new text but still have the old spelling in a lot of text. This commit updates most occurrences of "mbed TLS": ``` sed -i -e 's/mbed TLS/Mbed TLS/g' $(git ls-files ':!ChangeLog' ':!tests/data_files/**' ':!tests/suites/*.data' ':!programs/x509/*' ':!configs/tfm*') ``` Justification for the omissions: * `ChangeLog`: historical text. * `test/data_files/**`, `tests/suites/*.data`, `programs/x509/*`: many occurrences are significant names in certificates and such. Changing the spelling would invalidate many signatures and tests. * `configs/tfm*`: this is an imported file. We'll follow the upstream updates. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-24Add guards for mbedtls_psa_crypto_free()Przemek Stekiel1-0/+2
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-19Free psa crypto at the end of programs when initializedPrzemek Stekiel1-1/+1
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-17Move psa_crypto_init() after other init callsPrzemek Stekiel1-10/+10
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-16Init PSA in ssl and x509 programsPrzemek Stekiel1-0/+10
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-01-11Switch to the new code styleGilles Peskine1-154/+134
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-09-15Include platform.h unconditionally: automatic partGilles Peskine1-12/+0
We used to include platform.h only when MBEDTLS_PLATFORM_C was enabled, and to define ad hoc replacements for mbedtls_xxx functions on a case-by-case basis when MBEDTLS_PLATFORM_C was disabled. The only reason for this complication was to allow building individual source modules without copying platform.h. This is not something we support or recommend anymore, so get rid of the complication: include platform.h unconditionally. There should be no change in behavior since just including the header should not change the behavior of a program. This commit replaces most occurrences of conditional inclusion of platform.h, using the following code: ``` perl -i -0777 -pe 's!#if.*\n#include "mbedtls/platform.h"\n(#else.*\n(#define (mbedtls|MBEDTLS)_.*\n|#include <(stdarg|stddef|stdio|stdlib|string|time)\.h>\n)*)?#endif.*!#include "mbedtls/platform.h"!mg' $(git grep -l '#include "mbedtls/platform.h"') ``` Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-05-06Remove prompt to exit in all programsjosesimoes1-5/+0
Signed-off-by: José Simões <jose.simoes@eclo.solutions>
2021-08-31Allow read-only access to lists of certificates, CRL, CRL entriesGilles Peskine1-1/+1
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-06-28Replace all inclusions of config.hBence Szépkúti1-5/+1
Also remove preprocessor logic for MBEDTLS_CONFIG_FILE, since build_info.h alreadyy handles it. This commit was generated using the following script: # ======================== #!/bin/sh git ls-files | grep -v '^include/mbedtls/build_info\.h$' | xargs sed -b -E -i ' /^#if !?defined\(MBEDTLS_CONFIG_FILE\)/i#include "mbedtls/build_info.h" //,/^#endif/d ' # ======================== Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-06-17Add RNG params to private key parsingManuel Pégourié-Gonnard1-19/+20
This is necessary for the case where the public part of an EC keypair needs to be computed from the private part - either because it was not included (it's an optional component) or because it was compressed (a format we can't parse). This changes the API of two public functions: mbedtls_pk_parse_key() and mbedtls_pk_parse_keyfile(). Tests and programs have been adapted. Some programs use a non-secure RNG (from the test library) just to get things to compile and run; in a future commit this should be improved in order to demonstrate best practice. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-05-27Fix MBEDTLS_PRIVATE wrapping in tests and sample programs.Mateusz Starzyk1-3/+1
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
2021-05-21Add MBEDTLS_PRIVATE wrapping to sample programs.Mateusz Starzyk1-0/+2
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
2021-03-16Remove certs module from mbedtls.Mateusz Starzyk1-9/+8
Certs will be used only by tests and programs. Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
2020-08-19Update copyright notices to use Linux Foundation guidanceBence Szépkúti1-3/+1
As a result, the copyright of contributors other than Arm is now acknowledged, and the years of publishing are no longer tracked in the source files. Also remove the now-redundant lines declaring that the files are part of MbedTLS. This commit was generated using the following script: # ======================== #!/bin/sh # Find files find '(' -path './.git' -o -path './3rdparty' ')' -prune -o -type f -print | xargs sed -bi ' # Replace copyright attribution line s/Copyright.*Arm.*/Copyright The Mbed TLS Contributors/I # Remove redundant declaration and the preceding line $!N /This file is part of Mbed TLS/Id P D ' # ======================== Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2020-05-12Merge pull request #2595 from k-stachowiak/unified-exit-in-examplesGilles Peskine1-2/+2
Unify the example programs' termination
2020-04-22Fix GCC format-signedness warningsKenneth Soerensen1-1/+1
Signed-off-by: Kenneth Soerensen <knnthsrnsn@gmail.com>
2019-08-16Unify the example programs' terminationKrzysztof Stachowiak1-2/+2
This is done to account for platforms, for which we want custom behavior upon the program termination, hence we call `mbedtls_exit()` instead of returning from `main()`.
2019-06-13Remove mbedtls_param_failed from programsGilles Peskine1-11/+0
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.
2018-12-11Fix const-ness in mbedtls_param_failed()Manuel Pégourié-Gonnard1-3/+10
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-11Add handlers for parameter validation in the sample programsSimon Butcher1-0/+8
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-05-15Fix minor code style issuesDarryl Green1-1/+1
2016-09-26Rename net.{c,h} to net_sockets.{c,h}Andres AG1-1/+1
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-04-27Fixes SSL sample apps for non-default configsSimon Butcher1-0/+3
Fixes the SSL sample applications to build for the non-default configs which don't build if MBEDTLS_PLATFORM_C isn't defined.
2015-09-04Change main license to Apache 2.0Manuel Pégourié-Gonnard1-12/+11
2015-07-28Update date in copyright lineManuel Pégourié-Gonnard1-1/+1
2015-06-30Rename mbedtls_net_close() to mbedtls_net_free()Manuel Pégourié-Gonnard1-3/+3
close() may be more meaningful, but free() is symmetric with _init(), and more consistent with all other modules
2015-06-30Adapt programs to the new NET APIManuel Pégourié-Gonnard1-9/+7
2015-06-23Adapt programs to the new debug APIManuel Pégourié-Gonnard1-2/+4
2015-06-23Make 'port' a string in NET moduleManuel Pégourié-Gonnard1-1/+1
- avoids dependency on snprintf - allows using "smtps" instead of "456" if desired
2015-06-17Add SSL presets.Manuel Pégourié-Gonnard1-1/+2
No need to use a separate profile as in X.509, everything we need is already in ssl_config. Just load appropriate values.
2015-05-14Adapt prototype of net_accept() for explicit sizeManuel Pégourié-Gonnard1-1/+2
2015-05-11Fix order of ssl_conf vs ssl_setup in programsManuel Pégourié-Gonnard1-6/+6
Except ssl_phtread_server that will be done later
2015-05-11Rename ssl_set_xxx() to ssl_conf_xxx()Manuel Pégourié-Gonnard1-6/+6
2015-05-11Change ssl_own_cert to work on ssl_configManuel Pégourié-Gonnard1-1/+1
2015-05-11Move ssl_set_rng() to act on configManuel Pégourié-Gonnard1-1/+1
2015-05-11Merge contexts for session cacheManuel Pégourié-Gonnard1-3/+3
2015-05-11Move WANT_READ/WANT_WRITE codes to SSLManuel Pégourié-Gonnard1-5/+5
2015-05-11Rename ssl_set_bio_timeout() to set_bio()Manuel Pégourié-Gonnard1-1/+1
Initially thought it was best to keep the old function around and add a new one, but this so many ssl_set_xxx() functions are changing anyway...
2015-05-11Split ssl_set_read_timeout() out of bio_timeout()Manuel Pégourié-Gonnard1-1/+1
2015-05-11Move ssl_set_ca_chain() to work on configManuel Pégourié-Gonnard1-1/+1
2015-05-07Move easy ssl_set_xxx() functions to work on confManuel Pégourié-Gonnard1-5/+4
mbedtls_ssl_set_alpn_protocols mbedtls_ssl_set_arc4_support mbedtls_ssl_set_authmode mbedtls_ssl_set_ciphersuites mbedtls_ssl_set_ciphersuites_for_version mbedtls_ssl_set_curves mbedtls_ssl_set_dbg mbedtls_ssl_set_dh_param mbedtls_ssl_set_dh_param_ctx mbedtls_ssl_set_dtls_anti_replay mbedtls_ssl_set_dtls_badmac_limit mbedtls_ssl_set_dtls_cookies mbedtls_ssl_set_encrypt_then_mac mbedtls_ssl_set_endpoint mbedtls_ssl_set_extended_master_secret mbedtls_ssl_set_handshake_timeout mbedtls_ssl_legacy_renegotiation mbedtls_ssl_set_max_version mbedtls_ssl_set_min_version mbedtls_ssl_set_psk_cb mbedtls_ssl_set_renegotiation mbedtls_ssl_set_renegotiation_enforced mbedtls_ssl_set_renegotiation_period mbedtls_ssl_set_session_cache mbedtls_ssl_set_session_ticket_lifetime mbedtls_ssl_set_sni mbedtls_ssl_set_transport mbedtls_ssl_set_truncated_hmac mbedtls_ssl_set_verify
2015-05-07Make endpoint+transport args of config_defaults()Manuel Pégourié-Gonnard1-2/+3
2015-05-07Allocate ssl_config out of ssl_setup()Manuel Pégourié-Gonnard1-1/+10
2015-04-29Split ssl_init() -> ssl_setup()Manuel Pégourié-Gonnard1-3/+3
2015-04-29Update ctr_drbg_init() usage in programsManuel Pégourié-Gonnard1-2/+3
2015-04-08The Great RenamingManuel Pégourié-Gonnard1-122/+122
A simple execution of tmp/invoke-rename.pl
2015-03-31Change default min TLS version to TLS 1.0Manuel Pégourié-Gonnard1-3/+0
2015-03-27Avoid duplicate #ifdefs in programs/sslManuel Pégourié-Gonnard1-28/+22