diff options
Diffstat (limited to 'recipes-kernel/cryptodev/sdk_patches/0049-add-support-for-crc32c-hash-sync-speed-test.patch')
| -rw-r--r-- | recipes-kernel/cryptodev/sdk_patches/0049-add-support-for-crc32c-hash-sync-speed-test.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/recipes-kernel/cryptodev/sdk_patches/0049-add-support-for-crc32c-hash-sync-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0049-add-support-for-crc32c-hash-sync-speed-test.patch new file mode 100644 index 000000000..26279b68a --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0049-add-support-for-crc32c-hash-sync-speed-test.patch | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | From af3d42a68f1e356d21e52e72f3f5ebc7cfd90e81 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alexe Radu <radu.alexe@nxp.com> | ||
| 3 | Date: Tue, 25 Oct 2016 12:13:58 +0300 | ||
| 4 | Subject: [PATCH 049/104] add support for crc32c hash sync speed test | ||
| 5 | |||
| 6 | Signed-off-by: Alexe Radu <radu.alexe@nxp.com> | ||
| 7 | --- | ||
| 8 | tests/speed.c | 25 +++++++++++++++++++++++++ | ||
| 9 | 1 file changed, 25 insertions(+) | ||
| 10 | |||
| 11 | diff --git a/tests/speed.c b/tests/speed.c | ||
| 12 | index 16ad7b7..bd6d2b2 100644 | ||
| 13 | --- a/tests/speed.c | ||
| 14 | +++ b/tests/speed.c | ||
| 15 | @@ -74,6 +74,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) | ||
| 16 | { | ||
| 17 | struct crypt_op cop; | ||
| 18 | char *buffer, iv[32]; | ||
| 19 | + char mac[HASH_MAX_LEN]; | ||
| 20 | static int val = 23; | ||
| 21 | struct timeval start, end; | ||
| 22 | double total = 0; | ||
| 23 | @@ -110,6 +111,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) | ||
| 24 | cop.iv = (unsigned char *)iv; | ||
| 25 | cop.op = COP_ENCRYPT; | ||
| 26 | cop.src = cop.dst = (unsigned char *)buffer; | ||
| 27 | + cop.mac = mac; | ||
| 28 | |||
| 29 | if (ioctl(fdc, CIOCCRYPT, &cop)) { | ||
| 30 | perror("ioctl(CIOCCRYPT)"); | ||
| 31 | @@ -230,6 +232,29 @@ int main(int argc, char** argv) | ||
| 32 | break; | ||
| 33 | } | ||
| 34 | |||
| 35 | + fprintf(stderr, "\nTesting CRC32C hash: \n"); | ||
| 36 | + memset(&sess, 0, sizeof(sess)); | ||
| 37 | + sess.mac = CRYPTO_CRC32C; | ||
| 38 | + if (ioctl(fdc, CIOCGSESSION, &sess)) { | ||
| 39 | + perror("ioctl(CIOCGSESSION)"); | ||
| 40 | + return 1; | ||
| 41 | + } | ||
| 42 | +#ifdef CIOCGSESSINFO | ||
| 43 | + siop.ses = sess.ses; | ||
| 44 | + if (ioctl(fdc, CIOCGSESSINFO, &siop)) { | ||
| 45 | + perror("ioctl(CIOCGSESSINFO)"); | ||
| 46 | + return 1; | ||
| 47 | + } | ||
| 48 | + printf("requested hash CRYPTO_CRC32C, got %s with driver %s\n", | ||
| 49 | + siop.hash_info.cra_name, siop.hash_info.cra_driver_name); | ||
| 50 | + alignmask = siop.alignmask; | ||
| 51 | +#endif | ||
| 52 | + | ||
| 53 | + for (i = 512; i <= (64 * 1024); i *= 2) { | ||
| 54 | + if (encrypt_data(&sess, fdc, i, alignmask)) | ||
| 55 | + break; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | close(fdc); | ||
| 59 | close(fd); | ||
| 60 | return 0; | ||
| 61 | -- | ||
| 62 | 2.10.2 | ||
| 63 | |||
