Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:magist3r:livecd
veracrypt
veracrypt-update-jitterentropy-library.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File veracrypt-update-jitterentropy-library.patch of Package veracrypt
diff -Naur a/src/Crypto/jitterentropy-base-user.h b/src/Crypto/jitterentropy-base-user.h --- a/src/Crypto/jitterentropy-base-user.h 2019-10-27 07:10:18.000000000 -0500 +++ b/src/Crypto/jitterentropy-base-user.h 2019-11-05 14:46:55.948054597 -0600 @@ -1,7 +1,7 @@ /* * Non-physical true random number generator based on timing jitter. * - * Copyright Stephan Mueller <smueller@chronox.de>, 2013 + * Copyright Stephan Mueller <smueller@chronox.de>, 2013 - 2019 * * License * ======= @@ -35,7 +35,7 @@ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - e USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH + * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ @@ -49,8 +49,6 @@ #include <stdlib.h> #include <string.h> -typedef uint64 __u64; - #ifdef _MSC_VER typedef uint64 uint64_t; @@ -70,17 +68,19 @@ #endif #endif -static VC_INLINE void jent_get_nstime(__u64 *out) +static VC_INLINE void jent_get_nstime(uint64 *out) { *out = __rdtsc();; } #else +#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 + /* taken from Linux kernel */ #if CRYPTOPP_BOOL_X64 #define DECLARE_ARGS(val, low, high) unsigned low, high -#define EAX_EDX_VAL(val, low, high) ((low) | ((__u64)(high) << 32)) +#define EAX_EDX_VAL(val, low, high) ((low) | ((uint64)(high) << 32)) #define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high) #else #define DECLARE_ARGS(val, low, high) unsigned long long val @@ -88,13 +88,36 @@ #define EAX_EDX_RET(val, low, high) "=A" (val) #endif -VC_INLINE void jent_get_nstime(__u64 *out) +VC_INLINE void jent_get_nstime(uint64 *out) { DECLARE_ARGS(val, low, high); asm volatile("rdtsc" : EAX_EDX_RET(val, low, high)); *out = EAX_EDX_VAL(val, low, high); } +#else + +#include <time.h> + +VC_INLINE void jent_get_nstime(uint64 *out) +{ + /* we could use CLOCK_MONOTONIC(_RAW), but with CLOCK_REALTIME + * we get some nice extra entropy once in a while from the NTP actions + * that we want to use as well... though, we do not rely on that + * extra little entropy */ + uint64_t tmp = 0; + struct timespec time; + if (clock_gettime(CLOCK_REALTIME, &time) == 0) + { + tmp = time.tv_sec; + tmp = tmp << 32; + tmp = tmp | time.tv_nsec; + } + *out = tmp; +} + +#endif + #endif #ifdef _MSC_VER
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor