mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
Merge misc crypto changes & fixes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCAAGBQJWeoF6AAoJEL6G67QVEE/ff7MP/jcF8c21q28DLPvHFTQdLCDS HsrJhUXlPBQk6knQrZQpb5PU8/s2NeyJdglzxFI7LaOlTAjlUh+bZIoU7Y9iGht9 HOKAgUX1eApkMfhpV+pzPXIrF3b7TCiWWOKsWW8SkqSnIYgigBM+8xA0XspduWvQ cSklbwvhs3duawrg8lVnRJQgbrVtDVFKrzBiUCke6qSrKqO/2iuLrpZMiv6b5uTQ tWzBb2gT/BDcZHRF6Br6DApBe1uqkL/oXmo5DtM/ouwPjuTHMnx8gYFgyIz1vbQN Ti0FrKtwrr8aK5hSnNbNcizKdst7Txw7jV5PiIDdTKV5CvYza4zdeppXXa0rSIyI ByThHzeR5J11hDiIAZ72/yHo9gIifOLqKZtQsCrRB8niyQ93rr85UWA2JWdLqRXs gbbLRK3UXwSZVWmdAlrFIZUxBUdTnc/qcLIU0cgnffC7ozZbwyjt3dnIUM6WmlxW DjY7Z5wcFbbnYsufwBZgZUhWbTj3AdAaiIdBuY33GqqtVs59nICBrtSCYmP1j4+u fDv4QlElETC5hGH9ZPeo08yGrgRA6hGlopnnKSzlfmeb62UU2aYcTW6fNP9OkZI2 HHyGa4XeaeYzYhYbbtRngSI9QjJVf5qzFq2rSFuZcf/9t0n1dztFd36DLca6sW4x fMahe7XiEmKqBBAwFaAr =fHY5 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/berrange/tags/pull-crypto-fixes-2015-12-23-1' into staging Merge misc crypto changes & fixes # gpg: Signature made Wed 23 Dec 2015 11:11:54 GMT using RSA key ID 15104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" * remotes/berrange/tags/pull-crypto-fixes-2015-12-23-1: crypto: fix transposed arguments in cipher error message crypto: ensure qapi/crypto.json is listed in qapi-modules crypto: move QCryptoCipherAlgorithm/Mode enum definitions into QAPI crypto: move QCryptoHashAlgorithm enum definition into QAPI crypto: add ability to query hash digest len crypto: add additional query accessors for cipher instances Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
38a762fec6
8 changed files with 180 additions and 28 deletions
|
@ -229,6 +229,7 @@ static void test_cipher(const void *opaque)
|
|||
uint8_t *key, *iv, *ciphertext, *plaintext, *outtext;
|
||||
size_t nkey, niv, nciphertext, nplaintext;
|
||||
char *outtexthex;
|
||||
size_t ivsize, keysize, blocksize;
|
||||
|
||||
nkey = unhex_string(data->key, &key);
|
||||
niv = unhex_string(data->iv, &iv);
|
||||
|
@ -245,6 +246,15 @@ static void test_cipher(const void *opaque)
|
|||
&error_abort);
|
||||
g_assert(cipher != NULL);
|
||||
|
||||
keysize = qcrypto_cipher_get_key_len(data->alg);
|
||||
blocksize = qcrypto_cipher_get_block_len(data->alg);
|
||||
ivsize = qcrypto_cipher_get_iv_len(data->alg, data->mode);
|
||||
|
||||
g_assert_cmpint(keysize, ==, nkey);
|
||||
g_assert_cmpint(ivsize, ==, niv);
|
||||
if (niv) {
|
||||
g_assert_cmpint(blocksize, ==, niv);
|
||||
}
|
||||
|
||||
if (iv) {
|
||||
g_assert(qcrypto_cipher_setiv(cipher,
|
||||
|
|
|
@ -163,6 +163,11 @@ static void test_hash_digest(void)
|
|||
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
|
||||
int ret;
|
||||
char *digest;
|
||||
size_t digestsize;
|
||||
|
||||
digestsize = qcrypto_hash_digest_len(i);
|
||||
|
||||
g_assert_cmpint(digestsize * 2, ==, strlen(expected_outputs[i]));
|
||||
|
||||
ret = qcrypto_hash_digest(i,
|
||||
INPUT_TEXT,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue