summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch')
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch92
1 files changed, 0 insertions, 92 deletions
diff --git a/recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch
deleted file mode 100644
index b1a790eb..00000000
--- a/recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch
+++ /dev/null
@@ -1,92 +0,0 @@
1From aa329106f586f8d055ceaa919e327ebc99bdd6e3 Mon Sep 17 00:00:00 2001
2From: Alexe Radu <radu.alexe@nxp.com>
3Date: Tue, 25 Oct 2016 11:15:37 +0300
4Subject: [PATCH 045/104] add support for crc32c hash async speed test
5
6Signed-off-by: Alexe Radu <radu.alexe@nxp.com>
7---
8 crypto/cryptodev.h | 1 +
9 ioctl.c | 4 ++++
10 tests/async_speed.c | 25 +++++++++++++++++++++++++
11 3 files changed, 30 insertions(+)
12
13diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
14index 9ade102..05221a4 100644
15--- a/crypto/cryptodev.h
16+++ b/crypto/cryptodev.h
17@@ -46,6 +46,7 @@ enum cryptodev_crypto_op_t {
18 CRYPTO_AES_XTS = 22,
19 CRYPTO_AES_ECB = 23,
20 CRYPTO_AES_GCM = 50,
21+ CRYPTO_CRC32C,
22
23 CRYPTO_CAMELLIA_CBC = 101,
24 CRYPTO_RIPEMD160,
25diff --git a/ioctl.c b/ioctl.c
26index ca3c5ac..2e2bdeb 100644
27--- a/ioctl.c
28+++ b/ioctl.c
29@@ -286,6 +286,10 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
30 hash_name = "sha512";
31 hmac_mode = 0;
32 break;
33+ case CRYPTO_CRC32C:
34+ hash_name = "crc32c";
35+ hmac_mode = 0;
36+ break;
37 default:
38 ddebug(1, "bad mac: %d", sop->mac);
39 return -EINVAL;
40diff --git a/tests/async_speed.c b/tests/async_speed.c
41index 39a3d23..8978b4b 100644
42--- a/tests/async_speed.c
43+++ b/tests/async_speed.c
44@@ -65,6 +65,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
45 {
46 struct crypt_op cop;
47 char *buffer[64], iv[32];
48+ char mac[64][HASH_MAX_LEN];
49 static int val = 23;
50 struct timeval start, end;
51 double total = 0;
52@@ -114,6 +115,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
53 cop.iv = (unsigned char *)iv;
54 cop.op = COP_ENCRYPT;
55 cop.src = cop.dst = (unsigned char *)buffer[bufidx];
56+ cop.mac = mac[bufidx];
57 bufidx = (bufidx + 1) % 64;
58
59 if (ioctl(fdc, CIOCASYNCCRYPT, &cop)) {
60@@ -235,6 +237,29 @@ int main(void)
61 break;
62 }
63
64+ fprintf(stderr, "\nTesting CRC32C hash: \n");
65+ memset(&sess, 0, sizeof(sess));
66+ sess.mac = CRYPTO_CRC32C;
67+ if (ioctl(fdc, CIOCGSESSION, &sess)) {
68+ perror("ioctl(CIOCGSESSION)");
69+ return 1;
70+ }
71+#ifdef CIOCGSESSINFO
72+ siop.ses = sess.ses;
73+ if (ioctl(fdc, CIOCGSESSINFO, &siop)) {
74+ perror("ioctl(CIOCGSESSION)");
75+ return 1;
76+ }
77+ printf("requested hash CRYPTO_CRC32C, got %s with driver %s\n",
78+ siop.hash_info.cra_name, siop.hash_info.cra_driver_name);
79+ alignmask = siop.alignmask;
80+#endif
81+
82+ for (i = 256; i <= (64 * 1024); i *= 2) {
83+ if (encrypt_data(&sess, fdc, i, alignmask))
84+ break;
85+ }
86+
87 end:
88 close(fdc);
89 close(fd);
90--
912.10.2
92