[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <10630099.jHjGp8aIto@positron.chronox.de>
Date: Tue, 21 Jun 2016 08:20:10 +0200
From: Stephan Mueller <smueller@...onox.de>
To: Arnd Bergmann <arnd@...db.de>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>, y2038@...ts.linaro.org,
Kees Cook <keescook@...omium.org>,
Alexander Kuleshov <kuleshovmail@...il.com>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: use timespec64 for jent_get_nstime
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
Powered by blists - more mailing lists