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
2 changed files with 5 additions and 8 deletions
|
@ -139,7 +139,6 @@ mbedtls_pkcs7_signer_info;
|
|||
* Structure holding attached data as part of PKCS7 signed data format
|
||||
*/
|
||||
typedef struct mbedtls_pkcs7_data {
|
||||
mbedtls_pkcs7_buf MBEDTLS_PRIVATE(oid);
|
||||
mbedtls_pkcs7_buf MBEDTLS_PRIVATE(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;
|
||||
}
|
||||
|
||||
/* Do not expect any content */
|
||||
ret = pkcs7_get_content_info_type(&p, end_set, &end_content_info,
|
||||
&signed_data->content.oid);
|
||||
mbedtls_pkcs7_buf content_type;
|
||||
ret = pkcs7_get_content_info_type(&p, end, &end_content_info, &content_type);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
if (MBEDTLS_OID_CMP(MBEDTLS_OID_PKCS7_DATA, &content_type)) {
|
||||
return MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO;
|
||||
}
|
||||
|
||||
if (p != end_content_info) {
|
||||
/* 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;
|
||||
}
|
||||
|
||||
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 */
|
||||
mbedtls_x509_crt_init(&signed_data->certs);
|
||||
ret = pkcs7_get_certificates(&p, end, &signed_data->certs);
|
||||
|
|
Loading…
Reference in a new issue