diff options
author | jsing <> | 2014-04-15 12:00:25 +0000 |
---|---|---|
committer | jsing <> | 2014-04-15 12:00:25 +0000 |
commit | 119df02356e2634a1f38a23d288d8774e841e5f7 (patch) | |
tree | 3ba45c8dc0a2bcf26ddd859d8ee8c4dfb1b8e4b2 /src/lib/libssl/ssl_locl.h | |
parent | ab563839bbe3ddf11336b51c80c7fb09adb04abb (diff) | |
download | openbsd-119df02356e2634a1f38a23d288d8774e841e5f7.tar.gz openbsd-119df02356e2634a1f38a23d288d8774e841e5f7.tar.bz2 openbsd-119df02356e2634a1f38a23d288d8774e841e5f7.zip |
First pass at applying KNF to the OpenSSL code, which almost makes it
readable. This pass is whitespace only and can readily be verified using
tr and md5.
There is still a huge amount of inconsistency within these headers.
Diffstat (limited to 'src/lib/libssl/ssl_locl.h')
-rw-r--r-- | src/lib/libssl/ssl_locl.h | 263 |
1 files changed, 129 insertions, 134 deletions
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index 7311d984ae..203a47480f 100644 --- a/src/lib/libssl/ssl_locl.h +++ b/src/lib/libssl/ssl_locl.h | |||
@@ -480,21 +480,19 @@ | |||
480 | #define NAMED_CURVE_TYPE 3 | 480 | #define NAMED_CURVE_TYPE 3 |
481 | #endif /* OPENSSL_NO_EC */ | 481 | #endif /* OPENSSL_NO_EC */ |
482 | 482 | ||
483 | typedef struct cert_pkey_st | 483 | typedef struct cert_pkey_st { |
484 | { | ||
485 | X509 *x509; | 484 | X509 *x509; |
486 | EVP_PKEY *privatekey; | 485 | EVP_PKEY *privatekey; |
487 | /* Digest to use when signing */ | 486 | /* Digest to use when signing */ |
488 | const EVP_MD *digest; | 487 | const EVP_MD *digest; |
489 | } CERT_PKEY; | 488 | } CERT_PKEY; |
490 | 489 | ||
491 | typedef struct cert_st | 490 | typedef struct cert_st { |
492 | { | ||
493 | /* Current active set */ | 491 | /* Current active set */ |
494 | CERT_PKEY *key; /* ALWAYS points to an element of the pkeys array | 492 | CERT_PKEY *key; /* ALWAYS points to an element of the pkeys array |
495 | * Probably it would make more sense to store | 493 | * Probably it would make more sense to store |
496 | * an index, not a pointer. */ | 494 | * an index, not a pointer. */ |
497 | 495 | ||
498 | /* The following masks are for the key and auth | 496 | /* The following masks are for the key and auth |
499 | * algorithms that are supported by the certs below */ | 497 | * algorithms that are supported by the certs below */ |
500 | int valid; | 498 | int valid; |
@@ -504,26 +502,25 @@ typedef struct cert_st | |||
504 | unsigned long export_mask_a; | 502 | unsigned long export_mask_a; |
505 | #ifndef OPENSSL_NO_RSA | 503 | #ifndef OPENSSL_NO_RSA |
506 | RSA *rsa_tmp; | 504 | RSA *rsa_tmp; |
507 | RSA *(*rsa_tmp_cb)(SSL *ssl,int is_export,int keysize); | 505 | RSA *(*rsa_tmp_cb)(SSL *ssl, int is_export, int keysize); |
508 | #endif | 506 | #endif |
509 | #ifndef OPENSSL_NO_DH | 507 | #ifndef OPENSSL_NO_DH |
510 | DH *dh_tmp; | 508 | DH *dh_tmp; |
511 | DH *(*dh_tmp_cb)(SSL *ssl,int is_export,int keysize); | 509 | DH *(*dh_tmp_cb)(SSL *ssl, int is_export, int keysize); |
512 | #endif | 510 | #endif |
513 | #ifndef OPENSSL_NO_ECDH | 511 | #ifndef OPENSSL_NO_ECDH |
514 | EC_KEY *ecdh_tmp; | 512 | EC_KEY *ecdh_tmp; |
515 | /* Callback for generating ephemeral ECDH keys */ | 513 | /* Callback for generating ephemeral ECDH keys */ |
516 | EC_KEY *(*ecdh_tmp_cb)(SSL *ssl,int is_export,int keysize); | 514 | EC_KEY *(*ecdh_tmp_cb)(SSL *ssl, int is_export, int keysize); |
517 | #endif | 515 | #endif |
518 | 516 | ||
519 | CERT_PKEY pkeys[SSL_PKEY_NUM]; | 517 | CERT_PKEY pkeys[SSL_PKEY_NUM]; |
520 | 518 | ||
521 | int references; /* >1 only if SSL_copy_session_id is used */ | 519 | int references; /* >1 only if SSL_copy_session_id is used */ |
522 | } CERT; | 520 | } CERT; |
523 | 521 | ||
524 | 522 | ||
525 | typedef struct sess_cert_st | 523 | typedef struct sess_cert_st { |
526 | { | ||
527 | STACK_OF(X509) *cert_chain; /* as received from peer (not for SSL2) */ | 524 | STACK_OF(X509) *cert_chain; /* as received from peer (not for SSL2) */ |
528 | 525 | ||
529 | /* The 'peer_...' members are used only by clients. */ | 526 | /* The 'peer_...' members are used only by clients. */ |
@@ -545,7 +542,7 @@ typedef struct sess_cert_st | |||
545 | #endif | 542 | #endif |
546 | 543 | ||
547 | int references; /* actually always 1 at the moment */ | 544 | int references; /* actually always 1 at the moment */ |
548 | } SESS_CERT; | 545 | } SESS_CERT; |
549 | 546 | ||
550 | 547 | ||
551 | /*#define MAC_DEBUG */ | 548 | /*#define MAC_DEBUG */ |
@@ -568,12 +565,12 @@ typedef struct sess_cert_st | |||
568 | /* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff | 565 | /* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff |
569 | * It is a bit of a mess of functions, but hell, think of it as | 566 | * It is a bit of a mess of functions, but hell, think of it as |
570 | * an opaque structure :-) */ | 567 | * an opaque structure :-) */ |
571 | typedef struct ssl3_enc_method | 568 | typedef struct ssl3_enc_method { |
572 | { | ||
573 | int (*enc)(SSL *, int); | 569 | int (*enc)(SSL *, int); |
574 | int (*mac)(SSL *, unsigned char *, int); | 570 | int (*mac)(SSL *, unsigned char *, int); |
575 | int (*setup_key_block)(SSL *); | 571 | int (*setup_key_block)(SSL *); |
576 | int (*generate_master_secret)(SSL *, unsigned char *, unsigned char *, int); | 572 | int (*generate_master_secret)(SSL *, unsigned char *, |
573 | unsigned char *, int); | ||
577 | int (*change_cipher_state)(SSL *, int); | 574 | int (*change_cipher_state)(SSL *, int); |
578 | int (*final_finish_mac)(SSL *, const char *, int, unsigned char *); | 575 | int (*final_finish_mac)(SSL *, const char *, int, unsigned char *); |
579 | int finish_mac_length; | 576 | int finish_mac_length; |
@@ -584,33 +581,29 @@ typedef struct ssl3_enc_method | |||
584 | int server_finished_label_len; | 581 | int server_finished_label_len; |
585 | int (*alert_value)(int); | 582 | int (*alert_value)(int); |
586 | int (*export_keying_material)(SSL *, unsigned char *, size_t, | 583 | int (*export_keying_material)(SSL *, unsigned char *, size_t, |
587 | const char *, size_t, | 584 | const char *, size_t, const unsigned char *, size_t, |
588 | const unsigned char *, size_t, | 585 | int use_context); |
589 | int use_context); | 586 | } SSL3_ENC_METHOD; |
590 | } SSL3_ENC_METHOD; | ||
591 | 587 | ||
592 | #ifndef OPENSSL_NO_COMP | 588 | #ifndef OPENSSL_NO_COMP |
593 | /* Used for holding the relevant compression methods loaded into SSL_CTX */ | 589 | /* Used for holding the relevant compression methods loaded into SSL_CTX */ |
594 | typedef struct ssl3_comp_st | 590 | typedef struct ssl3_comp_st { |
595 | { | ||
596 | int comp_id; /* The identifier byte for this compression type */ | 591 | int comp_id; /* The identifier byte for this compression type */ |
597 | char *name; /* Text name used for the compression type */ | 592 | char *name; /* Text name used for the compression type */ |
598 | COMP_METHOD *method; /* The method :-) */ | 593 | COMP_METHOD *method; /* The method :-) */ |
599 | } SSL3_COMP; | 594 | } SSL3_COMP; |
600 | #endif | 595 | #endif |
601 | 596 | ||
602 | #ifndef OPENSSL_NO_BUF_FREELISTS | 597 | #ifndef OPENSSL_NO_BUF_FREELISTS |
603 | typedef struct ssl3_buf_freelist_st | 598 | typedef struct ssl3_buf_freelist_st { |
604 | { | ||
605 | size_t chunklen; | 599 | size_t chunklen; |
606 | unsigned int len; | 600 | unsigned int len; |
607 | struct ssl3_buf_freelist_entry_st *head; | 601 | struct ssl3_buf_freelist_entry_st *head; |
608 | } SSL3_BUF_FREELIST; | 602 | } SSL3_BUF_FREELIST; |
609 | 603 | ||
610 | typedef struct ssl3_buf_freelist_entry_st | 604 | typedef struct ssl3_buf_freelist_entry_st { |
611 | { | ||
612 | struct ssl3_buf_freelist_entry_st *next; | 605 | struct ssl3_buf_freelist_entry_st *next; |
613 | } SSL3_BUF_FREELIST_ENTRY; | 606 | } SSL3_BUF_FREELIST_ENTRY; |
614 | #endif | 607 | #endif |
615 | 608 | ||
616 | extern SSL3_ENC_METHOD ssl3_undef_enc_method; | 609 | extern SSL3_ENC_METHOD ssl3_undef_enc_method; |
@@ -822,32 +815,33 @@ SESS_CERT *ssl_sess_cert_new(void); | |||
822 | void ssl_sess_cert_free(SESS_CERT *sc); | 815 | void ssl_sess_cert_free(SESS_CERT *sc); |
823 | int ssl_set_peer_cert_type(SESS_CERT *c, int type); | 816 | int ssl_set_peer_cert_type(SESS_CERT *c, int type); |
824 | int ssl_get_new_session(SSL *s, int session); | 817 | int ssl_get_new_session(SSL *s, int session); |
825 | int ssl_get_prev_session(SSL *s, unsigned char *session,int len, const unsigned char *limit); | 818 | int ssl_get_prev_session(SSL *s, unsigned char *session, int len, |
826 | int ssl_cipher_id_cmp(const SSL_CIPHER *a,const SSL_CIPHER *b); | 819 | const unsigned char *limit); |
827 | DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, | 820 | int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b); |
828 | ssl_cipher_id); | 821 | DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id); |
829 | int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, | 822 | int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, |
830 | const SSL_CIPHER * const *bp); | 823 | const SSL_CIPHER * const *bp); |
831 | STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, | 824 | STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, |
832 | STACK_OF(SSL_CIPHER) **skp); | 825 | int num, STACK_OF(SSL_CIPHER) **skp); |
833 | int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p, | 826 | int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, |
834 | int (*put_cb)(const SSL_CIPHER *, unsigned char *)); | 827 | unsigned char *p, int (*put_cb)(const SSL_CIPHER *, unsigned char *)); |
835 | STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, | 828 | STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, |
836 | STACK_OF(SSL_CIPHER) **pref, | 829 | STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted, |
837 | STACK_OF(SSL_CIPHER) **sorted, | 830 | const char *rule_str); |
838 | const char *rule_str); | ||
839 | void ssl_update_cache(SSL *s, int mode); | 831 | void ssl_update_cache(SSL *s, int mode); |
840 | int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc, | 832 | int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc, |
841 | const EVP_MD **md,int *mac_pkey_type,int *mac_secret_size, SSL_COMP **comp); | 833 | const EVP_MD **md, int *mac_pkey_type, int *mac_secret_size, |
842 | int ssl_get_handshake_digest(int i,long *mask,const EVP_MD **md); | 834 | SSL_COMP **comp); |
843 | int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); | 835 | int ssl_get_handshake_digest(int i, long *mask, const EVP_MD **md); |
836 | |||
837 | int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk); | ||
844 | int ssl_undefined_function(SSL *s); | 838 | int ssl_undefined_function(SSL *s); |
845 | int ssl_undefined_void_function(void); | 839 | int ssl_undefined_void_function(void); |
846 | int ssl_undefined_const_function(const SSL *s); | 840 | int ssl_undefined_const_function(const SSL *s); |
847 | CERT_PKEY *ssl_get_server_send_pkey(const SSL *s); | 841 | CERT_PKEY *ssl_get_server_send_pkey(const SSL *s); |
848 | X509 *ssl_get_server_send_cert(const SSL *); | 842 | X509 *ssl_get_server_send_cert(const SSL *); |
849 | EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *c, const EVP_MD **pmd); | 843 | EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *c, const EVP_MD **pmd); |
850 | int ssl_cert_type(X509 *x,EVP_PKEY *pkey); | 844 | int ssl_cert_type(X509 *x, EVP_PKEY *pkey); |
851 | void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); | 845 | void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); |
852 | STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); | 846 | STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); |
853 | int ssl_verify_alarm_type(long type); | 847 | int ssl_verify_alarm_type(long type); |
@@ -856,14 +850,14 @@ int ssl_fill_hello_random(SSL *s, int server, unsigned char *field, int len); | |||
856 | 850 | ||
857 | int ssl2_enc_init(SSL *s, int client); | 851 | int ssl2_enc_init(SSL *s, int client); |
858 | int ssl2_generate_key_material(SSL *s); | 852 | int ssl2_generate_key_material(SSL *s); |
859 | void ssl2_enc(SSL *s,int send_data); | 853 | void ssl2_enc(SSL *s, int send_data); |
860 | void ssl2_mac(SSL *s,unsigned char *mac,int send_data); | 854 | void ssl2_mac(SSL *s, unsigned char *mac, int send_data); |
861 | const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p); | 855 | const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p); |
862 | int ssl2_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); | 856 | int ssl2_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p); |
863 | int ssl2_part_read(SSL *s, unsigned long f, int i); | 857 | int ssl2_part_read(SSL *s, unsigned long f, int i); |
864 | int ssl2_do_write(SSL *s); | 858 | int ssl2_do_write(SSL *s); |
865 | int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data); | 859 | int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data); |
866 | void ssl2_return_error(SSL *s,int reason); | 860 | void ssl2_return_error(SSL *s, int reason); |
867 | void ssl2_write_error(SSL *s); | 861 | void ssl2_write_error(SSL *s); |
868 | int ssl2_num_ciphers(void); | 862 | int ssl2_num_ciphers(void); |
869 | const SSL_CIPHER *ssl2_get_cipher(unsigned int u); | 863 | const SSL_CIPHER *ssl2_get_cipher(unsigned int u); |
@@ -876,47 +870,50 @@ int ssl2_peek(SSL *s, void *buf, int len); | |||
876 | int ssl2_write(SSL *s, const void *buf, int len); | 870 | int ssl2_write(SSL *s, const void *buf, int len); |
877 | int ssl2_shutdown(SSL *s); | 871 | int ssl2_shutdown(SSL *s); |
878 | void ssl2_clear(SSL *s); | 872 | void ssl2_clear(SSL *s); |
879 | long ssl2_ctrl(SSL *s,int cmd, long larg, void *parg); | 873 | long ssl2_ctrl(SSL *s, int cmd, long larg, void *parg); |
880 | long ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); | 874 | long ssl2_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg); |
881 | long ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); | 875 | long ssl2_callback_ctrl(SSL *s, int cmd, void (*fp)(void)); |
882 | long ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void)); | 876 | long ssl2_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void)); |
883 | int ssl2_pending(const SSL *s); | 877 | int ssl2_pending(const SSL *s); |
884 | long ssl2_default_timeout(void ); | 878 | long ssl2_default_timeout(void ); |
885 | 879 | ||
886 | const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); | 880 | const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); |
887 | int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); | 881 | int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p); |
888 | void ssl3_init_finished_mac(SSL *s); | 882 | void ssl3_init_finished_mac(SSL *s); |
889 | int ssl3_send_server_certificate(SSL *s); | 883 | int ssl3_send_server_certificate(SSL *s); |
890 | int ssl3_send_newsession_ticket(SSL *s); | 884 | int ssl3_send_newsession_ticket(SSL *s); |
891 | int ssl3_send_cert_status(SSL *s); | 885 | int ssl3_send_cert_status(SSL *s); |
892 | int ssl3_get_finished(SSL *s,int state_a,int state_b); | 886 | int ssl3_get_finished(SSL *s, int state_a, int state_b); |
893 | int ssl3_setup_key_block(SSL *s); | 887 | int ssl3_setup_key_block(SSL *s); |
894 | int ssl3_send_change_cipher_spec(SSL *s,int state_a,int state_b); | 888 | int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b); |
895 | int ssl3_change_cipher_state(SSL *s,int which); | 889 | int ssl3_change_cipher_state(SSL *s, int which); |
896 | void ssl3_cleanup_key_block(SSL *s); | 890 | void ssl3_cleanup_key_block(SSL *s); |
897 | int ssl3_do_write(SSL *s,int type); | 891 | int ssl3_do_write(SSL *s, int type); |
898 | int ssl3_send_alert(SSL *s,int level, int desc); | 892 | int ssl3_send_alert(SSL *s, int level, int desc); |
899 | int ssl3_generate_master_secret(SSL *s, unsigned char *out, | 893 | int ssl3_generate_master_secret(SSL *s, unsigned char *out, |
900 | unsigned char *p, int len); | 894 | unsigned char *p, int len); |
901 | int ssl3_get_req_cert_type(SSL *s,unsigned char *p); | 895 | int ssl3_get_req_cert_type(SSL *s, unsigned char *p); |
902 | long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); | 896 | long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); |
903 | int ssl3_send_finished(SSL *s, int a, int b, const char *sender,int slen); | 897 | int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen); |
904 | int ssl3_num_ciphers(void); | 898 | int ssl3_num_ciphers(void); |
905 | const SSL_CIPHER *ssl3_get_cipher(unsigned int u); | 899 | const SSL_CIPHER *ssl3_get_cipher(unsigned int u); |
906 | int ssl3_renegotiate(SSL *ssl); | 900 | int ssl3_renegotiate(SSL *ssl); |
907 | int ssl3_renegotiate_check(SSL *ssl); | 901 | |
902 | int ssl3_renegotiate_check(SSL *ssl); | ||
903 | |||
908 | int ssl3_dispatch_alert(SSL *s); | 904 | int ssl3_dispatch_alert(SSL *s); |
909 | int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); | 905 | int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); |
910 | int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); | 906 | int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); |
911 | int ssl3_final_finish_mac(SSL *s, const char *sender, int slen,unsigned char *p); | 907 | int ssl3_final_finish_mac(SSL *s, const char *sender, int slen, |
908 | unsigned char *p); | ||
912 | int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); | 909 | int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); |
913 | void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len); | 910 | void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len); |
914 | int ssl3_enc(SSL *s, int send_data); | 911 | int ssl3_enc(SSL *s, int send_data); |
915 | int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data); | 912 | int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data); |
916 | void ssl3_free_digest_list(SSL *s); | 913 | void ssl3_free_digest_list(SSL *s); |
917 | unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); | 914 | unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); |
918 | SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,STACK_OF(SSL_CIPHER) *clnt, | 915 | SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt, |
919 | STACK_OF(SSL_CIPHER) *srvr); | 916 | STACK_OF(SSL_CIPHER) *srvr); |
920 | int ssl3_setup_buffers(SSL *s); | 917 | int ssl3_setup_buffers(SSL *s); |
921 | int ssl3_setup_read_buffer(SSL *s); | 918 | int ssl3_setup_read_buffer(SSL *s); |
922 | int ssl3_setup_write_buffer(SSL *s); | 919 | int ssl3_setup_write_buffer(SSL *s); |
@@ -932,10 +929,10 @@ int ssl3_peek(SSL *s, void *buf, int len); | |||
932 | int ssl3_write(SSL *s, const void *buf, int len); | 929 | int ssl3_write(SSL *s, const void *buf, int len); |
933 | int ssl3_shutdown(SSL *s); | 930 | int ssl3_shutdown(SSL *s); |
934 | void ssl3_clear(SSL *s); | 931 | void ssl3_clear(SSL *s); |
935 | long ssl3_ctrl(SSL *s,int cmd, long larg, void *parg); | 932 | long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg); |
936 | long ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); | 933 | long ssl3_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg); |
937 | long ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); | 934 | long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void)); |
938 | long ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void)); | 935 | long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void)); |
939 | int ssl3_pending(const SSL *s); | 936 | int ssl3_pending(const SSL *s); |
940 | 937 | ||
941 | void ssl3_record_sequence_update(unsigned char *seq); | 938 | void ssl3_record_sequence_update(unsigned char *seq); |
@@ -952,16 +949,16 @@ const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p); | |||
952 | long ssl23_default_timeout(void ); | 949 | long ssl23_default_timeout(void ); |
953 | 950 | ||
954 | long tls1_default_timeout(void); | 951 | long tls1_default_timeout(void); |
955 | int dtls1_do_write(SSL *s,int type); | 952 | int dtls1_do_write(SSL *s, int type); |
956 | int ssl3_read_n(SSL *s, int n, int max, int extend); | 953 | int ssl3_read_n(SSL *s, int n, int max, int extend); |
957 | int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); | 954 | int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); |
958 | int ssl3_do_compress(SSL *ssl); | 955 | int ssl3_do_compress(SSL *ssl); |
959 | int ssl3_do_uncompress(SSL *ssl); | 956 | int ssl3_do_uncompress(SSL *ssl); |
960 | int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, | 957 | int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, |
961 | unsigned int len); | 958 | unsigned int len); |
962 | unsigned char *dtls1_set_message_header(SSL *s, | 959 | unsigned char *dtls1_set_message_header(SSL *s, unsigned char *p, |
963 | unsigned char *p, unsigned char mt, unsigned long len, | 960 | unsigned char mt, unsigned long len, unsigned long frag_off, |
964 | unsigned long frag_off, unsigned long frag_len); | 961 | unsigned long frag_len); |
965 | 962 | ||
966 | int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len); | 963 | int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len); |
967 | int dtls1_write_bytes(SSL *s, int type, const void *buf, int len); | 964 | int dtls1_write_bytes(SSL *s, int type, const void *buf, int len); |
@@ -971,8 +968,8 @@ int dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen); | |||
971 | unsigned long dtls1_output_cert_chain(SSL *s, X509 *x); | 968 | unsigned long dtls1_output_cert_chain(SSL *s, X509 *x); |
972 | int dtls1_read_failed(SSL *s, int code); | 969 | int dtls1_read_failed(SSL *s, int code); |
973 | int dtls1_buffer_message(SSL *s, int ccs); | 970 | int dtls1_buffer_message(SSL *s, int ccs); |
974 | int dtls1_retransmit_message(SSL *s, unsigned short seq, | 971 | int dtls1_retransmit_message(SSL *s, unsigned short seq, |
975 | unsigned long frag_off, int *found); | 972 | unsigned long frag_off, int *found); |
976 | int dtls1_get_queue_priority(unsigned short seq, int is_ccs); | 973 | int dtls1_get_queue_priority(unsigned short seq, int is_ccs); |
977 | int dtls1_retransmit_buffered_messages(SSL *s); | 974 | int dtls1_retransmit_buffered_messages(SSL *s); |
978 | void dtls1_clear_record_buffer(SSL *s); | 975 | void dtls1_clear_record_buffer(SSL *s); |
@@ -1049,21 +1046,21 @@ int ssl23_write_bytes(SSL *s); | |||
1049 | int tls1_new(SSL *s); | 1046 | int tls1_new(SSL *s); |
1050 | void tls1_free(SSL *s); | 1047 | void tls1_free(SSL *s); |
1051 | void tls1_clear(SSL *s); | 1048 | void tls1_clear(SSL *s); |
1052 | long tls1_ctrl(SSL *s,int cmd, long larg, void *parg); | 1049 | long tls1_ctrl(SSL *s, int cmd, long larg, void *parg); |
1053 | long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); | 1050 | long tls1_callback_ctrl(SSL *s, int cmd, void (*fp)(void)); |
1054 | 1051 | ||
1055 | int dtls1_new(SSL *s); | 1052 | int dtls1_new(SSL *s); |
1056 | int dtls1_accept(SSL *s); | 1053 | int dtls1_accept(SSL *s); |
1057 | int dtls1_connect(SSL *s); | 1054 | int dtls1_connect(SSL *s); |
1058 | void dtls1_free(SSL *s); | 1055 | void dtls1_free(SSL *s); |
1059 | void dtls1_clear(SSL *s); | 1056 | void dtls1_clear(SSL *s); |
1060 | long dtls1_ctrl(SSL *s,int cmd, long larg, void *parg); | 1057 | long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg); |
1061 | int dtls1_shutdown(SSL *s); | 1058 | int dtls1_shutdown(SSL *s); |
1062 | 1059 | ||
1063 | long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); | 1060 | long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); |
1064 | int dtls1_get_record(SSL *s); | 1061 | int dtls1_get_record(SSL *s); |
1065 | int do_dtls1_write(SSL *s, int type, const unsigned char *buf, | 1062 | int do_dtls1_write(SSL *s, int type, const unsigned char *buf, |
1066 | unsigned int len, int create_empty_fragement); | 1063 | unsigned int len, int create_empty_fragement); |
1067 | int dtls1_dispatch_alert(SSL *s); | 1064 | int dtls1_dispatch_alert(SSL *s); |
1068 | int dtls1_enc(SSL *s, int snd); | 1065 | int dtls1_enc(SSL *s, int snd); |
1069 | 1066 | ||
@@ -1073,15 +1070,14 @@ void ssl_free_wbio_buffer(SSL *s); | |||
1073 | int tls1_change_cipher_state(SSL *s, int which); | 1070 | int tls1_change_cipher_state(SSL *s, int which); |
1074 | int tls1_setup_key_block(SSL *s); | 1071 | int tls1_setup_key_block(SSL *s); |
1075 | int tls1_enc(SSL *s, int snd); | 1072 | int tls1_enc(SSL *s, int snd); |
1076 | int tls1_final_finish_mac(SSL *s, | 1073 | int tls1_final_finish_mac(SSL *s, const char *str, int slen, unsigned char *p); |
1077 | const char *str, int slen, unsigned char *p); | ||
1078 | int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); | 1074 | int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); |
1079 | int tls1_mac(SSL *ssl, unsigned char *md, int snd); | 1075 | int tls1_mac(SSL *ssl, unsigned char *md, int snd); |
1080 | int tls1_generate_master_secret(SSL *s, unsigned char *out, | 1076 | int tls1_generate_master_secret(SSL *s, unsigned char *out, |
1081 | unsigned char *p, int len); | 1077 | unsigned char *p, int len); |
1082 | int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, | 1078 | int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, |
1083 | const char *label, size_t llen, | 1079 | const char *label, size_t llen, const unsigned char *p, size_t plen, |
1084 | const unsigned char *p, size_t plen, int use_context); | 1080 | int use_context); |
1085 | int tls1_alert_code(int code); | 1081 | int tls1_alert_code(int code); |
1086 | int ssl3_alert_code(int code); | 1082 | int ssl3_alert_code(int code); |
1087 | int ssl_ok(SSL *s); | 1083 | int ssl_ok(SSL *s); |
@@ -1098,10 +1094,16 @@ int tls1_ec_nid2curve_id(int nid); | |||
1098 | #endif /* OPENSSL_NO_EC */ | 1094 | #endif /* OPENSSL_NO_EC */ |
1099 | 1095 | ||
1100 | #ifndef OPENSSL_NO_TLSEXT | 1096 | #ifndef OPENSSL_NO_TLSEXT |
1101 | unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); | 1097 | unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, |
1102 | unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); | 1098 | unsigned char *limit); |
1103 | int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); | 1099 | |
1104 | int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); | 1100 | unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, |
1101 | unsigned char *limit); | ||
1102 | |||
1103 | int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data, | ||
1104 | unsigned char *d, int n, int *al); | ||
1105 | int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, | ||
1106 | unsigned char *d, int n, int *al); | ||
1105 | int ssl_prepare_clienthello_tlsext(SSL *s); | 1107 | int ssl_prepare_clienthello_tlsext(SSL *s); |
1106 | int ssl_prepare_serverhello_tlsext(SSL *s); | 1108 | int ssl_prepare_serverhello_tlsext(SSL *s); |
1107 | int ssl_check_clienthello_tlsext_early(SSL *s); | 1109 | int ssl_check_clienthello_tlsext_early(SSL *s); |
@@ -1114,60 +1116,53 @@ int ssl_check_serverhello_tlsext(SSL *s); | |||
1114 | #define tlsext_tick_md EVP_sha256 | 1116 | #define tlsext_tick_md EVP_sha256 |
1115 | #endif | 1117 | #endif |
1116 | int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, | 1118 | int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, |
1117 | const unsigned char *limit, SSL_SESSION **ret); | 1119 | const unsigned char *limit, SSL_SESSION **ret); |
1118 | 1120 | ||
1119 | int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, | 1121 | int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, |
1120 | const EVP_MD *md); | 1122 | const EVP_MD *md); |
1121 | int tls12_get_sigid(const EVP_PKEY *pk); | 1123 | int tls12_get_sigid(const EVP_PKEY *pk); |
1122 | const EVP_MD *tls12_get_hash(unsigned char hash_alg); | 1124 | const EVP_MD *tls12_get_hash(unsigned char hash_alg); |
1123 | 1125 | ||
1124 | #endif | 1126 | #endif |
1125 | EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ; | 1127 | EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md); |
1126 | void ssl_clear_hash_ctx(EVP_MD_CTX **hash); | 1128 | void ssl_clear_hash_ctx(EVP_MD_CTX **hash); |
1127 | int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p, int *len, | 1129 | int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p, |
1128 | int maxlen); | 1130 | int *len, int maxlen); |
1129 | int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d, int len, | 1131 | int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d, |
1130 | int *al); | 1132 | int len, int *al); |
1131 | int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p, int *len, | 1133 | int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p, |
1132 | int maxlen); | 1134 | int *len, int maxlen); |
1133 | int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int len, | 1135 | int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, |
1134 | int *al); | 1136 | int len, int *al); |
1135 | long ssl_get_algorithm2(SSL *s); | 1137 | long ssl_get_algorithm2(SSL *s); |
1136 | int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize); | 1138 | int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize); |
1137 | int tls12_get_req_sig_algs(SSL *s, unsigned char *p); | 1139 | int tls12_get_req_sig_algs(SSL *s, unsigned char *p); |
1138 | 1140 | ||
1139 | int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); | 1141 | int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, |
1140 | int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); | 1142 | int *len, int maxlen); |
1141 | int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); | 1143 | int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, |
1142 | int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); | 1144 | int len, int *al); |
1145 | int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, | ||
1146 | int *len, int maxlen); | ||
1147 | int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, | ||
1148 | int len, int *al); | ||
1143 | 1149 | ||
1144 | /* s3_cbc.c */ | 1150 | /* s3_cbc.c */ |
1145 | void ssl3_cbc_copy_mac(unsigned char* out, | 1151 | void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, |
1146 | const SSL3_RECORD *rec, | 1152 | unsigned md_size, unsigned orig_len); |
1147 | unsigned md_size,unsigned orig_len); | 1153 | int ssl3_cbc_remove_padding(const SSL *s, SSL3_RECORD *rec, |
1148 | int ssl3_cbc_remove_padding(const SSL* s, | 1154 | unsigned block_size, unsigned mac_size); |
1149 | SSL3_RECORD *rec, | 1155 | int tls1_cbc_remove_padding(const SSL *s, SSL3_RECORD *rec, |
1150 | unsigned block_size, | 1156 | unsigned block_size, unsigned mac_size); |
1151 | unsigned mac_size); | ||
1152 | int tls1_cbc_remove_padding(const SSL* s, | ||
1153 | SSL3_RECORD *rec, | ||
1154 | unsigned block_size, | ||
1155 | unsigned mac_size); | ||
1156 | char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx); | 1157 | char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx); |
1157 | void ssl3_cbc_digest_record( | 1158 | void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out, |
1158 | const EVP_MD_CTX *ctx, | 1159 | size_t *md_out_size, const unsigned char header[13], |
1159 | unsigned char* md_out, | 1160 | const unsigned char *data, size_t data_plus_mac_size, |
1160 | size_t* md_out_size, | 1161 | size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret, |
1161 | const unsigned char header[13], | 1162 | unsigned mac_secret_length, char is_sslv3); |
1162 | const unsigned char *data, | 1163 | |
1163 | size_t data_plus_mac_size, | 1164 | void tls_fips_digest_extra(const EVP_CIPHER_CTX *cipher_ctx, |
1164 | size_t data_plus_mac_plus_padding_size, | 1165 | EVP_MD_CTX *mac_ctx, const unsigned char *data, size_t data_len, |
1165 | const unsigned char *mac_secret, | 1166 | size_t orig_len); |
1166 | unsigned mac_secret_length, | ||
1167 | char is_sslv3); | ||
1168 | |||
1169 | void tls_fips_digest_extra( | ||
1170 | const EVP_CIPHER_CTX *cipher_ctx, EVP_MD_CTX *mac_ctx, | ||
1171 | const unsigned char *data, size_t data_len, size_t orig_len); | ||
1172 | 1167 | ||
1173 | #endif | 1168 | #endif |