diff options
author | David Benjamin <davidben@chromium.org> | 2014-12-11 09:46:01 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-12-14 01:38:27 +0300 |
commit | e99e912bea854910c56301985afc3e72dcfe0404 (patch) | |
tree | f937c6fc72697ce4995515d76160b9c744ce11ab /ssl/ssl_lib.c | |
parent | ceb6f2880feb600ff76604db6deae15dc2e93899 (diff) |
Pull SSL3_ENC_METHOD out of SSL_METHOD.
SSL3_ENC_METHOD will remain version-specific while SSL_METHOD will become
protocol-specific. This finally removes all the version-specific portions of
SSL_METHOD but the version tag itself.
(SSL3_ENC_METHOD's version-specific bits themselves can probably be handled by
tracking a canonicalized protocol version. It would simplify version
comparisons anyway. The one catch is SSLv3 has a very different table. But
that's a cleanup for future. Then again, perhaps a version-specific method
table swap somewhere will be useful later for TLS 1.3.)
Much of this commit was generated with sed invocation:
s/method->ssl3_enc/enc_method/g
Change-Id: I2b192507876aadd4f9310240687e562e56e6c0b1
Reviewed-on: https://boringssl-review.googlesource.com/2581
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'ssl/ssl_lib.c')
-rw-r--r-- | ssl/ssl_lib.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 0456cf6a..241bcc3c 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -338,6 +338,8 @@ SSL *SSL_new(SSL_CTX *ctx) if (!s->method->ssl_new(s)) goto err; + s->enc_method = ssl3_get_enc_method(s->version); + assert(s->enc_method != NULL); s->references=1; @@ -1792,7 +1794,7 @@ int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, if (s->version < TLS1_VERSION) return -1; - return s->method->ssl3_enc->export_keying_material(s, out, olen, label, + return s->enc_method->export_keying_material(s, out, olen, label, llen, p, plen, use_context); } @@ -3069,6 +3071,27 @@ const SSL_METHOD *ssl3_get_method(uint16_t version) } } +const SSL3_ENC_METHOD *ssl3_get_enc_method(uint16_t version) + { + switch (version) + { + case SSL3_VERSION: + return &SSLv3_enc_data; + case TLS1_VERSION: + return &TLSv1_enc_data; + case TLS1_1_VERSION: + return &TLSv1_1_enc_data; + case TLS1_2_VERSION: + return &TLSv1_2_enc_data; + case DTLS1_VERSION: + return &DTLSv1_enc_data; + case DTLS1_2_VERSION: + return &DTLSv1_2_enc_data; + default: + return NULL; + } + } + uint16_t ssl3_get_max_server_version(const SSL *s) { if (SSL_IS_DTLS(s)) |