diff options
Diffstat (limited to 'src/pubkey')
-rw-r--r-- | src/pubkey/elgamal/elgamal.cpp | 4 | ||||
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.cpp | 14 | ||||
-rw-r--r-- | src/pubkey/pubkey.cpp | 10 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/pubkey/elgamal/elgamal.cpp b/src/pubkey/elgamal/elgamal.cpp index a264d209b..58336b1b1 100644 --- a/src/pubkey/elgamal/elgamal.cpp +++ b/src/pubkey/elgamal/elgamal.cpp @@ -93,8 +93,8 @@ ElGamal_Encryption_Operation::encrypt(const byte msg[], u32bit msg_len, BigInt b = mod_p.multiply(m, powermod_y_p(k)); SecureVector<byte> output(2*p.bytes()); - a.binary_encode(output + (p.bytes() - a.bytes())); - b.binary_encode(output + output.size() / 2 + (p.bytes() - b.bytes())); + a.binary_encode(&output[p.bytes() - a.bytes()]); + b.binary_encode(&output[output.size() / 2 + (p.bytes() - b.bytes())]); return output; } diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp index 74b39d50b..1cff9e081 100644 --- a/src/pubkey/gost_3410/gost_3410.cpp +++ b/src/pubkey/gost_3410/gost_3410.cpp @@ -23,8 +23,8 @@ MemoryVector<byte> GOST_3410_PublicKey::x509_subject_public_key() const MemoryVector<byte> bits(2*part_size); - x.binary_encode(bits + (part_size - x.bytes())); - y.binary_encode(bits + (2*part_size - y.bytes())); + x.binary_encode(&bits[part_size - x.bytes()]); + y.binary_encode(&bits[2*part_size - y.bytes()]); // Keys are stored in little endian format (WTF) for(u32bit i = 0; i != part_size / 2; ++i) @@ -69,8 +69,8 @@ GOST_3410_PublicKey::GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id, std::swap(bits[part_size+i], bits[2*part_size-1-i]); } - BigInt x(bits, part_size); - BigInt y(bits + part_size, part_size); + BigInt x(&bits[0], part_size); + BigInt y(&bits[part_size], part_size); public_key = PointGFp(domain().get_curve(), x, y); @@ -87,7 +87,7 @@ BigInt decode_le(const byte msg[], u32bit msg_len) for(size_t i = 0; i != msg_le.size() / 2; ++i) std::swap(msg_le[i], msg_le[msg_le.size()-1-i]); - return BigInt(msg_le, msg_le.size()); + return BigInt(&msg_le[0], msg_le.size()); } } @@ -129,8 +129,8 @@ GOST_3410_Signature_Operation::sign(const byte msg[], u32bit msg_len, throw Invalid_State("GOST 34.10: r == 0 || s == 0"); SecureVector<byte> output(2*order.bytes()); - r.binary_encode(output + (output.size() / 2 - r.bytes())); - s.binary_encode(output + (output.size() - s.bytes())); + r.binary_encode(&output[output.size() / 2 - r.bytes()]); + s.binary_encode(&output[output.size() - s.bytes()]); return output; } diff --git a/src/pubkey/pubkey.cpp b/src/pubkey/pubkey.cpp index c8ffccf53..dc91ca908 100644 --- a/src/pubkey/pubkey.cpp +++ b/src/pubkey/pubkey.cpp @@ -57,7 +57,7 @@ PK_Encryptor_EME::enc(const byte msg[], if(8*(message.size() - 1) + high_bit(message[0]) > op->max_input_bits()) throw Invalid_Argument("PK_Encryptor_EME: Input is too large"); - return op->encrypt(message, message.size(), rng); + return op->encrypt(&message[0], message.size(), rng); } /* @@ -201,7 +201,7 @@ SecureVector<byte> PK_Signer::signature(RandomNumberGenerator& rng) op->max_input_bits(), rng); - SecureVector<byte> plain_sig = op->sign(encoded, encoded.size(), rng); + SecureVector<byte> plain_sig = op->sign(&encoded[0], encoded.size(), rng); if(verify_op && !self_test_signature(encoded, plain_sig)) throw Internal_Error("PK_Signer consistency check failed"); @@ -217,7 +217,7 @@ SecureVector<byte> PK_Signer::signature(RandomNumberGenerator& rng) std::vector<BigInt> sig_parts(op->message_parts()); for(u32bit j = 0; j != sig_parts.size(); ++j) - sig_parts[j].binary_decode(plain_sig + SIZE_OF_PART*j, SIZE_OF_PART); + sig_parts[j].binary_decode(&plain_sig[SIZE_OF_PART*j], SIZE_OF_PART); return DER_Encoder() .start_cons(SEQUENCE) @@ -310,7 +310,7 @@ bool PK_Verifier::check_signature(const byte sig[], u32bit length) throw Decoding_Error("PK_Verifier: signature size invalid"); return validate_signature(emsa->raw_data(), - real_sig, real_sig.size()); + &real_sig[0], real_sig.size()); } else throw Decoding_Error("PK_Verifier: Unknown signature format " + @@ -337,7 +337,7 @@ bool PK_Verifier::validate_signature(const MemoryRegion<byte>& msg, SecureVector<byte> encoded = emsa->encoding_of(msg, op->max_input_bits(), rng); - return op->verify(encoded, encoded.size(), sig, sig_len); + return op->verify(&encoded[0], encoded.size(), sig, sig_len); } } |