From b6cc9a4084caf6d9d4b955fadc321f6521f2b36e Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 23 Jan 2015 17:09:54 +0000 Subject: Amalgamation fixes --- src/lib/mac/poly1305/poly1305_donna.h | 10 +--------- src/lib/pubkey/curve25519/donna.cpp | 19 +------------------ src/lib/pubkey/mce/mce_kem.h | 2 +- src/lib/pubkey/mce/mceliece.h | 6 ++---- src/lib/utils/donna128.h | 11 +++++++++++ 5 files changed, 16 insertions(+), 32 deletions(-) (limited to 'src/lib') diff --git a/src/lib/mac/poly1305/poly1305_donna.h b/src/lib/mac/poly1305/poly1305_donna.h index fa190baa5..128d0359b 100644 --- a/src/lib/mac/poly1305/poly1305_donna.h +++ b/src/lib/mac/poly1305/poly1305_donna.h @@ -12,10 +12,7 @@ #include #include - -#if !defined(BOTAN_TARGET_HAS_NATIVE_UINT128) - #include -#endif +#include namespace Botan { @@ -23,11 +20,6 @@ namespace { #if !defined(BOTAN_TARGET_HAS_NATIVE_UINT128) typedef donna128 uint128_t; -#else -inline u64bit carry_shift(const uint128_t a, size_t shift) - { - return static_cast(a >> shift); - } #endif void poly1305_init(secure_vector& X, const byte key[32]) diff --git a/src/lib/pubkey/curve25519/donna.cpp b/src/lib/pubkey/curve25519/donna.cpp index 29d40ce13..8a29e0db9 100644 --- a/src/lib/pubkey/curve25519/donna.cpp +++ b/src/lib/pubkey/curve25519/donna.cpp @@ -29,13 +29,10 @@ #include #include +#include #include #include -#if !defined(BOTAN_TARGET_HAS_NATIVE_UINT128) - #include -#endif - namespace Botan { typedef byte u8; @@ -44,20 +41,6 @@ typedef limb felem[5]; #if !defined(BOTAN_TARGET_HAS_NATIVE_UINT128) typedef donna128 uint128_t; - -#else - -inline u64bit carry_shift(const uint128_t a, size_t shift) - { - return static_cast(a >> shift); - } - -inline u64bit combine_lower(const uint128_t a, size_t s1, - const uint128_t b, size_t s2) - { - return static_cast((a >> s1) | (b << s2)); - } - #endif /* Sum two numbers: output += in */ diff --git a/src/lib/pubkey/mce/mce_kem.h b/src/lib/pubkey/mce/mce_kem.h index 14d5cd678..cbb2fc553 100644 --- a/src/lib/pubkey/mce/mce_kem.h +++ b/src/lib/pubkey/mce/mce_kem.h @@ -52,4 +52,4 @@ class BOTAN_DLL McEliece_KEM_Decryptor }; } -#endif /* h-guard */ +#endif diff --git a/src/lib/pubkey/mce/mceliece.h b/src/lib/pubkey/mce/mceliece.h index b0246ac88..649153233 100644 --- a/src/lib/pubkey/mce/mceliece.h +++ b/src/lib/pubkey/mce/mceliece.h @@ -9,16 +9,14 @@ * */ - +#ifndef BOTAN_MCELIECE_H__ +#define BOTAN_MCELIECE_H__ #include #include #include #include -#ifndef BOTAN_MCELIECE_H__ -#define BOTAN_MCELIECE_H__ - #define MASK_LOG2_BYTE ((1 << 3) - 1) #define _BITP_TO_BYTEP(__bit_pos) (__bit_pos >> 3) #define _BITP_TO_BYTEOFFS(__bit_pos) (__bit_pos & MASK_LOG2_BYTE) diff --git a/src/lib/utils/donna128.h b/src/lib/utils/donna128.h index 2cfeb455f..037d9bdfe 100644 --- a/src/lib/utils/donna128.h +++ b/src/lib/utils/donna128.h @@ -111,6 +111,17 @@ inline u64bit combine_lower(const donna128 a, size_t s1, return z.lo(); } +inline u64bit carry_shift(const uint128_t a, size_t shift) + { + return static_cast(a >> shift); + } + +inline u64bit combine_lower(const uint128_t a, size_t s1, + const uint128_t b, size_t s2) + { + return static_cast((a >> s1) | (b << s2)); + } + } #endif -- cgit v1.2.3