diff options
author | lloyd <lloyd@randombit.net> | 2008-04-10 14:35:43 +0000 |
---|---|---|
committer | lloyd <lloyd@randombit.net> | 2008-04-10 14:35:43 +0000 |
commit | e540b08fcc5ccf5c56093a278a417b274eda0ae6 (patch) | |
tree | 1391172b3b8d17651b1385f6c6846802f2c2c4de | |
parent | a4af97b93eafdacfd26c55d37e4c06e20ff95258 (diff) |
Rename fips140.h to selftest.h, since it doesn't really have much to do
with FIPS-140 aside from being a startup self test.
Remove the test of X9.19 MAC at startup because it's not that important, and
loading it in the startup means a prototypical object will be created and
exist in memory for the entire process runtime. This actually raises an
interesting idea, that periodically the cache of objects could be cleared
and, if one is needed again, it can be created again as if it was the first
time.
-rw-r--r-- | include/selftest.h (renamed from include/fips140.h) | 12 | ||||
-rw-r--r-- | src/libstate.cpp | 6 | ||||
-rw-r--r-- | src/selftest.cpp (renamed from src/fips140.cpp) | 14 |
3 files changed, 9 insertions, 23 deletions
diff --git a/include/fips140.h b/include/selftest.h index b0cae081e..1283b3dd4 100644 --- a/include/fips140.h +++ b/include/selftest.h @@ -1,24 +1,20 @@ /************************************************* -* FIPS 140 Header File * +* Startup Self Test Header File * * (C) 1999-2007 Jack Lloyd * *************************************************/ -#ifndef BOTAN_FIPS140_H__ -#define BOTAN_FIPS140_H__ +#ifndef BOTAN_SELF_TEST_H__ +#define BOTAN_SELF_TEST_H__ #include <botan/base.h> namespace Botan { -namespace FIPS140 { - /************************************************* -* FIPS 140-2 Self Tests * +* Self Tests * *************************************************/ bool passes_self_tests(); } -} - #endif diff --git a/src/libstate.cpp b/src/libstate.cpp index 8221d09bd..154ec928c 100644 --- a/src/libstate.cpp +++ b/src/libstate.cpp @@ -13,7 +13,7 @@ #include <botan/timers.h> #include <botan/charset.h> #include <botan/x931_rng.h> -#include <botan/fips140.h> +#include <botan/selftest.h> #include <algorithm> namespace Botan { @@ -364,8 +364,8 @@ void Library_State::initialize(const InitializerOptions& args, if(args.fips_mode() || args.self_test()) { - if(!FIPS140::passes_self_tests()) - throw Self_Test_Failure("FIPS-140 startup tests"); + if(!passes_self_tests()) + throw Self_Test_Failure("Initialization self-tests"); } } diff --git a/src/fips140.cpp b/src/selftest.cpp index 486afa072..3c8185ce0 100644 --- a/src/fips140.cpp +++ b/src/selftest.cpp @@ -1,15 +1,13 @@ /************************************************* -* FIPS-140 Self Tests Source File * +* Startup Self Tests Source File * * (C) 1999-2007 Jack Lloyd * *************************************************/ -#include <botan/fips140.h> +#include <botan/selftest.h> #include <botan/lookup.h> namespace Botan { -namespace FIPS140 { - namespace { /************************************************* @@ -150,12 +148,6 @@ bool passes_self_tests() "BA0AA3F3D9AE3C1C7A3B1696A0B68CF7", "0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B" "0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B"); - - mac_kat("X9.19-MAC", - "31311C3931383237333634351C1C35383134333237361C1C3B3132333435" - "36373839303132333435363D3939313231303030303F1C30303031323530" - "301C393738363533343132343837363932331C", "C209CCB78EE1B606", - "0123456789ABCDEFFEDCBA9876543210"); } catch(std::exception) { @@ -166,5 +158,3 @@ bool passes_self_tests() } } - -} |