summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_locl.h
diff options
context:
space:
mode:
authorjsing <>2014-04-15 12:00:25 +0000
committerjsing <>2014-04-15 12:00:25 +0000
commit119df02356e2634a1f38a23d288d8774e841e5f7 (patch)
tree3ba45c8dc0a2bcf26ddd859d8ee8c4dfb1b8e4b2 /src/lib/libssl/ssl_locl.h
parentab563839bbe3ddf11336b51c80c7fb09adb04abb (diff)
downloadopenbsd-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.h263
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
483typedef struct cert_pkey_st 483typedef 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
491typedef struct cert_st 490typedef 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
525typedef struct sess_cert_st 523typedef 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 :-) */
571typedef struct ssl3_enc_method 568typedef 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 */
594typedef struct ssl3_comp_st 590typedef 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
603typedef struct ssl3_buf_freelist_st 598typedef 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
610typedef struct ssl3_buf_freelist_entry_st 604typedef 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
616extern SSL3_ENC_METHOD ssl3_undef_enc_method; 609extern SSL3_ENC_METHOD ssl3_undef_enc_method;
@@ -822,32 +815,33 @@ SESS_CERT *ssl_sess_cert_new(void);
822void ssl_sess_cert_free(SESS_CERT *sc); 815void ssl_sess_cert_free(SESS_CERT *sc);
823int ssl_set_peer_cert_type(SESS_CERT *c, int type); 816int ssl_set_peer_cert_type(SESS_CERT *c, int type);
824int ssl_get_new_session(SSL *s, int session); 817int ssl_get_new_session(SSL *s, int session);
825int ssl_get_prev_session(SSL *s, unsigned char *session,int len, const unsigned char *limit); 818int ssl_get_prev_session(SSL *s, unsigned char *session, int len,
826int ssl_cipher_id_cmp(const SSL_CIPHER *a,const SSL_CIPHER *b); 819 const unsigned char *limit);
827DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, 820int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b);
828 ssl_cipher_id); 821DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id);
829int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, 822int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
830 const SSL_CIPHER * const *bp); 823 const SSL_CIPHER * const *bp);
831STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, 824STACK_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);
833int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p, 826int 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 *));
835STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, 828STACK_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);
839void ssl_update_cache(SSL *s, int mode); 831void ssl_update_cache(SSL *s, int mode);
840int ssl_cipher_get_evp(const SSL_SESSION *s,const EVP_CIPHER **enc, 832int 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,
842int ssl_get_handshake_digest(int i,long *mask,const EVP_MD **md); 834 SSL_COMP **comp);
843int ssl_verify_cert_chain(SSL *s,STACK_OF(X509) *sk); 835int ssl_get_handshake_digest(int i, long *mask, const EVP_MD **md);
836
837int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk);
844int ssl_undefined_function(SSL *s); 838int ssl_undefined_function(SSL *s);
845int ssl_undefined_void_function(void); 839int ssl_undefined_void_function(void);
846int ssl_undefined_const_function(const SSL *s); 840int ssl_undefined_const_function(const SSL *s);
847CERT_PKEY *ssl_get_server_send_pkey(const SSL *s); 841CERT_PKEY *ssl_get_server_send_pkey(const SSL *s);
848X509 *ssl_get_server_send_cert(const SSL *); 842X509 *ssl_get_server_send_cert(const SSL *);
849EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *c, const EVP_MD **pmd); 843EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *c, const EVP_MD **pmd);
850int ssl_cert_type(X509 *x,EVP_PKEY *pkey); 844int ssl_cert_type(X509 *x, EVP_PKEY *pkey);
851void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); 845void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher);
852STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); 846STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s);
853int ssl_verify_alarm_type(long type); 847int 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
857int ssl2_enc_init(SSL *s, int client); 851int ssl2_enc_init(SSL *s, int client);
858int ssl2_generate_key_material(SSL *s); 852int ssl2_generate_key_material(SSL *s);
859void ssl2_enc(SSL *s,int send_data); 853void ssl2_enc(SSL *s, int send_data);
860void ssl2_mac(SSL *s,unsigned char *mac,int send_data); 854void ssl2_mac(SSL *s, unsigned char *mac, int send_data);
861const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p); 855const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p);
862int ssl2_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); 856int ssl2_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
863int ssl2_part_read(SSL *s, unsigned long f, int i); 857int ssl2_part_read(SSL *s, unsigned long f, int i);
864int ssl2_do_write(SSL *s); 858int ssl2_do_write(SSL *s);
865int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data); 859int ssl2_set_certificate(SSL *s, int type, int len, const unsigned char *data);
866void ssl2_return_error(SSL *s,int reason); 860void ssl2_return_error(SSL *s, int reason);
867void ssl2_write_error(SSL *s); 861void ssl2_write_error(SSL *s);
868int ssl2_num_ciphers(void); 862int ssl2_num_ciphers(void);
869const SSL_CIPHER *ssl2_get_cipher(unsigned int u); 863const SSL_CIPHER *ssl2_get_cipher(unsigned int u);
@@ -876,47 +870,50 @@ int ssl2_peek(SSL *s, void *buf, int len);
876int ssl2_write(SSL *s, const void *buf, int len); 870int ssl2_write(SSL *s, const void *buf, int len);
877int ssl2_shutdown(SSL *s); 871int ssl2_shutdown(SSL *s);
878void ssl2_clear(SSL *s); 872void ssl2_clear(SSL *s);
879long ssl2_ctrl(SSL *s,int cmd, long larg, void *parg); 873long ssl2_ctrl(SSL *s, int cmd, long larg, void *parg);
880long ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); 874long ssl2_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg);
881long ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 875long ssl2_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
882long ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void)); 876long ssl2_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void));
883int ssl2_pending(const SSL *s); 877int ssl2_pending(const SSL *s);
884long ssl2_default_timeout(void ); 878long ssl2_default_timeout(void );
885 879
886const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); 880const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
887int ssl3_put_cipher_by_char(const SSL_CIPHER *c,unsigned char *p); 881int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
888void ssl3_init_finished_mac(SSL *s); 882void ssl3_init_finished_mac(SSL *s);
889int ssl3_send_server_certificate(SSL *s); 883int ssl3_send_server_certificate(SSL *s);
890int ssl3_send_newsession_ticket(SSL *s); 884int ssl3_send_newsession_ticket(SSL *s);
891int ssl3_send_cert_status(SSL *s); 885int ssl3_send_cert_status(SSL *s);
892int ssl3_get_finished(SSL *s,int state_a,int state_b); 886int ssl3_get_finished(SSL *s, int state_a, int state_b);
893int ssl3_setup_key_block(SSL *s); 887int ssl3_setup_key_block(SSL *s);
894int ssl3_send_change_cipher_spec(SSL *s,int state_a,int state_b); 888int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b);
895int ssl3_change_cipher_state(SSL *s,int which); 889int ssl3_change_cipher_state(SSL *s, int which);
896void ssl3_cleanup_key_block(SSL *s); 890void ssl3_cleanup_key_block(SSL *s);
897int ssl3_do_write(SSL *s,int type); 891int ssl3_do_write(SSL *s, int type);
898int ssl3_send_alert(SSL *s,int level, int desc); 892int ssl3_send_alert(SSL *s, int level, int desc);
899int ssl3_generate_master_secret(SSL *s, unsigned char *out, 893int ssl3_generate_master_secret(SSL *s, unsigned char *out,
900 unsigned char *p, int len); 894 unsigned char *p, int len);
901int ssl3_get_req_cert_type(SSL *s,unsigned char *p); 895int ssl3_get_req_cert_type(SSL *s, unsigned char *p);
902long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); 896long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
903int ssl3_send_finished(SSL *s, int a, int b, const char *sender,int slen); 897int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen);
904int ssl3_num_ciphers(void); 898int ssl3_num_ciphers(void);
905const SSL_CIPHER *ssl3_get_cipher(unsigned int u); 899const SSL_CIPHER *ssl3_get_cipher(unsigned int u);
906int ssl3_renegotiate(SSL *ssl); 900int ssl3_renegotiate(SSL *ssl);
907int ssl3_renegotiate_check(SSL *ssl); 901
902int ssl3_renegotiate_check(SSL *ssl);
903
908int ssl3_dispatch_alert(SSL *s); 904int ssl3_dispatch_alert(SSL *s);
909int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 905int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
910int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); 906int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
911int ssl3_final_finish_mac(SSL *s, const char *sender, int slen,unsigned char *p); 907int ssl3_final_finish_mac(SSL *s, const char *sender, int slen,
908 unsigned char *p);
912int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); 909int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p);
913void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len); 910void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len);
914int ssl3_enc(SSL *s, int send_data); 911int ssl3_enc(SSL *s, int send_data);
915int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data); 912int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data);
916void ssl3_free_digest_list(SSL *s); 913void ssl3_free_digest_list(SSL *s);
917unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); 914unsigned long ssl3_output_cert_chain(SSL *s, X509 *x);
918SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,STACK_OF(SSL_CIPHER) *clnt, 915SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt,
919 STACK_OF(SSL_CIPHER) *srvr); 916 STACK_OF(SSL_CIPHER) *srvr);
920int ssl3_setup_buffers(SSL *s); 917int ssl3_setup_buffers(SSL *s);
921int ssl3_setup_read_buffer(SSL *s); 918int ssl3_setup_read_buffer(SSL *s);
922int ssl3_setup_write_buffer(SSL *s); 919int ssl3_setup_write_buffer(SSL *s);
@@ -932,10 +929,10 @@ int ssl3_peek(SSL *s, void *buf, int len);
932int ssl3_write(SSL *s, const void *buf, int len); 929int ssl3_write(SSL *s, const void *buf, int len);
933int ssl3_shutdown(SSL *s); 930int ssl3_shutdown(SSL *s);
934void ssl3_clear(SSL *s); 931void ssl3_clear(SSL *s);
935long ssl3_ctrl(SSL *s,int cmd, long larg, void *parg); 932long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg);
936long ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg); 933long ssl3_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg);
937long ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 934long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
938long ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)(void)); 935long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void));
939int ssl3_pending(const SSL *s); 936int ssl3_pending(const SSL *s);
940 937
941void ssl3_record_sequence_update(unsigned char *seq); 938void ssl3_record_sequence_update(unsigned char *seq);
@@ -952,16 +949,16 @@ const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p);
952long ssl23_default_timeout(void ); 949long ssl23_default_timeout(void );
953 950
954long tls1_default_timeout(void); 951long tls1_default_timeout(void);
955int dtls1_do_write(SSL *s,int type); 952int dtls1_do_write(SSL *s, int type);
956int ssl3_read_n(SSL *s, int n, int max, int extend); 953int ssl3_read_n(SSL *s, int n, int max, int extend);
957int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 954int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
958int ssl3_do_compress(SSL *ssl); 955int ssl3_do_compress(SSL *ssl);
959int ssl3_do_uncompress(SSL *ssl); 956int ssl3_do_uncompress(SSL *ssl);
960int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, 957int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
961 unsigned int len); 958 unsigned int len);
962unsigned char *dtls1_set_message_header(SSL *s, 959unsigned 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
966int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len); 963int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len);
967int dtls1_write_bytes(SSL *s, int type, const void *buf, int len); 964int 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);
971unsigned long dtls1_output_cert_chain(SSL *s, X509 *x); 968unsigned long dtls1_output_cert_chain(SSL *s, X509 *x);
972int dtls1_read_failed(SSL *s, int code); 969int dtls1_read_failed(SSL *s, int code);
973int dtls1_buffer_message(SSL *s, int ccs); 970int dtls1_buffer_message(SSL *s, int ccs);
974int dtls1_retransmit_message(SSL *s, unsigned short seq, 971int dtls1_retransmit_message(SSL *s, unsigned short seq,
975 unsigned long frag_off, int *found); 972 unsigned long frag_off, int *found);
976int dtls1_get_queue_priority(unsigned short seq, int is_ccs); 973int dtls1_get_queue_priority(unsigned short seq, int is_ccs);
977int dtls1_retransmit_buffered_messages(SSL *s); 974int dtls1_retransmit_buffered_messages(SSL *s);
978void dtls1_clear_record_buffer(SSL *s); 975void dtls1_clear_record_buffer(SSL *s);
@@ -1049,21 +1046,21 @@ int ssl23_write_bytes(SSL *s);
1049int tls1_new(SSL *s); 1046int tls1_new(SSL *s);
1050void tls1_free(SSL *s); 1047void tls1_free(SSL *s);
1051void tls1_clear(SSL *s); 1048void tls1_clear(SSL *s);
1052long tls1_ctrl(SSL *s,int cmd, long larg, void *parg); 1049long tls1_ctrl(SSL *s, int cmd, long larg, void *parg);
1053long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); 1050long tls1_callback_ctrl(SSL *s, int cmd, void (*fp)(void));
1054 1051
1055int dtls1_new(SSL *s); 1052int dtls1_new(SSL *s);
1056int dtls1_accept(SSL *s); 1053int dtls1_accept(SSL *s);
1057int dtls1_connect(SSL *s); 1054int dtls1_connect(SSL *s);
1058void dtls1_free(SSL *s); 1055void dtls1_free(SSL *s);
1059void dtls1_clear(SSL *s); 1056void dtls1_clear(SSL *s);
1060long dtls1_ctrl(SSL *s,int cmd, long larg, void *parg); 1057long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg);
1061int dtls1_shutdown(SSL *s); 1058int dtls1_shutdown(SSL *s);
1062 1059
1063long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); 1060long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok);
1064int dtls1_get_record(SSL *s); 1061int dtls1_get_record(SSL *s);
1065int do_dtls1_write(SSL *s, int type, const unsigned char *buf, 1062int 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);
1067int dtls1_dispatch_alert(SSL *s); 1064int dtls1_dispatch_alert(SSL *s);
1068int dtls1_enc(SSL *s, int snd); 1065int dtls1_enc(SSL *s, int snd);
1069 1066
@@ -1073,15 +1070,14 @@ void ssl_free_wbio_buffer(SSL *s);
1073int tls1_change_cipher_state(SSL *s, int which); 1070int tls1_change_cipher_state(SSL *s, int which);
1074int tls1_setup_key_block(SSL *s); 1071int tls1_setup_key_block(SSL *s);
1075int tls1_enc(SSL *s, int snd); 1072int tls1_enc(SSL *s, int snd);
1076int tls1_final_finish_mac(SSL *s, 1073int tls1_final_finish_mac(SSL *s, const char *str, int slen, unsigned char *p);
1077 const char *str, int slen, unsigned char *p);
1078int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); 1074int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p);
1079int tls1_mac(SSL *ssl, unsigned char *md, int snd); 1075int tls1_mac(SSL *ssl, unsigned char *md, int snd);
1080int tls1_generate_master_secret(SSL *s, unsigned char *out, 1076int tls1_generate_master_secret(SSL *s, unsigned char *out,
1081 unsigned char *p, int len); 1077 unsigned char *p, int len);
1082int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, 1078int 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);
1085int tls1_alert_code(int code); 1081int tls1_alert_code(int code);
1086int ssl3_alert_code(int code); 1082int ssl3_alert_code(int code);
1087int ssl_ok(SSL *s); 1083int 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
1101unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 1097unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p,
1102unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 1098 unsigned char *limit);
1103int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); 1099
1104int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al); 1100unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p,
1101 unsigned char *limit);
1102
1103int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data,
1104 unsigned char *d, int n, int *al);
1105int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data,
1106 unsigned char *d, int n, int *al);
1105int ssl_prepare_clienthello_tlsext(SSL *s); 1107int ssl_prepare_clienthello_tlsext(SSL *s);
1106int ssl_prepare_serverhello_tlsext(SSL *s); 1108int ssl_prepare_serverhello_tlsext(SSL *s);
1107int ssl_check_clienthello_tlsext_early(SSL *s); 1109int 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
1116int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, 1118int 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
1119int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, 1121int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk,
1120 const EVP_MD *md); 1122 const EVP_MD *md);
1121int tls12_get_sigid(const EVP_PKEY *pk); 1123int tls12_get_sigid(const EVP_PKEY *pk);
1122const EVP_MD *tls12_get_hash(unsigned char hash_alg); 1124const EVP_MD *tls12_get_hash(unsigned char hash_alg);
1123 1125
1124#endif 1126#endif
1125EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ; 1127EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md);
1126void ssl_clear_hash_ctx(EVP_MD_CTX **hash); 1128void ssl_clear_hash_ctx(EVP_MD_CTX **hash);
1127int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p, int *len, 1129int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p,
1128 int maxlen); 1130 int *len, int maxlen);
1129int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d, int len, 1131int ssl_parse_serverhello_renegotiate_ext(SSL *s, unsigned char *d,
1130 int *al); 1132 int len, int *al);
1131int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p, int *len, 1133int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p,
1132 int maxlen); 1134 int *len, int maxlen);
1133int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int len, 1135int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d,
1134 int *al); 1136 int len, int *al);
1135long ssl_get_algorithm2(SSL *s); 1137long ssl_get_algorithm2(SSL *s);
1136int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize); 1138int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize);
1137int tls12_get_req_sig_algs(SSL *s, unsigned char *p); 1139int tls12_get_req_sig_algs(SSL *s, unsigned char *p);
1138 1140
1139int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); 1141int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p,
1140int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); 1142 int *len, int maxlen);
1141int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen); 1143int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d,
1142int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al); 1144 int len, int *al);
1145int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p,
1146 int *len, int maxlen);
1147int 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 */
1145void ssl3_cbc_copy_mac(unsigned char* out, 1151void 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); 1153int ssl3_cbc_remove_padding(const SSL *s, SSL3_RECORD *rec,
1148int ssl3_cbc_remove_padding(const SSL* s, 1154 unsigned block_size, unsigned mac_size);
1149 SSL3_RECORD *rec, 1155int 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);
1152int tls1_cbc_remove_padding(const SSL* s,
1153 SSL3_RECORD *rec,
1154 unsigned block_size,
1155 unsigned mac_size);
1156char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx); 1157char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx);
1157void ssl3_cbc_digest_record( 1158void 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, 1164void 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
1169void 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