mbedtls/library
Hanno Becker ce8bdf82a1 ECP restart: Don't calculate address of sub ctx if ctx is NULL
All modules using restartable ECC operations support passing `NULL`
as the restart context as a means to not use the feature.

The restart contexts for ECDSA and ECP are nested, and when calling
restartable ECP operations from restartable ECDSA operations, the
address of the ECP restart context to use is calculated by adding
the to the address of the ECDSA restart context the offset the of
the ECP restart context.

If the ECP restart context happens to not reside at offset `0`, this
leads to a non-`NULL` pointer being passed to restartable ECP
operations from restartable ECDSA-operations; those ECP operations
will hence assume that the pointer points to a valid ECP restart
address and likely run into a segmentation fault when trying to
dereference the non-NULL but close-to-NULL address.

The problem doesn't arise currently because luckily the ECP restart
context has offset 0 within the ECDSA restart context, but we should
not rely on it.

This commit fixes the passage from restartable ECDSA to restartable ECP
operations by propagating NULL as the restart context pointer.

Apart from being fragile, the previous version could also lead to
NULL pointer dereference failures in ASanDbg builds which dereferenced
the ECDSA restart context even though it's not needed to calculate the
address of the offset'ed ECP restart context.
2019-07-19 14:56:09 +01:00
..
.gitignore
aes.c
aesni.c
arc4.c
aria.c
asn1parse.c [FIXUP] Fix bug in ASN.1 traversal of silently ignored tag 2019-06-25 10:41:34 +01:00
asn1write.c
base64.c
bignum.c Consistently use (type *) instead of (type*) for pointer conversion 2019-06-25 09:10:57 +01:00
blowfish.c
camellia.c
ccm.c
certs.c Re-generate library/certs.c from script 2019-05-30 10:58:12 +01:00
chacha20.c
chachapoly.c
cipher_wrap.c Consistently use (type *) instead of (type*) for pointer conversion 2019-06-25 09:10:57 +01:00
cipher.c Consistently use (type *) instead of (type*) for pointer conversion 2019-06-25 09:10:57 +01:00
cmac.c
CMakeLists.txt Merge branch 'mbedtls-2.16' into baremetal-2.16-01_07_19 2019-07-01 11:25:42 +01:00
ctr_drbg.c
debug.c Consistently use (type *) instead of (type*) for pointer conversion 2019-06-25 09:10:57 +01:00
des.c
dhm.c Allow DHM self test to run without MBEDTLS_PEM_PARSE_C 2019-05-30 10:58:12 +01:00
ecdh.c
ecdsa.c ECP restart: Don't calculate address of sub ctx if ctx is NULL 2019-07-19 14:56:09 +01:00
ecjpake.c
ecp_curves.c
ecp.c
entropy_poll.c
entropy.c
error.c Merge branch 'mbedtls-2.16' into baremetal-2.16-01_07_19 2019-07-01 11:25:42 +01:00
gcm.c
havege.c Prevent building the HAVEGE module on platforms where it doesn't work 2019-06-17 15:12:51 +02:00
hkdf.c
hmac_drbg.c
Makefile Merge branch 'mbedtls-2.16' into baremetal-2.16-01_07_19 2019-07-01 11:25:42 +01:00
md2.c
md4.c
md5.c
md_wrap.c
md.c
memory_buffer_alloc.c
net_sockets.c Merge remote-tracking branch 'restricted/pr/608' into baremetal-proposed 2019-07-03 10:31:46 +02:00
nist_kw.c
oid.c Address review comments 2019-06-18 11:05:44 +01:00
padlock.c
pem.c
pk_wrap.c
pk.c
pkcs5.c
pkcs11.c
pkcs12.c
pkparse.c Fix unused variable warnings in pkparse.c 2019-06-18 11:31:59 +02:00
pkwrite.c
platform_util.c
platform.c
poly1305.c
ripemd160.c
rsa_internal.c
rsa.c
sha1.c
sha256.c
sha512.c
ssl_cache.c Remove ciphersuite from SSL session if single suite hardcoded 2019-07-08 11:23:24 +01:00
ssl_ciphersuites.c Restore static inline qualif'n of some helpers in ssl_ciphersuites.h 2019-07-08 11:23:25 +01:00
ssl_cli.c Merge remote-tracking branch 'origin/pr/602' into baremetal 2019-07-15 19:24:11 +01:00
ssl_cookie.c
ssl_srv.c Merge remote-tracking branch 'origin/pr/602' into baremetal 2019-07-15 19:24:11 +01:00
ssl_ticket.c Move session save/load function to ssl_tls.c 2019-06-03 09:51:08 +02:00
ssl_tls.c Merge remote-tracking branch 'origin/pr/602' into baremetal 2019-07-15 19:24:11 +01:00
threading.c
timing.c timing: Remove redundant include file 2019-06-20 16:33:02 +01:00
version_features.c Merge remote-tracking branch 'restricted/pr/608' into baremetal-proposed 2019-07-03 10:31:46 +02:00
version.c
x509_create.c Move declarations of internal X.509 functions to separate header 2019-06-25 09:10:57 +01:00
x509_crl.c Move declarations of internal X.509 functions to separate header 2019-06-25 09:10:57 +01:00
x509_crt.c Merge remote-tracking branch 'restricted/pr/608' into baremetal-proposed 2019-07-03 10:31:46 +02:00
x509_csr.c Move declarations of internal X.509 functions to separate header 2019-06-25 09:10:57 +01:00
x509.c Merge remote-tracking branch 'restricted/pr/608' into baremetal-proposed 2019-07-03 10:31:46 +02:00
x509write_crt.c Move declarations of internal X.509 functions to separate header 2019-06-25 09:10:57 +01:00
x509write_csr.c Move declarations of internal X.509 functions to separate header 2019-06-25 09:10:57 +01:00
xtea.c