diff options
Diffstat (limited to 'src/lib/libssl/src/ssl/ssl_locl.h')
-rw-r--r-- | src/lib/libssl/src/ssl/ssl_locl.h | 75 |
1 files changed, 65 insertions, 10 deletions
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h index cea622a2a6..d87fd51cfa 100644 --- a/src/lib/libssl/src/ssl/ssl_locl.h +++ b/src/lib/libssl/src/ssl/ssl_locl.h | |||
@@ -170,7 +170,7 @@ | |||
170 | # define OPENSSL_EXTERN OPENSSL_EXPORT | 170 | # define OPENSSL_EXTERN OPENSSL_EXPORT |
171 | #endif | 171 | #endif |
172 | 172 | ||
173 | #define PKCS1_CHECK | 173 | #undef PKCS1_CHECK |
174 | 174 | ||
175 | #define c2l(c,l) (l = ((unsigned long)(*((c)++))) , \ | 175 | #define c2l(c,l) (l = ((unsigned long)(*((c)++))) , \ |
176 | l|=(((unsigned long)(*((c)++)))<< 8), \ | 176 | l|=(((unsigned long)(*((c)++)))<< 8), \ |
@@ -289,6 +289,7 @@ | |||
289 | #define SSL_kEECDH 0x00000080L /* ephemeral ECDH */ | 289 | #define SSL_kEECDH 0x00000080L /* ephemeral ECDH */ |
290 | #define SSL_kPSK 0x00000100L /* PSK */ | 290 | #define SSL_kPSK 0x00000100L /* PSK */ |
291 | #define SSL_kGOST 0x00000200L /* GOST key exchange */ | 291 | #define SSL_kGOST 0x00000200L /* GOST key exchange */ |
292 | #define SSL_kSRP 0x00000400L /* SRP */ | ||
292 | 293 | ||
293 | /* Bits for algorithm_auth (server authentication) */ | 294 | /* Bits for algorithm_auth (server authentication) */ |
294 | #define SSL_aRSA 0x00000001L /* RSA auth */ | 295 | #define SSL_aRSA 0x00000001L /* RSA auth */ |
@@ -316,21 +317,29 @@ | |||
316 | #define SSL_CAMELLIA256 0x00000200L | 317 | #define SSL_CAMELLIA256 0x00000200L |
317 | #define SSL_eGOST2814789CNT 0x00000400L | 318 | #define SSL_eGOST2814789CNT 0x00000400L |
318 | #define SSL_SEED 0x00000800L | 319 | #define SSL_SEED 0x00000800L |
320 | #define SSL_AES128GCM 0x00001000L | ||
321 | #define SSL_AES256GCM 0x00002000L | ||
319 | 322 | ||
320 | #define SSL_AES (SSL_AES128|SSL_AES256) | 323 | #define SSL_AES (SSL_AES128|SSL_AES256|SSL_AES128GCM|SSL_AES256GCM) |
321 | #define SSL_CAMELLIA (SSL_CAMELLIA128|SSL_CAMELLIA256) | 324 | #define SSL_CAMELLIA (SSL_CAMELLIA128|SSL_CAMELLIA256) |
322 | 325 | ||
323 | 326 | ||
324 | /* Bits for algorithm_mac (symmetric authentication) */ | 327 | /* Bits for algorithm_mac (symmetric authentication) */ |
328 | |||
325 | #define SSL_MD5 0x00000001L | 329 | #define SSL_MD5 0x00000001L |
326 | #define SSL_SHA1 0x00000002L | 330 | #define SSL_SHA1 0x00000002L |
327 | #define SSL_GOST94 0x00000004L | 331 | #define SSL_GOST94 0x00000004L |
328 | #define SSL_GOST89MAC 0x00000008L | 332 | #define SSL_GOST89MAC 0x00000008L |
333 | #define SSL_SHA256 0x00000010L | ||
334 | #define SSL_SHA384 0x00000020L | ||
335 | /* Not a real MAC, just an indication it is part of cipher */ | ||
336 | #define SSL_AEAD 0x00000040L | ||
329 | 337 | ||
330 | /* Bits for algorithm_ssl (protocol version) */ | 338 | /* Bits for algorithm_ssl (protocol version) */ |
331 | #define SSL_SSLV2 0x00000001L | 339 | #define SSL_SSLV2 0x00000001L |
332 | #define SSL_SSLV3 0x00000002L | 340 | #define SSL_SSLV3 0x00000002L |
333 | #define SSL_TLSV1 SSL_SSLV3 /* for now */ | 341 | #define SSL_TLSV1 SSL_SSLV3 /* for now */ |
342 | #define SSL_TLSV1_2 0x00000004L | ||
334 | 343 | ||
335 | 344 | ||
336 | /* Bits for algorithm2 (handshake digests and other extra flags) */ | 345 | /* Bits for algorithm2 (handshake digests and other extra flags) */ |
@@ -338,15 +347,21 @@ | |||
338 | #define SSL_HANDSHAKE_MAC_MD5 0x10 | 347 | #define SSL_HANDSHAKE_MAC_MD5 0x10 |
339 | #define SSL_HANDSHAKE_MAC_SHA 0x20 | 348 | #define SSL_HANDSHAKE_MAC_SHA 0x20 |
340 | #define SSL_HANDSHAKE_MAC_GOST94 0x40 | 349 | #define SSL_HANDSHAKE_MAC_GOST94 0x40 |
350 | #define SSL_HANDSHAKE_MAC_SHA256 0x80 | ||
351 | #define SSL_HANDSHAKE_MAC_SHA384 0x100 | ||
341 | #define SSL_HANDSHAKE_MAC_DEFAULT (SSL_HANDSHAKE_MAC_MD5 | SSL_HANDSHAKE_MAC_SHA) | 352 | #define SSL_HANDSHAKE_MAC_DEFAULT (SSL_HANDSHAKE_MAC_MD5 | SSL_HANDSHAKE_MAC_SHA) |
342 | 353 | ||
343 | /* When adding new digest in the ssl_ciph.c and increment SSM_MD_NUM_IDX | 354 | /* When adding new digest in the ssl_ciph.c and increment SSM_MD_NUM_IDX |
344 | * make sure to update this constant too */ | 355 | * make sure to update this constant too */ |
345 | #define SSL_MAX_DIGEST 4 | 356 | #define SSL_MAX_DIGEST 6 |
357 | |||
358 | #define TLS1_PRF_DGST_MASK (0xff << TLS1_PRF_DGST_SHIFT) | ||
346 | 359 | ||
347 | #define TLS1_PRF_DGST_SHIFT 8 | 360 | #define TLS1_PRF_DGST_SHIFT 10 |
348 | #define TLS1_PRF_MD5 (SSL_HANDSHAKE_MAC_MD5 << TLS1_PRF_DGST_SHIFT) | 361 | #define TLS1_PRF_MD5 (SSL_HANDSHAKE_MAC_MD5 << TLS1_PRF_DGST_SHIFT) |
349 | #define TLS1_PRF_SHA1 (SSL_HANDSHAKE_MAC_SHA << TLS1_PRF_DGST_SHIFT) | 362 | #define TLS1_PRF_SHA1 (SSL_HANDSHAKE_MAC_SHA << TLS1_PRF_DGST_SHIFT) |
363 | #define TLS1_PRF_SHA256 (SSL_HANDSHAKE_MAC_SHA256 << TLS1_PRF_DGST_SHIFT) | ||
364 | #define TLS1_PRF_SHA384 (SSL_HANDSHAKE_MAC_SHA384 << TLS1_PRF_DGST_SHIFT) | ||
350 | #define TLS1_PRF_GOST94 (SSL_HANDSHAKE_MAC_GOST94 << TLS1_PRF_DGST_SHIFT) | 365 | #define TLS1_PRF_GOST94 (SSL_HANDSHAKE_MAC_GOST94 << TLS1_PRF_DGST_SHIFT) |
351 | #define TLS1_PRF (TLS1_PRF_MD5 | TLS1_PRF_SHA1) | 366 | #define TLS1_PRF (TLS1_PRF_MD5 | TLS1_PRF_SHA1) |
352 | 367 | ||
@@ -457,6 +472,8 @@ typedef struct cert_pkey_st | |||
457 | { | 472 | { |
458 | X509 *x509; | 473 | X509 *x509; |
459 | EVP_PKEY *privatekey; | 474 | EVP_PKEY *privatekey; |
475 | /* Digest to use when signing */ | ||
476 | const EVP_MD *digest; | ||
460 | } CERT_PKEY; | 477 | } CERT_PKEY; |
461 | 478 | ||
462 | typedef struct cert_st | 479 | typedef struct cert_st |
@@ -554,6 +571,10 @@ typedef struct ssl3_enc_method | |||
554 | const char *server_finished_label; | 571 | const char *server_finished_label; |
555 | int server_finished_label_len; | 572 | int server_finished_label_len; |
556 | int (*alert_value)(int); | 573 | int (*alert_value)(int); |
574 | int (*export_keying_material)(SSL *, unsigned char *, size_t, | ||
575 | const char *, size_t, | ||
576 | const unsigned char *, size_t, | ||
577 | int use_context); | ||
557 | } SSL3_ENC_METHOD; | 578 | } SSL3_ENC_METHOD; |
558 | 579 | ||
559 | #ifndef OPENSSL_NO_COMP | 580 | #ifndef OPENSSL_NO_COMP |
@@ -591,11 +612,12 @@ extern SSL3_ENC_METHOD TLSv1_enc_data; | |||
591 | extern SSL3_ENC_METHOD SSLv3_enc_data; | 612 | extern SSL3_ENC_METHOD SSLv3_enc_data; |
592 | extern SSL3_ENC_METHOD DTLSv1_enc_data; | 613 | extern SSL3_ENC_METHOD DTLSv1_enc_data; |
593 | 614 | ||
594 | #define IMPLEMENT_tls1_meth_func(func_name, s_accept, s_connect, s_get_meth) \ | 615 | #define IMPLEMENT_tls_meth_func(version, func_name, s_accept, s_connect, \ |
616 | s_get_meth) \ | ||
595 | const SSL_METHOD *func_name(void) \ | 617 | const SSL_METHOD *func_name(void) \ |
596 | { \ | 618 | { \ |
597 | static const SSL_METHOD func_name##_data= { \ | 619 | static const SSL_METHOD func_name##_data= { \ |
598 | TLS1_VERSION, \ | 620 | version, \ |
599 | tls1_new, \ | 621 | tls1_new, \ |
600 | tls1_clear, \ | 622 | tls1_clear, \ |
601 | tls1_free, \ | 623 | tls1_free, \ |
@@ -669,7 +691,7 @@ const SSL_METHOD *func_name(void) \ | |||
669 | const SSL_METHOD *func_name(void) \ | 691 | const SSL_METHOD *func_name(void) \ |
670 | { \ | 692 | { \ |
671 | static const SSL_METHOD func_name##_data= { \ | 693 | static const SSL_METHOD func_name##_data= { \ |
672 | TLS1_VERSION, \ | 694 | TLS1_2_VERSION, \ |
673 | tls1_new, \ | 695 | tls1_new, \ |
674 | tls1_clear, \ | 696 | tls1_clear, \ |
675 | tls1_free, \ | 697 | tls1_free, \ |
@@ -752,7 +774,7 @@ const SSL_METHOD *func_name(void) \ | |||
752 | ssl3_read, \ | 774 | ssl3_read, \ |
753 | ssl3_peek, \ | 775 | ssl3_peek, \ |
754 | ssl3_write, \ | 776 | ssl3_write, \ |
755 | ssl3_shutdown, \ | 777 | dtls1_shutdown, \ |
756 | ssl3_renegotiate, \ | 778 | ssl3_renegotiate, \ |
757 | ssl3_renegotiate_check, \ | 779 | ssl3_renegotiate_check, \ |
758 | dtls1_get_message, \ | 780 | dtls1_get_message, \ |
@@ -809,7 +831,7 @@ int ssl_undefined_function(SSL *s); | |||
809 | int ssl_undefined_void_function(void); | 831 | int ssl_undefined_void_function(void); |
810 | int ssl_undefined_const_function(const SSL *s); | 832 | int ssl_undefined_const_function(const SSL *s); |
811 | X509 *ssl_get_server_send_cert(SSL *); | 833 | X509 *ssl_get_server_send_cert(SSL *); |
812 | EVP_PKEY *ssl_get_sign_pkey(SSL *,const SSL_CIPHER *); | 834 | EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *c, const EVP_MD **pmd); |
813 | int ssl_cert_type(X509 *x,EVP_PKEY *pkey); | 835 | int ssl_cert_type(X509 *x,EVP_PKEY *pkey); |
814 | void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); | 836 | void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); |
815 | STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); | 837 | STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); |
@@ -943,6 +965,7 @@ void dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr); | |||
943 | void dtls1_reset_seq_numbers(SSL *s, int rw); | 965 | void dtls1_reset_seq_numbers(SSL *s, int rw); |
944 | long dtls1_default_timeout(void); | 966 | long dtls1_default_timeout(void); |
945 | struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft); | 967 | struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft); |
968 | int dtls1_check_timeout_num(SSL *s); | ||
946 | int dtls1_handle_timeout(SSL *s); | 969 | int dtls1_handle_timeout(SSL *s); |
947 | const SSL_CIPHER *dtls1_get_cipher(unsigned int u); | 970 | const SSL_CIPHER *dtls1_get_cipher(unsigned int u); |
948 | void dtls1_start_timer(SSL *s); | 971 | void dtls1_start_timer(SSL *s); |
@@ -968,6 +991,9 @@ int ssl3_get_server_certificate(SSL *s); | |||
968 | int ssl3_check_cert_and_algorithm(SSL *s); | 991 | int ssl3_check_cert_and_algorithm(SSL *s); |
969 | #ifndef OPENSSL_NO_TLSEXT | 992 | #ifndef OPENSSL_NO_TLSEXT |
970 | int ssl3_check_finished(SSL *s); | 993 | int ssl3_check_finished(SSL *s); |
994 | # ifndef OPENSSL_NO_NEXTPROTONEG | ||
995 | int ssl3_send_next_proto(SSL *s); | ||
996 | # endif | ||
971 | #endif | 997 | #endif |
972 | 998 | ||
973 | int dtls1_client_hello(SSL *s); | 999 | int dtls1_client_hello(SSL *s); |
@@ -986,6 +1012,9 @@ int ssl3_check_client_hello(SSL *s); | |||
986 | int ssl3_get_client_certificate(SSL *s); | 1012 | int ssl3_get_client_certificate(SSL *s); |
987 | int ssl3_get_client_key_exchange(SSL *s); | 1013 | int ssl3_get_client_key_exchange(SSL *s); |
988 | int ssl3_get_cert_verify(SSL *s); | 1014 | int ssl3_get_cert_verify(SSL *s); |
1015 | #ifndef OPENSSL_NO_NEXTPROTONEG | ||
1016 | int ssl3_get_next_proto(SSL *s); | ||
1017 | #endif | ||
989 | 1018 | ||
990 | int dtls1_send_hello_request(SSL *s); | 1019 | int dtls1_send_hello_request(SSL *s); |
991 | int dtls1_send_server_hello(SSL *s); | 1020 | int dtls1_send_server_hello(SSL *s); |
@@ -1013,6 +1042,7 @@ int dtls1_connect(SSL *s); | |||
1013 | void dtls1_free(SSL *s); | 1042 | void dtls1_free(SSL *s); |
1014 | void dtls1_clear(SSL *s); | 1043 | void dtls1_clear(SSL *s); |
1015 | long dtls1_ctrl(SSL *s,int cmd, long larg, void *parg); | 1044 | long dtls1_ctrl(SSL *s,int cmd, long larg, void *parg); |
1045 | int dtls1_shutdown(SSL *s); | ||
1016 | 1046 | ||
1017 | long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); | 1047 | long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); |
1018 | int dtls1_get_record(SSL *s); | 1048 | int dtls1_get_record(SSL *s); |
@@ -1033,12 +1063,15 @@ int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); | |||
1033 | int tls1_mac(SSL *ssl, unsigned char *md, int snd); | 1063 | int tls1_mac(SSL *ssl, unsigned char *md, int snd); |
1034 | int tls1_generate_master_secret(SSL *s, unsigned char *out, | 1064 | int tls1_generate_master_secret(SSL *s, unsigned char *out, |
1035 | unsigned char *p, int len); | 1065 | unsigned char *p, int len); |
1066 | int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, | ||
1067 | const char *label, size_t llen, | ||
1068 | const unsigned char *p, size_t plen, int use_context); | ||
1036 | int tls1_alert_code(int code); | 1069 | int tls1_alert_code(int code); |
1037 | int ssl3_alert_code(int code); | 1070 | int ssl3_alert_code(int code); |
1038 | int ssl_ok(SSL *s); | 1071 | int ssl_ok(SSL *s); |
1039 | 1072 | ||
1040 | #ifndef OPENSSL_NO_ECDH | 1073 | #ifndef OPENSSL_NO_ECDH |
1041 | int ssl_check_srvr_ecc_cert_and_alg(X509 *x, const SSL_CIPHER *cs); | 1074 | int ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s); |
1042 | #endif | 1075 | #endif |
1043 | 1076 | ||
1044 | SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n); | 1077 | SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n); |
@@ -1058,6 +1091,13 @@ int ssl_prepare_serverhello_tlsext(SSL *s); | |||
1058 | int ssl_check_clienthello_tlsext(SSL *s); | 1091 | int ssl_check_clienthello_tlsext(SSL *s); |
1059 | int ssl_check_serverhello_tlsext(SSL *s); | 1092 | int ssl_check_serverhello_tlsext(SSL *s); |
1060 | 1093 | ||
1094 | #ifndef OPENSSL_NO_HEARTBEATS | ||
1095 | int tls1_heartbeat(SSL *s); | ||
1096 | int dtls1_heartbeat(SSL *s); | ||
1097 | int tls1_process_heartbeat(SSL *s); | ||
1098 | int dtls1_process_heartbeat(SSL *s); | ||
1099 | #endif | ||
1100 | |||
1061 | #ifdef OPENSSL_NO_SHA256 | 1101 | #ifdef OPENSSL_NO_SHA256 |
1062 | #define tlsext_tick_md EVP_sha1 | 1102 | #define tlsext_tick_md EVP_sha1 |
1063 | #else | 1103 | #else |
@@ -1065,6 +1105,12 @@ int ssl_check_serverhello_tlsext(SSL *s); | |||
1065 | #endif | 1105 | #endif |
1066 | int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, | 1106 | int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, |
1067 | const unsigned char *limit, SSL_SESSION **ret); | 1107 | const unsigned char *limit, SSL_SESSION **ret); |
1108 | |||
1109 | int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, | ||
1110 | const EVP_MD *md); | ||
1111 | int tls12_get_sigid(const EVP_PKEY *pk); | ||
1112 | const EVP_MD *tls12_get_hash(unsigned char hash_alg); | ||
1113 | |||
1068 | #endif | 1114 | #endif |
1069 | EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ; | 1115 | EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ; |
1070 | void ssl_clear_hash_ctx(EVP_MD_CTX **hash); | 1116 | void ssl_clear_hash_ctx(EVP_MD_CTX **hash); |
@@ -1076,4 +1122,13 @@ int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p, int *len, | |||
1076 | int maxlen); | 1122 | int maxlen); |
1077 | int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int len, | 1123 | int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int len, |
1078 | int *al); | 1124 | int *al); |
1125 | long ssl_get_algorithm2(SSL *s); | ||
1126 | int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize); | ||
1127 | int tls12_get_req_sig_algs(SSL *s, unsigned char *p); | ||
1128 | |||
1129 | int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); | ||
1130 | int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); | ||
1131 | int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); | ||
1132 | int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); | ||
1133 | |||
1079 | #endif | 1134 | #endif |