Changeset 95604 in vbox for trunk/src/VBox/Runtime/common/crypto/iprt-openssl.cpp
- Timestamp:
- Jul 12, 2022 9:37:41 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/crypto/iprt-openssl.cpp
r93115 r95604 37 37 # include <iprt/asn1.h> 38 38 # include <iprt/crypto/digest.h> 39 # include <iprt/crypto/pkcs7.h> 39 40 40 41 # include "internal/iprt-openssl.h" … … 139 140 } 140 141 142 DECLHIDDEN(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 166 DECLHIDDEN(void) rtCrOpenSslFreeConvertedPkcs7Attribute(void *pvOsslAttrib) 167 { 168 X509_ATTRIBUTE_free((X509_ATTRIBUTE *)pvOsslAttrib); 169 } 170 171 141 172 #endif /* IPRT_WITH_OPENSSL */ 142 173
Note:
See TracChangeset
for help on using the changeset viewer.