diff options
author | guenther <> | 2020-10-11 12:45:52 +0000 |
---|---|---|
committer | guenther <> | 2020-10-11 12:45:52 +0000 |
commit | af6a663711d3d3993dad528fa53865494ffaca28 (patch) | |
tree | 667c30e60e822bb9cb6f7a9d26580beea65d65a0 /src/lib/libssl/ssl_locl.h | |
parent | d30a2211e331d165f1922febac556a295ba95562 (diff) | |
download | openbsd-af6a663711d3d3993dad528fa53865494ffaca28.tar.gz openbsd-af6a663711d3d3993dad528fa53865494ffaca28.tar.bz2 openbsd-af6a663711d3d3993dad528fa53865494ffaca28.zip |
SSL3_ENC_METHOD is just a flag word; merge it into SSL_METHOD_INTERNAL
with #defines for the per-version initializers instead of extern
globals. Add SSL_USE_SHA256_PRF() to complete the abstraction.
ok tb@ jsing@
Diffstat (limited to 'src/lib/libssl/ssl_locl.h')
-rw-r--r-- | src/lib/libssl/ssl_locl.h | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index 5d41417df8..f2e1cb97f8 100644 --- a/src/lib/libssl/ssl_locl.h +++ b/src/lib/libssl/ssl_locl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_locl.h,v 1.303 2020/10/11 02:44:27 tb Exp $ */ | 1 | /* $OpenBSD: ssl_locl.h,v 1.304 2020/10/11 12:45:52 guenther Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -319,15 +319,19 @@ __BEGIN_HIDDEN_DECLS | |||
319 | 319 | ||
320 | /* See if we use signature algorithms extension. */ | 320 | /* See if we use signature algorithms extension. */ |
321 | #define SSL_USE_SIGALGS(s) \ | 321 | #define SSL_USE_SIGALGS(s) \ |
322 | (s->method->internal->ssl3_enc->enc_flags & SSL_ENC_FLAG_SIGALGS) | 322 | (s->method->internal->enc_flags & SSL_ENC_FLAG_SIGALGS) |
323 | |||
324 | /* See if we use SHA256 default PRF. */ | ||
325 | #define SSL_USE_SHA256_PRF(s) \ | ||
326 | (s->method->internal->enc_flags & SSL_ENC_FLAG_SHA256_PRF) | ||
323 | 327 | ||
324 | /* Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2. */ | 328 | /* Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2. */ |
325 | #define SSL_USE_TLS1_2_CIPHERS(s) \ | 329 | #define SSL_USE_TLS1_2_CIPHERS(s) \ |
326 | (s->method->internal->ssl3_enc->enc_flags & SSL_ENC_FLAG_TLS1_2_CIPHERS) | 330 | (s->method->internal->enc_flags & SSL_ENC_FLAG_TLS1_2_CIPHERS) |
327 | 331 | ||
328 | /* Allow TLS 1.3 ciphersuites only. */ | 332 | /* Allow TLS 1.3 ciphersuites only. */ |
329 | #define SSL_USE_TLS1_3_CIPHERS(s) \ | 333 | #define SSL_USE_TLS1_3_CIPHERS(s) \ |
330 | (s->method->internal->ssl3_enc->enc_flags & SSL_ENC_FLAG_TLS1_3_CIPHERS) | 334 | (s->method->internal->enc_flags & SSL_ENC_FLAG_TLS1_3_CIPHERS) |
331 | 335 | ||
332 | #define SSL_PKEY_RSA 0 | 336 | #define SSL_PKEY_RSA 0 |
333 | #define SSL_PKEY_ECC 1 | 337 | #define SSL_PKEY_ECC 1 |
@@ -379,7 +383,7 @@ typedef struct ssl_method_internal_st { | |||
379 | int peek); | 383 | int peek); |
380 | int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len); | 384 | int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len); |
381 | 385 | ||
382 | struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */ | 386 | unsigned int enc_flags; /* SSL_ENC_FLAG_* */ |
383 | } SSL_METHOD_INTERNAL; | 387 | } SSL_METHOD_INTERNAL; |
384 | 388 | ||
385 | typedef struct ssl_session_internal_st { | 389 | typedef struct ssl_session_internal_st { |
@@ -1063,10 +1067,6 @@ typedef struct sess_cert_st { | |||
1063 | /*#define SSL_DEBUG */ | 1067 | /*#define SSL_DEBUG */ |
1064 | /*#define RSA_DEBUG */ | 1068 | /*#define RSA_DEBUG */ |
1065 | 1069 | ||
1066 | typedef struct ssl3_enc_method { | ||
1067 | unsigned int enc_flags; | ||
1068 | } SSL3_ENC_METHOD; | ||
1069 | |||
1070 | /* | 1070 | /* |
1071 | * Flag values for enc_flags. | 1071 | * Flag values for enc_flags. |
1072 | */ | 1072 | */ |
@@ -1083,6 +1083,14 @@ typedef struct ssl3_enc_method { | |||
1083 | /* Allow TLS 1.3 ciphersuites only. */ | 1083 | /* Allow TLS 1.3 ciphersuites only. */ |
1084 | #define SSL_ENC_FLAG_TLS1_3_CIPHERS (1 << 5) | 1084 | #define SSL_ENC_FLAG_TLS1_3_CIPHERS (1 << 5) |
1085 | 1085 | ||
1086 | #define TLSV1_ENC_FLAGS 0 | ||
1087 | #define TLSV1_1_ENC_FLAGS 0 | ||
1088 | #define TLSV1_2_ENC_FLAGS (SSL_ENC_FLAG_SIGALGS | \ | ||
1089 | SSL_ENC_FLAG_SHA256_PRF | \ | ||
1090 | SSL_ENC_FLAG_TLS1_2_CIPHERS) | ||
1091 | #define TLSV1_3_ENC_FLAGS (SSL_ENC_FLAG_SIGALGS | \ | ||
1092 | SSL_ENC_FLAG_TLS1_3_CIPHERS) | ||
1093 | |||
1086 | /* | 1094 | /* |
1087 | * ssl_aead_ctx_st contains information about an AEAD that is being used to | 1095 | * ssl_aead_ctx_st contains information about an AEAD that is being used to |
1088 | * encrypt an SSL connection. | 1096 | * encrypt an SSL connection. |
@@ -1123,11 +1131,6 @@ int ssl_cipher_allowed_in_version_range(const SSL_CIPHER *cipher, | |||
1123 | const SSL_METHOD *tls_legacy_method(void); | 1131 | const SSL_METHOD *tls_legacy_method(void); |
1124 | const SSL_METHOD *ssl_get_method(uint16_t version); | 1132 | const SSL_METHOD *ssl_get_method(uint16_t version); |
1125 | 1133 | ||
1126 | extern SSL3_ENC_METHOD TLSv1_enc_data; | ||
1127 | extern SSL3_ENC_METHOD TLSv1_1_enc_data; | ||
1128 | extern SSL3_ENC_METHOD TLSv1_2_enc_data; | ||
1129 | extern SSL3_ENC_METHOD TLSv1_3_enc_data; | ||
1130 | |||
1131 | void ssl_clear_cipher_state(SSL *s); | 1134 | void ssl_clear_cipher_state(SSL *s); |
1132 | void ssl_clear_cipher_read_state(SSL *s); | 1135 | void ssl_clear_cipher_read_state(SSL *s); |
1133 | void ssl_clear_cipher_write_state(SSL *s); | 1136 | void ssl_clear_cipher_write_state(SSL *s); |