[crypto] Allow initialisation vector length to vary from cipher blocksize

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2022-10-24 16:52:24 +01:00
parent 52f72d298a
commit 8e478e648f
7 changed files with 24 additions and 16 deletions

View File

@@ -1033,7 +1033,8 @@ static int peerblk_parse_iv ( struct peerdist_block *peerblk, size_t buf_len,
}
/* Set initialisation vector */
cipher_setiv ( peerblk->cipher, peerblk->cipherctx, msg->msg.iv.data );
cipher_setiv ( peerblk->cipher, peerblk->cipherctx, msg->msg.iv.data,
blksize );
return 0;
}

View File

@@ -717,14 +717,14 @@ static int tls_generate_keys ( struct tls_connection *tls ) {
/* TX initialisation vector */
cipher_setiv ( tx_cipherspec->suite->cipher,
tx_cipherspec->cipher_ctx, key );
tx_cipherspec->cipher_ctx, key, iv_size );
DBGC ( tls, "TLS %p TX IV:\n", tls );
DBGC_HD ( tls, key, iv_size );
key += iv_size;
/* RX initialisation vector */
cipher_setiv ( rx_cipherspec->suite->cipher,
rx_cipherspec->cipher_ctx, key );
rx_cipherspec->cipher_ctx, key, iv_size );
DBGC ( tls, "TLS %p RX IV:\n", tls );
DBGC_HD ( tls, key, iv_size );
key += iv_size;