diff options
Diffstat (limited to 'arch/s390/crypto/crypt_s390_query.c')
-rw-r--r-- | arch/s390/crypto/crypt_s390_query.c | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/arch/s390/crypto/crypt_s390_query.c b/arch/s390/crypto/crypt_s390_query.c new file mode 100644 index 000000000000..0fa6bdf197cf --- /dev/null +++ b/arch/s390/crypto/crypt_s390_query.c | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | * Cryptographic API. | ||
3 | * | ||
4 | * Support for s390 cryptographic instructions. | ||
5 | * Testing module for querying processor crypto capabilities. | ||
6 | * | ||
7 | * Copyright (c) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
8 | * Author(s): Thomas Spatzier (tspat@de.ibm.com) | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the Free | ||
12 | * Software Foundation; either version 2 of the License, or (at your option) | ||
13 | * any later version. | ||
14 | * | ||
15 | */ | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/kernel.h> | ||
19 | #include <asm/errno.h> | ||
20 | #include "crypt_s390.h" | ||
21 | |||
22 | static void query_available_functions(void) | ||
23 | { | ||
24 | printk(KERN_INFO "#####################\n"); | ||
25 | |||
26 | /* query available KM functions */ | ||
27 | printk(KERN_INFO "KM_QUERY: %d\n", | ||
28 | crypt_s390_func_available(KM_QUERY)); | ||
29 | printk(KERN_INFO "KM_DEA: %d\n", | ||
30 | crypt_s390_func_available(KM_DEA_ENCRYPT)); | ||
31 | printk(KERN_INFO "KM_TDEA_128: %d\n", | ||
32 | crypt_s390_func_available(KM_TDEA_128_ENCRYPT)); | ||
33 | printk(KERN_INFO "KM_TDEA_192: %d\n", | ||
34 | crypt_s390_func_available(KM_TDEA_192_ENCRYPT)); | ||
35 | |||
36 | /* query available KMC functions */ | ||
37 | printk(KERN_INFO "KMC_QUERY: %d\n", | ||
38 | crypt_s390_func_available(KMC_QUERY)); | ||
39 | printk(KERN_INFO "KMC_DEA: %d\n", | ||
40 | crypt_s390_func_available(KMC_DEA_ENCRYPT)); | ||
41 | printk(KERN_INFO "KMC_TDEA_128: %d\n", | ||
42 | crypt_s390_func_available(KMC_TDEA_128_ENCRYPT)); | ||
43 | printk(KERN_INFO "KMC_TDEA_192: %d\n", | ||
44 | crypt_s390_func_available(KMC_TDEA_192_ENCRYPT)); | ||
45 | |||
46 | /* query available KIMD fucntions */ | ||
47 | printk(KERN_INFO "KIMD_QUERY: %d\n", | ||
48 | crypt_s390_func_available(KIMD_QUERY)); | ||
49 | printk(KERN_INFO "KIMD_SHA_1: %d\n", | ||
50 | crypt_s390_func_available(KIMD_SHA_1)); | ||
51 | |||
52 | /* query available KLMD functions */ | ||
53 | printk(KERN_INFO "KLMD_QUERY: %d\n", | ||
54 | crypt_s390_func_available(KLMD_QUERY)); | ||
55 | printk(KERN_INFO "KLMD_SHA_1: %d\n", | ||
56 | crypt_s390_func_available(KLMD_SHA_1)); | ||
57 | |||
58 | /* query available KMAC functions */ | ||
59 | printk(KERN_INFO "KMAC_QUERY: %d\n", | ||
60 | crypt_s3990_func_available(KMAC_QUERY)); | ||
61 | printk(KERN_INFO "KMAC_DEA: %d\n", | ||
62 | crypt_s390_func_available(KMAC_DEA)); | ||
63 | printk(KERN_INFO "KMAC_TDEA_128: %d\n", | ||
64 | crypt_s390_func_available(KMAC_TDEA_128)); | ||
65 | printk(KERN_INFO "KMAC_TDEA_192: %d\n", | ||
66 | crypt_s390_func_available(KMAC_TDEA_192)); | ||
67 | } | ||
68 | |||
69 | static int init(void) | ||
70 | { | ||
71 | struct crypt_s390_query_status status = { | ||
72 | .high = 0, | ||
73 | .low = 0 | ||
74 | }; | ||
75 | |||
76 | printk(KERN_INFO "crypt_s390: querying available crypto functions\n"); | ||
77 | crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0); | ||
78 | printk(KERN_INFO "KM:\t%016llx %016llx\n", | ||
79 | (unsigned long long) status.high, | ||
80 | (unsigned long long) status.low); | ||
81 | status.high = status.low = 0; | ||
82 | crypt_s390_kmc(KMC_QUERY, &status, NULL, NULL, 0); | ||
83 | printk(KERN_INFO "KMC:\t%016llx %016llx\n", | ||
84 | (unsigned long long) status.high, | ||
85 | (unsigned long long) status.low); | ||
86 | status.high = status.low = 0; | ||
87 | crypt_s390_kimd(KIMD_QUERY, &status, NULL, 0); | ||
88 | printk(KERN_INFO "KIMD:\t%016llx %016llx\n", | ||
89 | (unsigned long long) status.high, | ||
90 | (unsigned long long) status.low); | ||
91 | status.high = status.low = 0; | ||
92 | crypt_s390_klmd(KLMD_QUERY, &status, NULL, 0); | ||
93 | printk(KERN_INFO "KLMD:\t%016llx %016llx\n", | ||
94 | (unsigned long long) status.high, | ||
95 | (unsigned long long) status.low); | ||
96 | status.high = status.low = 0; | ||
97 | crypt_s390_kmac(KMAC_QUERY, &status, NULL, 0); | ||
98 | printk(KERN_INFO "KMAC:\t%016llx %016llx\n", | ||
99 | (unsigned long long) status.high, | ||
100 | (unsigned long long) status.low); | ||
101 | |||
102 | query_available_functions(); | ||
103 | return -ECANCELED; | ||
104 | } | ||
105 | |||
106 | static void __exit cleanup(void) | ||
107 | { | ||
108 | } | ||
109 | |||
110 | module_init(init); | ||
111 | module_exit(cleanup); | ||
112 | |||
113 | MODULE_LICENSE("GPL"); | ||