diff options
| author | Corentin Labbe <clabbe@baylibre.com> | 2018-11-29 09:42:20 -0500 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-12-07 01:15:00 -0500 |
| commit | 76d09ea7c22f2cabf1f66ffc287c23b19b120be9 (patch) | |
| tree | 1e6b0998c77f23183cc2a10369be43a0b6f11c73 /tools/crypto | |
| parent | 7f0a9d5c9d1ba8ab3e5b144e52553744dc0d7471 (diff) | |
crypto: tool: getstat: convert user space example to the new crypto_user_stat uapi
This patch converts the getstat example tool to the recent changes done in crypto_user_stat
- changed all stats to u64
- separated struct stats for each crypto alg
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'tools/crypto')
| -rw-r--r-- | tools/crypto/getstat.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/tools/crypto/getstat.c b/tools/crypto/getstat.c index 24115173a483..57fbb94608d4 100644 --- a/tools/crypto/getstat.c +++ b/tools/crypto/getstat.c | |||
| @@ -152,53 +152,53 @@ static int get_stat(const char *drivername) | |||
| 152 | 152 | ||
| 153 | if (tb[CRYPTOCFGA_STAT_HASH]) { | 153 | if (tb[CRYPTOCFGA_STAT_HASH]) { |
| 154 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_HASH]; | 154 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_HASH]; |
| 155 | struct crypto_stat *rhash = | 155 | struct crypto_stat_hash *rhash = |
| 156 | (struct crypto_stat *)RTA_DATA(rta); | 156 | (struct crypto_stat_hash *)RTA_DATA(rta); |
| 157 | printf("%s\tHash\n\tHash: %u bytes: %llu\n\tErrors: %u\n", | 157 | printf("%s\tHash\n\tHash: %llu bytes: %llu\n\tErrors: %llu\n", |
| 158 | drivername, | 158 | drivername, |
| 159 | rhash->stat_hash_cnt, rhash->stat_hash_tlen, | 159 | rhash->stat_hash_cnt, rhash->stat_hash_tlen, |
| 160 | rhash->stat_hash_err_cnt); | 160 | rhash->stat_hash_err_cnt); |
| 161 | } else if (tb[CRYPTOCFGA_STAT_COMPRESS]) { | 161 | } else if (tb[CRYPTOCFGA_STAT_COMPRESS]) { |
| 162 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_COMPRESS]; | 162 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_COMPRESS]; |
| 163 | struct crypto_stat *rblk = | 163 | struct crypto_stat_compress *rblk = |
| 164 | (struct crypto_stat *)RTA_DATA(rta); | 164 | (struct crypto_stat_compress *)RTA_DATA(rta); |
| 165 | printf("%s\tCompress\n\tCompress: %u bytes: %llu\n\tDecompress: %u bytes: %llu\n\tErrors: %u\n", | 165 | printf("%s\tCompress\n\tCompress: %llu bytes: %llu\n\tDecompress: %llu bytes: %llu\n\tErrors: %llu\n", |
| 166 | drivername, | 166 | drivername, |
| 167 | rblk->stat_compress_cnt, rblk->stat_compress_tlen, | 167 | rblk->stat_compress_cnt, rblk->stat_compress_tlen, |
| 168 | rblk->stat_decompress_cnt, rblk->stat_decompress_tlen, | 168 | rblk->stat_decompress_cnt, rblk->stat_decompress_tlen, |
| 169 | rblk->stat_compress_err_cnt); | 169 | rblk->stat_compress_err_cnt); |
| 170 | } else if (tb[CRYPTOCFGA_STAT_ACOMP]) { | 170 | } else if (tb[CRYPTOCFGA_STAT_ACOMP]) { |
| 171 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_ACOMP]; | 171 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_ACOMP]; |
| 172 | struct crypto_stat *rcomp = | 172 | struct crypto_stat_compress *rcomp = |
| 173 | (struct crypto_stat *)RTA_DATA(rta); | 173 | (struct crypto_stat_compress *)RTA_DATA(rta); |
| 174 | printf("%s\tACompress\n\tCompress: %u bytes: %llu\n\tDecompress: %u bytes: %llu\n\tErrors: %u\n", | 174 | printf("%s\tACompress\n\tCompress: %llu bytes: %llu\n\tDecompress: %llu bytes: %llu\n\tErrors: %llu\n", |
| 175 | drivername, | 175 | drivername, |
| 176 | rcomp->stat_compress_cnt, rcomp->stat_compress_tlen, | 176 | rcomp->stat_compress_cnt, rcomp->stat_compress_tlen, |
| 177 | rcomp->stat_decompress_cnt, rcomp->stat_decompress_tlen, | 177 | rcomp->stat_decompress_cnt, rcomp->stat_decompress_tlen, |
| 178 | rcomp->stat_compress_err_cnt); | 178 | rcomp->stat_compress_err_cnt); |
| 179 | } else if (tb[CRYPTOCFGA_STAT_AEAD]) { | 179 | } else if (tb[CRYPTOCFGA_STAT_AEAD]) { |
| 180 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_AEAD]; | 180 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_AEAD]; |
| 181 | struct crypto_stat *raead = | 181 | struct crypto_stat_aead *raead = |
| 182 | (struct crypto_stat *)RTA_DATA(rta); | 182 | (struct crypto_stat_aead *)RTA_DATA(rta); |
| 183 | printf("%s\tAEAD\n\tEncrypt: %u bytes: %llu\n\tDecrypt: %u bytes: %llu\n\tErrors: %u\n", | 183 | printf("%s\tAEAD\n\tEncrypt: %llu bytes: %llu\n\tDecrypt: %llu bytes: %llu\n\tErrors: %llu\n", |
| 184 | drivername, | 184 | drivername, |
| 185 | raead->stat_encrypt_cnt, raead->stat_encrypt_tlen, | 185 | raead->stat_encrypt_cnt, raead->stat_encrypt_tlen, |
| 186 | raead->stat_decrypt_cnt, raead->stat_decrypt_tlen, | 186 | raead->stat_decrypt_cnt, raead->stat_decrypt_tlen, |
| 187 | raead->stat_aead_err_cnt); | 187 | raead->stat_aead_err_cnt); |
| 188 | } else if (tb[CRYPTOCFGA_STAT_BLKCIPHER]) { | 188 | } else if (tb[CRYPTOCFGA_STAT_BLKCIPHER]) { |
| 189 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_BLKCIPHER]; | 189 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_BLKCIPHER]; |
| 190 | struct crypto_stat *rblk = | 190 | struct crypto_stat_cipher *rblk = |
| 191 | (struct crypto_stat *)RTA_DATA(rta); | 191 | (struct crypto_stat_cipher *)RTA_DATA(rta); |
| 192 | printf("%s\tCipher\n\tEncrypt: %u bytes: %llu\n\tDecrypt: %u bytes: %llu\n\tErrors: %u\n", | 192 | printf("%s\tCipher\n\tEncrypt: %llu bytes: %llu\n\tDecrypt: %llu bytes: %llu\n\tErrors: %llu\n", |
| 193 | drivername, | 193 | drivername, |
| 194 | rblk->stat_encrypt_cnt, rblk->stat_encrypt_tlen, | 194 | rblk->stat_encrypt_cnt, rblk->stat_encrypt_tlen, |
| 195 | rblk->stat_decrypt_cnt, rblk->stat_decrypt_tlen, | 195 | rblk->stat_decrypt_cnt, rblk->stat_decrypt_tlen, |
| 196 | rblk->stat_cipher_err_cnt); | 196 | rblk->stat_cipher_err_cnt); |
| 197 | } else if (tb[CRYPTOCFGA_STAT_AKCIPHER]) { | 197 | } else if (tb[CRYPTOCFGA_STAT_AKCIPHER]) { |
| 198 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_AKCIPHER]; | 198 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_AKCIPHER]; |
| 199 | struct crypto_stat *rblk = | 199 | struct crypto_stat_akcipher *rblk = |
| 200 | (struct crypto_stat *)RTA_DATA(rta); | 200 | (struct crypto_stat_akcipher *)RTA_DATA(rta); |
| 201 | printf("%s\tAkcipher\n\tEncrypt: %u bytes: %llu\n\tDecrypt: %u bytes: %llu\n\tSign: %u\n\tVerify: %u\n\tErrors: %u\n", | 201 | printf("%s\tAkcipher\n\tEncrypt: %llu bytes: %llu\n\tDecrypt: %llu bytes: %llu\n\tSign: %llu\n\tVerify: %llu\n\tErrors: %llu\n", |
| 202 | drivername, | 202 | drivername, |
| 203 | rblk->stat_encrypt_cnt, rblk->stat_encrypt_tlen, | 203 | rblk->stat_encrypt_cnt, rblk->stat_encrypt_tlen, |
| 204 | rblk->stat_decrypt_cnt, rblk->stat_decrypt_tlen, | 204 | rblk->stat_decrypt_cnt, rblk->stat_decrypt_tlen, |
| @@ -206,27 +206,27 @@ static int get_stat(const char *drivername) | |||
| 206 | rblk->stat_akcipher_err_cnt); | 206 | rblk->stat_akcipher_err_cnt); |
| 207 | } else if (tb[CRYPTOCFGA_STAT_CIPHER]) { | 207 | } else if (tb[CRYPTOCFGA_STAT_CIPHER]) { |
| 208 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_CIPHER]; | 208 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_CIPHER]; |
| 209 | struct crypto_stat *rblk = | 209 | struct crypto_stat_cipher *rblk = |
| 210 | (struct crypto_stat *)RTA_DATA(rta); | 210 | (struct crypto_stat_cipher *)RTA_DATA(rta); |
| 211 | printf("%s\tcipher\n\tEncrypt: %u bytes: %llu\n\tDecrypt: %u bytes: %llu\n\tErrors: %u\n", | 211 | printf("%s\tcipher\n\tEncrypt: %llu bytes: %llu\n\tDecrypt: %llu bytes: %llu\n\tErrors: %llu\n", |
| 212 | drivername, | 212 | drivername, |
| 213 | rblk->stat_encrypt_cnt, rblk->stat_encrypt_tlen, | 213 | rblk->stat_encrypt_cnt, rblk->stat_encrypt_tlen, |
| 214 | rblk->stat_decrypt_cnt, rblk->stat_decrypt_tlen, | 214 | rblk->stat_decrypt_cnt, rblk->stat_decrypt_tlen, |
| 215 | rblk->stat_cipher_err_cnt); | 215 | rblk->stat_cipher_err_cnt); |
| 216 | } else if (tb[CRYPTOCFGA_STAT_RNG]) { | 216 | } else if (tb[CRYPTOCFGA_STAT_RNG]) { |
| 217 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_RNG]; | 217 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_RNG]; |
| 218 | struct crypto_stat *rrng = | 218 | struct crypto_stat_rng *rrng = |
| 219 | (struct crypto_stat *)RTA_DATA(rta); | 219 | (struct crypto_stat_rng *)RTA_DATA(rta); |
| 220 | printf("%s\tRNG\n\tSeed: %u\n\tGenerate: %u bytes: %llu\n\tErrors: %u\n", | 220 | printf("%s\tRNG\n\tSeed: %llu\n\tGenerate: %llu bytes: %llu\n\tErrors: %llu\n", |
| 221 | drivername, | 221 | drivername, |
| 222 | rrng->stat_seed_cnt, | 222 | rrng->stat_seed_cnt, |
| 223 | rrng->stat_generate_cnt, rrng->stat_generate_tlen, | 223 | rrng->stat_generate_cnt, rrng->stat_generate_tlen, |
| 224 | rrng->stat_rng_err_cnt); | 224 | rrng->stat_rng_err_cnt); |
| 225 | } else if (tb[CRYPTOCFGA_STAT_KPP]) { | 225 | } else if (tb[CRYPTOCFGA_STAT_KPP]) { |
| 226 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_KPP]; | 226 | struct rtattr *rta = tb[CRYPTOCFGA_STAT_KPP]; |
| 227 | struct crypto_stat *rkpp = | 227 | struct crypto_stat_kpp *rkpp = |
| 228 | (struct crypto_stat *)RTA_DATA(rta); | 228 | (struct crypto_stat_kpp *)RTA_DATA(rta); |
| 229 | printf("%s\tKPP\n\tSetsecret: %u\n\tGenerate public key: %u\n\tCompute_shared_secret: %u\n\tErrors: %u\n", | 229 | printf("%s\tKPP\n\tSetsecret: %llu\n\tGenerate public key: %llu\n\tCompute_shared_secret: %llu\n\tErrors: %llu\n", |
| 230 | drivername, | 230 | drivername, |
| 231 | rkpp->stat_setsecret_cnt, | 231 | rkpp->stat_setsecret_cnt, |
| 232 | rkpp->stat_generate_public_key_cnt, | 232 | rkpp->stat_generate_public_key_cnt, |
