aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-02-02 10:49:43 +0000
committerlloyd <[email protected]>2010-02-02 10:49:43 +0000
commit7667619fa001b4b9dd9df663fc01fa7c31e5f4f9 (patch)
treed5e20f6b94478df76893755adb54c66ae6276abf /src
parentcf3e984dbffc0fb2a695306a9b4d53257bb74ea8 (diff)
Move the get_byte template to its own header, because many files
including loadstor.h actually just needed get_byte and nothing else.
Diffstat (limited to 'src')
-rw-r--r--src/asn1/ber_dec.cpp2
-rw-r--r--src/asn1/der_enc.cpp4
-rw-r--r--src/checksum/crc24/crc24.cpp2
-rw-r--r--src/constructs/aont/package.cpp2
-rw-r--r--src/constructs/cryptobox/cryptobox.cpp2
-rw-r--r--src/constructs/fpe/fpe.cpp2
-rw-r--r--src/hash/md4_ia32/md4_ia32.cpp1
-rw-r--r--src/hash/md5_ia32/md5_ia32.cpp1
-rw-r--r--src/hash/sha1_ia32/sha1_ia32.cpp1
-rw-r--r--src/kdf/kdf2/kdf2.cpp2
-rw-r--r--src/kdf/mgf1/mgf1.cpp2
-rw-r--r--src/math/bigint/bigint.cpp2
-rw-r--r--src/rng/hmac_rng/hmac_rng.cpp2
-rw-r--r--src/rng/randpool/randpool.cpp2
-rw-r--r--src/s2k/pbkdf2/pbkdf2.cpp2
-rw-r--r--src/utils/cpuid.cpp2
-rw-r--r--src/utils/get_byte.h27
-rw-r--r--src/utils/info.txt1
-rw-r--r--src/utils/loadstor.h11
-rw-r--r--src/utils/parsing.cpp2
20 files changed, 44 insertions, 28 deletions
diff --git a/src/asn1/ber_dec.cpp b/src/asn1/ber_dec.cpp
index b34bf8ca2..66a27dd4e 100644
--- a/src/asn1/ber_dec.cpp
+++ b/src/asn1/ber_dec.cpp
@@ -7,7 +7,7 @@
#include <botan/ber_dec.h>
#include <botan/bigint.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
namespace Botan {
diff --git a/src/asn1/der_enc.cpp b/src/asn1/der_enc.cpp
index 3c318c291..e410292bb 100644
--- a/src/asn1/der_enc.cpp
+++ b/src/asn1/der_enc.cpp
@@ -8,9 +8,9 @@
#include <botan/der_enc.h>
#include <botan/asn1_int.h>
#include <botan/bigint.h>
-#include <botan/loadstor.h>
-#include <botan/internal/bit_ops.h>
+#include <botan/get_byte.h>
#include <botan/parsing.h>
+#include <botan/internal/bit_ops.h>
#include <algorithm>
namespace Botan {
diff --git a/src/checksum/crc24/crc24.cpp b/src/checksum/crc24/crc24.cpp
index e50b4d33e..5441020f5 100644
--- a/src/checksum/crc24/crc24.cpp
+++ b/src/checksum/crc24/crc24.cpp
@@ -6,7 +6,7 @@
*/
#include <botan/crc24.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
namespace Botan {
diff --git a/src/constructs/aont/package.cpp b/src/constructs/aont/package.cpp
index 8d2d7257d..5d1e674ca 100644
--- a/src/constructs/aont/package.cpp
+++ b/src/constructs/aont/package.cpp
@@ -9,7 +9,7 @@
#include <botan/package.h>
#include <botan/filters.h>
#include <botan/ctr.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
#include <botan/internal/xor_buf.h>
namespace Botan {
diff --git a/src/constructs/cryptobox/cryptobox.cpp b/src/constructs/cryptobox/cryptobox.cpp
index c862b5c50..371b52e66 100644
--- a/src/constructs/cryptobox/cryptobox.cpp
+++ b/src/constructs/cryptobox/cryptobox.cpp
@@ -13,7 +13,7 @@
#include <botan/hmac.h>
#include <botan/pbkdf2.h>
#include <botan/pem.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
#include <botan/mem_ops.h>
namespace Botan {
diff --git a/src/constructs/fpe/fpe.cpp b/src/constructs/fpe/fpe.cpp
index 86e56625d..a0b3274b5 100644
--- a/src/constructs/fpe/fpe.cpp
+++ b/src/constructs/fpe/fpe.cpp
@@ -12,7 +12,7 @@
#include <botan/numthry.h>
#include <botan/hmac.h>
#include <botan/sha2_32.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
#include <stdexcept>
namespace Botan {
diff --git a/src/hash/md4_ia32/md4_ia32.cpp b/src/hash/md4_ia32/md4_ia32.cpp
index 12fe71da4..8a60d8f0e 100644
--- a/src/hash/md4_ia32/md4_ia32.cpp
+++ b/src/hash/md4_ia32/md4_ia32.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/md4_ia32.h>
-#include <botan/loadstor.h>
namespace Botan {
diff --git a/src/hash/md5_ia32/md5_ia32.cpp b/src/hash/md5_ia32/md5_ia32.cpp
index 443569b3b..affd0b8f7 100644
--- a/src/hash/md5_ia32/md5_ia32.cpp
+++ b/src/hash/md5_ia32/md5_ia32.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/md5_ia32.h>
-#include <botan/loadstor.h>
namespace Botan {
diff --git a/src/hash/sha1_ia32/sha1_ia32.cpp b/src/hash/sha1_ia32/sha1_ia32.cpp
index 0fa0b6bf2..6eecdab56 100644
--- a/src/hash/sha1_ia32/sha1_ia32.cpp
+++ b/src/hash/sha1_ia32/sha1_ia32.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/sha1_ia32.h>
-#include <botan/loadstor.h>
namespace Botan {
diff --git a/src/kdf/kdf2/kdf2.cpp b/src/kdf/kdf2/kdf2.cpp
index 167f64436..7cc1d7416 100644
--- a/src/kdf/kdf2/kdf2.cpp
+++ b/src/kdf/kdf2/kdf2.cpp
@@ -6,7 +6,7 @@
*/
#include <botan/kdf2.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
namespace Botan {
diff --git a/src/kdf/mgf1/mgf1.cpp b/src/kdf/mgf1/mgf1.cpp
index a8c7e5fa3..340e87a7c 100644
--- a/src/kdf/mgf1/mgf1.cpp
+++ b/src/kdf/mgf1/mgf1.cpp
@@ -6,7 +6,7 @@
*/
#include <botan/mgf1.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
#include <botan/exceptn.h>
#include <botan/internal/xor_buf.h>
#include <algorithm>
diff --git a/src/math/bigint/bigint.cpp b/src/math/bigint/bigint.cpp
index 70bb11a83..09ac2a75d 100644
--- a/src/math/bigint/bigint.cpp
+++ b/src/math/bigint/bigint.cpp
@@ -7,7 +7,7 @@
#include <botan/bigint.h>
#include <botan/internal/mp_core.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
#include <botan/parsing.h>
#include <botan/internal/rounding.h>
diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp
index 995ec9259..84a7b1c13 100644
--- a/src/rng/hmac_rng/hmac_rng.cpp
+++ b/src/rng/hmac_rng/hmac_rng.cpp
@@ -6,7 +6,7 @@
*/
#include <botan/hmac_rng.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
#include <botan/internal/xor_buf.h>
#include <botan/internal/stl_util.h>
#include <algorithm>
diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp
index f6479b2dd..9a4d77e55 100644
--- a/src/rng/randpool/randpool.cpp
+++ b/src/rng/randpool/randpool.cpp
@@ -6,7 +6,7 @@
*/
#include <botan/randpool.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
#include <botan/internal/xor_buf.h>
#include <botan/internal/stl_util.h>
#include <algorithm>
diff --git a/src/s2k/pbkdf2/pbkdf2.cpp b/src/s2k/pbkdf2/pbkdf2.cpp
index e7aebbfe2..f1fc6e29f 100644
--- a/src/s2k/pbkdf2/pbkdf2.cpp
+++ b/src/s2k/pbkdf2/pbkdf2.cpp
@@ -6,7 +6,7 @@
*/
#include <botan/pbkdf2.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
#include <botan/internal/xor_buf.h>
namespace Botan {
diff --git a/src/utils/cpuid.cpp b/src/utils/cpuid.cpp
index 924d29b1b..8d801b75f 100644
--- a/src/utils/cpuid.cpp
+++ b/src/utils/cpuid.cpp
@@ -7,7 +7,7 @@
#include <botan/cpuid.h>
#include <botan/types.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
#include <botan/mem_ops.h>
#if defined(BOTAN_TARGET_OS_IS_DARWIN)
diff --git a/src/utils/get_byte.h b/src/utils/get_byte.h
new file mode 100644
index 000000000..fce87af83
--- /dev/null
+++ b/src/utils/get_byte.h
@@ -0,0 +1,27 @@
+/*
+* Read out bytes
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_GET_BYTE_H__
+#define BOTAN_GET_BYTE_H__
+
+#include <botan/types.h>
+
+namespace Botan {
+
+/*
+* Byte Extraction Function
+*/
+template<typename T> inline byte get_byte(u32bit byte_num, T input)
+ {
+ return static_cast<byte>(
+ input >> ((sizeof(T)-1-(byte_num&(sizeof(T)-1))) << 3)
+ );
+ }
+
+}
+
+#endif
diff --git a/src/utils/info.txt b/src/utils/info.txt
index 193d63a87..2fb3e79a5 100644
--- a/src/utils/info.txt
+++ b/src/utils/info.txt
@@ -35,6 +35,7 @@ time.h
types.h
ui.h
version.h
+get_byte.h
</header:public>
<libs>
diff --git a/src/utils/loadstor.h b/src/utils/loadstor.h
index bd2acc87d..ffd27540d 100644
--- a/src/utils/loadstor.h
+++ b/src/utils/loadstor.h
@@ -11,6 +11,7 @@
#include <botan/types.h>
#include <botan/bswap.h>
+#include <botan/get_byte.h>
#include <cstring>
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
@@ -38,16 +39,6 @@
namespace Botan {
/*
-* Byte Extraction Function
-*/
-template<typename T> inline byte get_byte(u32bit byte_num, T input)
- {
- return static_cast<byte>(
- input >> ((sizeof(T)-1-(byte_num&(sizeof(T)-1))) << 3)
- );
- }
-
-/*
* Byte to Word Conversions
*/
inline u16bit make_u16bit(byte i0, byte i1)
diff --git a/src/utils/parsing.cpp b/src/utils/parsing.cpp
index 4b99ac1ec..e8259ac52 100644
--- a/src/utils/parsing.cpp
+++ b/src/utils/parsing.cpp
@@ -8,7 +8,7 @@
#include <botan/parsing.h>
#include <botan/exceptn.h>
#include <botan/charset.h>
-#include <botan/loadstor.h>
+#include <botan/get_byte.h>
namespace Botan {