Lines Matching refs:mac

346     struct sshmac *mac, u_int packet_length, u_int discard)  in ssh_packet_start_discard()  argument
351 if (enc == NULL || !cipher_is_cbc(enc->cipher) || (mac && mac->etm)) { in ssh_packet_start_discard()
356 if (packet_length != PACKET_MAX_SIZE && mac && mac->enabled) in ssh_packet_start_discard()
357 state->packet_discard_mac = mac; in ssh_packet_start_discard()
920 struct sshmac *mac; in ssh_set_newkeys() local
945 mac = &state->newkeys[mode]->mac; in ssh_set_newkeys()
947 mac_clear(mac); in ssh_set_newkeys()
950 explicit_bzero(mac->key, mac->key_len); in ssh_set_newkeys()
954 free(mac->name); in ssh_set_newkeys()
955 free(mac->key); in ssh_set_newkeys()
964 mac = &state->newkeys[mode]->mac; in ssh_set_newkeys()
967 if ((r = mac_init(mac)) != 0) in ssh_set_newkeys()
970 mac->enabled = 1; in ssh_set_newkeys()
1062 struct sshmac *mac = NULL; in ssh_packet_send2_wrapped() local
1068 mac = &state->newkeys[MODE_OUT]->mac; in ssh_packet_send2_wrapped()
1072 mac = NULL; in ssh_packet_send2_wrapped()
1075 aadlen = (mac && mac->enabled && mac->etm) || authlen ? 4 : 0; in ssh_packet_send2_wrapped()
1148 if (mac && mac->enabled && !mac->etm) { in ssh_packet_send2_wrapped()
1149 if ((r = mac_compute(mac, state->p_send.seqnr, in ssh_packet_send2_wrapped()
1164 if (mac && mac->enabled) { in ssh_packet_send2_wrapped()
1165 if (mac->etm) { in ssh_packet_send2_wrapped()
1167 if ((r = mac_compute(mac, state->p_send.seqnr, in ssh_packet_send2_wrapped()
1173 if ((r = sshbuf_put(state->output, macbuf, mac->mac_len)) != 0) in ssh_packet_send2_wrapped()
1542 struct sshmac *mac = NULL; in ssh_packet_read_poll2() local
1553 mac = &state->newkeys[MODE_IN]->mac; in ssh_packet_read_poll2()
1557 mac = NULL; in ssh_packet_read_poll2()
1559 maclen = mac && mac->enabled ? mac->mac_len : 0; in ssh_packet_read_poll2()
1561 aadlen = (mac && mac->enabled && mac->etm) || authlen ? 4 : 0; in ssh_packet_read_poll2()
1603 return ssh_packet_start_discard(ssh, enc, mac, in ssh_packet_read_poll2()
1626 return ssh_packet_start_discard(ssh, enc, mac, in ssh_packet_read_poll2()
1644 if (mac && mac->enabled && mac->etm) { in ssh_packet_read_poll2()
1645 if ((r = mac_compute(mac, state->p_read.seqnr, in ssh_packet_read_poll2()
1662 if (mac && mac->enabled) { in ssh_packet_read_poll2()
1663 if (!mac->etm) in ssh_packet_read_poll2()
1664 if ((r = mac_compute(mac, state->p_read.seqnr, in ssh_packet_read_poll2()
1670 mac->mac_len) != 0) { in ssh_packet_read_poll2()
1674 return ssh_packet_start_discard(ssh, enc, mac, in ssh_packet_read_poll2()
1679 if ((r = sshbuf_consume(state->input, mac->mac_len)) != 0) in ssh_packet_read_poll2()
2368 struct sshmac *mac; in newkeys_to_blob() local
2375 mac = &newkey->mac; in newkeys_to_blob()
2392 if ((r = sshbuf_put_cstring(b, mac->name)) != 0 || in newkeys_to_blob()
2393 (r = sshbuf_put_u32(b, mac->enabled)) != 0 || in newkeys_to_blob()
2394 (r = sshbuf_put_string(b, mac->key, mac->key_len)) != 0) in newkeys_to_blob()
2481 struct sshmac *mac; in newkeys_from_blob() local
2496 mac = &newkey->mac; in newkeys_from_blob()
2507 if ((r = sshbuf_get_cstring(b, &mac->name, NULL)) != 0) in newkeys_from_blob()
2509 if ((r = mac_setup(mac, mac->name)) != 0) in newkeys_from_blob()
2511 if ((r = sshbuf_get_u32(b, (u_int *)&mac->enabled)) != 0 || in newkeys_from_blob()
2512 (r = sshbuf_get_string(b, &mac->key, &maclen)) != 0) in newkeys_from_blob()
2514 if (maclen > mac->key_len) { in newkeys_from_blob()
2518 mac->key_len = maclen; in newkeys_from_blob()