Merge pull request #1 from ARMmbed/development
Update my fork to Github repo
This commit is contained in:
commit
90b50f485e
335 changed files with 16914 additions and 22929 deletions
23
.github/issue_template.md
vendored
23
.github/issue_template.md
vendored
|
@ -1,7 +1,17 @@
|
|||
Note: This is just a template, so feel free to use/remove the unnecessary things
|
||||
_Note:_ this is a template, please remove the parts that are not
|
||||
applicable (these initial notes, and the "Bug" section for a Feature request
|
||||
and vice-versa).
|
||||
|
||||
**Note:** to report a security vulnerability, see
|
||||
[SECURITY.md](../SECURITY.md). Please do not use github issues for
|
||||
vulnerabilities.
|
||||
|
||||
_Note:_ to get support, see [SUPPORT.md](../SUPPORT.md). Please do not use
|
||||
github issues for questions.
|
||||
|
||||
---------------------------------------------------------------
|
||||
### Description
|
||||
- Type: Bug | Enhancement\Feature Request
|
||||
- Type: Bug | Enhancement / Feature Request
|
||||
- Priority: Blocker | Major | Minor
|
||||
|
||||
---------------------------------------------------------------
|
||||
|
@ -28,14 +38,9 @@ Version:
|
|||
**Steps to reproduce**
|
||||
|
||||
----------------------------------------------------------------
|
||||
## Enhancement\Feature Request
|
||||
|
||||
**Justification - why does the library need this feature?**
|
||||
## Enhancement / Feature Request
|
||||
|
||||
**Suggested enhancement**
|
||||
|
||||
-----------------------------------------------------------------
|
||||
**Justification - why does the library need this feature?**
|
||||
|
||||
## Question
|
||||
|
||||
**Please first check for answers in the [Mbed TLS knowledge Base](https://tls.mbed.org/kb). If you can't find the answer you're looking for then please use the [Mbed TLS mailing list](https://lists.trustedfirmware.org/mailman/listinfo/mbed-tls)**
|
||||
|
|
60
BRANCHES.md
Normal file
60
BRANCHES.md
Normal file
|
@ -0,0 +1,60 @@
|
|||
# Maintained branches
|
||||
|
||||
At any point in time, we have a number of maintained branches consisting of:
|
||||
|
||||
- The [`master`](https://github.com/ARMmbed/mbedtls/tree/master) branch:
|
||||
this always contains the latest release, including all publicly available
|
||||
security fixes.
|
||||
- The [`development`](https://github.com/ARMmbed/mbedtls/tree/development) branch:
|
||||
this is where the next major version of Mbed TLS (version 3.0) is being
|
||||
prepared. It has API changes that make it incompatible with Mbed TLS 2.x,
|
||||
as well as all the new features and bug fixes and security fixes.
|
||||
- The [`development_2.x`](https://github.com/ARMmbed/mbedtls/tree/development_2.x) branch:
|
||||
this branch retains the API of Mbed TLS 2.x, and has a subset of the
|
||||
features added after Mbed TLS 2.26.0 and bug fixes and security fixes.
|
||||
- One or more long-time support (LTS) branches:
|
||||
these only get bug fixes and security fixes.
|
||||
|
||||
We use [Semantic Versioning](https://semver.org/). In particular, we maintain
|
||||
API compatibility in the `master` branch between major version changes. We
|
||||
also maintain ABI compatibility within LTS branches; see the next section for
|
||||
details.
|
||||
|
||||
## Backwards Compatibility
|
||||
|
||||
We maintain API compatibility in released versions of Mbed TLS. If you have
|
||||
code that's working and secure with Mbed TLS x.y.z and does not rely on
|
||||
undocumented features, then you should be able to re-compile it without
|
||||
modification with any later release x.y'.z' with the same major version
|
||||
number, and your code will still build, be secure, and work.
|
||||
|
||||
There are rare exceptions: code that was relying on something that became
|
||||
insecure in the meantime (for example, crypto that was found to be weak) may
|
||||
need to be changed. In case security comes in conflict with backwards
|
||||
compatibility, we will put security first, but always attempt to provide a
|
||||
compatibility option.
|
||||
|
||||
For the LTS branches, additionally we try very hard to also maintain ABI
|
||||
compatibility (same definition as API except with re-linking instead of
|
||||
re-compiling) and to avoid any increase in code size or RAM usage, or in the
|
||||
minimum version of tools needed to build the code. The only exception, as
|
||||
before, is in case those goals would conflict with fixing a security issue, we
|
||||
will put security first but provide a compatibility option. (So far we never
|
||||
had to break ABI compatibility in an LTS branch, but we occasionally had to
|
||||
increase code size for a security fix.)
|
||||
|
||||
For contributors, see the [Backwards Compatibility section of
|
||||
CONTRIBUTING](CONTRIBUTING.md#cackwords-compatibility).
|
||||
|
||||
## Current Branches
|
||||
|
||||
The following branches are currently maintained:
|
||||
|
||||
- [master](https://github.com/ARMmbed/mbedtls/tree/master)
|
||||
- [`development`](https://github.com/ARMmbed/mbedtls/)
|
||||
- [`development_2.x`](https://github.com/ARMmbed/mbedtls/tree/development_2.x)
|
||||
- [`mbedtls-2.16`](https://github.com/ARMmbed/mbedtls/tree/mbedtls-2.16)
|
||||
maintained until at least the end of 2021, see
|
||||
<https://tls.mbed.org/tech-updates/blog/announcing-lts-branch-mbedtls-2.16>
|
||||
|
||||
Users are urged to always use the latest version of a maintained branch.
|
20
BUGS.md
Normal file
20
BUGS.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
## Known issues
|
||||
|
||||
Known issues in Mbed TLS are [tracked on GitHub](https://github.com/ARMmbed/mbedtls/issues).
|
||||
|
||||
## Reporting a bug
|
||||
|
||||
If you think you've found a bug in Mbed TLS, please follow these steps:
|
||||
|
||||
1. Make sure you're using the latest version of a
|
||||
[maintained branch](BRANCHES.md): `master`, `development`,
|
||||
or a long-time support branch.
|
||||
2. Check [GitHub](https://github.com/ARMmbed/mbedtls/issues) to see if
|
||||
your issue has already been reported. If not, …
|
||||
3. If the issue is a security risk (for example: buffer overflow,
|
||||
data leak), please report it confidentially as described in
|
||||
[`SECURITY.md`](SECURITY.md). If not, …
|
||||
4. Please [create an issue on on GitHub](https://github.com/ARMmbed/mbedtls/issues).
|
||||
|
||||
Please do not use GitHub for support questions. If you want to know
|
||||
how to do something with Mbed TLS, please see [`SUPPORT.md`](SUPPORT.md) for available documentation and support channels.
|
|
@ -10,10 +10,6 @@
|
|||
# directories. That way, a target linking to a library (using the
|
||||
# target_link_librairies command) inherits from the library PUBLIC include
|
||||
# directories and not from the PRIVATE ones.
|
||||
# + Note: there is currently one remaining include_directories command in the
|
||||
# CMake files. It is related to ZLIB support which is planned to be removed.
|
||||
# When the support is removed, the associated include_directories command
|
||||
# will be removed as well as this note.
|
||||
# - MBEDTLS_TARGET_PREFIX: CMake targets are designed to be alterable by calling
|
||||
# CMake in order to avoid target name clashes, via the use of
|
||||
# MBEDTLS_TARGET_PREFIX. The value of this variable is prefixed to the
|
||||
|
@ -42,9 +38,6 @@ endif()
|
|||
# Set the project root directory.
|
||||
set(MBEDTLS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
option(USE_PKCS11_HELPER_LIBRARY "Build mbed TLS with the pkcs11-helper library." OFF)
|
||||
option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF)
|
||||
|
||||
option(ENABLE_PROGRAMS "Build mbed TLS programs." ON)
|
||||
|
||||
option(UNSAFE_BUILD "Allow unsafe builds. These builds ARE NOT SECURE." OFF)
|
||||
|
@ -198,7 +191,7 @@ if(CMAKE_COMPILER_IS_GNU)
|
|||
endif()
|
||||
endif()
|
||||
if (GCC_VERSION VERSION_GREATER 7.0 OR GCC_VERSION VERSION_EQUAL 7.0)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-overflow=2 -Wformat-truncation=2")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-overflow=2 -Wformat-truncation")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3")
|
||||
|
@ -256,14 +249,6 @@ else()
|
|||
set(LIB_INSTALL_DIR lib)
|
||||
endif()
|
||||
|
||||
if(ENABLE_ZLIB_SUPPORT)
|
||||
find_package(ZLIB)
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
endif(ZLIB_FOUND)
|
||||
endif(ENABLE_ZLIB_SUPPORT)
|
||||
|
||||
add_subdirectory(include)
|
||||
|
||||
add_subdirectory(3rdparty)
|
||||
|
|
|
@ -22,9 +22,10 @@ Making a Contribution
|
|||
1. All new files should include the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) standard license header where possible.
|
||||
1. Ensure that each commit has at least one `Signed-off-by:` line from the committer. If anyone else contributes to the commit, they should also add their own `Signed-off-by:` line. By adding this line, contributor(s) certify that the contribution is made under the terms of the [Developer Certificate of Origin](dco.txt). The contribution licensing is described in the [License section of the README](README.md#License).
|
||||
|
||||
API/ABI Compatibility
|
||||
---------------------
|
||||
The project aims to minimise the impact on users upgrading to newer versions of the library and it should not be necessary for a user to make any changes to their own code to work with a newer version of the library. Unless the user has made an active decision to use newer features, a newer generation of the library or a change has been necessary due to a security issue or other significant software defect, no modifications to their own code should be necessary. To achieve this, API compatibility is maintained between different versions of Mbed TLS on the main development branch and in LTS (Long Term Support) branches.
|
||||
Backwards Compatibility
|
||||
-----------------------
|
||||
|
||||
The project aims to minimise the impact on users upgrading to newer versions of the library and it should not be necessary for a user to make any changes to their own code to work with a newer version of the library. Unless the user has made an active decision to use newer features, a newer generation of the library or a change has been necessary due to a security issue or other significant software defect, no modifications to their own code should be necessary. To achieve this, API compatibility is maintained between different versions of Mbed TLS on the main development branch and in LTS (Long Term Support) branches, as described in [BRANCHES.md](BRANCHES.md).
|
||||
|
||||
To minimise such disruption to users, where a change to the interface is required, all changes to the ABI or API, even on the main development branch where new features are added, need to be justifiable by either being a significant enhancement, new feature or bug fix which is best resolved by an interface change.
|
||||
|
||||
|
@ -48,6 +49,9 @@ When backporting to these branches please observe the following rules:
|
|||
|
||||
It would be highly appreciated if contributions are backported to LTS branches in addition to the [development branch](https://github.com/ARMmbed/mbedtls/tree/development) by contributors.
|
||||
|
||||
The list of maintained branches can be found in the [Current Branches section
|
||||
of BRANCHES.md](BRANCHES.md#current-branches).
|
||||
|
||||
Currently maintained LTS branches are:
|
||||
1. [mbedtls-2.7](https://github.com/ARMmbed/mbedtls/tree/mbedtls-2.7)
|
||||
1. [mbedtls-2.16](https://github.com/ARMmbed/mbedtls/tree/mbedtls-2.16)
|
||||
|
|
93
ChangeLog
93
ChangeLog
|
@ -1,5 +1,98 @@
|
|||
mbed TLS ChangeLog (Sorted per branch, date)
|
||||
|
||||
= Mbed TLS 3.0.0 branch released 2021-xx-xx
|
||||
|
||||
API changes
|
||||
* Remove HAVEGE module.
|
||||
The design of HAVEGE makes it unsuitable for microcontrollers. Platforms
|
||||
with a more complex CPU usually have an operating system interface that
|
||||
provides better randomness. Instead of HAVEGE, declare OS or hardware RNG
|
||||
interfaces with mbedtls_entropy_add_source() and/or use an entropy seed
|
||||
file created securely during device provisioning. See
|
||||
https://tls.mbed.org/kb/how-to/add-entropy-sources-to-entropy-pool for
|
||||
more information.
|
||||
* Add missing const attributes to API functions.
|
||||
* Remove helpers for the transition from Mbed TLS 1.3 to Mbed TLS 2.0: the
|
||||
header compat-1.3.h and the script rename.pl.
|
||||
* Remove certs module from the API.
|
||||
Transfer keys and certificates embedded in the library to the test
|
||||
component. This contributes to minimizing library API and discourages
|
||||
users from using unsafe keys in production.
|
||||
* Move alt helpers and definitions.
|
||||
Various helpers and definitions available for use in alt implementations
|
||||
have been moved out of the include/ directory and into the library/
|
||||
directory. The files concerned are ecp_internal.h and rsa_internal.h
|
||||
which have also been renamed to ecp_alt.h and rsa_alt_helpers.h
|
||||
respectively.
|
||||
* Move internal headers.
|
||||
Header files that were only meant for the library's internal use and
|
||||
were not meant to be used in application code have been moved out of
|
||||
the include/ directory. The headers concerned are bn_mul.h, aesni.h,
|
||||
padlock.h, entropy_poll.h and *_internal.h.
|
||||
* Drop support for parsing SSLv2 ClientHello
|
||||
(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO).
|
||||
* Drop support for SSLv3 (MBEDTLS_SSL_PROTO_SSL3).
|
||||
* Drop support for compatibility with our own previous buggy
|
||||
implementation of truncated HMAC (MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT).
|
||||
* Drop support for TLS record-level compression (MBEDTLS_ZLIB_SUPPORT).
|
||||
* Drop support for RC4 TLS ciphersuites.
|
||||
* Drop support for single-DES ciphersuites.
|
||||
* Drop support for MBEDTLS_SSL_HW_RECORD_ACCEL.
|
||||
|
||||
Requirement changes
|
||||
* The library now uses the %zu format specifier with the printf() family of
|
||||
functions, so requires a toolchain that supports it. This change does not
|
||||
affect the maintained LTS branches, so when contributing changes please
|
||||
bear this in mind and do not add them to backported code.
|
||||
|
||||
Removals
|
||||
* Remove the MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
|
||||
compile-time option, which was off by default. Users should not trust
|
||||
certificates signed with SHA-1 due to the known attacks against SHA-1.
|
||||
If needed, SHA-1 certificates can still be verified by using a custom
|
||||
verification profile.
|
||||
|
||||
* Removed deprecated things in psa/crypto_compat.h. Fixes #4284
|
||||
* Removed deprecated functions from hashing modules. Fixes #4280.
|
||||
* Remove PKCS#11 library wrapper. PKCS#11 has limited functionality,
|
||||
lacks automated tests and has scarce documentation. Also, PSA Crypto
|
||||
provides a more flexible private key management.
|
||||
More details on PCKS#11 wrapper removal can be found in the mailing list
|
||||
https://lists.trustedfirmware.org/pipermail/mbed-tls/2020-April/000024.html
|
||||
* Remove deprecated error codes. Fix #4283
|
||||
|
||||
Features
|
||||
* Add mbedtls_rsa_rsassa_pss_sign_ext() function allowing to generate a
|
||||
signature with a specific salt length. This function allows to validate
|
||||
test cases provided in the NIST's CAVP test suite. Contributed by Cédric
|
||||
Meuter in PR #3183.
|
||||
|
||||
Bugfix
|
||||
* Fix premature fopen() call in mbedtls_entropy_write_seed_file which may
|
||||
lead to the seed file corruption in case if the path to the seed file is
|
||||
equal to MBEDTLS_PLATFORM_STD_NV_SEED_FILE. Contributed by Victor
|
||||
Krasnoshchok in #3616.
|
||||
* PSA functions creating a key now return PSA_ERROR_INVALID_ARGUMENT rather
|
||||
than PSA_ERROR_INVALID_HANDLE when the identifier specified for the key
|
||||
to create is not valid, bringing them in line with version 1.0.0 of the
|
||||
specification. Fix #4271.
|
||||
* Add printf function attributes to mbedtls_debug_print_msg to ensure we
|
||||
get printf format specifier warnings.
|
||||
* PSA functions other than psa_open_key now return PSA_ERROR_INVALID_HANDLE
|
||||
rather than PSA_ERROR_DOES_NOT_EXIST for an invalid handle, bringing them
|
||||
in line with version 1.0.0 of the specification. Fix #4162.
|
||||
* Fix a bug in ECDSA that would cause it to fail when the hash is all-bits
|
||||
zero. Fixes #1792
|
||||
* mbedtls_mpi_read_string on "-0" produced an MPI object that was not treated
|
||||
as equal to 0 in all cases. Fix it to produce the same object as "0".
|
||||
|
||||
Changes
|
||||
* Fix the setting of the read timeout in the DTLS sample programs.
|
||||
* Add extra printf compiler warning flags to builds.
|
||||
* Fix memsan build false positive in x509_crt.c with clang 11
|
||||
* There is ongoing work for the next release (= Mbed TLS 3.0.0 branch to
|
||||
be released 2021-xx-xx), including various API-breaking changes.
|
||||
|
||||
= mbed TLS 2.26.0 branch released 2021-03-08
|
||||
|
||||
API changes
|
||||
|
|
3
ChangeLog.d/add-missing-parenthesis.txt
Normal file
3
ChangeLog.d/add-missing-parenthesis.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Bugfix
|
||||
* Fix a compilation error when MBEDTLS_ECP_RANDOMIZE_MXZ_ALT is
|
||||
defined. Fixes #4217.
|
3
ChangeLog.d/aescrypt2.txt
Normal file
3
ChangeLog.d/aescrypt2.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Changes
|
||||
* Remove the AES sample application programs/aes/aescrypt2 which shows
|
||||
bad cryptographic practice. Fix #1906.
|
3
ChangeLog.d/allow_alt_cmac_without_des.txt
Normal file
3
ChangeLog.d/allow_alt_cmac_without_des.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Changes
|
||||
* Alternative implementations of CMAC may now opt to not support 3DES as a
|
||||
CMAC block cipher, and still pass the CMAC self test.
|
4
ChangeLog.d/dhm_min_bitlen.txt
Normal file
4
ChangeLog.d/dhm_min_bitlen.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
Bugfix
|
||||
* In a TLS client, enforce the Diffie-Hellman minimum parameter size
|
||||
set with mbedtls_ssl_conf_dhm_min_bitlen() precisely. Before, the
|
||||
minimum size was rounded down to the nearest multiple of 8.
|
2
ChangeLog.d/fix-pk-parse-key-error-code.txt
Normal file
2
ChangeLog.d/fix-pk-parse-key-error-code.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Bugfix
|
||||
* Fix an incorrect error code when parsing a PKCS#8 private key.
|
|
@ -1,10 +0,0 @@
|
|||
Bugfix
|
||||
* Add printf function attributes to mbedtls_debug_print_msg to ensure we
|
||||
get printf format specifier warnings.
|
||||
Changes
|
||||
* Add extra printf compiler warning flags to builds.
|
||||
Requirement changes
|
||||
* The library now uses the %zu format specifier with the printf() family of
|
||||
functions, so requires a toolchain that supports it. This change does not
|
||||
affect the maintained LTS branches, so when contributing changes please
|
||||
bear this in mind and do not add them to backported code.
|
|
@ -1,2 +0,0 @@
|
|||
Changes
|
||||
* Fix memsan build false positive in x509_crt.c with clang 11
|
5
ChangeLog.d/issue4036.txt
Normal file
5
ChangeLog.d/issue4036.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
Default behavior changes
|
||||
* Enable by default the functionalities which have no reason to be disabled.
|
||||
They are: ARIA block cipher, CMAC mode, elliptic curve J-PAKE library and
|
||||
Key Wrapping mode as defined in NIST SP 800-38F. Fixes #4036.
|
||||
|
13
ChangeLog.d/issue4282.txt
Normal file
13
ChangeLog.d/issue4282.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
Removals
|
||||
* Remove the following deprecated functions and constants of hex-encoded
|
||||
primes based on RFC 5114 and RFC 3526 from library code and tests:
|
||||
mbedtls_aes_encrypt(), mbedtls_aes_decrypt(), mbedtls_mpi_is_prime(),
|
||||
mbedtls_cipher_auth_encrypt(), mbedtls_cipher_auth_decrypt(),
|
||||
mbedtls_ctr_drbg_update(), mbedtls_hmac_drbg_update(),
|
||||
mbedtls_ecdsa_write_signature_det(), mbedtls_ecdsa_sign_det(),
|
||||
mbedtls_ssl_conf_dh_param(), mbedtls_ssl_get_max_frag_len(),
|
||||
MBEDTLS_DHM_RFC5114_MODP_2048_P, MBEDTLS_DHM_RFC5114_MODP_2048_G,
|
||||
MBEDTLS_DHM_RFC3526_MODP_2048_P, MBEDTLS_DHM_RFC3526_MODP_2048_G,
|
||||
MBEDTLS_DHM_RFC3526_MODP_3072_P, MBEDTLS_DHM_RFC3526_MODP_3072_G,
|
||||
MBEDTLS_DHM_RFC3526_MODP_4096_P, MBEDTLS_DHM_RFC3526_MODP_4096_G.
|
||||
Remove the deprecated file: include/mbedtls/net.h. Fixes #4282.
|
5
ChangeLog.d/psa-aead-output-size-macros-1.0.txt
Normal file
5
ChangeLog.d/psa-aead-output-size-macros-1.0.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
API changes
|
||||
* Update AEAD output size macros to bring them in line with the PSA Crypto
|
||||
API version 1.0 spec. This version of the spec parameterizes them on the
|
||||
key type used, as well as the key bit-size in the case of
|
||||
PSA_AEAD_TAG_LENGTH.
|
4
ChangeLog.d/psa-builtin-keys-implementation.txt
Normal file
4
ChangeLog.d/psa-builtin-keys-implementation.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
Features
|
||||
* Added support for built-in driver keys through the PSA opaque crypto
|
||||
driver interface. Refer to the documentation of
|
||||
MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS for more information.
|
3
ChangeLog.d/remove-config-psa-crypto.txt
Normal file
3
ChangeLog.d/remove-config-psa-crypto.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Changes
|
||||
* Remove configs/config-psa-crypto.h, which no longer had any intended
|
||||
differences from the default configuration, but had accidentally diverged.
|
2
ChangeLog.d/remove-enable-weak-ciphersuites.txt
Normal file
2
ChangeLog.d/remove-enable-weak-ciphersuites.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Removals
|
||||
* Remove MBEDTLS_ENABLE_WEAK_CIPHERSUITES configuration option. Fixes #4416.
|
5
ChangeLog.d/rm-ticket-lifetime-option
Normal file
5
ChangeLog.d/rm-ticket-lifetime-option
Normal file
|
@ -0,0 +1,5 @@
|
|||
Removals
|
||||
* Remove the MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
|
||||
compile-time option. This option has been inactive for a long time.
|
||||
Please use the `lifetime` parameter of `mbedtls_ssl_ticket_setup()`
|
||||
instead.
|
6
ChangeLog.d/x509_remove_info.txt
Normal file
6
ChangeLog.d/x509_remove_info.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
API changes
|
||||
* Add configuration option MBEDTLS_X509_REMOVE_INFO which
|
||||
removes the mbedtls_x509_*_info(), mbedtls_debug_print_crt()
|
||||
as well as other functions and constants only used by
|
||||
those functions. This reduces the code footprint by
|
||||
several kB.
|
4
Makefile
4
Makefile
|
@ -138,11 +138,11 @@ C_SOURCE_FILES = $(wildcard \
|
|||
tests/suites/*.function \
|
||||
)
|
||||
# Exuberant-ctags invocation. Other ctags implementations may require different options.
|
||||
CTAGS = ctags --langmap=c:+.h.function -o
|
||||
CTAGS = ctags --langmap=c:+.h.function --line-directives=no -o
|
||||
tags: $(C_SOURCE_FILES)
|
||||
$(CTAGS) $@ $(C_SOURCE_FILES)
|
||||
TAGS: $(C_SOURCE_FILES)
|
||||
etags -o $@ $(C_SOURCE_FILES)
|
||||
etags --no-line-directive -o $@ $(C_SOURCE_FILES)
|
||||
global: GPATH GRTAGS GSYMS GTAGS
|
||||
GPATH GRTAGS GSYMS GTAGS: $(C_SOURCE_FILES)
|
||||
ls $(C_SOURCE_FILES) | gtags -f - --gtagsconf .globalrc
|
||||
|
|
|
@ -5,6 +5,11 @@ Mbed TLS is a C library that implements cryptographic primitives, X.509 certific
|
|||
|
||||
Mbed TLS includes a reference implementation of the [PSA Cryptography API](#psa-cryptography-api). This is currently a preview for evaluation purposes only.
|
||||
|
||||
Stability
|
||||
---------
|
||||
|
||||
**Warning: the [`development`](https://github.com/ARMmbed/mbedtls/tree/development) branch of Mbed TLS currently has an unstable API.** It is where work is happening on the next major release of Mbed TLS. Until Mbed TLS 3.0 is released, if you need a stable API, please use the branch [`development_2.x`](https://github.com/ARMmbed/mbedtls/tree/development_2.x) instead.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
|
@ -25,6 +30,8 @@ To generate a local copy of the library documentation in HTML format, tailored t
|
|||
1. Run `make apidoc`.
|
||||
1. Browse `apidoc/index.html` or `apidoc/modules.html`.
|
||||
|
||||
For other sources of documentation, see the [SUPPORT](SUPPORT.md) document.
|
||||
|
||||
Compiling
|
||||
---------
|
||||
|
||||
|
|
20
SECURITY.md
Normal file
20
SECURITY.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
## Reporting Vulneratibilities
|
||||
|
||||
If you think you have found an Mbed TLS security vulnerability, then please
|
||||
send an email to the security team at
|
||||
<mbed-tls-security@lists.trustedfirmware.org>.
|
||||
|
||||
## Security Incident Handling Process
|
||||
|
||||
Our security process is detailled in our
|
||||
[security
|
||||
center](https://developer.trustedfirmware.org/w/mbed-tls/security-center/).
|
||||
|
||||
Its primary goal is to ensure fixes are ready to be deployed when the issue
|
||||
goes public.
|
||||
|
||||
## Maintained branches
|
||||
|
||||
Only the maintained branches, as listed in [`BRANCHES.md`](BRANCHES.md),
|
||||
get security fixes.
|
||||
Users are urged to always use the latest version of a maintained branch.
|
15
SUPPORT.md
Normal file
15
SUPPORT.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
## Documentation
|
||||
|
||||
Here are some useful sources of information about using Mbed TLS:
|
||||
|
||||
- API documentation, see the [Documentation section of the
|
||||
README](README.md#License);
|
||||
- the `docs` directory in the source tree;
|
||||
- the [Mbed TLS knowledge Base](https://tls.mbed.org/kb);
|
||||
- the [Mbed TLS mailing-list
|
||||
archives](https://lists.trustedfirmware.org/pipermail/mbed-tls/).
|
||||
|
||||
## Asking Questions
|
||||
|
||||
If you can't find your answer in the above sources, please use the [Mbed TLS
|
||||
mailing list](https://lists.trustedfirmware.org/mailman/listinfo/mbed-tls).
|
|
@ -65,7 +65,6 @@
|
|||
|
||||
/* For test certificates */
|
||||
#define MBEDTLS_BASE64_C
|
||||
#define MBEDTLS_CERTS_C
|
||||
#define MBEDTLS_PEM_PARSE_C
|
||||
|
||||
/* For testing with compat.sh */
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
/* mbed TLS feature support */
|
||||
#define MBEDTLS_CIPHER_MODE_CBC
|
||||
#define MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
||||
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -73,7 +73,6 @@
|
|||
|
||||
/* For test certificates */
|
||||
#define MBEDTLS_BASE64_C
|
||||
#define MBEDTLS_CERTS_C
|
||||
#define MBEDTLS_PEM_PARSE_C
|
||||
|
||||
/* Save RAM at the expense of ROM */
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
#define MBEDTLS_ENTROPY_C
|
||||
#define MBEDTLS_ERROR_C
|
||||
#define MBEDTLS_GCM_C
|
||||
//#define MBEDTLS_HAVEGE_C
|
||||
#define MBEDTLS_HKDF_C
|
||||
#define MBEDTLS_HMAC_DRBG_C
|
||||
#define MBEDTLS_NIST_KW_C
|
||||
|
|
27
docs/3.0-migration-guide.d/00README
Normal file
27
docs/3.0-migration-guide.d/00README
Normal file
|
@ -0,0 +1,27 @@
|
|||
Please add your migration guide entries here. Until 3.0 is released, each PR
|
||||
that makes backwards-incompatible changes should add a file here, with the
|
||||
extension .md, a descriptive name and the following format:
|
||||
|
||||
---%<------%<------%<------%<------%<------%<------%<------%<---
|
||||
|
||||
The change that was made
|
||||
------------------------
|
||||
|
||||
Who exactly is affected: does this affect users of the default config, of a
|
||||
particular feature? Remember to contextualise.
|
||||
|
||||
If I'm affected, what's my migration path? How should I change my code if this
|
||||
is an API change; if a feature was removed what are my alternatives?
|
||||
|
||||
---%<------%<------%<------%<------%<------%<------%<------%<---
|
||||
|
||||
PRs that make multiple independent changes should include one entry for each
|
||||
changes or logical groups of changes. You can either add multiple files or put
|
||||
multiple entries in the same file.
|
||||
|
||||
For examples, have a look a docs/3.0-migration-guide.md (which includes the
|
||||
top-level header and an intro before the list of entries).
|
||||
|
||||
As part of release preparation, the entries in this directory will be appended
|
||||
to docs/3.0-migration-guide.md and then re-ordered and reviewed one last time.
|
||||
The file is then going to be moved to the version-independent docs repo.
|
|
@ -0,0 +1,12 @@
|
|||
Remove the configuration to enable weak ciphersuites in SSL / TLS
|
||||
-----------------------------------------------------------------
|
||||
|
||||
This does not affect users who use the default `config.h`, as this option was
|
||||
already off by default.
|
||||
|
||||
If you were using a weak cipher, please switch to any of the modern,
|
||||
recommended ciphersuites (based on AES-GCM, AES-CCM or ChachaPoly for example)
|
||||
and if your peer doesn't support any, encourage them to upgrade their software.
|
||||
|
||||
If you were using a ciphersuite without encryption, you just have to
|
||||
enable MBEDTLS_CIPHER_NULL_CIPHER now.
|
|
@ -0,0 +1,72 @@
|
|||
Deprecated functions were removed from AES
|
||||
------------------------------------------
|
||||
|
||||
The functions `mbedtls_aes_encrypt()` and `mbedtls_aes_decrypt()` were
|
||||
removed.
|
||||
|
||||
If you're simply using the AES module, you should be calling the higher-level
|
||||
functions `mbedtls_aes_crypt_xxx()`.
|
||||
|
||||
If you're providing an alternative implementation using
|
||||
`MBEDTLS_AES_ENCRYPT_ALT` or `MBEDTLS_AES_DECRYPT_ALT`, you should be
|
||||
replacing the removed functions with `mbedtls_internal_aes_encrypt()` and
|
||||
`mbedtls_internal_aes_decrypt()` respectively.
|
||||
|
||||
Deprecated functions were removed from bignum
|
||||
---------------------------------------------
|
||||
|
||||
The function `mbedtls_mpi_is_prime()` was removed. Please use
|
||||
`mbedtls_mpi_is_prime_ext()` instead which additionally allows specifying the
|
||||
number of Miller-Rabin rounds.
|
||||
|
||||
Deprecated functions were removed from cipher
|
||||
---------------------------------------------
|
||||
|
||||
The functions `mbedtls_cipher_auth_encrypt()` and
|
||||
`mbedtls_cipher_auth_decrypt()` were removed. They were superseded by
|
||||
`mbedtls_cipher_auth_encrypt_ext()` and `mbedtls_cipher_auth_decrypt_ext()`
|
||||
respectively which additionally support key wrapping algorithms such as
|
||||
NIST_KW.
|
||||
|
||||
Deprecated functions were removed from DRBGs
|
||||
--------------------------------------------
|
||||
|
||||
The functions `mbedtls_ctr_drbg_update()` and `mbedtls_hmac_drbg_update()`
|
||||
were removed. They were superseded by `mbedtls_ctr_drbg_update_ret()` and
|
||||
`mbedtls_hmac_drbg_update_ret()` respectively.
|
||||
|
||||
Deprecated functions were removed from ECDSA
|
||||
--------------------------------------------
|
||||
|
||||
The functions `mbedtls_ecdsa_write_signature_det()` and
|
||||
`mbedtls_ecdsa_sign_det()` were removed. They were superseded by
|
||||
`mbedtls_ecdsa_write_signature()` and `mbedtls_ecdsa_sign_det_ext()`
|
||||
respectively.
|
||||
|
||||
Deprecated functions were removed from SSL
|
||||
------------------------------------------
|
||||
|
||||
The function `mbedtls_ssl_conf_dh_param()` was removed. Please use
|
||||
`mbedtls_ssl_conf_dh_param_bin()` or `mbedtls_ssl_conf_dh_param_ctx()` instead.
|
||||
|
||||
The function `mbedtls_ssl_get_max_frag_len()` was removed. Please use
|
||||
`mbedtls_ssl_get_output_max_frag_len()` instead.
|
||||
|
||||
Deprecated hex-encoded primes were removed from DHM
|
||||
---------------------------------------------------
|
||||
|
||||
The macros `MBEDTLS_DHM_RFC5114_MODP_2048_P`, `MBEDTLS_DHM_RFC5114_MODP_2048_G`,
|
||||
`MBEDTLS_DHM_RFC3526_MODP_2048_P`, `MBEDTLS_DHM_RFC3526_MODP_2048_G`,
|
||||
`MBEDTLS_DHM_RFC3526_MODP_3072_P`, `MBEDTLS_DHM_RFC3526_MODP_3072_G`,
|
||||
`MBEDTLS_DHM_RFC3526_MODP_4096_P `and `MBEDTLS_DHM_RFC3526_MODP_4096_G` were
|
||||
removed. The primes from RFC 5114 are deprecated because their derivation is not
|
||||
documented and therefore their usage constitutes a security risk; they are fully
|
||||
removed from the library. Please use parameters from RFC3526 (still in the
|
||||
library, only in binary form) or RFC 7919 (also available in the library) or
|
||||
other trusted sources instead.
|
||||
|
||||
Deprecated net.h file was removed
|
||||
---------------------------------
|
||||
|
||||
The file `include/mbedtls/net.h` was removed because its only function was to
|
||||
include `mbedtls/net_sockets.h` which now should be included directly.
|
222
docs/3.0-migration-guide.md
Normal file
222
docs/3.0-migration-guide.md
Normal file
|
@ -0,0 +1,222 @@
|
|||
Migrating from Mbed TLS 2.x to Mbed TLS 3.0
|
||||
===========================================
|
||||
|
||||
This guide details the steps required to migrate from Mbed TLS version 2.x to
|
||||
Mbed TLS version 3.0 or greater. Unlike normal releases, Mbed TLS 3.0 breaks
|
||||
compatibility with previous versions, so users (and alt implementors) might
|
||||
need to change their own code in order to make it work with Mbed TLS 3.0.
|
||||
|
||||
Here's the list of breaking changes; each entry should help you answer these
|
||||
two questions: (1) am I affected? (2) if yes, what's my migration path?
|
||||
|
||||
Some function parameters were made const
|
||||
----------------------------------------
|
||||
|
||||
Various functions in the PK and ASN.1 modules had a `const` qualifier added to
|
||||
some of their parameters.
|
||||
|
||||
This normally doesn't affect your code, unless you use pointers to reference
|
||||
those functions. In this case, you'll need to update the type of your pointers
|
||||
in order to match the new signature.
|
||||
|
||||
Deprecated functions were removed from hashing modules
|
||||
------------------------------------------------------
|
||||
|
||||
Modules: MD2, MD4, MD5, SHA1, SHA256, SHA512, MD.
|
||||
|
||||
- The functions `mbedtls_xxx_starts()`, `mbedtls_xxx_update()`,
|
||||
`mbedtls_xxx_finish()` and `mbedtls_xxx()` were removed. Please use the
|
||||
function with the same name with `_ret` appended and check the return value.
|
||||
- The function `mbedtls_md_init_ctx()` was removed; please use
|
||||
`mbedtls_md_setup()` instead.
|
||||
- The functions `mbedtls_xxx_process()` were removed. You normally don't need
|
||||
to call that from application code. However if you do (or if you want to
|
||||
provide your own version of that function), please use
|
||||
`mbedtls_internal_xxx_process()` instead, and check the return value.
|
||||
|
||||
Deprecated error codes for hardware failures were removed
|
||||
---------------------------------------------------------
|
||||
|
||||
- The macros `MBEDTLS_ERR_xxx_FEATURE_UNSUPPORTED` from various crypto modules
|
||||
were removed; `MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED` is now used
|
||||
instead.
|
||||
- The macros `MBEDTLS_ERR_xxx_HW_ACCEL_FAILED` from various crypto modules
|
||||
were removed; `MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED` is now used instead.
|
||||
|
||||
Deprecated names for PSA constants and types were removed
|
||||
---------------------------------------------------------
|
||||
|
||||
Some constants and types that were present in beta versions of the PSA Crypto
|
||||
API were removed from version 1.0 of specification. Please switch to the new
|
||||
names provided by the 1.0 specification instead.
|
||||
|
||||
Internal / alt-focused headers were moved to a private location
|
||||
----------------------------------------------------------------
|
||||
|
||||
This shouldn't affect users who took care not to include headers that
|
||||
were documented as internal, despite being in the public include directory.
|
||||
|
||||
If you're providing alt implementations of ECP or RSA, you'll need to add our
|
||||
`library` directory to your include path when building your alt
|
||||
implementations, and note that `ecp_internal.h` and `rsa_internal.h` have been
|
||||
renamed to `ecp_alt.h` and `rsa_alt_helpers.h` respectively.
|
||||
|
||||
If you're a library user and used to rely on having access to a structure or
|
||||
function that's now in a private header, please reach out on the mailing list
|
||||
and explain your need; we'll consider adding a new API in a future version.
|
||||
|
||||
Remove the option to allow SHA-1 by default in certificates
|
||||
-----------------------------------------------------------
|
||||
|
||||
This does not affect users who use the default `config.h`, as this option was
|
||||
already off by default.
|
||||
|
||||
If you used to enable `MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES` in your
|
||||
`config.h`, first please take a moment to consider whether you really still
|
||||
want to accept certificates signed with SHA-1 as those are considered insecure
|
||||
and no CA has issued them for a while. If you really need to allow SHA-1 in
|
||||
certificates, please set up a custom profile as follows:
|
||||
|
||||
```
|
||||
const mbedtls_x509_crt_profile mbedtls_x509_crt_custom = {
|
||||
MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA1 ) |
|
||||
MBEDTLS_X509_ID_FLAG( /* other hash */ ) /* | etc */,
|
||||
0xFFFFFFF, /* Or specific PK algs */
|
||||
0xFFFFFFF, /* Or specific curves */
|
||||
2048 /* Or another RSA min bitlen */
|
||||
};
|
||||
```
|
||||
Then pass it to `mbedtls_x509_crt_verify_with_profile()` if you're verifying
|
||||
a certificate chain directly, or to `mbedtls_ssl_conf_cert_profile()` if the
|
||||
verification happens during a TLS handshake.
|
||||
|
||||
Remove the certs module from the library
|
||||
----------------------------------------
|
||||
|
||||
This should not affect production use of the library, as the certificates and
|
||||
keys included there were never suitable for production use.
|
||||
|
||||
However it might affect you if you relied on them for testing purposes. In
|
||||
that case, please embed your own test certificates in your test code; now that
|
||||
`certs.c` is out of the library there is no longer any stability guaranteed
|
||||
and it may change in incompatible ways at any time.
|
||||
|
||||
Remove the HAVEGE module
|
||||
------------------------
|
||||
|
||||
This doesn't affect people using the default configuration as it was already
|
||||
disabled by default.
|
||||
|
||||
This only affects users who called the HAVEGE modules directly (not
|
||||
recommended), or users who used it through the entropy module but had it as the
|
||||
only source of entropy. If you're in that case, please declare OS or hardware
|
||||
RNG interfaces with `mbedtls_entropy_add_source()` and/or use an entropy seed
|
||||
file created securely during device provisioning. See
|
||||
<https://tls.mbed.org/kb/how-to/add-entropy-sources-to-entropy-pool> for more
|
||||
information.
|
||||
|
||||
Remove support for parsing SSLv2 ClientHello
|
||||
--------------------------------------------
|
||||
|
||||
This doesn't affect people using the default configuration as it was already
|
||||
disabled by default.
|
||||
|
||||
This only affects TLS servers that have clients who send an SSLv2 ClientHello.
|
||||
These days clients are very unlikely to do that. If you have a client that
|
||||
does, please try contacting them and encouraging them to upgrade their
|
||||
software.
|
||||
|
||||
Remove support for SSL 3.0
|
||||
--------------------------
|
||||
|
||||
This doesn't affect people using the default configuration as it was already
|
||||
disabled by default.
|
||||
|
||||
This only affects TLS users who explicitly enabled `MBEDTLS_SSL_PROTO_SSL3`
|
||||
and relied on that version in order to communicate with peers that are not up
|
||||
to date. If one of your peers is in that case, please try contacting them and
|
||||
encouraging them to upgrade their software.
|
||||
|
||||
Remove support for compatibility with old Mbed TLS's truncated HMAC
|
||||
-------------------------------------------------------------------
|
||||
|
||||
This doesn't affect people using the default configuration as it was already
|
||||
disabled by default.
|
||||
|
||||
This only affects TLS users who enabled `MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT` and
|
||||
used the Truncated HMAC extension to communicate with peers using old version
|
||||
of Mbed TLS. Please consider using a CCM-8 ciphersuite instead of the
|
||||
Truncated HMAC extension, or convincing your peer to upgrade their version of
|
||||
Mbed TLS.
|
||||
|
||||
Remove support for TLS record-level compression
|
||||
-----------------------------------------------
|
||||
|
||||
This doesn't affect people using the default configuration as it was already
|
||||
disabled by default.
|
||||
|
||||
This only affects TLS users who enabled `MBEDTLS_ZLIB_SUPPORT`. This will not
|
||||
cause any failures however if you used to enable TLS record-level compression
|
||||
you may find that your bandwidth usage increases without compression. There's
|
||||
no general solution to this problem; application protocols might have their
|
||||
own compression mechanisms and are in a better position than the TLS stack to
|
||||
avoid variants of the CRIME and BREACH attacks.
|
||||
|
||||
Remove support for TLS RC4-based ciphersuites
|
||||
---------------------------------------------
|
||||
|
||||
This does not affect people who used the default `config.h` and the default
|
||||
list of ciphersuites, as RC4-based ciphersuites were already not negotiated in
|
||||
that case.
|
||||
|
||||
Please switch to any of the modern, recommended ciphersuites (based on
|
||||
AES-GCM, AES-CCM or ChachaPoly for example) and if your peer doesn't support
|
||||
any, encourage them to upgrade their software.
|
||||
|
||||
Remove support for TLS single-DES ciphersuites
|
||||
----------------------------------------------
|
||||
|
||||
This doesn't affect people using the default configuration as it was already
|
||||
disabled by default.
|
||||
|
||||
Please switch to any of the modern, recommended ciphersuites (based on
|
||||
AES-GCM, AES-CCM or ChachaPoly for example) and if your peer doesn't support
|
||||
any, encourage them to upgrade their software.
|
||||
|
||||
Remove support for TLS record-level hardware acceleration
|
||||
---------------------------------------------------------
|
||||
|
||||
This doesn't affect people using the default configuration as it was already
|
||||
disabled by default.
|
||||
|
||||
This feature had been broken for a while so we doubt anyone still used it.
|
||||
However if you did, please reach out on the mailing list and let us know about
|
||||
your use case.
|
||||
|
||||
Remove wrapper for libpkcs11-helper
|
||||
-----------------------------------
|
||||
|
||||
This doesn't affect people using the default configuration as it was already
|
||||
disabled by default.
|
||||
|
||||
If you used to rely on this module in order to store your private keys
|
||||
securely, please have a look at the key management facilities provided by the
|
||||
PSA crypto API. If you have a use case that's not covered yet by this API,
|
||||
please reach out on the mailing list.
|
||||
|
||||
Remove config option `MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME`
|
||||
----------------------------------------------------------
|
||||
|
||||
This doesn't affect people using the default configuration.
|
||||
|
||||
This option has not had any effect for a long time. Please use the `lifetime`
|
||||
parameter of `mbedtls_ssl_ticket_setup()` instead.
|
||||
|
||||
Remove helpers for the transition from Mbed TLS 1.3 to Mbed TLS 2.0
|
||||
-------------------------------------------------------------------
|
||||
|
||||
This only affects people who've been using Mbed TLS since before version 2.0
|
||||
and still relied on `compat-1.3.h` in their code.
|
||||
|
||||
Please use the new names directly in your code; `scripts/rename.pl` (from any
|
||||
of the 2.x releases - no longer included in 3.0) might help you do that.
|
|
@ -63,7 +63,7 @@ Key creation implementation in Mbed TLS PSA core is articulated around three int
|
|||
3. Generate or copy the key material into the key slot. This entails the allocation of the buffer to store the key material.
|
||||
4. Call psa_finish_key_creation() that mostly saves persistent keys into persistent storage.
|
||||
|
||||
In case of any error occuring at step 3 or 4, psa_fail_key_creation() is called. It wipes and cleans the slot especially the key material: reset to zero of the RAM memory that contained the key material, free the allocated buffer.
|
||||
In case of any error occurring at step 3 or 4, psa_fail_key_creation() is called. It wipes and cleans the slot especially the key material: reset to zero of the RAM memory that contained the key material, free the allocated buffer.
|
||||
|
||||
|
||||
## Mbed TLS PSA Cryptography API implementation drivers
|
||||
|
|
|
@ -31,7 +31,7 @@ Do not add test-specific interfaces if there's a practical way of doing it anoth
|
|||
|
||||
### Reliance on internal details
|
||||
|
||||
In unit tests and in test programs, it's ok to include header files from `library/`. Do not define non-public interfaces in public headers (`include/mbedtls` has `*_internal.h` headers for legacy reasons, but this approach is deprecated). In contrast, sample programs must not include header files from `library/`.
|
||||
In unit tests and in test programs, it's ok to include internal header files from `library/`. Do not define non-public interfaces in public headers. In contrast, sample programs must not include header files from `library/`.
|
||||
|
||||
Sometimes it makes sense to have unit tests on functions that aren't part of the public API. Declare such functions in `library/*.h` and include the corresponding header in the test code. If the function should be `static` for optimization but can't be `static` for testing, declare it as `MBEDTLS_STATIC_TESTABLE`, and make the tests that use it depend on `MBEDTLS_TEST_HOOKS` (see [“rules for compile-time options”](#rules-for-compile-time-options)).
|
||||
|
||||
|
|
|
@ -47,3 +47,22 @@ together with their level of testing:
|
|||
Those functions are implemented in `library/ssl_tls13_keys.c` and
|
||||
tested in `test_suite_ssl` using test vectors from RFC 8448 and
|
||||
https://tls13.ulfheim.net/.
|
||||
|
||||
- New TLS Message Processing Stack (MPS)
|
||||
|
||||
The TLS 1.3 prototype is developed alongside a rewrite of the TLS messaging layer,
|
||||
encompassing low-level details such as record parsing, handshake reassembly, and
|
||||
DTLS retransmission state machine.
|
||||
|
||||
MPS has the following components:
|
||||
- Layer 1 (Datagram handling)
|
||||
- Layer 2 (Record handling)
|
||||
- Layer 3 (Message handling)
|
||||
- Layer 4 (Retransmission State Machine)
|
||||
- Reader (Abstracted pointer arithmetic and reassembly logic for incoming data)
|
||||
- Writer (Abstracted pointer arithmetic and fragmentation logic for outgoing data)
|
||||
|
||||
Of those components, the following have been upstreamed
|
||||
as part of `MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL`:
|
||||
|
||||
- Reader ([`library/mps_reader.h`](../../library/mps_reader.h))
|
||||
|
|
|
@ -134,7 +134,7 @@ Example 2: the following capability declares that the driver can perform determ
|
|||
"entry_points": ["sign_hash"],
|
||||
"algorithms": ["PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256)",
|
||||
"PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_384)"],
|
||||
"key_types": ["PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP_R1)"],
|
||||
"key_types": ["PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)"],
|
||||
"key_sizes": [256, 384]
|
||||
}
|
||||
```
|
||||
|
@ -164,7 +164,7 @@ The name `_` may be used instead of a curve or group to indicate that the capabi
|
|||
Valid examples:
|
||||
```
|
||||
PSA_KEY_TYPE_AES
|
||||
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP_R1)
|
||||
PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)
|
||||
PSA_KEY_TYPE_ECC_KEY_PAIR(_)
|
||||
```
|
||||
|
||||
|
@ -810,7 +810,7 @@ psa_status_t acme_get_builtin_key(psa_drv_slot_number_t slot_number,
|
|||
|
||||
If this function returns `PSA_SUCCESS` or `PSA_ERROR_BUFFER_TOO_SMALL`, it must fill `attributes` with the attributes of the key (except for the key identifier). On success, this function must also fill `key_buffer` with the key context.
|
||||
|
||||
On entry, `psa_get_key_lifetime(attributes)` is the location at which the driver was declared and the persistence level `#PSA_KEY_LIFETIME_PERSISTENT`. The driver entry point may change the lifetime to one with the same location but a different persistence level. The standard attributes other than the key identifier and lifetime have the value conveyed by `PSA_KEY_ATTRIBUTES_INIT`.
|
||||
On entry, `psa_get_key_lifetime(attributes)` is the location at which the driver was declared and a persistence level with which the platform is attempting to register the key. The driver entry point may choose to change the lifetime (`psa_set_key_lifetime(attributes, lifetime)`) of the reported key attributes to one with the same location but a different persistence level, in case the driver has more specific knowledge about the actual persistence level of the key which is being retrieved. For example, if a driver knows it cannot delete a key, it may override the persistence level in the lifetime to `PSA_KEY_PERSISTENCE_READ_ONLY`. The standard attributes other than the key identifier and lifetime have the value conveyed by `PSA_KEY_ATTRIBUTES_INIT`.
|
||||
|
||||
The output parameter `key_buffer` points to a writable buffer of `key_buffer_size` bytes. If the driver has a [`"builtin_key_size"` property](#key-format-for-opaque-drivers) property, `key_buffer_size` has this value, otherwise `key_buffer_size` has the value determined from the key type and size.
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
*
|
||||
* @section mainpage_modules Modules
|
||||
*
|
||||
* mbed TLS supports SSLv3 up to TLSv1.2 communication by providing the
|
||||
* mbed TLS supports TLSv1.0 up to TLSv1.2 communication by providing the
|
||||
* following:
|
||||
* - TCP/IP communication functions: listen, connect, accept, read/write.
|
||||
* - SSL/TLS communication functions: init, handshake, read/write.
|
||||
|
|
|
@ -32,11 +32,6 @@
|
|||
* source of entropy. For these purposes \c mbedtls_entropy_func() can be used.
|
||||
* This is an implementation based on a simple entropy accumulator design.
|
||||
*
|
||||
* The other number generator that is included is less strong and uses the
|
||||
* HAVEGE (HArdware Volatile Entropy Gathering and Expansion) software heuristic
|
||||
* which considered unsafe for primary usage, but provides additional random
|
||||
* to the entropy pool if enables.
|
||||
*
|
||||
* Meaning that there seems to be no practical algorithm that can guess
|
||||
* the next bit with a probability larger than 1/2 in an output sequence.
|
||||
*
|
||||
|
|
|
@ -710,7 +710,7 @@ EXCLUDE_SYMLINKS = YES
|
|||
# against the file with absolute path, so to exclude all test directories
|
||||
# for example use the pattern */test/*
|
||||
|
||||
EXCLUDE_PATTERNS = *_internal.h *_wrap.h
|
||||
EXCLUDE_PATTERNS =
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
|
|
|
@ -60,12 +60,6 @@
|
|||
/* Error codes in range 0x0021-0x0025 */
|
||||
#define MBEDTLS_ERR_AES_BAD_INPUT_DATA -0x0021 /**< Invalid input data. */
|
||||
|
||||
/* MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE -0x0023 /**< Feature not available. For example, an unsupported AES key size. */
|
||||
|
||||
/* MBEDTLS_ERR_AES_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_AES_HW_ACCEL_FAILED -0x0025 /**< AES hardware accelerator failed. */
|
||||
|
||||
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
|
||||
!defined(inline) && !defined(__cplusplus)
|
||||
#define inline __inline
|
||||
|
@ -617,44 +611,6 @@ int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
|
|||
const unsigned char input[16],
|
||||
unsigned char output[16] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief Deprecated internal AES block encryption function
|
||||
* without return value.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_aes_encrypt()
|
||||
*
|
||||
* \param ctx The AES context to use for encryption.
|
||||
* \param input Plaintext block.
|
||||
* \param output Output (ciphertext) block.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
|
||||
const unsigned char input[16],
|
||||
unsigned char output[16] );
|
||||
|
||||
/**
|
||||
* \brief Deprecated internal AES block decryption function
|
||||
* without return value.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_aes_decrypt()
|
||||
*
|
||||
* \param ctx The AES context to use for decryption.
|
||||
* \param input Ciphertext block.
|
||||
* \param output Output (plaintext) block.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
|
||||
const unsigned char input[16],
|
||||
unsigned char output[16] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
/**
|
||||
* \brief Checkup routine.
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
/* MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED -0x0019 /**< ARC4 hardware accelerator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -47,20 +47,10 @@
|
|||
#define MBEDTLS_ARIA_MAX_ROUNDS 16 /**< Maxiumum number of rounds in ARIA. */
|
||||
#define MBEDTLS_ARIA_MAX_KEYSIZE 32 /**< Maximum size of an ARIA key in bytes. */
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x005C )
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
#define MBEDTLS_ERR_ARIA_BAD_INPUT_DATA -0x005C /**< Bad input data. */
|
||||
|
||||
#define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E /**< Invalid data input length. */
|
||||
|
||||
/* MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE is deprecated and should not be used.
|
||||
*/
|
||||
#define MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE -0x005A /**< Feature not available. For example, an unsupported ARIA key size. */
|
||||
|
||||
/* MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED -0x0058 /**< ARIA hardware accelerator failed. */
|
||||
|
||||
#if !defined(MBEDTLS_ARIA_ALT)
|
||||
// Regular implementation
|
||||
//
|
||||
|
|
|
@ -578,7 +578,7 @@ int mbedtls_asn1_get_alg_null( unsigned char **p,
|
|||
*
|
||||
* \return NULL if not found, or a pointer to the existing entry.
|
||||
*/
|
||||
mbedtls_asn1_named_data *mbedtls_asn1_find_named_data( mbedtls_asn1_named_data *list,
|
||||
const mbedtls_asn1_named_data *mbedtls_asn1_find_named_data( const mbedtls_asn1_named_data *list,
|
||||
const char *oid, size_t len );
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,7 +55,7 @@ extern "C" {
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_len( unsigned char **p, const unsigned char *start,
|
||||
size_t len );
|
||||
/**
|
||||
* \brief Write an ASN.1 tag in ASN.1 format.
|
||||
|
@ -69,7 +69,7 @@ int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_tag( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_tag( unsigned char **p, const unsigned char *start,
|
||||
unsigned char tag );
|
||||
|
||||
/**
|
||||
|
@ -85,7 +85,7 @@ int mbedtls_asn1_write_tag( unsigned char **p, unsigned char *start,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_raw_buffer( unsigned char **p, const unsigned char *start,
|
||||
const unsigned char *buf, size_t size );
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
|
@ -103,7 +103,7 @@ int mbedtls_asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_mpi( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_mpi( unsigned char **p, const unsigned char *start,
|
||||
const mbedtls_mpi *X );
|
||||
#endif /* MBEDTLS_BIGNUM_C */
|
||||
|
||||
|
@ -119,7 +119,7 @@ int mbedtls_asn1_write_mpi( unsigned char **p, unsigned char *start,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_null( unsigned char **p, unsigned char *start );
|
||||
int mbedtls_asn1_write_null( unsigned char **p, const unsigned char *start );
|
||||
|
||||
/**
|
||||
* \brief Write an OID tag (#MBEDTLS_ASN1_OID) and data
|
||||
|
@ -135,7 +135,7 @@ int mbedtls_asn1_write_null( unsigned char **p, unsigned char *start );
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_oid( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_oid( unsigned char **p, const unsigned char *start,
|
||||
const char *oid, size_t oid_len );
|
||||
|
||||
/**
|
||||
|
@ -154,7 +154,7 @@ int mbedtls_asn1_write_oid( unsigned char **p, unsigned char *start,
|
|||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_algorithm_identifier( unsigned char **p,
|
||||
unsigned char *start,
|
||||
const unsigned char *start,
|
||||
const char *oid, size_t oid_len,
|
||||
size_t par_len );
|
||||
|
||||
|
@ -171,7 +171,7 @@ int mbedtls_asn1_write_algorithm_identifier( unsigned char **p,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_bool( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_bool( unsigned char **p, const unsigned char *start,
|
||||
int boolean );
|
||||
|
||||
/**
|
||||
|
@ -188,7 +188,7 @@ int mbedtls_asn1_write_bool( unsigned char **p, unsigned char *start,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int val );
|
||||
int mbedtls_asn1_write_int( unsigned char **p, const unsigned char *start, int val );
|
||||
|
||||
/**
|
||||
* \brief Write an enum tag (#MBEDTLS_ASN1_ENUMERATED) and value
|
||||
|
@ -203,7 +203,7 @@ int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int val );
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_enum( unsigned char **p, unsigned char *start, int val );
|
||||
int mbedtls_asn1_write_enum( unsigned char **p, const unsigned char *start, int val );
|
||||
|
||||
/**
|
||||
* \brief Write a string in ASN.1 format using a specific
|
||||
|
@ -222,7 +222,7 @@ int mbedtls_asn1_write_enum( unsigned char **p, unsigned char *start, int val );
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_tagged_string( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_tagged_string( unsigned char **p, const unsigned char *start,
|
||||
int tag, const char *text,
|
||||
size_t text_len );
|
||||
|
||||
|
@ -242,7 +242,7 @@ int mbedtls_asn1_write_tagged_string( unsigned char **p, unsigned char *start,
|
|||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_printable_string( unsigned char **p,
|
||||
unsigned char *start,
|
||||
const unsigned char *start,
|
||||
const char *text, size_t text_len );
|
||||
|
||||
/**
|
||||
|
@ -260,7 +260,7 @@ int mbedtls_asn1_write_printable_string( unsigned char **p,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_utf8_string( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_utf8_string( unsigned char **p, const unsigned char *start,
|
||||
const char *text, size_t text_len );
|
||||
|
||||
/**
|
||||
|
@ -278,7 +278,7 @@ int mbedtls_asn1_write_utf8_string( unsigned char **p, unsigned char *start,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_ia5_string( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_ia5_string( unsigned char **p, const unsigned char *start,
|
||||
const char *text, size_t text_len );
|
||||
|
||||
/**
|
||||
|
@ -295,7 +295,7 @@ int mbedtls_asn1_write_ia5_string( unsigned char **p, unsigned char *start,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_bitstring( unsigned char **p, const unsigned char *start,
|
||||
const unsigned char *buf, size_t bits );
|
||||
|
||||
/**
|
||||
|
@ -316,7 +316,7 @@ int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start,
|
|||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_named_bitstring( unsigned char **p,
|
||||
unsigned char *start,
|
||||
const unsigned char *start,
|
||||
const unsigned char *buf,
|
||||
size_t bits );
|
||||
|
||||
|
@ -334,7 +334,7 @@ int mbedtls_asn1_write_named_bitstring( unsigned char **p,
|
|||
* \return The number of bytes written to \p p on success.
|
||||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_asn1_write_octet_string( unsigned char **p, unsigned char *start,
|
||||
int mbedtls_asn1_write_octet_string( unsigned char **p, const unsigned char *start,
|
||||
const unsigned char *buf, size_t size );
|
||||
|
||||
/**
|
||||
|
|
|
@ -904,37 +904,6 @@ int mbedtls_mpi_gcd( mbedtls_mpi *G, const mbedtls_mpi *A,
|
|||
int mbedtls_mpi_inv_mod( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *N );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief Perform a Miller-Rabin primality test with error
|
||||
* probability of 2<sup>-80</sup>.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_mpi_is_prime_ext() which allows
|
||||
* specifying the number of Miller-Rabin rounds.
|
||||
*
|
||||
* \param X The MPI to check for primality.
|
||||
* This must point to an initialized MPI.
|
||||
* \param f_rng The RNG function to use. This must not be \c NULL.
|
||||
* \param p_rng The RNG parameter to be passed to \p f_rng.
|
||||
* This may be \c NULL if \p f_rng doesn't use a
|
||||
* context parameter.
|
||||
*
|
||||
* \return \c 0 if successful, i.e. \p X is probably prime.
|
||||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
|
||||
* \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p X is not prime.
|
||||
* \return Another negative error code on other kinds of failure.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED int mbedtls_mpi_is_prime( const mbedtls_mpi *X,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng );
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief Miller-Rabin primality test.
|
||||
*
|
||||
|
|
|
@ -40,17 +40,10 @@
|
|||
#define MBEDTLS_BLOWFISH_ROUNDS 16 /**< Rounds to use. When increasing this value, make sure to extend the initialisation vectors */
|
||||
#define MBEDTLS_BLOWFISH_BLOCKSIZE 8 /* Blowfish uses 64 bit blocks */
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0016 )
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
#define MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA -0x0016 /**< Bad input data. */
|
||||
|
||||
#define MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH -0x0018 /**< Invalid data input length. */
|
||||
|
||||
/* MBEDTLS_ERR_BLOWFISH_HW_ACCEL_FAILED is deprecated and should not be used.
|
||||
*/
|
||||
#define MBEDTLS_ERR_BLOWFISH_HW_ACCEL_FAILED -0x0017 /**< Blowfish hardware accelerator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -36,17 +36,10 @@
|
|||
#define MBEDTLS_CAMELLIA_ENCRYPT 1
|
||||
#define MBEDTLS_CAMELLIA_DECRYPT 0
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( -0x0024 )
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
#define MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA -0x0024 /**< Bad input data. */
|
||||
|
||||
#define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026 /**< Invalid data input length. */
|
||||
|
||||
/* MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED is deprecated and should not be used.
|
||||
*/
|
||||
#define MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED -0x0027 /**< Camellia hardware accelerator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -58,9 +58,6 @@
|
|||
#define MBEDTLS_ERR_CCM_BAD_INPUT -0x000D /**< Bad input parameters to the function. */
|
||||
#define MBEDTLS_ERR_CCM_AUTH_FAILED -0x000F /**< Authenticated decryption failed. */
|
||||
|
||||
/* MBEDTLS_ERR_CCM_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_CCM_HW_ACCEL_FAILED -0x0011 /**< CCM hardware accelerator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -43,14 +43,6 @@
|
|||
|
||||
#define MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA -0x0051 /**< Invalid input parameter(s). */
|
||||
|
||||
/* MBEDTLS_ERR_CHACHA20_FEATURE_UNAVAILABLE is deprecated and should not be
|
||||
* used. */
|
||||
#define MBEDTLS_ERR_CHACHA20_FEATURE_UNAVAILABLE -0x0053 /**< Feature not available. For example, s part of the API is not implemented. */
|
||||
|
||||
/* MBEDTLS_ERR_CHACHA20_HW_ACCEL_FAILED is deprecated and should not be used.
|
||||
*/
|
||||
#define MBEDTLS_ERR_CHACHA20_HW_ACCEL_FAILED -0x0055 /**< Chacha20 hardware accelerator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -81,10 +81,6 @@
|
|||
#error "MBEDTLS_DHM_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) && !defined(MBEDTLS_SSL_TRUNCATED_HMAC)
|
||||
#error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CMAC_C) && \
|
||||
!defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C)
|
||||
#error "MBEDTLS_CMAC_C defined, but not all prerequisites"
|
||||
|
@ -210,8 +206,7 @@
|
|||
#error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
|
||||
#endif
|
||||
#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
|
||||
( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
|
||||
defined(MBEDTLS_HAVEGE_C) )
|
||||
( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) )
|
||||
#error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
|
||||
#endif
|
||||
|
||||
|
@ -256,10 +251,6 @@
|
|||
#error "MBEDTLS_ECP_NO_FALLBACK defined, but no alternative implementation enabled"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
|
||||
#error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
|
||||
#error "MBEDTLS_HKDF_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
@ -371,18 +362,6 @@
|
|||
#error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
|
||||
#error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PKCS11_C)
|
||||
#if defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#error "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
|
||||
#elif defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#warning "MBEDTLS_PKCS11_C is deprecated and will be removed in a future version of Mbed TLS"
|
||||
#endif
|
||||
#endif /* MBEDTLS_PKCS11_C */
|
||||
|
||||
#if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
|
||||
#error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
|
||||
#endif
|
||||
|
@ -643,11 +622,6 @@
|
|||
#error "MBEDTLS_SHA512_NO_SHA384 defined without MBEDTLS_SHA512_C"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) || \
|
||||
!defined(MBEDTLS_SHA1_C) )
|
||||
#error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) || \
|
||||
!defined(MBEDTLS_SHA1_C) )
|
||||
#error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
|
||||
|
@ -668,8 +642,8 @@
|
|||
#error "MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if (defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
|
||||
defined(MBEDTLS_SSL_PROTO_TLS1_1) || defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \
|
||||
#if (defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) ||\
|
||||
defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \
|
||||
!(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
|
||||
defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
|
||||
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
|
||||
|
@ -704,28 +678,16 @@
|
|||
#error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
|
||||
!defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
|
||||
!defined(MBEDTLS_SSL_PROTO_TLS1_2))
|
||||
#if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_TLS1) && \
|
||||
!defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1_2))
|
||||
#error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
|
||||
defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
|
||||
#error "Illegal protocol selection"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
|
||||
defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
|
||||
#error "Illegal protocol selection"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
|
||||
defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
|
||||
!defined(MBEDTLS_SSL_PROTO_TLS1_1)))
|
||||
#error "Illegal protocol selection"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
#error "MBEDTLS_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"
|
||||
#endif
|
||||
|
@ -780,8 +742,7 @@
|
|||
#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
|
||||
!defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
|
||||
#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && !defined(MBEDTLS_SSL_PROTO_TLS1)
|
||||
#error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
|
@ -829,10 +790,6 @@
|
|||
#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CERTS_C) && !defined(MBEDTLS_X509_USE_C)
|
||||
#error "MBEDTLS_CERTS_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
|
||||
#error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
@ -862,30 +819,6 @@
|
|||
#error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
|
||||
#endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_SSL3)
|
||||
#if defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#error "MBEDTLS_SSL_PROTO_SSL3 is deprecated and will be removed in a future version of Mbed TLS"
|
||||
#elif defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#warning "MBEDTLS_SSL_PROTO_SSL3 is deprecated and will be removed in a future version of Mbed TLS"
|
||||
#endif
|
||||
#endif /* MBEDTLS_SSL_PROTO_SSL3 */
|
||||
|
||||
#if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO)
|
||||
#if defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#error "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO is deprecated and will be removed in a future version of Mbed TLS"
|
||||
#elif defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#warning "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO is deprecated and will be removed in a future version of Mbed TLS"
|
||||
#endif
|
||||
#endif /* MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO */
|
||||
|
||||
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
|
||||
#if defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#error "MBEDTLS_SSL_HW_RECORD_ACCEL is deprecated and will be removed in a future version of Mbed TLS"
|
||||
#elif defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#warning "MBEDTLS_SSL_HW_RECORD_ACCEL is deprecated and will be removed in a future version of Mbed TLS"
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
|
||||
|
||||
#if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) )
|
||||
#error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites"
|
||||
#endif
|
||||
|
@ -894,6 +827,40 @@
|
|||
#error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Reject attempts to enable options that have been removed and that could
|
||||
* cause a build to succeed but with features removed. */
|
||||
|
||||
#if defined(MBEDTLS_HAVEGE_C) //no-check-names
|
||||
#error "MBEDTLS_HAVEGE_C was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/2599"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL) //no-check-names
|
||||
#error "MBEDTLS_SSL_HW_RECORD_ACCEL was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_SSL3) //no-check-names
|
||||
#error "MBEDTLS_SSL_PROTO_SSL3 (SSL v3.0 support) was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO) //no-check-names
|
||||
#error "MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO (SSL v2 ClientHello support) was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) //no-check-names
|
||||
#error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT (compatibility with the buggy implementation of truncated HMAC in Mbed TLS up to 2.7) was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES) //no-check-names
|
||||
#error "MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES was removed in Mbed TLS 3.0. See the ChangeLog entry if you really need SHA-1-signed certificates."
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ZLIB_SUPPORT) //no-check-names
|
||||
#error "MBEDTLS_ZLIB_SUPPORT was removed in Mbed TLS 3.0. See https://github.com/ARMmbed/mbedtls/issues/4031"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Avoid warning from -pedantic. This is a convenient place for this
|
||||
* workaround since this is included by every single file before the
|
||||
|
|
|
@ -62,9 +62,6 @@
|
|||
#define MBEDTLS_ERR_CIPHER_AUTH_FAILED -0x6300 /**< Authentication failed (for AEAD modes). */
|
||||
#define MBEDTLS_ERR_CIPHER_INVALID_CONTEXT -0x6380 /**< The context is invalid. For example, because it was freed. */
|
||||
|
||||
/* MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED -0x6400 /**< Cipher hardware accelerator failed. */
|
||||
|
||||
#define MBEDTLS_CIPHER_VARIABLE_IV_LEN 0x01 /**< Cipher accepts IVs of variable length. */
|
||||
#define MBEDTLS_CIPHER_VARIABLE_KEY_LEN 0x02 /**< Cipher accepts keys of variable length. */
|
||||
|
||||
|
@ -229,13 +226,13 @@ enum {
|
|||
/** Maximum length of any IV, in Bytes. */
|
||||
/* This should ideally be derived automatically from list of ciphers.
|
||||
* This should be kept in sync with MBEDTLS_SSL_MAX_IV_LENGTH defined
|
||||
* in ssl_internal.h. */
|
||||
* in library/ssl_misc.h. */
|
||||
#define MBEDTLS_MAX_IV_LENGTH 16
|
||||
|
||||
/** Maximum block size of any cipher, in Bytes. */
|
||||
/* This should ideally be derived automatically from list of ciphers.
|
||||
* This should be kept in sync with MBEDTLS_SSL_MAX_BLOCK_LENGTH defined
|
||||
* in ssl_internal.h. */
|
||||
* in library/ssl_misc.h. */
|
||||
#define MBEDTLS_MAX_BLOCK_LENGTH 16
|
||||
|
||||
/** Maximum key length, in Bytes. */
|
||||
|
@ -243,7 +240,7 @@ enum {
|
|||
* For now, only check whether XTS is enabled which uses 64 Byte keys,
|
||||
* and use 32 Bytes as an upper bound for the maximum key length otherwise.
|
||||
* This should be kept in sync with MBEDTLS_SSL_MAX_BLOCK_LENGTH defined
|
||||
* in ssl_internal.h, which however deliberately ignores the case of XTS
|
||||
* in library/ssl_misc.h, which however deliberately ignores the case of XTS
|
||||
* since the latter isn't used in SSL/TLS. */
|
||||
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
||||
#define MBEDTLS_MAX_KEY_LENGTH 64
|
||||
|
@ -470,8 +467,8 @@ int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx,
|
|||
* \param cipher_info The cipher to use.
|
||||
* \param taglen For AEAD ciphers, the length in bytes of the
|
||||
* authentication tag to use. Subsequent uses of
|
||||
* mbedtls_cipher_auth_encrypt() or
|
||||
* mbedtls_cipher_auth_decrypt() must provide
|
||||
* mbedtls_cipher_auth_encrypt_ext() or
|
||||
* mbedtls_cipher_auth_decrypt_ext() must provide
|
||||
* the same tag length.
|
||||
* For non-AEAD ciphers, the value must be \c 0.
|
||||
*
|
||||
|
@ -856,129 +853,6 @@ int mbedtls_cipher_crypt( mbedtls_cipher_context_t *ctx,
|
|||
const unsigned char *input, size_t ilen,
|
||||
unsigned char *output, size_t *olen );
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_AEAD)
|
||||
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif /* MBEDTLS_DEPRECATED_WARNING */
|
||||
/**
|
||||
* \brief The generic authenticated encryption (AEAD) function.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_cipher_auth_encrypt_ext().
|
||||
*
|
||||
* \note This function only supports AEAD algorithms, not key
|
||||
* wrapping algorithms such as NIST_KW; for this, see
|
||||
* mbedtls_cipher_auth_encrypt_ext().
|
||||
*
|
||||
* \param ctx The generic cipher context. This must be initialized and
|
||||
* bound to a key associated with an AEAD algorithm.
|
||||
* \param iv The nonce to use. This must be a readable buffer of
|
||||
* at least \p iv_len Bytes and must not be \c NULL.
|
||||
* \param iv_len The length of the nonce. This must satisfy the
|
||||
* constraints imposed by the AEAD cipher used.
|
||||
* \param ad The additional data to authenticate. This must be a
|
||||
* readable buffer of at least \p ad_len Bytes, and may
|
||||
* be \c NULL is \p ad_len is \c 0.
|
||||
* \param ad_len The length of \p ad.
|
||||
* \param input The buffer holding the input data. This must be a
|
||||
* readable buffer of at least \p ilen Bytes, and may be
|
||||
* \c NULL if \p ilen is \c 0.
|
||||
* \param ilen The length of the input data.
|
||||
* \param output The buffer for the output data. This must be a
|
||||
* writable buffer of at least \p ilen Bytes, and must
|
||||
* not be \c NULL.
|
||||
* \param olen This will be filled with the actual number of Bytes
|
||||
* written to the \p output buffer. This must point to a
|
||||
* writable object of type \c size_t.
|
||||
* \param tag The buffer for the authentication tag. This must be a
|
||||
* writable buffer of at least \p tag_len Bytes. See note
|
||||
* below regarding restrictions with PSA-based contexts.
|
||||
* \param tag_len The desired length of the authentication tag. This
|
||||
* must match the constraints imposed by the AEAD cipher
|
||||
* used, and in particular must not be \c 0.
|
||||
*
|
||||
* \note If the context is based on PSA (that is, it was set up
|
||||
* with mbedtls_cipher_setup_psa()), then it is required
|
||||
* that \c tag == output + ilen. That is, the tag must be
|
||||
* appended to the ciphertext as recommended by RFC 5116.
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
* \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
|
||||
* parameter-verification failure.
|
||||
* \return A cipher-specific error code on failure.
|
||||
*/
|
||||
int mbedtls_cipher_auth_encrypt( mbedtls_cipher_context_t *ctx,
|
||||
const unsigned char *iv, size_t iv_len,
|
||||
const unsigned char *ad, size_t ad_len,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char *output, size_t *olen,
|
||||
unsigned char *tag, size_t tag_len )
|
||||
MBEDTLS_DEPRECATED;
|
||||
|
||||
/**
|
||||
* \brief The generic authenticated decryption (AEAD) function.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_cipher_auth_decrypt_ext().
|
||||
*
|
||||
* \note This function only supports AEAD algorithms, not key
|
||||
* wrapping algorithms such as NIST_KW; for this, see
|
||||
* mbedtls_cipher_auth_decrypt_ext().
|
||||
*
|
||||
* \note If the data is not authentic, then the output buffer
|
||||
* is zeroed out to prevent the unauthentic plaintext being
|
||||
* used, making this interface safer.
|
||||
*
|
||||
* \param ctx The generic cipher context. This must be initialized and
|
||||
* bound to a key associated with an AEAD algorithm.
|
||||
* \param iv The nonce to use. This must be a readable buffer of
|
||||
* at least \p iv_len Bytes and must not be \c NULL.
|
||||
* \param iv_len The length of the nonce. This must satisfy the
|
||||
* constraints imposed by the AEAD cipher used.
|
||||
* \param ad The additional data to authenticate. This must be a
|
||||
* readable buffer of at least \p ad_len Bytes, and may
|
||||
* be \c NULL is \p ad_len is \c 0.
|
||||
* \param ad_len The length of \p ad.
|
||||
* \param input The buffer holding the input data. This must be a
|
||||
* readable buffer of at least \p ilen Bytes, and may be
|
||||
* \c NULL if \p ilen is \c 0.
|
||||
* \param ilen The length of the input data.
|
||||
* \param output The buffer for the output data. This must be a
|
||||
* writable buffer of at least \p ilen Bytes, and must
|
||||
* not be \c NULL.
|
||||
* \param olen This will be filled with the actual number of Bytes
|
||||
* written to the \p output buffer. This must point to a
|
||||
* writable object of type \c size_t.
|
||||
* \param tag The buffer for the authentication tag. This must be a
|
||||
* readable buffer of at least \p tag_len Bytes. See note
|
||||
* below regarding restrictions with PSA-based contexts.
|
||||
* \param tag_len The length of the authentication tag. This must match
|
||||
* the constraints imposed by the AEAD cipher used, and in
|
||||
* particular must not be \c 0.
|
||||
*
|
||||
* \note If the context is based on PSA (that is, it was set up
|
||||
* with mbedtls_cipher_setup_psa()), then it is required
|
||||
* that \c tag == input + len. That is, the tag must be
|
||||
* appended to the ciphertext as recommended by RFC 5116.
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
* \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
|
||||
* parameter-verification failure.
|
||||
* \return #MBEDTLS_ERR_CIPHER_AUTH_FAILED if data is not authentic.
|
||||
* \return A cipher-specific error code on failure.
|
||||
*/
|
||||
int mbedtls_cipher_auth_decrypt( mbedtls_cipher_context_t *ctx,
|
||||
const unsigned char *iv, size_t iv_len,
|
||||
const unsigned char *ad, size_t ad_len,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char *output, size_t *olen,
|
||||
const unsigned char *tag, size_t tag_len )
|
||||
MBEDTLS_DEPRECATED;
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
#endif /* MBEDTLS_CIPHER_MODE_AEAD */
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_AEAD) || defined(MBEDTLS_NIST_KW_C)
|
||||
/**
|
||||
* \brief The authenticated encryption (AEAD/NIST_KW) function.
|
||||
|
|
|
@ -38,9 +38,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* MBEDTLS_ERR_CMAC_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_CMAC_HW_ACCEL_FAILED -0x007A /**< CMAC hardware accelerator failed. */
|
||||
|
||||
#define MBEDTLS_AES_BLOCK_SIZE 16
|
||||
#define MBEDTLS_DES3_BLOCK_SIZE 8
|
||||
|
||||
|
@ -77,6 +74,12 @@ struct mbedtls_cmac_context_t
|
|||
* the input data.
|
||||
* Must be called with an initialized cipher context.
|
||||
*
|
||||
* \note When the CMAC implementation is supplied by an alternate
|
||||
* implementation (through #MBEDTLS_CMAC_ALT), some ciphers
|
||||
* may not be supported by that implementation, and thus
|
||||
* return an error. Alternate implementations must support
|
||||
* AES-128 and AES-256, and may support AES-192 and 3DES.
|
||||
*
|
||||
* \param ctx The cipher context used for the CMAC operation, initialized
|
||||
* as one of the following types: MBEDTLS_CIPHER_AES_128_ECB,
|
||||
* MBEDTLS_CIPHER_AES_192_ECB, MBEDTLS_CIPHER_AES_256_ECB,
|
||||
|
@ -154,6 +157,11 @@ int mbedtls_cipher_cmac_reset( mbedtls_cipher_context_t *ctx );
|
|||
* The CMAC result is calculated as
|
||||
* output = generic CMAC(cmac key, input buffer).
|
||||
*
|
||||
* \note When the CMAC implementation is supplied by an alternate
|
||||
* implementation (through #MBEDTLS_CMAC_ALT), some ciphers
|
||||
* may not be supported by that implementation, and thus
|
||||
* return an error. Alternate implementations must support
|
||||
* AES-128 and AES-256, and may support AES-192 and 3DES.
|
||||
*
|
||||
* \param cipher_info The cipher information.
|
||||
* \param key The CMAC key.
|
||||
|
@ -198,6 +206,13 @@ int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_len,
|
|||
/**
|
||||
* \brief The CMAC checkup routine.
|
||||
*
|
||||
* \note In case the CMAC routines are provided by an alternative
|
||||
* implementation (i.e. #MBEDTLS_CMAC_ALT is defined), the
|
||||
* checkup routine will succeed even if the implementation does
|
||||
* not support the less widely used AES-192 or 3DES primitives.
|
||||
* The self-test requires at least AES-128 and AES-256 to be
|
||||
* supported by the underlying implementation.
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
* \return \c 1 on failure.
|
||||
*/
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -48,7 +48,7 @@
|
|||
* Used in:
|
||||
* library/aria.c
|
||||
* library/timing.c
|
||||
* include/mbedtls/bn_mul.h
|
||||
* library/bn_mul.h
|
||||
*
|
||||
* Required by:
|
||||
* MBEDTLS_AESNI_C
|
||||
|
@ -421,12 +421,6 @@
|
|||
* of mbedtls_sha1_context, so your implementation of mbedtls_sha1_process must be compatible
|
||||
* with this definition.
|
||||
*
|
||||
* \note Because of a signature change, the core AES encryption and decryption routines are
|
||||
* currently named mbedtls_aes_internal_encrypt and mbedtls_aes_internal_decrypt,
|
||||
* respectively. When setting up alternative implementations, these functions should
|
||||
* be overridden, but the wrapper functions mbedtls_aes_decrypt and mbedtls_aes_encrypt
|
||||
* must stay untouched.
|
||||
*
|
||||
* \note If you use the AES_xxx_ALT macros, then is is recommended to also set
|
||||
* MBEDTLS_AES_ROM_TABLES in order to help the linker garbage-collect the AES
|
||||
* tables.
|
||||
|
@ -445,9 +439,7 @@
|
|||
* alternative implementations should use the RNG only for generating
|
||||
* the ephemeral key and nothing else. If this is not possible, then
|
||||
* MBEDTLS_ECDSA_DETERMINISTIC should be disabled and an alternative
|
||||
* implementation should be provided for mbedtls_ecdsa_sign_det_ext()
|
||||
* (and for mbedtls_ecdsa_sign_det() too if backward compatibility is
|
||||
* desirable).
|
||||
* implementation should be provided for mbedtls_ecdsa_sign_det_ext().
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_MD2_PROCESS_ALT
|
||||
|
@ -559,7 +551,8 @@
|
|||
* hardware entropy collector.
|
||||
*
|
||||
* Your function must be called \c mbedtls_hardware_poll(), have the same
|
||||
* prototype as declared in entropy_poll.h, and accept NULL as first argument.
|
||||
* prototype as declared in library/entropy_poll.h, and accept NULL as first
|
||||
* argument.
|
||||
*
|
||||
* Uncomment to use your own hardware entropy collector.
|
||||
*/
|
||||
|
@ -658,8 +651,7 @@
|
|||
* Warning: Only do so when you know what you are doing. This allows for
|
||||
* encryption or channels without any security!
|
||||
*
|
||||
* Requires MBEDTLS_ENABLE_WEAK_CIPHERSUITES as well to enable
|
||||
* the following ciphersuites:
|
||||
* To enable the following ciphersuites:
|
||||
* MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA
|
||||
* MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA
|
||||
* MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA
|
||||
|
@ -707,37 +699,6 @@
|
|||
*/
|
||||
//#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_ENABLE_WEAK_CIPHERSUITES
|
||||
*
|
||||
* Enable weak ciphersuites in SSL / TLS.
|
||||
* Warning: Only do so when you know what you are doing. This allows for
|
||||
* channels with virtually no security at all!
|
||||
*
|
||||
* This enables the following ciphersuites:
|
||||
* MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA
|
||||
* MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA
|
||||
*
|
||||
* Uncomment this macro to enable weak ciphersuites
|
||||
*
|
||||
* \warning DES is considered a weak cipher and its use constitutes a
|
||||
* security risk. We recommend considering stronger ciphers instead.
|
||||
*/
|
||||
//#define MBEDTLS_ENABLE_WEAK_CIPHERSUITES
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
*
|
||||
* Remove RC4 ciphersuites by default in SSL / TLS.
|
||||
* This flag removes the ciphersuites based on RC4 from the default list as
|
||||
* returned by mbedtls_ssl_list_ciphersuites(). However, it is still possible to
|
||||
* enable (some of) them with mbedtls_ssl_conf_ciphersuites() by including them
|
||||
* explicitly.
|
||||
*
|
||||
* Uncomment this macro to remove RC4 ciphersuites by default.
|
||||
*/
|
||||
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_REMOVE_3DES_CIPHERSUITES
|
||||
*
|
||||
|
@ -900,7 +861,6 @@
|
|||
* MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
|
||||
* MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
|
||||
* MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_PSK_WITH_RC4_128_SHA
|
||||
*/
|
||||
#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
|
||||
|
@ -924,7 +884,6 @@
|
|||
* MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256
|
||||
* MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
|
||||
* MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA
|
||||
*
|
||||
* \warning Using DHE constitutes a security risk as it
|
||||
* is not possible to validate custom DH parameters.
|
||||
|
@ -951,7 +910,6 @@
|
|||
* MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
|
||||
* MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
|
||||
* MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
|
||||
*/
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
|
||||
|
||||
|
@ -976,7 +934,6 @@
|
|||
* MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256
|
||||
* MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256
|
||||
* MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
|
||||
*/
|
||||
#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
|
||||
|
||||
|
@ -1003,8 +960,6 @@
|
|||
* MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
|
||||
* MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
|
||||
* MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_RSA_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_RSA_WITH_RC4_128_MD5
|
||||
*/
|
||||
#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
|
||||
|
||||
|
@ -1062,7 +1017,6 @@
|
|||
* MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
|
||||
* MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
|
||||
* MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA
|
||||
*/
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
|
||||
|
||||
|
@ -1086,7 +1040,6 @@
|
|||
* MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
|
||||
* MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
|
||||
* MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
|
||||
*/
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
|
@ -1099,7 +1052,6 @@
|
|||
*
|
||||
* This enables the following ciphersuites (if other requisites are
|
||||
* enabled as well):
|
||||
* MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
|
||||
* MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
|
||||
|
@ -1123,7 +1075,6 @@
|
|||
*
|
||||
* This enables the following ciphersuites (if other requisites are
|
||||
* enabled as well):
|
||||
* MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
|
||||
* MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
|
||||
* MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
|
||||
|
@ -1205,8 +1156,8 @@
|
|||
/**
|
||||
* \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
|
||||
*
|
||||
* Do not add default entropy sources. These are the platform specific,
|
||||
* mbedtls_timing_hardclock and HAVEGE based poll functions.
|
||||
* Do not add default entropy sources. These are the platform specific
|
||||
* or mbedtls_timing_hardclock poll function.
|
||||
*
|
||||
* This is useful to have more control over the added entropy sources in an
|
||||
* application.
|
||||
|
@ -1338,6 +1289,22 @@
|
|||
*/
|
||||
#define MBEDTLS_PKCS1_V21
|
||||
|
||||
/** \def MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
|
||||
*
|
||||
* Enable support for platform built-in keys. If you enable this feature,
|
||||
* you must implement the function mbedtls_psa_platform_get_builtin_key().
|
||||
* See the documentation of that function for more information.
|
||||
*
|
||||
* Built-in keys are typically derived from a hardware unique key or
|
||||
* stored in a secure element.
|
||||
*
|
||||
* Requires: MBEDTLS_PSA_CRYPTO_C.
|
||||
*
|
||||
* \warning This interface is experimental and may change or be removed
|
||||
* without notice.
|
||||
*/
|
||||
//#define MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
|
||||
|
||||
/** \def MBEDTLS_PSA_CRYPTO_CLIENT
|
||||
*
|
||||
* Enable support for PSA crypto client.
|
||||
|
@ -1672,23 +1639,10 @@
|
|||
*/
|
||||
#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_HW_RECORD_ACCEL
|
||||
*
|
||||
* Enable hooking functions in SSL module for hardware acceleration of
|
||||
* individual records.
|
||||
*
|
||||
* \deprecated This option is deprecated and will be removed in a future
|
||||
* version of Mbed TLS.
|
||||
*
|
||||
* Uncomment this macro to enable hooking functions.
|
||||
*/
|
||||
//#define MBEDTLS_SSL_HW_RECORD_ACCEL
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_CBC_RECORD_SPLITTING
|
||||
*
|
||||
* Enable 1/n-1 record splitting for CBC mode in SSLv3 and TLS 1.0.
|
||||
* Enable 1/n-1 record splitting for CBC mode in TLS 1.0.
|
||||
*
|
||||
* This is a countermeasure to the BEAST attack, which also minimizes the risk
|
||||
* of interoperability issues compared to sending 0-length records.
|
||||
|
@ -1719,19 +1673,6 @@
|
|||
*/
|
||||
#define MBEDTLS_SSL_RENEGOTIATION
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
|
||||
*
|
||||
* Enable support for receiving and parsing SSLv2 Client Hello messages for the
|
||||
* SSL Server module (MBEDTLS_SSL_SRV_C).
|
||||
*
|
||||
* \deprecated This option is deprecated and will be removed in a future
|
||||
* version of Mbed TLS.
|
||||
*
|
||||
* Uncomment this macro to enable support for SSLv2 Client Hello messages.
|
||||
*/
|
||||
//#define MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
|
||||
*
|
||||
|
@ -1751,21 +1692,6 @@
|
|||
*/
|
||||
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_PROTO_SSL3
|
||||
*
|
||||
* Enable support for SSL 3.0.
|
||||
*
|
||||
* Requires: MBEDTLS_MD5_C
|
||||
* MBEDTLS_SHA1_C
|
||||
*
|
||||
* \deprecated This option is deprecated and will be removed in a future
|
||||
* version of Mbed TLS.
|
||||
*
|
||||
* Comment this macro to disable support for SSL 3.0
|
||||
*/
|
||||
//#define MBEDTLS_SSL_PROTO_SSL3
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_PROTO_TLS1
|
||||
*
|
||||
|
@ -1980,30 +1906,6 @@
|
|||
*/
|
||||
#define MBEDTLS_SSL_TRUNCATED_HMAC
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
|
||||
*
|
||||
* Fallback to old (pre-2.7), non-conforming implementation of the truncated
|
||||
* HMAC extension which also truncates the HMAC key. Note that this option is
|
||||
* only meant for a transitory upgrade period and will be removed in a future
|
||||
* version of the library.
|
||||
*
|
||||
* \warning The old implementation is non-compliant and has a security weakness
|
||||
* (2^80 brute force attack on the HMAC key used for a single,
|
||||
* uninterrupted connection). This should only be enabled temporarily
|
||||
* when (1) the use of truncated HMAC is essential in order to save
|
||||
* bandwidth, and (2) the peer is an Mbed TLS stack that doesn't use
|
||||
* the fixed implementation yet (pre-2.7).
|
||||
*
|
||||
* \deprecated This option is deprecated and will be removed in a
|
||||
* future version of Mbed TLS.
|
||||
*
|
||||
* Uncomment to fallback to old, non-compliant truncated HMAC implementation.
|
||||
*
|
||||
* Requires: MBEDTLS_SSL_TRUNCATED_HMAC
|
||||
*/
|
||||
//#define MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
|
||||
*
|
||||
|
@ -2218,6 +2120,17 @@
|
|||
*/
|
||||
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_X509_REMOVE_INFO
|
||||
*
|
||||
* Disable mbedtls_x509_*_info() and related APIs.
|
||||
*
|
||||
* Uncomment to omit mbedtls_x509_*_info(), as well as mbedtls_debug_print_crt()
|
||||
* and other functions/constants only used by these functions, thus reducing
|
||||
* the code footprint by several KB.
|
||||
*/
|
||||
//#define MBEDTLS_X509_REMOVE_INFO
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_X509_RSASSA_PSS_SUPPORT
|
||||
*
|
||||
|
@ -2227,31 +2140,6 @@
|
|||
* Comment this macro to disallow using RSASSA-PSS in certificates.
|
||||
*/
|
||||
#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_ZLIB_SUPPORT
|
||||
*
|
||||
* If set, the SSL/TLS module uses ZLIB to support compression and
|
||||
* decompression of packet data.
|
||||
*
|
||||
* \warning TLS-level compression MAY REDUCE SECURITY! See for example the
|
||||
* CRIME attack. Before enabling this option, you should examine with care if
|
||||
* CRIME or similar exploits may be applicable to your use case.
|
||||
*
|
||||
* \note Currently compression can't be used with DTLS.
|
||||
*
|
||||
* \deprecated This feature is deprecated and will be removed
|
||||
* in the next major revision of the library.
|
||||
*
|
||||
* Used in: library/ssl_tls.c
|
||||
* library/ssl_cli.c
|
||||
* library/ssl_srv.c
|
||||
*
|
||||
* This feature requires zlib library and headers to be present.
|
||||
*
|
||||
* Uncomment to enable use of ZLIB
|
||||
*/
|
||||
//#define MBEDTLS_ZLIB_SUPPORT
|
||||
/* \} name SECTION: mbed TLS feature support */
|
||||
|
||||
/**
|
||||
|
@ -2360,16 +2248,6 @@
|
|||
*
|
||||
* This module enables the following ciphersuites (if other requisites are
|
||||
* enabled as well):
|
||||
* MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_RSA_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_RSA_WITH_RC4_128_MD5
|
||||
* MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
|
||||
* MBEDTLS_TLS_PSK_WITH_RC4_128_SHA
|
||||
*
|
||||
* \warning ARC4 is considered a weak cipher and its use constitutes a
|
||||
* security risk. If possible, we recommend avoidng dependencies on
|
||||
|
@ -2428,7 +2306,7 @@
|
|||
* library/ecp.c
|
||||
* library/ecdsa.c
|
||||
* library/rsa.c
|
||||
* library/rsa_internal.c
|
||||
* library/rsa_alt_helpers.c
|
||||
* library/ssl_tls.c
|
||||
*
|
||||
* This module is required for RSA, DHM and ECC (ECDH, ECDSA) support.
|
||||
|
@ -2549,7 +2427,7 @@
|
|||
* MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256
|
||||
* MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384
|
||||
*/
|
||||
//#define MBEDTLS_ARIA_C
|
||||
#define MBEDTLS_ARIA_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CCM_C
|
||||
|
@ -2565,18 +2443,6 @@
|
|||
*/
|
||||
#define MBEDTLS_CCM_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CERTS_C
|
||||
*
|
||||
* Enable the test certificates.
|
||||
*
|
||||
* Module: library/certs.c
|
||||
* Caller:
|
||||
*
|
||||
* This module is used for testing (ssl_client/server).
|
||||
*/
|
||||
#define MBEDTLS_CERTS_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CHACHA20_C
|
||||
*
|
||||
|
@ -2615,12 +2481,17 @@
|
|||
* Enable the CMAC (Cipher-based Message Authentication Code) mode for block
|
||||
* ciphers.
|
||||
*
|
||||
* \note When #MBEDTLS_CMAC_ALT is active, meaning that the underlying
|
||||
* implementation of the CMAC algorithm is provided by an alternate
|
||||
* implementation, that alternate implementation may opt to not support
|
||||
* AES-192 or 3DES as underlying block ciphers for the CMAC operation.
|
||||
*
|
||||
* Module: library/cmac.c
|
||||
*
|
||||
* Requires: MBEDTLS_AES_C or MBEDTLS_DES_C
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_CMAC_C
|
||||
#define MBEDTLS_CMAC_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_CTR_DRBG_C
|
||||
|
@ -2744,9 +2615,9 @@
|
|||
*
|
||||
* Enable the elliptic curve J-PAKE library.
|
||||
*
|
||||
* \warning This is currently experimental. EC J-PAKE support is based on the
|
||||
* Thread v1.0.0 specification; incompatible changes to the specification
|
||||
* might still happen. For this reason, this is disabled by default.
|
||||
* \note EC J-PAKE support is based on the Thread v1.0.0 specification.
|
||||
* It has not been reviewed for compliance with newer standards such as
|
||||
* Thread v1.1 or RFC 8236.
|
||||
*
|
||||
* Module: library/ecjpake.c
|
||||
* Caller:
|
||||
|
@ -2756,7 +2627,7 @@
|
|||
*
|
||||
* Requires: MBEDTLS_ECP_C, MBEDTLS_MD_C
|
||||
*/
|
||||
//#define MBEDTLS_ECJPAKE_C
|
||||
#define MBEDTLS_ECJPAKE_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_ECP_C
|
||||
|
@ -2812,29 +2683,6 @@
|
|||
*/
|
||||
#define MBEDTLS_GCM_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_HAVEGE_C
|
||||
*
|
||||
* Enable the HAVEGE random generator.
|
||||
*
|
||||
* Warning: the HAVEGE random generator is not suitable for virtualized
|
||||
* environments
|
||||
*
|
||||
* Warning: the HAVEGE random generator is dependent on timing and specific
|
||||
* processor traits. It is therefore not advised to use HAVEGE as
|
||||
* your applications primary random generator or primary entropy pool
|
||||
* input. As a secondary input to your entropy pool, it IS able add
|
||||
* the (limited) extra entropy it provides.
|
||||
*
|
||||
* Module: library/havege.c
|
||||
* Caller:
|
||||
*
|
||||
* Requires: MBEDTLS_TIMING_C
|
||||
*
|
||||
* Uncomment to enable the HAVEGE random generator.
|
||||
*/
|
||||
//#define MBEDTLS_HAVEGE_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_HKDF_C
|
||||
*
|
||||
|
@ -2875,7 +2723,7 @@
|
|||
*
|
||||
* Requires: MBEDTLS_AES_C and MBEDTLS_CIPHER_C
|
||||
*/
|
||||
//#define MBEDTLS_NIST_KW_C
|
||||
#define MBEDTLS_NIST_KW_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_MD_C
|
||||
|
@ -3109,24 +2957,6 @@
|
|||
*/
|
||||
#define MBEDTLS_PKCS5_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_PKCS11_C
|
||||
*
|
||||
* Enable wrapper for PKCS#11 smartcard support via the pkcs11-helper library.
|
||||
*
|
||||
* \deprecated This option is deprecated and will be removed in a future
|
||||
* version of Mbed TLS.
|
||||
*
|
||||
* Module: library/pkcs11.c
|
||||
* Caller: library/pk.c
|
||||
*
|
||||
* Requires: MBEDTLS_PK_C
|
||||
*
|
||||
* This module enables SSL/TLS PKCS #11 smartcard support.
|
||||
* Requires the presence of the PKCS#11 helper library (libpkcs11-helper)
|
||||
*/
|
||||
//#define MBEDTLS_PKCS11_C
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_PKCS12_C
|
||||
*
|
||||
|
@ -3249,7 +3079,7 @@
|
|||
* Enable the RSA public-key cryptosystem.
|
||||
*
|
||||
* Module: library/rsa.c
|
||||
* library/rsa_internal.c
|
||||
* library/rsa_alt_helpers.c
|
||||
* Caller: library/ssl_cli.c
|
||||
* library/ssl_srv.c
|
||||
* library/ssl_tls.c
|
||||
|
@ -3433,9 +3263,6 @@
|
|||
* https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
|
||||
*
|
||||
* Module: library/timing.c
|
||||
* Caller: library/havege.c
|
||||
*
|
||||
* This module is used by the HAVEGE random number generator.
|
||||
*/
|
||||
#define MBEDTLS_TIMING_C
|
||||
|
||||
|
@ -3843,7 +3670,6 @@
|
|||
*/
|
||||
//#define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768
|
||||
|
||||
//#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400 /**< Lifetime of session tickets (if enabled) */
|
||||
//#define MBEDTLS_PSK_MAX_LEN 32 /**< Max size of TLS pre-shared keys, in bytes (default 256 bits) */
|
||||
//#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */
|
||||
|
||||
|
@ -3865,20 +3691,6 @@
|
|||
//#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */
|
||||
//#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */
|
||||
|
||||
/**
|
||||
* Allow SHA-1 in the default TLS configuration for certificate signing.
|
||||
* Without this build-time option, SHA-1 support must be activated explicitly
|
||||
* through mbedtls_ssl_conf_cert_profile. Turning on this option is not
|
||||
* recommended because of it is possible to generate SHA-1 collisions, however
|
||||
* this may be safe for legacy infrastructure where additional controls apply.
|
||||
*
|
||||
* \warning SHA-1 is considered a weak message digest and its use constitutes
|
||||
* a security risk. If possible, we recommend avoiding dependencies
|
||||
* on it, and considering stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
//#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
|
||||
|
||||
/**
|
||||
* Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake
|
||||
* signature and ciphersuite selection. Without this build-time option, SHA-1
|
||||
|
|
|
@ -231,16 +231,23 @@ extern "C" {
|
|||
(defined(PSA_WANT_ALG_CBC_NO_PADDING) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)) || \
|
||||
(defined(PSA_WANT_ALG_CBC_PKCS7) && \
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7))
|
||||
!defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7)) || \
|
||||
(defined(PSA_WANT_ALG_CMAC) && !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC))
|
||||
#define PSA_HAVE_SOFT_BLOCK_MODE 1
|
||||
#endif
|
||||
|
||||
#if (defined(PSA_WANT_ALG_GCM) && !defined(MBEDTLS_PSA_ACCEL_ALG_GCM)) || \
|
||||
(defined(PSA_WANT_ALG_CCM) && !defined(MBEDTLS_PSA_ACCEL_ALG_CCM))
|
||||
#define PSA_HAVE_SOFT_BLOCK_AEAD 1
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_AES)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
|
||||
#define PSA_HAVE_SOFT_KEY_TYPE_AES 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_AES */
|
||||
#if defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_MODE)
|
||||
defined(PSA_HAVE_SOFT_BLOCK_MODE) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_AEAD)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES 1
|
||||
#define MBEDTLS_AES_C
|
||||
#endif /* PSA_HAVE_SOFT_KEY_TYPE_AES || PSA_HAVE_SOFT_BLOCK_MODE */
|
||||
|
@ -258,7 +265,8 @@ extern "C" {
|
|||
#define PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA */
|
||||
#if defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_MODE)
|
||||
defined(PSA_HAVE_SOFT_BLOCK_MODE) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_AEAD)
|
||||
#define MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA 1
|
||||
#define MBEDTLS_CAMELLIA_C
|
||||
#endif /* PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA || PSA_HAVE_SOFT_BLOCK_MODE */
|
||||
|
@ -295,6 +303,21 @@ extern "C" {
|
|||
#define MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER 1
|
||||
#endif /* PSA_WANT_ALG_STREAM_CIPHER */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CBC_MAC)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_MAC)
|
||||
#error "CBC-MAC is not yet supported via the PSA API in Mbed TLS."
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CBC_MAC 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_CBC_MAC */
|
||||
#endif /* PSA_WANT_ALG_CBC_MAC */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CMAC)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CMAC 1
|
||||
#define MBEDTLS_CMAC_C
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ALG_CMAC */
|
||||
#endif /* PSA_WANT_ALG_CMAC */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CTR)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CTR) || \
|
||||
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)
|
||||
|
@ -348,6 +371,24 @@ extern "C" {
|
|||
#endif
|
||||
#endif /* PSA_WANT_ALG_CBC_PKCS7 */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CCM)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CCM) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CCM 1
|
||||
#define MBEDTLS_CCM_C
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_CCM */
|
||||
|
||||
#if defined(PSA_WANT_ALG_GCM)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ALG_GCM) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_AES) || \
|
||||
defined(PSA_HAVE_SOFT_KEY_TYPE_CAMELLIA)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_GCM 1
|
||||
#define MBEDTLS_GCM_C
|
||||
#endif
|
||||
#endif /* PSA_WANT_ALG_GCM */
|
||||
|
||||
#if defined(PSA_WANT_ALG_CHACHA20_POLY1305)
|
||||
#if defined(PSA_WANT_KEY_TYPE_CHACHA20)
|
||||
#define MBEDTLS_CHACHAPOLY_C
|
||||
|
@ -355,6 +396,107 @@ extern "C" {
|
|||
#endif /* PSA_WANT_KEY_TYPE_CHACHA20 */
|
||||
#endif /* PSA_WANT_ALG_CHACHA20_POLY1305 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256)
|
||||
#define MBEDTLS_ECP_DP_BP256R1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256 */
|
||||
#endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_256 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384)
|
||||
#define MBEDTLS_ECP_DP_BP384R1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384 */
|
||||
#endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_384 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512)
|
||||
#define MBEDTLS_ECP_DP_BP512R1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512 */
|
||||
#endif /* PSA_WANT_ECC_BRAINPOOL_P_R1_512 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_MONTGOMERY_255)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255)
|
||||
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255 */
|
||||
#endif /* PSA_WANT_ECC_MONTGOMERY_255 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_MONTGOMERY_448)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448)
|
||||
/*
|
||||
* Curve448 is not yet supported via the PSA API in Mbed TLS
|
||||
* (https://github.com/ARMmbed/mbedtls/issues/4249).
|
||||
*/
|
||||
#error "Curve448 is not yet supported via the PSA API in Mbed TLS."
|
||||
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448 */
|
||||
#endif /* PSA_WANT_ECC_MONTGOMERY_448 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_192)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192)
|
||||
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192 */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_192 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_224)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224)
|
||||
#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224 */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_224 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_256)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256)
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256 */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_256 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_384)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384)
|
||||
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384 */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_384 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_521)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521)
|
||||
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521 */
|
||||
#endif /* PSA_WANT_ECC_SECP_R1_521 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_K1_192)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192)
|
||||
#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192 */
|
||||
#endif /* PSA_WANT_ECC_SECP_K1_192 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_K1_224)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224)
|
||||
/*
|
||||
* SECP224K1 is buggy via the PSA API in Mbed TLS
|
||||
* (https://github.com/ARMmbed/mbedtls/issues/3541).
|
||||
*/
|
||||
#error "SECP224K1 is buggy via the PSA API in Mbed TLS."
|
||||
#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224 */
|
||||
#endif /* PSA_WANT_ECC_SECP_K1_224 */
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_K1_256)
|
||||
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256)
|
||||
#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
|
||||
#endif /* !MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256 */
|
||||
#endif /* PSA_WANT_ECC_SECP_K1_256 */
|
||||
|
||||
#else /* MBEDTLS_PSA_CRYPTO_CONFIG */
|
||||
|
||||
/*
|
||||
|
@ -362,6 +504,16 @@ extern "C" {
|
|||
* is not defined
|
||||
*/
|
||||
|
||||
#if defined(MBEDTLS_CCM_C)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CCM 1
|
||||
#define PSA_WANT_ALG_CCM 1
|
||||
#endif /* MBEDTLS_CCM_C */
|
||||
|
||||
#if defined(MBEDTLS_CMAC_C)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_CMAC 1
|
||||
#define PSA_WANT_ALG_CMAC 1
|
||||
#endif /* MBEDTLS_CMAC_C */
|
||||
|
||||
#if defined(MBEDTLS_ECDH_C)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_ECDH 1
|
||||
#define PSA_WANT_ALG_ECDH 1
|
||||
|
@ -386,6 +538,11 @@ extern "C" {
|
|||
#define PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
|
||||
#endif /* MBEDTLS_ECP_C */
|
||||
|
||||
#if defined(MBEDTLS_GCM_C)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_GCM 1
|
||||
#define PSA_WANT_ALG_GCM 1
|
||||
#endif /* MBEDTLS_GCM_C */
|
||||
|
||||
#if defined(MBEDTLS_HKDF_C)
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
|
||||
#define PSA_WANT_ALG_HMAC 1
|
||||
|
@ -531,6 +688,73 @@ extern "C" {
|
|||
#define PSA_WANT_ALG_XTS 1
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1
|
||||
#define PSA_WANT_ECC_BRAINPOOL_P_R1_256
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1
|
||||
#define PSA_WANT_ECC_BRAINPOOL_P_R1_384
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1
|
||||
#define PSA_WANT_ECC_BRAINPOOL_P_R1_512
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
|
||||
#define PSA_WANT_ECC_MONTGOMERY_255
|
||||
#endif
|
||||
|
||||
/* Curve448 is not yet supported via the PSA API (https://github.com/ARMmbed/mbedtls/issues/4249) */
|
||||
#if 0 && defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
|
||||
#define PSA_WANT_ECC_MONTGOMERY_448
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
|
||||
#define PSA_WANT_ECC_SECP_R1_192
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
|
||||
#define PSA_WANT_ECC_SECP_R1_224
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
|
||||
#define PSA_WANT_ECC_SECP_R1_256
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
|
||||
#define PSA_WANT_ECC_SECP_R1_384
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
|
||||
#define PSA_WANT_ECC_SECP_R1_521
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
|
||||
#define PSA_WANT_ECC_SECP_K1_192
|
||||
#endif
|
||||
|
||||
/* SECP224K1 is buggy via the PSA API (https://github.com/ARMmbed/mbedtls/issues/3541) */
|
||||
#if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
|
||||
#define PSA_WANT_ECC_SECP_K1_224
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
|
||||
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
|
||||
#define PSA_WANT_ECC_SECP_K1_256
|
||||
#endif
|
||||
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
|
||||
|
||||
/* These features are always enabled. */
|
||||
|
|
|
@ -528,35 +528,6 @@ int mbedtls_ctr_drbg_random_with_add( void *p_rng,
|
|||
int mbedtls_ctr_drbg_random( void *p_rng,
|
||||
unsigned char *output, size_t output_len );
|
||||
|
||||
|
||||
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function updates the state of the CTR_DRBG context.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_ctr_drbg_update_ret()
|
||||
* in 2.16.0.
|
||||
*
|
||||
* \note If \p add_len is greater than
|
||||
* #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT, only the first
|
||||
* #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT Bytes are used.
|
||||
* The remaining Bytes are silently discarded.
|
||||
*
|
||||
* \param ctx The CTR_DRBG context.
|
||||
* \param additional The data to update the state with.
|
||||
* \param add_len Length of \p additional data.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_ctr_drbg_update(
|
||||
mbedtls_ctr_drbg_context *ctx,
|
||||
const unsigned char *additional,
|
||||
size_t add_len );
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#if defined(MBEDTLS_FS_IO)
|
||||
/**
|
||||
* \brief This function writes a seed file.
|
||||
|
|
|
@ -59,9 +59,13 @@
|
|||
#endif
|
||||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
#if !defined(MBEDTLS_X509_REMOVE_INFO)
|
||||
#define MBEDTLS_SSL_DEBUG_CRT( level, text, crt ) \
|
||||
mbedtls_debug_print_crt( ssl, level, __FILE__, __LINE__, text, crt )
|
||||
#endif
|
||||
#else
|
||||
#define MBEDTLS_SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 )
|
||||
#endif /* MBEDTLS_X509_REMOVE_INFO */
|
||||
#endif /* MBEDTLS_X509_CRT_PARSE_C */
|
||||
|
||||
#if defined(MBEDTLS_ECDH_C)
|
||||
#define MBEDTLS_SSL_DEBUG_ECDH( level, ecdh, attr ) \
|
||||
|
@ -248,7 +252,7 @@ void mbedtls_debug_print_ecp( const mbedtls_ssl_context *ssl, int level,
|
|||
const char *text, const mbedtls_ecp_point *X );
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C) && !defined(MBEDTLS_X509_REMOVE_INFO)
|
||||
/**
|
||||
* \brief Print a X.509 certificate structure to the debug output. This
|
||||
* function is always used through the MBEDTLS_SSL_DEBUG_CRT() macro,
|
||||
|
|
|
@ -41,9 +41,6 @@
|
|||
|
||||
#define MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH -0x0032 /**< The data input has an invalid length. */
|
||||
|
||||
/* MBEDTLS_ERR_DES_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_DES_HW_ACCEL_FAILED -0x0033 /**< DES hardware accelerator failed. */
|
||||
|
||||
#define MBEDTLS_DES_KEY_SIZE 8
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -82,10 +82,6 @@
|
|||
#define MBEDTLS_ERR_DHM_INVALID_FORMAT -0x3380 /**< The ASN.1 data is not formatted correctly. */
|
||||
#define MBEDTLS_ERR_DHM_ALLOC_FAILED -0x3400 /**< Allocation of memory failed. */
|
||||
#define MBEDTLS_ERR_DHM_FILE_IO_ERROR -0x3480 /**< Read or write of file failed. */
|
||||
|
||||
/* MBEDTLS_ERR_DHM_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_DHM_HW_ACCEL_FAILED -0x3500 /**< DHM hardware accelerator failed. */
|
||||
|
||||
#define MBEDTLS_ERR_DHM_SET_GROUP_FAILED -0x3580 /**< Setting the modulus and generator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -386,161 +382,6 @@ int mbedtls_dhm_self_test( int verbose );
|
|||
*
|
||||
*/
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
|
||||
/**
|
||||
* \warning The origin of the primes in RFC 5114 is not documented and
|
||||
* their use therefore constitutes a security risk!
|
||||
*
|
||||
* \deprecated The hex-encoded primes from RFC 5114 are deprecated and are
|
||||
* likely to be removed in a future version of the library without
|
||||
* replacement.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The hexadecimal presentation of the prime underlying the
|
||||
* 2048-bit MODP Group with 224-bit Prime Order Subgroup, as defined
|
||||
* in <em>RFC-5114: Additional Diffie-Hellman Groups for Use with
|
||||
* IETF Standards</em>.
|
||||
*/
|
||||
#define MBEDTLS_DHM_RFC5114_MODP_2048_P \
|
||||
MBEDTLS_DEPRECATED_STRING_CONSTANT( \
|
||||
"AD107E1E9123A9D0D660FAA79559C51FA20D64E5683B9FD1" \
|
||||
"B54B1597B61D0A75E6FA141DF95A56DBAF9A3C407BA1DF15" \
|
||||
"EB3D688A309C180E1DE6B85A1274A0A66D3F8152AD6AC212" \
|
||||
"9037C9EDEFDA4DF8D91E8FEF55B7394B7AD5B7D0B6C12207" \
|
||||
"C9F98D11ED34DBF6C6BA0B2C8BBC27BE6A00E0A0B9C49708" \
|
||||
"B3BF8A317091883681286130BC8985DB1602E714415D9330" \
|
||||
"278273C7DE31EFDC7310F7121FD5A07415987D9ADC0A486D" \
|
||||
"CDF93ACC44328387315D75E198C641A480CD86A1B9E587E8" \
|
||||
"BE60E69CC928B2B9C52172E413042E9B23F10B0E16E79763" \
|
||||
"C9B53DCF4BA80A29E3FB73C16B8E75B97EF363E2FFA31F71" \
|
||||
"CF9DE5384E71B81C0AC4DFFE0C10E64F" )
|
||||
|
||||
/**
|
||||
* The hexadecimal presentation of the chosen generator of the 2048-bit MODP
|
||||
* Group with 224-bit Prime Order Subgroup, as defined in <em>RFC-5114:
|
||||
* Additional Diffie-Hellman Groups for Use with IETF Standards</em>.
|
||||
*/
|
||||
#define MBEDTLS_DHM_RFC5114_MODP_2048_G \
|
||||
MBEDTLS_DEPRECATED_STRING_CONSTANT( \
|
||||
"AC4032EF4F2D9AE39DF30B5C8FFDAC506CDEBE7B89998CAF" \
|
||||
"74866A08CFE4FFE3A6824A4E10B9A6F0DD921F01A70C4AFA" \
|
||||
"AB739D7700C29F52C57DB17C620A8652BE5E9001A8D66AD7" \
|
||||
"C17669101999024AF4D027275AC1348BB8A762D0521BC98A" \
|
||||
"E247150422EA1ED409939D54DA7460CDB5F6C6B250717CBE" \
|
||||
"F180EB34118E98D119529A45D6F834566E3025E316A330EF" \
|
||||
"BB77A86F0C1AB15B051AE3D428C8F8ACB70A8137150B8EEB" \
|
||||
"10E183EDD19963DDD9E263E4770589EF6AA21E7F5F2FF381" \
|
||||
"B539CCE3409D13CD566AFBB48D6C019181E1BCFE94B30269" \
|
||||
"EDFE72FE9B6AA4BD7B5A0F1C71CFFF4C19C418E1F6EC0179" \
|
||||
"81BC087F2A7065B384B890D3191F2BFA" )
|
||||
|
||||
/**
|
||||
* The hexadecimal presentation of the prime underlying the 2048-bit MODP
|
||||
* Group, as defined in <em>RFC-3526: More Modular Exponential (MODP)
|
||||
* Diffie-Hellman groups for Internet Key Exchange (IKE)</em>.
|
||||
*
|
||||
* \deprecated The hex-encoded primes from RFC 3625 are deprecated and
|
||||
* superseded by the corresponding macros providing them as
|
||||
* binary constants. Their hex-encoded constants are likely
|
||||
* to be removed in a future version of the library.
|
||||
*
|
||||
*/
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_2048_P \
|
||||
MBEDTLS_DEPRECATED_STRING_CONSTANT( \
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
|
||||
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
|
||||
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \
|
||||
"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \
|
||||
"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \
|
||||
"83655D23DCA3AD961C62F356208552BB9ED529077096966D" \
|
||||
"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \
|
||||
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \
|
||||
"15728E5A8AACAA68FFFFFFFFFFFFFFFF" )
|
||||
|
||||
/**
|
||||
* The hexadecimal presentation of the chosen generator of the 2048-bit MODP
|
||||
* Group, as defined in <em>RFC-3526: More Modular Exponential (MODP)
|
||||
* Diffie-Hellman groups for Internet Key Exchange (IKE)</em>.
|
||||
*/
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_2048_G \
|
||||
MBEDTLS_DEPRECATED_STRING_CONSTANT( "02" )
|
||||
|
||||
/**
|
||||
* The hexadecimal presentation of the prime underlying the 3072-bit MODP
|
||||
* Group, as defined in <em>RFC-3072: More Modular Exponential (MODP)
|
||||
* Diffie-Hellman groups for Internet Key Exchange (IKE)</em>.
|
||||
*/
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_3072_P \
|
||||
MBEDTLS_DEPRECATED_STRING_CONSTANT( \
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
|
||||
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
|
||||
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \
|
||||
"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \
|
||||
"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \
|
||||
"83655D23DCA3AD961C62F356208552BB9ED529077096966D" \
|
||||
"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \
|
||||
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \
|
||||
"15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \
|
||||
"ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \
|
||||
"ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \
|
||||
"F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \
|
||||
"BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \
|
||||
"43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF" )
|
||||
|
||||
/**
|
||||
* The hexadecimal presentation of the chosen generator of the 3072-bit MODP
|
||||
* Group, as defined in <em>RFC-3526: More Modular Exponential (MODP)
|
||||
* Diffie-Hellman groups for Internet Key Exchange (IKE)</em>.
|
||||
*/
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_3072_G \
|
||||
MBEDTLS_DEPRECATED_STRING_CONSTANT( "02" )
|
||||
|
||||
/**
|
||||
* The hexadecimal presentation of the prime underlying the 4096-bit MODP
|
||||
* Group, as defined in <em>RFC-3526: More Modular Exponential (MODP)
|
||||
* Diffie-Hellman groups for Internet Key Exchange (IKE)</em>.
|
||||
*/
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_4096_P \
|
||||
MBEDTLS_DEPRECATED_STRING_CONSTANT( \
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
|
||||
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
|
||||
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \
|
||||
"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \
|
||||
"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \
|
||||
"83655D23DCA3AD961C62F356208552BB9ED529077096966D" \
|
||||
"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \
|
||||
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \
|
||||
"15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \
|
||||
"ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \
|
||||
"ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \
|
||||
"F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \
|
||||
"BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \
|
||||
"43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" \
|
||||
"88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" \
|
||||
"2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" \
|
||||
"287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" \
|
||||
"1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" \
|
||||
"93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199" \
|
||||
"FFFFFFFFFFFFFFFF" )
|
||||
|
||||
/**
|
||||
* The hexadecimal presentation of the chosen generator of the 4096-bit MODP
|
||||
* Group, as defined in <em>RFC-3526: More Modular Exponential (MODP)
|
||||
* Diffie-Hellman groups for Internet Key Exchange (IKE)</em>.
|
||||
*/
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_4096_G \
|
||||
MBEDTLS_DEPRECATED_STRING_CONSTANT( "02" )
|
||||
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/*
|
||||
* Trustworthy DHM parameters in binary form
|
||||
*/
|
||||
|
|
|
@ -138,7 +138,7 @@ int mbedtls_ecdsa_can_do( mbedtls_ecp_group_id gid );
|
|||
* previously-hashed message.
|
||||
*
|
||||
* \note The deterministic version implemented in
|
||||
* mbedtls_ecdsa_sign_det() is usually preferred.
|
||||
* mbedtls_ecdsa_sign_det_ext() is usually preferred.
|
||||
*
|
||||
* \note If the bitlength of the message hash is larger than the
|
||||
* bitlength of the group order, then the hash is truncated
|
||||
|
@ -174,67 +174,6 @@ int mbedtls_ecdsa_sign( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s,
|
|||
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
|
||||
|
||||
#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
|
||||
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function computes the ECDSA signature of a
|
||||
* previously-hashed message, deterministic version.
|
||||
*
|
||||
* For more information, see <em>RFC-6979: Deterministic
|
||||
* Usage of the Digital Signature Algorithm (DSA) and Elliptic
|
||||
* Curve Digital Signature Algorithm (ECDSA)</em>.
|
||||
*
|
||||
* \note If the bitlength of the message hash is larger than the
|
||||
* bitlength of the group order, then the hash is truncated as
|
||||
* defined in <em>Standards for Efficient Cryptography Group
|
||||
* (SECG): SEC1 Elliptic Curve Cryptography</em>, section
|
||||
* 4.1.3, step 5.
|
||||
*
|
||||
* \warning Since the output of the internal RNG is always the same for
|
||||
* the same key and message, this limits the efficiency of
|
||||
* blinding and leaks information through side channels. For
|
||||
* secure behavior use mbedtls_ecdsa_sign_det_ext() instead.
|
||||
*
|
||||
* (Optimally the blinding is a random value that is different
|
||||
* on every execution. In this case the blinding is still
|
||||
* random from the attackers perspective, but is the same on
|
||||
* each execution. This means that this blinding does not
|
||||
* prevent attackers from recovering secrets by combining
|
||||
* several measurement traces, but may prevent some attacks
|
||||
* that exploit relationships between secret data.)
|
||||
*
|
||||
* \see ecp.h
|
||||
*
|
||||
* \param grp The context for the elliptic curve to use.
|
||||
* This must be initialized and have group parameters
|
||||
* set, for example through mbedtls_ecp_group_load().
|
||||
* \param r The MPI context in which to store the first part
|
||||
* the signature. This must be initialized.
|
||||
* \param s The MPI context in which to store the second part
|
||||
* the signature. This must be initialized.
|
||||
* \param d The private signing key. This must be initialized
|
||||
* and setup, for example through mbedtls_ecp_gen_privkey().
|
||||
* \param buf The hashed content to be signed. This must be a readable
|
||||
* buffer of length \p blen Bytes. It may be \c NULL if
|
||||
* \p blen is zero.
|
||||
* \param blen The length of \p buf in Bytes.
|
||||
* \param md_alg The hash algorithm used to hash the original data.
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
* \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX
|
||||
* error code on failure.
|
||||
*/
|
||||
int mbedtls_ecdsa_sign_det( mbedtls_ecp_group *grp, mbedtls_mpi *r,
|
||||
mbedtls_mpi *s, const mbedtls_mpi *d,
|
||||
const unsigned char *buf, size_t blen,
|
||||
mbedtls_md_type_t md_alg ) MBEDTLS_DEPRECATED;
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief This function computes the ECDSA signature of a
|
||||
* previously-hashed message, deterministic version.
|
||||
|
@ -421,64 +360,6 @@ int mbedtls_ecdsa_write_signature_restartable( mbedtls_ecdsa_context *ctx,
|
|||
void *p_rng,
|
||||
mbedtls_ecdsa_restart_ctx *rs_ctx );
|
||||
|
||||
#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
|
||||
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function computes an ECDSA signature and writes
|
||||
* it to a buffer, serialized as defined in <em>RFC-4492:
|
||||
* Elliptic Curve Cryptography (ECC) Cipher Suites for
|
||||
* Transport Layer Security (TLS)</em>.
|
||||
*
|
||||
* The deterministic version is defined in <em>RFC-6979:
|
||||
* Deterministic Usage of the Digital Signature Algorithm (DSA)
|
||||
* and Elliptic Curve Digital Signature Algorithm (ECDSA)</em>.
|
||||
*
|
||||
* \warning It is not thread-safe to use the same context in
|
||||
* multiple threads.
|
||||
*
|
||||
* \note If the bitlength of the message hash is larger than the
|
||||
* bitlength of the group order, then the hash is truncated as
|
||||
* defined in <em>Standards for Efficient Cryptography Group
|
||||
* (SECG): SEC1 Elliptic Curve Cryptography</em>, section
|
||||
* 4.1.3, step 5.
|
||||
*
|
||||
* \see ecp.h
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_ecdsa_write_signature() in
|
||||
* Mbed TLS version 2.0 and later.
|
||||
*
|
||||
* \param ctx The ECDSA context to use. This must be initialized
|
||||
* and have a group and private key bound to it, for example
|
||||
* via mbedtls_ecdsa_genkey() or mbedtls_ecdsa_from_keypair().
|
||||
* \param hash The message hash to be signed. This must be a readable
|
||||
* buffer of length \p blen Bytes.
|
||||
* \param hlen The length of the hash \p hash in Bytes.
|
||||
* \param sig The buffer to which to write the signature. This must be a
|
||||
* writable buffer of length at least twice as large as the
|
||||
* size of the curve used, plus 9. For example, 73 Bytes if
|
||||
* a 256-bit curve is used. A buffer length of
|
||||
* #MBEDTLS_ECDSA_MAX_LEN is always safe.
|
||||
* \param slen The address at which to store the actual length of
|
||||
* the signature written. Must not be \c NULL.
|
||||
* \param md_alg The message digest that was used to hash the message.
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
* \return An \c MBEDTLS_ERR_ECP_XXX, \c MBEDTLS_ERR_MPI_XXX or
|
||||
* \c MBEDTLS_ERR_ASN1_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_ecdsa_write_signature_det( mbedtls_ecdsa_context *ctx,
|
||||
const unsigned char *hash, size_t hlen,
|
||||
unsigned char *sig, size_t *slen,
|
||||
mbedtls_md_type_t md_alg ) MBEDTLS_DEPRECATED;
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
|
||||
|
||||
/**
|
||||
* \brief This function reads and verifies an ECDSA signature.
|
||||
*
|
||||
|
|
|
@ -53,10 +53,6 @@
|
|||
#define MBEDTLS_ERR_ECP_RANDOM_FAILED -0x4D00 /**< Generation of random value, such as ephemeral key, failed. */
|
||||
#define MBEDTLS_ERR_ECP_INVALID_KEY -0x4C80 /**< Invalid private or public key. */
|
||||
#define MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH -0x4C00 /**< The buffer contains a valid signature followed by more data. */
|
||||
|
||||
/* MBEDTLS_ERR_ECP_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_ECP_HW_ACCEL_FAILED -0x4B80 /**< The ECP hardware accelerator failed. */
|
||||
|
||||
#define MBEDTLS_ERR_ECP_IN_PROGRESS -0x4B00 /**< Operation in progress, call again with the same parameters to continue. */
|
||||
|
||||
/* Flags indicating whether to include code that is specific to certain
|
||||
|
|
|
@ -44,9 +44,6 @@
|
|||
#include "mbedtls/threading.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_HAVEGE_C)
|
||||
#include "mbedtls/havege.h"
|
||||
#endif
|
||||
|
||||
#define MBEDTLS_ERR_ENTROPY_SOURCE_FAILED -0x003C /**< Critical entropy source failure. */
|
||||
#define MBEDTLS_ERR_ENTROPY_MAX_SOURCES -0x003E /**< No more sources can be added. */
|
||||
|
@ -130,9 +127,6 @@ typedef struct mbedtls_entropy_context
|
|||
#endif
|
||||
int source_count; /* Number of entries used in source. */
|
||||
mbedtls_entropy_source_state source[MBEDTLS_ENTROPY_MAX_SOURCES];
|
||||
#if defined(MBEDTLS_HAVEGE_C)
|
||||
mbedtls_havege_state havege_data;
|
||||
#endif
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
mbedtls_threading_mutex_t mutex; /*!< mutex */
|
||||
#endif
|
||||
|
@ -142,6 +136,14 @@ typedef struct mbedtls_entropy_context
|
|||
}
|
||||
mbedtls_entropy_context;
|
||||
|
||||
#if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
|
||||
/**
|
||||
* \brief Platform-specific entropy poll callback
|
||||
*/
|
||||
int mbedtls_platform_entropy_poll( void *data,
|
||||
unsigned char *output, size_t len, size_t *olen );
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Initialize the context
|
||||
*
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
|
||||
!defined(inline) && !defined(__cplusplus)
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Error code layout.
|
||||
*
|
||||
|
@ -114,6 +119,57 @@ extern "C" {
|
|||
#define MBEDTLS_ERR_ERROR_GENERIC_ERROR -0x0001 /**< Generic error */
|
||||
#define MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED -0x006E /**< This is a bug in the library */
|
||||
|
||||
#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED -0x0070 /**< Hardware accelerator failed */
|
||||
#define MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED -0x0072 /**< The requested feature is not supported by the platform */
|
||||
|
||||
/**
|
||||
* \brief Combines a high-level and low-level error code together.
|
||||
*
|
||||
* Wrapper macro for mbedtls_error_add(). See that function for
|
||||
* more details.
|
||||
*/
|
||||
#define MBEDTLS_ERROR_ADD( high, low ) \
|
||||
mbedtls_error_add( high, low, __FILE__, __LINE__ )
|
||||
|
||||
#if defined(MBEDTLS_TEST_HOOKS)
|
||||
/**
|
||||
* \brief Testing hook called before adding/combining two error codes together.
|
||||
* Only used when invasive testing is enabled via MBEDTLS_TEST_HOOKS.
|
||||
*/
|
||||
extern void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Combines a high-level and low-level error code together.
|
||||
*
|
||||
* This function can be called directly however it is usually
|
||||
* called via the #MBEDTLS_ERROR_ADD macro.
|
||||
*
|
||||
* While a value of zero is not a negative error code, it is still an
|
||||
* error code (that denotes success) and can be combined with both a
|
||||
* negative error code or another value of zero.
|
||||
*
|
||||
* \note When invasive testing is enabled via #MBEDTLS_TEST_HOOKS, also try to
|
||||
* call \link mbedtls_test_hook_error_add \endlink.
|
||||
*
|
||||
* \param high high-level error code. See error.h for more details.
|
||||
* \param low low-level error code. See error.h for more details.
|
||||
* \param file file where this error code addition occured.
|
||||
* \param line line where this error code addition occured.
|
||||
*/
|
||||
static inline int mbedtls_error_add( int high, int low,
|
||||
const char *file, int line )
|
||||
{
|
||||
#if defined(MBEDTLS_TEST_HOOKS)
|
||||
if( *mbedtls_test_hook_error_add != NULL )
|
||||
( *mbedtls_test_hook_error_add )( high, low, file, line );
|
||||
#endif
|
||||
(void)file;
|
||||
(void)line;
|
||||
|
||||
return( high + low );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Translate a mbed TLS error code into a string representation,
|
||||
* Result is truncated if necessary and always includes a terminating
|
||||
|
|
|
@ -45,10 +45,6 @@
|
|||
#define MBEDTLS_GCM_DECRYPT 0
|
||||
|
||||
#define MBEDTLS_ERR_GCM_AUTH_FAILED -0x0012 /**< Authenticated decryption failed. */
|
||||
|
||||
/* MBEDTLS_ERR_GCM_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_GCM_HW_ACCEL_FAILED -0x0013 /**< GCM hardware accelerator failed. */
|
||||
|
||||
#define MBEDTLS_ERR_GCM_BAD_INPUT -0x0014 /**< Bad input parameters to function. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
/**
|
||||
* \file havege.h
|
||||
*
|
||||
* \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBEDTLS_HAVEGE_H
|
||||
#define MBEDTLS_HAVEGE_H
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define MBEDTLS_HAVEGE_COLLECT_SIZE 1024
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief HAVEGE state structure
|
||||
*/
|
||||
typedef struct mbedtls_havege_state
|
||||
{
|
||||
uint32_t PT1, PT2, offset[2];
|
||||
uint32_t pool[MBEDTLS_HAVEGE_COLLECT_SIZE];
|
||||
uint32_t WALK[8192];
|
||||
}
|
||||
mbedtls_havege_state;
|
||||
|
||||
/**
|
||||
* \brief HAVEGE initialization
|
||||
*
|
||||
* \param hs HAVEGE state to be initialized
|
||||
*/
|
||||
void mbedtls_havege_init( mbedtls_havege_state *hs );
|
||||
|
||||
/**
|
||||
* \brief Clear HAVEGE state
|
||||
*
|
||||
* \param hs HAVEGE state to be cleared
|
||||
*/
|
||||
void mbedtls_havege_free( mbedtls_havege_state *hs );
|
||||
|
||||
/**
|
||||
* \brief HAVEGE rand function
|
||||
*
|
||||
* \param p_rng A HAVEGE state
|
||||
* \param output Buffer to fill
|
||||
* \param len Length of buffer
|
||||
*
|
||||
* \return 0
|
||||
*/
|
||||
int mbedtls_havege_random( void *p_rng, unsigned char *output, size_t len );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* havege.h */
|
|
@ -397,30 +397,6 @@ int mbedtls_hmac_drbg_random( void *p_rng, unsigned char *output, size_t out_len
|
|||
*/
|
||||
void mbedtls_hmac_drbg_free( mbedtls_hmac_drbg_context *ctx );
|
||||
|
||||
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function updates the state of the HMAC_DRBG context.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_hmac_drbg_update_ret()
|
||||
* in 2.16.0.
|
||||
*
|
||||
* \param ctx The HMAC_DRBG context.
|
||||
* \param additional The data to update the state with.
|
||||
* If this is \c NULL, there is no additional data.
|
||||
* \param add_len Length of \p additional in bytes.
|
||||
* Unused if \p additional is \c NULL.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_hmac_drbg_update(
|
||||
mbedtls_hmac_drbg_context *ctx,
|
||||
const unsigned char *additional, size_t add_len );
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#if defined(MBEDTLS_FS_IO)
|
||||
/**
|
||||
* \brief This function writes a seed file.
|
||||
|
|
|
@ -38,9 +38,6 @@
|
|||
#define MBEDTLS_ERR_MD_ALLOC_FAILED -0x5180 /**< Failed to allocate memory. */
|
||||
#define MBEDTLS_ERR_MD_FILE_IO_ERROR -0x5200 /**< Opening or reading of file failed. */
|
||||
|
||||
/* MBEDTLS_ERR_MD_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_MD_HW_ACCEL_FAILED -0x5280 /**< MD hardware accelerator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -79,8 +76,15 @@ typedef enum {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Opaque struct defined in md_internal.h.
|
||||
* Opaque struct.
|
||||
*
|
||||
* Constructed using either #mbedtls_md_info_from_string or
|
||||
* #mbedtls_md_info_from_type.
|
||||
*
|
||||
* Fields can be accessed with #mbedtls_md_get_size,
|
||||
* #mbedtls_md_get_type and #mbedtls_md_get_name.
|
||||
*/
|
||||
/* Defined internally in library/md_wrap.h. */
|
||||
typedef struct mbedtls_md_info_t mbedtls_md_info_t;
|
||||
|
||||
/**
|
||||
|
@ -158,33 +162,6 @@ void mbedtls_md_init( mbedtls_md_context_t *ctx );
|
|||
*/
|
||||
void mbedtls_md_free( mbedtls_md_context_t *ctx );
|
||||
|
||||
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function selects the message digest algorithm to use,
|
||||
* and allocates internal structures.
|
||||
*
|
||||
* It should be called after mbedtls_md_init() or mbedtls_md_free().
|
||||
* Makes it necessary to call mbedtls_md_free() later.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md_setup() in 2.0.0
|
||||
*
|
||||
* \param ctx The context to set up.
|
||||
* \param md_info The information structure of the message-digest algorithm
|
||||
* to use.
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
|
||||
* failure.
|
||||
* \return #MBEDTLS_ERR_MD_ALLOC_FAILED on memory-allocation failure.
|
||||
*/
|
||||
int mbedtls_md_init_ctx( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info ) MBEDTLS_DEPRECATED;
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief This function selects the message digest algorithm to use,
|
||||
|
|
|
@ -35,9 +35,6 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
/* MBEDTLS_ERR_MD2_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_MD2_HW_ACCEL_FAILED -0x002B /**< MD2 hardware accelerator failed */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -167,77 +164,6 @@ int mbedtls_md2_finish_ret( mbedtls_md2_context *ctx,
|
|||
*/
|
||||
int mbedtls_internal_md2_process( mbedtls_md2_context *ctx );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief MD2 context setup
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md2_starts_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*
|
||||
* \warning MD2 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md2_starts( mbedtls_md2_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief MD2 process buffer
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md2_update_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx MD2 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \warning MD2 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md2_update( mbedtls_md2_context *ctx,
|
||||
const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief MD2 final digest
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md2_finish_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx MD2 context
|
||||
* \param output MD2 checksum result
|
||||
*
|
||||
* \warning MD2 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md2_finish( mbedtls_md2_context *ctx,
|
||||
unsigned char output[16] );
|
||||
|
||||
/**
|
||||
* \brief MD2 process data block (internal use only)
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_md2_process() in 2.7.0
|
||||
*
|
||||
* \param ctx MD2 context
|
||||
*
|
||||
* \warning MD2 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md2_process( mbedtls_md2_context *ctx );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief Output = MD2( input buffer )
|
||||
*
|
||||
|
@ -254,33 +180,6 @@ int mbedtls_md2_ret( const unsigned char *input,
|
|||
size_t ilen,
|
||||
unsigned char output[16] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief Output = MD2( input buffer )
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md2_ret() in 2.7.0
|
||||
*
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output MD2 checksum result
|
||||
*
|
||||
* \warning MD2 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md2( const unsigned char *input,
|
||||
size_t ilen,
|
||||
unsigned char output[16] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* MBEDTLS_ERR_MD4_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_MD4_HW_ACCEL_FAILED -0x002D /**< MD4 hardware accelerator failed */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -168,79 +165,6 @@ int mbedtls_md4_finish_ret( mbedtls_md4_context *ctx,
|
|||
int mbedtls_internal_md4_process( mbedtls_md4_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief MD4 context setup
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md4_starts_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*
|
||||
* \warning MD4 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md4_starts( mbedtls_md4_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief MD4 process buffer
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md4_update_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx MD4 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \warning MD4 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md4_update( mbedtls_md4_context *ctx,
|
||||
const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief MD4 final digest
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md4_finish_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx MD4 context
|
||||
* \param output MD4 checksum result
|
||||
*
|
||||
* \warning MD4 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md4_finish( mbedtls_md4_context *ctx,
|
||||
unsigned char output[16] );
|
||||
|
||||
/**
|
||||
* \brief MD4 process data block (internal use only)
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_md4_process() in 2.7.0
|
||||
*
|
||||
* \param ctx MD4 context
|
||||
* \param data buffer holding one block of data
|
||||
*
|
||||
* \warning MD4 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md4_process( mbedtls_md4_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief Output = MD4( input buffer )
|
||||
*
|
||||
|
@ -259,33 +183,6 @@ int mbedtls_md4_ret( const unsigned char *input,
|
|||
size_t ilen,
|
||||
unsigned char output[16] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief Output = MD4( input buffer )
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md4_ret() in 2.7.0
|
||||
*
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output MD4 checksum result
|
||||
*
|
||||
* \warning MD4 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md4( const unsigned char *input,
|
||||
size_t ilen,
|
||||
unsigned char output[16] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,9 +35,6 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* MBEDTLS_ERR_MD5_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_MD5_HW_ACCEL_FAILED -0x002F /**< MD5 hardware accelerator failed */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -168,79 +165,6 @@ int mbedtls_md5_finish_ret( mbedtls_md5_context *ctx,
|
|||
int mbedtls_internal_md5_process( mbedtls_md5_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief MD5 context setup
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md5_starts_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*
|
||||
* \warning MD5 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md5_starts( mbedtls_md5_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief MD5 process buffer
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md5_update_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx MD5 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \warning MD5 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md5_update( mbedtls_md5_context *ctx,
|
||||
const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief MD5 final digest
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md5_finish_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx MD5 context
|
||||
* \param output MD5 checksum result
|
||||
*
|
||||
* \warning MD5 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md5_finish( mbedtls_md5_context *ctx,
|
||||
unsigned char output[16] );
|
||||
|
||||
/**
|
||||
* \brief MD5 process data block (internal use only)
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_md5_process() in 2.7.0
|
||||
*
|
||||
* \param ctx MD5 context
|
||||
* \param data buffer holding one block of data
|
||||
*
|
||||
* \warning MD5 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md5_process( mbedtls_md5_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief Output = MD5( input buffer )
|
||||
*
|
||||
|
@ -259,33 +183,6 @@ int mbedtls_md5_ret( const unsigned char *input,
|
|||
size_t ilen,
|
||||
unsigned char output[16] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief Output = MD5( input buffer )
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_md5_ret() in 2.7.0
|
||||
*
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output MD5 checksum result
|
||||
*
|
||||
* \warning MD5 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_md5( const unsigned char *input,
|
||||
size_t ilen,
|
||||
unsigned char output[16] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* \file net.h
|
||||
*
|
||||
* \brief Deprecated header file that includes net_sockets.h
|
||||
*
|
||||
* \deprecated Superseded by mbedtls/net_sockets.h
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#include "mbedtls/net_sockets.h"
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#warning "Deprecated header file: Superseded by mbedtls/net_sockets.h"
|
||||
#endif /* MBEDTLS_DEPRECATED_WARNING */
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
|
@ -441,8 +441,10 @@ typedef struct mbedtls_oid_descriptor_t
|
|||
{
|
||||
const char *asn1; /*!< OID ASN.1 representation */
|
||||
size_t asn1_len; /*!< length of asn1 */
|
||||
#if !defined(MBEDTLS_X509_REMOVE_INFO)
|
||||
const char *name; /*!< official name (e.g. from RFC) */
|
||||
const char *description; /*!< human friendly description */
|
||||
#endif
|
||||
} mbedtls_oid_descriptor_t;
|
||||
|
||||
/**
|
||||
|
@ -582,6 +584,7 @@ int mbedtls_oid_get_md_alg( const mbedtls_asn1_buf *oid, mbedtls_md_type_t *md_a
|
|||
int mbedtls_oid_get_md_hmac( const mbedtls_asn1_buf *oid, mbedtls_md_type_t *md_hmac );
|
||||
#endif /* MBEDTLS_MD_C */
|
||||
|
||||
#if !defined(MBEDTLS_X509_REMOVE_INFO)
|
||||
/**
|
||||
* \brief Translate Extended Key Usage OID into description
|
||||
*
|
||||
|
@ -591,6 +594,7 @@ int mbedtls_oid_get_md_hmac( const mbedtls_asn1_buf *oid, mbedtls_md_type_t *md_
|
|||
* \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
|
||||
*/
|
||||
int mbedtls_oid_get_extended_key_usage( const mbedtls_asn1_buf *oid, const char **desc );
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Translate certificate policies OID into description
|
||||
|
|
|
@ -67,9 +67,6 @@
|
|||
#define MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE -0x3980 /**< Unavailable feature, e.g. RSA disabled for RSA key. */
|
||||
#define MBEDTLS_ERR_PK_SIG_LEN_MISMATCH -0x3900 /**< The buffer contains a valid signature followed by more data. */
|
||||
|
||||
/* MBEDTLS_ERR_PK_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_PK_HW_ACCEL_FAILED -0x3880 /**< PK hardware accelerator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -118,7 +115,7 @@ typedef struct mbedtls_pk_rsassa_pss_options
|
|||
/* For RSA, the signature can be as large as the bignum module allows.
|
||||
* For RSA_ALT, the signature size is not necessarily tied to what the
|
||||
* bignum module can do, but in the absence of any specific setting,
|
||||
* we use that (rsa_alt_sign_wrap in pk_wrap will check). */
|
||||
* we use that (rsa_alt_sign_wrap in library/pk_wrap.h will check). */
|
||||
#undef MBEDTLS_PK_SIGNATURE_MAX_SIZE
|
||||
#define MBEDTLS_PK_SIGNATURE_MAX_SIZE MBEDTLS_MPI_MAX_SIZE
|
||||
#endif
|
||||
|
@ -760,7 +757,7 @@ int mbedtls_pk_parse_public_keyfile( mbedtls_pk_context *ctx, const char *path )
|
|||
* \return length of data written if successful, or a specific
|
||||
* error code
|
||||
*/
|
||||
int mbedtls_pk_write_key_der( mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
|
||||
int mbedtls_pk_write_key_der( const mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
|
||||
|
||||
/**
|
||||
* \brief Write a public key to a SubjectPublicKeyInfo DER structure
|
||||
|
@ -775,7 +772,7 @@ int mbedtls_pk_write_key_der( mbedtls_pk_context *ctx, unsigned char *buf, size_
|
|||
* \return length of data written if successful, or a specific
|
||||
* error code
|
||||
*/
|
||||
int mbedtls_pk_write_pubkey_der( mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
|
||||
int mbedtls_pk_write_pubkey_der( const mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
|
||||
|
||||
#if defined(MBEDTLS_PEM_WRITE_C)
|
||||
/**
|
||||
|
@ -788,7 +785,7 @@ int mbedtls_pk_write_pubkey_der( mbedtls_pk_context *ctx, unsigned char *buf, si
|
|||
*
|
||||
* \return 0 if successful, or a specific error code
|
||||
*/
|
||||
int mbedtls_pk_write_pubkey_pem( mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
|
||||
int mbedtls_pk_write_pubkey_pem( const mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
|
||||
|
||||
/**
|
||||
* \brief Write a private key to a PKCS#1 or SEC1 PEM string
|
||||
|
@ -800,7 +797,7 @@ int mbedtls_pk_write_pubkey_pem( mbedtls_pk_context *ctx, unsigned char *buf, si
|
|||
*
|
||||
* \return 0 if successful, or a specific error code
|
||||
*/
|
||||
int mbedtls_pk_write_key_pem( mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
|
||||
int mbedtls_pk_write_key_pem( const mbedtls_pk_context *ctx, unsigned char *buf, size_t size );
|
||||
#endif /* MBEDTLS_PEM_WRITE_C */
|
||||
#endif /* MBEDTLS_PK_WRITE_C */
|
||||
|
||||
|
|
|
@ -1,246 +0,0 @@
|
|||
/**
|
||||
* \file pkcs11.h
|
||||
*
|
||||
* \brief Wrapper for PKCS#11 library libpkcs11-helper
|
||||
*
|
||||
* \author Adriaan de Jong <dejong@fox-it.com>
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBEDTLS_PKCS11_H
|
||||
#define MBEDTLS_PKCS11_H
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PKCS11_C)
|
||||
|
||||
#include "mbedtls/x509_crt.h"
|
||||
|
||||
#include <pkcs11-helper-1.0/pkcs11h-certificate.h>
|
||||
|
||||
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
|
||||
!defined(inline) && !defined(__cplusplus)
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
|
||||
/**
|
||||
* Context for PKCS #11 private keys.
|
||||
*/
|
||||
typedef struct mbedtls_pkcs11_context
|
||||
{
|
||||
pkcs11h_certificate_t pkcs11h_cert;
|
||||
int len;
|
||||
} mbedtls_pkcs11_context;
|
||||
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initialize a mbedtls_pkcs11_context.
|
||||
* (Just making memory references valid.)
|
||||
*
|
||||
* \deprecated This function is deprecated and will be removed in a
|
||||
* future version of the library.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_pkcs11_init( mbedtls_pkcs11_context *ctx );
|
||||
|
||||
/**
|
||||
* Fill in a mbed TLS certificate, based on the given PKCS11 helper certificate.
|
||||
*
|
||||
* \deprecated This function is deprecated and will be removed in a
|
||||
* future version of the library.
|
||||
*
|
||||
* \param cert X.509 certificate to fill
|
||||
* \param pkcs11h_cert PKCS #11 helper certificate
|
||||
*
|
||||
* \return 0 on success.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED int mbedtls_pkcs11_x509_cert_bind( mbedtls_x509_crt *cert,
|
||||
pkcs11h_certificate_t pkcs11h_cert );
|
||||
|
||||
/**
|
||||
* Set up a mbedtls_pkcs11_context storing the given certificate. Note that the
|
||||
* mbedtls_pkcs11_context will take over control of the certificate, freeing it when
|
||||
* done.
|
||||
*
|
||||
* \deprecated This function is deprecated and will be removed in a
|
||||
* future version of the library.
|
||||
*
|
||||
* \param priv_key Private key structure to fill.
|
||||
* \param pkcs11_cert PKCS #11 helper certificate
|
||||
*
|
||||
* \return 0 on success
|
||||
*/
|
||||
MBEDTLS_DEPRECATED int mbedtls_pkcs11_priv_key_bind(
|
||||
mbedtls_pkcs11_context *priv_key,
|
||||
pkcs11h_certificate_t pkcs11_cert );
|
||||
|
||||
/**
|
||||
* Free the contents of the given private key context. Note that the structure
|
||||
* itself is not freed.
|
||||
*
|
||||
* \deprecated This function is deprecated and will be removed in a
|
||||
* future version of the library.
|
||||
*
|
||||
* \param priv_key Private key structure to cleanup
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_pkcs11_priv_key_free(
|
||||
mbedtls_pkcs11_context *priv_key );
|
||||
|
||||
/**
|
||||
* \brief Do an RSA private key decrypt, then remove the message
|
||||
* padding
|
||||
*
|
||||
* \deprecated This function is deprecated and will be removed in a future
|
||||
* version of the library.
|
||||
*
|
||||
* \param ctx PKCS #11 context
|
||||
* \param mode must be MBEDTLS_RSA_PRIVATE, for compatibility with rsa.c's signature
|
||||
* \param input buffer holding the encrypted data
|
||||
* \param output buffer that will hold the plaintext
|
||||
* \param olen will contain the plaintext length
|
||||
* \param output_max_len maximum length of the output buffer
|
||||
*
|
||||
* \return 0 if successful, or an MBEDTLS_ERR_RSA_XXX error code
|
||||
*
|
||||
* \note The output buffer must be as large as the size
|
||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used) otherwise
|
||||
* an error is thrown.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED int mbedtls_pkcs11_decrypt( mbedtls_pkcs11_context *ctx,
|
||||
int mode, size_t *olen,
|
||||
const unsigned char *input,
|
||||
unsigned char *output,
|
||||
size_t output_max_len );
|
||||
|
||||
/**
|
||||
* \brief Do a private RSA to sign a message digest
|
||||
*
|
||||
* \deprecated This function is deprecated and will be removed in a future
|
||||
* version of the library.
|
||||
*
|
||||
* \param ctx PKCS #11 context
|
||||
* \param mode must be MBEDTLS_RSA_PRIVATE, for compatibility with rsa.c's signature
|
||||
* \param md_alg a MBEDTLS_MD_XXX (use MBEDTLS_MD_NONE for signing raw data)
|
||||
* \param hashlen message digest length (for MBEDTLS_MD_NONE only)
|
||||
* \param hash buffer holding the message digest
|
||||
* \param sig buffer that will hold the ciphertext
|
||||
*
|
||||
* \return 0 if the signing operation was successful,
|
||||
* or an MBEDTLS_ERR_RSA_XXX error code
|
||||
*
|
||||
* \note The "sig" buffer must be as large as the size
|
||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used).
|
||||
*/
|
||||
MBEDTLS_DEPRECATED int mbedtls_pkcs11_sign( mbedtls_pkcs11_context *ctx,
|
||||
int mode,
|
||||
mbedtls_md_type_t md_alg,
|
||||
unsigned int hashlen,
|
||||
const unsigned char *hash,
|
||||
unsigned char *sig );
|
||||
|
||||
/**
|
||||
* SSL/TLS wrappers for PKCS#11 functions
|
||||
*
|
||||
* \deprecated This function is deprecated and will be removed in a future
|
||||
* version of the library.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED static inline int mbedtls_ssl_pkcs11_decrypt( void *ctx,
|
||||
int mode, size_t *olen,
|
||||
const unsigned char *input, unsigned char *output,
|
||||
size_t output_max_len )
|
||||
{
|
||||
return mbedtls_pkcs11_decrypt( (mbedtls_pkcs11_context *) ctx, mode, olen, input, output,
|
||||
output_max_len );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief This function signs a message digest using RSA.
|
||||
*
|
||||
* \deprecated This function is deprecated and will be removed in a future
|
||||
* version of the library.
|
||||
*
|
||||
* \param ctx The PKCS #11 context.
|
||||
* \param f_rng The RNG function. This parameter is unused.
|
||||
* \param p_rng The RNG context. This parameter is unused.
|
||||
* \param mode The operation to run. This must be set to
|
||||
* MBEDTLS_RSA_PRIVATE, for compatibility with rsa.c's
|
||||
* signature.
|
||||
* \param md_alg The message digest algorithm. One of the MBEDTLS_MD_XXX
|
||||
* must be passed to this function and MBEDTLS_MD_NONE can be
|
||||
* used for signing raw data.
|
||||
* \param hashlen The message digest length (for MBEDTLS_MD_NONE only).
|
||||
* \param hash The buffer holding the message digest.
|
||||
* \param sig The buffer that will hold the ciphertext.
|
||||
*
|
||||
* \return \c 0 if the signing operation was successful.
|
||||
* \return A non-zero error code on failure.
|
||||
*
|
||||
* \note The \p sig buffer must be as large as the size of
|
||||
* <code>ctx->N</code>. For example, 128 bytes if RSA-1024 is
|
||||
* used.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED static inline int mbedtls_ssl_pkcs11_sign( void *ctx,
|
||||
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
|
||||
int mode, mbedtls_md_type_t md_alg, unsigned int hashlen,
|
||||
const unsigned char *hash, unsigned char *sig )
|
||||
{
|
||||
((void) f_rng);
|
||||
((void) p_rng);
|
||||
return mbedtls_pkcs11_sign( (mbedtls_pkcs11_context *) ctx, mode, md_alg,
|
||||
hashlen, hash, sig );
|
||||
}
|
||||
|
||||
/**
|
||||
* This function gets the length of the private key.
|
||||
*
|
||||
* \deprecated This function is deprecated and will be removed in a future
|
||||
* version of the library.
|
||||
*
|
||||
* \param ctx The PKCS #11 context.
|
||||
*
|
||||
* \return The length of the private key.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED static inline size_t mbedtls_ssl_pkcs11_key_len( void *ctx )
|
||||
{
|
||||
return ( (mbedtls_pkcs11_context *) ctx )->len;
|
||||
}
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MBEDTLS_PKCS11_C */
|
||||
|
||||
#endif /* MBEDTLS_PKCS11_H */
|
|
@ -41,9 +41,6 @@
|
|||
#include "mbedtls/platform_time.h"
|
||||
#endif
|
||||
|
||||
#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED -0x0070 /**< Hardware accelerator failed */
|
||||
#define MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED -0x0072 /**< The requested feature is not supported by the platform */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -43,14 +43,6 @@
|
|||
|
||||
#define MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA -0x0057 /**< Invalid input parameter(s). */
|
||||
|
||||
/* MBEDTLS_ERR_POLY1305_FEATURE_UNAVAILABLE is deprecated and should not be
|
||||
* used. */
|
||||
#define MBEDTLS_ERR_POLY1305_FEATURE_UNAVAILABLE -0x0059 /**< Feature not available. For example, s part of the API is not implemented. */
|
||||
|
||||
/* MBEDTLS_ERR_POLY1305_HW_ACCEL_FAILED is deprecated and should not be used.
|
||||
*/
|
||||
#define MBEDTLS_ERR_POLY1305_HW_ACCEL_FAILED -0x005B /**< Poly1305 hardware accelerator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "mbedtls/md.h"
|
||||
#include "mbedtls/pk.h"
|
||||
#include "mbedtls/oid.h"
|
||||
#include "mbedtls/error.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -92,8 +93,8 @@ static inline psa_algorithm_t mbedtls_psa_translate_cipher_mode(
|
|||
case MBEDTLS_MODE_CBC:
|
||||
if( taglen == 0 )
|
||||
return( PSA_ALG_CBC_NO_PADDING );
|
||||
/* Intentional fallthrough for taglen != 0 */
|
||||
/* fallthrough */
|
||||
else
|
||||
return( 0 );
|
||||
default:
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -151,7 +152,8 @@ static inline psa_algorithm_t mbedtls_psa_translate_md( mbedtls_md_type_t md_alg
|
|||
case MBEDTLS_MD_RIPEMD160:
|
||||
return( PSA_ALG_RIPEMD160 );
|
||||
#endif
|
||||
case MBEDTLS_MD_NONE: /* Intentional fallthrough */
|
||||
case MBEDTLS_MD_NONE:
|
||||
return( 0 );
|
||||
default:
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -352,11 +354,11 @@ static inline int mbedtls_psa_err_translate_pk( psa_status_t status )
|
|||
case PSA_ERROR_COMMUNICATION_FAILURE:
|
||||
case PSA_ERROR_HARDWARE_FAILURE:
|
||||
case PSA_ERROR_CORRUPTION_DETECTED:
|
||||
return( MBEDTLS_ERR_PK_HW_ACCEL_FAILED );
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
default: /* We return the same as for the 'other failures',
|
||||
* but list them separately nonetheless to indicate
|
||||
* which failure conditions we have considered. */
|
||||
return( MBEDTLS_ERR_PK_HW_ACCEL_FAILED );
|
||||
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED is deprecated and should not be used.
|
||||
*/
|
||||
#define MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED -0x0031 /**< RIPEMD160 hardware accelerator failed */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -125,63 +121,6 @@ int mbedtls_ripemd160_finish_ret( mbedtls_ripemd160_context *ctx,
|
|||
int mbedtls_internal_ripemd160_process( mbedtls_ripemd160_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief RIPEMD-160 context setup
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_ripemd160_starts_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_ripemd160_starts(
|
||||
mbedtls_ripemd160_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief RIPEMD-160 process buffer
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_ripemd160_update_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx RIPEMD-160 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_ripemd160_update(
|
||||
mbedtls_ripemd160_context *ctx,
|
||||
const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief RIPEMD-160 final digest
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_ripemd160_finish_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx RIPEMD-160 context
|
||||
* \param output RIPEMD-160 checksum result
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_ripemd160_finish(
|
||||
mbedtls_ripemd160_context *ctx,
|
||||
unsigned char output[20] );
|
||||
|
||||
/**
|
||||
* \brief RIPEMD-160 process data block (internal use only)
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_ripemd160_process() in 2.7.0
|
||||
*
|
||||
* \param ctx RIPEMD-160 context
|
||||
* \param data buffer holding one block of data
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_ripemd160_process(
|
||||
mbedtls_ripemd160_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief Output = RIPEMD-160( input buffer )
|
||||
*
|
||||
|
@ -195,28 +134,6 @@ int mbedtls_ripemd160_ret( const unsigned char *input,
|
|||
size_t ilen,
|
||||
unsigned char output[20] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief Output = RIPEMD-160( input buffer )
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_ripemd160_ret() in 2.7.0
|
||||
*
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output RIPEMD-160 checksum result
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_ripemd160( const unsigned char *input,
|
||||
size_t ilen,
|
||||
unsigned char output[20] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,13 +54,6 @@
|
|||
#define MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE -0x4400 /**< The output buffer for decryption is not large enough. */
|
||||
#define MBEDTLS_ERR_RSA_RNG_FAILED -0x4480 /**< The random generator failed to generate non-zeros. */
|
||||
|
||||
/* MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION is deprecated and should not be used.
|
||||
*/
|
||||
#define MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION -0x4500 /**< The implementation does not offer the requested operation, for example, because of security violations or lack of functionality. */
|
||||
|
||||
/* MBEDTLS_ERR_RSA_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_RSA_HW_ACCEL_FAILED -0x4580 /**< RSA hardware accelerator failed. */
|
||||
|
||||
/*
|
||||
* RSA constants
|
||||
*/
|
||||
|
@ -972,6 +965,59 @@ int mbedtls_rsa_rsassa_pkcs1_v15_sign( mbedtls_rsa_context *ctx,
|
|||
const unsigned char *hash,
|
||||
unsigned char *sig );
|
||||
|
||||
/**
|
||||
* \brief This function performs a PKCS#1 v2.1 PSS signature
|
||||
* operation (RSASSA-PSS-SIGN).
|
||||
*
|
||||
* \note The \p hash_id in the RSA context is the one used for the
|
||||
* encoding. \p md_alg in the function call is the type of hash
|
||||
* that is encoded. According to <em>RFC-3447: Public-Key
|
||||
* Cryptography Standards (PKCS) #1 v2.1: RSA Cryptography
|
||||
* Specifications</em> it is advised to keep both hashes the
|
||||
* same.
|
||||
*
|
||||
* \note This function enforces that the provided salt length complies
|
||||
* with FIPS 186-4 §5.5 (e) and RFC 8017 (PKCS#1 v2.2) §9.1.1
|
||||
* step 3. The constraint is that the hash length plus the salt
|
||||
* length plus 2 bytes must be at most the key length. If this
|
||||
* constraint is not met, this function returns
|
||||
* #MBEDTLS_ERR_RSA_BAD_INPUT_DATA.
|
||||
*
|
||||
* \param ctx The initialized RSA context to use.
|
||||
* \param f_rng The RNG function. It must not be \c NULL.
|
||||
* \param p_rng The RNG context to be passed to \p f_rng. This may be \c NULL
|
||||
* if \p f_rng doesn't need a context argument.
|
||||
* \param md_alg The message-digest algorithm used to hash the original data.
|
||||
* Use #MBEDTLS_MD_NONE for signing raw data.
|
||||
* \param hashlen The length of the message digest.
|
||||
* Ths is only used if \p md_alg is #MBEDTLS_MD_NONE.
|
||||
* \param hash The buffer holding the message digest or raw data.
|
||||
* If \p md_alg is #MBEDTLS_MD_NONE, this must be a readable
|
||||
* buffer of length \p hashlen Bytes. If \p md_alg is not
|
||||
* #MBEDTLS_MD_NONE, it must be a readable buffer of length
|
||||
* the size of the hash corresponding to \p md_alg.
|
||||
* \param saltlen The length of the salt that should be used.
|
||||
* If passed #MBEDTLS_RSA_SALT_LEN_ANY, the function will use
|
||||
* the largest possible salt length up to the hash length,
|
||||
* which is the largest permitted by some standards including
|
||||
* FIPS 186-4 §5.5.
|
||||
* \param sig The buffer to hold the signature. This must be a writable
|
||||
* buffer of length \c ctx->len Bytes. For example, \c 256 Bytes
|
||||
* for an 2048-bit RSA modulus. A buffer length of
|
||||
* #MBEDTLS_MPI_MAX_SIZE is always safe.
|
||||
*
|
||||
* \return \c 0 if the signing operation was successful.
|
||||
* \return An \c MBEDTLS_ERR_RSA_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_rsa_rsassa_pss_sign_ext( mbedtls_rsa_context *ctx,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng,
|
||||
mbedtls_md_type_t md_alg,
|
||||
unsigned int hashlen,
|
||||
const unsigned char *hash,
|
||||
int saltlen,
|
||||
unsigned char *sig );
|
||||
|
||||
/**
|
||||
* \brief This function performs a PKCS#1 v2.1 PSS signature
|
||||
* operation (RSASSA-PSS-SIGN).
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035 /**< SHA-1 hardware accelerator failed */
|
||||
#define MBEDTLS_ERR_SHA1_BAD_INPUT_DATA -0x0073 /**< SHA-1 input data was malformed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -185,85 +183,6 @@ int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx,
|
|||
int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function starts a SHA-1 checksum calculation.
|
||||
*
|
||||
* \warning SHA-1 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha1_starts_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-1 context to initialize. This must be initialized.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief This function feeds an input buffer into an ongoing SHA-1
|
||||
* checksum calculation.
|
||||
*
|
||||
* \warning SHA-1 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha1_update_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-1 context. This must be initialized and
|
||||
* have a hash operation started.
|
||||
* \param input The buffer holding the input data.
|
||||
* This must be a readable buffer of length \p ilen Bytes.
|
||||
* \param ilen The length of the input data \p input in Bytes.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha1_update( mbedtls_sha1_context *ctx,
|
||||
const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief This function finishes the SHA-1 operation, and writes
|
||||
* the result to the output buffer.
|
||||
*
|
||||
* \warning SHA-1 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha1_finish_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-1 context. This must be initialized and
|
||||
* have a hash operation started.
|
||||
* \param output The SHA-1 checksum result.
|
||||
* This must be a writable buffer of length \c 20 Bytes.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha1_finish( mbedtls_sha1_context *ctx,
|
||||
unsigned char output[20] );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 process data block (internal use only).
|
||||
*
|
||||
* \warning SHA-1 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_sha1_process() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-1 context. This must be initialized.
|
||||
* \param data The data block being processed.
|
||||
* This must be a readable buffer of length \c 64 bytes.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha1_process( mbedtls_sha1_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief This function calculates the SHA-1 checksum of a buffer.
|
||||
*
|
||||
|
@ -291,41 +210,6 @@ int mbedtls_sha1_ret( const unsigned char *input,
|
|||
size_t ilen,
|
||||
unsigned char output[20] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function calculates the SHA-1 checksum of a buffer.
|
||||
*
|
||||
* The function allocates the context, performs the
|
||||
* calculation, and frees the context.
|
||||
*
|
||||
* The SHA-1 result is calculated as
|
||||
* output = SHA-1(input buffer).
|
||||
*
|
||||
* \warning SHA-1 is considered a weak message digest and its use
|
||||
* constitutes a security risk. We recommend considering
|
||||
* stronger message digests instead.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha1_ret() in 2.7.0
|
||||
*
|
||||
* \param input The buffer holding the input data.
|
||||
* This must be a readable buffer of length \p ilen Bytes.
|
||||
* \param ilen The length of the input data \p input in Bytes.
|
||||
* \param output The SHA-1 checksum result. This must be a writable
|
||||
* buffer of size \c 20 Bytes.
|
||||
*
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha1( const unsigned char *input,
|
||||
size_t ilen,
|
||||
unsigned char output[20] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037 /**< SHA-256 hardware accelerator failed */
|
||||
#define MBEDTLS_ERR_SHA256_BAD_INPUT_DATA -0x0074 /**< SHA-256 input data was malformed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -152,72 +150,6 @@ int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
|
|||
int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function starts a SHA-224 or SHA-256 checksum
|
||||
* calculation.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha256_starts_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The context to use. This must be initialized.
|
||||
* \param is224 Determines which function to use. This must be
|
||||
* either \c 0 for SHA-256, or \c 1 for SHA-224.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha256_starts( mbedtls_sha256_context *ctx,
|
||||
int is224 );
|
||||
|
||||
/**
|
||||
* \brief This function feeds an input buffer into an ongoing
|
||||
* SHA-256 checksum calculation.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha256_update_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-256 context to use. This must be
|
||||
* initialized and have a hash operation started.
|
||||
* \param input The buffer holding the data. This must be a readable
|
||||
* buffer of length \p ilen Bytes.
|
||||
* \param ilen The length of the input data in Bytes.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha256_update( mbedtls_sha256_context *ctx,
|
||||
const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief This function finishes the SHA-256 operation, and writes
|
||||
* the result to the output buffer.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha256_finish_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-256 context. This must be initialized and
|
||||
* have a hash operation started.
|
||||
* \param output The SHA-224 or SHA-256 checksum result. This must be
|
||||
* a writable buffer of length \c 32 Bytes.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha256_finish( mbedtls_sha256_context *ctx,
|
||||
unsigned char output[32] );
|
||||
|
||||
/**
|
||||
* \brief This function processes a single data block within
|
||||
* the ongoing SHA-256 computation. This function is for
|
||||
* internal use only.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_sha256_process() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-256 context. This must be initialized.
|
||||
* \param data The buffer holding one block of data. This must be
|
||||
* a readable buffer of size \c 64 Bytes.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha256_process( mbedtls_sha256_context *ctx,
|
||||
const unsigned char data[64] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief This function calculates the SHA-224 or SHA-256
|
||||
* checksum of a buffer.
|
||||
|
@ -241,41 +173,6 @@ int mbedtls_sha256_ret( const unsigned char *input,
|
|||
unsigned char output[32],
|
||||
int is224 );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief This function calculates the SHA-224 or SHA-256 checksum
|
||||
* of a buffer.
|
||||
*
|
||||
* The function allocates the context, performs the
|
||||
* calculation, and frees the context.
|
||||
*
|
||||
* The SHA-256 result is calculated as
|
||||
* output = SHA-256(input buffer).
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha256_ret() in 2.7.0.
|
||||
*
|
||||
* \param input The buffer holding the data. This must be a readable
|
||||
* buffer of length \p ilen Bytes.
|
||||
* \param ilen The length of the input data in Bytes.
|
||||
* \param output The SHA-224 or SHA-256 checksum result. This must be
|
||||
* a writable buffer of length \c 32 Bytes.
|
||||
* \param is224 Determines which function to use. This must be either
|
||||
* \c 0 for SHA-256, or \c 1 for SHA-224.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha256( const unsigned char *input,
|
||||
size_t ilen,
|
||||
unsigned char output[32],
|
||||
int is224 );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED -0x0039 /**< SHA-512 hardware accelerator failed */
|
||||
#define MBEDTLS_ERR_SHA512_BAD_INPUT_DATA -0x0075 /**< SHA-512 input data was malformed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -158,75 +156,6 @@ int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
|
|||
*/
|
||||
int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx,
|
||||
const unsigned char data[128] );
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function starts a SHA-384 or SHA-512 checksum
|
||||
* calculation.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha512_starts_ret() in 2.7.0
|
||||
*
|
||||
* \param ctx The SHA-512 context to use. This must be initialized.
|
||||
* \param is384 Determines which function to use. This must be either
|
||||
* \c 0 for SHA-512 or \c 1 for SHA-384.
|
||||
*
|
||||
* \note When \c MBEDTLS_SHA512_NO_SHA384 is defined, \p is384 must
|
||||
* be \c 0, or the function will fail to work.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha512_starts( mbedtls_sha512_context *ctx,
|
||||
int is384 );
|
||||
|
||||
/**
|
||||
* \brief This function feeds an input buffer into an ongoing
|
||||
* SHA-512 checksum calculation.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha512_update_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-512 context. This must be initialized
|
||||
* and have a hash operation started.
|
||||
* \param input The buffer holding the data. This must be a readable
|
||||
* buffer of length \p ilen Bytes.
|
||||
* \param ilen The length of the input data in Bytes.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha512_update( mbedtls_sha512_context *ctx,
|
||||
const unsigned char *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief This function finishes the SHA-512 operation, and writes
|
||||
* the result to the output buffer.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha512_finish_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-512 context. This must be initialized
|
||||
* and have a hash operation started.
|
||||
* \param output The SHA-384 or SHA-512 checksum result. This must
|
||||
* be a writable buffer of size \c 64 Bytes.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
|
||||
unsigned char output[64] );
|
||||
|
||||
/**
|
||||
* \brief This function processes a single data block within
|
||||
* the ongoing SHA-512 computation. This function is for
|
||||
* internal use only.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_sha512_process() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-512 context. This must be initialized.
|
||||
* \param data The buffer holding one block of data. This must be
|
||||
* a readable buffer of length \c 128 Bytes.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha512_process(
|
||||
mbedtls_sha512_context *ctx,
|
||||
const unsigned char data[128] );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief This function calculates the SHA-512 or SHA-384
|
||||
|
@ -258,44 +187,6 @@ int mbedtls_sha512_ret( const unsigned char *input,
|
|||
unsigned char output[64],
|
||||
int is384 );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief This function calculates the SHA-512 or SHA-384
|
||||
* checksum of a buffer.
|
||||
*
|
||||
* The function allocates the context, performs the
|
||||
* calculation, and frees the context.
|
||||
*
|
||||
* The SHA-512 result is calculated as
|
||||
* output = SHA-512(input buffer).
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha512_ret() in 2.7.0
|
||||
*
|
||||
* \param input The buffer holding the data. This must be a
|
||||
* readable buffer of length \p ilen Bytes.
|
||||
* \param ilen The length of the input data in Bytes.
|
||||
* \param output The SHA-384 or SHA-512 checksum result. This must
|
||||
* be a writable buffer of length \c 64 Bytes.
|
||||
* \param is384 Determines which function to use. This must be either
|
||||
* \c 0 for SHA-512, or \c 1 for SHA-384.
|
||||
*
|
||||
* \note When \c MBEDTLS_SHA512_NO_SHA384 is defined, \p is384 must
|
||||
* be \c 0, or the function will fail to work.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED void mbedtls_sha512( const unsigned char *input,
|
||||
size_t ilen,
|
||||
unsigned char output[64],
|
||||
int is384 );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,19 +51,6 @@
|
|||
#include "mbedtls/ecdh.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ZLIB_SUPPORT)
|
||||
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#warning "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and will be removed in the next major revision of the library"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#error "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and cannot be used if MBEDTLS_DEPRECATED_REMOVED is set"
|
||||
#endif
|
||||
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
#include "mbedtls/platform_time.h"
|
||||
#endif
|
||||
|
@ -107,7 +94,6 @@
|
|||
#define MBEDTLS_ERR_SSL_ALLOC_FAILED -0x7F00 /**< Memory allocation failed */
|
||||
#define MBEDTLS_ERR_SSL_HW_ACCEL_FAILED -0x7F80 /**< Hardware acceleration function returned with error */
|
||||
#define MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH -0x6F80 /**< Hardware acceleration function skipped / left alone data */
|
||||
#define MBEDTLS_ERR_SSL_COMPRESSION_FAILED -0x6F00 /**< Processing of the compression / decompression failed */
|
||||
#define MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION -0x6E80 /**< Handshake protocol not within min/max boundaries */
|
||||
#define MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET -0x6E00 /**< Processing of the NewSessionTicket handshake message failed. */
|
||||
#define MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED -0x6D80 /**< Session ticket has expired. */
|
||||
|
@ -137,8 +123,14 @@
|
|||
/*
|
||||
* Various constants
|
||||
*/
|
||||
|
||||
/* These are the high an low bytes of ProtocolVersion as defined by:
|
||||
* - RFC 2246: ProtocolVersion version = { 3, 1 }; // TLS v1.0
|
||||
* - RFC 4346: ProtocolVersion version = { 3, 2 }; // TLS v1.1
|
||||
* - RFC 5246: ProtocolVersion version = { 3, 3 }; // TLS v1.2
|
||||
* - RFC 8446: see section 4.2.1
|
||||
*/
|
||||
#define MBEDTLS_SSL_MAJOR_VERSION_3 3
|
||||
#define MBEDTLS_SSL_MINOR_VERSION_0 0 /*!< SSL v3.0 */
|
||||
#define MBEDTLS_SSL_MINOR_VERSION_1 1 /*!< TLS v1.0 */
|
||||
#define MBEDTLS_SSL_MINOR_VERSION_2 2 /*!< TLS v1.1 */
|
||||
#define MBEDTLS_SSL_MINOR_VERSION_3 3 /*!< TLS v1.2 */
|
||||
|
@ -177,7 +169,6 @@
|
|||
#define MBEDTLS_SSL_ETM_ENABLED 1
|
||||
|
||||
#define MBEDTLS_SSL_COMPRESS_NULL 0
|
||||
#define MBEDTLS_SSL_COMPRESS_DEFLATE 1
|
||||
|
||||
#define MBEDTLS_SSL_VERIFY_NONE 0
|
||||
#define MBEDTLS_SSL_VERIFY_OPTIONAL 1
|
||||
|
@ -210,9 +201,6 @@
|
|||
#define MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED 0
|
||||
#define MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED 1
|
||||
|
||||
#define MBEDTLS_SSL_ARC4_ENABLED 0
|
||||
#define MBEDTLS_SSL_ARC4_DISABLED 1
|
||||
|
||||
#define MBEDTLS_SSL_PRESET_DEFAULT 0
|
||||
#define MBEDTLS_SSL_PRESET_SUITEB 2
|
||||
|
||||
|
@ -237,10 +225,6 @@
|
|||
* \{
|
||||
*/
|
||||
|
||||
#if !defined(MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME)
|
||||
#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400 /**< Lifetime of session tickets (if enabled) */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Maximum fragment length in bytes,
|
||||
* determines the size of each of the two internal I/O buffers.
|
||||
|
@ -296,11 +280,7 @@
|
|||
/*
|
||||
* Length of the verify data for secure renegotiation
|
||||
*/
|
||||
#if defined(MBEDTLS_SSL_PROTO_SSL3)
|
||||
#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 36
|
||||
#else
|
||||
#define MBEDTLS_SSL_VERIFY_DATA_MAX_LEN 12
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Signaling ciphersuite values (SCSV)
|
||||
|
@ -499,7 +479,6 @@ mbedtls_ssl_states;
|
|||
typedef enum
|
||||
{
|
||||
MBEDTLS_SSL_TLS_PRF_NONE,
|
||||
MBEDTLS_SSL_TLS_PRF_SSL3,
|
||||
MBEDTLS_SSL_TLS_PRF_TLS1,
|
||||
MBEDTLS_SSL_TLS_PRF_SHA384,
|
||||
MBEDTLS_SSL_TLS_PRF_SHA256
|
||||
|
@ -619,7 +598,7 @@ typedef struct mbedtls_ssl_session mbedtls_ssl_session;
|
|||
typedef struct mbedtls_ssl_context mbedtls_ssl_context;
|
||||
typedef struct mbedtls_ssl_config mbedtls_ssl_config;
|
||||
|
||||
/* Defined in ssl_internal.h */
|
||||
/* Defined in library/ssl_misc.h */
|
||||
typedef struct mbedtls_ssl_transform mbedtls_ssl_transform;
|
||||
typedef struct mbedtls_ssl_handshake_params mbedtls_ssl_handshake_params;
|
||||
typedef struct mbedtls_ssl_sig_hash_set_t mbedtls_ssl_sig_hash_set_t;
|
||||
|
@ -961,7 +940,10 @@ struct mbedtls_ssl_config
|
|||
* Pointers
|
||||
*/
|
||||
|
||||
const int *ciphersuite_list[4]; /*!< allowed ciphersuites per version */
|
||||
/** Allowed ciphersuites per version. To access list's elements, please use
|
||||
* \c mbedtls_ssl_get_protocol_version_ciphersuites
|
||||
*/
|
||||
const int *ciphersuite_list[3];
|
||||
|
||||
/** Callback for printing debug output */
|
||||
void (*f_dbg)(void *, int, const char *, int, const char *);
|
||||
|
@ -1151,9 +1133,6 @@ struct mbedtls_ssl_config
|
|||
unsigned int authmode : 2; /*!< MBEDTLS_SSL_VERIFY_XXX */
|
||||
/* needed even with renego disabled for LEGACY_BREAK_HANDSHAKE */
|
||||
unsigned int allow_legacy_renegotiation : 2 ; /*!< MBEDTLS_LEGACY_XXX */
|
||||
#if defined(MBEDTLS_ARC4_C)
|
||||
unsigned int arc4_disabled : 1; /*!< blacklist RC4 ciphersuites? */
|
||||
#endif
|
||||
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
|
||||
unsigned int mfl_code : 3; /*!< desired fragment length */
|
||||
#endif
|
||||
|
@ -1212,7 +1191,7 @@ struct mbedtls_ssl_context
|
|||
#endif /* MBEDTLS_SSL_RENEGOTIATION */
|
||||
|
||||
int major_ver; /*!< equal to MBEDTLS_SSL_MAJOR_VERSION_3 */
|
||||
int minor_ver; /*!< either 0 (SSL3) or 1 (TLS1.0) */
|
||||
int minor_ver; /*!< one of MBEDTLS_SSL_MINOR_VERSION_x macros */
|
||||
|
||||
#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT)
|
||||
unsigned badmac_seen; /*!< records with a bad MAC received */
|
||||
|
@ -1330,9 +1309,6 @@ struct mbedtls_ssl_context
|
|||
uint16_t mtu; /*!< path mtu, used to fragment outgoing messages */
|
||||
#endif /* MBEDTLS_SSL_PROTO_DTLS */
|
||||
|
||||
#if defined(MBEDTLS_ZLIB_SUPPORT)
|
||||
unsigned char *compress_buf; /*!< zlib data buffer */
|
||||
#endif /* MBEDTLS_ZLIB_SUPPORT */
|
||||
#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING)
|
||||
signed char split_done; /*!< current record already splitted? */
|
||||
#endif /* MBEDTLS_SSL_CBC_RECORD_SPLITTING */
|
||||
|
@ -1397,44 +1373,6 @@ struct mbedtls_ssl_context
|
|||
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
||||
};
|
||||
|
||||
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
|
||||
#define MBEDTLS_SSL_CHANNEL_OUTBOUND MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( 0 )
|
||||
#define MBEDTLS_SSL_CHANNEL_INBOUND MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( 1 )
|
||||
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif /* MBEDTLS_DEPRECATED_WARNING */
|
||||
|
||||
MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_init)(
|
||||
mbedtls_ssl_context *ssl,
|
||||
const unsigned char *key_enc, const unsigned char *key_dec,
|
||||
size_t keylen,
|
||||
const unsigned char *iv_enc, const unsigned char *iv_dec,
|
||||
size_t ivlen,
|
||||
const unsigned char *mac_enc, const unsigned char *mac_dec,
|
||||
size_t maclen);
|
||||
MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_activate)(
|
||||
mbedtls_ssl_context *ssl,
|
||||
int direction );
|
||||
MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_reset)(
|
||||
mbedtls_ssl_context *ssl );
|
||||
MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_write)(
|
||||
mbedtls_ssl_context *ssl );
|
||||
MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_read)(
|
||||
mbedtls_ssl_context *ssl );
|
||||
MBEDTLS_DEPRECATED extern int (*mbedtls_ssl_hw_record_finish)(
|
||||
mbedtls_ssl_context *ssl );
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
|
||||
|
||||
/**
|
||||
* \brief Return the name of the ciphersuite associated with the
|
||||
* given ID
|
||||
|
@ -1493,9 +1431,8 @@ int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
|
|||
* pointers and data.
|
||||
*
|
||||
* \param ssl SSL context
|
||||
* \return 0 if successful, or MBEDTLS_ERR_SSL_ALLOC_FAILED,
|
||||
MBEDTLS_ERR_SSL_HW_ACCEL_FAILED or
|
||||
* MBEDTLS_ERR_SSL_COMPRESSION_FAILED
|
||||
* \return 0 if successful, or MBEDTLS_ERR_SSL_ALLOC_FAILED or
|
||||
MBEDTLS_ERR_SSL_HW_ACCEL_FAILED
|
||||
*/
|
||||
int mbedtls_ssl_session_reset( mbedtls_ssl_context *ssl );
|
||||
|
||||
|
@ -1810,9 +1747,6 @@ int mbedtls_ssl_get_peer_cid( mbedtls_ssl_context *ssl,
|
|||
* \note Values lower than the current record layer expansion will
|
||||
* result in an error when trying to send data.
|
||||
*
|
||||
* \note Using record compression together with a non-zero MTU value
|
||||
* will result in an error when trying to send data.
|
||||
*
|
||||
* \param ssl SSL context
|
||||
* \param mtu Value of the path MTU in bytes
|
||||
*/
|
||||
|
@ -2557,6 +2491,17 @@ const mbedtls_ssl_session *mbedtls_ssl_get_session_pointer( const mbedtls_ssl_co
|
|||
void mbedtls_ssl_conf_ciphersuites( mbedtls_ssl_config *conf,
|
||||
const int *ciphersuites );
|
||||
|
||||
/**
|
||||
* \brief Get ciphersuite for given protocol's minor version.
|
||||
*
|
||||
* \param conf The SSL configuration.
|
||||
* \param prot_version Protocol version. One of MBEDTLS_SSL_MINOR_VERSION_x macros.
|
||||
* \return Ciphersuites pointer if succesful.
|
||||
* \return \c NULL if no ciphersuites where found.
|
||||
*/
|
||||
const int *mbedtls_ssl_get_protocol_version_ciphersuites(
|
||||
const mbedtls_ssl_config *conf, int prot_version );
|
||||
|
||||
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
||||
#define MBEDTLS_SSL_UNEXPECTED_CID_IGNORE 0
|
||||
#define MBEDTLS_SSL_UNEXPECTED_CID_FAIL 1
|
||||
|
@ -2608,8 +2553,8 @@ int mbedtls_ssl_conf_cid( mbedtls_ssl_config *conf, size_t len,
|
|||
* \param ciphersuites 0-terminated list of allowed ciphersuites
|
||||
* \param major Major version number (only MBEDTLS_SSL_MAJOR_VERSION_3
|
||||
* supported)
|
||||
* \param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_0,
|
||||
* MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,
|
||||
* \param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_1,
|
||||
* MBEDTLS_SSL_MINOR_VERSION_2,
|
||||
* MBEDTLS_SSL_MINOR_VERSION_3 supported)
|
||||
*
|
||||
* \note With DTLS, use MBEDTLS_SSL_MINOR_VERSION_2 for DTLS 1.0
|
||||
|
@ -2914,34 +2859,6 @@ void mbedtls_ssl_conf_psk_cb( mbedtls_ssl_config *conf,
|
|||
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_DHM_C) && defined(MBEDTLS_SSL_SRV_C)
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Set the Diffie-Hellman public P and G values,
|
||||
* read as hexadecimal strings (server-side only)
|
||||
* (Default values: MBEDTLS_DHM_RFC3526_MODP_2048_[PG])
|
||||
*
|
||||
* \param conf SSL configuration
|
||||
* \param dhm_P Diffie-Hellman-Merkle modulus
|
||||
* \param dhm_G Diffie-Hellman-Merkle generator
|
||||
*
|
||||
* \deprecated Superseded by \c mbedtls_ssl_conf_dh_param_bin.
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
MBEDTLS_DEPRECATED int mbedtls_ssl_conf_dh_param( mbedtls_ssl_config *conf,
|
||||
const char *dhm_P,
|
||||
const char *dhm_G );
|
||||
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/**
|
||||
* \brief Set the Diffie-Hellman public P and G values
|
||||
* from big-endian binary presentations.
|
||||
|
@ -3296,8 +3213,7 @@ void mbedtls_ssl_get_dtls_srtp_negotiation_result( const mbedtls_ssl_context *ss
|
|||
*
|
||||
* \param conf SSL configuration
|
||||
* \param major Major version number (only MBEDTLS_SSL_MAJOR_VERSION_3 supported)
|
||||
* \param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_0,
|
||||
* MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,
|
||||
* \param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,
|
||||
* MBEDTLS_SSL_MINOR_VERSION_3 supported)
|
||||
*/
|
||||
void mbedtls_ssl_conf_max_version( mbedtls_ssl_config *conf, int major, int minor );
|
||||
|
@ -3309,15 +3225,13 @@ void mbedtls_ssl_conf_max_version( mbedtls_ssl_config *conf, int major, int mino
|
|||
* \note Input outside of the SSL_MAX_XXXXX_VERSION and
|
||||
* SSL_MIN_XXXXX_VERSION range is ignored.
|
||||
*
|
||||
* \note MBEDTLS_SSL_MINOR_VERSION_0 (SSL v3) should be avoided.
|
||||
*
|
||||
* \note With DTLS, use MBEDTLS_SSL_MINOR_VERSION_2 for DTLS 1.0 and
|
||||
* MBEDTLS_SSL_MINOR_VERSION_3 for DTLS 1.2
|
||||
*
|
||||
* \param conf SSL configuration
|
||||
* \param major Major version number (only MBEDTLS_SSL_MAJOR_VERSION_3 supported)
|
||||
* \param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_0,
|
||||
* MBEDTLS_SSL_MINOR_VERSION_1 and MBEDTLS_SSL_MINOR_VERSION_2,
|
||||
* \param minor Minor version number (MBEDTLS_SSL_MINOR_VERSION_1,
|
||||
* MBEDTLS_SSL_MINOR_VERSION_2,
|
||||
* MBEDTLS_SSL_MINOR_VERSION_3 supported)
|
||||
*/
|
||||
void mbedtls_ssl_conf_min_version( mbedtls_ssl_config *conf, int major, int minor );
|
||||
|
@ -3375,25 +3289,6 @@ void mbedtls_ssl_conf_encrypt_then_mac( mbedtls_ssl_config *conf, char etm );
|
|||
void mbedtls_ssl_conf_extended_master_secret( mbedtls_ssl_config *conf, char ems );
|
||||
#endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
|
||||
|
||||
#if defined(MBEDTLS_ARC4_C)
|
||||
/**
|
||||
* \brief Disable or enable support for RC4
|
||||
* (Default: MBEDTLS_SSL_ARC4_DISABLED)
|
||||
*
|
||||
* \warning Use of RC4 in DTLS/TLS has been prohibited by RFC 7465
|
||||
* for security reasons. Use at your own risk.
|
||||
*
|
||||
* \note This function is deprecated and will be removed in
|
||||
* a future version of the library.
|
||||
* RC4 is disabled by default at compile time and needs to be
|
||||
* actively enabled for use with legacy systems.
|
||||
*
|
||||
* \param conf SSL configuration
|
||||
* \param arc4 MBEDTLS_SSL_ARC4_ENABLED or MBEDTLS_SSL_ARC4_DISABLED
|
||||
*/
|
||||
void mbedtls_ssl_conf_arc4_support( mbedtls_ssl_config *conf, char arc4 );
|
||||
#endif /* MBEDTLS_ARC4_C */
|
||||
|
||||
#if defined(MBEDTLS_SSL_SRV_C)
|
||||
/**
|
||||
* \brief Whether to send a list of acceptable CAs in
|
||||
|
@ -3463,7 +3358,7 @@ void mbedtls_ssl_conf_truncated_hmac( mbedtls_ssl_config *conf, int truncate );
|
|||
* \brief Enable / Disable 1/n-1 record splitting
|
||||
* (Default: MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED)
|
||||
*
|
||||
* \note Only affects SSLv3 and TLS 1.0, not higher versions.
|
||||
* \note Only affects TLS 1.0, not higher versions.
|
||||
* Does not affect non-CBC ciphersuites in any version.
|
||||
*
|
||||
* \param conf SSL configuration
|
||||
|
@ -3687,11 +3582,11 @@ uint32_t mbedtls_ssl_get_verify_result( const mbedtls_ssl_context *ssl );
|
|||
const char *mbedtls_ssl_get_ciphersuite( const mbedtls_ssl_context *ssl );
|
||||
|
||||
/**
|
||||
* \brief Return the current SSL version (SSLv3/TLSv1/etc)
|
||||
* \brief Return the current TLS version
|
||||
*
|
||||
* \param ssl SSL context
|
||||
*
|
||||
* \return a string containing the SSL version
|
||||
* \return a string containing the TLS version
|
||||
*/
|
||||
const char *mbedtls_ssl_get_version( const mbedtls_ssl_context *ssl );
|
||||
|
||||
|
@ -3699,14 +3594,9 @@ const char *mbedtls_ssl_get_version( const mbedtls_ssl_context *ssl );
|
|||
* \brief Return the (maximum) number of bytes added by the record
|
||||
* layer: header + encryption/MAC overhead (inc. padding)
|
||||
*
|
||||
* \note This function is not available (always returns an error)
|
||||
* when record compression is enabled.
|
||||
*
|
||||
* \param ssl SSL context
|
||||
*
|
||||
* \return Current maximum record expansion in bytes, or
|
||||
* MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE if compression is
|
||||
* enabled, which makes expansion much less predictable
|
||||
* \return Current maximum record expansion in bytes
|
||||
*/
|
||||
int mbedtls_ssl_get_record_expansion( const mbedtls_ssl_context *ssl );
|
||||
|
||||
|
@ -3741,32 +3631,6 @@ size_t mbedtls_ssl_get_output_max_frag_len( const mbedtls_ssl_context *ssl );
|
|||
* \return Current maximum fragment length for the output buffer.
|
||||
*/
|
||||
size_t mbedtls_ssl_get_input_max_frag_len( const mbedtls_ssl_context *ssl );
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief This function is a deprecated approach to getting the max
|
||||
* fragment length. Its an alias for
|
||||
* \c mbedtls_ssl_get_output_max_frag_len(), as the behaviour
|
||||
* is the same. See \c mbedtls_ssl_get_output_max_frag_len() for
|
||||
* more detail.
|
||||
*
|
||||
* \sa mbedtls_ssl_get_input_max_frag_len()
|
||||
* \sa mbedtls_ssl_get_output_max_frag_len()
|
||||
*
|
||||
* \param ssl SSL context
|
||||
*
|
||||
* \return Current maximum fragment length for the output buffer.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED size_t mbedtls_ssl_get_max_frag_len(
|
||||
const mbedtls_ssl_context *ssl );
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
|
||||
|
||||
/**
|
||||
|
@ -3783,9 +3647,6 @@ MBEDTLS_DEPRECATED size_t mbedtls_ssl_get_max_frag_len(
|
|||
* to the caller to call \c mbedtls_ssl_write() again in
|
||||
* order to send the remaining bytes if any.
|
||||
*
|
||||
* \note This function is not available (always returns an error)
|
||||
* when record compression is enabled.
|
||||
*
|
||||
* \sa mbedtls_ssl_set_mtu()
|
||||
* \sa mbedtls_ssl_get_output_max_frag_len()
|
||||
* \sa mbedtls_ssl_get_input_max_frag_len()
|
||||
|
|
|
@ -42,13 +42,8 @@ extern "C" {
|
|||
#define MBEDTLS_TLS_RSA_WITH_NULL_MD5 0x01 /**< Weak! */
|
||||
#define MBEDTLS_TLS_RSA_WITH_NULL_SHA 0x02 /**< Weak! */
|
||||
|
||||
#define MBEDTLS_TLS_RSA_WITH_RC4_128_MD5 0x04
|
||||
#define MBEDTLS_TLS_RSA_WITH_RC4_128_SHA 0x05
|
||||
#define MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA 0x09 /**< Weak! Not in TLS 1.2 */
|
||||
|
||||
#define MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA 0x0A
|
||||
|
||||
#define MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA 0x15 /**< Weak! Not in TLS 1.2 */
|
||||
#define MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 0x16
|
||||
|
||||
#define MBEDTLS_TLS_PSK_WITH_NULL_SHA 0x2C /**< Weak! */
|
||||
|
@ -73,17 +68,14 @@ extern "C" {
|
|||
#define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA 0x84
|
||||
#define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x88
|
||||
|
||||
#define MBEDTLS_TLS_PSK_WITH_RC4_128_SHA 0x8A
|
||||
#define MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA 0x8B
|
||||
#define MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA 0x8C
|
||||
#define MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA 0x8D
|
||||
|
||||
#define MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA 0x8E
|
||||
#define MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x8F
|
||||
#define MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA 0x90
|
||||
#define MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA 0x91
|
||||
|
||||
#define MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA 0x92
|
||||
#define MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x93
|
||||
#define MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA 0x94
|
||||
#define MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA 0x95
|
||||
|
@ -122,28 +114,24 @@ extern "C" {
|
|||
#define MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC4 /**< TLS 1.2 */
|
||||
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA 0xC001 /**< Weak! */
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA 0xC002 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC003 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0xC004 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0xC005 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC003
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0xC004
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0xC005
|
||||
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA 0xC006 /**< Weak! */
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA 0xC007 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC008 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0xC009 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0xC00A /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC008
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0xC009
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0xC00A
|
||||
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA 0xC00B /**< Weak! */
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA 0xC00C /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA 0xC00D /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA 0xC00E /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA 0xC00F /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA 0xC00D
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA 0xC00E
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA 0xC00F
|
||||
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA 0xC010 /**< Weak! */
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA 0xC011 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA 0xC012 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xC013 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xC014 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA 0xC012
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xC013
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xC014
|
||||
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xC023 /**< TLS 1.2 */
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 0xC024 /**< TLS 1.2 */
|
||||
|
@ -163,15 +151,14 @@ extern "C" {
|
|||
#define MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 0xC031 /**< TLS 1.2 */
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 0xC032 /**< TLS 1.2 */
|
||||
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA 0xC033 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0xC034 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA 0xC035 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA 0xC036 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0xC037 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0xC038 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA 0xC039 /**< Weak! No SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 0xC03A /**< Weak! No SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 0xC03B /**< Weak! No SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0xC034
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA 0xC035
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA 0xC036
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0xC037
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0xC038
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA 0xC039
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 0xC03A
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 0xC03B
|
||||
|
||||
#define MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256 0xC03C /**< TLS 1.2 */
|
||||
#define MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384 0xC03D /**< TLS 1.2 */
|
||||
|
@ -212,14 +199,14 @@ extern "C" {
|
|||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 0xC070 /**< TLS 1.2 */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 0xC071 /**< TLS 1.2 */
|
||||
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC072 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC073 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC074 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC075 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC076 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC077 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC078 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC079 /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC072
|
||||
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC073
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC074
|
||||
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC075
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC076
|
||||
#define MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC077
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC078
|
||||
#define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC079
|
||||
|
||||
#define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07A /**< TLS 1.2 */
|
||||
#define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07B /**< TLS 1.2 */
|
||||
|
@ -247,8 +234,8 @@ extern "C" {
|
|||
#define MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC097
|
||||
#define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC098
|
||||
#define MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC099
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC09A /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC09B /**< Not in SSL3! */
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC09A
|
||||
#define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC09B
|
||||
|
||||
#define MBEDTLS_TLS_RSA_WITH_AES_128_CCM 0xC09C /**< TLS 1.2 */
|
||||
#define MBEDTLS_TLS_RSA_WITH_AES_256_CCM 0xC09D /**< TLS 1.2 */
|
||||
|
|
|
@ -34,10 +34,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* MBEDTLS_ERR_THREADING_FEATURE_UNAVAILABLE is deprecated and should not be
|
||||
* used. */
|
||||
#define MBEDTLS_ERR_THREADING_FEATURE_UNAVAILABLE -0x001A /**< The selected feature is not available. */
|
||||
|
||||
#define MBEDTLS_ERR_THREADING_BAD_INPUT_DATA -0x001C /**< Bad input parameters to function. */
|
||||
#define MBEDTLS_ERR_THREADING_MUTEX_ERROR -0x001E /**< Locking / unlocking / free failed with error code. */
|
||||
|
||||
|
|
|
@ -291,17 +291,6 @@ int mbedtls_x509_time_is_past( const mbedtls_x509_time *to );
|
|||
*/
|
||||
int mbedtls_x509_time_is_future( const mbedtls_x509_time *from );
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/**
|
||||
* \brief Checkup routine
|
||||
*
|
||||
* \return 0 if successful, or 1 if the test failed
|
||||
*/
|
||||
int mbedtls_x509_self_test( int verbose );
|
||||
|
||||
#endif /* MBEDTLS_SELF_TEST */
|
||||
|
||||
/*
|
||||
* Internal module functions. You probably do not want to use these unless you
|
||||
* know you do.
|
||||
|
@ -327,9 +316,11 @@ int mbedtls_x509_get_serial( unsigned char **p, const unsigned char *end,
|
|||
mbedtls_x509_buf *serial );
|
||||
int mbedtls_x509_get_ext( unsigned char **p, const unsigned char *end,
|
||||
mbedtls_x509_buf *ext, int tag );
|
||||
#if !defined(MBEDTLS_X509_REMOVE_INFO)
|
||||
int mbedtls_x509_sig_alg_gets( char *buf, size_t size, const mbedtls_x509_buf *sig_oid,
|
||||
mbedtls_pk_type_t pk_alg, mbedtls_md_type_t md_alg,
|
||||
const void *sig_opts );
|
||||
#endif
|
||||
int mbedtls_x509_key_size_helper( char *buf, size_t buf_size, const char *name );
|
||||
int mbedtls_x509_string_to_names( mbedtls_asn1_named_data **head, const char *name );
|
||||
int mbedtls_x509_set_extension( mbedtls_asn1_named_data **head, const char *oid, size_t oid_len,
|
||||
|
|
|
@ -134,6 +134,7 @@ int mbedtls_x509_crl_parse( mbedtls_x509_crl *chain, const unsigned char *buf, s
|
|||
int mbedtls_x509_crl_parse_file( mbedtls_x509_crl *chain, const char *path );
|
||||
#endif /* MBEDTLS_FS_IO */
|
||||
|
||||
#if !defined(MBEDTLS_X509_REMOVE_INFO)
|
||||
/**
|
||||
* \brief Returns an informational string about the CRL.
|
||||
*
|
||||
|
@ -147,6 +148,7 @@ int mbedtls_x509_crl_parse_file( mbedtls_x509_crl *chain, const char *path );
|
|||
*/
|
||||
int mbedtls_x509_crl_info( char *buf, size_t size, const char *prefix,
|
||||
const mbedtls_x509_crl *crl );
|
||||
#endif /* !MBEDTLS_X509_REMOVE_INFO */
|
||||
|
||||
/**
|
||||
* \brief Initialize a CRL (chain)
|
||||
|
|
|
@ -176,6 +176,74 @@ mbedtls_x509_crt_profile;
|
|||
#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512
|
||||
#endif
|
||||
|
||||
/* This macro unfolds to the concatenation of macro invocations
|
||||
* X509_CRT_ERROR_INFO( error code,
|
||||
* error code as string,
|
||||
* human readable description )
|
||||
* where X509_CRT_ERROR_INFO is defined by the user.
|
||||
* See x509_crt.c for an example of how to use this. */
|
||||
#define MBEDTLS_X509_CRT_ERROR_INFO_LIST \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_EXPIRED, \
|
||||
"MBEDTLS_X509_BADCERT_EXPIRED", \
|
||||
"The certificate validity has expired" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_REVOKED, \
|
||||
"MBEDTLS_X509_BADCERT_REVOKED", \
|
||||
"The certificate has been revoked (is on a CRL)" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_CN_MISMATCH, \
|
||||
"MBEDTLS_X509_BADCERT_CN_MISMATCH", \
|
||||
"The certificate Common Name (CN) does not match with the expected CN" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_NOT_TRUSTED, \
|
||||
"MBEDTLS_X509_BADCERT_NOT_TRUSTED", \
|
||||
"The certificate is not correctly signed by the trusted CA" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCRL_NOT_TRUSTED, \
|
||||
"MBEDTLS_X509_BADCRL_NOT_TRUSTED", \
|
||||
"The CRL is not correctly signed by the trusted CA" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCRL_EXPIRED, \
|
||||
"MBEDTLS_X509_BADCRL_EXPIRED", \
|
||||
"The CRL is expired" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_MISSING, \
|
||||
"MBEDTLS_X509_BADCERT_MISSING", \
|
||||
"Certificate was missing" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_SKIP_VERIFY, \
|
||||
"MBEDTLS_X509_BADCERT_SKIP_VERIFY", \
|
||||
"Certificate verification was skipped" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_OTHER, \
|
||||
"MBEDTLS_X509_BADCERT_OTHER", \
|
||||
"Other reason (can be used by verify callback)" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_FUTURE, \
|
||||
"MBEDTLS_X509_BADCERT_FUTURE", \
|
||||
"The certificate validity starts in the future" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCRL_FUTURE, \
|
||||
"MBEDTLS_X509_BADCRL_FUTURE", \
|
||||
"The CRL is from the future" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_KEY_USAGE, \
|
||||
"MBEDTLS_X509_BADCERT_KEY_USAGE", \
|
||||
"Usage does not match the keyUsage extension" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_EXT_KEY_USAGE, \
|
||||
"MBEDTLS_X509_BADCERT_EXT_KEY_USAGE", \
|
||||
"Usage does not match the extendedKeyUsage extension" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_NS_CERT_TYPE, \
|
||||
"MBEDTLS_X509_BADCERT_NS_CERT_TYPE", \
|
||||
"Usage does not match the nsCertType extension" ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_BAD_MD, \
|
||||
"MBEDTLS_X509_BADCERT_BAD_MD", \
|
||||
"The certificate is signed with an unacceptable hash." ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_BAD_PK, \
|
||||
"MBEDTLS_X509_BADCERT_BAD_PK", \
|
||||
"The certificate is signed with an unacceptable PK alg (eg RSA vs ECDSA)." ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCERT_BAD_KEY, \
|
||||
"MBEDTLS_X509_BADCERT_BAD_KEY", \
|
||||
"The certificate is signed with an unacceptable key (eg bad curve, RSA too short)." ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCRL_BAD_MD, \
|
||||
"MBEDTLS_X509_BADCRL_BAD_MD", \
|
||||
"The CRL is signed with an unacceptable hash." ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCRL_BAD_PK, \
|
||||
"MBEDTLS_X509_BADCRL_BAD_PK", \
|
||||
"The CRL is signed with an unacceptable PK alg (eg RSA vs ECDSA)." ) \
|
||||
X509_CRT_ERROR_INFO( MBEDTLS_X509_BADCRL_BAD_KEY, \
|
||||
"MBEDTLS_X509_BADCRL_BAD_KEY", \
|
||||
"The CRL is signed with an unacceptable key (eg bad curve, RSA too short)." )
|
||||
|
||||
/**
|
||||
* Container for writing a certificate (CRT)
|
||||
*/
|
||||
|
@ -509,6 +577,8 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path );
|
|||
*/
|
||||
int mbedtls_x509_parse_subject_alt_name( const mbedtls_x509_buf *san_buf,
|
||||
mbedtls_x509_subject_alternative_name *san );
|
||||
|
||||
#if !defined(MBEDTLS_X509_REMOVE_INFO)
|
||||
/**
|
||||
* \brief Returns an informational string about the
|
||||
* certificate.
|
||||
|
@ -538,6 +608,7 @@ int mbedtls_x509_crt_info( char *buf, size_t size, const char *prefix,
|
|||
*/
|
||||
int mbedtls_x509_crt_verify_info( char *buf, size_t size, const char *prefix,
|
||||
uint32_t flags );
|
||||
#endif /* !MBEDTLS_X509_REMOVE_INFO */
|
||||
|
||||
/**
|
||||
* \brief Verify a chain of certificates.
|
||||
|
|
|
@ -121,6 +121,7 @@ int mbedtls_x509_csr_parse( mbedtls_x509_csr *csr, const unsigned char *buf, siz
|
|||
int mbedtls_x509_csr_parse_file( mbedtls_x509_csr *csr, const char *path );
|
||||
#endif /* MBEDTLS_FS_IO */
|
||||
|
||||
#if !defined(MBEDTLS_X509_REMOVE_INFO)
|
||||
/**
|
||||
* \brief Returns an informational string about the
|
||||
* CSR.
|
||||
|
@ -135,6 +136,7 @@ int mbedtls_x509_csr_parse_file( mbedtls_x509_csr *csr, const char *path );
|
|||
*/
|
||||
int mbedtls_x509_csr_info( char *buf, size_t size, const char *prefix,
|
||||
const mbedtls_x509_csr *csr );
|
||||
#endif /* !MBEDTLS_X509_REMOVE_INFO */
|
||||
|
||||
/**
|
||||
* \brief Initialize a CSR
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
|
||||
#define MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028 /**< The data input has an invalid length. */
|
||||
|
||||
/* MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED is deprecated and should not be used. */
|
||||
#define MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED -0x0029 /**< XTEA hardware accelerator failed. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -709,6 +709,8 @@ psa_status_t psa_import_key(const psa_key_attributes_t *attributes,
|
|||
* For Weierstrass curves, this is the content of the `privateKey` field of
|
||||
* the `ECPrivateKey` format defined by RFC 5915. For Montgomery curves,
|
||||
* the format is defined by RFC 7748, and output is masked according to §5.
|
||||
* For twisted Edwards curves, the private key is as defined by RFC 8032
|
||||
* (a 32-byte string for Edwards25519, a 57-byte string for Edwards448).
|
||||
* - For Diffie-Hellman key exchange key pairs (key types for which
|
||||
* #PSA_KEY_TYPE_IS_DH_KEY_PAIR is true), the
|
||||
* format is the representation of the private key `x` as a big-endian byte
|
||||
|
@ -774,7 +776,12 @@ psa_status_t psa_export_key(mbedtls_svc_key_id_t key,
|
|||
* modulus INTEGER, -- n
|
||||
* publicExponent INTEGER } -- e
|
||||
* ```
|
||||
* - For elliptic curve public keys (key types for which
|
||||
* - For elliptic curve keys on a twisted Edwards curve (key types for which
|
||||
* #PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY is true and #PSA_KEY_TYPE_ECC_GET_FAMILY
|
||||
* returns #PSA_ECC_FAMILY_TWISTED_EDWARDS), the public key is as defined
|
||||
* by RFC 8032
|
||||
* (a 32-byte string for Edwards25519, a 57-byte string for Edwards448).
|
||||
* - For other elliptic curve public keys (key types for which
|
||||
* #PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY is true), the format is the uncompressed
|
||||
* representation defined by SEC1 §2.3.3 as the content of an ECPoint.
|
||||
* Let `m` be the bit size associated with the curve, i.e. the bit size of
|
||||
|
@ -2106,9 +2113,16 @@ psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation);
|
|||
* authentication tag is appended to the
|
||||
* encrypted data.
|
||||
* \param ciphertext_size Size of the \p ciphertext buffer in bytes.
|
||||
* This must be at least
|
||||
* #PSA_AEAD_ENCRYPT_OUTPUT_SIZE(\p alg,
|
||||
* \p plaintext_length).
|
||||
* This must be appropriate for the selected
|
||||
* algorithm and key:
|
||||
* - A sufficient output size is
|
||||
* #PSA_AEAD_ENCRYPT_OUTPUT_SIZE(\c key_type,
|
||||
* \p alg, \p plaintext_length) where
|
||||
* \c key_type is the type of \p key.
|
||||
* - #PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(\p
|
||||
* plaintext_length) evaluates to the maximum
|
||||
* ciphertext size of any supported AEAD
|
||||
* encryption.
|
||||
* \param[out] ciphertext_length On success, the size of the output
|
||||
* in the \p ciphertext buffer.
|
||||
*
|
||||
|
@ -2122,7 +2136,11 @@ psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation);
|
|||
* \p alg is not supported or is not an AEAD algorithm.
|
||||
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
|
||||
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
|
||||
* \p ciphertext_size is too small
|
||||
* \p ciphertext_size is too small.
|
||||
* #PSA_AEAD_ENCRYPT_OUTPUT_SIZE(\c key_type, \p alg,
|
||||
* \p plaintext_length) or
|
||||
* #PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(\p plaintext_length) can be used to
|
||||
* determine the required buffer size.
|
||||
* \retval #PSA_ERROR_COMMUNICATION_FAILURE
|
||||
* \retval #PSA_ERROR_HARDWARE_FAILURE
|
||||
* \retval #PSA_ERROR_CORRUPTION_DETECTED
|
||||
|
@ -2166,9 +2184,16 @@ psa_status_t psa_aead_encrypt(mbedtls_svc_key_id_t key,
|
|||
* \param ciphertext_length Size of \p ciphertext in bytes.
|
||||
* \param[out] plaintext Output buffer for the decrypted data.
|
||||
* \param plaintext_size Size of the \p plaintext buffer in bytes.
|
||||
* This must be at least
|
||||
* #PSA_AEAD_DECRYPT_OUTPUT_SIZE(\p alg,
|
||||
* \p ciphertext_length).
|
||||
* This must be appropriate for the selected
|
||||
* algorithm and key:
|
||||
* - A sufficient output size is
|
||||
* #PSA_AEAD_DECRYPT_OUTPUT_SIZE(\c key_type,
|
||||
* \p alg, \p ciphertext_length) where
|
||||
* \c key_type is the type of \p key.
|
||||
* - #PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(\p
|
||||
* ciphertext_length) evaluates to the maximum
|
||||
* plaintext size of any supported AEAD
|
||||
* decryption.
|
||||
* \param[out] plaintext_length On success, the size of the output
|
||||
* in the \p plaintext buffer.
|
||||
*
|
||||
|
@ -2184,7 +2209,11 @@ psa_status_t psa_aead_encrypt(mbedtls_svc_key_id_t key,
|
|||
* \p alg is not supported or is not an AEAD algorithm.
|
||||
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
|
||||
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
|
||||
* \p plaintext_size or \p nonce_length is too small
|
||||
* \p plaintext_size is too small.
|
||||
* #PSA_AEAD_DECRYPT_OUTPUT_SIZE(\c key_type, \p alg,
|
||||
* \p ciphertext_length) or
|
||||
* #PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(\p ciphertext_length) can be used
|
||||
* to determine the required buffer size.
|
||||
* \retval #PSA_ERROR_COMMUNICATION_FAILURE
|
||||
* \retval #PSA_ERROR_HARDWARE_FAILURE
|
||||
* \retval #PSA_ERROR_CORRUPTION_DETECTED
|
||||
|
@ -2605,10 +2634,18 @@ psa_status_t psa_aead_update_ad(psa_aead_operation_t *operation,
|
|||
* \param input_length Size of the \p input buffer in bytes.
|
||||
* \param[out] output Buffer where the output is to be written.
|
||||
* \param output_size Size of the \p output buffer in bytes.
|
||||
* This must be at least
|
||||
* #PSA_AEAD_UPDATE_OUTPUT_SIZE(\c alg,
|
||||
* \p input_length) where \c alg is the
|
||||
* algorithm that is being calculated.
|
||||
* This must be appropriate for the selected
|
||||
* algorithm and key:
|
||||
* - A sufficient output size is
|
||||
* #PSA_AEAD_UPDATE_OUTPUT_SIZE(\c key_type,
|
||||
* \c alg, \p input_length) where
|
||||
* \c key_type is the type of key and \c alg is
|
||||
* the algorithm that were used to set up the
|
||||
* operation.
|
||||
* - #PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE(\p
|
||||
* input_length) evaluates to the maximum
|
||||
* output size of any supported AEAD
|
||||
* algorithm.
|
||||
* \param[out] output_length On success, the number of bytes
|
||||
* that make up the returned output.
|
||||
*
|
||||
|
@ -2619,9 +2656,9 @@ psa_status_t psa_aead_update_ad(psa_aead_operation_t *operation,
|
|||
* set, and have lengths set if required by the algorithm).
|
||||
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
|
||||
* The size of the \p output buffer is too small.
|
||||
* You can determine a sufficient buffer size by calling
|
||||
* #PSA_AEAD_UPDATE_OUTPUT_SIZE(\c alg, \p input_length)
|
||||
* where \c alg is the algorithm that is being calculated.
|
||||
* #PSA_AEAD_UPDATE_OUTPUT_SIZE(\c key_type, \c alg, \p input_length) or
|
||||
* #PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE(\p input_length) can be used to
|
||||
* determine the required buffer size.
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT
|
||||
* The total length of input to psa_aead_update_ad() so far is
|
||||
* less than the additional data length that was previously
|
||||
|
@ -2658,9 +2695,7 @@ psa_status_t psa_aead_update(psa_aead_operation_t *operation,
|
|||
* This function has two output buffers:
|
||||
* - \p ciphertext contains trailing ciphertext that was buffered from
|
||||
* preceding calls to psa_aead_update().
|
||||
* - \p tag contains the authentication tag. Its length is always
|
||||
* #PSA_AEAD_TAG_LENGTH(\c alg) where \c alg is the AEAD algorithm
|
||||
* that the operation performs.
|
||||
* - \p tag contains the authentication tag.
|
||||
*
|
||||
* When this function returns successfuly, the operation becomes inactive.
|
||||
* If this function returns an error status, the operation enters an error
|
||||
|
@ -2670,18 +2705,32 @@ psa_status_t psa_aead_update(psa_aead_operation_t *operation,
|
|||
* \param[out] ciphertext Buffer where the last part of the ciphertext
|
||||
* is to be written.
|
||||
* \param ciphertext_size Size of the \p ciphertext buffer in bytes.
|
||||
* This must be at least
|
||||
* #PSA_AEAD_FINISH_OUTPUT_SIZE(\c alg) where
|
||||
* \c alg is the algorithm that is being
|
||||
* calculated.
|
||||
* This must be appropriate for the selected
|
||||
* algorithm and key:
|
||||
* - A sufficient output size is
|
||||
* #PSA_AEAD_FINISH_OUTPUT_SIZE(\c key_type,
|
||||
* \c alg) where \c key_type is the type of key
|
||||
* and \c alg is the algorithm that were used to
|
||||
* set up the operation.
|
||||
* - #PSA_AEAD_FINISH_OUTPUT_MAX_SIZE evaluates to
|
||||
* the maximum output size of any supported AEAD
|
||||
* algorithm.
|
||||
* \param[out] ciphertext_length On success, the number of bytes of
|
||||
* returned ciphertext.
|
||||
* \param[out] tag Buffer where the authentication tag is
|
||||
* to be written.
|
||||
* \param tag_size Size of the \p tag buffer in bytes.
|
||||
* This must be at least
|
||||
* #PSA_AEAD_TAG_LENGTH(\c alg) where \c alg is
|
||||
* the algorithm that is being calculated.
|
||||
* This must be appropriate for the selected
|
||||
* algorithm and key:
|
||||
* - The exact tag size is #PSA_AEAD_TAG_LENGTH(\c
|
||||
* key_type, \c key_bits, \c alg) where
|
||||
* \c key_type and \c key_bits are the type and
|
||||
* bit-size of the key, and \c alg is the
|
||||
* algorithm that were used in the call to
|
||||
* psa_aead_encrypt_setup().
|
||||
* - #PSA_AEAD_TAG_MAX_SIZE evaluates to the
|
||||
* maximum tag size of any supported AEAD
|
||||
* algorithm.
|
||||
* \param[out] tag_length On success, the number of bytes
|
||||
* that make up the returned tag.
|
||||
*
|
||||
|
@ -2692,11 +2741,11 @@ psa_status_t psa_aead_update(psa_aead_operation_t *operation,
|
|||
* operation with a nonce set).
|
||||
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
|
||||
* The size of the \p ciphertext or \p tag buffer is too small.
|
||||
* You can determine a sufficient buffer size for \p ciphertext by
|
||||
* calling #PSA_AEAD_FINISH_OUTPUT_SIZE(\c alg)
|
||||
* where \c alg is the algorithm that is being calculated.
|
||||
* You can determine a sufficient buffer size for \p tag by
|
||||
* calling #PSA_AEAD_TAG_LENGTH(\c alg).
|
||||
* #PSA_AEAD_FINISH_OUTPUT_SIZE(\c key_type, \c alg) or
|
||||
* #PSA_AEAD_FINISH_OUTPUT_MAX_SIZE can be used to determine the
|
||||
* required \p ciphertext buffer size. #PSA_AEAD_TAG_LENGTH(\c key_type,
|
||||
* \c key_bits, \c alg) or #PSA_AEAD_TAG_MAX_SIZE can be used to
|
||||
* determine the required \p tag buffer size.
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT
|
||||
* The total length of input to psa_aead_update_ad() so far is
|
||||
* less than the additional data length that was previously
|
||||
|
@ -2755,10 +2804,15 @@ psa_status_t psa_aead_finish(psa_aead_operation_t *operation,
|
|||
* that could not be processed until the end
|
||||
* of the input.
|
||||
* \param plaintext_size Size of the \p plaintext buffer in bytes.
|
||||
* This must be at least
|
||||
* #PSA_AEAD_VERIFY_OUTPUT_SIZE(\c alg) where
|
||||
* \c alg is the algorithm that is being
|
||||
* calculated.
|
||||
* This must be appropriate for the selected algorithm and key:
|
||||
* - A sufficient output size is
|
||||
* #PSA_AEAD_VERIFY_OUTPUT_SIZE(\c key_type,
|
||||
* \c alg) where \c key_type is the type of key
|
||||
* and \c alg is the algorithm that were used to
|
||||
* set up the operation.
|
||||
* - #PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE evaluates to
|
||||
* the maximum output size of any supported AEAD
|
||||
* algorithm.
|
||||
* \param[out] plaintext_length On success, the number of bytes of
|
||||
* returned plaintext.
|
||||
* \param[in] tag Buffer containing the authentication tag.
|
||||
|
@ -2774,9 +2828,9 @@ psa_status_t psa_aead_finish(psa_aead_operation_t *operation,
|
|||
* operation with a nonce set).
|
||||
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
|
||||
* The size of the \p plaintext buffer is too small.
|
||||
* You can determine a sufficient buffer size for \p plaintext by
|
||||
* calling #PSA_AEAD_VERIFY_OUTPUT_SIZE(\c alg)
|
||||
* where \c alg is the algorithm that is being calculated.
|
||||
* #PSA_AEAD_VERIFY_OUTPUT_SIZE(\c key_type, \c alg) or
|
||||
* #PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE can be used to determine the
|
||||
* required buffer size.
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT
|
||||
* The total length of input to psa_aead_update_ad() so far is
|
||||
* less than the additional data length that was previously
|
||||
|
@ -2840,7 +2894,8 @@ psa_status_t psa_aead_abort(psa_aead_operation_t *operation);
|
|||
*
|
||||
* Note that to perform a hash-and-sign signature algorithm, you must
|
||||
* first calculate the hash by calling psa_hash_setup(), psa_hash_update()
|
||||
* and psa_hash_finish(). Then pass the resulting hash as the \p hash
|
||||
* and psa_hash_finish(), or alternatively by calling psa_hash_compute().
|
||||
* Then pass the resulting hash as the \p hash
|
||||
* parameter to this function. You can use #PSA_ALG_SIGN_GET_HASH(\p alg)
|
||||
* to determine the hash algorithm to use.
|
||||
*
|
||||
|
@ -2891,7 +2946,8 @@ psa_status_t psa_sign_hash(mbedtls_svc_key_id_t key,
|
|||
*
|
||||
* Note that to perform a hash-and-sign signature algorithm, you must
|
||||
* first calculate the hash by calling psa_hash_setup(), psa_hash_update()
|
||||
* and psa_hash_finish(). Then pass the resulting hash as the \p hash
|
||||
* and psa_hash_finish(), or alternatively by calling psa_hash_compute().
|
||||
* Then pass the resulting hash as the \p hash
|
||||
* parameter to this function. You can use #PSA_ALG_SIGN_GET_HASH(\p alg)
|
||||
* to determine the hash algorithm to use.
|
||||
*
|
||||
|
@ -3465,7 +3521,8 @@ psa_status_t psa_key_derivation_output_bytes(
|
|||
* state and must be aborted by calling psa_key_derivation_abort().
|
||||
*
|
||||
* How much output is produced and consumed from the operation, and how
|
||||
* the key is derived, depends on the key type:
|
||||
* the key is derived, depends on the key type and on the key size
|
||||
* (denoted \c bits below):
|
||||
*
|
||||
* - For key types for which the key is an arbitrary sequence of bytes
|
||||
* of a given size, this function is functionally equivalent to
|
||||
|
@ -3475,7 +3532,7 @@ psa_status_t psa_key_derivation_output_bytes(
|
|||
* if the implementation provides an isolation boundary then
|
||||
* the key material is not exposed outside the isolation boundary.
|
||||
* As a consequence, for these key types, this function always consumes
|
||||
* exactly (\p bits / 8) bytes from the operation.
|
||||
* exactly (\c bits / 8) bytes from the operation.
|
||||
* The following key types defined in this specification follow this scheme:
|
||||
*
|
||||
* - #PSA_KEY_TYPE_AES;
|
||||
|
@ -3496,8 +3553,8 @@ psa_status_t psa_key_derivation_output_bytes(
|
|||
* string and process it as specified in RFC 7748 §5.
|
||||
*
|
||||
* - For key types for which the key is represented by a single sequence of
|
||||
* \p bits bits with constraints as to which bit sequences are acceptable,
|
||||
* this function draws a byte string of length (\p bits / 8) bytes rounded
|
||||
* \c bits bits with constraints as to which bit sequences are acceptable,
|
||||
* this function draws a byte string of length (\c bits / 8) bytes rounded
|
||||
* up to the nearest whole number of bytes. If the resulting byte string
|
||||
* is acceptable, it becomes the key, otherwise the drawn bytes are discarded.
|
||||
* This process is repeated until an acceptable byte string is drawn.
|
||||
|
|
144
include/psa/crypto_builtin.h
Normal file
144
include/psa/crypto_builtin.h
Normal file
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Context structure declaration of the Mbed TLS software-based PSA drivers
|
||||
* called through the PSA Crypto driver dispatch layer.
|
||||
*
|
||||
* \note This file may not be included directly. Applications must
|
||||
* include psa/crypto.h.
|
||||
*
|
||||
* \note This header and its content is not part of the Mbed TLS API and
|
||||
* applications must not depend on it. Its main purpose is to define the
|
||||
* multi-part state objects of the Mbed TLS software-based PSA drivers. The
|
||||
* definition of these objects are then used by crypto_struct.h to define the
|
||||
* implementation-defined types of PSA multi-part state objects.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_BUILTIN_H
|
||||
#define PSA_CRYPTO_BUILTIN_H
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
/*
|
||||
* Hash multi-part operation definitions.
|
||||
*/
|
||||
|
||||
#include "mbedtls/md2.h"
|
||||
#include "mbedtls/md4.h"
|
||||
#include "mbedtls/md5.h"
|
||||
#include "mbedtls/ripemd160.h"
|
||||
#include "mbedtls/sha1.h"
|
||||
#include "mbedtls/sha256.h"
|
||||
#include "mbedtls/sha512.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_MD2) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_MD4) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_MD5) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
|
||||
#define MBEDTLS_PSA_BUILTIN_HASH
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
psa_algorithm_t alg;
|
||||
union
|
||||
{
|
||||
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||
#if defined(MBEDTLS_MD2_C)
|
||||
mbedtls_md2_context md2;
|
||||
#endif
|
||||
#if defined(MBEDTLS_MD4_C)
|
||||
mbedtls_md4_context md4;
|
||||
#endif
|
||||
#if defined(MBEDTLS_MD5_C)
|
||||
mbedtls_md5_context md5;
|
||||
#endif
|
||||
#if defined(MBEDTLS_RIPEMD160_C)
|
||||
mbedtls_ripemd160_context ripemd160;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA1_C)
|
||||
mbedtls_sha1_context sha1;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
mbedtls_sha256_context sha256;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
mbedtls_sha512_context sha512;
|
||||
#endif
|
||||
} ctx;
|
||||
} mbedtls_psa_hash_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_HASH_OPERATION_INIT {0, {0}}
|
||||
|
||||
/*
|
||||
* Cipher multi-part operation definitions.
|
||||
*/
|
||||
|
||||
#include "mbedtls/cipher.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CTR) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CFB) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_OFB) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_XTS) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7)
|
||||
#define MBEDTLS_PSA_BUILTIN_CIPHER 1
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/* Context structure for the Mbed TLS cipher implementation. */
|
||||
psa_algorithm_t alg;
|
||||
uint8_t iv_length;
|
||||
uint8_t block_length;
|
||||
mbedtls_cipher_context_t cipher;
|
||||
} mbedtls_psa_cipher_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_CIPHER_OPERATION_INIT {0, 0, 0, {0}}
|
||||
|
||||
/*
|
||||
* BEYOND THIS POINT, TEST DRIVER DECLARATIONS ONLY.
|
||||
*/
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
|
||||
typedef mbedtls_psa_hash_operation_t mbedtls_transparent_test_driver_hash_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT MBEDTLS_PSA_HASH_OPERATION_INIT
|
||||
|
||||
typedef mbedtls_psa_cipher_operation_t
|
||||
mbedtls_transparent_test_driver_cipher_operation_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int initialised : 1;
|
||||
mbedtls_transparent_test_driver_cipher_operation_t ctx;
|
||||
} mbedtls_opaque_test_driver_cipher_operation_t;
|
||||
|
||||
#define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
|
||||
MBEDTLS_PSA_CIPHER_OPERATION_INIT
|
||||
|
||||
#define MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT \
|
||||
{ 0, MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT }
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
|
||||
#endif /* PSA_CRYPTO_BUILTIN_H */
|
|
@ -55,222 +55,6 @@ static inline int psa_key_handle_is_null( psa_key_handle_t handle )
|
|||
return( mbedtls_svc_key_id_is_null( handle ) );
|
||||
}
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
|
||||
/*
|
||||
* Mechanism for declaring deprecated values
|
||||
*/
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING) && !defined(MBEDTLS_PSA_DEPRECATED)
|
||||
#define MBEDTLS_PSA_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_PSA_DEPRECATED
|
||||
#endif
|
||||
|
||||
typedef MBEDTLS_PSA_DEPRECATED size_t mbedtls_deprecated_size_t;
|
||||
typedef MBEDTLS_PSA_DEPRECATED psa_status_t mbedtls_deprecated_psa_status_t;
|
||||
typedef MBEDTLS_PSA_DEPRECATED psa_key_usage_t mbedtls_deprecated_psa_key_usage_t;
|
||||
typedef MBEDTLS_PSA_DEPRECATED psa_ecc_family_t mbedtls_deprecated_psa_ecc_family_t;
|
||||
typedef MBEDTLS_PSA_DEPRECATED psa_dh_family_t mbedtls_deprecated_psa_dh_family_t;
|
||||
typedef MBEDTLS_PSA_DEPRECATED psa_ecc_family_t psa_ecc_curve_t;
|
||||
typedef MBEDTLS_PSA_DEPRECATED psa_dh_family_t psa_dh_group_t;
|
||||
typedef MBEDTLS_PSA_DEPRECATED psa_algorithm_t mbedtls_deprecated_psa_algorithm_t;
|
||||
|
||||
#define PSA_KEY_TYPE_GET_CURVE PSA_KEY_TYPE_ECC_GET_FAMILY
|
||||
#define PSA_KEY_TYPE_GET_GROUP PSA_KEY_TYPE_DH_GET_FAMILY
|
||||
|
||||
#define MBEDTLS_DEPRECATED_CONSTANT( type, value ) \
|
||||
( (mbedtls_deprecated_##type) ( value ) )
|
||||
|
||||
/*
|
||||
* Deprecated PSA Crypto error code definitions (PSA Crypto API <= 1.0 beta2)
|
||||
*/
|
||||
#define PSA_ERROR_UNKNOWN_ERROR \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_GENERIC_ERROR )
|
||||
#define PSA_ERROR_OCCUPIED_SLOT \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_ALREADY_EXISTS )
|
||||
#define PSA_ERROR_EMPTY_SLOT \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_DOES_NOT_EXIST )
|
||||
#define PSA_ERROR_INSUFFICIENT_CAPACITY \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_INSUFFICIENT_DATA )
|
||||
#define PSA_ERROR_TAMPERING_DETECTED \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_CORRUPTION_DETECTED )
|
||||
|
||||
/*
|
||||
* Deprecated PSA Crypto numerical encodings (PSA Crypto API <= 1.0 beta3)
|
||||
*/
|
||||
#define PSA_KEY_USAGE_SIGN \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_key_usage_t, PSA_KEY_USAGE_SIGN_HASH )
|
||||
#define PSA_KEY_USAGE_VERIFY \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_key_usage_t, PSA_KEY_USAGE_VERIFY_HASH )
|
||||
|
||||
/*
|
||||
* Deprecated PSA Crypto size calculation macros (PSA Crypto API <= 1.0 beta3)
|
||||
*/
|
||||
#define PSA_ASYMMETRIC_SIGNATURE_MAX_SIZE \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_SIGNATURE_MAX_SIZE )
|
||||
#define PSA_ASYMMETRIC_SIGN_OUTPUT_SIZE( key_type, key_bits, alg ) \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_SIGN_OUTPUT_SIZE( key_type, key_bits, alg ) )
|
||||
#define PSA_KEY_EXPORT_MAX_SIZE( key_type, key_bits ) \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_EXPORT_KEY_OUTPUT_SIZE( key_type, key_bits ) )
|
||||
#define PSA_BLOCK_CIPHER_BLOCK_SIZE( type ) \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_BLOCK_CIPHER_BLOCK_LENGTH( type ) )
|
||||
#define PSA_MAX_BLOCK_CIPHER_BLOCK_SIZE \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE )
|
||||
#define PSA_HASH_SIZE( alg ) \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_HASH_LENGTH( alg ) )
|
||||
#define PSA_MAC_FINAL_SIZE( key_type, key_bits, alg ) \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_MAC_LENGTH( key_type, key_bits, alg ) )
|
||||
#define PSA_ALG_TLS12_PSK_TO_MS_MAX_PSK_LEN \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE )
|
||||
|
||||
/*
|
||||
* Deprecated PSA Crypto function names (PSA Crypto API <= 1.0 beta3)
|
||||
*/
|
||||
MBEDTLS_PSA_DEPRECATED static inline psa_status_t psa_asymmetric_sign( psa_key_handle_t key,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash,
|
||||
size_t hash_length,
|
||||
uint8_t *signature,
|
||||
size_t signature_size,
|
||||
size_t *signature_length )
|
||||
{
|
||||
return psa_sign_hash( key, alg, hash, hash_length, signature, signature_size, signature_length );
|
||||
}
|
||||
|
||||
MBEDTLS_PSA_DEPRECATED static inline psa_status_t psa_asymmetric_verify( psa_key_handle_t key,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash,
|
||||
size_t hash_length,
|
||||
const uint8_t *signature,
|
||||
size_t signature_length )
|
||||
{
|
||||
return psa_verify_hash( key, alg, hash, hash_length, signature, signature_length );
|
||||
}
|
||||
|
||||
/*
|
||||
* Size-specific elliptic curve families.
|
||||
*/
|
||||
#define PSA_ECC_CURVE_SECP160K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
|
||||
#define PSA_ECC_CURVE_SECP192K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
|
||||
#define PSA_ECC_CURVE_SECP224K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
|
||||
#define PSA_ECC_CURVE_SECP256K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
|
||||
#define PSA_ECC_CURVE_SECP160R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
|
||||
#define PSA_ECC_CURVE_SECP192R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
|
||||
#define PSA_ECC_CURVE_SECP224R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
|
||||
#define PSA_ECC_CURVE_SECP256R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
|
||||
#define PSA_ECC_CURVE_SECP384R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
|
||||
#define PSA_ECC_CURVE_SECP521R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
|
||||
#define PSA_ECC_CURVE_SECP160R2 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R2 )
|
||||
#define PSA_ECC_CURVE_SECT163K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
|
||||
#define PSA_ECC_CURVE_SECT233K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
|
||||
#define PSA_ECC_CURVE_SECT239K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
|
||||
#define PSA_ECC_CURVE_SECT283K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
|
||||
#define PSA_ECC_CURVE_SECT409K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
|
||||
#define PSA_ECC_CURVE_SECT571K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
|
||||
#define PSA_ECC_CURVE_SECT163R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
|
||||
#define PSA_ECC_CURVE_SECT193R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
|
||||
#define PSA_ECC_CURVE_SECT233R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
|
||||
#define PSA_ECC_CURVE_SECT283R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
|
||||
#define PSA_ECC_CURVE_SECT409R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
|
||||
#define PSA_ECC_CURVE_SECT571R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
|
||||
#define PSA_ECC_CURVE_SECT163R2 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R2 )
|
||||
#define PSA_ECC_CURVE_SECT193R2 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R2 )
|
||||
#define PSA_ECC_CURVE_BRAINPOOL_P256R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
|
||||
#define PSA_ECC_CURVE_BRAINPOOL_P384R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
|
||||
#define PSA_ECC_CURVE_BRAINPOOL_P512R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
|
||||
#define PSA_ECC_CURVE_CURVE25519 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_MONTGOMERY )
|
||||
#define PSA_ECC_CURVE_CURVE448 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_MONTGOMERY )
|
||||
|
||||
/*
|
||||
* Curves that changed name due to PSA specification.
|
||||
*/
|
||||
#define PSA_ECC_CURVE_SECP_K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_K1 )
|
||||
#define PSA_ECC_CURVE_SECP_R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R1 )
|
||||
#define PSA_ECC_CURVE_SECP_R2 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECP_R2 )
|
||||
#define PSA_ECC_CURVE_SECT_K1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_K1 )
|
||||
#define PSA_ECC_CURVE_SECT_R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R1 )
|
||||
#define PSA_ECC_CURVE_SECT_R2 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_SECT_R2 )
|
||||
#define PSA_ECC_CURVE_BRAINPOOL_P_R1 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_BRAINPOOL_P_R1 )
|
||||
#define PSA_ECC_CURVE_MONTGOMERY \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_ecc_family_t, PSA_ECC_FAMILY_MONTGOMERY )
|
||||
|
||||
/*
|
||||
* Finite-field Diffie-Hellman families.
|
||||
*/
|
||||
#define PSA_DH_GROUP_FFDHE2048 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
|
||||
#define PSA_DH_GROUP_FFDHE3072 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
|
||||
#define PSA_DH_GROUP_FFDHE4096 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
|
||||
#define PSA_DH_GROUP_FFDHE6144 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
|
||||
#define PSA_DH_GROUP_FFDHE8192 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
|
||||
|
||||
/*
|
||||
* Diffie-Hellman families that changed name due to PSA specification.
|
||||
*/
|
||||
#define PSA_DH_GROUP_RFC7919 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_RFC7919 )
|
||||
#define PSA_DH_GROUP_CUSTOM \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_dh_family_t, PSA_DH_FAMILY_CUSTOM )
|
||||
|
||||
/*
|
||||
* Deprecated PSA Crypto stream cipher algorithms (PSA Crypto API <= 1.0 beta3)
|
||||
*/
|
||||
#define PSA_ALG_ARC4 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_algorithm_t, PSA_ALG_STREAM_CIPHER )
|
||||
#define PSA_ALG_CHACHA20 \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_algorithm_t, PSA_ALG_STREAM_CIPHER )
|
||||
|
||||
/*
|
||||
* Renamed AEAD tag length macros (PSA Crypto API <= 1.0 beta3)
|
||||
*/
|
||||
#define PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH( aead_alg ) \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_algorithm_t, PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG( aead_alg ) )
|
||||
#define PSA_ALG_AEAD_WITH_TAG_LENGTH( aead_alg, tag_length ) \
|
||||
MBEDTLS_DEPRECATED_CONSTANT( psa_algorithm_t, PSA_ALG_AEAD_WITH_SHORTENED_TAG( aead_alg, tag_length ) )
|
||||
|
||||
#endif /* MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
/** Open a handle to an existing persistent key.
|
||||
*
|
||||
* Open a handle to a persistent key. A key is persistent if it was created
|
||||
|
@ -313,9 +97,9 @@ MBEDTLS_PSA_DEPRECATED static inline psa_status_t psa_asymmetric_verify( psa_key
|
|||
* number of open keys, the number of open key handles, or available
|
||||
* memory.
|
||||
* \retval #PSA_ERROR_DOES_NOT_EXIST
|
||||
* There is no persistent key with key identifier \p id.
|
||||
* There is no persistent key with key identifier \p key.
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT
|
||||
* \p id is not a valid persistent key identifier.
|
||||
* \p key is not a valid persistent key identifier.
|
||||
* \retval #PSA_ERROR_NOT_PERMITTED
|
||||
* The specified key exists, but the application does not have the
|
||||
* permission to access it. Note that this specification does not
|
||||
|
|
|
@ -50,15 +50,22 @@
|
|||
#ifndef PSA_CRYPTO_CONFIG_H
|
||||
#define PSA_CRYPTO_CONFIG_H
|
||||
|
||||
/*
|
||||
* CBC-MAC is not yet supported via the PSA API in Mbed TLS.
|
||||
*/
|
||||
//#define PSA_WANT_ALG_CBC_MAC 1
|
||||
#define PSA_WANT_ALG_CBC_NO_PADDING 1
|
||||
#define PSA_WANT_ALG_CBC_PKCS7 1
|
||||
#define PSA_WANT_ALG_CCM 1
|
||||
#define PSA_WANT_ALG_CFB 1
|
||||
#define PSA_WANT_ALG_CHACHA20_POLY1305 1
|
||||
#define PSA_WANT_ALG_CMAC 1
|
||||
#define PSA_WANT_ALG_CTR 1
|
||||
#define PSA_WANT_ALG_DETERMINISTIC_ECDSA 1
|
||||
#define PSA_WANT_ALG_ECB_NO_PADDING 1
|
||||
#define PSA_WANT_ALG_ECDH 1
|
||||
#define PSA_WANT_ALG_ECDSA 1
|
||||
#define PSA_WANT_ALG_GCM 1
|
||||
#define PSA_WANT_ALG_HKDF 1
|
||||
#define PSA_WANT_ALG_HMAC 1
|
||||
#define PSA_WANT_ALG_MD2 1
|
||||
|
@ -80,6 +87,30 @@
|
|||
#define PSA_WANT_ALG_TLS12_PSK_TO_MS 1
|
||||
#define PSA_WANT_ALG_XTS 1
|
||||
|
||||
#define PSA_WANT_ECC_BRAINPOOL_P_R1_256 1
|
||||
#define PSA_WANT_ECC_BRAINPOOL_P_R1_384 1
|
||||
#define PSA_WANT_ECC_BRAINPOOL_P_R1_512 1
|
||||
#define PSA_WANT_ECC_MONTGOMERY_255 1
|
||||
/*
|
||||
* Curve448 is not yet supported via the PSA API in Mbed TLS
|
||||
* (https://github.com/ARMmbed/mbedtls/issues/4249). Thus, do not enable it by
|
||||
* default.
|
||||
*/
|
||||
//#define PSA_WANT_ECC_MONTGOMERY_448 1
|
||||
#define PSA_WANT_ECC_SECP_K1_192 1
|
||||
/*
|
||||
* SECP224K1 is buggy via the PSA API in Mbed TLS
|
||||
* (https://github.com/ARMmbed/mbedtls/issues/3541). Thus, do not enable it by
|
||||
* default.
|
||||
*/
|
||||
//#define PSA_WANT_ECC_SECP_K1_224 1
|
||||
#define PSA_WANT_ECC_SECP_K1_256 1
|
||||
#define PSA_WANT_ECC_SECP_R1_192 1
|
||||
#define PSA_WANT_ECC_SECP_R1_224 1
|
||||
#define PSA_WANT_ECC_SECP_R1_256 1
|
||||
#define PSA_WANT_ECC_SECP_R1_384 1
|
||||
#define PSA_WANT_ECC_SECP_R1_521 1
|
||||
|
||||
#define PSA_WANT_KEY_TYPE_DERIVE 1
|
||||
#define PSA_WANT_KEY_TYPE_HMAC 1
|
||||
#define PSA_WANT_KEY_TYPE_AES 1
|
||||
|
|
69
include/psa/crypto_driver_contexts.h
Normal file
69
include/psa/crypto_driver_contexts.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Declaration of context structures for use with the PSA driver wrapper
|
||||
* interface.
|
||||
*
|
||||
* Warning: This file will be auto-generated in the future.
|
||||
*
|
||||
* \note This file may not be included directly. Applications must
|
||||
* include psa/crypto.h.
|
||||
*
|
||||
* \note This header and its content is not part of the Mbed TLS API and
|
||||
* applications must not depend on it. Its main purpose is to define the
|
||||
* multi-part state objects of the PSA drivers included in the cryptographic
|
||||
* library. The definition of these objects are then used by crypto_struct.h
|
||||
* to define the implementation-defined types of PSA multi-part state objects.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_DRIVER_CONTEXTS_H
|
||||
#define PSA_CRYPTO_DRIVER_CONTEXTS_H
|
||||
|
||||
#include "psa/crypto.h"
|
||||
#include "psa/crypto_driver_common.h"
|
||||
|
||||
/* Include the context structure definitions for those drivers that were
|
||||
* declared during the autogeneration process. */
|
||||
|
||||
/* Include the context structure definitions for the Mbed TLS software drivers */
|
||||
#include "psa/crypto_builtin.h"
|
||||
|
||||
/* Define the context to be used for an operation that is executed through the
|
||||
* PSA Driver wrapper layer as the union of all possible driver's contexts.
|
||||
*
|
||||
* The union members are the driver's context structures, and the member names
|
||||
* are formatted as `'drivername'_ctx`. This allows for procedural generation
|
||||
* of both this file and the content of psa_crypto_driver_wrappers.c */
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_hash_operation_t mbedtls_ctx;
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_transparent_test_driver_hash_operation_t test_driver_ctx;
|
||||
#endif
|
||||
} psa_driver_hash_context_t;
|
||||
|
||||
typedef union {
|
||||
unsigned dummy; /* Make sure this union is always non-empty */
|
||||
mbedtls_psa_cipher_operation_t mbedtls_ctx;
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
mbedtls_transparent_test_driver_cipher_operation_t transparent_test_driver_ctx;
|
||||
mbedtls_opaque_test_driver_cipher_operation_t opaque_test_driver_ctx;
|
||||
#endif
|
||||
} psa_driver_cipher_context_t;
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_CONTEXTS_H */
|
||||
/* End of automatically generated file. */
|
|
@ -179,6 +179,9 @@ static inline void psa_clear_key_slot_number(
|
|||
* The secure element driver for the specified lifetime does not
|
||||
* support registering a key.
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT
|
||||
* The identifier in \p attributes is invalid, namely the identifier is
|
||||
* not in the user range.
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT
|
||||
* \p attributes specifies a lifetime which is not located
|
||||
* in a secure element.
|
||||
* \retval #PSA_ERROR_INVALID_ARGUMENT
|
||||
|
@ -303,8 +306,10 @@ void mbedtls_psa_get_stats( mbedtls_psa_stats_t *stats );
|
|||
* \param[in] seed Buffer containing the seed value to inject.
|
||||
* \param[in] seed_size Size of the \p seed buffer.
|
||||
* The size of the seed in bytes must be greater
|
||||
* or equal to both #MBEDTLS_ENTROPY_MIN_PLATFORM
|
||||
* and #MBEDTLS_ENTROPY_BLOCK_SIZE.
|
||||
* or equal to both #MBEDTLS_ENTROPY_BLOCK_SIZE
|
||||
* and the value of \c MBEDTLS_ENTROPY_MIN_PLATFORM
|
||||
* in `library/entropy_poll.h` in the Mbed TLS source
|
||||
* code.
|
||||
* It must be less or equal to
|
||||
* #MBEDTLS_ENTROPY_MAX_SEED_SIZE.
|
||||
*
|
||||
|
@ -407,10 +412,9 @@ psa_status_t mbedtls_psa_inject_entropy(const uint8_t *seed,
|
|||
|
||||
/* We need to expand the sample definition of this macro from
|
||||
* the API definition. */
|
||||
#undef PSA_ALG_IS_HASH_AND_SIGN
|
||||
#define PSA_ALG_IS_HASH_AND_SIGN(alg) \
|
||||
(PSA_ALG_IS_RSA_PSS(alg) || PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) || \
|
||||
PSA_ALG_IS_DSA(alg) || PSA_ALG_IS_ECDSA(alg))
|
||||
#undef PSA_ALG_IS_VENDOR_HASH_AND_SIGN
|
||||
#define PSA_ALG_IS_VENDOR_HASH_AND_SIGN(alg) \
|
||||
PSA_ALG_IS_DSA(alg)
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
@ -711,6 +715,104 @@ psa_status_t mbedtls_psa_external_get_random(
|
|||
|
||||
/**@}*/
|
||||
|
||||
/** \defgroup psa_builtin_keys Built-in keys
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** The minimum value for a key identifier that is built into the
|
||||
* implementation.
|
||||
*
|
||||
* The range of key identifiers from #MBEDTLS_PSA_KEY_ID_BUILTIN_MIN
|
||||
* to #MBEDTLS_PSA_KEY_ID_BUILTIN_MAX within the range from
|
||||
* #PSA_KEY_ID_VENDOR_MIN and #PSA_KEY_ID_VENDOR_MAX and must not intersect
|
||||
* with any other set of implementation-chosen key identifiers.
|
||||
*
|
||||
* This value is part of the library's ABI since changing it would invalidate
|
||||
* the values of built-in key identifiers in applications.
|
||||
*/
|
||||
#define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN ((psa_key_id_t)0x7fff0000)
|
||||
|
||||
/** The maximum value for a key identifier that is built into the
|
||||
* implementation.
|
||||
*
|
||||
* See #MBEDTLS_PSA_KEY_ID_BUILTIN_MIN for more information.
|
||||
*/
|
||||
#define MBEDTLS_PSA_KEY_ID_BUILTIN_MAX ((psa_key_id_t)0x7fffefff)
|
||||
|
||||
/** A slot number identifying a key in a driver.
|
||||
*
|
||||
* Values of this type are used to identify built-in keys.
|
||||
*/
|
||||
typedef uint64_t psa_drv_slot_number_t;
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
|
||||
/** Test whether a key identifier belongs to the builtin key range.
|
||||
*
|
||||
* \param key_id Key identifier to test.
|
||||
*
|
||||
* \retval 1
|
||||
* The key identifier is a builtin key identifier.
|
||||
* \retval 0
|
||||
* The key identifier is not a builtin key identifier.
|
||||
*/
|
||||
static inline int psa_key_id_is_builtin( psa_key_id_t key_id )
|
||||
{
|
||||
return( ( key_id >= MBEDTLS_PSA_KEY_ID_BUILTIN_MIN ) &&
|
||||
( key_id <= MBEDTLS_PSA_KEY_ID_BUILTIN_MAX ) );
|
||||
}
|
||||
|
||||
/** Platform function to obtain the location and slot number of a built-in key.
|
||||
*
|
||||
* An application-specific implementation of this function must be provided if
|
||||
* #MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS is enabled. This would typically be provided
|
||||
* as part of a platform's system image.
|
||||
*
|
||||
* #MBEDTLS_SVC_KEY_ID_GET_KEY_ID(\p key_id) needs to be in the range from
|
||||
* #MBEDTLS_PSA_KEY_ID_BUILTIN_MIN to #MBEDTLS_PSA_KEY_ID_BUILTIN_MAX.
|
||||
*
|
||||
* In a multi-application configuration
|
||||
* (\c MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER is defined),
|
||||
* this function should check that #MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(\p key_id)
|
||||
* is allowed to use the given key.
|
||||
*
|
||||
* \param key_id The key ID for which to retrieve the
|
||||
* location and slot attributes.
|
||||
* \param[out] lifetime On success, the lifetime associated with the key
|
||||
* corresponding to \p key_id. Lifetime is a
|
||||
* combination of which driver contains the key,
|
||||
* and with what persistence level the key is
|
||||
* intended to be used. If the platform
|
||||
* implementation does not contain specific
|
||||
* information about the intended key persistence
|
||||
* level, the persistence level may be reported as
|
||||
* #PSA_KEY_PERSISTENCE_DEFAULT.
|
||||
* \param[out] slot_number On success, the slot number known to the driver
|
||||
* registered at the lifetime location reported
|
||||
* through \p lifetime which corresponds to the
|
||||
* requested built-in key.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* The requested key identifier designates a built-in key.
|
||||
* In a multi-application configuration, the requested owner
|
||||
* is allowed to access it.
|
||||
* \retval #PSA_ERROR_DOES_NOT_EXIST
|
||||
* The requested key identifier is not a built-in key which is known
|
||||
* to this function. If a key exists in the key storage with this
|
||||
* identifier, the data from the storage will be used.
|
||||
* \return (any other error)
|
||||
* Any other error is propagated to the function that requested the key.
|
||||
* Common errors include:
|
||||
* - #PSA_ERROR_NOT_PERMITTED: the key exists but the requested owner
|
||||
* is not allowed to access it.
|
||||
*/
|
||||
psa_status_t mbedtls_psa_platform_get_builtin_key(
|
||||
mbedtls_svc_key_id_t key_id,
|
||||
psa_key_lifetime_t *lifetime,
|
||||
psa_drv_slot_number_t *slot_number );
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1061,7 +1061,8 @@ typedef psa_status_t (*psa_drv_se_export_key_t)(psa_drv_se_context_t *drv_contex
|
|||
* \brief A function that generates a symmetric or asymmetric key on a secure
|
||||
* element
|
||||
*
|
||||
* If \p type is asymmetric (#PSA_KEY_TYPE_IS_ASYMMETRIC(\p type) = 1),
|
||||
* If the key type \c type recorded in \p attributes
|
||||
* is asymmetric (#PSA_KEY_TYPE_IS_ASYMMETRIC(\c type) = 1),
|
||||
* the driver may export the public key at the time of generation,
|
||||
* in the format documented for psa_export_public_key() by writing it
|
||||
* to the \p pubkey buffer.
|
||||
|
@ -1364,16 +1365,16 @@ typedef struct {
|
|||
*
|
||||
* \return #PSA_SUCCESS
|
||||
* The driver was successfully registered. Applications can now
|
||||
* use \p lifetime to access keys through the methods passed to
|
||||
* use \p location to access keys through the methods passed to
|
||||
* this function.
|
||||
* \return #PSA_ERROR_BAD_STATE
|
||||
* This function was called after the initialization of the
|
||||
* cryptography module, and this implementation does not support
|
||||
* driver registration at this stage.
|
||||
* \return #PSA_ERROR_ALREADY_EXISTS
|
||||
* There is already a registered driver for this value of \p lifetime.
|
||||
* There is already a registered driver for this value of \p location.
|
||||
* \return #PSA_ERROR_INVALID_ARGUMENT
|
||||
* \p lifetime is a reserved value.
|
||||
* \p location is a reserved value.
|
||||
* \return #PSA_ERROR_NOT_SUPPORTED
|
||||
* `methods->hal_version` is not supported by this implementation.
|
||||
* \return #PSA_ERROR_INSUFFICIENT_MEMORY
|
||||
|
|
|
@ -117,26 +117,35 @@
|
|||
*/
|
||||
#define PSA_MAC_MAX_SIZE PSA_HASH_MAX_SIZE
|
||||
|
||||
/** The tag size for an AEAD algorithm, in bytes.
|
||||
/** The length of a tag for an AEAD algorithm, in bytes.
|
||||
*
|
||||
* This macro can be used to allocate a buffer of sufficient size to store the
|
||||
* tag output from psa_aead_finish().
|
||||
*
|
||||
* See also #PSA_AEAD_TAG_MAX_SIZE.
|
||||
*
|
||||
* \param key_type The type of the AEAD key.
|
||||
* \param key_bits The size of the AEAD key in bits.
|
||||
* \param alg An AEAD algorithm
|
||||
* (\c PSA_ALG_XXX value such that
|
||||
* #PSA_ALG_IS_AEAD(\p alg) is true).
|
||||
*
|
||||
* \return The tag size for the specified algorithm.
|
||||
* \return The tag length for the specified algorithm and key.
|
||||
* If the AEAD algorithm does not have an identified
|
||||
* tag that can be distinguished from the rest of
|
||||
* the ciphertext, return 0.
|
||||
* If the AEAD algorithm is not recognized, return 0.
|
||||
* If the key type or AEAD algorithm is not
|
||||
* recognized, or the parameters are incompatible,
|
||||
* return 0.
|
||||
*/
|
||||
#define PSA_AEAD_TAG_LENGTH(alg) \
|
||||
(PSA_ALG_IS_AEAD(alg) ? \
|
||||
(((alg) & PSA_ALG_AEAD_TAG_LENGTH_MASK) >> PSA_AEAD_TAG_LENGTH_OFFSET) : \
|
||||
0)
|
||||
#define PSA_AEAD_TAG_LENGTH(key_type, key_bits, alg) \
|
||||
(PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 ? \
|
||||
PSA_ALG_AEAD_GET_TAG_LENGTH(alg) : \
|
||||
((void) (key_bits), 0))
|
||||
|
||||
/** The maximum tag size for all supported AEAD algorithms, in bytes.
|
||||
*
|
||||
* See also #PSA_AEAD_TAG_LENGTH(\p alg).
|
||||
* See also #PSA_AEAD_TAG_LENGTH(\p key_type, \p key_bits, \p alg).
|
||||
*/
|
||||
#define PSA_AEAD_TAG_MAX_SIZE 16
|
||||
|
||||
|
@ -189,7 +198,7 @@
|
|||
|
||||
/** This macro returns the maximum supported length of the PSK for the
|
||||
* TLS-1.2 PSK-to-MS key derivation
|
||||
* (#PSA_ALG_TLS12_PSK_TO_MS(\p hash_alg)).
|
||||
* (#PSA_ALG_TLS12_PSK_TO_MS(\c hash_alg)).
|
||||
*
|
||||
* The maximum supported length does not depend on the chosen hash algorithm.
|
||||
*
|
||||
|
@ -241,10 +250,14 @@
|
|||
* insufficient buffer size. Depending on the algorithm, the actual size of
|
||||
* the ciphertext may be smaller.
|
||||
*
|
||||
* See also #PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(\p plaintext_length).
|
||||
*
|
||||
* \warning This macro may evaluate its arguments multiple times or
|
||||
* zero times, so you should not pass arguments that contain
|
||||
* side effects.
|
||||
*
|
||||
* \param key_type A symmetric key type that is
|
||||
* compatible with algorithm \p alg.
|
||||
* \param alg An AEAD algorithm
|
||||
* (\c PSA_ALG_XXX value such that
|
||||
* #PSA_ALG_IS_AEAD(\p alg) is true).
|
||||
|
@ -252,11 +265,13 @@
|
|||
*
|
||||
* \return The AEAD ciphertext size for the specified
|
||||
* algorithm.
|
||||
* If the AEAD algorithm is not recognized, return 0.
|
||||
* If the key type or AEAD algorithm is not
|
||||
* recognized, or the parameters are incompatible,
|
||||
* return 0.
|
||||
*/
|
||||
#define PSA_AEAD_ENCRYPT_OUTPUT_SIZE(alg, plaintext_length) \
|
||||
(PSA_AEAD_TAG_LENGTH(alg) != 0 ? \
|
||||
(plaintext_length) + PSA_AEAD_TAG_LENGTH(alg) : \
|
||||
#define PSA_AEAD_ENCRYPT_OUTPUT_SIZE(key_type, alg, plaintext_length) \
|
||||
(PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 ? \
|
||||
(plaintext_length) + PSA_ALG_AEAD_GET_TAG_LENGTH(alg) : \
|
||||
0)
|
||||
|
||||
/** A sufficient output buffer size for psa_aead_encrypt(), for any of the
|
||||
|
@ -268,7 +283,8 @@
|
|||
* \note This macro returns a compile-time constant if its arguments are
|
||||
* compile-time constants.
|
||||
*
|
||||
* See also #PSA_AEAD_ENCRYPT_OUTPUT_SIZE(\p alg, \p plaintext_length).
|
||||
* See also #PSA_AEAD_ENCRYPT_OUTPUT_SIZE(\p key_type, \p alg,
|
||||
* \p plaintext_length).
|
||||
*
|
||||
* \param plaintext_length Size of the plaintext in bytes.
|
||||
*
|
||||
|
@ -287,10 +303,14 @@
|
|||
* insufficient buffer size. Depending on the algorithm, the actual size of
|
||||
* the plaintext may be smaller.
|
||||
*
|
||||
* See also #PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(\p ciphertext_length).
|
||||
*
|
||||
* \warning This macro may evaluate its arguments multiple times or
|
||||
* zero times, so you should not pass arguments that contain
|
||||
* side effects.
|
||||
*
|
||||
* \param key_type A symmetric key type that is
|
||||
* compatible with algorithm \p alg.
|
||||
* \param alg An AEAD algorithm
|
||||
* (\c PSA_ALG_XXX value such that
|
||||
* #PSA_ALG_IS_AEAD(\p alg) is true).
|
||||
|
@ -298,11 +318,14 @@
|
|||
*
|
||||
* \return The AEAD ciphertext size for the specified
|
||||
* algorithm.
|
||||
* If the AEAD algorithm is not recognized, return 0.
|
||||
* If the key type or AEAD algorithm is not
|
||||
* recognized, or the parameters are incompatible,
|
||||
* return 0.
|
||||
*/
|
||||
#define PSA_AEAD_DECRYPT_OUTPUT_SIZE(alg, ciphertext_length) \
|
||||
(PSA_AEAD_TAG_LENGTH(alg) != 0 ? \
|
||||
(ciphertext_length) - PSA_AEAD_TAG_LENGTH(alg) : \
|
||||
#define PSA_AEAD_DECRYPT_OUTPUT_SIZE(key_type, alg, ciphertext_length) \
|
||||
(PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 && \
|
||||
(ciphertext_length) > PSA_ALG_AEAD_GET_TAG_LENGTH(alg) ? \
|
||||
(ciphertext_length) - PSA_ALG_AEAD_GET_TAG_LENGTH(alg) : \
|
||||
0)
|
||||
|
||||
/** A sufficient output buffer size for psa_aead_decrypt(), for any of the
|
||||
|
@ -314,7 +337,8 @@
|
|||
* \note This macro returns a compile-time constant if its arguments are
|
||||
* compile-time constants.
|
||||
*
|
||||
* See also #PSA_AEAD_DECRYPT_OUTPUT_SIZE(\p alg, \p ciphertext_length).
|
||||
* See also #PSA_AEAD_DECRYPT_OUTPUT_SIZE(\p key_type, \p alg,
|
||||
* \p ciphertext_length).
|
||||
*
|
||||
* \param ciphertext_length Size of the ciphertext in bytes.
|
||||
*
|
||||
|
@ -351,11 +375,12 @@
|
|||
* or the parameters are incompatible, return 0.
|
||||
*/
|
||||
#define PSA_AEAD_NONCE_LENGTH(key_type, alg) \
|
||||
(PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) == 16 && \
|
||||
(PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg) == PSA_ALG_CCM || \
|
||||
PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg) == PSA_ALG_GCM) ? 12 : \
|
||||
(PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) == 16 ? \
|
||||
MBEDTLS_PSA_ALG_AEAD_EQUAL(alg, PSA_ALG_CCM) ? 13 : \
|
||||
MBEDTLS_PSA_ALG_AEAD_EQUAL(alg, PSA_ALG_GCM) ? 12 : \
|
||||
0 : \
|
||||
(key_type) == PSA_KEY_TYPE_CHACHA20 && \
|
||||
PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg) == PSA_ALG_CHACHA20_POLY1305 ? 12 : \
|
||||
MBEDTLS_PSA_ALG_AEAD_EQUAL(alg, PSA_ALG_CHACHA20_POLY1305) ? 12 : \
|
||||
0)
|
||||
|
||||
/** The maximum default nonce size among all supported pairs of key types and
|
||||
|
@ -369,7 +394,7 @@
|
|||
* just the largest size that may be generated by
|
||||
* #psa_aead_generate_nonce().
|
||||
*/
|
||||
#define PSA_AEAD_NONCE_MAX_SIZE 12
|
||||
#define PSA_AEAD_NONCE_MAX_SIZE 13
|
||||
|
||||
/** A sufficient output buffer size for psa_aead_update().
|
||||
*
|
||||
|
@ -378,10 +403,14 @@
|
|||
* insufficient buffer size. The actual size of the output may be smaller
|
||||
* in any given call.
|
||||
*
|
||||
* See also #PSA_AEAD_UPDATE_OUTPUT_MAX_SIZE(\p input_length).
|
||||
*
|
||||
* \warning This macro may evaluate its arguments multiple times or
|
||||
* zero times, so you should not pass arguments that contain
|
||||
* side effects.
|
||||
*
|
||||
* \param key_type A symmetric key type that is
|
||||
* compatible with algorithm \p alg.
|
||||
* \param alg An AEAD algorithm
|
||||
* (\c PSA_ALG_XXX value such that
|
||||
* #PSA_ALG_IS_AEAD(\p alg) is true).
|
||||
|
@ -389,16 +418,20 @@
|
|||
*
|
||||
* \return A sufficient output buffer size for the specified
|
||||
* algorithm.
|
||||
* If the AEAD algorithm is not recognized, return 0.
|
||||
* If the key type or AEAD algorithm is not
|
||||
* recognized, or the parameters are incompatible,
|
||||
* return 0.
|
||||
*/
|
||||
/* For all the AEAD modes defined in this specification, it is possible
|
||||
* to emit output without delay. However, hardware may not always be
|
||||
* capable of this. So for modes based on a block cipher, allow the
|
||||
* implementation to delay the output until it has a full block. */
|
||||
#define PSA_AEAD_UPDATE_OUTPUT_SIZE(alg, input_length) \
|
||||
(PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
|
||||
PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE, (input_length)) : \
|
||||
(input_length))
|
||||
#define PSA_AEAD_UPDATE_OUTPUT_SIZE(key_type, alg, input_length) \
|
||||
(PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 ? \
|
||||
PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
|
||||
PSA_ROUND_UP_TO_MULTIPLE(PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type), (input_length)) : \
|
||||
(input_length) : \
|
||||
0)
|
||||
|
||||
/** A sufficient output buffer size for psa_aead_update(), for any of the
|
||||
* supported key types and AEAD algorithms.
|
||||
|
@ -406,7 +439,7 @@
|
|||
* If the size of the output buffer is at least this large, it is guaranteed
|
||||
* that psa_aead_update() will not fail due to an insufficient buffer size.
|
||||
*
|
||||
* See also #PSA_AEAD_UPDATE_OUTPUT_SIZE(\p alg, \p input_length).
|
||||
* See also #PSA_AEAD_UPDATE_OUTPUT_SIZE(\p key_type, \p alg, \p input_length).
|
||||
*
|
||||
* \param input_length Size of the input in bytes.
|
||||
*/
|
||||
|
@ -420,23 +453,30 @@
|
|||
* insufficient ciphertext buffer size. The actual size of the output may
|
||||
* be smaller in any given call.
|
||||
*
|
||||
* See also #PSA_AEAD_FINISH_OUTPUT_MAX_SIZE.
|
||||
*
|
||||
* \param key_type A symmetric key type that is
|
||||
compatible with algorithm \p alg.
|
||||
* \param alg An AEAD algorithm
|
||||
* (\c PSA_ALG_XXX value such that
|
||||
* #PSA_ALG_IS_AEAD(\p alg) is true).
|
||||
*
|
||||
* \return A sufficient ciphertext buffer size for the
|
||||
* specified algorithm.
|
||||
* If the AEAD algorithm is not recognized, return 0.
|
||||
* If the key type or AEAD algorithm is not
|
||||
* recognized, or the parameters are incompatible,
|
||||
* return 0.
|
||||
*/
|
||||
#define PSA_AEAD_FINISH_OUTPUT_SIZE(alg) \
|
||||
(PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
|
||||
PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE : \
|
||||
#define PSA_AEAD_FINISH_OUTPUT_SIZE(key_type, alg) \
|
||||
(PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 && \
|
||||
PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
|
||||
PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) : \
|
||||
0)
|
||||
|
||||
/** A sufficient ciphertext buffer size for psa_aead_finish(), for any of the
|
||||
* supported key types and AEAD algorithms.
|
||||
*
|
||||
* See also #PSA_AEAD_FINISH_OUTPUT_SIZE(\p alg).
|
||||
* See also #PSA_AEAD_FINISH_OUTPUT_SIZE(\p key_type, \p alg).
|
||||
*/
|
||||
#define PSA_AEAD_FINISH_OUTPUT_MAX_SIZE (PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE)
|
||||
|
||||
|
@ -447,23 +487,30 @@
|
|||
* insufficient plaintext buffer size. The actual size of the output may
|
||||
* be smaller in any given call.
|
||||
*
|
||||
* See also #PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE.
|
||||
*
|
||||
* \param key_type A symmetric key type that is
|
||||
* compatible with algorithm \p alg.
|
||||
* \param alg An AEAD algorithm
|
||||
* (\c PSA_ALG_XXX value such that
|
||||
* #PSA_ALG_IS_AEAD(\p alg) is true).
|
||||
*
|
||||
* \return A sufficient plaintext buffer size for the
|
||||
* specified algorithm.
|
||||
* If the AEAD algorithm is not recognized, return 0.
|
||||
* If the key type or AEAD algorithm is not
|
||||
* recognized, or the parameters are incompatible,
|
||||
* return 0.
|
||||
*/
|
||||
#define PSA_AEAD_VERIFY_OUTPUT_SIZE(alg) \
|
||||
(PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
|
||||
PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE : \
|
||||
#define PSA_AEAD_VERIFY_OUTPUT_SIZE(key_type, alg) \
|
||||
(PSA_AEAD_NONCE_LENGTH(key_type, alg) != 0 && \
|
||||
PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
|
||||
PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) : \
|
||||
0)
|
||||
|
||||
/** A sufficient plaintext buffer size for psa_aead_verify(), for any of the
|
||||
* supported key types and AEAD algorithms.
|
||||
*
|
||||
* See also #PSA_AEAD_VERIFY_OUTPUT_SIZE(\p alg).
|
||||
* See also #PSA_AEAD_VERIFY_OUTPUT_SIZE(\p key_type, \p alg).
|
||||
*/
|
||||
#define PSA_AEAD_VERIFY_OUTPUT_MAX_SIZE (PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE)
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue