linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: LABBE Corentin <clabbe@baylibre.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: davem@davemloft.net, herbert@gondor.apana.org.au,
	nhorman@tuxdriver.com, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] crypto: Implement a generic crypto statistics
Date: Sun, 4 Nov 2018 10:12:11 +0100	[thread overview]
Message-ID: <20181104091211.GB6963@Red> (raw)
In-Reply-To: <20181103225234.GD808@sol.localdomain>

On Sat, Nov 03, 2018 at 03:52:35PM -0700, Eric Biggers wrote:
> On Wed, Sep 19, 2018 at 10:10:54AM +0000, Corentin Labbe wrote:
> > diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
> > index 19bf0ca6d635..6dafbc3e4414 100644
> > --- a/include/uapi/linux/cryptouser.h
> > +++ b/include/uapi/linux/cryptouser.h
> > @@ -29,6 +29,7 @@ enum {
> >  	CRYPTO_MSG_UPDATEALG,
> >  	CRYPTO_MSG_GETALG,
> >  	CRYPTO_MSG_DELRNG,
> > +	CRYPTO_MSG_GETSTAT,
> >  	__CRYPTO_MSG_MAX
> >  };
> >  #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
> > @@ -50,6 +51,16 @@ enum crypto_attr_type_t {
> >  	CRYPTOCFGA_REPORT_AKCIPHER,	/* struct crypto_report_akcipher */
> >  	CRYPTOCFGA_REPORT_KPP,		/* struct crypto_report_kpp */
> >  	CRYPTOCFGA_REPORT_ACOMP,	/* struct crypto_report_acomp */
> > +	CRYPTOCFGA_STAT_LARVAL,		/* struct crypto_stat */
> > +	CRYPTOCFGA_STAT_HASH,		/* struct crypto_stat */
> > +	CRYPTOCFGA_STAT_BLKCIPHER,	/* struct crypto_stat */
> > +	CRYPTOCFGA_STAT_AEAD,		/* struct crypto_stat */
> > +	CRYPTOCFGA_STAT_COMPRESS,	/* struct crypto_stat */
> > +	CRYPTOCFGA_STAT_RNG,		/* struct crypto_stat */
> > +	CRYPTOCFGA_STAT_CIPHER,		/* struct crypto_stat */
> > +	CRYPTOCFGA_STAT_AKCIPHER,	/* struct crypto_stat */
> > +	CRYPTOCFGA_STAT_KPP,		/* struct crypto_stat */
> > +	CRYPTOCFGA_STAT_ACOMP,		/* struct crypto_stat */
> >  	__CRYPTOCFGA_MAX
> >  
> >  #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
> > @@ -65,6 +76,47 @@ struct crypto_user_alg {
> >  	__u32 cru_flags;
> >  };
> >  
> > +struct crypto_stat {
> > +	char type[CRYPTO_MAX_NAME];
> > +	union {
> > +		__u32 stat_encrypt_cnt;
> > +		__u32 stat_compress_cnt;
> > +		__u32 stat_generate_cnt;
> > +		__u32 stat_hash_cnt;
> > +		__u32 stat_setsecret_cnt;
> > +	};
> > +	union {
> > +		__u64 stat_encrypt_tlen;
> > +		__u64 stat_compress_tlen;
> > +		__u64 stat_generate_tlen;
> > +		__u64 stat_hash_tlen;
> > +	};
> > +	union {
> > +		__u32 stat_akcipher_err_cnt;
> > +		__u32 stat_cipher_err_cnt;
> > +		__u32 stat_compress_err_cnt;
> > +		__u32 stat_aead_err_cnt;
> > +		__u32 stat_hash_err_cnt;
> > +		__u32 stat_rng_err_cnt;
> > +		__u32 stat_kpp_err_cnt;
> > +	};
> > +	union {
> > +		__u32 stat_decrypt_cnt;
> > +		__u32 stat_decompress_cnt;
> > +		__u32 stat_seed_cnt;
> > +		__u32 stat_generate_public_key_cnt;
> > +	};
> > +	union {
> > +		__u64 stat_decrypt_tlen;
> > +		__u64 stat_decompress_tlen;
> > +	};
> > +	union {
> > +		__u32 stat_verify_cnt;
> > +		__u32 stat_compute_shared_secret_cnt;
> > +	};
> > +	__u32 stat_sign_cnt;
> > +};
> > +
> 
> All the 32-bit fields need to be 64-bit.  In some cases, UINT32_MAX crypto
> operations can be done in seconds.
> 
> It's also weird that everything shares the same crypto_stat structure.  I think
> there should be a different struct for each algorithm type, like there is for
> the existing crypto_user algorithm reporting.  In fact you are kind of already
> doing that since the struct is loaded full of unions.  But it would be much
> cleaner to use actually different structures.
> 
> - Eric

Hello

I agree, separate structures will be cleaner.
I will address this in a followup patch.

Thanks

  reply	other threads:[~2018-11-04 18:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19 10:10 [PATCH v3 0/2] crypto: Implement a generic crypto statistics Corentin Labbe
2018-09-19 10:10 ` [PATCH v3 1/2] " Corentin Labbe
2018-11-03 22:19   ` Eric Biggers
2018-11-04  9:11     ` LABBE Corentin
2018-11-03 22:52   ` Eric Biggers
2018-11-04  9:12     ` LABBE Corentin [this message]
2018-12-06  0:04   ` Eric Biggers
2018-12-06 11:08     ` LABBE Corentin
2018-09-19 10:10 ` [PATCH v3 2/2] crypto: tools: Add cryptostat userspace Corentin Labbe
2018-09-28 13:13   ` Ard Biesheuvel
2018-09-28 17:03     ` Ard Biesheuvel
2018-10-01  7:20       ` LABBE Corentin
2018-10-01  8:40         ` Ard Biesheuvel
2018-09-28  5:08 ` [PATCH v3 0/2] crypto: Implement a generic crypto statistics Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181104091211.GB6963@Red \
    --to=clabbe@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).