diff options
author | Peter Züger <zueger.peter@icloud.com> | 2024-04-26 17:48:57 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-08-13 17:32:32 +1000 |
commit | 4d6d84983f370e48e81fb05fe31802e0a13fb369 (patch) | |
tree | 527155d941758cb5366b90565e6e508437ecddb5 /py/obj.c | |
parent | 288a03625327b025f81bb6d4e7fb76d56343172c (diff) | |
download | micropython-4d6d84983f370e48e81fb05fe31802e0a13fb369.tar.gz micropython-4d6d84983f370e48e81fb05fe31802e0a13fb369.zip |
extmod/modtls_mbedtls: Fix DER parsing and calculation of key/cert len.
`mbedtls_pk_parse_key()` expects `key_len` to include the NULL terminator
for PEM data but not for DER encoded data. This also applies to
`mbedtls_x509_crt_parse()` and `cert_len`.
Since all PEM data contains "-----BEGIN" this is used to check if the data
is PEM (as per mbedtls code).
This can be done for both v2 and v3 of mbedtls since the fundamental
behaviour/expectation did not change. What changed is that in v3 the
PKCS#8 DER parser now checks that the passed key buffer is fully utilized
and no bytes are remaining (all other DER formats still do not check this).
Signed-off-by: Peter Züger <zueger.peter@icloud.com>
Diffstat (limited to 'py/obj.c')
0 files changed, 0 insertions, 0 deletions