aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-01-08 12:43:06 +0000
committerlloyd <[email protected]>2015-01-08 12:43:06 +0000
commita62473b5f0a893db620d8658d75374a50a67e496 (patch)
tree8d91cc0c700951a2dec445f07aa773fd55474922 /src/lib
parentadfe64da5d35d97cc6eaf084a28cde44aa02664b (diff)
Cleanup
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/pubkey/mce/mceliece_key.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/pubkey/mce/mceliece_key.cpp b/src/lib/pubkey/mce/mceliece_key.cpp
index 2b4a277ad..15fba67e2 100644
--- a/src/lib/pubkey/mce/mceliece_key.cpp
+++ b/src/lib/pubkey/mce/mceliece_key.cpp
@@ -135,19 +135,17 @@ secure_vector<byte> McEliece_PrivateKey::pkcs8_private_key() const
bool McEliece_PrivateKey::check_key(RandomNumberGenerator& rng, bool) const
{
- const McEliece_PublicKey* p_pk = dynamic_cast<const McEliece_PublicKey*>(this);
-
McEliece_Private_Operation priv_op(*this);
- McEliece_Public_Operation pub_op(*p_pk, p_pk->get_code_length() );
+ McEliece_Public_Operation pub_op(*this, get_code_length());
- secure_vector<byte> plaintext((p_pk->get_message_word_bit_length()+7)/8);
+ secure_vector<byte> plaintext((this->get_message_word_bit_length()+7)/8);
rng.randomize(&plaintext[0], plaintext.size() - 1);
- secure_vector<gf2m> err_pos = create_random_error_positions(p_pk->get_code_length(), p_pk->get_t(), rng);
+ const secure_vector<gf2m> err_pos = create_random_error_positions(this->get_code_length(), this->get_t(), rng);
- mceliece_message_parts parts(err_pos, plaintext, p_pk->get_code_length());
+ mceliece_message_parts parts(err_pos, plaintext, this->get_code_length());
secure_vector<byte> message_and_error_input = parts.get_concat();
secure_vector<byte> ciphertext = pub_op.encrypt(&message_and_error_input[0], message_and_error_input.size(), rng);
- secure_vector<byte> message_and_error_output = priv_op.decrypt(&ciphertext[0], ciphertext.size() );
+ secure_vector<byte> message_and_error_output = priv_op.decrypt(&ciphertext[0], ciphertext.size());
return (message_and_error_input == message_and_error_output);
}