summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_locl.h
diff options
context:
space:
mode:
authorjsing <>2017-03-05 14:39:53 +0000
committerjsing <>2017-03-05 14:39:53 +0000
commite04ca894aa08b4b01dbc7ead7524d8026ce8f3be (patch)
tree4868a41992758cf1a7f9ffdaf1b940ee7bcceb4c /src/lib/libssl/ssl_locl.h
parentb7e97f3829f43765f12691c1665b5e6017d75d28 (diff)
downloadopenbsd-e04ca894aa08b4b01dbc7ead7524d8026ce8f3be.tar.gz
openbsd-e04ca894aa08b4b01dbc7ead7524d8026ce8f3be.tar.bz2
openbsd-e04ca894aa08b4b01dbc7ead7524d8026ce8f3be.zip
Provide a rolling handshake hash that commences as soon as the cipher
suite has been selected, and convert the final finish MAC to use this handshake hash. This is a first step towards cleaning up the current handshake buffer/digest code. ok beck@ inoguchi@
Diffstat (limited to 'src/lib/libssl/ssl_locl.h')
-rw-r--r--src/lib/libssl/ssl_locl.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index deabb58894..3f5d6fad20 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.176 2017/03/04 16:32:00 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.177 2017/03/05 14:39:53 jsing 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 *
@@ -259,12 +259,13 @@ __BEGIN_HIDDEN_DECLS
259 259
260/* Bits for algorithm2 (handshake digests and other extra flags) */ 260/* Bits for algorithm2 (handshake digests and other extra flags) */
261 261
262#define SSL_HANDSHAKE_MAC_MD5 0x10 262#define SSL_HANDSHAKE_MAC_MASK 0xff0
263#define SSL_HANDSHAKE_MAC_SHA 0x20 263#define SSL_HANDSHAKE_MAC_MD5 0x010
264#define SSL_HANDSHAKE_MAC_GOST94 0x40 264#define SSL_HANDSHAKE_MAC_SHA 0x020
265#define SSL_HANDSHAKE_MAC_SHA256 0x80 265#define SSL_HANDSHAKE_MAC_GOST94 0x040
266#define SSL_HANDSHAKE_MAC_SHA384 0x100 266#define SSL_HANDSHAKE_MAC_SHA256 0x080
267#define SSL_HANDSHAKE_MAC_STREEBOG256 0x200 267#define SSL_HANDSHAKE_MAC_SHA384 0x100
268#define SSL_HANDSHAKE_MAC_STREEBOG256 0x200
268#define SSL_HANDSHAKE_MAC_DEFAULT (SSL_HANDSHAKE_MAC_MD5 | SSL_HANDSHAKE_MAC_SHA) 269#define SSL_HANDSHAKE_MAC_DEFAULT (SSL_HANDSHAKE_MAC_MD5 | SSL_HANDSHAKE_MAC_SHA)
269 270
270/* When adding new digest in the ssl_ciph.c and increment SSM_MD_NUM_IDX 271/* When adding new digest in the ssl_ciph.c and increment SSM_MD_NUM_IDX
@@ -808,6 +809,10 @@ typedef struct ssl3_state_internal_st {
808 * and freed and MD_CTX-es for all required digests are stored in 809 * and freed and MD_CTX-es for all required digests are stored in
809 * this array */ 810 * this array */
810 EVP_MD_CTX **handshake_dgst; 811 EVP_MD_CTX **handshake_dgst;
812
813 /* Rolling hash of handshake messages. */
814 EVP_MD_CTX *handshake_hash;
815
811 /* this is set whenerver we see a change_cipher_spec message 816 /* this is set whenerver we see a change_cipher_spec message
812 * come in when we are not looking for one */ 817 * come in when we are not looking for one */
813 int change_cipher_spec; 818 int change_cipher_spec;
@@ -1099,6 +1104,7 @@ int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
1099 const EVP_MD **md, int *mac_pkey_type, int *mac_secret_size); 1104 const EVP_MD **md, int *mac_pkey_type, int *mac_secret_size);
1100int ssl_cipher_get_evp_aead(const SSL_SESSION *s, const EVP_AEAD **aead); 1105int ssl_cipher_get_evp_aead(const SSL_SESSION *s, const EVP_AEAD **aead);
1101int ssl_get_handshake_digest(int i, long *mask, const EVP_MD **md); 1106int ssl_get_handshake_digest(int i, long *mask, const EVP_MD **md);
1107int ssl_get_handshake_evp_md(SSL *s, const EVP_MD **md);
1102 1108
1103int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk); 1109int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk);
1104int ssl_undefined_function(SSL *s); 1110int ssl_undefined_function(SSL *s);
@@ -1272,6 +1278,12 @@ int dtls1_enc(SSL *s, int snd);
1272int ssl_init_wbio_buffer(SSL *s, int push); 1278int ssl_init_wbio_buffer(SSL *s, int push);
1273void ssl_free_wbio_buffer(SSL *s); 1279void ssl_free_wbio_buffer(SSL *s);
1274 1280
1281int tls1_handshake_hash_init(SSL *s);
1282int tls1_handshake_hash_update(SSL *s, const unsigned char *buf, size_t len);
1283int tls1_handshake_hash_value(SSL *s, const unsigned char *out, size_t len,
1284 size_t *outlen);
1285void tls1_handshake_hash_free(SSL *s);
1286
1275int tls1_init_finished_mac(SSL *s); 1287int tls1_init_finished_mac(SSL *s);
1276int tls1_finish_mac(SSL *s, const unsigned char *buf, int len); 1288int tls1_finish_mac(SSL *s, const unsigned char *buf, int len);
1277void tls1_free_digest_list(SSL *s); 1289void tls1_free_digest_list(SSL *s);