aboutsummaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-30 05:41:04 +0000
committerlloyd <[email protected]>2008-09-30 05:41:04 +0000
commit75ef07ee5378341adf054bd729232167c73e9e47 (patch)
tree7c84c43a431f0313b4f08b4267ff066650948bb0 /src/core
parentbc9e881d7c7a569664b5e753c12e4c8cbde06d2d (diff)
Remove lookup/libstate dependency on Lion, KDF1, KDF2, EMSA[1-4]
Diffstat (limited to 'src/core')
-rw-r--r--src/core/libstate/def_alg.cpp4
-rw-r--r--src/core/libstate/get_enc.cpp24
2 files changed, 16 insertions, 12 deletions
diff --git a/src/core/libstate/def_alg.cpp b/src/core/libstate/def_alg.cpp
index cad5dca5a..6a12f79f2 100644
--- a/src/core/libstate/def_alg.cpp
+++ b/src/core/libstate/def_alg.cpp
@@ -397,7 +397,9 @@ Default_Engine::find_block_cipher(const std::string& algo_spec) const
{
if(name.size() != 4)
throw Invalid_Algorithm_Name(algo_spec);
- return new Lion(name[1], name[2], to_u32bit(name[3]));
+
+ return new Lion(find_hash(name[1]), find_stream_cipher(name[2]),
+ to_u32bit(name[3]));
}
#endif
diff --git a/src/core/libstate/get_enc.cpp b/src/core/libstate/get_enc.cpp
index 5f54be199..2459ef0a6 100644
--- a/src/core/libstate/get_enc.cpp
+++ b/src/core/libstate/get_enc.cpp
@@ -82,7 +82,7 @@ EMSA* get_emsa(const std::string& algo_spec)
if(emsa_name == "EMSA1")
{
if(name.size() == 2)
- return new EMSA1(name[1]);
+ return new EMSA1(get_hash(name[1]));
}
#endif
@@ -90,7 +90,7 @@ EMSA* get_emsa(const std::string& algo_spec)
if(emsa_name == "EMSA2")
{
if(name.size() == 2)
- return new EMSA2(name[1]);
+ return new EMSA2(get_hash(name[1]));
}
#endif
@@ -98,19 +98,21 @@ EMSA* get_emsa(const std::string& algo_spec)
if(emsa_name == "EMSA3")
{
if(name.size() == 2)
- return new EMSA3(name[1]);
+ return new EMSA3(get_hash(name[1]));
}
#endif
#if defined(BOTAN_HAS_EMSA4)
if(emsa_name == "EMSA4")
{
- if(name.size() == 2)
- return new EMSA4(name[1], "MGF1");
- if(name.size() == 3)
- return new EMSA4(name[1], name[2]);
- if(name.size() == 4)
- return new EMSA4(name[1], name[2], to_u32bit(name[3]));
+ // EMSA4 is hardcoded to use MGF1
+ if(name.size() >= 3 && name[2] != "MGF1")
+ throw Algorithm_Not_Found(algo_spec);
+
+ if(name.size() == 2 || name.size() == 3)
+ return new EMSA4(get_hash(name[1]));
+ else if(name.size() == 4)
+ return new EMSA4(get_hash(name[1]), to_u32bit(name[3]));
}
#endif
@@ -165,7 +167,7 @@ KDF* get_kdf(const std::string& algo_spec)
if(kdf_name == "KDF1")
{
if(name.size() == 2)
- return new KDF1(name[1]);
+ return new KDF1(get_hash(name[1]));
}
#endif
@@ -173,7 +175,7 @@ KDF* get_kdf(const std::string& algo_spec)
if(kdf_name == "KDF2")
{
if(name.size() == 2)
- return new KDF2(name[1]);
+ return new KDF2(get_hash(name[1]));
}
#endif