aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/block/serpent_ia32/info.txt3
-rw-r--r--src/engine/amd64_eng/info.txt6
-rw-r--r--src/engine/ia32_eng/info.txt6
-rw-r--r--src/engine/sse2_eng/info.txt2
-rw-r--r--src/entropy/entropy_src.h2
-rw-r--r--src/hash/md4_ia32/info.txt1
-rw-r--r--src/hash/md5_ia32/info.txt1
-rw-r--r--src/hash/sha1_amd64/info.txt3
-rw-r--r--src/hash/sha1_ia32/info.txt3
-rw-r--r--src/hash/sha1_sse2/info.txt1
-rw-r--r--src/hash/skein/skein_512.cpp3
-rw-r--r--src/math/gfpmath/curve_gfp.cpp1
-rw-r--r--src/math/gfpmath/curve_gfp.h2
-rw-r--r--src/math/gfpmath/gfp_element.cpp1
-rw-r--r--src/math/gfpmath/gfp_element.h2
-rw-r--r--src/math/numbertheory/make_prm.cpp6
-rw-r--r--src/math/numbertheory/numthry.cpp39
-rw-r--r--src/math/numbertheory/ressol.cpp2
-rw-r--r--src/utils/scan_name.cpp2
19 files changed, 45 insertions, 41 deletions
diff --git a/src/block/serpent_ia32/info.txt b/src/block/serpent_ia32/info.txt
index d6a29229d..8aca9b2ba 100644
--- a/src/block/serpent_ia32/info.txt
+++ b/src/block/serpent_ia32/info.txt
@@ -2,7 +2,7 @@ realname "Serpent (IA-32)"
define SERPENT_IA32
-load_on auto
+load_on asm_ok
<add>
serp_ia32_imp.S
@@ -11,6 +11,7 @@ serp_ia32.h
</add>
<requires>
+ia32_eng
asm_ia32
utils
</requires>
diff --git a/src/engine/amd64_eng/info.txt b/src/engine/amd64_eng/info.txt
index 1d0283ad6..47f891445 100644
--- a/src/engine/amd64_eng/info.txt
+++ b/src/engine/amd64_eng/info.txt
@@ -2,13 +2,9 @@ realname "AMD64 Assembler Engine"
define ENGINE_AMD64_ASSEMBLER
-load_on auto
+load_on dep
<add>
eng_amd64.cpp
eng_amd64.h
</add>
-
-<arch>
-amd64
-</arch>
diff --git a/src/engine/ia32_eng/info.txt b/src/engine/ia32_eng/info.txt
index b9e3bddd5..3bf2a7f2b 100644
--- a/src/engine/ia32_eng/info.txt
+++ b/src/engine/ia32_eng/info.txt
@@ -2,13 +2,9 @@ realname "IA32 Assembler Engine"
define ENGINE_IA32_ASSEMBLER
-load_on auto
+load_on dep
<add>
eng_ia32.cpp
eng_ia32.h
</add>
-
-<arch>
-ia32
-</arch>
diff --git a/src/engine/sse2_eng/info.txt b/src/engine/sse2_eng/info.txt
index c44180ca4..6242c7fee 100644
--- a/src/engine/sse2_eng/info.txt
+++ b/src/engine/sse2_eng/info.txt
@@ -2,7 +2,7 @@ realname "SSE2 Assembler Engine"
define ENGINE_SSE2_ASSEMBLER
-load_on auto
+load_on dep
<add>
eng_sse2.cpp
diff --git a/src/entropy/entropy_src.h b/src/entropy/entropy_src.h
index 78e07a7a5..a1a53fafb 100644
--- a/src/entropy/entropy_src.h
+++ b/src/entropy/entropy_src.h
@@ -41,7 +41,7 @@ class Entropy_Accumulator
{
if(collected_bits >= entropy_goal)
return 0;
- return (entropy_goal - collected_bits);
+ return static_cast<u32bit>(entropy_goal - collected_bits);
}
void add(const void* bytes, u32bit length, double entropy_bits_per_byte)
diff --git a/src/hash/md4_ia32/info.txt b/src/hash/md4_ia32/info.txt
index b2ad76ca3..e7249ad5f 100644
--- a/src/hash/md4_ia32/info.txt
+++ b/src/hash/md4_ia32/info.txt
@@ -11,6 +11,7 @@ md4_ia32.h
</add>
<requires>
+ia32_eng
asm_ia32
md4
</requires>
diff --git a/src/hash/md5_ia32/info.txt b/src/hash/md5_ia32/info.txt
index 652b50a16..7133e1ddd 100644
--- a/src/hash/md5_ia32/info.txt
+++ b/src/hash/md5_ia32/info.txt
@@ -11,6 +11,7 @@ md5_ia32.h
</add>
<requires>
+ia32_eng
asm_ia32
mdx_hash
utils
diff --git a/src/hash/sha1_amd64/info.txt b/src/hash/sha1_amd64/info.txt
index ad473369a..662d60c69 100644
--- a/src/hash/sha1_amd64/info.txt
+++ b/src/hash/sha1_amd64/info.txt
@@ -2,7 +2,7 @@ realname "SHA-1 (x86-64 assembler)"
define SHA1_AMD64
-load_on auto
+load_on asm_ok
<add>
sha1_amd64_imp.S
@@ -11,6 +11,7 @@ sha1_amd64.h
</add>
<requires>
+amd64_eng
asm_amd64
sha1
utils
diff --git a/src/hash/sha1_ia32/info.txt b/src/hash/sha1_ia32/info.txt
index 45903f2d6..8c333dc57 100644
--- a/src/hash/sha1_ia32/info.txt
+++ b/src/hash/sha1_ia32/info.txt
@@ -2,7 +2,7 @@ realname "SHA-1 (IA-32)"
define SHA1_IA32
-load_on auto
+load_on asm_ok
<add>
sha1_ia32_imp.S
@@ -11,6 +11,7 @@ sha1_ia32.h
</add>
<requires>
+ia32_eng
asm_ia32
sha1
utils
diff --git a/src/hash/sha1_sse2/info.txt b/src/hash/sha1_sse2/info.txt
index ac3a98c9f..e33bb1859 100644
--- a/src/hash/sha1_sse2/info.txt
+++ b/src/hash/sha1_sse2/info.txt
@@ -11,6 +11,7 @@ sha1_sse2.h
</add>
<requires>
+sse2_eng
sha1
utils
</requires>
diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp
index eaef641ed..51eef262c 100644
--- a/src/hash/skein/skein_512.cpp
+++ b/src/hash/skein/skein_512.cpp
@@ -193,6 +193,9 @@ void Skein_512::clear() throw()
void Skein_512::add_data(const byte input[], u32bit length)
{
+ if(length == 0)
+ return;
+
if(buf_pos)
{
buffer.copy(buf_pos, input, length);
diff --git a/src/math/gfpmath/curve_gfp.cpp b/src/math/gfpmath/curve_gfp.cpp
index 54799a076..7536318d9 100644
--- a/src/math/gfpmath/curve_gfp.cpp
+++ b/src/math/gfpmath/curve_gfp.cpp
@@ -10,6 +10,7 @@
#include <botan/curve_gfp.h>
#include <botan/bigint.h>
#include <assert.h>
+#include <ostream>
namespace Botan {
diff --git a/src/math/gfpmath/curve_gfp.h b/src/math/gfpmath/curve_gfp.h
index 2c9201560..eab8a57da 100644
--- a/src/math/gfpmath/curve_gfp.h
+++ b/src/math/gfpmath/curve_gfp.h
@@ -14,7 +14,7 @@
#include <botan/bigint.h>
#include <botan/gfp_element.h>
-#include <iostream>
+#include <iosfwd>
namespace Botan {
diff --git a/src/math/gfpmath/gfp_element.cpp b/src/math/gfpmath/gfp_element.cpp
index 7d7b7f34d..932ec274e 100644
--- a/src/math/gfpmath/gfp_element.cpp
+++ b/src/math/gfpmath/gfp_element.cpp
@@ -16,6 +16,7 @@
#include <botan/mp_asm.h>
#include <botan/mp_asmi.h>
#include <assert.h>
+#include <ostream>
namespace Botan {
diff --git a/src/math/gfpmath/gfp_element.h b/src/math/gfpmath/gfp_element.h
index 1ee0be0ba..d9e60f41d 100644
--- a/src/math/gfpmath/gfp_element.h
+++ b/src/math/gfpmath/gfp_element.h
@@ -14,7 +14,7 @@
#include <botan/bigint.h>
#include <botan/gfp_modulus.h>
-#include <iostream>
+#include <iosfwd>
#include <memory>
namespace Botan {
diff --git a/src/math/numbertheory/make_prm.cpp b/src/math/numbertheory/make_prm.cpp
index 226f0c38f..b136b6d25 100644
--- a/src/math/numbertheory/make_prm.cpp
+++ b/src/math/numbertheory/make_prm.cpp
@@ -22,11 +22,11 @@ BigInt random_prime(RandomNumberGenerator& rng,
throw Invalid_Argument("random_prime: Can't make a prime of " +
to_string(bits) + " bits");
else if(bits == 2)
- return ((rng.next_byte() % 1) ? 2 : 3);
+ return ((rng.next_byte() % 2) ? 2 : 3);
else if(bits == 3)
- return ((rng.next_byte() % 1) ? 5 : 7);
+ return ((rng.next_byte() % 2) ? 5 : 7);
else if(bits == 4)
- return ((rng.next_byte() % 1) ? 11 : 13);
+ return ((rng.next_byte() % 2) ? 11 : 13);
if(coprime <= 0)
throw Invalid_Argument("random_prime: coprime must be > 0");
diff --git a/src/math/numbertheory/numthry.cpp b/src/math/numbertheory/numthry.cpp
index d634ca88c..448681333 100644
--- a/src/math/numbertheory/numthry.cpp
+++ b/src/math/numbertheory/numthry.cpp
@@ -1,6 +1,6 @@
/*
-* Number Theory
-* (C) 1999-2008 Jack Lloyd
+* Number Theory Functions
+* (C) 1999-2009 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -56,14 +56,14 @@ u32bit miller_rabin_test_iterations(u32bit bits, bool verify)
{ 0, 0, 0 }
};
- for(u32bit j = 0; tests[j].bits; ++j)
+ for(u32bit i = 0; tests[i].bits; ++i)
{
- if(bits <= tests[j].bits)
+ if(bits <= tests[i].bits)
{
if(verify)
- return tests[j].verify_iter;
+ return tests[i].verify_iter;
else
- return tests[j].check_iter;
+ return tests[i].check_iter;
}
}
return 2;
@@ -154,7 +154,7 @@ BigInt inverse_mod(const BigInt& n, const BigInt& mod)
{
u32bit zero_bits = low_zero_bits(u);
u >>= zero_bits;
- for(u32bit j = 0; j != zero_bits; ++j)
+ for(u32bit i = 0; i != zero_bits; ++i)
{
if(A.is_odd() || B.is_odd())
{ A += y; B -= x; }
@@ -163,7 +163,7 @@ BigInt inverse_mod(const BigInt& n, const BigInt& mod)
zero_bits = low_zero_bits(v);
v >>= zero_bits;
- for(u32bit j = 0; j != zero_bits; ++j)
+ for(u32bit i = 0; i != zero_bits; ++i)
{
if(C.is_odd() || D.is_odd())
{ C += y; D -= x; }
@@ -209,17 +209,17 @@ s32bit simple_primality_tests(const BigInt& n)
if(n <= PRIMES[PRIME_TABLE_SIZE-1])
{
const word num = n.word_at(0);
- for(u32bit j = 0; PRIMES[j]; ++j)
+ for(u32bit i = 0; PRIMES[i]; ++i)
{
- if(num == PRIMES[j]) return PRIME;
- if(num < PRIMES[j]) return NOT_PRIME;
+ if(num == PRIMES[i]) return PRIME;
+ if(num < PRIMES[i]) return NOT_PRIME;
}
return NOT_PRIME;
}
u32bit check_first = std::min(n.bits() / 32, PRIME_PRODUCTS_TABLE_SIZE);
- for(u32bit j = 0; j != check_first; ++j)
- if(gcd(n, PRIME_PRODUCTS[j]) != 1)
+ for(u32bit i = 0; i != check_first; ++i)
+ if(gcd(n, PRIME_PRODUCTS[i]) != 1)
return NOT_PRIME;
return UNKNOWN;
@@ -286,10 +286,15 @@ bool passes_mr_tests(RandomNumberGenerator& rng,
u32bit tests = miller_rabin_test_iterations(n.bits(), verify);
BigInt nonce;
- for(u32bit j = 0; j != tests; ++j)
+ for(u32bit i = 0; i != tests; ++i)
{
- if(verify) nonce.randomize(rng, NONCE_BITS);
- else nonce = PRIMES[j];
+ if(!verify && PRIMES[i] < (n-1))
+ nonce = PRIMES[i];
+ else
+ {
+ while(nonce < 2 || nonce >= (n-1))
+ nonce.randomize(rng, NONCE_BITS);
+ }
if(!mr.passes_test(nonce))
return false;
@@ -309,7 +314,7 @@ bool MillerRabin_Test::passes_test(const BigInt& a)
if(y == 1 || y == n_minus_1)
return true;
- for(u32bit j = 1; j != s; ++j)
+ for(u32bit i = 1; i != s; ++i)
{
y = reducer.square(y);
diff --git a/src/math/numbertheory/ressol.cpp b/src/math/numbertheory/ressol.cpp
index 6a078726d..d51acb8bd 100644
--- a/src/math/numbertheory/ressol.cpp
+++ b/src/math/numbertheory/ressol.cpp
@@ -9,8 +9,6 @@
#include <botan/numthry.h>
#include <botan/reducer.h>
-#include <iostream>
-
namespace Botan {
/*
diff --git a/src/utils/scan_name.cpp b/src/utils/scan_name.cpp
index 92fded3c4..4ca6e6d59 100644
--- a/src/utils/scan_name.cpp
+++ b/src/utils/scan_name.cpp
@@ -11,8 +11,6 @@ SCAN Name Abstraction
#include <botan/exceptn.h>
#include <stdexcept>
-#include <iostream>
-
namespace Botan {
namespace {