mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
[S390] Support for s390 Pseudo Random Number Generator
Starting with the z9 the CPU Cryptographic Assist Facility comes with an integrated Pseudo Random Number Generator. The generator creates random numbers by an algorithm similar to the ANSI X9.17 standard. The pseudo-random numbers can be accessed via a character device driver node called /dev/prandom. Similar to /dev/urandom any amount of bytes can be read from the device without blocking. Signed-off-by: Jan Glauber <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
This commit is contained in:
parent
d54853ef8c
commit
1b27829489
6 changed files with 230 additions and 0 deletions
|
|
@ -62,6 +62,18 @@ static inline unsigned long long get_clock (void)
|
|||
return clk;
|
||||
}
|
||||
|
||||
static inline void get_clock_extended(void *dest)
|
||||
{
|
||||
typedef struct { unsigned long long clk[2]; } __clock_t;
|
||||
|
||||
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
|
||||
asm volatile("stcke %0" : "=Q" (*((__clock_t *)dest)) : : "cc");
|
||||
#else /* __GNUC__ */
|
||||
asm volatile("stcke 0(%1)" : "=m" (*((__clock_t *)dest))
|
||||
: "a" ((__clock_t *)dest) : "cc");
|
||||
#endif /* __GNUC__ */
|
||||
}
|
||||
|
||||
static inline cycles_t get_cycles(void)
|
||||
{
|
||||
return (cycles_t) get_clock() >> 2;
|
||||
|
|
|
|||
Loading…
Reference in a new issue