Skip to content

Commit

Permalink
tests: Replace deprecated ASN1 code
Browse files Browse the repository at this point in the history
This fixes several compiler warnings on MacOS with Homebrew. The
git development branch for forthcoming libtasn1 4.17.0 has introduced
deprecation warnings for several macros/types that we use.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
  • Loading branch information
stweil authored and berrange committed Jan 29, 2021
1 parent a07e9fd commit ecb98f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions tests/crypto-tls-x509-helpers.c
Expand Up @@ -30,7 +30,7 @@
* This stores some static data that is needed when
* encoding extensions in the x509 certs
*/
ASN1_TYPE pkix_asn1;
asn1_node pkix_asn1;

/*
* To avoid consuming random entropy to generate keys,
Expand Down Expand Up @@ -139,7 +139,7 @@ void test_tls_cleanup(const char *keyfile)
/*
* Turns an ASN1 object into a DER encoded byte array
*/
static void test_tls_der_encode(ASN1_TYPE src,
static void test_tls_der_encode(asn1_node src,
const char *src_name,
gnutls_datum_t *res)
{
Expand Down Expand Up @@ -317,7 +317,7 @@ test_tls_generate_cert(QCryptoTLSTestCertReq *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",
Expand All @@ -344,7 +344,7 @@ test_tls_generate_cert(QCryptoTLSTestCertReq *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;
Expand Down Expand Up @@ -374,7 +374,7 @@ test_tls_generate_cert(QCryptoTLSTestCertReq *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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/crypto-tls-x509-helpers.h
Expand Up @@ -125,7 +125,7 @@ void test_tls_cleanup(const char *keyfile);
}; \
test_tls_generate_cert(&varname, NULL)

extern const ASN1_ARRAY_TYPE pkix_asn1_tab[];
extern const asn1_static_node pkix_asn1_tab[];

#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */

Expand Down
2 changes: 1 addition & 1 deletion tests/pkix_asn1_tab.c
Expand Up @@ -8,7 +8,7 @@

#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT

const ASN1_ARRAY_TYPE pkix_asn1_tab[] = {
const asn1_static_node pkix_asn1_tab[] = {
{"PKIX1", 536875024, 0},
{0, 1073741836, 0},
{"id-ce", 1879048204, 0},
Expand Down

0 comments on commit ecb98f5

Please sign in to comment.