aboutsummaryrefslogtreecommitdiffstats
path: root/checks
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-13 20:53:31 +0000
committerlloyd <[email protected]>2010-09-13 20:53:31 +0000
commit4fe8a34f1869805d9115f39cad53d1fd7f7eb6c4 (patch)
tree2ff6c30d1a7d5f2244b6f1b459a5ea10b6d43fe0 /checks
parent36bfef27271eadffefbc6891a9d7fa7eed7b1e10 (diff)
Remove more uses of vector to pointer implicit conversions
Diffstat (limited to 'checks')
-rw-r--r--checks/dolook.cpp8
-rw-r--r--checks/ec_tests.cpp6
-rw-r--r--checks/pk.cpp18
-rw-r--r--checks/pk_bench.cpp3
-rw-r--r--checks/validate.cpp4
5 files changed, 15 insertions, 24 deletions
diff --git a/checks/dolook.cpp b/checks/dolook.cpp
index 92f7381c2..09c3d5987 100644
--- a/checks/dolook.cpp
+++ b/checks/dolook.cpp
@@ -115,9 +115,7 @@ class KDF_Filter : public Filter
{ secret.append(in, len); }
void end_msg()
{
- SymmetricKey x = kdf->derive_key(outlen,
- secret, secret.size(),
- salt, salt.size());
+ SymmetricKey x = kdf->derive_key(outlen, secret, salt);
send(x.bits_of(), x.length());
}
KDF_Filter(KDF* algo, const SymmetricKey& s, u32bit o)
@@ -154,9 +152,7 @@ void RNG_Filter::write(const byte[], u32bit length)
{
if(length)
{
- SecureVector<byte> out(length);
- rng->randomize(out, out.size());
- send(out);
+ send(rng->random_vec(length));
}
}
diff --git a/checks/ec_tests.cpp b/checks/ec_tests.cpp
index 1f31cb2cf..979414ed4 100644
--- a/checks/ec_tests.cpp
+++ b/checks/ec_tests.cpp
@@ -644,11 +644,7 @@ void test_gfp_store_restore()
//store point (to std::string)
SecureVector<byte> sv_mes = EC2OSP(p, PointGFp::COMPRESSED);
- std::string storrage = hex_encode(sv_mes, sv_mes.size());
-
- // restore point (from std::string)
- SecureVector<byte> sv_new_point = hex_decode(storrage);
- PointGFp new_p = OS2ECP(sv_new_point, dom_pars.get_curve());
+ PointGFp new_p = OS2ECP(sv_mes, dom_pars.get_curve());
CHECK_MESSAGE( p == new_p, "original and restored point are different!");
}
diff --git a/checks/pk.cpp b/checks/pk.cpp
index 0d06e0983..eb93cc531 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -178,7 +178,7 @@ void validate_signature(PK_Verifier& v, PK_Signer& s, const std::string& algo,
SecureVector<byte> expected = hex_decode(exp);
- SecureVector<byte> sig = s.sign_message(message, message.size(), rng);
+ SecureVector<byte> sig = s.sign_message(message, rng);
if(sig != expected)
{
@@ -187,7 +187,7 @@ void validate_signature(PK_Verifier& v, PK_Signer& s, const std::string& algo,
failure = true;
}
- if(!v.verify_message(message, message.size(), sig, sig.size()))
+ if(!v.verify_message(message, sig))
{
std::cout << "FAILED (verify): " << algo << std::endl;
failure = true;
@@ -196,7 +196,7 @@ void validate_signature(PK_Verifier& v, PK_Signer& s, const std::string& algo,
/* This isn't a very thorough testing method, but it will hopefully
catch any really horrible errors */
sig[0]++;
- if(v.verify_message(message, message.size(), sig, sig.size()))
+ if(v.verify_message(message, sig))
{
std::cout << "FAILED (accepted bad sig): " << algo << std::endl;
failure = true;
@@ -220,7 +220,7 @@ void validate_kas(PK_Key_Agreement& kas, const std::string& algo,
SecureVector<byte> expected = hex_decode(output);
SecureVector<byte> got = kas.derive_key(keylen,
- pubkey, pubkey.size()).bits_of();
+ pubkey).bits_of();
if(got != expected)
{
@@ -371,7 +371,7 @@ u32bit validate_rsa_ver(const std::string& algo,
SecureVector<byte> sig = hex_decode(str[3]);
bool passed = true;
- passed = v.verify_message(msg, msg.size(), sig, sig.size());
+ passed = v.verify_message(msg, sig);
return (passed ? 0 : 1);
#endif
@@ -402,7 +402,7 @@ u32bit validate_rsa_ver_x509(const std::string& algo,
SecureVector<byte> msg = hex_decode(str[1]);
SecureVector<byte> sig = hex_decode(str[2]);
- bool passed = v.verify_message(msg, msg.size(), sig, sig.size());
+ bool passed = v.verify_message(msg, sig);
return (passed ? 0 : 1);
#endif
@@ -427,7 +427,7 @@ u32bit validate_rw_ver(const std::string& algo,
SecureVector<byte> sig = hex_decode(str[3]);
bool passed = true;
- passed = v.verify_message(msg, msg.size(), sig, sig.size());
+ passed = v.verify_message(msg, sig);
return (passed ? 0 : 1);
#endif
@@ -542,7 +542,7 @@ u32bit validate_gost_ver(const std::string& algo,
SecureVector<byte> msg = hex_decode(str[2]);
SecureVector<byte> sig = hex_decode(str[3]);
- bool passed = v.verify_message(msg, msg.size(), sig, sig.size());
+ bool passed = v.verify_message(msg, sig);
return (passed ? 0 : 1);
#endif
@@ -575,7 +575,7 @@ u32bit validate_dsa_ver(const std::string& algo,
SecureVector<byte> sig = hex_decode(str[2]);
v.set_input_format(DER_SEQUENCE);
- bool passed = v.verify_message(msg, msg.size(), sig, sig.size());
+ bool passed = v.verify_message(msg, sig);
return (passed ? 0 : 1);
#endif
diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp
index 41108d9ac..2eb87dfeb 100644
--- a/checks/pk_bench.cpp
+++ b/checks/pk_bench.cpp
@@ -162,8 +162,7 @@ void benchmark_sig_ver(PK_Verifier& ver, PK_Signer& sig,
if((i % 100) == 0)
{
- sig_random.resize(signature.size());
- rng.randomize(sig_random, sig_random.size());
+ sig_random = rng.random_vec(signature.size());
verify_timer.start();
bool verified2 = ver.verify_message(message, sig_random);
diff --git a/checks/validate.cpp b/checks/validate.cpp
index 9f6bc44ce..3c7aeeb22 100644
--- a/checks/validate.cpp
+++ b/checks/validate.cpp
@@ -346,7 +346,7 @@ bool failed_test(const std::string& algo,
pipe.append(new Botan::Hex_Encoder);
Botan::SecureVector<byte> data = Botan::hex_decode(in);
- const byte* data_ptr = data;
+ const byte* data_ptr = &data[0];
// this can help catch errors with buffering, etc
u32bit len = data.size();
@@ -394,7 +394,7 @@ bool failed_test(const std::string& algo,
u32bit length = random_word(rng, pipe.remaining() - offset);
Botan::SecureVector<byte> peekbuf(length);
- pipe.peek(peekbuf, length, offset);
+ pipe.peek(&peekbuf[0], peekbuf.size(), offset);
output = pipe.read_all_as_string();