aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-07-09 16:43:21 +0000
committerlloyd <[email protected]>2012-07-09 16:43:21 +0000
commita73ace1185febb9a9dfa9e6ba93c883beedbd938 (patch)
tree73170167ab016e9af2346921aa9da2afd5ed25b2 /src/pubkey
parent4e43080954be57e362feb1cc8202bfd42117e286 (diff)
The messages for assertion checks were done both ways, both "assertion
X is true" and "assertion X is false". Convert all of them to the form "assertion X is true" thus making it clear what it is that we are attempting to assert by testing the expression provided.
Diffstat (limited to 'src/pubkey')
-rw-r--r--src/pubkey/dl_group/dl_group.cpp2
-rw-r--r--src/pubkey/ecc_key/ecc_key.cpp5
-rw-r--r--src/pubkey/ecdh/ecdh.cpp2
-rw-r--r--src/pubkey/gost_3410/gost_3410.cpp4
-rw-r--r--src/pubkey/pubkey.cpp3
-rw-r--r--src/pubkey/rsa/rsa.cpp2
6 files changed, 9 insertions, 9 deletions
diff --git a/src/pubkey/dl_group/dl_group.cpp b/src/pubkey/dl_group/dl_group.cpp
index cf89abc8d..a6bea3bbc 100644
--- a/src/pubkey/dl_group/dl_group.cpp
+++ b/src/pubkey/dl_group/dl_group.cpp
@@ -322,7 +322,7 @@ BigInt DL_Group::make_dsa_generator(const BigInt& p, const BigInt& q)
{
BigInt g, e = (p - 1) / q;
- BOTAN_ASSERT(e > 0, "q does not divide p, invalid group");
+ BOTAN_ASSERT(e > 0, "q divides p-1");
for(size_t i = 0; i != PRIME_TABLE_SIZE; ++i)
{
diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp
index 2b6deea44..367b27584 100644
--- a/src/pubkey/ecc_key/ecc_key.cpp
+++ b/src/pubkey/ecc_key/ecc_key.cpp
@@ -93,7 +93,7 @@ EC_PrivateKey::EC_PrivateKey(RandomNumberGenerator& rng,
public_key = domain().get_base_point() * private_key;
BOTAN_ASSERT(public_key.on_the_curve(),
- "ECC private key was not on the curve");
+ "Generated public key point was on the curve");
}
secure_vector<byte> EC_PrivateKey::pkcs8_private_key() const
@@ -130,8 +130,9 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id,
if(public_key_bits.empty())
{
public_key = domain().get_base_point() * private_key;
+
BOTAN_ASSERT(public_key.on_the_curve(),
- "Public key derived from private key was on the curve");
+ "Public point derived from loaded key was on the curve");
}
else
{
diff --git a/src/pubkey/ecdh/ecdh.cpp b/src/pubkey/ecdh/ecdh.cpp
index 511dd0678..5a42f4a49 100644
--- a/src/pubkey/ecdh/ecdh.cpp
+++ b/src/pubkey/ecdh/ecdh.cpp
@@ -27,7 +27,7 @@ secure_vector<byte> ECDH_KA_Operation::agree(const byte w[], size_t w_len)
PointGFp S = (cofactor * point) * l_times_priv;
BOTAN_ASSERT(S.on_the_curve(),
- "ECDH agreed value not on the curve");
+ "ECDH agreed value was on the curve");
return BigInt::encode_1363(S.get_affine_x(),
curve.get_p().bytes());
diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp
index 289cdcac4..19287d2cf 100644
--- a/src/pubkey/gost_3410/gost_3410.cpp
+++ b/src/pubkey/gost_3410/gost_3410.cpp
@@ -76,7 +76,7 @@ GOST_3410_PublicKey::GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id,
public_key = PointGFp(domain().get_curve(), x, y);
BOTAN_ASSERT(public_key.on_the_curve(),
- "Loaded GOST 34.10 public key not on the curve");
+ "Loaded GOST 34.10 public key is on the curve");
}
namespace {
@@ -120,7 +120,7 @@ GOST_3410_Signature_Operation::sign(const byte msg[], size_t msg_len,
PointGFp k_times_P = base_point * k;
BOTAN_ASSERT(k_times_P.on_the_curve(),
- "GOST 34.10 k*g not on the curve");
+ "GOST 34.10 k*g is on the curve");
BigInt r = k_times_P.get_affine_x() % order;
diff --git a/src/pubkey/pubkey.cpp b/src/pubkey/pubkey.cpp
index c27cf4a05..8430e2c7b 100644
--- a/src/pubkey/pubkey.cpp
+++ b/src/pubkey/pubkey.cpp
@@ -214,8 +214,7 @@ std::vector<byte> PK_Signer::signature(RandomNumberGenerator& rng)
std::vector<byte> plain_sig = unlock(op->sign(&encoded[0], encoded.size(), rng));
- BOTAN_ASSERT(self_test_signature(encoded, plain_sig),
- "PK_Signer consistency check failed");
+ BOTAN_ASSERT(self_test_signature(encoded, plain_sig), "Signature was consistent");
if(op->message_parts() == 1 || sig_format == IEEE_1363)
return plain_sig;
diff --git a/src/pubkey/rsa/rsa.cpp b/src/pubkey/rsa/rsa.cpp
index 8b121f013..48243c9f9 100644
--- a/src/pubkey/rsa/rsa.cpp
+++ b/src/pubkey/rsa/rsa.cpp
@@ -112,7 +112,7 @@ RSA_Private_Operation::decrypt(const byte msg[], size_t msg_len)
BigInt x = blinder.unblind(private_op(blinder.blind(m)));
BOTAN_ASSERT(m == powermod_e_n(x),
- "RSA private op failed consistency check");
+ "RSA decrypt passed consistency check");
return BigInt::encode_locked(x);
}