| dee99f10 | 15-Mar-2023 |
Yann Gautier <yann.gautier@st.com> |
refactor(auth)!: unify REGISTER_CRYPTO_LIB
Have only one definition for REGISTER_CRYPTO_LIB macro, with all the possible fields. Worst case adds 4 u64 to crypto_lib_desc. While at it, correct some M
refactor(auth)!: unify REGISTER_CRYPTO_LIB
Have only one definition for REGISTER_CRYPTO_LIB macro, with all the possible fields. Worst case adds 4 u64 to crypto_lib_desc. While at it, correct some MISRA violations: MC3R1.R12.1: (advisory) The precedence of operators within expressions should be made explicit.
Signed-off-by: Yann Gautier <yann.gautier@st.com> Change-Id: I1342a20e6eef2354753182c2a81ff959e03e5c81
show more ...
|
| ddd9f675 | 19-Jan-2023 |
Demi Marie Obenour <demiobenour@gmail.com> |
refactor(auth): clean up certificate length checks
The previous code was correct but unnecessarily verbose.
Change-Id: Ia19c667811a7c3b6957a0274d36076b0b16e36b7 Signed-off-by: Demi Marie Obenour <d
refactor(auth): clean up certificate length checks
The previous code was correct but unnecessarily verbose.
Change-Id: Ia19c667811a7c3b6957a0274d36076b0b16e36b7 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
show more ...
|
| f5c51855 | 09-Dec-2022 |
Demi Marie Obenour <demiobenour@gmail.com> |
fix(auth): properly validate X.509 extensions
get_ext() does not check the return value of the various mbedtls_* functions, as cert_parse() is assumed to have guaranteed that they will always succee
fix(auth): properly validate X.509 extensions
get_ext() does not check the return value of the various mbedtls_* functions, as cert_parse() is assumed to have guaranteed that they will always succeed. However, it passes the end of an extension as the end pointer to these functions, whereas cert_parse() passes the end of the TBSCertificate. Furthermore, cert_parse() does *not* check that the contents of the extension have the same length as the extension itself. Before fd37982a19a4a291 ("fix(auth): forbid junk after extensions"), cert_parse() also does not check that the extension block extends to the end of the TBSCertificate.
This is a problem, as mbedtls_asn1_get_tag() leaves *p and *len undefined on failure. In practice, this results in get_ext() continuing to parse at different offsets than were used (and validated) by cert_parse(), which means that the in-bounds guarantee provided by cert_parse() no longer holds.
This patch fixes the remaining flaw by enforcing that the contents of an extension are the same length as the extension itself.
Change-Id: Id4570f911402e34d5d6c799ae01a01f184c68d7c Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
show more ...
|
| ce882b53 | 08-Dec-2022 |
Demi Marie Obenour <demiobenour@gmail.com> |
refactor(auth): do not include SEQUENCE tag in saved extensions
This makes the code a little bit smaller. No functional change intended.
Change-Id: I794d2927fcd034a79e29c9bba1f8e4410203f547 Signed
refactor(auth): do not include SEQUENCE tag in saved extensions
This makes the code a little bit smaller. No functional change intended.
Change-Id: I794d2927fcd034a79e29c9bba1f8e4410203f547 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
show more ...
|
| ca34dbc0 | 08-Dec-2022 |
Demi Marie Obenour <demiobenour@gmail.com> |
fix(auth): reject junk after certificates
Certificates must not allow trailing junk after them.
Change-Id: Ie33205fb051fc63af5b72c326822da7f62eec1d1 Signed-off-by: Demi Marie Obenour <demiobenour@g
fix(auth): reject junk after certificates
Certificates must not allow trailing junk after them.
Change-Id: Ie33205fb051fc63af5b72c326822da7f62eec1d1 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
show more ...
|
| 63cc49d0 | 08-Dec-2022 |
Demi Marie Obenour <demiobenour@gmail.com> |
refactor(auth): avoid parsing signature algorithm twice
Since the two instances of the signature algorithm in a certificate must be bitwise identical, it is not necessary to parse both of them. Inst
refactor(auth): avoid parsing signature algorithm twice
Since the two instances of the signature algorithm in a certificate must be bitwise identical, it is not necessary to parse both of them. Instead, it suffices to parse one of them, and then check that the other fits in the remaining buffer space and is equal to the first.
Change-Id: Id0a0663165f147879ac83b6a540378fd4873b0dd Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
show more ...
|
| 94c0cfbb | 08-Dec-2022 |
Demi Marie Obenour <demiobenour@gmail.com> |
refactor(auth): partially validate SubjectPublicKeyInfo early
This reduces the likelihood of future problems later.
Change-Id: Ia748b6ae31a7a48f17ec7f0fc08310a50cd1b135 Signed-off-by: Demi Marie Ob
refactor(auth): partially validate SubjectPublicKeyInfo early
This reduces the likelihood of future problems later.
Change-Id: Ia748b6ae31a7a48f17ec7f0fc08310a50cd1b135 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
show more ...
|
| f47547b3 | 08-Dec-2022 |
Demi Marie Obenour <demiobenour@gmail.com> |
fix(auth): reject invalid padding in digests
Digests must not have padding after the SEQUENCE or OCTET STRING.
Change-Id: Id25ab23111781f8c8a97c2c3c8edf1cc4a4384c0 Signed-off-by: Demi Marie Obenour
fix(auth): reject invalid padding in digests
Digests must not have padding after the SEQUENCE or OCTET STRING.
Change-Id: Id25ab23111781f8c8a97c2c3c8edf1cc4a4384c0 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
show more ...
|
| 72460f50 | 08-Dec-2022 |
Demi Marie Obenour <demiobenour@gmail.com> |
fix(auth): require at least one extension to be present
X.509 and RFC5280 allow omitting the extensions entirely, but require that if the extensions field is present at all, it must contain at least
fix(auth): require at least one extension to be present
X.509 and RFC5280 allow omitting the extensions entirely, but require that if the extensions field is present at all, it must contain at least one certificate. TF-A already requires the extensions to be present, but allows them to be empty. However, a certificate with an empty extensions field will always fail later on, as the extensions contain the information needed to validate the next stage in the boot chain. Therefore, it is simpler to require the extension field to be present and contain at least one extension. Also add a comment explaining why the extensions field is required, even though it is OPTIONAL in the ASN.1 syntax.
Change-Id: Ie26eed8a7924bf50937a6b27ccdf7cc9a390588d Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
show more ...
|
| fd37982a | 08-Dec-2022 |
Demi Marie Obenour <demiobenour@gmail.com> |
fix(auth): forbid junk after extensions
The extensions must use all remaining bytes in the TBSCertificate.
Change-Id: Idf48f7168e146d050ba62dbc732638946fcd6c92 Signed-off-by: Demi Marie Obenour <de
fix(auth): forbid junk after extensions
The extensions must use all remaining bytes in the TBSCertificate.
Change-Id: Idf48f7168e146d050ba62dbc732638946fcd6c92 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
show more ...
|