|
@@ -666,6 +666,7 @@ size_t crypto_sec_header_size(
|
|
|
int crypto_cipher = string_to_crypto_cipher_type(crypto_cipher_type);
|
|
int crypto_cipher = string_to_crypto_cipher_type(crypto_cipher_type);
|
|
|
int crypto_hash = string_to_crypto_hash_type(crypto_hash_type);
|
|
int crypto_hash = string_to_crypto_hash_type(crypto_hash_type);
|
|
|
size_t hdr_size = 0;
|
|
size_t hdr_size = 0;
|
|
|
|
|
+ int block_size = 0;
|
|
|
|
|
|
|
|
hdr_size = sizeof(struct crypto_config_header);
|
|
hdr_size = sizeof(struct crypto_config_header);
|
|
|
|
|
|
|
@@ -675,7 +676,19 @@ size_t crypto_sec_header_size(
|
|
|
|
|
|
|
|
if (crypto_cipher) {
|
|
if (crypto_cipher) {
|
|
|
hdr_size += SALT_SIZE;
|
|
hdr_size += SALT_SIZE;
|
|
|
- hdr_size += cypher_block_len[crypto_cipher];
|
|
|
|
|
|
|
+ if (cypher_block_len[crypto_cipher]) {
|
|
|
|
|
+ block_size = cypher_block_len[crypto_cipher];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ block_size = PK11_GetBlockSize(crypto_cipher, NULL);
|
|
|
|
|
+ if (block_size < 0) {
|
|
|
|
|
+ /*
|
|
|
|
|
+ * failsafe. we can potentially lose up to 63
|
|
|
|
|
+ * byte per packet, but better than fragmenting
|
|
|
|
|
+ */
|
|
|
|
|
+ block_size = 64;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ hdr_size += (block_size * 2);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return hdr_size;
|
|
return hdr_size;
|