Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to mbedtls 2.28.0 #173

Merged
merged 10 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mbedtls-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mbedtls-sys-auto"
version = "2.26.1"
version = "2.28.0"
authors = ["Jethro Beekman <jethro@fortanix.com>"]
build = "build/build.rs"
license = "Apache-2.0/GPL-2.0+"
Expand Down
1 change: 1 addition & 0 deletions mbedtls-sys/build/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ impl super::BuildConfig {
}

let bindings = bindgen::builder()
.enable_function_attribute_detection()
.clang_args(cc.get_compiler().args().iter().map(|arg| arg.to_str().unwrap()))
.header_contents("bindgen-input.h", &input)
.allowlist_function("^(?i)mbedtls_.*")
Expand Down
7 changes: 5 additions & 2 deletions mbedtls-sys/build/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const DEFAULT_DEFINES: &'static [CDefine] = &[
("MBEDTLS_AES_ROM_TABLES", Undefined),
("MBEDTLS_AES_FEWER_TABLES", Undefined),
("MBEDTLS_CAMELLIA_SMALL_MEMORY", Undefined),
("MBEDTLS_CHECK_RETURN_WARNING", Defined),
("MBEDTLS_CIPHER_MODE_CBC", Defined),
("MBEDTLS_CIPHER_MODE_CFB", Defined),
("MBEDTLS_CIPHER_MODE_CTR", Defined),
Expand Down Expand Up @@ -203,6 +204,7 @@ const DEFAULT_DEFINES: &'static [CDefine] = &[
("MBEDTLS_PK_RSA_ALT_SUPPORT", Defined),
("MBEDTLS_PKCS1_V15", Defined),
("MBEDTLS_PKCS1_V21", Defined),
("MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS", Undefined),
("MBEDTLS_PSA_CRYPTO_CLIENT", Undefined),
("MBEDTLS_PSA_CRYPTO_DRIVERS", Undefined),
("MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG", Undefined),
Expand Down Expand Up @@ -349,7 +351,7 @@ const DEFAULT_DEFINES: &'static [CDefine] = &[
("MBEDTLS_HMAC_DRBG_MAX_REQUEST", Undefined), // default: 1024
("MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT", Undefined), // default: 384
("MBEDTLS_ECP_MAX_BITS", Undefined), // default: 521
("MBEDTLS_ECP_WINDOW_SIZE", Undefined), // default: 6
("MBEDTLS_ECP_WINDOW_SIZE", Undefined), // default: 4
("MBEDTLS_ECP_FIXED_POINT_OPTIM", Undefined), // default: 1
("MBEDTLS_ENTROPY_MAX_SOURCES", Undefined), // default: 20
("MBEDTLS_ENTROPY_MAX_GATHER", Undefined), // default: 128
Expand Down Expand Up @@ -377,6 +379,7 @@ const DEFAULT_DEFINES: &'static [CDefine] = &[
("MBEDTLS_PLATFORM_VSNPRINTF_MACRO", Undefined), // default: vsnprintf
("MBEDTLS_PLATFORM_NV_SEED_READ_MACRO", Undefined), // default: mbedtls_platform_std_nv_seed_read
("MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO", Undefined), // default: mbedtls_platform_std_nv_seed_write
("MBEDTLS_CHECK_RETURN", Undefined), // default: __attribute__((__warn_unused_result__))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing MBEDTLS_IGNORE_RETURN

Copy link
Member Author

@MihirLuthra MihirLuthra Feb 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, not adding this as this is a function-like macro (although, I am less knowledgeable about why). For reference:

/** \def MBEDTLS_IGNORE_RETURN
 *
 * This macro requires one argument, which should be a C function call.
 * If that function call would cause a #MBEDTLS_CHECK_RETURN warning, this
 * warning is suppressed.
 */
//#define MBEDTLS_IGNORE_RETURN( result ) ((void) !(result))

