Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757409AbdLTXhm (ORCPT ); Wed, 20 Dec 2017 18:37:42 -0500 Received: from merlin.infradead.org ([205.233.59.134]:52102 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755928AbdLTXh0 (ORCPT ); Wed, 20 Dec 2017 18:37:26 -0500 From: Randy Dunlap Subject: Re: [PATCH RFC 3/3] crypto: tools: Add cryptostat userspace To: Corentin Labbe , davem@davemloft.net, herbert@gondor.apana.org.au, nhorman@tuxdriver.com Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org References: <1513800567-12764-1-git-send-email-clabbe@baylibre.com> <1513800567-12764-4-git-send-email-clabbe@baylibre.com> Message-ID: <167f88c3-a70e-57f4-6715-129d40d1e4a9@infradead.org> Date: Wed, 20 Dec 2017 15:37:24 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1513800567-12764-4-git-send-email-clabbe@baylibre.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1943 Lines: 64 On 12/20/2017 12:09 PM, Corentin Labbe wrote: > Add an example tool for getting easily crypto statistics. > > Signed-off-by: Corentin Labbe > --- > tools/crypto/cryptostat | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > create mode 100755 tools/crypto/cryptostat > > diff --git a/tools/crypto/cryptostat b/tools/crypto/cryptostat > new file mode 100755 > index 000000000000..314e108eb608 > --- /dev/null > +++ b/tools/crypto/cryptostat > @@ -0,0 +1,40 @@ > +#!/bin/bash > + > +for dn in `ls /sys/kernel/crypto/` > +do > + dnpath=/sys/kernel/crypto/$dn/ > + algtype=$(cat $dnpath/algtype) > + algname=$(cat $dnpath/algname) > + echo "$dn ($algtype) $algname" > + case $algtype in > + hash) > + echo -e "\tHash: $(cat $dnpath/enc_cnt)\tbytes $(cat $dnpath/enc_tlen)" > + ;; > + cipher) > + echo -e "\tEncrypt: $(cat $dnpath/enc_cnt)\tbytes $(cat $dnpath/enc_tlen)" > + echo -e "\tDecrypt: $(cat $dnpath/dec_cnt)\tbytes $(cat $dnpath/dec_tlen)" > + ;; > + compress) > + echo -e "\tCompress: $(cat $dnpath/enc_cnt)\tbytes $(cat $dnpath/enc_tlen)" > + echo -e "\tDecompress: $(cat $dnpath/dec_cnt)\tbytes $(cat $dnpath/dec_tlen)" > + ;; > + asymetric) spello: asymmetric) > + echo -e "\tEncrypt: $(cat $dnpath/enc_cnt)\tbytes $(cat $dnpath/enc_tlen)" > + echo -e "\tDecrypt: $(cat $dnpath/dec_cnt)\tbytes $(cat $dnpath/dec_tlen)" > + echo -e "\tVerify: $(cat $dnpath/verify_cnt)" > + echo -e "\tSign: $(cat $dnpath/sign_cnt)" > + ;; > + rng) > + echo -e "\tGenerate: $(cat $dnpath/enc_cnt)\tbytes $(cat $dnpath/enc_tlen)" > + echo -e "\tSeed: $(cat $dnpath/dec_cnt)" > + ;; > + kpp) > + echo -e "\tSet_secret: $(cat $dnpath/dec_cnt)" > + echo -e "\tGenerate_public_key: $(cat $dnpath/enc_cnt)" > + echo -e "\tCompute_shared_secret: $(cat $dnpath/verify_cnt)" > + ;; > + *) > + echo -e "\t$(cat $dnpath/enc_cnt)\tbytes $(cat $dnpath/enc_tlen)" > + ;; > + esac > +done > -- ~Randy