diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-04 18:23:14 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-04 18:23:14 -0400 |
| commit | b7c8e55db7141dcbb9d5305a3260fa0ed62a1bcc (patch) | |
| tree | 59fbd52d8e80e5a83d9747961d28aaf4d400613a /arch | |
| parent | ffd386a9a8273dcfa61705d0b349eebc7525ef87 (diff) | |
| parent | 4015d9a865e3bcc42d88bedc8ce1551000bab664 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (39 commits)
random: Reorder struct entropy_store to remove padding on 64bits
padata: update API documentation
padata: Remove padata_get_cpumask
crypto: pcrypt - Update pcrypt cpumask according to the padata cpumask notifier
crypto: pcrypt - Rename pcrypt_instance
padata: Pass the padata cpumasks to the cpumask_change_notifier chain
padata: Rearrange set_cpumask functions
padata: Rename padata_alloc functions
crypto: pcrypt - Dont calulate a callback cpu on empty callback cpumask
padata: Check for valid cpumasks
padata: Allocate cpumask dependend recources in any case
padata: Fix cpu index counting
crypto: geode_aes - Convert pci_table entries to PCI_VDEVICE (if PCI_ANY_ID is used)
pcrypt: Added sysfs interface to pcrypt
padata: Added sysfs primitives to padata subsystem
padata: Make two separate cpumasks
padata: update documentation
padata: simplify serialization mechanism
padata: make padata_do_parallel to return zero on success
padata: Handle empty padata cpumasks
...
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/s390/crypto/Makefile | 2 | ||||
| -rw-r--r-- | arch/s390/crypto/crypto_des.h | 2 | ||||
| -rw-r--r-- | arch/s390/crypto/des_s390.c | 238 |
3 files changed, 23 insertions, 219 deletions
diff --git a/arch/s390/crypto/Makefile b/arch/s390/crypto/Makefile index 6a1157fa4f98..1cf81d77c5a5 100644 --- a/arch/s390/crypto/Makefile +++ b/arch/s390/crypto/Makefile | |||
| @@ -5,6 +5,6 @@ | |||
| 5 | obj-$(CONFIG_CRYPTO_SHA1_S390) += sha1_s390.o sha_common.o | 5 | obj-$(CONFIG_CRYPTO_SHA1_S390) += sha1_s390.o sha_common.o |
| 6 | obj-$(CONFIG_CRYPTO_SHA256_S390) += sha256_s390.o sha_common.o | 6 | obj-$(CONFIG_CRYPTO_SHA256_S390) += sha256_s390.o sha_common.o |
| 7 | obj-$(CONFIG_CRYPTO_SHA512_S390) += sha512_s390.o sha_common.o | 7 | obj-$(CONFIG_CRYPTO_SHA512_S390) += sha512_s390.o sha_common.o |
| 8 | obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o des_check_key.o | 8 | obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o |
| 9 | obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o | 9 | obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o |
| 10 | obj-$(CONFIG_S390_PRNG) += prng.o | 10 | obj-$(CONFIG_S390_PRNG) += prng.o |
diff --git a/arch/s390/crypto/crypto_des.h b/arch/s390/crypto/crypto_des.h index c964b64111dd..6210457ceebb 100644 --- a/arch/s390/crypto/crypto_des.h +++ b/arch/s390/crypto/crypto_des.h | |||
| @@ -15,4 +15,4 @@ | |||
| 15 | 15 | ||
| 16 | extern int crypto_des_check_key(const u8*, unsigned int, u32*); | 16 | extern int crypto_des_check_key(const u8*, unsigned int, u32*); |
| 17 | 17 | ||
| 18 | #endif //__CRYPTO_DES_H__ | 18 | #endif /*__CRYPTO_DES_H__*/ |
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c index 2bc479ab3a66..cc5420118393 100644 --- a/arch/s390/crypto/des_s390.c +++ b/arch/s390/crypto/des_s390.c | |||
| @@ -14,32 +14,21 @@ | |||
| 14 | * | 14 | * |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <crypto/algapi.h> | ||
| 18 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 19 | #include <linux/crypto.h> | ||
| 20 | #include <crypto/algapi.h> | ||
| 21 | #include <crypto/des.h> | ||
| 20 | 22 | ||
| 21 | #include "crypt_s390.h" | 23 | #include "crypt_s390.h" |
| 22 | #include "crypto_des.h" | ||
| 23 | |||
| 24 | #define DES_BLOCK_SIZE 8 | ||
| 25 | #define DES_KEY_SIZE 8 | ||
| 26 | |||
| 27 | #define DES3_128_KEY_SIZE (2 * DES_KEY_SIZE) | ||
| 28 | #define DES3_128_BLOCK_SIZE DES_BLOCK_SIZE | ||
| 29 | 24 | ||
| 30 | #define DES3_192_KEY_SIZE (3 * DES_KEY_SIZE) | 25 | #define DES3_192_KEY_SIZE (3 * DES_KEY_SIZE) |
| 31 | #define DES3_192_BLOCK_SIZE DES_BLOCK_SIZE | ||
| 32 | 26 | ||
| 33 | struct crypt_s390_des_ctx { | 27 | struct crypt_s390_des_ctx { |
| 34 | u8 iv[DES_BLOCK_SIZE]; | 28 | u8 iv[DES_BLOCK_SIZE]; |
| 35 | u8 key[DES_KEY_SIZE]; | 29 | u8 key[DES_KEY_SIZE]; |
| 36 | }; | 30 | }; |
| 37 | 31 | ||
| 38 | struct crypt_s390_des3_128_ctx { | ||
| 39 | u8 iv[DES_BLOCK_SIZE]; | ||
| 40 | u8 key[DES3_128_KEY_SIZE]; | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct crypt_s390_des3_192_ctx { | 32 | struct crypt_s390_des3_192_ctx { |
| 44 | u8 iv[DES_BLOCK_SIZE]; | 33 | u8 iv[DES_BLOCK_SIZE]; |
| 45 | u8 key[DES3_192_KEY_SIZE]; | 34 | u8 key[DES3_192_KEY_SIZE]; |
| @@ -50,13 +39,16 @@ static int des_setkey(struct crypto_tfm *tfm, const u8 *key, | |||
| 50 | { | 39 | { |
| 51 | struct crypt_s390_des_ctx *dctx = crypto_tfm_ctx(tfm); | 40 | struct crypt_s390_des_ctx *dctx = crypto_tfm_ctx(tfm); |
| 52 | u32 *flags = &tfm->crt_flags; | 41 | u32 *flags = &tfm->crt_flags; |
| 53 | int ret; | 42 | u32 tmp[DES_EXPKEY_WORDS]; |
| 54 | 43 | ||
| 55 | /* test if key is valid (not a weak key) */ | 44 | /* check for weak keys */ |
| 56 | ret = crypto_des_check_key(key, keylen, flags); | 45 | if (!des_ekey(tmp, key) && (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) { |
| 57 | if (ret == 0) | 46 | *flags |= CRYPTO_TFM_RES_WEAK_KEY; |
| 58 | memcpy(dctx->key, key, keylen); | 47 | return -EINVAL; |
| 59 | return ret; | 48 | } |
| 49 | |||
| 50 | memcpy(dctx->key, key, keylen); | ||
| 51 | return 0; | ||
| 60 | } | 52 | } |
| 61 | 53 | ||
| 62 | static void des_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | 54 | static void des_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
| @@ -237,165 +229,6 @@ static struct crypto_alg cbc_des_alg = { | |||
| 237 | * complementation keys. Any weakness is obviated by the use of | 229 | * complementation keys. Any weakness is obviated by the use of |
| 238 | * multiple keys. | 230 | * multiple keys. |
| 239 | * | 231 | * |
| 240 | * However, if the two independent 64-bit keys are equal, | ||
| 241 | * then the DES3 operation is simply the same as DES. | ||
| 242 | * Implementers MUST reject keys that exhibit this property. | ||
| 243 | * | ||
| 244 | */ | ||
| 245 | static int des3_128_setkey(struct crypto_tfm *tfm, const u8 *key, | ||
| 246 | unsigned int keylen) | ||
| 247 | { | ||
| 248 | int i, ret; | ||
| 249 | struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm); | ||
| 250 | const u8 *temp_key = key; | ||
| 251 | u32 *flags = &tfm->crt_flags; | ||
| 252 | |||
| 253 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE)) && | ||
| 254 | (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) { | ||
| 255 | *flags |= CRYPTO_TFM_RES_WEAK_KEY; | ||
| 256 | return -EINVAL; | ||
| 257 | } | ||
| 258 | for (i = 0; i < 2; i++, temp_key += DES_KEY_SIZE) { | ||
| 259 | ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags); | ||
| 260 | if (ret < 0) | ||
| 261 | return ret; | ||
| 262 | } | ||
| 263 | memcpy(dctx->key, key, keylen); | ||
| 264 | return 0; | ||
| 265 | } | ||
| 266 | |||
| 267 | static void des3_128_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 268 | { | ||
| 269 | struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm); | ||
| 270 | |||
| 271 | crypt_s390_km(KM_TDEA_128_ENCRYPT, dctx->key, dst, (void*)src, | ||
| 272 | DES3_128_BLOCK_SIZE); | ||
| 273 | } | ||
| 274 | |||
| 275 | static void des3_128_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
| 276 | { | ||
| 277 | struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm); | ||
| 278 | |||
| 279 | crypt_s390_km(KM_TDEA_128_DECRYPT, dctx->key, dst, (void*)src, | ||
| 280 | DES3_128_BLOCK_SIZE); | ||
| 281 | } | ||
| 282 | |||
| 283 | static struct crypto_alg des3_128_alg = { | ||
| 284 | .cra_name = "des3_ede128", | ||
| 285 | .cra_driver_name = "des3_ede128-s390", | ||
| 286 | .cra_priority = CRYPT_S390_PRIORITY, | ||
| 287 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
| 288 | .cra_blocksize = DES3_128_BLOCK_SIZE, | ||
| 289 | .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx), | ||
| 290 | .cra_module = THIS_MODULE, | ||
| 291 | .cra_list = LIST_HEAD_INIT(des3_128_alg.cra_list), | ||
| 292 | .cra_u = { | ||
| 293 | .cipher = { | ||
| 294 | .cia_min_keysize = DES3_128_KEY_SIZE, | ||
| 295 | .cia_max_keysize = DES3_128_KEY_SIZE, | ||
| 296 | .cia_setkey = des3_128_setkey, | ||
| 297 | .cia_encrypt = des3_128_encrypt, | ||
| 298 | .cia_decrypt = des3_128_decrypt, | ||
| 299 | } | ||
| 300 | } | ||
| 301 | }; | ||
| 302 | |||
| 303 | static int ecb_des3_128_encrypt(struct blkcipher_desc *desc, | ||
| 304 | struct scatterlist *dst, | ||
| 305 | struct scatterlist *src, unsigned int nbytes) | ||
| 306 | { | ||
| 307 | struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 308 | struct blkcipher_walk walk; | ||
| 309 | |||
| 310 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 311 | return ecb_desall_crypt(desc, KM_TDEA_128_ENCRYPT, sctx->key, &walk); | ||
| 312 | } | ||
| 313 | |||
| 314 | static int ecb_des3_128_decrypt(struct blkcipher_desc *desc, | ||
| 315 | struct scatterlist *dst, | ||
| 316 | struct scatterlist *src, unsigned int nbytes) | ||
| 317 | { | ||
| 318 | struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 319 | struct blkcipher_walk walk; | ||
| 320 | |||
| 321 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 322 | return ecb_desall_crypt(desc, KM_TDEA_128_DECRYPT, sctx->key, &walk); | ||
| 323 | } | ||
| 324 | |||
| 325 | static struct crypto_alg ecb_des3_128_alg = { | ||
| 326 | .cra_name = "ecb(des3_ede128)", | ||
| 327 | .cra_driver_name = "ecb-des3_ede128-s390", | ||
| 328 | .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, | ||
| 329 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
| 330 | .cra_blocksize = DES3_128_BLOCK_SIZE, | ||
| 331 | .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx), | ||
| 332 | .cra_type = &crypto_blkcipher_type, | ||
| 333 | .cra_module = THIS_MODULE, | ||
| 334 | .cra_list = LIST_HEAD_INIT( | ||
| 335 | ecb_des3_128_alg.cra_list), | ||
| 336 | .cra_u = { | ||
| 337 | .blkcipher = { | ||
| 338 | .min_keysize = DES3_128_KEY_SIZE, | ||
| 339 | .max_keysize = DES3_128_KEY_SIZE, | ||
| 340 | .setkey = des3_128_setkey, | ||
| 341 | .encrypt = ecb_des3_128_encrypt, | ||
| 342 | .decrypt = ecb_des3_128_decrypt, | ||
| 343 | } | ||
| 344 | } | ||
| 345 | }; | ||
| 346 | |||
| 347 | static int cbc_des3_128_encrypt(struct blkcipher_desc *desc, | ||
| 348 | struct scatterlist *dst, | ||
| 349 | struct scatterlist *src, unsigned int nbytes) | ||
| 350 | { | ||
| 351 | struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 352 | struct blkcipher_walk walk; | ||
| 353 | |||
| 354 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 355 | return cbc_desall_crypt(desc, KMC_TDEA_128_ENCRYPT, sctx->iv, &walk); | ||
| 356 | } | ||
| 357 | |||
| 358 | static int cbc_des3_128_decrypt(struct blkcipher_desc *desc, | ||
| 359 | struct scatterlist *dst, | ||
| 360 | struct scatterlist *src, unsigned int nbytes) | ||
| 361 | { | ||
| 362 | struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); | ||
| 363 | struct blkcipher_walk walk; | ||
| 364 | |||
| 365 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 366 | return cbc_desall_crypt(desc, KMC_TDEA_128_DECRYPT, sctx->iv, &walk); | ||
| 367 | } | ||
| 368 | |||
| 369 | static struct crypto_alg cbc_des3_128_alg = { | ||
| 370 | .cra_name = "cbc(des3_ede128)", | ||
| 371 | .cra_driver_name = "cbc-des3_ede128-s390", | ||
| 372 | .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, | ||
| 373 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | ||
| 374 | .cra_blocksize = DES3_128_BLOCK_SIZE, | ||
| 375 | .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx), | ||
| 376 | .cra_type = &crypto_blkcipher_type, | ||
| 377 | .cra_module = THIS_MODULE, | ||
| 378 | .cra_list = LIST_HEAD_INIT( | ||
| 379 | cbc_des3_128_alg.cra_list), | ||
| 380 | .cra_u = { | ||
| 381 | .blkcipher = { | ||
| 382 | .min_keysize = DES3_128_KEY_SIZE, | ||
| 383 | .max_keysize = DES3_128_KEY_SIZE, | ||
| 384 | .ivsize = DES3_128_BLOCK_SIZE, | ||
| 385 | .setkey = des3_128_setkey, | ||
| 386 | .encrypt = cbc_des3_128_encrypt, | ||
| 387 | .decrypt = cbc_des3_128_decrypt, | ||
| 388 | } | ||
| 389 | } | ||
| 390 | }; | ||
| 391 | |||
| 392 | /* | ||
| 393 | * RFC2451: | ||
| 394 | * | ||
| 395 | * For DES-EDE3, there is no known need to reject weak or | ||
| 396 | * complementation keys. Any weakness is obviated by the use of | ||
| 397 | * multiple keys. | ||
| 398 | * | ||
| 399 | * However, if the first two or last two independent 64-bit keys are | 232 | * However, if the first two or last two independent 64-bit keys are |
| 400 | * equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the | 233 | * equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the |
| 401 | * same as DES. Implementers MUST reject keys that exhibit this | 234 | * same as DES. Implementers MUST reject keys that exhibit this |
| @@ -405,9 +238,7 @@ static struct crypto_alg cbc_des3_128_alg = { | |||
| 405 | static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key, | 238 | static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key, |
| 406 | unsigned int keylen) | 239 | unsigned int keylen) |
| 407 | { | 240 | { |
| 408 | int i, ret; | ||
| 409 | struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); | 241 | struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); |
| 410 | const u8 *temp_key = key; | ||
| 411 | u32 *flags = &tfm->crt_flags; | 242 | u32 *flags = &tfm->crt_flags; |
| 412 | 243 | ||
| 413 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && | 244 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && |
| @@ -417,11 +248,6 @@ static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key, | |||
| 417 | *flags |= CRYPTO_TFM_RES_WEAK_KEY; | 248 | *flags |= CRYPTO_TFM_RES_WEAK_KEY; |
| 418 | return -EINVAL; | 249 | return -EINVAL; |
| 419 | } | 250 | } |
| 420 | for (i = 0; i < 3; i++, temp_key += DES_KEY_SIZE) { | ||
| 421 | ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags); | ||
| 422 | if (ret < 0) | ||
| 423 | return ret; | ||
| 424 | } | ||
| 425 | memcpy(dctx->key, key, keylen); | 251 | memcpy(dctx->key, key, keylen); |
| 426 | return 0; | 252 | return 0; |
| 427 | } | 253 | } |
| @@ -431,7 +257,7 @@ static void des3_192_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |||
| 431 | struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); | 257 | struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); |
| 432 | 258 | ||
| 433 | crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src, | 259 | crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src, |
| 434 | DES3_192_BLOCK_SIZE); | 260 | DES_BLOCK_SIZE); |
| 435 | } | 261 | } |
| 436 | 262 | ||
| 437 | static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | 263 | static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) |
| @@ -439,7 +265,7 @@ static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |||
| 439 | struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); | 265 | struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); |
| 440 | 266 | ||
| 441 | crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src, | 267 | crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src, |
| 442 | DES3_192_BLOCK_SIZE); | 268 | DES_BLOCK_SIZE); |
| 443 | } | 269 | } |
| 444 | 270 | ||
| 445 | static struct crypto_alg des3_192_alg = { | 271 | static struct crypto_alg des3_192_alg = { |
| @@ -447,7 +273,7 @@ static struct crypto_alg des3_192_alg = { | |||
| 447 | .cra_driver_name = "des3_ede-s390", | 273 | .cra_driver_name = "des3_ede-s390", |
| 448 | .cra_priority = CRYPT_S390_PRIORITY, | 274 | .cra_priority = CRYPT_S390_PRIORITY, |
| 449 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | 275 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, |
| 450 | .cra_blocksize = DES3_192_BLOCK_SIZE, | 276 | .cra_blocksize = DES_BLOCK_SIZE, |
| 451 | .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), | 277 | .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), |
| 452 | .cra_module = THIS_MODULE, | 278 | .cra_module = THIS_MODULE, |
| 453 | .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list), | 279 | .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list), |
| @@ -489,7 +315,7 @@ static struct crypto_alg ecb_des3_192_alg = { | |||
| 489 | .cra_driver_name = "ecb-des3_ede-s390", | 315 | .cra_driver_name = "ecb-des3_ede-s390", |
| 490 | .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, | 316 | .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, |
| 491 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | 317 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, |
| 492 | .cra_blocksize = DES3_192_BLOCK_SIZE, | 318 | .cra_blocksize = DES_BLOCK_SIZE, |
| 493 | .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), | 319 | .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), |
| 494 | .cra_type = &crypto_blkcipher_type, | 320 | .cra_type = &crypto_blkcipher_type, |
| 495 | .cra_module = THIS_MODULE, | 321 | .cra_module = THIS_MODULE, |
| @@ -533,7 +359,7 @@ static struct crypto_alg cbc_des3_192_alg = { | |||
| 533 | .cra_driver_name = "cbc-des3_ede-s390", | 359 | .cra_driver_name = "cbc-des3_ede-s390", |
| 534 | .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, | 360 | .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, |
| 535 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | 361 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, |
| 536 | .cra_blocksize = DES3_192_BLOCK_SIZE, | 362 | .cra_blocksize = DES_BLOCK_SIZE, |
| 537 | .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), | 363 | .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), |
| 538 | .cra_type = &crypto_blkcipher_type, | 364 | .cra_type = &crypto_blkcipher_type, |
| 539 | .cra_module = THIS_MODULE, | 365 | .cra_module = THIS_MODULE, |
| @@ -543,7 +369,7 @@ static struct crypto_alg cbc_des3_192_alg = { | |||
| 543 | .blkcipher = { | 369 | .blkcipher = { |
| 544 | .min_keysize = DES3_192_KEY_SIZE, | 370 | .min_keysize = DES3_192_KEY_SIZE, |
| 545 | .max_keysize = DES3_192_KEY_SIZE, | 371 | .max_keysize = DES3_192_KEY_SIZE, |
| 546 | .ivsize = DES3_192_BLOCK_SIZE, | 372 | .ivsize = DES_BLOCK_SIZE, |
| 547 | .setkey = des3_192_setkey, | 373 | .setkey = des3_192_setkey, |
| 548 | .encrypt = cbc_des3_192_encrypt, | 374 | .encrypt = cbc_des3_192_encrypt, |
| 549 | .decrypt = cbc_des3_192_decrypt, | 375 | .decrypt = cbc_des3_192_decrypt, |
| @@ -553,10 +379,9 @@ static struct crypto_alg cbc_des3_192_alg = { | |||
| 553 | 379 | ||
| 554 | static int des_s390_init(void) | 380 | static int des_s390_init(void) |
| 555 | { | 381 | { |
| 556 | int ret = 0; | 382 | int ret; |
| 557 | 383 | ||
| 558 | if (!crypt_s390_func_available(KM_DEA_ENCRYPT) || | 384 | if (!crypt_s390_func_available(KM_DEA_ENCRYPT) || |
| 559 | !crypt_s390_func_available(KM_TDEA_128_ENCRYPT) || | ||
| 560 | !crypt_s390_func_available(KM_TDEA_192_ENCRYPT)) | 385 | !crypt_s390_func_available(KM_TDEA_192_ENCRYPT)) |
| 561 | return -EOPNOTSUPP; | 386 | return -EOPNOTSUPP; |
| 562 | 387 | ||
| @@ -569,17 +394,6 @@ static int des_s390_init(void) | |||
| 569 | ret = crypto_register_alg(&cbc_des_alg); | 394 | ret = crypto_register_alg(&cbc_des_alg); |
| 570 | if (ret) | 395 | if (ret) |
| 571 | goto cbc_des_err; | 396 | goto cbc_des_err; |
| 572 | |||
| 573 | ret = crypto_register_alg(&des3_128_alg); | ||
| 574 | if (ret) | ||
| 575 | goto des3_128_err; | ||
| 576 | ret = crypto_register_alg(&ecb_des3_128_alg); | ||
| 577 | if (ret) | ||
| 578 | goto ecb_des3_128_err; | ||
| 579 | ret = crypto_register_alg(&cbc_des3_128_alg); | ||
| 580 | if (ret) | ||
| 581 | goto cbc_des3_128_err; | ||
| 582 | |||
| 583 | ret = crypto_register_alg(&des3_192_alg); | 397 | ret = crypto_register_alg(&des3_192_alg); |
| 584 | if (ret) | 398 | if (ret) |
| 585 | goto des3_192_err; | 399 | goto des3_192_err; |
| @@ -589,7 +403,6 @@ static int des_s390_init(void) | |||
| 589 | ret = crypto_register_alg(&cbc_des3_192_alg); | 403 | ret = crypto_register_alg(&cbc_des3_192_alg); |
| 590 | if (ret) | 404 | if (ret) |
| 591 | goto cbc_des3_192_err; | 405 | goto cbc_des3_192_err; |
| 592 | |||
| 593 | out: | 406 | out: |
| 594 | return ret; | 407 | return ret; |
| 595 | 408 | ||
| @@ -598,12 +411,6 @@ cbc_des3_192_err: | |||
| 598 | ecb_des3_192_err: | 411 | ecb_des3_192_err: |
| 599 | crypto_unregister_alg(&des3_192_alg); | 412 | crypto_unregister_alg(&des3_192_alg); |
| 600 | des3_192_err: | 413 | des3_192_err: |
| 601 | crypto_unregister_alg(&cbc_des3_128_alg); | ||
| 602 | cbc_des3_128_err: | ||
| 603 | crypto_unregister_alg(&ecb_des3_128_alg); | ||
| 604 | ecb_des3_128_err: | ||
| 605 | crypto_unregister_alg(&des3_128_alg); | ||
| 606 | des3_128_err: | ||
| 607 | crypto_unregister_alg(&cbc_des_alg); | 414 | crypto_unregister_alg(&cbc_des_alg); |
| 608 | cbc_des_err: | 415 | cbc_des_err: |
| 609 | crypto_unregister_alg(&ecb_des_alg); | 416 | crypto_unregister_alg(&ecb_des_alg); |
| @@ -613,21 +420,18 @@ des_err: | |||
| 613 | goto out; | 420 | goto out; |
| 614 | } | 421 | } |
| 615 | 422 | ||
| 616 | static void __exit des_s390_fini(void) | 423 | static void __exit des_s390_exit(void) |
| 617 | { | 424 | { |
| 618 | crypto_unregister_alg(&cbc_des3_192_alg); | 425 | crypto_unregister_alg(&cbc_des3_192_alg); |
| 619 | crypto_unregister_alg(&ecb_des3_192_alg); | 426 | crypto_unregister_alg(&ecb_des3_192_alg); |
| 620 | crypto_unregister_alg(&des3_192_alg); | 427 | crypto_unregister_alg(&des3_192_alg); |
| 621 | crypto_unregister_alg(&cbc_des3_128_alg); | ||
| 622 | crypto_unregister_alg(&ecb_des3_128_alg); | ||
| 623 | crypto_unregister_alg(&des3_128_alg); | ||
| 624 | crypto_unregister_alg(&cbc_des_alg); | 428 | crypto_unregister_alg(&cbc_des_alg); |
| 625 | crypto_unregister_alg(&ecb_des_alg); | 429 | crypto_unregister_alg(&ecb_des_alg); |
| 626 | crypto_unregister_alg(&des_alg); | 430 | crypto_unregister_alg(&des_alg); |
| 627 | } | 431 | } |
| 628 | 432 | ||
| 629 | module_init(des_s390_init); | 433 | module_init(des_s390_init); |
| 630 | module_exit(des_s390_fini); | 434 | module_exit(des_s390_exit); |
| 631 | 435 | ||
| 632 | MODULE_ALIAS("des"); | 436 | MODULE_ALIAS("des"); |
| 633 | MODULE_ALIAS("des3_ede"); | 437 | MODULE_ALIAS("des3_ede"); |