("MBEDTLS_PSA_HMAC_DRBG_MD_TYPE", Undefined), // default: see config.h
("MBEDTLS_PSA_KEY_SLOT_COUNT", Undefined), // default: 32
("MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT", Undefined), // default: 86400
Expand All @@ -392,10 +395,10 @@ const DEFAULT_DEFINES: &'static [CDefine] = &[
("MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME", Undefined), // default: 86400
("MBEDTLS_PSK_MAX_LEN", Undefined), // default: 32
("MBEDTLS_SSL_COOKIE_TIMEOUT", Undefined), // default: 60
("MBEDTLS_TLS_EXT_CID", Undefined), // default: 254
("MBEDTLS_SSL_CIPHERSUITES", Undefined), // default: no default
("MBEDTLS_X509_MAX_INTERMEDIATE_CA", Undefined), // default: 8
("MBEDTLS_X509_MAX_FILE_PATH_LEN", Undefined), // default: 512
("MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES", Undefined),
("MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE", Defined),
("MBEDTLS_PLATFORM_ZEROIZE_ALT", Undefined),
("MBEDTLS_PLATFORM_GMTIME_R_ALT", Undefined),
Expand Down
5 changes: 3 additions & 2 deletions mbedtls-sys/build/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ use crate::features::FEATURES;
#[cfg_attr(rustfmt, rustfmt_skip)]
pub const ORDERED: &'static [(Option<&'static str>, &'static str)] = &[
(None, "config_psa.h"),
(None, "platform_time.h"),
(None, "platform_util.h"),
(None, "bignum.h"),
(None, "md.h"),
(Some("threading"), "threading.h"),
(None, "ecp.h"),
(None, "rsa.h"),
(None, "ecdsa.h"),
(None, "platform_time.h"),
(None, "asn1.h"),
(None, "pk.h"),
(None, "platform_util.h"),
(None, "x509.h"),
(None, "cipher.h"),
(None, "x509_crl.h"),
Expand Down Expand Up @@ -91,6 +91,7 @@ pub const ORDERED: &'static [(Option<&'static str>, &'static str)] = &[
(None, "ecp_internal.h"),
(None, "des.h"),
(None, "debug.h"),
(None, "constant_time.h"),
(None, "cmac.h"),
(None, "cipher_internal.h"),
(None, "chachapoly.h"),
Expand Down
23 changes: 14 additions & 9 deletions mbedtls-sys/vendor/.github/issue_template.md
Original file line number Diff line number Diff line change
@@ -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

---------------------------------------------------------------
Expand All @@ -28,14 +38,9 @@ Version:
**Steps to reproduce**

----------------------------------------------------------------
## Enhancement\Feature Request

**Justification - why does the library need this feature?**
## Enhancement / Feature Request

**Suggested enhancement**

-----------------------------------------------------------------

## Question
**Justification - why does the library need this feature?**

**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)**
4 changes: 4 additions & 0 deletions mbedtls-sys/vendor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Testing
Coverage
*.gcno
*.gcda
coverage-summary.txt

# generated by scripts/memory.sh
massif-*
Expand Down Expand Up @@ -48,6 +49,9 @@ massif-*
# Generated documentation:
/apidoc

# PSA Crypto compliance test repo, cloned by test_psa_compliance.py
/psa-arch-tests

# Editor navigation files:
/GPATH
/GRTAGS
Expand Down
23 changes: 5 additions & 18 deletions mbedtls-sys/vendor/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,25 @@ jobs:
- graphviz
- gcc-arm-none-eabi
- libnewlib-arm-none-eabi
- gcc-arm-linux-gnueabi
- libc6-dev-armel-cross
language: python # Needed to get pip for Python 3
python: 3.5 # version from Ubuntu 16.04
install:
- pip install mypy==0.780 pylint==2.4.4
- scripts/min_requirements.py
script:
- tests/scripts/all.sh -k 'check_*'
- tests/scripts/all.sh -k test_default_out_of_box
- tests/scripts/test-ref-configs.pl
- tests/scripts/all.sh -k build_arm_none_eabi_gcc_arm5vte build_arm_none_eabi_gcc_m0plus
- tests/scripts/all.sh -k test_ref_configs
- tests/scripts/all.sh -k build_arm_linux_gnueabi_gcc_arm5vte build_arm_none_eabi_gcc_m0plus

- name: full configuration
script:
- tests/scripts/all.sh -k test_full_cmake_gcc_asan

- name: macOS
os: osx
compiler: clang
script:
- tests/scripts/all.sh -k test_default_out_of_box

- name: Windows
os: windows
before_install:
- choco install python --version=3.5.4
env:
# Add the directory where the Choco package goes
- PATH=/c/Python35:/c/Python35/Scripts:$PATH
script:
- type python; python --version
- python scripts/generate_psa_constants.py
# Logs appear out of sequence on Windows. Give time to catch up.
- sleep 5
- scripts/windows_msbuild.bat v141 # Visual Studio 2017

after_failure:
Expand Down
54 changes: 54 additions & 0 deletions mbedtls-sys/vendor/BRANCHES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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 new features land,
as well as 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/)
- [`mbedtls-2.28`](https://github.com/ARMmbed/mbedtls/tree/mbedtls-2.28)
maintained until at least the end of 2024.

Users are urged to always use the latest version of a maintained branch.
20 changes: 20 additions & 0 deletions mbedtls-sys/vendor/BUGS.md
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 3 deletions mbedtls-sys/vendor/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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)
Expand Down
Loading