Changeset 133 for trunk/src/sh_forward.c
- Timestamp:
- Oct 25, 2007, 12:19:05 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_forward.c
r132 r133 890 890 891 891 static time_t timeout_val = 1; 892 char hashbuf[KEYBUF_SIZE]; 893 char sigbuf[KEYBUF_SIZE]; 892 894 893 895 SL_ENTER(_("sh_forward_try_impl")); … … 1016 1018 sh_tiger_hash((char *) &ticks, 1017 1019 TIGER_DATA, 1018 (unsigned long)sizeof(UINT32)), 1020 (unsigned long)sizeof(UINT32), 1021 hashbuf, sizeof(hashbuf)), 1019 1022 KEY_LEN+1); 1020 1023 … … 1026 1029 sh_tiger_hash(temp, 1027 1030 TIGER_DATA, 1028 (unsigned long)sl_strlen(temp)), 1031 (unsigned long)sl_strlen(temp), 1032 hashbuf, sizeof(hashbuf)), 1029 1033 KEY_LEN+1); 1030 1034 sh_passwd (temp, NULL, NULL, foo_M1); … … 1163 1167 else /* if (0 != sh_srp_check_zero (answer)) */ 1164 1168 { 1165 sl_strlcpy(u_real, sh_tiger_hash(head_u, TIGER_DATA, 4), 1169 sl_strlcpy(u_real, sh_tiger_hash(head_u, TIGER_DATA, 4, 1170 hashbuf, sizeof(hashbuf)), 1166 1171 SH_CHALLENGE_SIZE); 1167 1172 foo_Sc = sh_srp_S_c (u_real, answer); … … 1176 1181 if (foo_Sc != NULL) 1177 1182 { 1178 sl_strlcpy(foo_M1, 1179 sh_srp_M(foo_A, 1180 answer, 1181 sh_tiger_hash(foo_Sc, 1182 TIGER_DATA, 1183 sl_strlen(foo_Sc))), 1184 KEY_LEN+1); 1183 sh_srp_M(foo_A, 1184 answer, 1185 sh_tiger_hash(foo_Sc, 1186 TIGER_DATA, 1187 sl_strlen(foo_Sc), 1188 hashbuf, sizeof(hashbuf)), 1189 foo_M1, KEY_LEN+1); 1190 1185 1191 1186 1192 TPT(( 0, FIL__, __LINE__, _("msg=<srp:M1 = %s>\n"), … … 1213 1219 /* ------ verify M2 = H(A, M1, K) -------- 1214 1220 */ 1221 char M_buf[KEY_LEN+1]; 1215 1222 M = sh_srp_M (foo_A, foo_M1, 1216 1223 sh_tiger_hash(foo_Sc, 1217 1224 TIGER_DATA, 1218 sl_strlen(foo_Sc))); 1225 sl_strlen(foo_Sc), 1226 hashbuf, sizeof(hashbuf)), 1227 M_buf, sizeof(M_buf) 1228 ); 1219 1229 if (M != NULL && 1220 1230 0 == sl_strncmp (answer, M, KEY_LEN+1)) … … 1223 1233 sh_tiger_hash(foo_Sc, 1224 1234 TIGER_DATA, 1225 sl_strlen(foo_Sc)), 1235 sl_strlen(foo_Sc), 1236 hashbuf, sizeof(hashbuf)), 1226 1237 KEY_LEN+1); 1227 1238 TPT(( 0, FIL__, __LINE__, … … 1301 1312 (void) sl_strlcpy (answer, sh_util_siggen(skey->session, 1302 1313 sh.host.name, 1303 sl_strlen(sh.host.name)), 1314 sl_strlen(sh.host.name), 1315 sigbuf, sizeof(sigbuf)), 1304 1316 KEY_LEN+1); 1305 1317 TPT((0, FIL__, __LINE__, _("msg=<host %s>\n"), sh.host.name)); … … 1373 1385 sh_util_siggen (skey->session, 1374 1386 buffer, 1375 sl_strlen(buffer)), 1387 sl_strlen(buffer), 1388 sigbuf, sizeof(sigbuf)), 1376 1389 KEY_LEN+1); 1377 1390 TPT((0, FIL__, __LINE__, _("msg=<sign %s.>\n"), 1378 1391 sh_util_siggen(skey->session, buffer, 1379 sl_strlen(buffer) )));1392 sl_strlen(buffer), sigbuf, sizeof(sigbuf)))); 1380 1393 1381 1394 (void) sl_strlcpy(buffer, errmsg, len); … … 1439 1452 sh_util_siggen(skey->session, 1440 1453 buffer, 1441 sl_strlen(buffer)), 1454 sl_strlen(buffer), 1455 sigbuf, sizeof(sigbuf)), 1442 1456 KEY_LEN); 1443 1457 TPT((0, FIL__, __LINE__, _("msg=<sign %s.>\n"), 1444 1458 sh_util_siggen(skey->session, buffer, 1445 sl_strlen(buffer) )));1459 sl_strlen(buffer), sigbuf, sizeof(sigbuf)))); 1446 1460 1447 1461 if (flag_err != 0) … … 1473 1487 sh_util_siggen(skey->session, 1474 1488 buffer, 1475 pos), 1489 pos, 1490 sigbuf, sizeof(sigbuf)), 1476 1491 KEY_LEN); 1477 1492 … … 1583 1598 sh_tiger_hash((char *) &ticks, 1584 1599 TIGER_DATA, 1585 (unsigned long)sizeof(UINT32)), 1600 (unsigned long)sizeof(UINT32), 1601 hashbuf, sizeof(hashbuf)), 1586 1602 KEY_LEN+1); 1587 1603 … … 1592 1608 (void)sl_strlcpy(foo_M1, 1593 1609 sh_tiger_hash(buffer, TIGER_DATA, 1594 (unsigned long)sl_strlen(buffer)), 1610 (unsigned long)sl_strlen(buffer), 1611 hashbuf, sizeof(hashbuf)), 1595 1612 KEY_LEN+1); 1596 1613 memset (buffer, 0, sl_strlen(buffer)); … … 1773 1790 unsigned char in[PW_LEN+1]; 1774 1791 int i = 0, j, k, l = 0; 1792 char hashbuf[KEYBUF_SIZE]; 1775 1793 1776 1794 if (sl_strlen(str) != (PW_LEN * 2)) … … 1800 1818 1801 1819 sl_strlcpy ((char *)key, 1802 sh_tiger_hash ((char*)in, TIGER_DATA, PW_LEN), 1820 sh_tiger_hash ((char*)in, TIGER_DATA, PW_LEN, 1821 hashbuf, sizeof(hashbuf)), 1803 1822 KEY_LEN+1); 1804 1823 key[KEY_LEN] = '\0'; … … 1822 1841 char in[PW_LEN]; 1823 1842 int i = 0, j, k, l = 0; 1843 char hashbuf[KEYBUF_SIZE]; 1824 1844 1825 1845 if (sl_strlen(str) != (PW_LEN*2)) … … 1851 1871 { 1852 1872 sh_util_keyinit(key, KEY_LEN); 1853 sl_strlcpy(salt, sh_tiger_hash(key, TIGER_DATA, KEY_LEN), 17); 1873 sl_strlcpy(salt, sh_tiger_hash(key, TIGER_DATA, KEY_LEN, 1874 hashbuf, sizeof(hashbuf)), 1875 17); 1854 1876 sh_srp_x (salt, in); 1855 1877 foo_v = sh_srp_verifier (); … … 1873 1895 UINT32 val[2]; 1874 1896 char output[KEY_LEN+1]; 1897 char hashbuf[KEYBUF_SIZE]; 1875 1898 1876 1899 val[0] = taus_get (&(skey->rng0[0]), &(skey->rng0[1]), &(skey->rng0[2])); … … 1878 1901 1879 1902 sl_strlcpy (output, 1880 sh_tiger_hash((char *)(&val[0]), TIGER_DATA, 2*sizeof(UINT32)), 1903 sh_tiger_hash((char *)(&val[0]), TIGER_DATA, 2*sizeof(UINT32), 1904 hashbuf, sizeof(hashbuf)), 1881 1905 KEY_LEN); 1882 1906 … … 2817 2841 char * foo_Ss; 2818 2842 #endif 2843 char hashbuf[KEYBUF_SIZE]; 2844 char sigbuf[KEYBUF_SIZE]; 2819 2845 2820 2846 SL_ENTER(_("check_protocol")); … … 2908 2934 sh_util_siggen(this_client->session_key, 2909 2935 &(conn->buf[KEY_LEN]), 2910 sl_strlen(&(conn->buf[KEY_LEN]))), 2936 sl_strlen(&(conn->buf[KEY_LEN])), 2937 sigbuf, sizeof(sigbuf)), 2911 2938 KEY_LEN+1); 2912 2939 TPT((0, FIL__, __LINE__, _("msg=<host %s>\n"), … … 2917 2944 sh_util_siggen(this_client->session_key, 2918 2945 &(conn->buf[KEY_LEN]), 2919 sl_strlen(&(conn->buf[KEY_LEN]))))); 2946 sl_strlen(&(conn->buf[KEY_LEN])), 2947 sigbuf, sizeof(sigbuf)))); 2920 2948 2921 2949 if (0 != sl_strncmp(conn->K, conn->buf, KEY_LEN)) … … 2953 2981 sl_strlcpy (conn->K, 2954 2982 sh_tiger_hash ((char *) &ticks, 2955 TIGER_DATA, sizeof(UINT32)), 2983 TIGER_DATA, sizeof(UINT32), 2984 hashbuf, sizeof(hashbuf)), 2956 2985 KEY_LEN+1); 2957 2986 … … 2985 3014 sl_strlcat(conn->A, conn->client_entry->session_key, 2986 3015 3*KEY_LEN+1); 2987 sl_strlcpy (conn->K, sh_tiger_hash(conn->A,TIGER_DATA,3*KEY_LEN), 3016 sl_strlcpy (conn->K, sh_tiger_hash(conn->A,TIGER_DATA,3*KEY_LEN, 3017 hashbuf, sizeof(hashbuf)), 2988 3018 KEY_LEN+1); 2989 3019 SH_FREE(conn->A); … … 3368 3398 sh_util_siggen(this_client->session_key, 3369 3399 &(conn->buf[KEY_LEN]), 3370 sl_strlen(&(conn->buf[KEY_LEN]))), 3400 sl_strlen(&(conn->buf[KEY_LEN])), 3401 sigbuf, sizeof(sigbuf)), 3371 3402 KEY_LEN+1); 3372 3403 TPT((0, FIL__, __LINE__, _("msg=<host %s>\n"), … … 3484 3515 sh_util_siggen(conn->client_entry->session_key, 3485 3516 buffer, 3486 sl_strlen(buffer)), 3517 sl_strlen(buffer), 3518 sigbuf, sizeof(sigbuf)), 3487 3519 KEY_LEN); 3488 3520 TPT((0, FIL__, __LINE__, _("msg=<sign %s.>\n"), 3489 3521 sh_util_siggen(conn->client_entry->session_key, 3490 3522 buffer, 3491 sl_strlen(buffer)))); 3523 sl_strlen(buffer), 3524 sigbuf, sizeof(sigbuf)))); 3492 3525 3493 3526 … … 3601 3634 sh_util_siggen ( conn->client_entry->session_key, 3602 3635 buffer, 3603 sl_strlen(buffer)), 3636 sl_strlen(buffer), 3637 sigbuf, sizeof(sigbuf)), 3604 3638 KEY_LEN+1); 3605 3639 … … 3615 3649 sh_util_siggen ( conn->client_entry->session_key, 3616 3650 &hash[KEY_LEN], 3617 sl_strlen(&hash[KEY_LEN])), 3651 sl_strlen(&hash[KEY_LEN]), 3652 sigbuf, sizeof(sigbuf)), 3618 3653 SH_MAXMSGLEN+KEY_LEN+1); 3619 3654 … … 3631 3666 sh_util_siggen(conn->client_entry->session_key, 3632 3667 buffer, 3633 sl_strlen(buffer)))); 3668 sl_strlen(buffer), 3669 sigbuf, sizeof(sigbuf)))); 3634 3670 3635 3671 #ifdef SH_ENCRYPT … … 3767 3803 sl_strlcpy(conn->A, 3768 3804 sh_tiger_hash((char *) &ticks, 3769 TIGER_DATA, sizeof(UINT32)), 3805 TIGER_DATA, sizeof(UINT32), 3806 hashbuf, sizeof(hashbuf)), 3770 3807 KEY_LEN+1); 3771 3808 u[0] = 'I'; u[1] = 'N'; u[2] = 'I'; u[3] = 'T'; u[4] = '\0'; … … 3849 3886 sl_strlcpy(hash, sh_tiger_hash (conn->M1, 3850 3887 TIGER_DATA, 3851 sl_strlen(conn->M1)), KEY_LEN+1); 3888 sl_strlen(conn->M1), 3889 hashbuf, sizeof(hashbuf)), 3890 KEY_LEN+1); 3852 3891 sh_passwd (hash, conn->client_entry->verifier, NULL, conn->M1); 3853 3892 … … 4084 4123 u[4] = '\0'; 4085 4124 sl_strlcpy(conn->challenge, 4086 sh_tiger_hash(u, TIGER_DATA, 4 ),4125 sh_tiger_hash(u, TIGER_DATA, 4, hashbuf, sizeof(hashbuf)), 4087 4126 SH_CHALLENGE_SIZE); 4088 4127 … … 4116 4155 sl_strlcpy(conn->K, 4117 4156 sh_tiger_hash(foo_Ss, TIGER_DATA, 4118 sl_strlen(foo_Ss)), 4157 sl_strlen(foo_Ss), 4158 hashbuf, sizeof(hashbuf)), 4119 4159 KEY_LEN+1); 4120 4160 … … 4125 4165 } 4126 4166 conn->M1 = SH_ALLOC(KEY_LEN+1); 4127 sl_strlcpy(conn->M1, 4128 sh_srp_M (conn->A, foo_B, conn->K), 4129 KEY_LEN+1); 4167 sh_srp_M (conn->A, foo_B, conn->K, conn->M1, KEY_LEN+1); 4130 4168 4131 4169 TPT((0, FIL__, __LINE__, _("msg=<srp:Ss = %s>\n"), foo_Ss)); … … 4196 4234 * send M2 4197 4235 */ 4236 char M_buf[KEY_LEN+1]; 4198 4237 sh_forward_prep_send (conn, 4199 sh_srp_M (conn->A, conn->M1, conn->K), 4238 sh_srp_M (conn->A, conn->M1, conn->K, 4239 M_buf, sizeof(M_buf)), 4200 4240 KEY_LEN+1, 4201 4241 _("PARP"),
Note:
See TracChangeset
for help on using the changeset viewer.