comparison common-kex.c @ 1899:ab9c5467970d

Merge pull request #152 from HansH111/tracelevel2
author Matt Johnston <matt@ucc.asn.au>
date Wed, 23 Mar 2022 21:55:33 +0800
parents 3bfacfc996cf
children 8b4274d34fe8
comparison
equal deleted inserted replaced
1890:45e552ee4391 1899:ab9c5467970d
867 /* kexguess2, ext-info-c, ext-info-s should not match negotiation */ 867 /* kexguess2, ext-info-c, ext-info-s should not match negotiation */
868 erralgo = "kex"; 868 erralgo = "kex";
869 goto error; 869 goto error;
870 } 870 }
871 TRACE(("kexguess2 %d", kexguess2)) 871 TRACE(("kexguess2 %d", kexguess2))
872 TRACE(("kex algo %s", algo->name)) 872 DEBUG3(("kex algo %s", algo->name))
873 ses.newkeys->algo_kex = algo->data; 873 ses.newkeys->algo_kex = algo->data;
874 874
875 /* server_host_key_algorithms */ 875 /* server_host_key_algorithms */
876 algo = buf_match_algo(ses.payload, sigalgs, kexguess2, &goodguess); 876 algo = buf_match_algo(ses.payload, sigalgs, kexguess2, &goodguess);
877 allgood &= goodguess; 877 allgood &= goodguess;
878 if (algo == NULL) { 878 if (algo == NULL) {
879 erralgo = "hostkey"; 879 erralgo = "hostkey";
880 goto error; 880 goto error;
881 } 881 }
882 TRACE(("signature algo %s", algo->name)) 882 DEBUG2(("hostkey algo %s", algo->name))
883 ses.newkeys->algo_signature = algo->val; 883 ses.newkeys->algo_signature = algo->val;
884 ses.newkeys->algo_hostkey = signkey_type_from_signature(ses.newkeys->algo_signature); 884 ses.newkeys->algo_hostkey = signkey_type_from_signature(ses.newkeys->algo_signature);
885 885
886 /* encryption_algorithms_client_to_server */ 886 /* encryption_algorithms_client_to_server */
887 c2s_cipher_algo = buf_match_algo(ses.payload, sshciphers, 0, NULL); 887 c2s_cipher_algo = buf_match_algo(ses.payload, sshciphers, 0, NULL);
888 if (c2s_cipher_algo == NULL) { 888 if (c2s_cipher_algo == NULL) {
889 erralgo = "enc c->s"; 889 erralgo = "enc c->s";
890 goto error; 890 goto error;
891 } 891 }
892 TRACE(("enc c2s is %s", c2s_cipher_algo->name)) 892 DEBUG2(("enc c2s is %s", c2s_cipher_algo->name))
893 893
894 /* encryption_algorithms_server_to_client */ 894 /* encryption_algorithms_server_to_client */
895 s2c_cipher_algo = buf_match_algo(ses.payload, sshciphers, 0, NULL); 895 s2c_cipher_algo = buf_match_algo(ses.payload, sshciphers, 0, NULL);
896 if (s2c_cipher_algo == NULL) { 896 if (s2c_cipher_algo == NULL) {
897 erralgo = "enc s->c"; 897 erralgo = "enc s->c";
898 goto error; 898 goto error;
899 } 899 }
900 TRACE(("enc s2c is %s", s2c_cipher_algo->name)) 900 DEBUG2(("enc s2c is %s", s2c_cipher_algo->name))
901 901
902 /* mac_algorithms_client_to_server */ 902 /* mac_algorithms_client_to_server */
903 c2s_hash_algo = buf_match_algo(ses.payload, sshhashes, 0, NULL); 903 c2s_hash_algo = buf_match_algo(ses.payload, sshhashes, 0, NULL);
904 #if DROPBEAR_AEAD_MODE 904 #if DROPBEAR_AEAD_MODE
905 if (((struct dropbear_cipher_mode*)c2s_cipher_algo->mode)->aead_crypt != NULL) { 905 if (((struct dropbear_cipher_mode*)c2s_cipher_algo->mode)->aead_crypt != NULL) {
908 #endif 908 #endif
909 if (c2s_hash_algo == NULL) { 909 if (c2s_hash_algo == NULL) {
910 erralgo = "mac c->s"; 910 erralgo = "mac c->s";
911 goto error; 911 goto error;
912 } 912 }
913 TRACE(("hash c2s is %s", c2s_hash_algo ? c2s_hash_algo->name : "<implicit>")) 913 DEBUG2(("hmac c2s is %s", c2s_hash_algo ? c2s_hash_algo->name : "<implicit>"))
914 914
915 /* mac_algorithms_server_to_client */ 915 /* mac_algorithms_server_to_client */
916 s2c_hash_algo = buf_match_algo(ses.payload, sshhashes, 0, NULL); 916 s2c_hash_algo = buf_match_algo(ses.payload, sshhashes, 0, NULL);
917 #if DROPBEAR_AEAD_MODE 917 #if DROPBEAR_AEAD_MODE
918 if (((struct dropbear_cipher_mode*)s2c_cipher_algo->mode)->aead_crypt != NULL) { 918 if (((struct dropbear_cipher_mode*)s2c_cipher_algo->mode)->aead_crypt != NULL) {
921 #endif 921 #endif
922 if (s2c_hash_algo == NULL) { 922 if (s2c_hash_algo == NULL) {
923 erralgo = "mac s->c"; 923 erralgo = "mac s->c";
924 goto error; 924 goto error;
925 } 925 }
926 TRACE(("hash s2c is %s", s2c_hash_algo ? s2c_hash_algo->name : "<implicit>")) 926 DEBUG2(("hmac s2c is %s", s2c_hash_algo ? s2c_hash_algo->name : "<implicit>"))
927 927
928 /* compression_algorithms_client_to_server */ 928 /* compression_algorithms_client_to_server */
929 c2s_comp_algo = buf_match_algo(ses.payload, ses.compress_algos, 0, NULL); 929 c2s_comp_algo = buf_match_algo(ses.payload, ses.compress_algos, 0, NULL);
930 if (c2s_comp_algo == NULL) { 930 if (c2s_comp_algo == NULL) {
931 erralgo = "comp c->s"; 931 erralgo = "comp c->s";
932 goto error; 932 goto error;
933 } 933 }
934 TRACE(("hash c2s is %s", c2s_comp_algo->name)) 934 DEBUG2(("comp c2s is %s", c2s_comp_algo->name))
935 935
936 /* compression_algorithms_server_to_client */ 936 /* compression_algorithms_server_to_client */
937 s2c_comp_algo = buf_match_algo(ses.payload, ses.compress_algos, 0, NULL); 937 s2c_comp_algo = buf_match_algo(ses.payload, ses.compress_algos, 0, NULL);
938 if (s2c_comp_algo == NULL) { 938 if (s2c_comp_algo == NULL) {
939 erralgo = "comp s->c"; 939 erralgo = "comp s->c";
940 goto error; 940 goto error;
941 } 941 }
942 TRACE(("hash s2c is %s", s2c_comp_algo->name)) 942 DEBUG2(("comp s2c is %s", s2c_comp_algo->name))
943 943
944 /* languages_client_to_server */ 944 /* languages_client_to_server */
945 buf_eatstring(ses.payload); 945 buf_eatstring(ses.payload);
946 946
947 /* languages_server_to_client */ 947 /* languages_server_to_client */