18 #include <linux/module.h>
25 #define DES3_KEY_SIZE (3 * DES_KEY_SIZE)
67 .cra_driver_name =
"des-s390",
77 .cia_setkey = des_setkey,
78 .cia_encrypt = des_encrypt,
79 .cia_decrypt = des_decrypt,
90 while ((nbytes = walk->
nbytes)) {
96 ret = crypt_s390_km(func, key, out, in, n);
97 BUG_ON((ret < 0) || (ret != n));
106 static int cbc_desall_crypt(
struct blkcipher_desc *desc,
long func,
110 unsigned int nbytes = walk->
nbytes;
122 ret = crypt_s390_kmc(func, iv, out, in, n);
123 BUG_ON((ret < 0) || (ret != n));
127 }
while ((nbytes = walk->
nbytes));
141 blkcipher_walk_init(&walk, dst, src, nbytes);
152 blkcipher_walk_init(&walk, dst, src, nbytes);
157 .cra_name =
"ecb(des)",
158 .cra_driver_name =
"ecb-des-s390",
169 .setkey = des_setkey,
170 .encrypt = ecb_des_encrypt,
171 .decrypt = ecb_des_decrypt,
183 blkcipher_walk_init(&walk, dst, src, nbytes);
194 blkcipher_walk_init(&walk, dst, src, nbytes);
199 .cra_name =
"cbc(des)",
200 .cra_driver_name =
"cbc-des-s390",
212 .setkey = des_setkey,
213 .encrypt = cbc_des_encrypt,
214 .decrypt = cbc_des_decrypt,
232 static int des3_setkey(
struct crypto_tfm *tfm,
const u8 *key,
239 memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
264 .cra_name =
"des3_ede",
265 .cra_driver_name =
"des3_ede-s390",
275 .cia_setkey = des3_setkey,
276 .cia_encrypt = des3_encrypt,
277 .cia_decrypt = des3_decrypt,
289 blkcipher_walk_init(&walk, dst, src, nbytes);
300 blkcipher_walk_init(&walk, dst, src, nbytes);
305 .cra_name =
"ecb(des3_ede)",
306 .cra_driver_name =
"ecb-des3_ede-s390",
317 .setkey = des3_setkey,
318 .encrypt = ecb_des3_encrypt,
319 .decrypt = ecb_des3_decrypt,
331 blkcipher_walk_init(&walk, dst, src, nbytes);
342 blkcipher_walk_init(&walk, dst, src, nbytes);
347 .cra_name =
"cbc(des3_ede)",
348 .cra_driver_name =
"cbc-des3_ede-s390",
360 .setkey = des3_setkey,
361 .encrypt = cbc_des3_encrypt,
362 .decrypt = cbc_des3_decrypt,
367 static int ctr_desall_crypt(
struct blkcipher_desc *desc,
long func,
388 ret = crypt_s390_kmctr(func, ctx->
key, out, in, n, ctrblk);
389 BUG_ON((ret < 0) || (ret != n));
405 ret = crypt_s390_kmctr(func, ctx->
key, buf, in,
423 blkcipher_walk_init(&walk, dst, src, nbytes);
434 blkcipher_walk_init(&walk, dst, src, nbytes);
439 .cra_name =
"ctr(des)",
440 .cra_driver_name =
"ctr-des-s390",
452 .setkey = des_setkey,
453 .encrypt = ctr_des_encrypt,
454 .decrypt = ctr_des_decrypt,
466 blkcipher_walk_init(&walk, dst, src, nbytes);
477 blkcipher_walk_init(&walk, dst, src, nbytes);
482 .cra_name =
"ctr(des3_ede)",
483 .cra_driver_name =
"ctr-des3_ede-s390",
495 .setkey = des3_setkey,
496 .encrypt = ctr_des3_encrypt,
497 .decrypt = ctr_des3_decrypt,
502 static int __init des_s390_init(
void)
568 static void __exit des_s390_exit(
void)