opencryptoki / libica

Crypto library for s390x.
Other
9 stars 17 forks source link

AES-XTS: Support multi part operations #100

Closed ifranzki closed 2 years ago

ifranzki commented 2 years ago

Function ica_aes_xts() does not support multi-part operations (although the parameter description for the tweak parameter indicates that it would support multi-patrt operations, which is not true).

Add a new function ica_aes_xts_ex() that additionally takes the IV as parameter. For the very first part, the tweak must be specified. Internally the initial IV is calculated (via PCC instruction). After a successful operation on the first part, the resulting IV is returned, and must be passed to subsequent calls to ica_aes_xts_ex() to continue the operation.

For intermediate parts, parameter tweak must be NULL. Then, the IV passed as parameter is used for the operation. The IV is updated on return.

The first and intermediate parts must be a multiple on the AES block size. Only the last part can use partial blocks. Nevertheless, the last part must also be at least one full block.