diff options
| -rw-r--r-- | meta-networking/recipes-connectivity/mbedtls/mbedtls/fix-incorrect-EOF-check-in-ssl_context_info.patch | 57 | ||||
| -rw-r--r-- | meta-networking/recipes-connectivity/mbedtls/mbedtls_2.24.0.bb (renamed from meta-networking/recipes-connectivity/mbedtls/mbedtls_2.16.6.bb) | 10 |
2 files changed, 63 insertions, 4 deletions
diff --git a/meta-networking/recipes-connectivity/mbedtls/mbedtls/fix-incorrect-EOF-check-in-ssl_context_info.patch b/meta-networking/recipes-connectivity/mbedtls/mbedtls/fix-incorrect-EOF-check-in-ssl_context_info.patch new file mode 100644 index 0000000000..836fce91e6 --- /dev/null +++ b/meta-networking/recipes-connectivity/mbedtls/mbedtls/fix-incorrect-EOF-check-in-ssl_context_info.patch | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | From d696e7d91e42a190d06760279d2e396392143454 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nayna Jain <nayna@linux.ibm.com> | ||
| 3 | Date: Thu, 13 Aug 2020 19:17:53 +0000 | ||
| 4 | Subject: [PATCH] programs/ssl: Fix incorrect EOF check in ssl_context_info.c | ||
| 5 | |||
| 6 | In `read_next_b64_code()`, the result of fgetc() is stored into a char, | ||
| 7 | but later compared against EOF, which is generally -1. On platforms | ||
| 8 | where char is unsigned, this generates a compiler warning/error that the | ||
| 9 | comparison will never be true (causing a build failure). The value will | ||
| 10 | never match, with the function ultimately bailing with a "Too many bad | ||
| 11 | symbols are detected" error. | ||
| 12 | |||
| 13 | On platforms with signed char, EOF is detected, but a file containing a | ||
| 14 | 0xFF character will causes a premature end of file exit of the loop. | ||
| 15 | |||
| 16 | Fix this by changing the result to an int. | ||
| 17 | |||
| 18 | Fixes #3794. | ||
| 19 | |||
| 20 | Signed-off-by: Nayna Jain <nayna@linux.ibm.com> | ||
| 21 | Signed-off-by: David Brown <david.brown@linaro.org> | ||
| 22 | --- | ||
| 23 | ChangeLog.d/bugfix_3794.txt | 4 ++++ | ||
| 24 | programs/ssl/ssl_context_info.c | 4 ++-- | ||
| 25 | 2 files changed, 6 insertions(+), 2 deletions(-) | ||
| 26 | create mode 100644 ChangeLog.d/bugfix_3794.txt | ||
| 27 | |||
| 28 | diff --git a/ChangeLog.d/bugfix_3794.txt b/ChangeLog.d/bugfix_3794.txt | ||
| 29 | new file mode 100644 | ||
| 30 | index 0000000000..a483ea76ae | ||
| 31 | --- /dev/null | ||
| 32 | +++ b/ChangeLog.d/bugfix_3794.txt | ||
| 33 | @@ -0,0 +1,4 @@ | ||
| 34 | +Bugfix | ||
| 35 | + * Fix handling of EOF against 0xff bytes and on platforms with | ||
| 36 | + unsigned chars. Fixes a build failure on platforms where char is | ||
| 37 | + unsigned. Fixes #3794. | ||
| 38 | diff --git a/programs/ssl/ssl_context_info.c b/programs/ssl/ssl_context_info.c | ||
| 39 | index df8819a804..d109c1e6f7 100644 | ||
| 40 | --- a/programs/ssl/ssl_context_info.c | ||
| 41 | +++ b/programs/ssl/ssl_context_info.c | ||
| 42 | @@ -377,13 +377,13 @@ size_t read_next_b64_code( uint8_t **b64, size_t *max_len ) | ||
| 43 | int valid_balance = 0; /* balance between valid and invalid characters */ | ||
| 44 | size_t len = 0; | ||
| 45 | char pad = 0; | ||
| 46 | - char c = 0; | ||
| 47 | + int c = 0; | ||
| 48 | |||
| 49 | while( EOF != c ) | ||
| 50 | { | ||
| 51 | char c_valid = 0; | ||
| 52 | |||
| 53 | - c = (char) fgetc( b64_file ); | ||
| 54 | + c = fgetc( b64_file ); | ||
| 55 | |||
| 56 | if( pad > 0 ) | ||
| 57 | { | ||
diff --git a/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.16.6.bb b/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.24.0.bb index 8e4b6c86c5..e3a0169566 100644 --- a/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.16.6.bb +++ b/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.24.0.bb | |||
| @@ -18,13 +18,15 @@ understand what the code does. It features: \ | |||
| 18 | HOMEPAGE = "https://tls.mbed.org/" | 18 | HOMEPAGE = "https://tls.mbed.org/" |
| 19 | 19 | ||
| 20 | LICENSE = "Apache-2.0" | 20 | LICENSE = "Apache-2.0" |
| 21 | LIC_FILES_CHKSUM = "file://LICENSE;md5=302d50a6369f5f22efdb674db908167a" | 21 | LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" |
| 22 | 22 | ||
| 23 | SECTION = "libs" | 23 | SECTION = "libs" |
| 24 | 24 | ||
| 25 | SRC_URI = "https://tls.mbed.org/download/mbedtls-${PV}-apache.tgz" | 25 | S = "${WORKDIR}/git" |
| 26 | SRC_URI[md5sum] = "1f629a43c166de2eca808f3e30aa961d" | 26 | SRCREV = "523f0554b6cdc7ace5d360885c3f5bbcc73ec0e8" |
| 27 | SRC_URI[sha256sum] = "66455e23a6190a30142cdc1113f7418158839331a9d8e6b0778631d077281770" | 27 | SRC_URI = "git://github.com/ARMmbed/mbedtls.git;protocol=https;branch=development \ |
| 28 | file://fix-incorrect-EOF-check-in-ssl_context_info.patch \ | ||
| 29 | " | ||
| 28 | 30 | ||
| 29 | inherit cmake | 31 | inherit cmake |
| 30 | 32 | ||
