From a62473b5f0a893db620d8658d75374a50a67e496 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 8 Jan 2015 12:43:06 +0000 Subject: Cleanup --- src/lib/pubkey/mce/mceliece_key.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/lib') 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 McEliece_PrivateKey::pkcs8_private_key() const bool McEliece_PrivateKey::check_key(RandomNumberGenerator& rng, bool) const { - const McEliece_PublicKey* p_pk = dynamic_cast(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 plaintext((p_pk->get_message_word_bit_length()+7)/8); + secure_vector plaintext((this->get_message_word_bit_length()+7)/8); rng.randomize(&plaintext[0], plaintext.size() - 1); - secure_vector err_pos = create_random_error_positions(p_pk->get_code_length(), p_pk->get_t(), rng); + const secure_vector 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 message_and_error_input = parts.get_concat(); secure_vector ciphertext = pub_op.encrypt(&message_and_error_input[0], message_and_error_input.size(), rng); - secure_vector message_and_error_output = priv_op.decrypt(&ciphertext[0], ciphertext.size() ); + secure_vector message_and_error_output = priv_op.decrypt(&ciphertext[0], ciphertext.size()); return (message_and_error_input == message_and_error_output); } -- cgit v1.2.3