VirtualBox

Ignore:
Timestamp:
Jul 12, 2022 9:37:41 AM (3 years ago)
Author:
vboxsync
Message:

IPRT/RTCrPkcs7SimpleSignSignedData: Implemented pAdditionalAuthenticatedAttribs. bugref:8691

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/crypto/iprt-openssl.cpp

    r93115 r95604  
    3737# include <iprt/asn1.h>
    3838# include <iprt/crypto/digest.h>
     39# include <iprt/crypto/pkcs7.h>
    3940
    4041# include "internal/iprt-openssl.h"
     
    139140}
    140141
     142DECLHIDDEN(int) rtCrOpenSslConvertPkcs7Attribute(void **ppvOsslAttrib, PCRTCRPKCS7ATTRIBUTE pAttrib, PRTERRINFO pErrInfo)
     143{
     144    const unsigned char *pabEncoded;
     145    uint32_t             cbEncoded;
     146    void                *pvFree;
     147    int rc = RTAsn1EncodeQueryRawBits(RTCrPkcs7Attribute_GetAsn1Core(pAttrib),
     148                                      (const uint8_t **)&pabEncoded, &cbEncoded, &pvFree, pErrInfo);
     149    if (RT_SUCCESS(rc))
     150    {
     151        X509_ATTRIBUTE *pOsslAttrib = NULL;
     152        X509_ATTRIBUTE *pOsslAttribRet = d2i_X509_ATTRIBUTE(&pOsslAttrib, &pabEncoded, cbEncoded);
     153        RTMemTmpFree(pvFree);
     154        if (pOsslAttribRet == pOsslAttrib)
     155        {
     156            *ppvOsslAttrib = pOsslAttrib;
     157            return VINF_SUCCESS;
     158        }
     159        rc = RTErrInfoSet(pErrInfo, VERR_CR_X509_OSSL_D2I_FAILED, "d2i_X509_ATTRIBUTE");
     160    }
     161    *ppvOsslAttrib = NULL;
     162    return rc;
     163}
     164
     165
     166DECLHIDDEN(void) rtCrOpenSslFreeConvertedPkcs7Attribute(void *pvOsslAttrib)
     167{
     168    X509_ATTRIBUTE_free((X509_ATTRIBUTE *)pvOsslAttrib);
     169}
     170
     171
    141172#endif /* IPRT_WITH_OPENSSL */
    142173
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