summaryrefslogtreecommitdiffstats
path: root/lib/bitrev.c
diff options
context:
space:
mode:
authorMilan Broz <gmazyland@gmail.com>2013-10-28 23:21:03 +0100
committerMike Snitzer <snitzer@redhat.com>2013-11-09 18:20:20 -0500
commitda31a0787a2ac92dd219ce0d33322160b66d6a01 (patch)
tree01f47fbf8855b25ea85a7504dbb32569f712f293 /lib/bitrev.c
parent2c2263c93f70c6abdce90ad96a854760532aa52f (diff)
downloadblackbird-obmc-linux-da31a0787a2ac92dd219ce0d33322160b66d6a01.tar.gz
blackbird-obmc-linux-da31a0787a2ac92dd219ce0d33322160b66d6a01.zip
dm crypt: properly handle extra key string in initialization
Some encryption modes use extra keys (e.g. loopAES has IV seed) which are not used in block cipher initialization but are part of key string in table constructor. This patch adds an additional field which describes the length of the extra key(s) and substracts it before real key encryption setting. The key_size always includes the size, in bytes, of the key provided in mapping table. The key_parts describes how many parts (usually keys) are contained in the whole key buffer. And key_extra_size contains size in bytes of additional keys part (this number of bytes must be subtracted because it is processed by the IV generator). | K1 | K2 | .... | K64 | Kiv | |----------- key_size ----------------- | | |-key_extra_size-| | [64 keys] | [1 key] | => key_parts = 65 Example where key string contains main key K, whitening key Kw and IV seed Kiv: | K | Kiv | Kw | |--------------- key_size --------------| | |-----key_extra_size------| | [1 key] | [1 key] | [1 key] | => key_parts = 3 Because key_extra_size is calculated during IV mode setting, key initialization is moved after this step. For now, this change has no effect to supported modes (thanks to ilog2 rounding) but it is required by the following patch. Also, fix a sparse warning in crypt_iv_lmk_one(). Signed-off-by: Milan Broz <gmazyland@gmail.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'lib/bitrev.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud