]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
Bitrot: X509_STORE_CTX opaque in OpenSSL 1.1.0
authorViktor Dukhovni <postfix-users@dukhovni.org>
Sun, 24 Apr 2016 13:40:13 +0000 (09:40 -0400)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Sun, 14 Oct 2018 15:50:09 +0000 (11:50 -0400)
postfix/src/tls/tls.h
postfix/src/tls/tls_dane.c

index 2475349c79a6f618680706d69311fb0707f2d381..a6b890d0e82828f167413bfd0509ad3771c70f2a 100644 (file)
@@ -92,6 +92,10 @@ extern const NAME_CODE tls_level_table[];
        CRYPTO_add(&((x)->references), 1, CRYPTO_LOCK_X509)
 #define EVP_PKEY_up_ref(k) \
        CRYPTO_add(&((k)->references), 1, CRYPTO_LOCK_EVP_PKEY)
+#define X509_STORE_CTX_get0_cert(ctx) ((ctx)->cert)
+#define X509_STORE_CTX_get0_untrusted(ctx) ((ctx)->untrusted)
+#define X509_STORE_CTX_set0_untrusted X509_STORE_CTX_set_chain
+#define X509_STORE_CTX_set0_trusted_stack X509_STORE_CTX_trusted_stack
 #endif
 
 /* SSL_CIPHER_get_name() got constified in 0.9.7g */
index c8712248a29d6e79a451591fcc22a47ccae65301..9f8821c7dc9e226ba8dcbe6b5d24289d41803438 100644 (file)
@@ -1720,8 +1720,8 @@ static void set_trust(TLS_SESS_STATE *TLScontext, X509_STORE_CTX *ctx)
     int     depth = 0;
     EVP_PKEY *takey;
     X509   *ca;
-    X509   *cert = ctx->cert;          /* XXX: Accessor? */
-    x509_stack_t *in = ctx->untrusted; /* XXX: Accessor? */
+    X509   *cert = X509_STORE_CTX_get0_cert(ctx);
+    x509_stack_t *in = X509_STORE_CTX_get0_untrusted(ctx);
 
     /* shallow copy */
     if ((in = sk_X509_dup(in)) == 0)
@@ -1802,7 +1802,7 @@ static int dane_cb(X509_STORE_CTX *ctx, void *app_ctx)
 {
     const char *myname = "dane_cb";
     TLS_SESS_STATE *TLScontext = (TLS_SESS_STATE *) app_ctx;
-    X509   *cert = ctx->cert;          /* XXX: accessor? */
+    X509   *cert = X509_STORE_CTX_get0_cert(ctx);
 
     /*
      * Degenerate case: depth 0 self-signed cert.
@@ -1832,9 +1832,9 @@ static int dane_cb(X509_STORE_CTX *ctx, void *app_ctx)
      * Check that setting the untrusted chain updates the expected structure
      * member at the expected offset.
      */
-    X509_STORE_CTX_trusted_stack(ctx, TLScontext->trusted);
-    X509_STORE_CTX_set_chain(ctx, TLScontext->untrusted);
-    if (ctx->untrusted != TLScontext->untrusted)
+    X509_STORE_CTX_set0_trusted_stack(ctx, TLScontext->trusted);
+    X509_STORE_CTX_set0_untrusted(ctx, TLScontext->untrusted);
+    if (X509_STORE_CTX_get0_untrusted(ctx) != TLScontext->untrusted)
        msg_panic("%s: OpenSSL ABI change", myname);
 
     return X509_verify_cert(ctx);