@@ -34,115 +34,83 @@ struct crypto_dump_info {
3434static int crypto_report_aead (struct sk_buff * skb , struct crypto_alg * alg )
3535{
3636 struct crypto_stat_aead raead ;
37- u64 v64 ;
3837
3938 memset (& raead , 0 , sizeof (raead ));
4039
4140 strscpy (raead .type , "aead" , sizeof (raead .type ));
4241
43- v64 = atomic64_read (& alg -> encrypt_cnt );
44- raead .stat_encrypt_cnt = v64 ;
45- v64 = atomic64_read (& alg -> encrypt_tlen );
46- raead .stat_encrypt_tlen = v64 ;
47- v64 = atomic64_read (& alg -> decrypt_cnt );
48- raead .stat_decrypt_cnt = v64 ;
49- v64 = atomic64_read (& alg -> decrypt_tlen );
50- raead .stat_decrypt_tlen = v64 ;
51- v64 = atomic64_read (& alg -> aead_err_cnt );
52- raead .stat_aead_err_cnt = v64 ;
42+ raead .stat_encrypt_cnt = atomic64_read (& alg -> encrypt_cnt );
43+ raead .stat_encrypt_tlen = atomic64_read (& alg -> encrypt_tlen );
44+ raead .stat_decrypt_cnt = atomic64_read (& alg -> decrypt_cnt );
45+ raead .stat_decrypt_tlen = atomic64_read (& alg -> decrypt_tlen );
46+ raead .stat_aead_err_cnt = atomic64_read (& alg -> aead_err_cnt );
5347
5448 return nla_put (skb , CRYPTOCFGA_STAT_AEAD , sizeof (raead ), & raead );
5549}
5650
5751static int crypto_report_cipher (struct sk_buff * skb , struct crypto_alg * alg )
5852{
5953 struct crypto_stat_cipher rcipher ;
60- u64 v64 ;
6154
6255 memset (& rcipher , 0 , sizeof (rcipher ));
6356
6457 strscpy (rcipher .type , "cipher" , sizeof (rcipher .type ));
6558
66- v64 = atomic64_read (& alg -> encrypt_cnt );
67- rcipher .stat_encrypt_cnt = v64 ;
68- v64 = atomic64_read (& alg -> encrypt_tlen );
69- rcipher .stat_encrypt_tlen = v64 ;
70- v64 = atomic64_read (& alg -> decrypt_cnt );
71- rcipher .stat_decrypt_cnt = v64 ;
72- v64 = atomic64_read (& alg -> decrypt_tlen );
73- rcipher .stat_decrypt_tlen = v64 ;
74- v64 = atomic64_read (& alg -> cipher_err_cnt );
75- rcipher .stat_cipher_err_cnt = v64 ;
59+ rcipher .stat_encrypt_cnt = atomic64_read (& alg -> encrypt_cnt );
60+ rcipher .stat_encrypt_tlen = atomic64_read (& alg -> encrypt_tlen );
61+ rcipher .stat_decrypt_cnt = atomic64_read (& alg -> decrypt_cnt );
62+ rcipher .stat_decrypt_tlen = atomic64_read (& alg -> decrypt_tlen );
63+ rcipher .stat_cipher_err_cnt = atomic64_read (& alg -> cipher_err_cnt );
7664
7765 return nla_put (skb , CRYPTOCFGA_STAT_CIPHER , sizeof (rcipher ), & rcipher );
7866}
7967
8068static int crypto_report_comp (struct sk_buff * skb , struct crypto_alg * alg )
8169{
8270 struct crypto_stat_compress rcomp ;
83- u64 v64 ;
8471
8572 memset (& rcomp , 0 , sizeof (rcomp ));
8673
8774 strscpy (rcomp .type , "compression" , sizeof (rcomp .type ));
88- v64 = atomic64_read (& alg -> compress_cnt );
89- rcomp .stat_compress_cnt = v64 ;
90- v64 = atomic64_read (& alg -> compress_tlen );
91- rcomp .stat_compress_tlen = v64 ;
92- v64 = atomic64_read (& alg -> decompress_cnt );
93- rcomp .stat_decompress_cnt = v64 ;
94- v64 = atomic64_read (& alg -> decompress_tlen );
95- rcomp .stat_decompress_tlen = v64 ;
96- v64 = atomic64_read (& alg -> compress_err_cnt );
97- rcomp .stat_compress_err_cnt = v64 ;
75+ rcomp .stat_compress_cnt = atomic64_read (& alg -> compress_cnt );
76+ rcomp .stat_compress_tlen = atomic64_read (& alg -> compress_tlen );
77+ rcomp .stat_decompress_cnt = atomic64_read (& alg -> decompress_cnt );
78+ rcomp .stat_decompress_tlen = atomic64_read (& alg -> decompress_tlen );
79+ rcomp .stat_compress_err_cnt = atomic64_read (& alg -> compress_err_cnt );
9880
9981 return nla_put (skb , CRYPTOCFGA_STAT_COMPRESS , sizeof (rcomp ), & rcomp );
10082}
10183
10284static int crypto_report_acomp (struct sk_buff * skb , struct crypto_alg * alg )
10385{
10486 struct crypto_stat_compress racomp ;
105- u64 v64 ;
10687
10788 memset (& racomp , 0 , sizeof (racomp ));
10889
10990 strscpy (racomp .type , "acomp" , sizeof (racomp .type ));
110- v64 = atomic64_read (& alg -> compress_cnt );
111- racomp .stat_compress_cnt = v64 ;
112- v64 = atomic64_read (& alg -> compress_tlen );
113- racomp .stat_compress_tlen = v64 ;
114- v64 = atomic64_read (& alg -> decompress_cnt );
115- racomp .stat_decompress_cnt = v64 ;
116- v64 = atomic64_read (& alg -> decompress_tlen );
117- racomp .stat_decompress_tlen = v64 ;
118- v64 = atomic64_read (& alg -> compress_err_cnt );
119- racomp .stat_compress_err_cnt = v64 ;
91+ racomp .stat_compress_cnt = atomic64_read (& alg -> compress_cnt );
92+ racomp .stat_compress_tlen = atomic64_read (& alg -> compress_tlen );
93+ racomp .stat_decompress_cnt = atomic64_read (& alg -> decompress_cnt );
94+ racomp .stat_decompress_tlen = atomic64_read (& alg -> decompress_tlen );
95+ racomp .stat_compress_err_cnt = atomic64_read (& alg -> compress_err_cnt );
12096
12197 return nla_put (skb , CRYPTOCFGA_STAT_ACOMP , sizeof (racomp ), & racomp );
12298}
12399
124100static int crypto_report_akcipher (struct sk_buff * skb , struct crypto_alg * alg )
125101{
126102 struct crypto_stat_akcipher rakcipher ;
127- u64 v64 ;
128103
129104 memset (& rakcipher , 0 , sizeof (rakcipher ));
130105
131106 strscpy (rakcipher .type , "akcipher" , sizeof (rakcipher .type ));
132- v64 = atomic64_read (& alg -> encrypt_cnt );
133- rakcipher .stat_encrypt_cnt = v64 ;
134- v64 = atomic64_read (& alg -> encrypt_tlen );
135- rakcipher .stat_encrypt_tlen = v64 ;
136- v64 = atomic64_read (& alg -> decrypt_cnt );
137- rakcipher .stat_decrypt_cnt = v64 ;
138- v64 = atomic64_read (& alg -> decrypt_tlen );
139- rakcipher .stat_decrypt_tlen = v64 ;
140- v64 = atomic64_read (& alg -> sign_cnt );
141- rakcipher .stat_sign_cnt = v64 ;
142- v64 = atomic64_read (& alg -> verify_cnt );
143- rakcipher .stat_verify_cnt = v64 ;
144- v64 = atomic64_read (& alg -> akcipher_err_cnt );
145- rakcipher .stat_akcipher_err_cnt = v64 ;
107+ rakcipher .stat_encrypt_cnt = atomic64_read (& alg -> encrypt_cnt );
108+ rakcipher .stat_encrypt_tlen = atomic64_read (& alg -> encrypt_tlen );
109+ rakcipher .stat_decrypt_cnt = atomic64_read (& alg -> decrypt_cnt );
110+ rakcipher .stat_decrypt_tlen = atomic64_read (& alg -> decrypt_tlen );
111+ rakcipher .stat_sign_cnt = atomic64_read (& alg -> sign_cnt );
112+ rakcipher .stat_verify_cnt = atomic64_read (& alg -> verify_cnt );
113+ rakcipher .stat_akcipher_err_cnt = atomic64_read (& alg -> akcipher_err_cnt );
146114
147115 return nla_put (skb , CRYPTOCFGA_STAT_AKCIPHER ,
148116 sizeof (rakcipher ), & rakcipher );
@@ -151,79 +119,61 @@ static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg)
151119static int crypto_report_kpp (struct sk_buff * skb , struct crypto_alg * alg )
152120{
153121 struct crypto_stat_kpp rkpp ;
154- u64 v ;
155122
156123 memset (& rkpp , 0 , sizeof (rkpp ));
157124
158125 strscpy (rkpp .type , "kpp" , sizeof (rkpp .type ));
159126
160- v = atomic64_read (& alg -> setsecret_cnt );
161- rkpp .stat_setsecret_cnt = v ;
162- v = atomic64_read (& alg -> generate_public_key_cnt );
163- rkpp .stat_generate_public_key_cnt = v ;
164- v = atomic64_read (& alg -> compute_shared_secret_cnt );
165- rkpp .stat_compute_shared_secret_cnt = v ;
166- v = atomic64_read (& alg -> kpp_err_cnt );
167- rkpp .stat_kpp_err_cnt = v ;
127+ rkpp .stat_setsecret_cnt = atomic64_read (& alg -> setsecret_cnt );
128+ rkpp .stat_generate_public_key_cnt = atomic64_read (& alg -> generate_public_key_cnt );
129+ rkpp .stat_compute_shared_secret_cnt = atomic64_read (& alg -> compute_shared_secret_cnt );
130+ rkpp .stat_kpp_err_cnt = atomic64_read (& alg -> kpp_err_cnt );
168131
169132 return nla_put (skb , CRYPTOCFGA_STAT_KPP , sizeof (rkpp ), & rkpp );
170133}
171134
172135static int crypto_report_ahash (struct sk_buff * skb , struct crypto_alg * alg )
173136{
174137 struct crypto_stat_hash rhash ;
175- u64 v64 ;
176138
177139 memset (& rhash , 0 , sizeof (rhash ));
178140
179141 strscpy (rhash .type , "ahash" , sizeof (rhash .type ));
180142
181- v64 = atomic64_read (& alg -> hash_cnt );
182- rhash .stat_hash_cnt = v64 ;
183- v64 = atomic64_read (& alg -> hash_tlen );
184- rhash .stat_hash_tlen = v64 ;
185- v64 = atomic64_read (& alg -> hash_err_cnt );
186- rhash .stat_hash_err_cnt = v64 ;
143+ rhash .stat_hash_cnt = atomic64_read (& alg -> hash_cnt );
144+ rhash .stat_hash_tlen = atomic64_read (& alg -> hash_tlen );
145+ rhash .stat_hash_err_cnt = atomic64_read (& alg -> hash_err_cnt );
187146
188147 return nla_put (skb , CRYPTOCFGA_STAT_HASH , sizeof (rhash ), & rhash );
189148}
190149
191150static int crypto_report_shash (struct sk_buff * skb , struct crypto_alg * alg )
192151{
193152 struct crypto_stat_hash rhash ;
194- u64 v64 ;
195153
196154 memset (& rhash , 0 , sizeof (rhash ));
197155
198156 strscpy (rhash .type , "shash" , sizeof (rhash .type ));
199157
200- v64 = atomic64_read (& alg -> hash_cnt );
201- rhash .stat_hash_cnt = v64 ;
202- v64 = atomic64_read (& alg -> hash_tlen );
203- rhash .stat_hash_tlen = v64 ;
204- v64 = atomic64_read (& alg -> hash_err_cnt );
205- rhash .stat_hash_err_cnt = v64 ;
158+ rhash .stat_hash_cnt = atomic64_read (& alg -> hash_cnt );
159+ rhash .stat_hash_tlen = atomic64_read (& alg -> hash_tlen );
160+ rhash .stat_hash_err_cnt = atomic64_read (& alg -> hash_err_cnt );
206161
207162 return nla_put (skb , CRYPTOCFGA_STAT_HASH , sizeof (rhash ), & rhash );
208163}
209164
210165static int crypto_report_rng (struct sk_buff * skb , struct crypto_alg * alg )
211166{
212167 struct crypto_stat_rng rrng ;
213- u64 v64 ;
214168
215169 memset (& rrng , 0 , sizeof (rrng ));
216170
217171 strscpy (rrng .type , "rng" , sizeof (rrng .type ));
218172
219- v64 = atomic64_read (& alg -> generate_cnt );
220- rrng .stat_generate_cnt = v64 ;
221- v64 = atomic64_read (& alg -> generate_tlen );
222- rrng .stat_generate_tlen = v64 ;
223- v64 = atomic64_read (& alg -> seed_cnt );
224- rrng .stat_seed_cnt = v64 ;
225- v64 = atomic64_read (& alg -> rng_err_cnt );
226- rrng .stat_rng_err_cnt = v64 ;
173+ rrng .stat_generate_cnt = atomic64_read (& alg -> generate_cnt );
174+ rrng .stat_generate_tlen = atomic64_read (& alg -> generate_tlen );
175+ rrng .stat_seed_cnt = atomic64_read (& alg -> seed_cnt );
176+ rrng .stat_rng_err_cnt = atomic64_read (& alg -> rng_err_cnt );
227177
228178 return nla_put (skb , CRYPTOCFGA_STAT_RNG , sizeof (rrng ), & rrng );
229179}
0 commit comments