diff options
Diffstat (limited to 'recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch')
| -rw-r--r-- | recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch b/recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch new file mode 100644 index 000000000..d2784b1c2 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch | |||
| @@ -0,0 +1,173 @@ | |||
| 1 | From 1fff269afd1925f4e4c7e37cc8c52187c407bc56 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Cristian Stoica <cristian.stoica@nxp.com> | ||
| 3 | Date: Tue, 29 Nov 2016 13:37:21 +0200 | ||
| 4 | Subject: [PATCH 095/104] rename header file to clarify purpose | ||
| 5 | |||
| 6 | testhelper.h suggests a common repository of utility functions but | ||
| 7 | current content targets only async tests. If we include it in non-async | ||
| 8 | tests we are forced to include <poll.h> as well. | ||
| 9 | |||
| 10 | Rename this header file to clarify that it targets only async tests | ||
| 11 | |||
| 12 | Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com> | ||
| 13 | --- | ||
| 14 | tests/async_cipher.c | 2 +- | ||
| 15 | tests/async_hmac.c | 2 +- | ||
| 16 | tests/asynchelper.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 17 | tests/testhelper.h | 57 ---------------------------------------------------- | ||
| 18 | 4 files changed, 56 insertions(+), 59 deletions(-) | ||
| 19 | create mode 100644 tests/asynchelper.h | ||
| 20 | delete mode 100644 tests/testhelper.h | ||
| 21 | |||
| 22 | diff --git a/tests/async_cipher.c b/tests/async_cipher.c | ||
| 23 | index dd08403..db6fb06 100644 | ||
| 24 | --- a/tests/async_cipher.c | ||
| 25 | +++ b/tests/async_cipher.c | ||
| 26 | @@ -13,7 +13,7 @@ | ||
| 27 | #include <sys/ioctl.h> | ||
| 28 | #include <crypto/cryptodev.h> | ||
| 29 | |||
| 30 | -#include "testhelper.h" | ||
| 31 | +#include "asynchelper.h" | ||
| 32 | |||
| 33 | #ifdef ENABLE_ASYNC | ||
| 34 | |||
| 35 | diff --git a/tests/async_hmac.c b/tests/async_hmac.c | ||
| 36 | index 85d19c6..1bdaad3 100644 | ||
| 37 | --- a/tests/async_hmac.c | ||
| 38 | +++ b/tests/async_hmac.c | ||
| 39 | @@ -14,7 +14,7 @@ | ||
| 40 | #include <sys/ioctl.h> | ||
| 41 | #include <crypto/cryptodev.h> | ||
| 42 | |||
| 43 | -#include "testhelper.h" | ||
| 44 | +#include "asynchelper.h" | ||
| 45 | |||
| 46 | #ifdef ENABLE_ASYNC | ||
| 47 | |||
| 48 | diff --git a/tests/asynchelper.h b/tests/asynchelper.h | ||
| 49 | new file mode 100644 | ||
| 50 | index 0000000..b5ab16c | ||
| 51 | --- /dev/null | ||
| 52 | +++ b/tests/asynchelper.h | ||
| 53 | @@ -0,0 +1,54 @@ | ||
| 54 | +#ifndef __ASYNCHELPER_H | ||
| 55 | +#define __ASYNCHELPER_H | ||
| 56 | + | ||
| 57 | +/* poll until POLLOUT, then call CIOCASYNCCRYPT */ | ||
| 58 | +inline int do_async_crypt(int cfd, struct crypt_op *cryp) | ||
| 59 | +{ | ||
| 60 | + struct pollfd pfd; | ||
| 61 | + | ||
| 62 | + pfd.fd = cfd; | ||
| 63 | + pfd.events = POLLOUT; | ||
| 64 | + | ||
| 65 | + if (poll(&pfd, 1, -1) < 1) { | ||
| 66 | + perror("poll()"); | ||
| 67 | + return 1; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + if (ioctl(cfd, CIOCASYNCCRYPT, cryp)) { | ||
| 71 | + perror("ioctl(CIOCCRYPT)"); | ||
| 72 | + return 1; | ||
| 73 | + } | ||
| 74 | + return 0; | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +/* poll until POLLIN, then call CIOCASYNCFETCH */ | ||
| 78 | +inline int do_async_fetch(int cfd, struct crypt_op *cryp) | ||
| 79 | +{ | ||
| 80 | + struct pollfd pfd; | ||
| 81 | + | ||
| 82 | + pfd.fd = cfd; | ||
| 83 | + pfd.events = POLLIN; | ||
| 84 | + | ||
| 85 | + if (poll(&pfd, 1, -1) < 1) { | ||
| 86 | + perror("poll()"); | ||
| 87 | + return 1; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + if (ioctl(cfd, CIOCASYNCFETCH, cryp)) { | ||
| 91 | + perror("ioctl(CIOCCRYPT)"); | ||
| 92 | + return 1; | ||
| 93 | + } | ||
| 94 | + return 0; | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +/* Check return value of stmt for identity with goodval. If they | ||
| 98 | + * don't match, call return with the value of stmt. */ | ||
| 99 | +#define DO_OR_DIE(stmt, goodval) { \ | ||
| 100 | + int __rc_val; \ | ||
| 101 | + if ((__rc_val = stmt) != goodval) { \ | ||
| 102 | + perror("DO_OR_DIE(" #stmt "," #goodval ")"); \ | ||
| 103 | + return __rc_val; \ | ||
| 104 | + } \ | ||
| 105 | +} | ||
| 106 | + | ||
| 107 | +#endif /* __ASYNCHELPER_H */ | ||
| 108 | diff --git a/tests/testhelper.h b/tests/testhelper.h | ||
| 109 | deleted file mode 100644 | ||
| 110 | index ea0b100..0000000 | ||
| 111 | --- a/tests/testhelper.h | ||
| 112 | +++ /dev/null | ||
| 113 | @@ -1,57 +0,0 @@ | ||
| 114 | -/* | ||
| 115 | - * Some helper stuff shared between the sample programs. | ||
| 116 | - */ | ||
| 117 | -#ifndef _TESTHELPER_H | ||
| 118 | -#define _TESTHELPER_H | ||
| 119 | - | ||
| 120 | -/* poll until POLLOUT, then call CIOCASYNCCRYPT */ | ||
| 121 | -inline int do_async_crypt(int cfd, struct crypt_op *cryp) | ||
| 122 | -{ | ||
| 123 | - struct pollfd pfd; | ||
| 124 | - | ||
| 125 | - pfd.fd = cfd; | ||
| 126 | - pfd.events = POLLOUT; | ||
| 127 | - | ||
| 128 | - if (poll(&pfd, 1, -1) < 1) { | ||
| 129 | - perror("poll()"); | ||
| 130 | - return 1; | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | - if (ioctl(cfd, CIOCASYNCCRYPT, cryp)) { | ||
| 134 | - perror("ioctl(CIOCCRYPT)"); | ||
| 135 | - return 1; | ||
| 136 | - } | ||
| 137 | - return 0; | ||
| 138 | -} | ||
| 139 | - | ||
| 140 | -/* poll until POLLIN, then call CIOCASYNCFETCH */ | ||
| 141 | -inline int do_async_fetch(int cfd, struct crypt_op *cryp) | ||
| 142 | -{ | ||
| 143 | - struct pollfd pfd; | ||
| 144 | - | ||
| 145 | - pfd.fd = cfd; | ||
| 146 | - pfd.events = POLLIN; | ||
| 147 | - | ||
| 148 | - if (poll(&pfd, 1, -1) < 1) { | ||
| 149 | - perror("poll()"); | ||
| 150 | - return 1; | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - if (ioctl(cfd, CIOCASYNCFETCH, cryp)) { | ||
| 154 | - perror("ioctl(CIOCCRYPT)"); | ||
| 155 | - return 1; | ||
| 156 | - } | ||
| 157 | - return 0; | ||
| 158 | -} | ||
| 159 | - | ||
| 160 | -/* Check return value of stmt for identity with goodval. If they | ||
| 161 | - * don't match, call return with the value of stmt. */ | ||
| 162 | -#define DO_OR_DIE(stmt, goodval) { \ | ||
| 163 | - int __rc_val; \ | ||
| 164 | - if ((__rc_val = stmt) != goodval) { \ | ||
| 165 | - perror("DO_OR_DIE(" #stmt "," #goodval ")"); \ | ||
| 166 | - return __rc_val; \ | ||
| 167 | - } \ | ||
| 168 | -} | ||
| 169 | - | ||
| 170 | -#endif /* _TESTHELPER_H */ | ||
| 171 | -- | ||
| 172 | 2.10.2 | ||
| 173 | |||
