Skip to content

Commit

Permalink
remove unneeded bindings (#6324)
Browse files Browse the repository at this point in the history
  • Loading branch information
reaperhulk committed Sep 28, 2021
1 parent baa6ff1 commit 57e5176
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 63 deletions.
21 changes: 0 additions & 21 deletions src/_cffi_src/openssl/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
41 changes: 0 additions & 41 deletions src/_cffi_src/openssl/x509.py
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 *);
Expand Down Expand Up @@ -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
"""
1 change: 0 additions & 1 deletion src/_cffi_src/openssl/x509name.py
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 57e5176

Please sign in to comment.