summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch
diff options
context:
space:
mode:
authorChunrong Guo <chunrong.guo@nxp.com>2017-04-18 15:11:50 +0800
committerOtavio Salvador <otavio@ossystems.com.br>2017-05-02 17:54:58 -0300
commite756964ac2595d880304f227dec7bdb424d7d974 (patch)
tree28c067a5652216278a92e39144d48ac95f0e8f12 /recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch
parentcfb3ddaaaa78204ef5281c8627eed08f4f7e3f09 (diff)
downloadmeta-freescale-e756964ac2595d880304f227dec7bdb424d7d974.tar.gz
cryptodev: update to 6c2b61c
**include the following changes 6c2b61c - update copyright notes f79d523 - fix: reset finish condition before test start e8f7a91 - Merge remote-tracking branch 'upstream/master' 6818263 - Fix ablkcipher algorithms usage in v4.8+ kernels 26e167f - zc: Use the power of #elif e49fe25 - adjust to API changes in kernel >=4.10 2b29be8 - adjust to API changes in kernel >=4.10 c3afb40 - add support for rsa speed tests c9b7a80 - close the session after every test ba49470 - add support for authenc(hmac(sha1), cbc(aes)) speed tests 690cd62 - Merge branch 'master' into hpe2016 5adf04e - Merge remote-tracking branch 'upstream/master' 840c7ba - remove not used variable 2dbbb23 - do more strict code checking to avoid maintenance issues 88223e4 - avoid implicit conversion between signed and unsigned char 8db6905 - use buf_align macro to reduce code duplication b6d0e0f - rename header file to clarify purpose 1fd6062 - fix warnings of "implicit declaration of function" in async_speed ff3c8ab - remove not used local variables 25a1276 - fix incorrect return code in case of error from openssl_cioccrypt e7ef4ea - Merge pull request #17 from michaelweiser/gup_flags 99c6d21 - fix ignored SIGALRM signals on some platforms 71975fa - setting KERNEL_DIR is not necessary to build tests a96ff97 - fix issues with install target 07748d3 - Merge branch 'master' into hpe2016 cc89148 - Fix ablkcipher algorithms usage in v4.8+ kernels 4d6e4fb - Merge remote-tracking branch 'upstream/master' f126e48 - Adjust to another change in the user page API 4257fce - add -async option to run_crypto_tests.sh f953164 - merge sync and async benchmarks into a single program e7af57b - add % to cpu idle for convenience 1883c95 - add a wrapper script for running all tests 998b66b - add notes about configured limits in SEC driver b1a35f3 - fix ignored SIGALRM signals on some platforms b754517 - use the same algorithm names in sync_speed as in async_speed 8baefa4 - force LC_TIME value to avoid mpstat not using ISO8601 format d0978b5 - add sync speed tests with the same format as async ones 15d890b - graceful exit if cryptodev is not built with ASYNC flags 9a595bf - fix typo, use consistent spacing 9461878 - remove output line because it does not add clarity to the results b09c17f - the C standard used by cryptodev is C90 with GNU extensions 447808d - exit early if cryptodev tests are not installed 493afd3 - fix incorrect handling of error cases... e0d2c88 - make default output tabular abc007a - really fix (again...) the mpstat issue 2696cd5 - use $(...) instead of `...` for consistency e8fb004 - fix the scale of the runtime value 119151b - remove old results to avoid incorrect reports 71ac3d5 - fix the reported unit 8c47a0c - setting KERNEL_DIR is not necessary to build tests 182b307 - fix issues with install target 5021828 - do more strict code checking to avoid maintenance issues ab239d7 - return error code of the test if there is one b5228f2 - remove not used local variables 90d67ce - avoid implicit conversion between signed and unsigned char 4b442ca - fix build warnings on implicit function declarations 2821b92 - add a little space in the output for clarity 9d0ef05 - more precision in running mpstat 0180e2b - fix some issues with parsing mpstat output 4257fce - add -async option to run_crypto_tests.sh f953164 - merge sync and async benchmarks into a single program e7af57b - add % to cpu idle for convenience 7d7a733 - sanity check on /dev/crypto availability 137c0c4 - gracefull stop for async speed tests 600eb70 - fix: set min value when allocating alligned memory buffers 18408c9 - add multithreaded wrapper for async speed test 854cc84 - rename algorithm names for clarity 216f235 - honor the -m flag in async_speed 1023ede - add flag to report in a machine friendly format 219a8b4 - enable async code by default 9def784 - Merge remote-tracking branch 'radualexe/new_tests` 149dc1c - add basic optargs support for async_speed test 9595499 - add support for crc32c hash sync speed test 83e3840 - add support for aes-256-xts sync speed test fff72ae - add support for sha2-256 hash async speed test b961800 - add support for sha1 hash async speed test fea5006 - add support for crc32c hash async speed test 8768fad - add aes-256-xts support for async speed test Signed-off-by: Chunrong Guo <B40290@freescale.com> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch')
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch248
1 files changed, 248 insertions, 0 deletions
diff --git a/recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch b/recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch
new file mode 100644
index 00000000..83d0be12
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch
@@ -0,0 +1,248 @@
1From 6f4589ae57d141ea6257ae16df1709781d0fb8e4 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Tue, 29 Nov 2016 13:37:22 +0200
4Subject: [PATCH 096/104] use buf_align macro to reduce code duplication
5
6Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
7---
8 tests/async_cipher.c | 9 +++++----
9 tests/cipher-aead-srtp.c | 13 +++++++------
10 tests/cipher-aead.c | 13 +++++++------
11 tests/cipher-gcm.c | 17 +++++------------
12 tests/cipher.c | 9 +++++----
13 tests/testhelper.h | 9 +++++++++
14 6 files changed, 38 insertions(+), 32 deletions(-)
15 create mode 100644 tests/testhelper.h
16
17diff --git a/tests/async_cipher.c b/tests/async_cipher.c
18index db6fb06..7a184e5 100644
19--- a/tests/async_cipher.c
20+++ b/tests/async_cipher.c
21@@ -14,6 +14,7 @@
22 #include <crypto/cryptodev.h>
23
24 #include "asynchelper.h"
25+#include "testhelper.h"
26
27 #ifdef ENABLE_ASYNC
28
29@@ -62,8 +63,8 @@ test_crypto(int cfd)
30 perror("ioctl(CIOCGSESSINFO)");
31 return 1;
32 }
33- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
34- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
35+ plaintext = buf_align(plaintext_raw, siop.alignmask);
36+ ciphertext = buf_align(ciphertext_raw, siop.alignmask);
37 #else
38 plaintext = plaintext_raw;
39 ciphertext = ciphertext_raw;
40@@ -162,7 +163,7 @@ static int test_aes(int cfd)
41 perror("ioctl(CIOCGSESSINFO)");
42 return 1;
43 }
44- plaintext1 = (uint8_t *)(((unsigned long)plaintext1_raw + siop1.alignmask) & ~siop1.alignmask);
45+ plaintext1 = buf_align(plaintext1_raw, siop1.alignmask);
46 #else
47 plaintext1 = plaintext1_raw;
48 #endif
49@@ -185,7 +186,7 @@ static int test_aes(int cfd)
50 perror("ioctl(CIOCGSESSINFO)");
51 return 1;
52 }
53- plaintext2 = (uint8_t *)(((unsigned long)plaintext2_raw + siop2.alignmask) & ~siop2.alignmask);
54+ plaintext2 = buf_align(plaintext2_raw, siop2.alignmask);
55 #else
56 plaintext2 = plaintext2_raw;
57 #endif
58diff --git a/tests/cipher-aead-srtp.c b/tests/cipher-aead-srtp.c
59index c44877d..578d2f7 100644
60--- a/tests/cipher-aead-srtp.c
61+++ b/tests/cipher-aead-srtp.c
62@@ -12,6 +12,7 @@
63
64 #include <sys/ioctl.h>
65 #include <crypto/cryptodev.h>
66+#include "testhelper.h"
67
68 #define DATA_SIZE (8*1024)
69 #define HEADER_SIZE 193
70@@ -122,8 +123,8 @@ test_crypto(int cfd)
71 printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
72 siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
73
74- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
75- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
76+ plaintext = buf_align(plaintext_raw, siop.alignmask);
77+ ciphertext = buf_align(ciphertext_raw, siop.alignmask);
78
79 memset(plaintext, 0x15, HEADER_SIZE); /* header */
80 memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */
81@@ -265,8 +266,8 @@ test_encrypt_decrypt(int cfd)
82 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
83 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
84
85- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
86- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
87+ plaintext = buf_align(plaintext_raw, siop.alignmask);
88+ ciphertext = buf_align(ciphertext_raw, siop.alignmask);
89
90 memset(plaintext, 0x15, HEADER_SIZE); /* header */
91 memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */
92@@ -407,8 +408,8 @@ test_encrypt_decrypt_error(int cfd, int err)
93 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
94 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
95
96- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
97- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
98+ plaintext = buf_align(plaintext_raw, siop.alignmask);
99+ ciphertext = buf_align(ciphertext_raw, siop.alignmask);
100
101 memset(plaintext, 0x15, HEADER_SIZE); /* header */
102 memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */
103diff --git a/tests/cipher-aead.c b/tests/cipher-aead.c
104index da43aa6..b329d12 100644
105--- a/tests/cipher-aead.c
106+++ b/tests/cipher-aead.c
107@@ -12,6 +12,7 @@
108
109 #include <sys/ioctl.h>
110 #include <crypto/cryptodev.h>
111+#include "testhelper.h"
112
113 #define DATA_SIZE (8*1024)
114 #define AUTH_SIZE 31
115@@ -133,8 +134,8 @@ test_crypto(int cfd)
116 printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
117 siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
118
119- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
120- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
121+ plaintext = buf_align(plaintext_raw, siop.alignmask);
122+ ciphertext = buf_align(ciphertext_raw, siop.alignmask);
123 memset(plaintext, 0x15, DATA_SIZE);
124
125 if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) {
126@@ -285,8 +286,8 @@ test_encrypt_decrypt(int cfd)
127 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
128 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
129
130- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
131- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
132+ plaintext = buf_align(plaintext_raw, siop.alignmask);
133+ ciphertext = buf_align(ciphertext_raw, siop.alignmask);
134
135 memset(plaintext, 0x15, DATA_SIZE);
136
137@@ -434,8 +435,8 @@ test_encrypt_decrypt_error(int cfd, int err)
138 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
139 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
140
141- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
142- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
143+ plaintext = buf_align(plaintext_raw, siop.alignmask);
144+ ciphertext = buf_align(ciphertext_raw, siop.alignmask);
145 memset(plaintext, 0x15, DATA_SIZE);
146
147 if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) {
148diff --git a/tests/cipher-gcm.c b/tests/cipher-gcm.c
149index 3f6cc7b..d5f8486 100644
150--- a/tests/cipher-gcm.c
151+++ b/tests/cipher-gcm.c
152@@ -12,6 +12,7 @@
153
154 #include <sys/ioctl.h>
155 #include <crypto/cryptodev.h>
156+#include "testhelper.h"
157
158 #define DATA_SIZE (8*1024)
159 #define AUTH_SIZE 31
160@@ -232,12 +233,8 @@ static int test_encrypt_decrypt(int cfd)
161 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
162 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
163
164- plaintext =
165- (uint8_t *) (((unsigned long) plaintext_raw + siop.alignmask) &
166- ~siop.alignmask);
167- ciphertext =
168- (uint8_t *) (((unsigned long) ciphertext_raw + siop.alignmask) &
169- ~siop.alignmask);
170+ plaintext = (__u8 *)buf_align(plaintext_raw, siop.alignmask);
171+ ciphertext = (__u8 *)buf_align(ciphertext_raw, siop.alignmask);
172
173 memset(plaintext, 0x15, DATA_SIZE);
174
175@@ -385,12 +382,8 @@ static int test_encrypt_decrypt_error(int cfd, int err)
176 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
177 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
178
179- plaintext =
180- (uint8_t *) (((unsigned long) plaintext_raw + siop.alignmask) &
181- ~siop.alignmask);
182- ciphertext =
183- (uint8_t *) (((unsigned long) ciphertext_raw + siop.alignmask) &
184- ~siop.alignmask);
185+ plaintext = (__u8 *)buf_align(plaintext_raw, siop.alignmask);
186+ ciphertext = (__u8 *)buf_align(ciphertext_raw, siop.alignmask);
187
188 memset(plaintext, 0x15, DATA_SIZE);
189 memcpy(ciphertext, plaintext, DATA_SIZE);
190diff --git a/tests/cipher.c b/tests/cipher.c
191index f3ca2f0..222f095 100644
192--- a/tests/cipher.c
193+++ b/tests/cipher.c
194@@ -12,6 +12,7 @@
195
196 #include <sys/ioctl.h>
197 #include <crypto/cryptodev.h>
198+#include "testhelper.h"
199
200 static int debug = 0;
201
202@@ -58,8 +59,8 @@ test_crypto(int cfd)
203 printf("requested cipher CRYPTO_AES_CBC, got %s with driver %s\n",
204 siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
205
206- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
207- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
208+ plaintext = buf_align(plaintext_raw, siop.alignmask);
209+ ciphertext = buf_align(ciphertext_raw, siop.alignmask);
210 #else
211 plaintext = plaintext_raw;
212 ciphertext = ciphertext_raw;
213@@ -177,7 +178,7 @@ static int test_aes(int cfd)
214 perror("ioctl(CIOCGSESSINFO)");
215 return 1;
216 }
217- plaintext1 = (uint8_t *)(((unsigned long)plaintext1_raw + siop.alignmask) & ~siop.alignmask);
218+ plaintext1 = buf_align(plaintext1_raw, siop.alignmask);
219 #else
220 plaintext1 = plaintext1_raw;
221 #endif
222@@ -227,7 +228,7 @@ static int test_aes(int cfd)
223 printf("requested cipher CRYPTO_AES_CBC, got %s with driver %s\n",
224 siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
225
226- plaintext2 = (uint8_t *)(((unsigned long)plaintext2_raw + siop.alignmask) & ~siop.alignmask);
227+ plaintext2 = buf_align(plaintext2_raw, siop.alignmask);
228 #else
229 plaintext2 = plaintext2_raw;
230 #endif
231diff --git a/tests/testhelper.h b/tests/testhelper.h
232new file mode 100644
233index 0000000..800d10d
234--- /dev/null
235+++ b/tests/testhelper.h
236@@ -0,0 +1,9 @@
237+/*
238+ * Some helper stuff shared between the sample programs.
239+ */
240+#ifndef __TESTHELPER_H
241+#define __TESTHELPER_H
242+
243+#define buf_align(buf, align) (void *)(((unsigned long)(buf) + (align)) & ~(align))
244+
245+#endif /* __TESTHELPER_H */
246--
2472.10.2
248