Skip to content

Commit

Permalink
Bind functions for dealing with sigalgs
Browse files Browse the repository at this point in the history
Fixes pyca#7336
  • Loading branch information
Jean-Daniel committed Jun 19, 2022
1 parent d4f1082 commit 4730856
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/_cffi_src/openssl/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
static const long Cryptography_HAS_SECURE_RENEGOTIATION;
static const long Cryptography_HAS_SSL_CTX_CLEAR_OPTIONS;
static const long Cryptography_HAS_DTLS;
static const long Cryptography_HAS_SIGALGS;
static const long Cryptography_HAS_PSK;
static const long Cryptography_HAS_PSK_TLSv1_3;
static const long Cryptography_HAS_VERIFIED_CHAIN;
Expand Down Expand Up @@ -191,6 +192,9 @@
X509_VERIFY_PARAM *SSL_get0_param(SSL *);
X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *);
int SSL_get_sigalgs(SSL *, int, int *, int *, int *, unsigned char *,
unsigned char *);
Cryptography_STACK_OF_X509 *SSL_get_peer_cert_chain(const SSL *);
Cryptography_STACK_OF_X509 *SSL_get0_verified_chain(const SSL *);
Cryptography_STACK_OF_X509_NAME *SSL_get_client_CA_list(const SSL *);
Expand Down Expand Up @@ -299,6 +303,8 @@
void (*)(const SSL *, const char *));
void (*SSL_CTX_get_keylog_callback(SSL_CTX *))(const SSL *, const char *);
long SSL_CTX_set1_sigalgs_list(SSL_CTX *, const char *);
/* SSL_SESSION */
void SSL_SESSION_free(SSL_SESSION *);
Expand Down Expand Up @@ -677,6 +683,15 @@
return r;
}
#if CRYPTOGRAPHY_IS_LIBRESSL
static const long Cryptography_HAS_SIGALGS = 0;
const int (*SSL_get_sigalgs)(SSL *, int, int *, int *, int *, unsigned char *,
unsigned char *) = NULL;
const long (*SSL_CTX_set1_sigalgs_list)(SSL_CTX *, const char *) = NULL;
#else
static const long Cryptography_HAS_SIGALGS = 1;
#endif
#if CRYPTOGRAPHY_IS_LIBRESSL || defined(OPENSSL_NO_PSK)
static const long Cryptography_HAS_PSK = 0;
int (*SSL_CTX_use_psk_identity_hint)(SSL_CTX *, const char *) = NULL;
Expand Down
8 changes: 8 additions & 0 deletions src/cryptography/hazmat/bindings/openssl/_conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ def cryptography_has_fips() -> typing.List[str]:
]


def cryptography_has_ssl_sigalgs():
return [
"SSL_CTX_set1_sigalgs_list",
"SSL_get_sigalgs",
]


def cryptography_has_psk() -> typing.List[str]:
return [
"SSL_CTX_use_psk_identity_hint",
Expand Down Expand Up @@ -345,6 +352,7 @@ def cryptography_has_ssl_op_ignore_unexpected_eof() -> typing.List[str]:
cryptography_has_evp_pkey_get_set_tls_encodedpoint
),
"Cryptography_HAS_FIPS": cryptography_has_fips,
"Cryptography_HAS_SIGALGS": cryptography_has_ssl_sigalgs,
"Cryptography_HAS_PSK": cryptography_has_psk,
"Cryptography_HAS_PSK_TLSv1_3": cryptography_has_psk_tlsv13,
"Cryptography_HAS_CUSTOM_EXT": cryptography_has_custom_ext,
Expand Down

0 comments on commit 4730856

Please sign in to comment.