diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h
index 03ece13..42cd999 100644
--- a/src/openvpn/openssl_compat.h
+++ b/src/openvpn/openssl_compat.h
@@ -208,6 +208,18 @@
 }
 
 /**
+ * Get the serial number from a X509 certificate
+ *
+ * @param x                  X509 certificate
+ * @return                   The certificate serial number
+ */
+static inline const ASN1_INTEGER *
+X509_get0_serialNumber(const X509 *x)
+{
+    return (const ASN1_INTEGER *)X509_get_serialNumber((X509 *)x);
+}
+
+/**
  * Fetch the X509 object stack from the X509 store
  *
  * @param store              X509 object store
