From: Herbert Xu <herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
To: Stephan Mueller <smueller-T9tCv8IpfcWELgA04lAiVw@public.gmane.org>
Cc: Daniel Borkmann
<dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
'Quentin Gouchet'
<quentin.gouchet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
'LKML' <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v6 3/4] crypto: AF_ALG: add random number generator support
Date: Mon, 29 Dec 2014 21:41:49 +1100 [thread overview]
Message-ID: <20141229104149.GA13699@gondor.apana.org.au> (raw)
In-Reply-To: <2323421.LJnyPUDp59-PJstQz4BMNNP20K/wil9xYQuADTiUCJX@public.gmane.org>
On Thu, Dec 25, 2014 at 11:00:06PM +0100, Stephan Mueller wrote:
> This patch adds the random number generator support for AF_ALG.
>
> A random number generator's purpose is to generate data without
> requiring the caller to provide any data. Therefore, the AF_ALG
> interface handler for RNGs only implements a callback handler for
> recvmsg.
>
> The following parameters provided with a recvmsg are processed by the
> RNG callback handler:
>
> * sock - to resolve the RNG context data structure accessing the
> RNG instance private to the socket
>
> * len - this parameter allows userspace callers to specify how
> many random bytes the RNG shall produce and return. As the
> kernel context for the RNG allocates a buffer of 128 bytes to
> store random numbers before copying them to userspace, the len
> parameter is checked that it is not larger than 128. If a
> caller wants more random numbers, a new request for recvmsg
> shall be made.
>
> The size of 128 bytes is chose because of the following considerations:
>
> * to increase the memory footprint of the kernel too much (note,
> that would be 128 bytes per open socket)
>
> * 128 is divisible by any typical cryptographic block size an
> RNG may have
>
> * A request for random numbers typically only shall supply small
> amount of data like for keys or IVs that should only require
> one invocation of the recvmsg function.
>
> Note, during instantiation of the RNG, the code checks whether the RNG
> implementation requires seeding. If so, the RNG is seeded with output
> from get_random_bytes.
>
> A fully working example using all aspects of the RNG interface is
> provided at http://www.chronox.de/libkcapi.html
>
> Signed-off-by: Stephan Mueller <smueller-T9tCv8IpfcWELgA04lAiVw@public.gmane.org>
Patch applied.
--
Email: Herbert Xu <herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2014-12-29 10:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-25 21:58 [PATCH v6 0/4] crypto: AF_ALG: add AEAD and RNG support Stephan Mueller
[not found] ` <5682082.ffPqvQlSqN-PJstQz4BMNNP20K/wil9xYQuADTiUCJX@public.gmane.org>
2014-12-25 21:59 ` [PATCH v6 2/4] crypto: AF_ALG: enable AEAD interface compilation Stephan Mueller
2014-12-25 22:00 ` [PATCH v6 3/4] crypto: AF_ALG: add random number generator support Stephan Mueller
[not found] ` <2323421.LJnyPUDp59-PJstQz4BMNNP20K/wil9xYQuADTiUCJX@public.gmane.org>
2014-12-29 10:41 ` Herbert Xu [this message]
2014-12-25 22:00 ` [PATCH v6 4/4] crypto: AF_ALG: enable RNG interface compilation Stephan Mueller
2014-12-29 10:41 ` Herbert Xu
[not found] ` <20141229104158.GB13699-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2014-12-31 7:57 ` Stephan Mueller
2014-12-25 22:01 ` [PATCH v6 1/4] crypto: AF_ALG: add AEAD support Stephan Mueller
[not found] ` <5002301.TQO37u96dE-PJstQz4BMNNP20K/wil9xYQuADTiUCJX@public.gmane.org>
2014-12-29 10:33 ` Herbert Xu
[not found] ` <20141229103319.GB13334-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2014-12-29 15:05 ` Stephan Mueller
[not found] ` <29582980.qoHS2EjmLy-PJstQz4BMNNP20K/wil9xYQuADTiUCJX@public.gmane.org>
2014-12-29 17:33 ` Herbert Xu
2014-12-30 21:03 ` Stephan Mueller
2014-12-30 21:30 ` Stephan Mueller
2014-12-29 10:20 ` [PATCH v6 0/4] crypto: AF_ALG: add AEAD and RNG support 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=20141229104149.GA13699@gondor.apana.org.au \
--to=herbert-loam2ak0srrlbo1qdeomrrpzq4s04n8q@public.gmane.org \
--cc=dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=quentin.gouchet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=smueller-T9tCv8IpfcWELgA04lAiVw@public.gmane.org \
/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