aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-06-06 19:57:46 +0000
committerlloyd <[email protected]>2009-06-06 19:57:46 +0000
commit95033a027fcda13453010805880ad7450d3ac3ff (patch)
tree4233c904bcc712e0af61ce75353163ad657a836a
parenta96eae0b3394b64aea544f9f0ce4664d3b4a5c58 (diff)
Mark Skein_512 with the BOTAN_DLL macro
Add a comment that the limitation of the personalization string being a maximum of 64 characters is due to the implementation and not the specification (but it makes it easy to implement, and in this particular case 64 characters is probably fine). Add some tests for the personalization option, generated by the Skein reference implementation. Disable stripping whitespace in checks/misc.cpp:strip - it strips the personalization tag, which breaks the test, and isn't needed otherwise because the test files are well-formed.
-rw-r--r--checks/misc.cpp2
-rw-r--r--checks/validate.dat23
-rw-r--r--src/hash/skein/skein_512.cpp6
-rw-r--r--src/hash/skein/skein_512.h6
4 files changed, 32 insertions, 5 deletions
diff --git a/checks/misc.cpp b/checks/misc.cpp
index 82b207196..198671451 100644
--- a/checks/misc.cpp
+++ b/checks/misc.cpp
@@ -25,8 +25,10 @@ void strip(std::string& line)
{
strip_comments(line);
+#if 0
while(line.find(' ') != std::string::npos)
line = line.erase(line.find(' '), 1);
+#endif
while(line.find('\t') != std::string::npos)
line = line.erase(line.find('\t'), 1);
diff --git a/checks/validate.dat b/checks/validate.dat
index 40b246da4..05a9b98bb 100644
--- a/checks/validate.dat
+++ b/checks/validate.dat
@@ -44906,8 +44906,6 @@ DB892CAFD8387E05B3012C0458A369E62191F5BDC57DD63CE42E945F493C2B42\
306B8084F3B25E94ABACF08EE155F3621ACC9626EE487C7A7E4667F0377AE4B2:\
5FD345F57D96137E3463DAD7EEE20492536BC115981050DFCB2AC0FE0B7215C3
-
-
[Skein-512(264)]
0000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000000000000000\
@@ -58432,6 +58430,27 @@ DB892CAFD8387E05B3012C0458A369E62191F5BDC57DD63CE42E945F493C2B42\
D5FBBB2DDADCD01816C44DEFFBE256535723F5F260A8ABA72332B4025FD5CC5B\
CE5B2DCB4A115FC015817CB1581F205D8C86CF02D5CC7EF52192322FB2C2DEF7\
+[Skein-512(512,20090606 [email protected] BOTAN/test)]
+:\
+E6FE2E3E0A2CFDC34B9F4E79CB36CCD9C3A2E0A9BE435B6263E00F4B4642B583\
+30D68F876ACF71D257878E46DE54A9B49245779450EB4C0E005AE74E87C39FD0
+
+52A608AB21CCDD8A4457A57EDE782176:\
+FF6E78DB1400B9B7FD29698A5DB3B6A44F843AAE6070DC22330BDCCC72E0E03E\
+4B2D20015A3A45FBCDA50AD6A919AD43F2146BCB22736E8E0CF7F608E8735B1C
+
+E926AE8B0AF6E53176DBFFCC2A6B88C6BD765F939D3D178A9BDE9EF3AA131C61\
+E31C1E42CDFAF4B4DCDE579A37E150EFBEF5555B4C1CB40439D835A724E2FAE7:\
+21401CEA630E80AE15D0B18CE0404EF5D226CD25EB64698DF922D617E9D605A1\
+85D93C0CE50F2469D23989B1E84C7A5409B86A04EDDE9E00A8F62B908E3F02D5
+
+2B6DB7CED8665EBE9DEB080295218426BDAA7C6DA9ADD2088932CDFFBAA1C141\
+29BCCDD70F369EFB149285858D2B1D155D14DE2FDB680A8B027284055182A0CA\
+E275234CC9C92863C1B4AB66F304CF0621CD54565F5BFF461D3B461BD40DF281\
+98E3732501B4860EADD503D26D6E69338F4E0456E9E9BAF3D827AE685FB1D817:\
+5451170D67B0EDEF7874F1A2377A66B00B4AE2DDAF38E0313D05DC2445CC6242\
+23212BC0FBF209C1AF6F8947B0037BE9F61F2D65B0FBC113AF291AB238B51508
+
[Skein-512(1032)]
0000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000000000000000\
diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp
index c8a26ae82..eaef641ed 100644
--- a/src/hash/skein/skein_512.cpp
+++ b/src/hash/skein/skein_512.cpp
@@ -132,6 +132,7 @@ void initial_block(u64bit H[9], u64bit T[3], u32bit output_bits,
{
clear_mem(H, 9);
+ // ASCII("SHA3") followed by version (0x0001) code
byte config_str[32] = { 0x53, 0x48, 0x41, 0x33, 0x01, 0x00, 0 };
store_le(output_bits, config_str + 8);
@@ -140,6 +141,11 @@ void initial_block(u64bit H[9], u64bit T[3], u32bit output_bits,
if(personalization != "")
{
+ /*
+ This is a limitation of this implementation, and not of the
+ algorithm specification. Could be fixed relatively easily, but
+ doesn't seem worth the trouble.
+ */
if(personalization.length() > 64)
throw Invalid_Argument("Skein personalization must be <= 64 bytes");
diff --git a/src/hash/skein/skein_512.h b/src/hash/skein/skein_512.h
index 2192767ca..fa558fc0d 100644
--- a/src/hash/skein/skein_512.h
+++ b/src/hash/skein/skein_512.h
@@ -5,8 +5,8 @@
* Distributed under the terms of the Botan license
*/
-#ifndef BOTAN_SKEIN_H__
-#define BOTAN_SKEIN_H__
+#ifndef BOTAN_SKEIN_512_H__
+#define BOTAN_SKEIN_512_H__
#include <botan/secmem.h>
#include <botan/hash.h>
@@ -14,7 +14,7 @@
namespace Botan {
-class Skein_512 : public HashFunction
+class BOTAN_DLL Skein_512 : public HashFunction
{
public:
Skein_512(u32bit output_bits = 512,