monotone

monotone Mtn Source Tree

Root/botan/engine.h

1/*************************************************
2* Engine Header File *
3* (C) 1999-2005 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_ENGINE_H__
7#define BOTAN_ENGINE_H__
8
9#include <botan/base.h>
10#include <botan/pk_ops.h>
11#include <botan/pkcs8.h>
12#include <botan/reducer.h>
13#include <botan/basefilt.h>
14#include <botan/mutex.h>
15#include <map>
16
17namespace Botan {
18
19/*************************************************
20* Engine Base Class *
21*************************************************/
22class Engine
23 {
24 public:
25 virtual IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
26 const BigInt&, const BigInt&, const BigInt&,
27 const BigInt&, const BigInt&) const;
28 virtual DSA_Operation* dsa_op(const DL_Group&, const BigInt&,
29 const BigInt&) const;
30 virtual NR_Operation* nr_op(const DL_Group&, const BigInt&,
31 const BigInt&) const;
32 virtual ELG_Operation* elg_op(const DL_Group&, const BigInt&,
33 const BigInt&) const;
34 virtual DH_Operation* dh_op(const DL_Group&, const BigInt&) const;
35 virtual ModularReducer* reducer(const BigInt&, bool) const;
36
37 const BlockCipher* block_cipher(const std::string&) const;
38 const StreamCipher* stream_cipher(const std::string&) const;
39 const HashFunction* hash(const std::string&) const;
40 const MessageAuthenticationCode* mac(const std::string&) const;
41
42 virtual Keyed_Filter* get_cipher(const std::string&, Cipher_Dir);
43
44 void add_algorithm(BlockCipher*) const;
45 void add_algorithm(StreamCipher*) const;
46 void add_algorithm(HashFunction*) const;
47 void add_algorithm(MessageAuthenticationCode*) const;
48
49 Engine();
50 virtual ~Engine();
51 private:
52 virtual BlockCipher* find_block_cipher(const std::string&) const;
53 virtual StreamCipher* find_stream_cipher(const std::string&) const;
54 virtual HashFunction* find_hash(const std::string&) const;
55 virtual MessageAuthenticationCode* find_mac(const std::string&) const;
56
57 mutable std::map<std::string, BlockCipher*> bc_map;
58 mutable std::map<std::string, StreamCipher*> sc_map;
59 mutable std::map<std::string, HashFunction*> hf_map;
60 mutable std::map<std::string, MessageAuthenticationCode*> mac_map;
61
62 Mutex* bc_map_lock;
63 Mutex* sc_map_lock;
64 Mutex* hf_map_lock;
65 Mutex* mac_map_lock;
66 };
67
68namespace Engine_Core {
69
70/*************************************************
71* Engine Management *
72*************************************************/
73void add_engine(Engine*);
74
75/*************************************************
76* Get an operation from an Engine *
77*************************************************/
78IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
79 const BigInt&, const BigInt&, const BigInt&,
80 const BigInt&, const BigInt&);
81
82DSA_Operation* dsa_op(const DL_Group&, const BigInt&, const BigInt&);
83NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&);
84
85ELG_Operation* elg_op(const DL_Group&, const BigInt&, const BigInt&);
86
87DH_Operation* dh_op(const DL_Group&, const BigInt&);
88
89}
90
91}
92
93#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status