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/linux | |
| 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/linux')
| -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 |
4 files changed, 69 insertions, 7 deletions
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) |
