From: Stephan Mueller <smueller@chronox.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
y2038@lists.linaro.org, Kees Cook <keescook@chromium.org>,
Alexander Kuleshov <kuleshovmail@gmail.com>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: use timespec64 for jent_get_nstime
Date: Tue, 21 Jun 2016 08:20:10 +0200 [thread overview]
Message-ID: <10630099.jHjGp8aIto@positron.chronox.de> (raw)
In-Reply-To: <20160617155952.1021006-1-arnd@arndb.de>
Am Freitag, 17. Juni 2016, 17:59:41 schrieb Arnd Bergmann:
Hi Arnd,
> The jent_get_nstime() function uses __getnstimeofday() to get
> something similar to a 64-bit nanosecond counter. As we want
> to get rid of struct timespec to fix the y2038 overflow,
> this patch changes the code to use __getnstimeofday64()
> instead, which returns a timespec64 structure.
>
> Nothing changes about the algorithm, but it looks like it
> might be better to use
>
> *out = ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec;
>
> or even
>
> *out = ktime_get_raw_fast_ns();
I tested ktime_get_raw_fast_ns and it works perfectly well for the use case,
i.e. the RNG behavior is indistinguishable from RDTSC on x86.
Which time source is used for this function? I am wondering about
architectures other than X86.
Note, this function is used as a fallback when random_get_entropy is not
implemented. In addition the Jitter RNG has an online health test which will
catch the failure of the time stamp operation. Hence, even if this function
may not be suitable on one or the other arch, it should not hurt though.
PS: If someone is interested in the test code or the test results, let me
know.
Ciao
Stephan
next prev parent reply other threads:[~2016-06-21 6:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-17 15:59 [PATCH] crypto: use timespec64 for jent_get_nstime Arnd Bergmann
2016-06-18 8:16 ` Stephan Mueller
2016-06-21 6:20 ` Stephan Mueller [this message]
2016-06-21 8:32 ` Arnd Bergmann
2016-06-21 8:39 ` Stephan Mueller
2016-06-21 16:22 ` [Y2038] " John Stultz
2016-06-21 16:34 ` Stephan Mueller
2016-06-21 16:47 ` John Stultz
2016-06-21 16:51 ` Stephan Mueller
2016-06-21 17:07 ` Stephan Mueller
2016-06-21 17:12 ` John Stultz
2016-06-21 17:16 ` Stephan Mueller
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=10630099.jHjGp8aIto@positron.chronox.de \
--to=smueller@chronox.de \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=keescook@chromium.org \
--cc=kuleshovmail@gmail.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=y2038@lists.linaro.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