Skip to content

Commit 8f89360

Browse files
author
Alex Wilson
committed
Add missing asserts on cipher authlen for ebox recovery
We don't support separate HMACs to authenticate the recovery box in the format as it stands today, so make sure we blow up if a non-authenticated cipher is used.
1 parent f07772f commit 8f89360

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

ebox.c

+4
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,8 @@ ebox_decrypt_recovery(struct ebox *box)
24042404
authlen = cipher_authlen(cipher);
24052405
blocksz = cipher_blocksize(cipher);
24062406
keylen = cipher_keylen(cipher);
2407+
/* TODO: support non-authenticated ciphers by adding an HMAC? */
2408+
VERIFY3U(authlen, >, 0);
24072409

24082410
iv = box->e_rcv_iv.b_data;
24092411
VERIFY(iv != NULL);
@@ -2497,6 +2499,8 @@ ebox_encrypt_recovery(struct ebox *box)
24972499
authlen = cipher_authlen(cipher);
24982500
blocksz = cipher_blocksize(cipher);
24992501
keylen = cipher_keylen(cipher);
2502+
/* TODO: support non-authenticated ciphers by adding an HMAC? */
2503+
VERIFY3U(authlen, >, 0);
25002504

25012505
plainlen = box->e_rcv_plain.b_len;
25022506
padding = blocksz - (plainlen % blocksz);

piv.c

+2
Original file line numberDiff line numberDiff line change
@@ -4217,6 +4217,8 @@ piv_box_open(struct piv_token *tk, struct piv_slot *slot,
42174217
authlen = cipher_authlen(cipher);
42184218
blocksz = cipher_blocksize(cipher);
42194219
keylen = cipher_keylen(cipher);
4220+
/* TODO: support non-authenticated ciphers by adding an HMAC */
4221+
VERIFY3U(authlen, >, 0);
42204222

42214223
dgalg = ssh_digest_alg_by_name(box->pdb_kdf);
42224224
if (dgalg == -1) {

0 commit comments

Comments
 (0)