summaryrefslogtreecommitdiffstats
path: root/crypto/cipher-builtin.c
Commit message (Collapse)AuthorAgeFilesLines
* crypto: add sanity checking of plaintext/ciphertext lengthDaniel P. Berrange2015-10-221-0/+15
| | | | | | | | | | When encrypting/decrypting data, the plaintext/ciphertext buffers are required to be a multiple of the cipher block size. If this is not done, nettle will abort and gcrypt will report an error. To get consistent behaviour add explicit checks upfront for the buffer sizes. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* crypto: don't let builtin aes crash if no IV is providedDaniel P. Berrange2015-10-221-9/+5
| | | | | | | | If no IV is provided, then use a default IV of all-zeros instead of crashing. This gives parity with gcrypt and nettle backends. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* crypto: fix built-in AES decrypt functionDaniel P. Berrange2015-07-271-4/+4
| | | | | | | | | | The qcrypto_cipher_decrypt_aes method was using the wrong key material, and passing the wrong mode. This caused it to incorrectly decrypt ciphertext. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1437740634-6261-1-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* crypto: fix builtin qcrypto_cipher_freePaolo Bonzini2015-07-091-1/+3
| | | | | | | | This was dereferencing a pointer before checking if it was NULL. Reported-by: Christian Borntraeger <borntraeger@de.ibm.com> Reported-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* crypto: introduce generic cipher API & built-in implementationDaniel P. Berrange2015-07-081-0/+398
Introduce a generic cipher API and an implementation of it that supports only the built-in AES and DES-RFB algorithms. The test suite checks the supported algorithms + modes to validate that every backend implementation is actually correctly complying with the specs. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1435770638-25715-5-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
OpenPOWER on IntegriCloud