Lines Matching +full:0 +full:- +full:9 +full:a +full:- +full:f

13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * You should have received a copy of the GNU Lesser General Public
38 /* AES test data comes from appendix F of:
40 * http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
44 /* NIST F.1.1 ECB-AES128.Encrypt */
45 .path = "/crypto/cipher/aes-ecb-128",
61 /* NIST F.1.3 ECB-AES192.Encrypt */
62 .path = "/crypto/cipher/aes-ecb-192",
75 "9a4b41ba738d6c72fb16691603c18e0e"
78 /* NIST F.1.5 ECB-AES256.Encrypt */
79 .path = "/crypto/cipher/aes-ecb-256",
97 /* NIST F.2.1 CBC-AES128.Encrypt */
98 .path = "/crypto/cipher/aes-cbc-128",
115 /* NIST F.2.3 CBC-AES128.Encrypt */
116 .path = "/crypto/cipher/aes-cbc-192",
133 /* NIST F.2.5 CBC-AES128.Encrypt */
134 .path = "/crypto/cipher/aes-cbc-256",
148 "9cfc4e967edb808d679f777bc6702c7d"
158 .path = "/crypto/cipher/des-ecb-56-one-block",
167 .path = "/crypto/cipher/des-cbc-56-one-block",
176 .path = "/crypto/cipher/des-ecb-56",
192 /* Borrowed from linux-kernel crypto/testmgr.h */
193 .path = "/crypto/cipher/3des-cbc",
211 "0e2db6973c5633f4671721c76e8ad549"
218 "9ddea570e942458a6bfab19113b0d919",
221 /* Borrowed from linux-kernel crypto/testmgr.h */
222 .path = "/crypto/cipher/3des-ecb",
234 /* Borrowed from linux-kernel crypto/testmgr.h */
235 .path = "/crypto/cipher/3des-ctr",
239 "9cd6f39cb95a67005a67002dceeb2dce"
310 .path = "/crypto/cipher/cast5-128",
313 .key = "0123456712345678234567893456789A",
319 .path = "/crypto/cipher/serpent-128",
328 .path = "/crypto/cipher/serpent-192",
338 .path = "/crypto/cipher/serpent-256a",
348 .path = "/crypto/cipher/serpent-256b",
358 .path = "/crypto/cipher/twofish-128",
367 .path = "/crypto/cipher/twofish-192",
377 .path = "/crypto/cipher/twofish-256",
387 /* SM4, GB/T 32907-2016, Appendix A.1 */
400 .path = "/crypto/cipher/aes-xts-128-1",
417 .path = "/crypto/cipher/aes-xts-128-2",
434 .path = "/crypto/cipher/aes-xts-128-3",
441 "9a785634120000000000000000000000",
451 .path = "/crypto/cipher/aes-xts-128-4",
508 "0bf12b1fa35b913f9f747a8afd1b130e"
524 "0a282df920147beabe421ee5319d0568",
527 /* Bad config - cast5-128 has 8 byte block size
530 .path = "/crypto/cipher/cast5-xts-128",
538 /* NIST F.5.1 CTR-AES128.Encrypt */
539 .path = "/crypto/cipher/aes-ctr-128",
556 /* NIST F.5.3 CTR-AES192.Encrypt */
557 .path = "/crypto/cipher/aes-ctr-192",
574 /* NIST F.5.5 CTR-AES256.Encrypt */
575 .path = "/crypto/cipher/aes-ctr-256",
597 if (c >= 'a' && c <= 'f') { in unhex()
598 return 10 + (c - 'a'); in unhex()
600 if (c >= 'A' && c <= 'F') { in unhex()
601 return 10 + (c - 'A'); in unhex()
603 return c - '0'; in unhex()
609 return '0' + i; in hex()
611 return 'a' + (i - 10); in hex()
622 return 0; in unhex_string()
628 for (i = 0; i < len; i += 2) { in unhex_string()
640 for (i = 0; i < len; i++) { in hex_string()
641 hexstr[i*2] = hex((bytes[i] >> 4) & 0xf); in hex_string()
642 hexstr[i*2+1] = hex(bytes[i] & 0xf); in hex_string()
644 hexstr[len*2] = '\0'; in hex_string()
656 size_t nkey, niv = 0, nciphertext = 0, nplaintext = 0; in test_cipher()
661 nkey = unhex_string(data->key, &key); in test_cipher()
662 if (data->iv) { in test_cipher()
663 niv = unhex_string(data->iv, &iv); in test_cipher()
665 if (data->ciphertext) { in test_cipher()
666 nciphertext = unhex_string(data->ciphertext, &ciphertext); in test_cipher()
668 if (data->plaintext) { in test_cipher()
669 nplaintext = unhex_string(data->plaintext, &plaintext); in test_cipher()
677 data->alg, data->mode, in test_cipher()
679 data->plaintext ? &error_abort : &err); in test_cipher()
680 if (data->plaintext) { in test_cipher()
688 keysize = qcrypto_cipher_get_key_len(data->alg); in test_cipher()
689 blocksize = qcrypto_cipher_get_block_len(data->alg); in test_cipher()
690 ivsize = qcrypto_cipher_get_iv_len(data->alg, data->mode); in test_cipher()
692 if (data->mode == QCRYPTO_CIPHER_MODE_XTS) { in test_cipher()
705 &error_abort) == 0); in test_cipher()
711 &error_abort) == 0); in test_cipher()
715 g_assert_cmpstr(outtexthex, ==, data->ciphertext); in test_cipher()
722 &error_abort) == 0); in test_cipher()
728 &error_abort) == 0); in test_cipher()
732 g_assert_cmpstr(outtexthex, ==, data->plaintext); in test_cipher()
748 uint8_t key[32] = { 0 }; in test_cipher_null_iv()
749 uint8_t plaintext[32] = { 0 }; in test_cipher_null_iv()
750 uint8_t ciphertext[32] = { 0 }; in test_cipher_null_iv()
774 uint8_t key[32] = { 0 }; in test_cipher_short_plaintext()
775 uint8_t plaintext1[20] = { 0 }; in test_cipher_short_plaintext()
776 uint8_t ciphertext1[20] = { 0 }; in test_cipher_short_plaintext()
777 uint8_t plaintext2[40] = { 0 }; in test_cipher_short_plaintext()
778 uint8_t ciphertext2[40] = { 0 }; in test_cipher_short_plaintext()
796 g_assert(ret == -1); in test_cipher_short_plaintext()
800 * block size, but not a multiple of block size in test_cipher_short_plaintext()
807 g_assert(ret == -1); in test_cipher_short_plaintext()
819 g_assert(qcrypto_init(NULL) == 0); in main()
821 for (i = 0; i < G_N_ELEMENTS(test_data); i++) { in main()
833 g_test_add_func("/crypto/cipher/null-iv", in main()
836 g_test_add_func("/crypto/cipher/short-plaintext", in main()
839 g_printerr("# skip unsupported aes-256:cbc\n"); in main()