- } else {
- if (stream->send_key[0])
- silc_cipher_free(stream->send_key[0]);
- if (stream->send_key[1])
- silc_cipher_free(stream->receive_key[0]);
- }
-
- stream->send_key[0] = send;
- stream->receive_key[0] = receive;
-
- silc_mutex_unlock(stream->lock);
-}
-
-/* Return current ciphers from packet stream */
-
-SilcBool silc_packet_get_ciphers(SilcPacketStream stream, SilcCipher *send,
- SilcCipher *receive)
-{
- if (!stream->send_key[0] && !stream->receive_key[0])
- return FALSE;
-
- silc_mutex_lock(stream->lock);
-
- if (send)
- *send = stream->send_key[0];
- if (receive)
- *receive = stream->receive_key[0];
-
- silc_mutex_unlock(stream->lock);
-
- return TRUE;
-}
-
-/* Set HMACs for packet stream */
-
-void silc_packet_set_hmacs(SilcPacketStream stream, SilcHmac send,
- SilcHmac receive)
-{
- SILC_LOG_DEBUG(("Setting new HMACs to packet stream"));
-
- silc_mutex_lock(stream->lock);
-
- /* In case IV Included is set, save the old HMAC */
- if (stream->iv_included) {
- if (stream->send_hmac[1]) {