mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-01 13:13:28 +00:00
pkcs7: do not store content type OIDs
They will always be constant. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This commit is contained in:
parent
55d9df25ef
commit
e373a254c4
@ -139,7 +139,6 @@ mbedtls_pkcs7_signer_info;
|
|||||||
* Structure holding attached data as part of PKCS7 signed data format
|
* Structure holding attached data as part of PKCS7 signed data format
|
||||||
*/
|
*/
|
||||||
typedef struct mbedtls_pkcs7_data {
|
typedef struct mbedtls_pkcs7_data {
|
||||||
mbedtls_pkcs7_buf MBEDTLS_PRIVATE(oid);
|
|
||||||
mbedtls_pkcs7_buf MBEDTLS_PRIVATE(data);
|
mbedtls_pkcs7_buf MBEDTLS_PRIVATE(data);
|
||||||
}
|
}
|
||||||
mbedtls_pkcs7_data;
|
mbedtls_pkcs7_data;
|
||||||
|
@ -490,12 +490,14 @@ static int pkcs7_get_signed_data(unsigned char *buf, size_t buflen,
|
|||||||
return MBEDTLS_ERR_PKCS7_INVALID_ALG;
|
return MBEDTLS_ERR_PKCS7_INVALID_ALG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not expect any content */
|
mbedtls_pkcs7_buf content_type;
|
||||||
ret = pkcs7_get_content_info_type(&p, end_set, &end_content_info,
|
ret = pkcs7_get_content_info_type(&p, end, &end_content_info, &content_type);
|
||||||
&signed_data->content.oid);
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
if (MBEDTLS_OID_CMP(MBEDTLS_OID_PKCS7_DATA, &content_type)) {
|
||||||
|
return MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
if (p != end_content_info) {
|
if (p != end_content_info) {
|
||||||
/* Determine if valid content is present */
|
/* Determine if valid content is present */
|
||||||
@ -514,10 +516,6 @@ static int pkcs7_get_signed_data(unsigned char *buf, size_t buflen,
|
|||||||
return MBEDTLS_ERR_PKCS7_FEATURE_UNAVAILABLE;
|
return MBEDTLS_ERR_PKCS7_FEATURE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MBEDTLS_OID_CMP(MBEDTLS_OID_PKCS7_DATA, &signed_data->content.oid)) {
|
|
||||||
return MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Look for certificates, there may or may not be any */
|
/* Look for certificates, there may or may not be any */
|
||||||
mbedtls_x509_crt_init(&signed_data->certs);
|
mbedtls_x509_crt_init(&signed_data->certs);
|
||||||
ret = pkcs7_get_certificates(&p, end, &signed_data->certs);
|
ret = pkcs7_get_certificates(&p, end, &signed_data->certs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user