From 57e5176f4d736d84bcc0c32ae303fe7db9f82078 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Tue, 28 Sep 2021 21:44:38 +0800 Subject: [PATCH] remove unneeded bindings (#6324) --- src/_cffi_src/openssl/objects.py | 21 ---------------- src/_cffi_src/openssl/x509.py | 41 ------------------------------- src/_cffi_src/openssl/x509name.py | 1 - 3 files changed, 63 deletions(-) diff --git a/src/_cffi_src/openssl/objects.py b/src/_cffi_src/openssl/objects.py index 10ceb2b1493b..9911599ffa22 100644 --- a/src/_cffi_src/openssl/objects.py +++ b/src/_cffi_src/openssl/objects.py @@ -25,28 +25,7 @@ int OBJ_sn2nid(const char *); int OBJ_txt2nid(const char *); ASN1_OBJECT *OBJ_txt2obj(const char *, int); -int OBJ_obj2txt(char *, int, const ASN1_OBJECT *, int); - -const unsigned char *Cryptography_OBJ_get0_data(const ASN1_OBJECT *); -size_t Cryptography_OBJ_length(const ASN1_OBJECT *); """ CUSTOMIZATIONS = """ -#if CRYPTOGRAPHY_IS_LIBRESSL -const unsigned char *Cryptography_OBJ_get0_data(const ASN1_OBJECT *a) { - return a->data; -} - -size_t Cryptography_OBJ_length(const ASN1_OBJECT *a) { - return a->length; -} -#else -const unsigned char *Cryptography_OBJ_get0_data(const ASN1_OBJECT *a) { - return OBJ_get0_data(a); -} - -size_t Cryptography_OBJ_length(const ASN1_OBJECT *a) { - return OBJ_length(a); -} -#endif """ diff --git a/src/_cffi_src/openssl/x509.py b/src/_cffi_src/openssl/x509.py index 778b5da31611..b90bbec7fb8b 100644 --- a/src/_cffi_src/openssl/x509.py +++ b/src/_cffi_src/openssl/x509.py @@ -87,11 +87,6 @@ int X509_REQ_print_ex(BIO *, X509_REQ *, unsigned long, unsigned long); int X509_REQ_add_extensions(X509_REQ *, X509_EXTENSIONS *); X509_EXTENSIONS *X509_REQ_get_extensions(X509_REQ *); -X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *, int); -int X509_REQ_get_attr_by_OBJ(const X509_REQ *, const ASN1_OBJECT *, int); -void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *, int, int, void *); -ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *, int); -int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *); int X509_REQ_add1_attr_by_OBJ(X509_REQ *, const ASN1_OBJECT *, int, const unsigned char *, int); @@ -188,15 +183,10 @@ X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *); X509_REVOKED *Cryptography_X509_REVOKED_dup(X509_REVOKED *); -/* new in 1.0.2 */ -int i2d_re_X509_tbs(X509 *, unsigned char **); int X509_get_signature_nid(const X509 *); const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *); -void X509_get0_signature(const ASN1_BIT_STRING **, - const X509_ALGOR **, const X509 *); - long X509_get_version(X509 *); ASN1_TIME *X509_get_notBefore(X509 *); @@ -267,42 +257,11 @@ /* these functions were added in 1.1.0 */ const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *); const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *); -void X509_CRL_get0_signature(const X509_CRL *, const ASN1_BIT_STRING **, - const X509_ALGOR **); -int i2d_re_X509_REQ_tbs(X509_REQ *, unsigned char **); -int i2d_re_X509_CRL_tbs(X509_CRL *, unsigned char **); -void X509_REQ_get0_signature(const X509_REQ *, const ASN1_BIT_STRING **, - const X509_ALGOR **); """ CUSTOMIZATIONS = """ -#if CRYPTOGRAPHY_IS_LIBRESSL -int i2d_re_X509_tbs(X509 *x, unsigned char **pp) -{ - /* in 1.0.2+ this function also sets x->cert_info->enc.modified = 1 - but older OpenSSLs don't have the enc ASN1_ENCODING member in the - X509 struct. Setting modified to 1 marks the encoding - (x->cert_info->enc.enc) as invalid, but since the entire struct isn't - present we don't care. */ - return i2d_X509_CINF(x->cert_info, pp); -} -#endif - /* Being kept around for pyOpenSSL */ X509_REVOKED *Cryptography_X509_REVOKED_dup(X509_REVOKED *rev) { return X509_REVOKED_dup(rev); } -/* Added in 1.1.0 but we need it in all versions now due to the great - opaquing. */ -#if CRYPTOGRAPHY_IS_LIBRESSL -int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp) -{ - req->req_info->enc.modified = 1; - return i2d_X509_REQ_INFO(req->req_info, pp); -} -int i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp) { - crl->crl->enc.modified = 1; - return i2d_X509_CRL_INFO(crl->crl, pp); -} -#endif """ diff --git a/src/_cffi_src/openssl/x509name.py b/src/_cffi_src/openssl/x509name.py index 52ecdc6309f1..37b0d9e74d42 100644 --- a/src/_cffi_src/openssl/x509name.py +++ b/src/_cffi_src/openssl/x509name.py @@ -32,7 +32,6 @@ int X509_NAME_get_index_by_NID(X509_NAME *, int, int); int X509_NAME_cmp(const X509_NAME *, const X509_NAME *); X509_NAME *X509_NAME_dup(X509_NAME *); -int X509_NAME_ENTRY_set(X509_NAME_ENTRY *); /* These became const X509_NAME * in 1.1.0 */ int X509_NAME_entry_count(X509_NAME *); X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *, int);