aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash/skein/skein_512.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-05-25 22:52:00 +0000
committerlloyd <[email protected]>2012-05-25 22:52:00 +0000
commit12090a7148d9ee73572cc1a7268fc489504a8173 (patch)
tree51e50ce0852c56231e9e6dc13f168b10edd45d01 /src/hash/skein/skein_512.cpp
parent9594979caf775dc4062850044715b804d1fda60c (diff)
parent65cc04445f8d40497f02a14bd8cb97081790e54b (diff)
propagate from branch 'net.randombit.botan.x509-path-validation' (head 63b5a20eab129ca13287fda33d2d02eec329708f)
to branch 'net.randombit.botan' (head 8b8150f09c55184f028f2929c4e7f7cd0d46d96e)
Diffstat (limited to 'src/hash/skein/skein_512.cpp')
-rw-r--r--src/hash/skein/skein_512.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp
index 571bf9c0b..28c2aa38b 100644
--- a/src/hash/skein/skein_512.cpp
+++ b/src/hash/skein/skein_512.cpp
@@ -27,8 +27,8 @@ enum type_code {
SKEIN_OUTPUT = 63
};
-void ubi_512(MemoryRegion<u64bit>& H,
- MemoryRegion<u64bit>& T,
+void ubi_512(secure_vector<u64bit>& H,
+ secure_vector<u64bit>& T,
const byte msg[], size_t msg_len)
{
do
@@ -125,7 +125,7 @@ void ubi_512(MemoryRegion<u64bit>& H,
} while(msg_len);
}
-void reset_tweak(MemoryRegion<u64bit>& T,
+void reset_tweak(secure_vector<u64bit>& T,
type_code type, bool final)
{
T[0] = 0;
@@ -135,8 +135,8 @@ void reset_tweak(MemoryRegion<u64bit>& T,
(static_cast<u64bit>(final) << 63);
}
-void initial_block(MemoryRegion<u64bit>& H,
- MemoryRegion<u64bit>& T,
+void initial_block(secure_vector<u64bit>& H,
+ secure_vector<u64bit>& T,
size_t output_bits,
const std::string& personalization)
{
@@ -185,8 +185,9 @@ Skein_512::Skein_512(size_t arg_output_bits,
std::string Skein_512::name() const
{
if(personalization != "")
- return "Skein-512(" + to_string(output_bits) + "," + personalization + ")";
- return "Skein-512(" + to_string(output_bits) + ")";
+ return "Skein-512(" + std::to_string(output_bits) + "," +
+ personalization + ")";
+ return "Skein-512(" + std::to_string(output_bits) + ")";
}
HashFunction* Skein_512::clone() const
@@ -209,7 +210,7 @@ void Skein_512::add_data(const byte input[], size_t length)
if(buf_pos)
{
- buffer.copy(buf_pos, input, length);
+ buffer_insert(buffer, buf_pos, input, length);
if(buf_pos + length > 64)
{
ubi_512(H, T, &buffer[0], buffer.size());
@@ -227,7 +228,7 @@ void Skein_512::add_data(const byte input[], size_t length)
length -= full_blocks * 64;
- buffer.copy(buf_pos, input + full_blocks * 64, length);
+ buffer_insert(buffer, buf_pos, input + full_blocks * 64, length);
buf_pos += length;
}
@@ -244,13 +245,13 @@ void Skein_512::final_result(byte out[])
size_t out_bytes = output_bits / 8;
- SecureVector<u64bit> H_out(9);
+ secure_vector<u64bit> H_out(9);
while(out_bytes)
{
const size_t to_proc = std::min<size_t>(out_bytes, 64);
- H_out.copy(&H[0], 8);
+ copy_mem(&H_out[0], &H[0], 8);
reset_tweak(T, SKEIN_OUTPUT, true);
ubi_512(H_out, T, counter, sizeof(counter));