mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-01 23:20:55 +00:00
parent
fb2e0b50c8
commit
a529fffb7b
@ -20,5 +20,3 @@ endif
|
|||||||
|
|
||||||
INC_DIR += $(call select_from_repositories,src/lib/jitterentropy)
|
INC_DIR += $(call select_from_repositories,src/lib/jitterentropy)
|
||||||
INC_DIR += $(call select_from_repositories,src/lib/jitterentropy/spec/$(TARGET_CPUARCH))
|
INC_DIR += $(call select_from_repositories,src/lib/jitterentropy/spec/$(TARGET_CPUARCH))
|
||||||
|
|
||||||
CC_OPT += -DJITTERENTROPY_GENODE
|
|
||||||
|
@ -3,12 +3,14 @@ JENT_CONTRIB_DIR := $(call select_from_ports,jitterentropy)
|
|||||||
INC_DIR += $(JENT_CONTRIB_DIR)/include/jitterentropy \
|
INC_DIR += $(JENT_CONTRIB_DIR)/include/jitterentropy \
|
||||||
$(REP_DIR)/src/lib/jitterentropy
|
$(REP_DIR)/src/lib/jitterentropy
|
||||||
|
|
||||||
SRC_C = jitterentropy-base.c
|
SRC_C += jitterentropy-base.c
|
||||||
SRC_CC = jitterentropy-base-genode.cc
|
SRC_C += jitterentropy-gcd.c
|
||||||
|
SRC_C += jitterentropy-health.c
|
||||||
CC_OPT += -DJITTERENTROPY_GENODE
|
SRC_C += jitterentropy-noise.c
|
||||||
|
SRC_C += jitterentropy-sha3.c
|
||||||
|
SRC_CC += jitterentropy-base-genode.cc
|
||||||
|
|
||||||
override CC_OLEVEL := -O0
|
override CC_OLEVEL := -O0
|
||||||
|
|
||||||
vpath %.c $(JENT_CONTRIB_DIR)/src/lib/jitterentropy
|
vpath %.c $(JENT_CONTRIB_DIR)/src/lib/jitterentropy/src
|
||||||
vpath %.cc $(REP_DIR)/src/lib/jitterentropy
|
vpath %.cc $(REP_DIR)/src/lib/jitterentropy
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/arm_v6
|
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/arm_v6
|
||||||
|
|
||||||
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
||||||
|
|
||||||
CC_CXX_WARN_STRICT =
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/arm_v7
|
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/arm_v7
|
||||||
|
|
||||||
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
||||||
|
|
||||||
CC_CXX_WARN_STRICT =
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/arm_v8
|
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/arm_v8
|
||||||
|
|
||||||
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
||||||
|
|
||||||
CC_CXX_WARN_STRICT =
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/x86_32
|
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/x86_32
|
||||||
|
|
||||||
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
||||||
|
|
||||||
CC_CXX_WARN_STRICT =
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/x86_64
|
INC_DIR += $(REP_DIR)/src/lib/jitterentropy/spec/x86_64
|
||||||
|
|
||||||
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
include $(REP_DIR)/lib/mk/jitterentropy.inc
|
||||||
|
|
||||||
CC_CXX_WARN_STRICT =
|
|
||||||
|
@ -1 +1 @@
|
|||||||
5a9912059b31cef732fde73b1933e9bf0ed15adc
|
6bed43a43605b0006c7298cf4824a8214f36bb07
|
||||||
|
@ -1,28 +1,13 @@
|
|||||||
LICENSE := BSD
|
LICENSE := BSD
|
||||||
VERSION := 1.2.0
|
VERSION := 3.4.1
|
||||||
DOWNLOADS := jitterentropy.archive
|
DOWNLOADS := jitterentropy.archive
|
||||||
|
|
||||||
URL(jitterentropy) := http://www.chronox.de/jent/releases/historic/jitterentropy-$(VERSION).tar.xz
|
NAME(jitterentropy) := jitterentropy-$(VERSION).tar.gz
|
||||||
SHA(jitterentropy) := c2cadcc413b9f5f40b6cc0e092933a32585f7db8f28269af2bee794fde8034b2
|
URL(jitterentropy) := https://github.com/smuellerDD/jitterentropy-library/archive/refs/tags/v$(VERSION).tar.gz
|
||||||
SIG(jitterentropy) := ${URL(jitterentropy)}.asc
|
SHA(jitterentropy) := 33352369092b5a0d1463c720f5a8a3e870dbd63502ea57692e7da84a65c0c5c3
|
||||||
KEY(jitterentropy) := 5F0D446594D2BF6977A9828AF02C639D843B5F11
|
DIR(jitterentropy) := src/lib/jitterentropy
|
||||||
DIR(jitterentropy) := src/lib/jitterentropy
|
|
||||||
|
PATCHES := src/lib/jitterentropy/jitterentropy.patch
|
||||||
|
|
||||||
DIRS := include/jitterentropy
|
DIRS := include/jitterentropy
|
||||||
DIR_CONTENT(include/jitterentropy) := $(addprefix src/lib/jitterentropy/,\
|
DIR_CONTENT(include/jitterentropy) := $(addprefix src/lib/jitterentropy/,jitterentropy.h)
|
||||||
jitterentropy.h)
|
|
||||||
|
|
||||||
PATCHES := src/lib/jitterentropy/jitterentropy_h.patch \
|
|
||||||
src/lib/jitterentropy/jitterentropy_delta_compare.patch \
|
|
||||||
src/lib/jitterentropy/jitterentropy_memcpy.patch
|
|
||||||
PATCH_OPT := -p1 -d src/lib/jitterentropy
|
|
||||||
|
|
||||||
#
|
|
||||||
# Just to make sure that the compiler will use the right header files
|
|
||||||
# we delete the local copy from the source directory after the files
|
|
||||||
# were copied to the include directory.
|
|
||||||
#
|
|
||||||
default: rm_header
|
|
||||||
rm_header: _dirs
|
|
||||||
@$(MSG_PREFIX)"remove header files from source directory "
|
|
||||||
$(VERBOSE)rm src/lib/jitterentropy/jitterentropy.h
|
|
||||||
|
@ -5,7 +5,7 @@ MIRROR_FROM_REP_DIR := lib/mk/jitterentropy.inc \
|
|||||||
src/lib/jitterentropy
|
src/lib/jitterentropy
|
||||||
|
|
||||||
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/jitterentropy)
|
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/jitterentropy)
|
||||||
MIRROR_FROM_PORT_DIR := src/lib/jitterentropy/jitterentropy-base.c \
|
MIRROR_FROM_PORT_DIR := src/lib/jitterentropy/src \
|
||||||
include/jitterentropy/jitterentropy.h
|
include/jitterentropy/jitterentropy.h
|
||||||
|
|
||||||
content: $(MIRROR_FROM_REP_DIR) $(MIRROR_FROM_PORT_DIR) LICENSE
|
content: $(MIRROR_FROM_REP_DIR) $(MIRROR_FROM_PORT_DIR) LICENSE
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
#include <base/allocator.h>
|
#include <base/allocator.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
|
|
||||||
/* local includes */
|
#include <jitterentropy.h>
|
||||||
#include <jitterentropy-base-genode.h>
|
|
||||||
|
|
||||||
|
|
||||||
static Genode::Allocator *_alloc;
|
static Genode::Allocator *_alloc;
|
||||||
@ -40,7 +39,7 @@ void *jent_zalloc(size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jent_zfree(void *ptr, unsigned int len)
|
void jent_zfree(void *ptr, unsigned int)
|
||||||
{
|
{
|
||||||
if (!_alloc) { return; }
|
if (!_alloc) { return; }
|
||||||
_alloc->free(ptr, 0);
|
_alloc->free(ptr, 0);
|
||||||
@ -51,3 +50,9 @@ void *jent_memcpy(void *dest, const void *src, size_t n)
|
|||||||
{
|
{
|
||||||
return Genode::memcpy(dest, src, n);
|
return Genode::memcpy(dest, src, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *jent_memset(void *dest, int c, size_t n)
|
||||||
|
{
|
||||||
|
return Genode::memset(dest, (uint8_t)c, n);
|
||||||
|
}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* \brief Genode base for jitterentropy
|
* \brief Genode base for jitterentropy
|
||||||
* \author Josef Soentgen
|
* \author Josef Soentgen
|
||||||
|
* \author Christian Helmuth
|
||||||
* \date 2014-08-18
|
* \date 2014-08-18
|
||||||
|
*
|
||||||
|
* Required to be included outside of extern "C" {...} at top of
|
||||||
|
* jitterentropy.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2014-2017 Genode Labs GmbH
|
* Copyright (C) 2014-2024 Genode Labs GmbH
|
||||||
*
|
*
|
||||||
* This file is part of the Genode OS framework, which is distributed
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
@ -14,21 +18,6 @@
|
|||||||
#ifndef _JITTERENTROPY_BASE_GENODE_H_
|
#ifndef _JITTERENTROPY_BASE_GENODE_H_
|
||||||
#define _JITTERENTROPY_BASE_GENODE_H_
|
#define _JITTERENTROPY_BASE_GENODE_H_
|
||||||
|
|
||||||
/* needed type definitions */
|
|
||||||
#include <base/fixed_stdint.h>
|
|
||||||
|
|
||||||
typedef unsigned long size_t;
|
|
||||||
typedef signed long ssize_t;
|
|
||||||
typedef genode_uint32_t uint32_t;
|
|
||||||
typedef genode_uint64_t uint64_t;
|
|
||||||
typedef uint32_t __u32;
|
|
||||||
typedef uint64_t __u64;
|
|
||||||
typedef genode_int64_t __s64;
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#define NULL (void*)0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <base/allocator.h>
|
#include <base/allocator.h>
|
||||||
@ -36,25 +25,6 @@ typedef genode_int64_t __s64;
|
|||||||
/* Genode specific function to set the backend allocator */
|
/* Genode specific function to set the backend allocator */
|
||||||
void jitterentropy_init(Genode::Allocator &alloc);
|
void jitterentropy_init(Genode::Allocator &alloc);
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <jitterentropy-base-genode-nstime.h>
|
|
||||||
|
|
||||||
void *jent_zalloc(size_t len);
|
|
||||||
void jent_zfree(void *ptr, unsigned int len);
|
|
||||||
|
|
||||||
static inline int jent_fips_enabled(void) { return 0; }
|
|
||||||
|
|
||||||
static inline __u64 rol64(__u64 word, unsigned int shift)
|
|
||||||
{
|
|
||||||
return (word << shift) | (word >> (64 - shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
void *jent_memcpy(void *dest, const void *src, size_t n);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _JITTERENTROPY_BASE_GENODE_H_ */
|
#endif /* _JITTERENTROPY_BASE_GENODE_H_ */
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* \brief Genode base for jitterentropy
|
||||||
|
* \author Josef Soentgen
|
||||||
|
* \author Christian Helmuth
|
||||||
|
* \date 2014-08-18
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2024 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JITTERENTROPY_BASE_USER_H_
|
||||||
|
#define _JITTERENTROPY_BASE_USER_H_
|
||||||
|
|
||||||
|
/* needed type definitions */
|
||||||
|
#include <base/fixed_stdint.h>
|
||||||
|
|
||||||
|
typedef unsigned long size_t;
|
||||||
|
typedef signed long ssize_t;
|
||||||
|
typedef genode_uint8_t uint8_t;
|
||||||
|
typedef genode_uint32_t uint32_t;
|
||||||
|
typedef genode_uint64_t uint64_t;
|
||||||
|
typedef uint32_t __u32;
|
||||||
|
typedef uint64_t __u64;
|
||||||
|
typedef genode_int64_t __s64;
|
||||||
|
|
||||||
|
/* use gcc standard defines */
|
||||||
|
#define UINT32_MAX __UINT32_MAX__
|
||||||
|
#define UINT32_C __UINT32_C
|
||||||
|
#define UINT64_C __UINT64_C
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#define NULL (void*)0
|
||||||
|
|
||||||
|
#define EAGAIN 35 /* jitterentropy-health.c */
|
||||||
|
#define EOPNOTSUPP 45 /* jitterentropy-timer.h */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <jitterentropy-base-genode-nstime.h>
|
||||||
|
|
||||||
|
void *jent_zalloc(size_t len);
|
||||||
|
void jent_zfree(void *ptr, unsigned int len);
|
||||||
|
|
||||||
|
static inline int jent_fips_enabled(void) { return 0; }
|
||||||
|
|
||||||
|
static inline uint32_t jent_cache_size_roundup(void) { return 0; }
|
||||||
|
|
||||||
|
static inline __u64 rol64(__u64 word, unsigned int shift)
|
||||||
|
{
|
||||||
|
return (word << shift) | (word >> (64 - shift));
|
||||||
|
}
|
||||||
|
|
||||||
|
void *jent_memcpy(void *dest, void const *src, size_t n);
|
||||||
|
|
||||||
|
void *jent_memset(void *dest, int c, size_t n);
|
||||||
|
|
||||||
|
static inline void jent_memset_secure(void *s, size_t n)
|
||||||
|
{
|
||||||
|
jent_memset(s, 0, n);
|
||||||
|
asm volatile ("" : : "r" (s) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _JITTERENTROPY_BASE_USER_H_ */
|
81
repos/libports/src/lib/jitterentropy/jitterentropy.patch
Normal file
81
repos/libports/src/lib/jitterentropy/jitterentropy.patch
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
diff -ur -x '*~' -x recording_userspace src.orig/lib/jitterentropy/jitterentropy.h src/lib/jitterentropy/jitterentropy.h
|
||||||
|
--- src.orig/lib/jitterentropy/jitterentropy.h
|
||||||
|
+++ src/lib/jitterentropy/jitterentropy.h
|
||||||
|
@@ -42,6 +42,8 @@
|
||||||
|
#ifndef _JITTERENTROPY_H
|
||||||
|
#define _JITTERENTROPY_H
|
||||||
|
|
||||||
|
+#include "jitterentropy-base-genode.h"
|
||||||
|
+
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
diff -ur -x '*~' -x recording_userspace src.orig/lib/jitterentropy/src/jitterentropy-noise.c src/lib/jitterentropy/src/jitterentropy-noise.c
|
||||||
|
--- src.orig/lib/jitterentropy/src/jitterentropy-noise.c
|
||||||
|
+++ src/lib/jitterentropy/src/jitterentropy-noise.c
|
||||||
|
@@ -112,7 +112,7 @@
|
||||||
|
jent_loop_shuffle(ec, MAX_HASH_LOOP, MIN_HASH_LOOP);
|
||||||
|
|
||||||
|
/* Use the memset to shut up valgrind */
|
||||||
|
- memset(intermediary, 0, sizeof(intermediary));
|
||||||
|
+ jent_memset(intermediary, 0, sizeof(intermediary));
|
||||||
|
|
||||||
|
sha3_256_init(&ctx);
|
||||||
|
|
||||||
|
@@ -413,7 +413,7 @@
|
||||||
|
/* The final operation automatically re-initializes the ->hash_state */
|
||||||
|
sha3_final(ec->hash_state, jent_block);
|
||||||
|
if (dst_len)
|
||||||
|
- memcpy(dst, jent_block, dst_len);
|
||||||
|
+ jent_memcpy(dst, jent_block, dst_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stir the new state with the data from the old state - the digest
|
||||||
|
diff -ur -x '*~' -x recording_userspace src.orig/lib/jitterentropy/src/jitterentropy-sha3.c src/lib/jitterentropy/src/jitterentropy-sha3.c
|
||||||
|
--- src.orig/lib/jitterentropy/src/jitterentropy-sha3.c
|
||||||
|
+++ src/lib/jitterentropy/src/jitterentropy-sha3.c
|
||||||
|
@@ -295,7 +295,7 @@
|
||||||
|
* buffer, copy it and leave it unprocessed.
|
||||||
|
*/
|
||||||
|
if (inlen < todo) {
|
||||||
|
- memcpy(ctx->partial + partial, in, inlen);
|
||||||
|
+ jent_memcpy(ctx->partial + partial, in, inlen);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -303,7 +303,7 @@
|
||||||
|
* The input data is large enough to fill the entire partial
|
||||||
|
* block buffer. Thus, we fill it and transform it.
|
||||||
|
*/
|
||||||
|
- memcpy(ctx->partial + partial, in, todo);
|
||||||
|
+ jent_memcpy(ctx->partial + partial, in, todo);
|
||||||
|
inlen -= todo;
|
||||||
|
in += todo;
|
||||||
|
|
||||||
|
@@ -318,7 +318,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we have data left, copy it into the partial block buffer */
|
||||||
|
- memcpy(ctx->partial, in, inlen);
|
||||||
|
+ jent_memcpy(ctx->partial, in, inlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sha3_final(struct sha_ctx *ctx, uint8_t *digest)
|
||||||
|
@@ -329,7 +329,7 @@
|
||||||
|
/* Final round in sponge absorbing phase */
|
||||||
|
|
||||||
|
/* Fill the unused part of the partial buffer with zeros */
|
||||||
|
- memset(ctx->partial + partial, 0, ctx->r - partial);
|
||||||
|
+ jent_memset(ctx->partial + partial, 0, ctx->r - partial);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add the leading and trailing bit as well as the 01 bits for the
|
||||||
|
@@ -353,7 +353,7 @@
|
||||||
|
if (ctx->digestsize % 8)
|
||||||
|
le32_to_ptr(digest, (uint32_t)(ctx->state[i]));
|
||||||
|
|
||||||
|
- memset(ctx->partial, 0, ctx->r);
|
||||||
|
+ jent_memset(ctx->partial, 0, ctx->r);
|
||||||
|
sha3_init(ctx);
|
||||||
|
}
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
diff --git a/jitterentropy-base.c b/jitterentropy-base.c
|
|
||||||
index c71e1e7..28b1462 100644
|
|
||||||
--- a/jitterentropy-base.c
|
|
||||||
+++ b/jitterentropy-base.c
|
|
||||||
@@ -754,7 +754,7 @@ int jent_entropy_init(void)
|
|
||||||
* than 1 to ensure the entropy estimation
|
|
||||||
* implied with 1 is preserved
|
|
||||||
*/
|
|
||||||
- if (!(delta_sum) > 1)
|
|
||||||
+ if (!(delta_sum > 1))
|
|
||||||
return EMINVARVAR;
|
|
||||||
|
|
||||||
/*
|
|
@ -1,31 +0,0 @@
|
|||||||
--- a/jitterentropy.h.orig
|
|
||||||
+++ b/jitterentropy.h
|
|
||||||
@@ -42,11 +42,19 @@
|
|
||||||
#ifndef _JITTERENTROPY_H
|
|
||||||
#define _JITTERENTROPY_H
|
|
||||||
|
|
||||||
+#ifdef JITTERENTROPY_GENODE
|
|
||||||
+#include <jitterentropy-base-genode.h>
|
|
||||||
+#else
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
#include "jitterentropy-base-kernel.h"
|
|
||||||
#else
|
|
||||||
#include "jitterentropy-base-user.h"
|
|
||||||
#endif /* __KERNEL__ */
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+#ifdef __cplusplus
|
|
||||||
+extern "C" {
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
/* Statistical data from the entropy source */
|
|
||||||
struct entropy_stat {
|
|
||||||
@@ -171,4 +179,8 @@
|
|
||||||
|
|
||||||
/* -- END of statistical test function -- */
|
|
||||||
|
|
||||||
+#ifdef __cplusplus
|
|
||||||
+}
|
|
||||||
+#endif /* extern "C" */
|
|
||||||
+
|
|
||||||
#endif /* _JITTERENTROPY_H */
|
|
@ -1,13 +0,0 @@
|
|||||||
diff --git a/jitterentropy-base.c b/jitterentropy-base.c
|
|
||||||
index 28b1462..3ea4c90 100644
|
|
||||||
--- a/jitterentropy-base.c
|
|
||||||
+++ b/jitterentropy-base.c
|
|
||||||
@@ -553,7 +553,7 @@ ssize_t jent_read_entropy(struct rand_data *ec, char *data, size_t len)
|
|
||||||
tocopy = (DATA_SIZE_BITS / 8);
|
|
||||||
else
|
|
||||||
tocopy = len;
|
|
||||||
- memcpy(p, &ec->data, tocopy);
|
|
||||||
+ jent_memcpy(p, &ec->data, tocopy);
|
|
||||||
|
|
||||||
len -= tocopy;
|
|
||||||
p += tocopy;
|
|
@ -17,7 +17,7 @@
|
|||||||
static inline void jent_get_nstime(__u64 *out)
|
static inline void jent_get_nstime(__u64 *out)
|
||||||
{
|
{
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
asm volatile("mrc p15, 0, %0, c15, c12, 1" : "=r"(t));
|
asm volatile ("mrc p15, 0, %0, c15, c12, 1" : "=r"(t));
|
||||||
*out = t;
|
*out = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
static inline void jent_get_nstime(__u64 *out)
|
static inline void jent_get_nstime(__u64 *out)
|
||||||
{
|
{
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(t));
|
asm volatile ("mrc p15, 0, %0, c9, c13, 0" : "=r"(t));
|
||||||
*out = t;
|
*out = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ static inline void jent_get_nstime(__u64 *out)
|
|||||||
{
|
{
|
||||||
uint64_t t;
|
uint64_t t;
|
||||||
/* cycle counter */
|
/* cycle counter */
|
||||||
asm volatile("mrs %0, pmccntr_el0" : "=r" (t));
|
asm volatile ("mrs %0, pmccntr_el0" : "=r" (t));
|
||||||
*out = t;
|
*out = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
static inline void jent_get_nstime(__u64 *out)
|
static inline void jent_get_nstime(__u64 *out)
|
||||||
{
|
{
|
||||||
uint64_t t;
|
uint64_t t;
|
||||||
__asm__ __volatile__ ( "rdtsc" : "=A" (t));
|
asm volatile ( "rdtsc" : "=A" (t));
|
||||||
*out = t;
|
*out = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _JITTERENTROPY_X86_32_BASE_GENODE_NSTIME_H */
|
#endif /* _JITTERENTROPY_X86_32_BASE_GENODE_NSTIME_H */
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
static inline void jent_get_nstime(__u64 *out)
|
static inline void jent_get_nstime(__u64 *out)
|
||||||
{
|
{
|
||||||
uint32_t lo, hi;
|
uint32_t lo, hi;
|
||||||
__asm__ __volatile__ ( "rdtsc" : "=a" (lo), "=d" (hi));
|
asm volatile ( "rdtsc" : "=a" (lo), "=d" (hi));
|
||||||
*out = (uint64_t)hi << 32 | lo;
|
*out = (uint64_t)hi << 32 | lo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user