des_generic.c (2d8ad8719591fa803b0d589ed057fa46f49b7155) | des_generic.c (9935e6d2f3b5670550e48a55172cab546ae5d096) |
---|---|
1/* 2 * Cryptographic API. 3 * 4 * DES & Triple DES EDE Cipher Algorithms. 5 * 6 * Copyright (c) 2005 Dag Arne Osvik <da@osvik.no> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 929 unchanged lines hidden (view full) --- 938 ROUND(R, L, A, B, K, -2); 939 } 940 FP(R, L, A); 941 942 d[0] = cpu_to_le32(R); 943 d[1] = cpu_to_le32(L); 944} 945 | 1/* 2 * Cryptographic API. 3 * 4 * DES & Triple DES EDE Cipher Algorithms. 5 * 6 * Copyright (c) 2005 Dag Arne Osvik <da@osvik.no> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 929 unchanged lines hidden (view full) --- 938 ROUND(R, L, A, B, K, -2); 939 } 940 FP(R, L, A); 941 942 d[0] = cpu_to_le32(R); 943 d[1] = cpu_to_le32(L); 944} 945 |
946static struct crypto_alg des_alg = { | 946static struct crypto_alg des_algs[2] = { { |
947 .cra_name = "des", 948 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 949 .cra_blocksize = DES_BLOCK_SIZE, 950 .cra_ctxsize = sizeof(struct des_ctx), 951 .cra_module = THIS_MODULE, 952 .cra_alignmask = 3, | 947 .cra_name = "des", 948 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 949 .cra_blocksize = DES_BLOCK_SIZE, 950 .cra_ctxsize = sizeof(struct des_ctx), 951 .cra_module = THIS_MODULE, 952 .cra_alignmask = 3, |
953 .cra_list = LIST_HEAD_INIT(des_alg.cra_list), | |
954 .cra_u = { .cipher = { 955 .cia_min_keysize = DES_KEY_SIZE, 956 .cia_max_keysize = DES_KEY_SIZE, 957 .cia_setkey = des_setkey, 958 .cia_encrypt = des_encrypt, 959 .cia_decrypt = des_decrypt } } | 953 .cra_u = { .cipher = { 954 .cia_min_keysize = DES_KEY_SIZE, 955 .cia_max_keysize = DES_KEY_SIZE, 956 .cia_setkey = des_setkey, 957 .cia_encrypt = des_encrypt, 958 .cia_decrypt = des_decrypt } } |
960}; 961 962static struct crypto_alg des3_ede_alg = { | 959}, { |
963 .cra_name = "des3_ede", 964 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 965 .cra_blocksize = DES3_EDE_BLOCK_SIZE, 966 .cra_ctxsize = sizeof(struct des3_ede_ctx), 967 .cra_module = THIS_MODULE, 968 .cra_alignmask = 3, | 960 .cra_name = "des3_ede", 961 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 962 .cra_blocksize = DES3_EDE_BLOCK_SIZE, 963 .cra_ctxsize = sizeof(struct des3_ede_ctx), 964 .cra_module = THIS_MODULE, 965 .cra_alignmask = 3, |
969 .cra_list = LIST_HEAD_INIT(des3_ede_alg.cra_list), | |
970 .cra_u = { .cipher = { 971 .cia_min_keysize = DES3_EDE_KEY_SIZE, 972 .cia_max_keysize = DES3_EDE_KEY_SIZE, 973 .cia_setkey = des3_ede_setkey, 974 .cia_encrypt = des3_ede_encrypt, 975 .cia_decrypt = des3_ede_decrypt } } | 966 .cra_u = { .cipher = { 967 .cia_min_keysize = DES3_EDE_KEY_SIZE, 968 .cia_max_keysize = DES3_EDE_KEY_SIZE, 969 .cia_setkey = des3_ede_setkey, 970 .cia_encrypt = des3_ede_encrypt, 971 .cia_decrypt = des3_ede_decrypt } } |
976}; | 972} }; |
977 978MODULE_ALIAS("des3_ede"); 979 980static int __init des_generic_mod_init(void) 981{ | 973 974MODULE_ALIAS("des3_ede"); 975 976static int __init des_generic_mod_init(void) 977{ |
982 int ret = 0; 983 984 ret = crypto_register_alg(&des_alg); 985 if (ret < 0) 986 goto out; 987 988 ret = crypto_register_alg(&des3_ede_alg); 989 if (ret < 0) 990 crypto_unregister_alg(&des_alg); 991out: 992 return ret; | 978 return crypto_register_algs(des_algs, ARRAY_SIZE(des_algs)); |
993} 994 995static void __exit des_generic_mod_fini(void) 996{ | 979} 980 981static void __exit des_generic_mod_fini(void) 982{ |
997 crypto_unregister_alg(&des3_ede_alg); 998 crypto_unregister_alg(&des_alg); | 983 crypto_unregister_algs(des_algs, ARRAY_SIZE(des_algs)); |
999} 1000 1001module_init(des_generic_mod_init); 1002module_exit(des_generic_mod_fini); 1003 1004MODULE_LICENSE("GPL"); 1005MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms"); 1006MODULE_AUTHOR("Dag Arne Osvik <da@osvik.no>"); 1007MODULE_ALIAS("des"); | 984} 985 986module_init(des_generic_mod_init); 987module_exit(des_generic_mod_fini); 988 989MODULE_LICENSE("GPL"); 990MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms"); 991MODULE_AUTHOR("Dag Arne Osvik <da@osvik.no>"); 992MODULE_ALIAS("des"); |