size_t *int_overhead, size_t *blocksize,
size_t *ext_overhead)
{
- size_t mac = 0, in = 0, blk = 0, out = 0;
+ int mac = 0, in = 0, blk = 0, out = 0;
/* Some hard-coded numbers for the CCM/Poly1305 MAC overhead
* because there are no handy #defines for those. */
return 0;
mac = EVP_MD_get_size(e_md);
+ if (mac <= 0)
+ return 0;
if (c->algorithm_enc != SSL_eNULL) {
int cipher_nid = SSL_CIPHER_get_cipher_nid(c);
const EVP_CIPHER *e_ciph = EVP_get_cipherbynid(cipher_nid);
in = 1; /* padding length byte */
out = EVP_CIPHER_get_iv_length(e_ciph);
+ if (out < 0)
+ return 0;
blk = EVP_CIPHER_get_block_size(e_ciph);
- if (blk == 0)
+ if (blk <= 0)
return 0;
}
}
- *mac_overhead = mac;
- *int_overhead = in;
- *blocksize = blk;
- *ext_overhead = out;
+ *mac_overhead = (size_t)mac;
+ *int_overhead = (size_t)in;
+ *blocksize = (size_t)blk;
+ *ext_overhead = (size_t)out;
return 1;
}