diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 18:53:46 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 18:53:46 -0400 |
| commit | 5a0387a8a8efb90ae7fea1e2e5c62de3efa74691 (patch) | |
| tree | 9e5bbbafe7fea01c843d86c7c3d40f29f962c474 /include | |
| parent | 204f144c9fcac355843412b6ba1150086488a208 (diff) | |
| parent | 929562b144783b9212625305eadcbbd800809643 (diff) | |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto updates from Herbert Xu:
"Here is the crypto update for 4.12:
API:
- Add batch registration for acomp/scomp
- Change acomp testing to non-unique compressed result
- Extend algorithm name limit to 128 bytes
- Require setkey before accept(2) in algif_aead
Algorithms:
- Add support for deflate rfc1950 (zlib)
Drivers:
- Add accelerated crct10dif for powerpc
- Add crc32 in stm32
- Add sha384/sha512 in ccp
- Add 3des/gcm(aes) for v5 devices in ccp
- Add Queue Interface (QI) backend support in caam
- Add new Exynos RNG driver
- Add ThunderX ZIP driver
- Add driver for hardware random generator on MT7623 SoC"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (101 commits)
crypto: stm32 - Fix OF module alias information
crypto: algif_aead - Require setkey before accept(2)
crypto: scomp - add support for deflate rfc1950 (zlib)
crypto: scomp - allow registration of multiple scomps
crypto: ccp - Change ISR handler method for a v5 CCP
crypto: ccp - Change ISR handler method for a v3 CCP
crypto: crypto4xx - rename ce_ring_contol to ce_ring_control
crypto: testmgr - Allow ecb(cipher_null) in FIPS mode
Revert "crypto: arm64/sha - Add constant operand modifier to ASM_EXPORT"
crypto: ccp - Disable interrupts early on unload
crypto: ccp - Use only the relevant interrupt bits
hwrng: mtk - Add driver for hardware random generator on MT7623 SoC
dt-bindings: hwrng: Add Mediatek hardware random generator bindings
crypto: crct10dif-vpmsum - Fix missing preempt_disable()
crypto: testmgr - replace compression known answer test
crypto: acomp - allow registration of multiple acomps
hwrng: n2 - Use devm_kcalloc() in n2rng_probe()
crypto: chcr - Fix error handling related to 'chcr_alloc_shash'
padata: get_next is never NULL
crypto: exynos - Add new Exynos RNG driver
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/crypto/gf128mul.h | 87 | ||||
| -rw-r--r-- | include/crypto/internal/acompress.h | 3 | ||||
| -rw-r--r-- | include/crypto/internal/scompress.h | 3 | ||||
| -rw-r--r-- | include/crypto/kpp.h | 6 | ||||
| -rw-r--r-- | include/crypto/xts.h | 2 | ||||
| -rw-r--r-- | include/dt-bindings/clock/gxbb-clkc.h | 3 | ||||
| -rw-r--r-- | include/linux/ccp.h | 68 | ||||
| -rw-r--r-- | include/linux/crypto.h | 2 | ||||
| -rw-r--r-- | include/linux/cryptohash.h | 5 | ||||
| -rw-r--r-- | include/linux/kernel.h | 1 | ||||
| -rw-r--r-- | include/soc/fsl/qman.h | 109 | ||||
| -rw-r--r-- | include/uapi/linux/cryptouser.h | 10 | ||||
| -rw-r--r-- | include/video/udlfb.h | 2 |
13 files changed, 266 insertions, 35 deletions
diff --git a/include/crypto/gf128mul.h b/include/crypto/gf128mul.h index 592d47e565a8..0977fb18ff68 100644 --- a/include/crypto/gf128mul.h +++ b/include/crypto/gf128mul.h | |||
| @@ -43,12 +43,13 @@ | |||
| 43 | --------------------------------------------------------------------------- | 43 | --------------------------------------------------------------------------- |
| 44 | Issue Date: 31/01/2006 | 44 | Issue Date: 31/01/2006 |
| 45 | 45 | ||
| 46 | An implementation of field multiplication in Galois Field GF(128) | 46 | An implementation of field multiplication in Galois Field GF(2^128) |
| 47 | */ | 47 | */ |
| 48 | 48 | ||
| 49 | #ifndef _CRYPTO_GF128MUL_H | 49 | #ifndef _CRYPTO_GF128MUL_H |
| 50 | #define _CRYPTO_GF128MUL_H | 50 | #define _CRYPTO_GF128MUL_H |
| 51 | 51 | ||
| 52 | #include <asm/byteorder.h> | ||
| 52 | #include <crypto/b128ops.h> | 53 | #include <crypto/b128ops.h> |
| 53 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
| 54 | 55 | ||
| @@ -65,7 +66,7 @@ | |||
| 65 | * are left and the lsb's are right. char b[16] is an array and b[0] is | 66 | * are left and the lsb's are right. char b[16] is an array and b[0] is |
| 66 | * the first octet. | 67 | * the first octet. |
| 67 | * | 68 | * |
| 68 | * 80000000 00000000 00000000 00000000 .... 00000000 00000000 00000000 | 69 | * 10000000 00000000 00000000 00000000 .... 00000000 00000000 00000000 |
| 69 | * b[0] b[1] b[2] b[3] b[13] b[14] b[15] | 70 | * b[0] b[1] b[2] b[3] b[13] b[14] b[15] |
| 70 | * | 71 | * |
| 71 | * Every bit is a coefficient of some power of X. We can store the bits | 72 | * Every bit is a coefficient of some power of X. We can store the bits |
| @@ -85,15 +86,17 @@ | |||
| 85 | * Both of the above formats are easy to implement on big-endian | 86 | * Both of the above formats are easy to implement on big-endian |
| 86 | * machines. | 87 | * machines. |
| 87 | * | 88 | * |
| 88 | * EME (which is patent encumbered) uses the ble format (bits are stored | 89 | * XTS and EME (the latter of which is patent encumbered) use the ble |
| 89 | * in big endian order and the bytes in little endian). The above buffer | 90 | * format (bits are stored in big endian order and the bytes in little |
| 90 | * represents X^7 in this case and the primitive polynomial is b[0] = 0x87. | 91 | * endian). The above buffer represents X^7 in this case and the |
| 92 | * primitive polynomial is b[0] = 0x87. | ||
| 91 | * | 93 | * |
| 92 | * The common machine word-size is smaller than 128 bits, so to make | 94 | * The common machine word-size is smaller than 128 bits, so to make |
| 93 | * an efficient implementation we must split into machine word sizes. | 95 | * an efficient implementation we must split into machine word sizes. |
| 94 | * This file uses one 32bit for the moment. Machine endianness comes into | 96 | * This implementation uses 64-bit words for the moment. Machine |
| 95 | * play. The lle format in relation to machine endianness is discussed | 97 | * endianness comes into play. The lle format in relation to machine |
| 96 | * below by the original author of gf128mul Dr Brian Gladman. | 98 | * endianness is discussed below by the original author of gf128mul Dr |
| 99 | * Brian Gladman. | ||
| 97 | * | 100 | * |
| 98 | * Let's look at the bbe and ble format on a little endian machine. | 101 | * Let's look at the bbe and ble format on a little endian machine. |
| 99 | * | 102 | * |
| @@ -127,10 +130,10 @@ | |||
| 127 | * machines this will automatically aligned to wordsize and on a 64-bit | 130 | * machines this will automatically aligned to wordsize and on a 64-bit |
| 128 | * machine also. | 131 | * machine also. |
| 129 | */ | 132 | */ |
| 130 | /* Multiply a GF128 field element by x. Field elements are held in arrays | 133 | /* Multiply a GF(2^128) field element by x. Field elements are |
| 131 | of bytes in which field bits 8n..8n + 7 are held in byte[n], with lower | 134 | held in arrays of bytes in which field bits 8n..8n + 7 are held in |
| 132 | indexed bits placed in the more numerically significant bit positions | 135 | byte[n], with lower indexed bits placed in the more numerically |
| 133 | within bytes. | 136 | significant bit positions within bytes. |
| 134 | 137 | ||
| 135 | On little endian machines the bit indexes translate into the bit | 138 | On little endian machines the bit indexes translate into the bit |
| 136 | positions within four 32-bit words in the following way | 139 | positions within four 32-bit words in the following way |
| @@ -161,8 +164,58 @@ void gf128mul_lle(be128 *a, const be128 *b); | |||
| 161 | 164 | ||
| 162 | void gf128mul_bbe(be128 *a, const be128 *b); | 165 | void gf128mul_bbe(be128 *a, const be128 *b); |
| 163 | 166 | ||
| 164 | /* multiply by x in ble format, needed by XTS */ | 167 | /* |
| 165 | void gf128mul_x_ble(be128 *a, const be128 *b); | 168 | * The following functions multiply a field element by x in |
| 169 | * the polynomial field representation. They use 64-bit word operations | ||
| 170 | * to gain speed but compensate for machine endianness and hence work | ||
| 171 | * correctly on both styles of machine. | ||
| 172 | * | ||
| 173 | * They are defined here for performance. | ||
| 174 | */ | ||
| 175 | |||
| 176 | static inline u64 gf128mul_mask_from_bit(u64 x, int which) | ||
| 177 | { | ||
| 178 | /* a constant-time version of 'x & ((u64)1 << which) ? (u64)-1 : 0' */ | ||
| 179 | return ((s64)(x << (63 - which)) >> 63); | ||
| 180 | } | ||
| 181 | |||
| 182 | static inline void gf128mul_x_lle(be128 *r, const be128 *x) | ||
| 183 | { | ||
| 184 | u64 a = be64_to_cpu(x->a); | ||
| 185 | u64 b = be64_to_cpu(x->b); | ||
| 186 | |||
| 187 | /* equivalent to gf128mul_table_le[(b << 7) & 0xff] << 48 | ||
| 188 | * (see crypto/gf128mul.c): */ | ||
| 189 | u64 _tt = gf128mul_mask_from_bit(b, 0) & ((u64)0xe1 << 56); | ||
| 190 | |||
| 191 | r->b = cpu_to_be64((b >> 1) | (a << 63)); | ||
| 192 | r->a = cpu_to_be64((a >> 1) ^ _tt); | ||
| 193 | } | ||
| 194 | |||
| 195 | static inline void gf128mul_x_bbe(be128 *r, const be128 *x) | ||
| 196 | { | ||
| 197 | u64 a = be64_to_cpu(x->a); | ||
| 198 | u64 b = be64_to_cpu(x->b); | ||
| 199 | |||
| 200 | /* equivalent to gf128mul_table_be[a >> 63] (see crypto/gf128mul.c): */ | ||
| 201 | u64 _tt = gf128mul_mask_from_bit(a, 63) & 0x87; | ||
| 202 | |||
| 203 | r->a = cpu_to_be64((a << 1) | (b >> 63)); | ||
| 204 | r->b = cpu_to_be64((b << 1) ^ _tt); | ||
| 205 | } | ||
| 206 | |||
| 207 | /* needed by XTS */ | ||
| 208 | static inline void gf128mul_x_ble(le128 *r, const le128 *x) | ||
| 209 | { | ||
| 210 | u64 a = le64_to_cpu(x->a); | ||
| 211 | u64 b = le64_to_cpu(x->b); | ||
| 212 | |||
| 213 | /* equivalent to gf128mul_table_be[b >> 63] (see crypto/gf128mul.c): */ | ||
| 214 | u64 _tt = gf128mul_mask_from_bit(a, 63) & 0x87; | ||
| 215 | |||
| 216 | r->a = cpu_to_le64((a << 1) | (b >> 63)); | ||
| 217 | r->b = cpu_to_le64((b << 1) ^ _tt); | ||
| 218 | } | ||
| 166 | 219 | ||
| 167 | /* 4k table optimization */ | 220 | /* 4k table optimization */ |
| 168 | 221 | ||
| @@ -172,8 +225,8 @@ struct gf128mul_4k { | |||
| 172 | 225 | ||
| 173 | struct gf128mul_4k *gf128mul_init_4k_lle(const be128 *g); | 226 | struct gf128mul_4k *gf128mul_init_4k_lle(const be128 *g); |
| 174 | struct gf128mul_4k *gf128mul_init_4k_bbe(const be128 *g); | 227 | struct gf128mul_4k *gf128mul_init_4k_bbe(const be128 *g); |
| 175 | void gf128mul_4k_lle(be128 *a, struct gf128mul_4k *t); | 228 | void gf128mul_4k_lle(be128 *a, const struct gf128mul_4k *t); |
| 176 | void gf128mul_4k_bbe(be128 *a, struct gf128mul_4k *t); | 229 | void gf128mul_4k_bbe(be128 *a, const struct gf128mul_4k *t); |
| 177 | 230 | ||
| 178 | static inline void gf128mul_free_4k(struct gf128mul_4k *t) | 231 | static inline void gf128mul_free_4k(struct gf128mul_4k *t) |
| 179 | { | 232 | { |
| @@ -194,6 +247,6 @@ struct gf128mul_64k { | |||
| 194 | */ | 247 | */ |
| 195 | struct gf128mul_64k *gf128mul_init_64k_bbe(const be128 *g); | 248 | struct gf128mul_64k *gf128mul_init_64k_bbe(const be128 *g); |
| 196 | void gf128mul_free_64k(struct gf128mul_64k *t); | 249 | void gf128mul_free_64k(struct gf128mul_64k *t); |
| 197 | void gf128mul_64k_bbe(be128 *a, struct gf128mul_64k *t); | 250 | void gf128mul_64k_bbe(be128 *a, const struct gf128mul_64k *t); |
| 198 | 251 | ||
| 199 | #endif /* _CRYPTO_GF128MUL_H */ | 252 | #endif /* _CRYPTO_GF128MUL_H */ |
diff --git a/include/crypto/internal/acompress.h b/include/crypto/internal/acompress.h index 1de2b5af12d7..51052f65cefc 100644 --- a/include/crypto/internal/acompress.h +++ b/include/crypto/internal/acompress.h | |||
| @@ -78,4 +78,7 @@ int crypto_register_acomp(struct acomp_alg *alg); | |||
| 78 | */ | 78 | */ |
| 79 | int crypto_unregister_acomp(struct acomp_alg *alg); | 79 | int crypto_unregister_acomp(struct acomp_alg *alg); |
| 80 | 80 | ||
| 81 | int crypto_register_acomps(struct acomp_alg *algs, int count); | ||
| 82 | void crypto_unregister_acomps(struct acomp_alg *algs, int count); | ||
| 83 | |||
| 81 | #endif | 84 | #endif |
diff --git a/include/crypto/internal/scompress.h b/include/crypto/internal/scompress.h index 3fda3c5655a0..ccad9b2c9bd6 100644 --- a/include/crypto/internal/scompress.h +++ b/include/crypto/internal/scompress.h | |||
| @@ -133,4 +133,7 @@ int crypto_register_scomp(struct scomp_alg *alg); | |||
| 133 | */ | 133 | */ |
| 134 | int crypto_unregister_scomp(struct scomp_alg *alg); | 134 | int crypto_unregister_scomp(struct scomp_alg *alg); |
| 135 | 135 | ||
| 136 | int crypto_register_scomps(struct scomp_alg *algs, int count); | ||
| 137 | void crypto_unregister_scomps(struct scomp_alg *algs, int count); | ||
| 138 | |||
| 136 | #endif | 139 | #endif |
diff --git a/include/crypto/kpp.h b/include/crypto/kpp.h index 4307a2f2365f..ce8e1f79374b 100644 --- a/include/crypto/kpp.h +++ b/include/crypto/kpp.h | |||
| @@ -74,7 +74,7 @@ struct crypto_kpp { | |||
| 74 | * @base: Common crypto API algorithm data structure | 74 | * @base: Common crypto API algorithm data structure |
| 75 | */ | 75 | */ |
| 76 | struct kpp_alg { | 76 | struct kpp_alg { |
| 77 | int (*set_secret)(struct crypto_kpp *tfm, void *buffer, | 77 | int (*set_secret)(struct crypto_kpp *tfm, const void *buffer, |
| 78 | unsigned int len); | 78 | unsigned int len); |
| 79 | int (*generate_public_key)(struct kpp_request *req); | 79 | int (*generate_public_key)(struct kpp_request *req); |
| 80 | int (*compute_shared_secret)(struct kpp_request *req); | 80 | int (*compute_shared_secret)(struct kpp_request *req); |
| @@ -273,8 +273,8 @@ struct kpp_secret { | |||
| 273 | * | 273 | * |
| 274 | * Return: zero on success; error code in case of error | 274 | * Return: zero on success; error code in case of error |
| 275 | */ | 275 | */ |
| 276 | static inline int crypto_kpp_set_secret(struct crypto_kpp *tfm, void *buffer, | 276 | static inline int crypto_kpp_set_secret(struct crypto_kpp *tfm, |
| 277 | unsigned int len) | 277 | const void *buffer, unsigned int len) |
| 278 | { | 278 | { |
| 279 | struct kpp_alg *alg = crypto_kpp_alg(tfm); | 279 | struct kpp_alg *alg = crypto_kpp_alg(tfm); |
| 280 | 280 | ||
diff --git a/include/crypto/xts.h b/include/crypto/xts.h index 77b630672b2c..c0bde308b28a 100644 --- a/include/crypto/xts.h +++ b/include/crypto/xts.h | |||
| @@ -11,7 +11,7 @@ struct blkcipher_desc; | |||
| 11 | #define XTS_BLOCK_SIZE 16 | 11 | #define XTS_BLOCK_SIZE 16 |
| 12 | 12 | ||
| 13 | struct xts_crypt_req { | 13 | struct xts_crypt_req { |
| 14 | be128 *tbuf; | 14 | le128 *tbuf; |
| 15 | unsigned int tbuflen; | 15 | unsigned int tbuflen; |
| 16 | 16 | ||
| 17 | void *tweak_ctx; | 17 | void *tweak_ctx; |
diff --git a/include/dt-bindings/clock/gxbb-clkc.h b/include/dt-bindings/clock/gxbb-clkc.h index 692846c7941b..63f4c2c44a1f 100644 --- a/include/dt-bindings/clock/gxbb-clkc.h +++ b/include/dt-bindings/clock/gxbb-clkc.h | |||
| @@ -12,9 +12,10 @@ | |||
| 12 | #define CLKID_FCLK_DIV4 6 | 12 | #define CLKID_FCLK_DIV4 6 |
| 13 | #define CLKID_CLK81 12 | 13 | #define CLKID_CLK81 12 |
| 14 | #define CLKID_MPLL2 15 | 14 | #define CLKID_MPLL2 15 |
| 15 | #define CLKID_SPI 34 | ||
| 16 | #define CLKID_I2C 22 | 15 | #define CLKID_I2C 22 |
| 17 | #define CLKID_SAR_ADC 23 | 16 | #define CLKID_SAR_ADC 23 |
| 17 | #define CLKID_RNG0 25 | ||
| 18 | #define CLKID_SPI 34 | ||
| 18 | #define CLKID_ETH 36 | 19 | #define CLKID_ETH 36 |
| 19 | #define CLKID_USB0 50 | 20 | #define CLKID_USB0 50 |
| 20 | #define CLKID_USB1 51 | 21 | #define CLKID_USB1 51 |
diff --git a/include/linux/ccp.h b/include/linux/ccp.h index c41b8d99dd0e..3285c944194a 100644 --- a/include/linux/ccp.h +++ b/include/linux/ccp.h | |||
| @@ -123,6 +123,10 @@ enum ccp_aes_mode { | |||
| 123 | CCP_AES_MODE_CFB, | 123 | CCP_AES_MODE_CFB, |
| 124 | CCP_AES_MODE_CTR, | 124 | CCP_AES_MODE_CTR, |
| 125 | CCP_AES_MODE_CMAC, | 125 | CCP_AES_MODE_CMAC, |
| 126 | CCP_AES_MODE_GHASH, | ||
| 127 | CCP_AES_MODE_GCTR, | ||
| 128 | CCP_AES_MODE_GCM, | ||
| 129 | CCP_AES_MODE_GMAC, | ||
| 126 | CCP_AES_MODE__LAST, | 130 | CCP_AES_MODE__LAST, |
| 127 | }; | 131 | }; |
| 128 | 132 | ||
| @@ -137,6 +141,9 @@ enum ccp_aes_action { | |||
| 137 | CCP_AES_ACTION_ENCRYPT, | 141 | CCP_AES_ACTION_ENCRYPT, |
| 138 | CCP_AES_ACTION__LAST, | 142 | CCP_AES_ACTION__LAST, |
| 139 | }; | 143 | }; |
| 144 | /* Overloaded field */ | ||
| 145 | #define CCP_AES_GHASHAAD CCP_AES_ACTION_DECRYPT | ||
| 146 | #define CCP_AES_GHASHFINAL CCP_AES_ACTION_ENCRYPT | ||
| 140 | 147 | ||
| 141 | /** | 148 | /** |
| 142 | * struct ccp_aes_engine - CCP AES operation | 149 | * struct ccp_aes_engine - CCP AES operation |
| @@ -181,6 +188,8 @@ struct ccp_aes_engine { | |||
| 181 | struct scatterlist *cmac_key; /* K1/K2 cmac key required for | 188 | struct scatterlist *cmac_key; /* K1/K2 cmac key required for |
| 182 | * final cmac cmd */ | 189 | * final cmac cmd */ |
| 183 | u32 cmac_key_len; /* In bytes */ | 190 | u32 cmac_key_len; /* In bytes */ |
| 191 | |||
| 192 | u32 aad_len; /* In bytes */ | ||
| 184 | }; | 193 | }; |
| 185 | 194 | ||
| 186 | /***** XTS-AES engine *****/ | 195 | /***** XTS-AES engine *****/ |
| @@ -249,6 +258,8 @@ enum ccp_sha_type { | |||
| 249 | CCP_SHA_TYPE_1 = 1, | 258 | CCP_SHA_TYPE_1 = 1, |
| 250 | CCP_SHA_TYPE_224, | 259 | CCP_SHA_TYPE_224, |
| 251 | CCP_SHA_TYPE_256, | 260 | CCP_SHA_TYPE_256, |
| 261 | CCP_SHA_TYPE_384, | ||
| 262 | CCP_SHA_TYPE_512, | ||
| 252 | CCP_SHA_TYPE__LAST, | 263 | CCP_SHA_TYPE__LAST, |
| 253 | }; | 264 | }; |
| 254 | 265 | ||
| @@ -290,6 +301,60 @@ struct ccp_sha_engine { | |||
| 290 | * final sha cmd */ | 301 | * final sha cmd */ |
| 291 | }; | 302 | }; |
| 292 | 303 | ||
| 304 | /***** 3DES engine *****/ | ||
| 305 | enum ccp_des3_mode { | ||
| 306 | CCP_DES3_MODE_ECB = 0, | ||
| 307 | CCP_DES3_MODE_CBC, | ||
| 308 | CCP_DES3_MODE_CFB, | ||
| 309 | CCP_DES3_MODE__LAST, | ||
| 310 | }; | ||
| 311 | |||
| 312 | enum ccp_des3_type { | ||
| 313 | CCP_DES3_TYPE_168 = 1, | ||
| 314 | CCP_DES3_TYPE__LAST, | ||
| 315 | }; | ||
| 316 | |||
| 317 | enum ccp_des3_action { | ||
| 318 | CCP_DES3_ACTION_DECRYPT = 0, | ||
| 319 | CCP_DES3_ACTION_ENCRYPT, | ||
| 320 | CCP_DES3_ACTION__LAST, | ||
| 321 | }; | ||
| 322 | |||
| 323 | /** | ||
| 324 | * struct ccp_des3_engine - CCP SHA operation | ||
| 325 | * @type: Type of 3DES operation | ||
| 326 | * @mode: cipher mode | ||
| 327 | * @action: 3DES operation (decrypt/encrypt) | ||
| 328 | * @key: key to be used for this 3DES operation | ||
| 329 | * @key_len: length of key (in bytes) | ||
| 330 | * @iv: IV to be used for this AES operation | ||
| 331 | * @iv_len: length in bytes of iv | ||
| 332 | * @src: input data to be used for this operation | ||
| 333 | * @src_len: length of input data used for this operation (in bytes) | ||
| 334 | * @dst: output data produced by this operation | ||
| 335 | * | ||
| 336 | * Variables required to be set when calling ccp_enqueue_cmd(): | ||
| 337 | * - type, mode, action, key, key_len, src, dst, src_len | ||
| 338 | * - iv, iv_len for any mode other than ECB | ||
| 339 | * | ||
| 340 | * The iv variable is used as both input and output. On completion of the | ||
| 341 | * 3DES operation the new IV overwrites the old IV. | ||
| 342 | */ | ||
| 343 | struct ccp_des3_engine { | ||
| 344 | enum ccp_des3_type type; | ||
| 345 | enum ccp_des3_mode mode; | ||
| 346 | enum ccp_des3_action action; | ||
| 347 | |||
| 348 | struct scatterlist *key; | ||
| 349 | u32 key_len; /* In bytes */ | ||
| 350 | |||
| 351 | struct scatterlist *iv; | ||
| 352 | u32 iv_len; /* In bytes */ | ||
| 353 | |||
| 354 | struct scatterlist *src, *dst; | ||
| 355 | u64 src_len; /* In bytes */ | ||
| 356 | }; | ||
| 357 | |||
| 293 | /***** RSA engine *****/ | 358 | /***** RSA engine *****/ |
| 294 | /** | 359 | /** |
| 295 | * struct ccp_rsa_engine - CCP RSA operation | 360 | * struct ccp_rsa_engine - CCP RSA operation |
| @@ -539,7 +604,7 @@ struct ccp_ecc_engine { | |||
| 539 | enum ccp_engine { | 604 | enum ccp_engine { |
| 540 | CCP_ENGINE_AES = 0, | 605 | CCP_ENGINE_AES = 0, |
| 541 | CCP_ENGINE_XTS_AES_128, | 606 | CCP_ENGINE_XTS_AES_128, |
| 542 | CCP_ENGINE_RSVD1, | 607 | CCP_ENGINE_DES3, |
| 543 | CCP_ENGINE_SHA, | 608 | CCP_ENGINE_SHA, |
| 544 | CCP_ENGINE_RSA, | 609 | CCP_ENGINE_RSA, |
| 545 | CCP_ENGINE_PASSTHRU, | 610 | CCP_ENGINE_PASSTHRU, |
| @@ -587,6 +652,7 @@ struct ccp_cmd { | |||
| 587 | union { | 652 | union { |
| 588 | struct ccp_aes_engine aes; | 653 | struct ccp_aes_engine aes; |
| 589 | struct ccp_xts_aes_engine xts; | 654 | struct ccp_xts_aes_engine xts; |
| 655 | struct ccp_des3_engine des3; | ||
| 590 | struct ccp_sha_engine sha; | 656 | struct ccp_sha_engine sha; |
| 591 | struct ccp_rsa_engine rsa; | 657 | struct ccp_rsa_engine rsa; |
| 592 | struct ccp_passthru_engine passthru; | 658 | struct ccp_passthru_engine passthru; |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index c0b0cf3d2d2f..84da9978e951 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
| @@ -123,7 +123,7 @@ | |||
| 123 | /* | 123 | /* |
| 124 | * Miscellaneous stuff. | 124 | * Miscellaneous stuff. |
| 125 | */ | 125 | */ |
| 126 | #define CRYPTO_MAX_ALG_NAME 64 | 126 | #define CRYPTO_MAX_ALG_NAME 128 |
| 127 | 127 | ||
| 128 | /* | 128 | /* |
| 129 | * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual | 129 | * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual |
diff --git a/include/linux/cryptohash.h b/include/linux/cryptohash.h index 3252799832cf..df4d3e943d28 100644 --- a/include/linux/cryptohash.h +++ b/include/linux/cryptohash.h | |||
| @@ -10,9 +10,4 @@ | |||
| 10 | void sha_init(__u32 *buf); | 10 | void sha_init(__u32 *buf); |
| 11 | void sha_transform(__u32 *digest, const char *data, __u32 *W); | 11 | void sha_transform(__u32 *digest, const char *data, __u32 *W); |
| 12 | 12 | ||
| 13 | #define MD5_DIGEST_WORDS 4 | ||
| 14 | #define MD5_MESSAGE_BYTES 64 | ||
| 15 | |||
| 16 | void md5_transform(__u32 *hash, __u32 const *in); | ||
| 17 | |||
| 18 | #endif | 13 | #endif |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 7ae256717a32..13bc08aba704 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | 47 | ||
| 48 | /* @a is a power of 2 value */ | 48 | /* @a is a power of 2 value */ |
| 49 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) | 49 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) |
| 50 | #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) | ||
| 50 | #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) | 51 | #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) |
| 51 | #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) | 52 | #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) |
| 52 | #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) | 53 | #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) |
diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h index 3d4df74a96de..d4dfefdee6c1 100644 --- a/include/soc/fsl/qman.h +++ b/include/soc/fsl/qman.h | |||
| @@ -36,8 +36,11 @@ | |||
| 36 | /* Hardware constants */ | 36 | /* Hardware constants */ |
| 37 | #define QM_CHANNEL_SWPORTAL0 0 | 37 | #define QM_CHANNEL_SWPORTAL0 0 |
| 38 | #define QMAN_CHANNEL_POOL1 0x21 | 38 | #define QMAN_CHANNEL_POOL1 0x21 |
| 39 | #define QMAN_CHANNEL_CAAM 0x80 | ||
| 39 | #define QMAN_CHANNEL_POOL1_REV3 0x401 | 40 | #define QMAN_CHANNEL_POOL1_REV3 0x401 |
| 41 | #define QMAN_CHANNEL_CAAM_REV3 0x840 | ||
| 40 | extern u16 qm_channel_pool1; | 42 | extern u16 qm_channel_pool1; |
| 43 | extern u16 qm_channel_caam; | ||
| 41 | 44 | ||
| 42 | /* Portal processing (interrupt) sources */ | 45 | /* Portal processing (interrupt) sources */ |
| 43 | #define QM_PIRQ_CSCI 0x00100000 /* Congestion State Change */ | 46 | #define QM_PIRQ_CSCI 0x00100000 /* Congestion State Change */ |
| @@ -165,6 +168,7 @@ static inline void qm_fd_set_param(struct qm_fd *fd, enum qm_fd_format fmt, | |||
| 165 | #define qm_fd_set_contig_big(fd, len) \ | 168 | #define qm_fd_set_contig_big(fd, len) \ |
| 166 | qm_fd_set_param(fd, qm_fd_contig_big, 0, len) | 169 | qm_fd_set_param(fd, qm_fd_contig_big, 0, len) |
| 167 | #define qm_fd_set_sg_big(fd, len) qm_fd_set_param(fd, qm_fd_sg_big, 0, len) | 170 | #define qm_fd_set_sg_big(fd, len) qm_fd_set_param(fd, qm_fd_sg_big, 0, len) |
| 171 | #define qm_fd_set_compound(fd, len) qm_fd_set_param(fd, qm_fd_compound, 0, len) | ||
| 168 | 172 | ||
| 169 | static inline void qm_fd_clear_fd(struct qm_fd *fd) | 173 | static inline void qm_fd_clear_fd(struct qm_fd *fd) |
| 170 | { | 174 | { |
| @@ -639,6 +643,7 @@ struct qm_mcc_initcgr { | |||
| 639 | #define QM_CGR_WE_MODE 0x0001 | 643 | #define QM_CGR_WE_MODE 0x0001 |
| 640 | 644 | ||
| 641 | #define QMAN_CGR_FLAG_USE_INIT 0x00000001 | 645 | #define QMAN_CGR_FLAG_USE_INIT 0x00000001 |
| 646 | #define QMAN_CGR_MODE_FRAME 0x00000001 | ||
| 642 | 647 | ||
| 643 | /* Portal and Frame Queues */ | 648 | /* Portal and Frame Queues */ |
| 644 | /* Represents a managed portal */ | 649 | /* Represents a managed portal */ |
| @@ -791,6 +796,84 @@ struct qman_cgr { | |||
| 791 | #define QMAN_INITFQ_FLAG_SCHED 0x00000001 /* schedule rather than park */ | 796 | #define QMAN_INITFQ_FLAG_SCHED 0x00000001 /* schedule rather than park */ |
| 792 | #define QMAN_INITFQ_FLAG_LOCAL 0x00000004 /* set dest portal */ | 797 | #define QMAN_INITFQ_FLAG_LOCAL 0x00000004 /* set dest portal */ |
| 793 | 798 | ||
| 799 | /* | ||
| 800 | * For qman_volatile_dequeue(); Choose one PRECEDENCE. EXACT is optional. Use | ||
| 801 | * NUMFRAMES(n) (6-bit) or NUMFRAMES_TILLEMPTY to fill in the frame-count. Use | ||
| 802 | * FQID(n) to fill in the frame queue ID. | ||
| 803 | */ | ||
| 804 | #define QM_VDQCR_PRECEDENCE_VDQCR 0x0 | ||
| 805 | #define QM_VDQCR_PRECEDENCE_SDQCR 0x80000000 | ||
| 806 | #define QM_VDQCR_EXACT 0x40000000 | ||
| 807 | #define QM_VDQCR_NUMFRAMES_MASK 0x3f000000 | ||
| 808 | #define QM_VDQCR_NUMFRAMES_SET(n) (((n) & 0x3f) << 24) | ||
| 809 | #define QM_VDQCR_NUMFRAMES_GET(n) (((n) >> 24) & 0x3f) | ||
| 810 | #define QM_VDQCR_NUMFRAMES_TILLEMPTY QM_VDQCR_NUMFRAMES_SET(0) | ||
| 811 | |||
| 812 | #define QMAN_VOLATILE_FLAG_WAIT 0x00000001 /* wait if VDQCR is in use */ | ||
| 813 | #define QMAN_VOLATILE_FLAG_WAIT_INT 0x00000002 /* if wait, interruptible? */ | ||
| 814 | #define QMAN_VOLATILE_FLAG_FINISH 0x00000004 /* wait till VDQCR completes */ | ||
| 815 | |||
| 816 | /* "Query FQ Non-Programmable Fields" */ | ||
| 817 | struct qm_mcr_queryfq_np { | ||
| 818 | u8 verb; | ||
| 819 | u8 result; | ||
| 820 | u8 __reserved1; | ||
| 821 | u8 state; /* QM_MCR_NP_STATE_*** */ | ||
| 822 | u32 fqd_link; /* 24-bit, _res2[24-31] */ | ||
| 823 | u16 odp_seq; /* 14-bit, _res3[14-15] */ | ||
| 824 | u16 orp_nesn; /* 14-bit, _res4[14-15] */ | ||
| 825 | u16 orp_ea_hseq; /* 15-bit, _res5[15] */ | ||
| 826 | u16 orp_ea_tseq; /* 15-bit, _res6[15] */ | ||
| 827 | u32 orp_ea_hptr; /* 24-bit, _res7[24-31] */ | ||
| 828 | u32 orp_ea_tptr; /* 24-bit, _res8[24-31] */ | ||
| 829 | u32 pfdr_hptr; /* 24-bit, _res9[24-31] */ | ||
| 830 | u32 pfdr_tptr; /* 24-bit, _res10[24-31] */ | ||
| 831 | u8 __reserved2[5]; | ||
| 832 | u8 is; /* 1-bit, _res12[1-7] */ | ||
| 833 | u16 ics_surp; | ||
| 834 | u32 byte_cnt; | ||
| 835 | u32 frm_cnt; /* 24-bit, _res13[24-31] */ | ||
| 836 | u32 __reserved3; | ||
| 837 | u16 ra1_sfdr; /* QM_MCR_NP_RA1_*** */ | ||
| 838 | u16 ra2_sfdr; /* QM_MCR_NP_RA2_*** */ | ||
| 839 | u16 __reserved4; | ||
| 840 | u16 od1_sfdr; /* QM_MCR_NP_OD1_*** */ | ||
| 841 | u16 od2_sfdr; /* QM_MCR_NP_OD2_*** */ | ||
| 842 | u16 od3_sfdr; /* QM_MCR_NP_OD3_*** */ | ||
| 843 | } __packed; | ||
| 844 | |||
| 845 | #define QM_MCR_NP_STATE_FE 0x10 | ||
| 846 | #define QM_MCR_NP_STATE_R 0x08 | ||
| 847 | #define QM_MCR_NP_STATE_MASK 0x07 /* Reads FQD::STATE; */ | ||
| 848 | #define QM_MCR_NP_STATE_OOS 0x00 | ||
| 849 | #define QM_MCR_NP_STATE_RETIRED 0x01 | ||
| 850 | #define QM_MCR_NP_STATE_TEN_SCHED 0x02 | ||
| 851 | #define QM_MCR_NP_STATE_TRU_SCHED 0x03 | ||
| 852 | #define QM_MCR_NP_STATE_PARKED 0x04 | ||
| 853 | #define QM_MCR_NP_STATE_ACTIVE 0x05 | ||
| 854 | #define QM_MCR_NP_PTR_MASK 0x07ff /* for RA[12] & OD[123] */ | ||
| 855 | #define QM_MCR_NP_RA1_NRA(v) (((v) >> 14) & 0x3) /* FQD::NRA */ | ||
| 856 | #define QM_MCR_NP_RA2_IT(v) (((v) >> 14) & 0x1) /* FQD::IT */ | ||
| 857 | #define QM_MCR_NP_OD1_NOD(v) (((v) >> 14) & 0x3) /* FQD::NOD */ | ||
| 858 | #define QM_MCR_NP_OD3_NPC(v) (((v) >> 14) & 0x3) /* FQD::NPC */ | ||
| 859 | |||
| 860 | enum qm_mcr_queryfq_np_masks { | ||
| 861 | qm_mcr_fqd_link_mask = BIT(24) - 1, | ||
| 862 | qm_mcr_odp_seq_mask = BIT(14) - 1, | ||
| 863 | qm_mcr_orp_nesn_mask = BIT(14) - 1, | ||
| 864 | qm_mcr_orp_ea_hseq_mask = BIT(15) - 1, | ||
| 865 | qm_mcr_orp_ea_tseq_mask = BIT(15) - 1, | ||
| 866 | qm_mcr_orp_ea_hptr_mask = BIT(24) - 1, | ||
| 867 | qm_mcr_orp_ea_tptr_mask = BIT(24) - 1, | ||
| 868 | qm_mcr_pfdr_hptr_mask = BIT(24) - 1, | ||
| 869 | qm_mcr_pfdr_tptr_mask = BIT(24) - 1, | ||
| 870 | qm_mcr_is_mask = BIT(1) - 1, | ||
| 871 | qm_mcr_frm_cnt_mask = BIT(24) - 1, | ||
| 872 | }; | ||
| 873 | |||
| 874 | #define qm_mcr_np_get(np, field) \ | ||
| 875 | ((np)->field & (qm_mcr_##field##_mask)) | ||
| 876 | |||
| 794 | /* Portal Management */ | 877 | /* Portal Management */ |
| 795 | /** | 878 | /** |
| 796 | * qman_p_irqsource_add - add processing sources to be interrupt-driven | 879 | * qman_p_irqsource_add - add processing sources to be interrupt-driven |
| @@ -963,6 +1046,25 @@ int qman_retire_fq(struct qman_fq *fq, u32 *flags); | |||
| 963 | */ | 1046 | */ |
| 964 | int qman_oos_fq(struct qman_fq *fq); | 1047 | int qman_oos_fq(struct qman_fq *fq); |
| 965 | 1048 | ||
| 1049 | /* | ||
| 1050 | * qman_volatile_dequeue - Issue a volatile dequeue command | ||
| 1051 | * @fq: the frame queue object to dequeue from | ||
| 1052 | * @flags: a bit-mask of QMAN_VOLATILE_FLAG_*** options | ||
| 1053 | * @vdqcr: bit mask of QM_VDQCR_*** options, as per qm_dqrr_vdqcr_set() | ||
| 1054 | * | ||
| 1055 | * Attempts to lock access to the portal's VDQCR volatile dequeue functionality. | ||
| 1056 | * The function will block and sleep if QMAN_VOLATILE_FLAG_WAIT is specified and | ||
| 1057 | * the VDQCR is already in use, otherwise returns non-zero for failure. If | ||
| 1058 | * QMAN_VOLATILE_FLAG_FINISH is specified, the function will only return once | ||
| 1059 | * the VDQCR command has finished executing (ie. once the callback for the last | ||
| 1060 | * DQRR entry resulting from the VDQCR command has been called). If not using | ||
| 1061 | * the FINISH flag, completion can be determined either by detecting the | ||
| 1062 | * presence of the QM_DQRR_STAT_UNSCHEDULED and QM_DQRR_STAT_DQCR_EXPIRED bits | ||
| 1063 | * in the "stat" parameter passed to the FQ's dequeue callback, or by waiting | ||
| 1064 | * for the QMAN_FQ_STATE_VDQCR bit to disappear. | ||
| 1065 | */ | ||
| 1066 | int qman_volatile_dequeue(struct qman_fq *fq, u32 flags, u32 vdqcr); | ||
| 1067 | |||
| 966 | /** | 1068 | /** |
| 967 | * qman_enqueue - Enqueue a frame to a frame queue | 1069 | * qman_enqueue - Enqueue a frame to a frame queue |
| 968 | * @fq: the frame queue object to enqueue to | 1070 | * @fq: the frame queue object to enqueue to |
| @@ -994,6 +1096,13 @@ int qman_alloc_fqid_range(u32 *result, u32 count); | |||
| 994 | */ | 1096 | */ |
| 995 | int qman_release_fqid(u32 fqid); | 1097 | int qman_release_fqid(u32 fqid); |
| 996 | 1098 | ||
| 1099 | /** | ||
| 1100 | * qman_query_fq_np - Queries non-programmable FQD fields | ||
| 1101 | * @fq: the frame queue object to be queried | ||
| 1102 | * @np: storage for the queried FQD fields | ||
| 1103 | */ | ||
| 1104 | int qman_query_fq_np(struct qman_fq *fq, struct qm_mcr_queryfq_np *np); | ||
| 1105 | |||
| 997 | /* Pool-channel management */ | 1106 | /* Pool-channel management */ |
| 998 | /** | 1107 | /** |
| 999 | * qman_alloc_pool_range - Allocate a contiguous range of pool-channel IDs | 1108 | * qman_alloc_pool_range - Allocate a contiguous range of pool-channel IDs |
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h index 11d21fce14d6..b4def5c630e7 100644 --- a/include/uapi/linux/cryptouser.h +++ b/include/uapi/linux/cryptouser.h | |||
| @@ -31,7 +31,7 @@ enum { | |||
| 31 | #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1) | 31 | #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1) |
| 32 | #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE) | 32 | #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE) |
| 33 | 33 | ||
| 34 | #define CRYPTO_MAX_NAME CRYPTO_MAX_ALG_NAME | 34 | #define CRYPTO_MAX_NAME 64 |
| 35 | 35 | ||
| 36 | /* Netlink message attributes. */ | 36 | /* Netlink message attributes. */ |
| 37 | enum crypto_attr_type_t { | 37 | enum crypto_attr_type_t { |
| @@ -53,9 +53,9 @@ enum crypto_attr_type_t { | |||
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | struct crypto_user_alg { | 55 | struct crypto_user_alg { |
| 56 | char cru_name[CRYPTO_MAX_ALG_NAME]; | 56 | char cru_name[CRYPTO_MAX_NAME]; |
| 57 | char cru_driver_name[CRYPTO_MAX_ALG_NAME]; | 57 | char cru_driver_name[CRYPTO_MAX_NAME]; |
| 58 | char cru_module_name[CRYPTO_MAX_ALG_NAME]; | 58 | char cru_module_name[CRYPTO_MAX_NAME]; |
| 59 | __u32 cru_type; | 59 | __u32 cru_type; |
| 60 | __u32 cru_mask; | 60 | __u32 cru_mask; |
| 61 | __u32 cru_refcnt; | 61 | __u32 cru_refcnt; |
| @@ -73,7 +73,7 @@ struct crypto_report_hash { | |||
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | struct crypto_report_cipher { | 75 | struct crypto_report_cipher { |
| 76 | char type[CRYPTO_MAX_ALG_NAME]; | 76 | char type[CRYPTO_MAX_NAME]; |
| 77 | unsigned int blocksize; | 77 | unsigned int blocksize; |
| 78 | unsigned int min_keysize; | 78 | unsigned int min_keysize; |
| 79 | unsigned int max_keysize; | 79 | unsigned int max_keysize; |
diff --git a/include/video/udlfb.h b/include/video/udlfb.h index f9466fa54ba4..3ea90aea5617 100644 --- a/include/video/udlfb.h +++ b/include/video/udlfb.h | |||
| @@ -92,6 +92,6 @@ struct dlfb_data { | |||
| 92 | 92 | ||
| 93 | /* remove these once align.h patch is taken into kernel */ | 93 | /* remove these once align.h patch is taken into kernel */ |
| 94 | #define DL_ALIGN_UP(x, a) ALIGN(x, a) | 94 | #define DL_ALIGN_UP(x, a) ALIGN(x, a) |
| 95 | #define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a) | 95 | #define DL_ALIGN_DOWN(x, a) ALIGN_DOWN(x, a) |
| 96 | 96 | ||
| 97 | #endif | 97 | #endif |
