aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/tls/gnutls_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/tls/gnutls_state.c')
-rw-r--r--src/daemon/https/tls/gnutls_state.c72
1 files changed, 37 insertions, 35 deletions
diff --git a/src/daemon/https/tls/gnutls_state.c b/src/daemon/https/tls/gnutls_state.c
index 49802b2e..4f4ea122 100644
--- a/src/daemon/https/tls/gnutls_state.c
+++ b/src/daemon/https/tls/gnutls_state.c
@@ -44,7 +44,7 @@
44 44
45void 45void
46MHD__gnutls_session_cert_type_set (MHD_gtls_session_t session, 46MHD__gnutls_session_cert_type_set (MHD_gtls_session_t session,
47 enum MHD_GNUTLS_CertificateType ct) 47 enum MHD_GNUTLS_CertificateType ct)
48{ 48{
49 session->security_parameters.cert_type = ct; 49 session->security_parameters.cert_type = ct;
50} 50}
@@ -236,7 +236,7 @@ MHD_gtls_handshake_internal_state_clear (MHD_gtls_session_t session)
236/* TODO rm redundent pointer ref */ 236/* TODO rm redundent pointer ref */
237int 237int
238MHD__gnutls_init (MHD_gtls_session_t * session, 238MHD__gnutls_init (MHD_gtls_session_t * session,
239 MHD_gnutls_connection_end_t con_end) 239 MHD_gnutls_connection_end_t con_end)
240{ 240{
241 *session = MHD_gnutls_calloc (1, sizeof (struct MHD_gtls_session_int)); 241 *session = MHD_gnutls_calloc (1, sizeof (struct MHD_gtls_session_int));
242 if (*session == NULL) 242 if (*session == NULL)
@@ -286,10 +286,10 @@ MHD__gnutls_init (MHD_gtls_session_t * session,
286 286
287 MHD__gnutls_dh_set_prime_bits ((*session), MIN_DH_BITS); 287 MHD__gnutls_dh_set_prime_bits ((*session), MIN_DH_BITS);
288 288
289 MHD__gnutls_transport_set_lowat ((*session), DEFAULT_LOWAT); /* the default for tcp */ 289 MHD__gnutls_transport_set_lowat ((*session), DEFAULT_LOWAT); /* the default for tcp */
290 290
291 MHD__gnutls_handshake_set_max_packet_length ((*session), 291 MHD__gnutls_handshake_set_max_packet_length ((*session),
292 MAX_HANDSHAKE_PACKET_SIZE); 292 MAX_HANDSHAKE_PACKET_SIZE);
293 293
294 /* Allocate a minimum size for recv_data 294 /* Allocate a minimum size for recv_data
295 * This is allocated in order to avoid small messages, making 295 * This is allocated in order to avoid small messages, making
@@ -612,7 +612,7 @@ MHD_gtls_dh_set_group (MHD_gtls_session_t session, mpi_t gen, mpi_t prime)
612 **/ 612 **/
613void 613void
614MHD__gnutls_certificate_send_x509_rdn_sequence (MHD_gtls_session_t session, 614MHD__gnutls_certificate_send_x509_rdn_sequence (MHD_gtls_session_t session,
615 int status) 615 int status)
616{ 616{
617 session->internals.ignore_rdn_sequence = status; 617 session->internals.ignore_rdn_sequence = status;
618} 618}
@@ -630,7 +630,8 @@ MHD__gnutls_certificate_send_x509_rdn_sequence (MHD_gtls_session_t session,
630 -*/ 630 -*/
631void 631void
632MHD__gnutls_record_set_default_version (MHD_gtls_session_t session, 632MHD__gnutls_record_set_default_version (MHD_gtls_session_t session,
633 unsigned char major, unsigned char minor) 633 unsigned char major,
634 unsigned char minor)
634{ 635{
635 session->internals.default_record_version[0] = major; 636 session->internals.default_record_version[0] = major;
636 session->internals.default_record_version[1] = minor; 637 session->internals.default_record_version[1] = minor;
@@ -661,9 +662,9 @@ MHD_gtls_handshake_set_private_extensions (MHD_gtls_session_t session,
661 662
662inline static int 663inline static int
663MHD__gnutls_cal_PRF_A (enum MHD_GNUTLS_HashAlgorithm algorithm, 664MHD__gnutls_cal_PRF_A (enum MHD_GNUTLS_HashAlgorithm algorithm,
664 const void *secret, 665 const void *secret,
665 int secret_size, 666 int secret_size,
666 const void *seed, int seed_size, void *result) 667 const void *seed, int seed_size, void *result)
667{ 668{
668 mac_hd_t td1; 669 mac_hd_t td1;
669 670
@@ -687,10 +688,10 @@ MHD__gnutls_cal_PRF_A (enum MHD_GNUTLS_HashAlgorithm algorithm,
687 */ 688 */
688static int 689static int
689MHD__gnutls_P_hash (enum MHD_GNUTLS_HashAlgorithm algorithm, 690MHD__gnutls_P_hash (enum MHD_GNUTLS_HashAlgorithm algorithm,
690 const opaque * secret, 691 const opaque * secret,
691 int secret_size, 692 int secret_size,
692 const opaque * seed, 693 const opaque * seed,
693 int seed_size, int total_bytes, opaque * ret) 694 int seed_size, int total_bytes, opaque * ret)
694{ 695{
695 696
696 mac_hd_t td2; 697 mac_hd_t td2;
@@ -730,8 +731,9 @@ MHD__gnutls_P_hash (enum MHD_GNUTLS_HashAlgorithm algorithm,
730 } 731 }
731 732
732 /* here we calculate A(i+1) */ 733 /* here we calculate A(i+1) */
733 if ((result = MHD__gnutls_cal_PRF_A (algorithm, secret, secret_size, Atmp, 734 if ((result =
734 A_size, Atmp)) < 0) 735 MHD__gnutls_cal_PRF_A (algorithm, secret, secret_size, Atmp,
736 A_size, Atmp)) < 0)
735 { 737 {
736 MHD_gnutls_assert (); 738 MHD_gnutls_assert ();
737 MHD_gnutls_MHD_hmac_deinit (td2, final); 739 MHD_gnutls_MHD_hmac_deinit (td2, final);
@@ -816,7 +818,7 @@ MHD_gtls_PRF (MHD_gtls_session_t session,
816 { 818 {
817 result = 819 result =
818 MHD__gnutls_P_hash (MHD_GNUTLS_MAC_SHA1, secret, secret_size, s_seed, 820 MHD__gnutls_P_hash (MHD_GNUTLS_MAC_SHA1, secret, secret_size, s_seed,
819 s_seed_size, total_bytes, ret); 821 s_seed_size, total_bytes, ret);
820 if (result < 0) 822 if (result < 0)
821 { 823 {
822 MHD_gnutls_assert (); 824 MHD_gnutls_assert ();
@@ -837,7 +839,7 @@ MHD_gtls_PRF (MHD_gtls_session_t session,
837 839
838 result = 840 result =
839 MHD__gnutls_P_hash (MHD_GNUTLS_MAC_MD5, s1, l_s, s_seed, s_seed_size, 841 MHD__gnutls_P_hash (MHD_GNUTLS_MAC_MD5, s1, l_s, s_seed, s_seed_size,
840 total_bytes, o1); 842 total_bytes, o1);
841 if (result < 0) 843 if (result < 0)
842 { 844 {
843 MHD_gnutls_assert (); 845 MHD_gnutls_assert ();
@@ -846,7 +848,7 @@ MHD_gtls_PRF (MHD_gtls_session_t session,
846 848
847 result = 849 result =
848 MHD__gnutls_P_hash (MHD_GNUTLS_MAC_SHA1, s2, l_s, s_seed, s_seed_size, 850 MHD__gnutls_P_hash (MHD_GNUTLS_MAC_SHA1, s2, l_s, s_seed, s_seed_size,
849 total_bytes, o2); 851 total_bytes, o2);
850 if (result < 0) 852 if (result < 0)
851 { 853 {
852 MHD_gnutls_assert (); 854 MHD_gnutls_assert ();
@@ -893,10 +895,10 @@ MHD_gtls_PRF (MHD_gtls_session_t session,
893 **/ 895 **/
894int 896int
895MHD__gnutls_prf_raw (MHD_gtls_session_t session, 897MHD__gnutls_prf_raw (MHD_gtls_session_t session,
896 size_t label_size, 898 size_t label_size,
897 const char *label, 899 const char *label,
898 size_t seed_size, const char *seed, size_t outsize, 900 size_t seed_size, const char *seed, size_t outsize,
899 char *out) 901 char *out)
900{ 902{
901 int ret; 903 int ret;
902 904
@@ -938,11 +940,11 @@ MHD__gnutls_prf_raw (MHD_gtls_session_t session,
938 **/ 940 **/
939int 941int
940MHD__gnutls_prf (MHD_gtls_session_t session, 942MHD__gnutls_prf (MHD_gtls_session_t session,
941 size_t label_size, 943 size_t label_size,
942 const char *label, 944 const char *label,
943 int server_random_first, 945 int server_random_first,
944 size_t extra_size, const char *extra, size_t outsize, 946 size_t extra_size, const char *extra, size_t outsize,
945 char *out) 947 char *out)
946{ 948{
947 int ret; 949 int ret;
948 opaque *seed; 950 opaque *seed;
@@ -1050,8 +1052,8 @@ MHD_gtls_session_is_resumed (MHD_gtls_session_t session)
1050 && session->security_parameters.session_id_size 1052 && session->security_parameters.session_id_size
1051 == session->internals.resumed_security_parameters.session_id_size 1053 == session->internals.resumed_security_parameters.session_id_size
1052 && memcmp (session->security_parameters.session_id, 1054 && memcmp (session->security_parameters.session_id,
1053 session->internals.resumed_security_parameters. 1055 session->internals.
1054 session_id, 1056 resumed_security_parameters.session_id,
1055 session->security_parameters.session_id_size) == 0) 1057 session->security_parameters.session_id_size) == 0)
1056 return 1; 1058 return 1;
1057 } 1059 }
@@ -1078,8 +1080,8 @@ MHD_gtls_session_is_export (MHD_gtls_session_t session)
1078 enum MHD_GNUTLS_CipherAlgorithm cipher; 1080 enum MHD_GNUTLS_CipherAlgorithm cipher;
1079 1081
1080 cipher = 1082 cipher =
1081 MHD_gtls_cipher_suite_get_cipher_algo (&session->security_parameters. 1083 MHD_gtls_cipher_suite_get_cipher_algo (&session->
1082 current_cipher_suite); 1084 security_parameters.current_cipher_suite);
1083 1085
1084 if (MHD_gtls_cipher_get_export_flag (cipher) != 0) 1086 if (MHD_gtls_cipher_get_export_flag (cipher) != 0)
1085 return 1; 1087 return 1;
@@ -1151,7 +1153,7 @@ MHD__gnutls_record_get_direction (MHD_gtls_session_t session)
1151 -*/ 1153 -*/
1152void 1154void
1153MHD__gnutls_rsa_pms_set_version (MHD_gtls_session_t session, 1155MHD__gnutls_rsa_pms_set_version (MHD_gtls_session_t session,
1154 unsigned char major, unsigned char minor) 1156 unsigned char major, unsigned char minor)
1155{ 1157{
1156 session->internals.rsa_pms_version[0] = major; 1158 session->internals.rsa_pms_version[0] = major;
1157 session->internals.rsa_pms_version[1] = minor; 1159 session->internals.rsa_pms_version[1] = minor;
@@ -1181,9 +1183,9 @@ MHD__gnutls_rsa_pms_set_version (MHD_gtls_session_t session,
1181 **/ 1183 **/
1182void 1184void
1183MHD__gnutls_handshake_set_post_client_hello_function (MHD_gtls_session_t 1185MHD__gnutls_handshake_set_post_client_hello_function (MHD_gtls_session_t
1184 session, 1186 session,
1185 MHD_gnutls_handshake_post_client_hello_func 1187 MHD_gnutls_handshake_post_client_hello_func
1186 func) 1188 func)
1187{ 1189{
1188 session->internals.user_hello_func = func; 1190 session->internals.user_hello_func = func;
1189} 1191}