VirtualBox

Ignore:
Timestamp:
Aug 12, 2020 4:09:12 PM (4 years ago)
Author:
vboxsync
Message:

Devices/EFI: Merge edk-stable202005 and make it build, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyBase.c

    r80721 r85718  
    1313#include <openssl/x509v3.h>
    1414#include <openssl/pkcs7.h>
     15
     16/**
     17  Check the contents of PKCS7 is not data.
     18
     19  It is copied from PKCS7_type_is_other() in pk7_doit.c.
     20
     21  @param[in] P7 Pointer to the location at which the PKCS7 is located.
     22
     23  @retval TRUE  If the type is others.
     24  @retval FALSE If the type is expected.
     25**/
     26STATIC
     27BOOLEAN
     28Pkcs7TypeIsOther (
     29  IN PKCS7 *P7
     30  )
     31{
     32  BOOLEAN Others;
     33  INTN    Nid = OBJ_obj2nid (P7->type);
     34
     35  switch (Nid) {
     36    case NID_pkcs7_data:
     37    case NID_pkcs7_signed:
     38    case NID_pkcs7_enveloped:
     39    case NID_pkcs7_signedAndEnveloped:
     40    case NID_pkcs7_encrypted:
     41      Others = FALSE;
     42      break;
     43    default:
     44      Others = TRUE;
     45  }
     46
     47  return Others;
     48}
     49
     50/**
     51  Get the ASN.1 string for the PKCS7.
     52
     53  It is copied from PKCS7_get_octet_string() in pk7_doit.c.
     54
     55  @param[in] P7 Pointer to the location at which the PKCS7 is located.
     56
     57  @return ASN1_OCTET_STRING ASN.1 string.
     58**/
     59STATIC
     60ASN1_OCTET_STRING*
     61Pkcs7GetOctetString (
     62  IN PKCS7 *P7
     63  )
     64{
     65  if (PKCS7_type_is_data (P7)) {
     66    return P7->d.data;
     67  }
     68
     69  if (Pkcs7TypeIsOther(P7) && (P7->d.other != NULL) &&
     70      (P7->d.other->type == V_ASN1_OCTET_STRING)) {
     71    return P7->d.other->value.octet_string;
     72  }
     73
     74  return NULL;
     75}
    1576
    1677/**
     
    99160    // Retrieve the attached content in PKCS7 signedData
    100161    //
    101     OctStr = Pkcs7->d.sign->contents->d.data;
     162    OctStr = Pkcs7GetOctetString (Pkcs7->d.sign->contents);
     163    if (OctStr == NULL) {
     164      goto _Exit;
     165    }
     166
    102167    if ((OctStr->length > 0) && (OctStr->data != NULL)) {
    103168      *ContentSize = OctStr->length;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette