From c2d0d2982e96ab7ce15e90b8d73c9774e2650d86 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 17 May 2012 16:35:57 +0000 Subject: Remove OctetString::change, only allow construction. Turns out nothing was using this, so no other changes needed. --- src/algo_base/symkey.cpp | 8 ++++++-- src/algo_base/symkey.h | 29 +++++------------------------ 2 files changed, 11 insertions(+), 26 deletions(-) (limited to 'src/algo_base') diff --git a/src/algo_base/symkey.cpp b/src/algo_base/symkey.cpp index 56648d9c5..a84ce2f19 100644 --- a/src/algo_base/symkey.cpp +++ b/src/algo_base/symkey.cpp @@ -26,7 +26,7 @@ OctetString::OctetString(RandomNumberGenerator& rng, /* * Create an OctetString from a hex string */ -void OctetString::change(const std::string& hex_string) +OctetString::OctetString(const std::string& hex_string) { bits.resize(1 + hex_string.length() / 2); bits.resize(hex_decode(&bits[0], hex_string)); @@ -35,12 +35,16 @@ void OctetString::change(const std::string& hex_string) /* * Create an OctetString from a byte string */ -void OctetString::change(const byte in[], size_t n) +OctetString::OctetString(const byte in[], size_t n) { bits.resize(n); bits.copy(in, n); } +OctetString::OctetString(const MemoryRegion& b) : bits(b) + { + } + /* * Set the parity of each key byte to odd */ diff --git a/src/algo_base/symkey.h b/src/algo_base/symkey.h index 6735b2b87..2ccc0b883 100644 --- a/src/algo_base/symkey.h +++ b/src/algo_base/symkey.h @@ -57,23 +57,10 @@ class BOTAN_DLL OctetString void set_odd_parity(); /** - * Change the contents of this octet string - * @param hex_string a hex encoded bytestring - */ - void change(const std::string& hex_string); - - /** - * Change the contents of this octet string - * @param in the input - * @param length of in in bytes - */ - void change(const byte in[], size_t length); - - /** - * Change the contents of this octet string - * @param in the input + * Create a new OctetString + * @param str is a hex encoded string */ - void change(const MemoryRegion& in) { bits = in; } + OctetString(const std::string& str = ""); /** * Create a new random OctetString @@ -82,24 +69,18 @@ class BOTAN_DLL OctetString */ OctetString(class RandomNumberGenerator& rng, size_t len); - /** - * Create a new OctetString - * @param str is a hex encoded string - */ - OctetString(const std::string& str = "") { change(str); } - /** * Create a new OctetString * @param in is an array * @param len is the length of in in bytes */ - OctetString(const byte in[], size_t len) { change(in, len); } + OctetString(const byte in[], size_t len); /** * Create a new OctetString * @param in a bytestring */ - OctetString(const MemoryRegion& in) { change(in); } + OctetString(const MemoryRegion& in); private: SecureVector bits; }; -- cgit v1.2.3