diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2016-03-13 18:54:28 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2016-03-13 18:54:28 -0400 |
commit | 13b08fc678b7e1f099a35143032db8fd50fe4734 (patch) | |
tree | 1548de21d39ebe7d019c8c24959569d3cac80959 /src/_cffi_src/openssl/ssl.py | |
parent | 2eb9378998969f11fccb3dfd507cf6242ae25116 (diff) | |
parent | 77c7230e15c8af33ccc7558a123833bb9c71896d (diff) | |
download | cryptography-13b08fc678b7e1f099a35143032db8fd50fe4734.tar.gz cryptography-13b08fc678b7e1f099a35143032db8fd50fe4734.tar.bz2 cryptography-13b08fc678b7e1f099a35143032db8fd50fe4734.zip |
Merge pull request #2819 from reaperhulk/110-patch-30
bind SSL_SESSION_set1_id_context
Diffstat (limited to 'src/_cffi_src/openssl/ssl.py')
-rw-r--r-- | src/_cffi_src/openssl/ssl.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/_cffi_src/openssl/ssl.py b/src/_cffi_src/openssl/ssl.py index a713a245..a19db7a2 100644 --- a/src/_cffi_src/openssl/ssl.py +++ b/src/_cffi_src/openssl/ssl.py @@ -426,9 +426,33 @@ void SSL_set_cert_cb(SSL *, int (*)(SSL *, void *), void *); /* Added in 1.0.2 */ const SSL_METHOD *SSL_CTX_get_ssl_method(SSL_CTX *); +/* Added in 1.0.1 */ +int SSL_SESSION_set1_id_context(SSL_SESSION *, const unsigned char *, + unsigned int); """ CUSTOMIZATIONS = """ +/* Added in 1.0.1 but we need it in all versions now due to the great + opaquing. */ +#if OPENSSL_VERSION_NUMBER < 0x1000100fL +/* from ssl.h */ +#define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 +#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 +/* from ssl/ssl_sess.c */ +int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx, + unsigned int sid_ctx_len) +{ + if (sid_ctx_len > SSL_MAX_SID_CTX_LENGTH) { + SSLerr(SSL_F_SSL_SESSION_SET1_ID_CONTEXT, + SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG); + return 0; + } + s->sid_ctx_length = sid_ctx_len; + memcpy(s->sid_ctx, sid_ctx, sid_ctx_len); + + return 1; +} +#endif /* Added in 1.0.2 but we need it in all versions now due to the great opaquing. */ #if OPENSSL_VERSION_NUMBER < 0x10002001L || defined(LIBRESSL_VERSION_NUMBER) |