summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2023-03-22 08:06:28 +0000
committerDaiki Ueno <ueno@gnu.org>2023-03-22 08:06:28 +0000
commit195be04e144b95d084eef3c4aa72b65c01fcb7c8 (patch)
treea70953a10adca068f706a2804c95784e5cfcbfab
parentb0c89ed7c2fd66143c51efea6ab9d13ce3090074 (diff)
parent85b0a5d424f2f01314f0df650591d7434ef0b0f7 (diff)
downloadgnutls-195be04e144b95d084eef3c4aa72b65c01fcb7c8.tar.gz
Merge branch 'master' into 'master'
add DER crl list import test See merge request gnutls/gnutls!1733
-rw-r--r--lib/x509/crl.c8
-rw-r--r--tests/crl_apis.c17
2 files changed, 21 insertions, 4 deletions
diff --git a/lib/x509/crl.c b/lib/x509/crl.c
index f6c6089af7..42367dba9c 100644
--- a/lib/x509/crl.c
+++ b/lib/x509/crl.c
@@ -1233,11 +1233,11 @@ gnutls_x509_crl_get_extension_data(gnutls_x509_crl_t crl, unsigned indx,
* gnutls_x509_crl_list_import2:
* @crls: Will contain the parsed crl list.
* @size: It will contain the size of the list.
- * @data: The PEM encoded CRL.
+ * @data: The CRL data.
* @format: One of DER or PEM.
* @flags: must be (0) or an OR'd sequence of gnutls_certificate_import_flags.
*
- * This function will convert the given PEM encoded CRL list
+ * This function will convert the given CRL list
* to the native gnutls_x509_crl_t format. The output will be stored
* in @crls. They will be automatically initialized.
*
@@ -1294,11 +1294,11 @@ gnutls_x509_crl_list_import2(gnutls_x509_crl_t ** crls,
* gnutls_x509_crl_list_import:
* @crls: Indicates where the parsed CRLs will be copied to. Must not be initialized.
* @crl_max: Initially must hold the maximum number of crls. It will be updated with the number of crls available.
- * @data: The PEM encoded CRLs
+ * @data: The CRL data
* @format: One of DER or PEM.
* @flags: must be (0) or an OR'd sequence of gnutls_certificate_import_flags.
*
- * This function will convert the given PEM encoded CRL list
+ * This function will convert the given CRL list
* to the native gnutls_x509_crl_t format. The output will be stored
* in @crls. They will be automatically initialized.
*
diff --git a/tests/crl_apis.c b/tests/crl_apis.c
index 1282e72a3f..2189dddfb2 100644
--- a/tests/crl_apis.c
+++ b/tests/crl_apis.c
@@ -287,6 +287,20 @@ static void get_dn_by_oid(gnutls_x509_crl_t crl,
gnutls_x509_crt_deinit(crt);
}
+static void import_der_crl_list(gnutls_x509_crl_t crl)
+{
+ gnutls_datum_t out;
+ assert(gnutls_x509_crl_export2(crl, GNUTLS_X509_FMT_DER, &out) >= 0);
+
+ gnutls_x509_crl_t crl_list;
+ unsigned int crl_list_max = 1;
+ assert(gnutls_x509_crl_list_import
+ (&crl_list, &crl_list_max, &out, GNUTLS_X509_FMT_DER, 0) > 0);
+
+ gnutls_free(out.data);
+ gnutls_x509_crl_deinit(crl_list);
+}
+
void doit(void)
{
gnutls_datum_t out;
@@ -322,6 +336,9 @@ void doit(void)
/* get dn by oid */
get_dn_by_oid(crl, &ca3_cert);
+ /* import DER crl */
+ import_der_crl_list(crl);
+
gnutls_free(out.data);
gnutls_x509_crl_deinit(crl);