]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Replace deprecated ASN1 code
authorLuke Yue <lukedyue@gmail.com>
Tue, 18 May 2021 01:19:26 +0000 (09:19 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 18 May 2021 08:02:24 +0000 (10:02 +0200)
This fixes compiler warnings when building with libtasn1 4.17.0.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/pkix_asn1_tab.c
tests/virnettlshelpers.c

index 5d5ca3db5d873616b3ce74e2912008606dac070f..a28d5f20c3f98f6eec7fe7653ba9900a1ed0f39e 100644 (file)
@@ -5,7 +5,7 @@
 #include <config.h>
 #include <libtasn1.h>
 
-const ASN1_ARRAY_TYPE pkix_asn1_tab[] = {
+const asn1_static_node pkix_asn1_tab[] = {
   { "PKIX1", 536875024, NULL },
   { NULL, 1073741836, NULL },
   { "id-pkix", 1879048204, NULL },
index ce38571b0adb746714303e49d19d3028e347e463..905e633e6088e56826e0acbb2f5f5154355ea8b2 100644 (file)
@@ -37,8 +37,8 @@ VIR_LOG_INIT("tests.nettlshelpers");
  * These store some static data that is needed when
  * encoding extensions in the x509 certs
  */
-ASN1_TYPE pkix_asn1;
-extern const ASN1_ARRAY_TYPE pkix_asn1_tab[];
+asn1_node pkix_asn1;
+extern const asn1_static_node pkix_asn1_tab[];
 
 /*
  * To avoid consuming random entropy to generate keys,
@@ -107,7 +107,7 @@ void testTLSCleanup(const char *keyfile)
 /*
  * Turns an ASN1 object into a DER encoded byte array
  */
-static void testTLSDerEncode(ASN1_TYPE src,
+static void testTLSDerEncode(asn1_node src,
                              const char *src_name,
                              gnutls_datum_t * res)
 {
@@ -267,7 +267,7 @@ testTLSGenerateCert(struct testTLSCertReq *req,
      * the 'critical' field which we want control over
      */
     if (req->basicConstraintsEnable) {
-        ASN1_TYPE ext = ASN1_TYPE_EMPTY;
+        asn1_node ext = NULL;
 
         asn1_create_element(pkix_asn1, "PKIX1.BasicConstraints", &ext);
         asn1_write_value(ext, "cA", req->basicConstraintsIsCA ? "TRUE" : "FALSE", 1);
@@ -292,7 +292,7 @@ testTLSGenerateCert(struct testTLSCertReq *req,
      * to be 'critical'
      */
     if (req->keyUsageEnable) {
-        ASN1_TYPE ext = ASN1_TYPE_EMPTY;
+        asn1_node ext = NULL;
         char str[2];
 
         str[0] = req->keyUsageValue & 0xff;
@@ -321,7 +321,7 @@ testTLSGenerateCert(struct testTLSCertReq *req,
      * set this the hard way building up ASN1 data ourselves
      */
     if (req->keyPurposeEnable) {
-        ASN1_TYPE ext = ASN1_TYPE_EMPTY;
+        asn1_node ext = NULL;
 
         asn1_create_element(pkix_asn1, "PKIX1.ExtKeyUsageSyntax", &ext);
         if (req->keyPurposeOID1) {