diff options
author | lloyd <[email protected]> | 2010-03-04 22:09:07 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-04 22:09:07 +0000 |
commit | 664e00a6d51cf7d6f3fefbbb3500a113d21288ab (patch) | |
tree | 32db25ebf468a2c75ec4578d83f8c41e0197bfaf /src/libstate | |
parent | f5cfe2857acb30ece3f01fbc98a83e8b82e4907a (diff) |
This checkin represents a pretty major change in how PK operations are
performed. Up until now, each key object (eg DSA_PublicKey or
ECDH_PrivateKey) had two jobs: contain the key material, and know how
to perform any operations on that key. However because of a desire to
support alternative implementations (GNU MP, hardware, whatever),
there was a notion of operations, with the key objects containing an
op that they got via engine rather than actually implementing the
underlying algorithms directly.
Now, represent the operation as an abstract interface (typically
mapping a byte string to a byte string), and pass a plain Public_Key&
or Private_Key& to the engine. The engine does any checks it wants (eg
based on name, typeid, key sizes, etc), and either returns nothing
(I'll pass) or a pointer to a new operation that represents signatures
or encryption or what-have-you using that key.
This means that plain key objects no longer contain operations. This
is a major break with the traditional interface. On the other hand,
using these 'bare' operations without padding, KDFs, etc is 99% of the
time a bad idea anyway (and if you really need them, there are options
so you get the bare op but via the pubkey.h interfaces).
Currently this change is only implemented for DH and ECDH (ie, key
agreement algorithms). Additionally the optional engines (gnump and
openssl) have not been updated. I'll probably wait to touch those
until after I can change them all in one go for all algos.
Diffstat (limited to 'src/libstate')
-rw-r--r-- | src/libstate/pk_engine.cpp | 19 | ||||
-rw-r--r-- | src/libstate/pk_engine.h | 8 |
2 files changed, 0 insertions, 27 deletions
diff --git a/src/libstate/pk_engine.cpp b/src/libstate/pk_engine.cpp index ac2fa68b0..51aaa073e 100644 --- a/src/libstate/pk_engine.cpp +++ b/src/libstate/pk_engine.cpp @@ -91,25 +91,6 @@ ELG_Operation* elg_op(const DL_Group& group, const BigInt& y, const BigInt& x) } #endif -#if defined(BOTAN_HAS_DIFFIE_HELLMAN) -/* -* Acquire a DH op -*/ -DH_Operation* dh_op(const DL_Group& group, const BigInt& x) - { - Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory()); - - while(const Engine* engine = i.next()) - { - DH_Operation* op = engine->dh_op(group, x); - if(op) - return op; - } - - throw Lookup_Error("Engine_Core::dh_op: Unable to find a working engine"); - } -#endif - /* * Acquire a modular exponentiator */ diff --git a/src/libstate/pk_engine.h b/src/libstate/pk_engine.h index 25f326ef0..e6399058e 100644 --- a/src/libstate/pk_engine.h +++ b/src/libstate/pk_engine.h @@ -19,10 +19,6 @@ #include <botan/dsa_op.h> #endif -#if defined(BOTAN_HAS_DIFFIE_HELLMAN) - #include <botan/dh_op.h> -#endif - #if defined(BOTAN_HAS_NYBERG_RUEPPEL) #include <botan/nr_op.h> #endif @@ -62,10 +58,6 @@ NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&); ELG_Operation* elg_op(const DL_Group&, const BigInt&, const BigInt&); #endif -#if defined(BOTAN_HAS_DIFFIE_HELLMAN) -DH_Operation* dh_op(const DL_Group&, const BigInt&); -#endif - } } |