* @cert: should contain a #gnutls_x509_crt_t structure
* @indx: Specifies which extension OID to send. Use (0) to get the first one.
* @data: a pointer to a structure to hold the data (may be null)
- * @sizeof_data: initially holds the size of @oid
+ * @sizeof_data: initially holds the size of @data
*
* This function will return the requested extension data in the
* certificate. The extension data will be stored in the
result = asn1_read_value(cert->cert, name, data, &len);
*sizeof_data = len;
- if (result == ASN1_ELEMENT_NOT_FOUND)
+ if (result == ASN1_ELEMENT_NOT_FOUND) {
return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE;
- else if (result != ASN1_SUCCESS) {
+ } else if (result == ASN1_MEM_ERROR && data == NULL) {
+ /* normally we should return GNUTLS_E_SHORT_MEMORY_BUFFER,
+ * but we haven't done that for long time, so use
+ * backwards compatible behavior */
+ return 0;
+ } else if (result != ASN1_SUCCESS) {
gnutls_assert();
return _gnutls_asn2err(result);
}