From 1dbbec7519d75f7bc5b8fa23eb175c8a8f96a9b5 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 5 Jul 2011 20:45:23 +0000 Subject: The Algorithm_Factory has this logic on looking for an object: - Check the cache; if found, return value - Populate cache, if the value is already there, delete the old object and save the new one. - Recheck the cache value Raja pointed out on the list that this could race if multiple threads called a lookup function in close succession while the cache was cold. All of them would fail the lookup, then each of them would add it, but the values returned would be deleted by other threads. Instead, declare that first write wins. Then, the cache stays consistent even if there is a race, the only issue is an extra search and delete. Modify GOST and Skein, as their name() function did not roundtrip properly which caused failures otherwise. --- src/hash/skein/skein_512.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/hash/skein') diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp index f85968e84..571bf9c0b 100644 --- a/src/hash/skein/skein_512.cpp +++ b/src/hash/skein/skein_512.cpp @@ -184,6 +184,8 @@ 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) + ")"; } -- cgit v1.2.3