X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilccore%2Fsilcmessage.c;h=e7f06c0ee2f158b0ab979c50e649ac2103019743;hb=7ada165ecc5e25429cd4fc9511f31794cd86d540;hp=19fb22f34376b6e5fdf62c71f32e9be2e4c844d6;hpb=e0bbbcc41edc732a66c55d26a56002f907fdaaf4;p=silc.git diff --git a/lib/silccore/silcmessage.c b/lib/silccore/silcmessage.c index 19fb22f3..e7f06c0e 100644 --- a/lib/silccore/silcmessage.c +++ b/lib/silccore/silcmessage.c @@ -281,7 +281,7 @@ SilcBool silc_message_payload_decrypt(unsigned char *data, if (!private_message || (private_message && static_key)) iv_len = block_len; - if (data_len <= (mac_len + iv_len + block_len)) + if (data_len < (mac_len + iv_len + block_len)) return FALSE; if (check_mac) { @@ -306,8 +306,10 @@ SilcBool silc_message_payload_decrypt(unsigned char *data, silc_cipher_get_iv(cipher)); /* Decrypt block */ - if (!silc_cipher_decrypt(cipher, data, data, block_len, ivp)) + if (!silc_cipher_decrypt(cipher, data, data, block_len, ivp)) { + SILC_ASSERT(FALSE); return FALSE; + } /* Get the payload length and decrypt rest */ totlen = 2; @@ -319,8 +321,10 @@ SilcBool silc_message_payload_decrypt(unsigned char *data, if (totlen >= block_len) if (!silc_cipher_decrypt(cipher, data + block_len, data + block_len, (totlen - block_len) + SILC_MESSAGE_PAD(totlen), - ivp)) + ivp)) { + SILC_ASSERT(FALSE); return FALSE; + } return TRUE; } @@ -648,9 +652,9 @@ unsigned char *silc_message_get_mac(SilcMessagePayload payload) /* Verify the signature in SILC_MESSAGE_FLAG_SIGNED Payload */ -int silc_message_signed_verify(SilcMessagePayload message, - SilcPublicKey remote_public_key, - SilcHash hash) +SilcAuthResult silc_message_signed_verify(SilcMessagePayload message, + SilcPublicKey remote_public_key, + SilcHash hash) { int ret = SILC_AUTH_FAILED; SilcBuffer sign, tmp;