- /* Decrypt the channel message. First push the IV out of the packet.
- The IV is used in the decryption process. Then decrypt the message.
- After decyprtion, take the MAC from the decrypted packet, compute MAC
- and compare the MACs. If they match, the decryption was successfull
- and we have the channel message ready to be displayed. */
-
- /* Push the IV out of the packet (it will be in buffer->tail) */
- iv_len = silc_cipher_get_block_len(cipher);
- silc_buffer_push_tail(buffer, iv_len);
-
- /* Decrypt the channel message */
- silc_cipher_decrypt(cipher, buffer->data, buffer->data,
- buffer->len, buffer->tail);
-
- /* Take the MAC */
- mac_len = silc_hmac_len(hmac);
- silc_buffer_push_tail(buffer, mac_len);
- mac = buffer->tail;
-
- /* Check the MAC of the message */
- SILC_LOG_DEBUG(("Checking channel message MACs"));
- silc_hmac_make(hmac, buffer->data, buffer->len, mac2, &mac_len);
- if (memcmp(mac, mac2, mac_len)) {
- SILC_LOG_DEBUG(("Channel message MACs does not match"));