From f65285a0df84f497140be80bcf9a06fc155f463c Mon Sep 17 00:00:00 2001 From: MiWCryptAnalytics Date: Wed, 12 Aug 2015 20:51:53 +0930 Subject: added attribs to SSL_SESSION, SSL_SESSION_print. CIPHER_description For a project I am working on I need some session reflection directly from python. This change adds the required openssl SSL_SESSION struct attributes and functions within OpenSSL API --- src/_cffi_src/openssl/ssl.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/_cffi_src/openssl/ssl.py b/src/_cffi_src/openssl/ssl.py index f15b9b32..ead6b9a5 100644 --- a/src/_cffi_src/openssl/ssl.py +++ b/src/_cffi_src/openssl/ssl.py @@ -130,8 +130,17 @@ typedef ... SSL_METHOD; typedef ... SSL_CTX; typedef struct { + unsigned int key_arg_length; + unsigned char key_arg[...]; int master_key_length; unsigned char master_key[...]; + unsigned int session_id_length; + unsigned char session_id[...]; + unsigned int sid_ctx_length; + unsigned char sid_ctx[...]; + unsigned char *tlsext_tick; + size_t tlsext_ticklen; + long tlsext_tick_lifetime_hint; ...; } SSL_SESSION; @@ -236,11 +245,13 @@ void SSL_CTX_set_client_CA_list(SSL_CTX *, Cryptography_STACK_OF_X509_NAME *); /* SSL_SESSION */ void SSL_SESSION_free(SSL_SESSION *); +int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); /* Information about actually used cipher */ const char *SSL_CIPHER_get_name(const SSL_CIPHER *); int SSL_CIPHER_get_bits(const SSL_CIPHER *, int *); char *SSL_CIPHER_get_version(const SSL_CIPHER *); +char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); size_t SSL_get_finished(const SSL *, void *, size_t); size_t SSL_get_peer_finished(const SSL *, void *, size_t); -- cgit v1.2.3 From 8a14d9bb9009c9b662fa185f3d24cfc9dff376d3 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Tue, 18 Aug 2015 20:12:00 -0500 Subject: style fix + remove some elements of the struct that aren't in 0.9.8 --- src/_cffi_src/openssl/ssl.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/_cffi_src/openssl/ssl.py b/src/_cffi_src/openssl/ssl.py index ead6b9a5..60b1a920 100644 --- a/src/_cffi_src/openssl/ssl.py +++ b/src/_cffi_src/openssl/ssl.py @@ -138,9 +138,6 @@ typedef struct { unsigned char session_id[...]; unsigned int sid_ctx_length; unsigned char sid_ctx[...]; - unsigned char *tlsext_tick; - size_t tlsext_ticklen; - long tlsext_tick_lifetime_hint; ...; } SSL_SESSION; @@ -245,13 +242,13 @@ void SSL_CTX_set_client_CA_list(SSL_CTX *, Cryptography_STACK_OF_X509_NAME *); /* SSL_SESSION */ void SSL_SESSION_free(SSL_SESSION *); -int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); +int SSL_SESSION_print(BIO *, const SSL_SESSION *); /* Information about actually used cipher */ const char *SSL_CIPHER_get_name(const SSL_CIPHER *); int SSL_CIPHER_get_bits(const SSL_CIPHER *, int *); char *SSL_CIPHER_get_version(const SSL_CIPHER *); -char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); +char *SSL_CIPHER_description(const SSL_CIPHER *, char *, int); size_t SSL_get_finished(const SSL *, void *, size_t); size_t SSL_get_peer_finished(const SSL *, void *, size_t); -- cgit v1.2.3 From 24be78a8d5e64f4ee94b28d742b53022b3d41186 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 19 Aug 2015 13:40:35 -0500 Subject: compilation fix --- src/_cffi_src/openssl/ssl.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/_cffi_src/openssl/ssl.py b/src/_cffi_src/openssl/ssl.py index 60b1a920..77885030 100644 --- a/src/_cffi_src/openssl/ssl.py +++ b/src/_cffi_src/openssl/ssl.py @@ -242,19 +242,21 @@ void SSL_CTX_set_client_CA_list(SSL_CTX *, Cryptography_STACK_OF_X509_NAME *); /* SSL_SESSION */ void SSL_SESSION_free(SSL_SESSION *); -int SSL_SESSION_print(BIO *, const SSL_SESSION *); /* Information about actually used cipher */ const char *SSL_CIPHER_get_name(const SSL_CIPHER *); int SSL_CIPHER_get_bits(const SSL_CIPHER *, int *); char *SSL_CIPHER_get_version(const SSL_CIPHER *); -char *SSL_CIPHER_description(const SSL_CIPHER *, char *, int); size_t SSL_get_finished(const SSL *, void *, size_t); size_t SSL_get_peer_finished(const SSL *, void *, size_t); """ MACROS = """ +/* not a macro, but older OpenSSLs don't pass the args as const */ +char *SSL_CIPHER_description(const SSL_CIPHER *, char *, int); +int SSL_SESSION_print(BIO *, const SSL_SESSION *); + /* not macros, but will be conditionally bound so can't live in functions */ const COMP_METHOD *SSL_get_current_compression(SSL *); const COMP_METHOD *SSL_get_current_expansion(SSL *); -- cgit v1.2.3 From 421ba64f450d10789df087644fa300f1824e3b6c Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 19 Aug 2015 13:49:53 -0500 Subject: libre doesn't have these fields (and might only be used in sslv2 anyway) --- src/_cffi_src/openssl/ssl.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/_cffi_src/openssl/ssl.py b/src/_cffi_src/openssl/ssl.py index 77885030..7a7968a1 100644 --- a/src/_cffi_src/openssl/ssl.py +++ b/src/_cffi_src/openssl/ssl.py @@ -130,8 +130,6 @@ typedef ... SSL_METHOD; typedef ... SSL_CTX; typedef struct { - unsigned int key_arg_length; - unsigned char key_arg[...]; int master_key_length; unsigned char master_key[...]; unsigned int session_id_length; -- cgit v1.2.3