"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib-dcrypt/istream-decrypt.c" between
dovecot-2.3.16.tar.gz and dovecot-2.3.17.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

istream-decrypt.c  (dovecot-2.3.16):istream-decrypt.c  (dovecot-2.3.17)
skipping to change at line 89 skipping to change at line 89
i_stream_decrypt_read_header_v1(struct decrypt_istream *stream, i_stream_decrypt_read_header_v1(struct decrypt_istream *stream,
const unsigned char *data, size_t mlen) const unsigned char *data, size_t mlen)
{ {
const char *error = NULL; const char *error = NULL;
size_t keydata_len = 0; size_t keydata_len = 0;
uint16_t len; uint16_t len;
int ec, i = 0; int ec, i = 0;
const unsigned char *digest_pos = NULL, *key_digest_pos = NULL, const unsigned char *digest_pos = NULL, *key_digest_pos = NULL,
*key_ct_pos = NULL; *key_ct_pos = NULL;
size_t pos = sizeof(IOSTREAM_CRYPT_MAGIC);
size_t digest_len = 0, key_ct_len = 0, key_digest_size = 0; size_t digest_len = 0, key_ct_len = 0, key_digest_size = 0;
buffer_t ephemeral_key; buffer_t ephemeral_key;
buffer_t *secret = t_buffer_create(256); buffer_t *secret = t_buffer_create(256);
buffer_t *key = t_buffer_create(256); buffer_t *key = t_buffer_create(256);
if (mlen < 2) if (mlen < 2)
return 0; return 0;
keydata_len = be16_to_cpu_unaligned(data); keydata_len = be16_to_cpu_unaligned(data);
if (mlen-2 < keydata_len) { if (mlen-2 < keydata_len) {
skipping to change at line 114 skipping to change at line 113
data+=2; data+=2;
mlen-=2; mlen-=2;
while (i < 4 && mlen > 2) { while (i < 4 && mlen > 2) {
memcpy(&len, data, 2); memcpy(&len, data, 2);
len = ntohs(len); len = ntohs(len);
if (len == 0 || len > mlen-2) if (len == 0 || len > mlen-2)
break; break;
data += 2; data += 2;
mlen -= 2; mlen -= 2;
pos += 2;
switch(i++) { switch(i++) {
case 0: case 0:
buffer_create_from_const_data(&ephemeral_key, buffer_create_from_const_data(&ephemeral_key,
data, len); data, len);
break; break;
case 1: case 1:
/* public key id */ /* public key id */
digest_pos = data; digest_pos = data;
digest_len = len; digest_len = len;
skipping to change at line 137 skipping to change at line 135
/* encryption key digest */ /* encryption key digest */
key_digest_pos = data; key_digest_pos = data;
key_digest_size = len; key_digest_size = len;
break; break;
case 3: case 3:
/* encrypted key data */ /* encrypted key data */
key_ct_pos = data; key_ct_pos = data;
key_ct_len = len; key_ct_len = len;
break; break;
} }
pos += len;
data += len; data += len;
mlen -= len; mlen -= len;
} }
if (i < 4) { if (i < 4) {
io_stream_set_error(&stream->istream.iostream, io_stream_set_error(&stream->istream.iostream,
"Invalid or corrupted header"); "Invalid or corrupted header");
/* was it consumed? */ /* was it consumed? */
stream->istream.istream.stream_errno = stream->istream.istream.stream_errno =
mlen > 2 ? EINVAL : EPIPE; mlen > 2 ? EINVAL : EPIPE;
 End of changes. 3 change blocks. 
3 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)