aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-10 16:23:59 +0000
committerlloyd <[email protected]>2008-06-10 16:23:59 +0000
commit2aef9fa5bc25984a838a51a93ac0e918d2d1bbac (patch)
tree9f0b9035c4549380de6c62a7bf941a9396b8f554 /include
parent7ab69d77956048fdc27f49a07724d6b21549b916 (diff)
Pass RandomNumberGenerator references to public key operations that need
them (encrypt and sign), with the intent of slowly bubbling up the access points to the API level, at which point the application handles managing the RNG. This will allow removing the compiled-in global PRNG, and make testing much simpler.
Diffstat (limited to 'include')
-rw-r--r--include/dl_algo.h2
-rw-r--r--include/dsa.h3
-rw-r--r--include/elgamal.h3
-rw-r--r--include/nr.h3
-rw-r--r--include/pk_keys.h6
-rw-r--r--include/rsa.h8
-rw-r--r--include/rw.h3
7 files changed, 19 insertions, 9 deletions
diff --git a/include/dl_algo.h b/include/dl_algo.h
index 2bcd67cb9..aaf078bac 100644
--- a/include/dl_algo.h
+++ b/include/dl_algo.h
@@ -40,7 +40,7 @@ class BOTAN_DLL DL_Scheme_PublicKey : public virtual Public_Key
* DL Private Key *
*************************************************/
class BOTAN_DLL DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey,
- public virtual Private_Key
+ public virtual Private_Key
{
public:
bool check_key(RandomNumberGenerator& rng, bool) const;
diff --git a/include/dsa.h b/include/dsa.h
index a858374e6..67de8d137 100644
--- a/include/dsa.h
+++ b/include/dsa.h
@@ -43,7 +43,8 @@ class BOTAN_DLL DSA_PrivateKey : public DSA_PublicKey,
public virtual DL_Scheme_PrivateKey
{
public:
- SecureVector<byte> sign(const byte[], u32bit) const;
+ SecureVector<byte> sign(const byte[], u32bit,
+ RandomNumberGenerator& rng) const;
bool check_key(RandomNumberGenerator& rng, bool) const;
diff --git a/include/elgamal.h b/include/elgamal.h
index 90fd8c77a..e5de3f965 100644
--- a/include/elgamal.h
+++ b/include/elgamal.h
@@ -21,7 +21,8 @@ class BOTAN_DLL ElGamal_PublicKey : public PK_Encrypting_Key,
std::string algo_name() const { return "ElGamal"; }
DL_Group::Format group_format() const { return DL_Group::ANSI_X9_42; }
- SecureVector<byte> encrypt(const byte[], u32bit) const;
+ SecureVector<byte> encrypt(const byte[], u32bit,
+ RandomNumberGenerator& rng) const;
u32bit max_input_bits() const;
ElGamal_PublicKey() {}
diff --git a/include/nr.h b/include/nr.h
index 0f5e1d677..c8eaaf32e 100644
--- a/include/nr.h
+++ b/include/nr.h
@@ -43,7 +43,8 @@ class BOTAN_DLL NR_PrivateKey : public NR_PublicKey,
public virtual DL_Scheme_PrivateKey
{
public:
- SecureVector<byte> sign(const byte[], u32bit) const;
+ SecureVector<byte> sign(const byte[], u32bit,
+ RandomNumberGenerator& rng) const;
bool check_key(RandomNumberGenerator& rng, bool) const;
diff --git a/include/pk_keys.h b/include/pk_keys.h
index fed96d37b..c6f9ced3c 100644
--- a/include/pk_keys.h
+++ b/include/pk_keys.h
@@ -54,7 +54,8 @@ class BOTAN_DLL Private_Key : public virtual Public_Key
class BOTAN_DLL PK_Encrypting_Key : public virtual Public_Key
{
public:
- virtual SecureVector<byte> encrypt(const byte[], u32bit) const = 0;
+ virtual SecureVector<byte> encrypt(const byte[], u32bit,
+ RandomNumberGenerator&) const = 0;
virtual ~PK_Encrypting_Key() {}
};
@@ -74,7 +75,8 @@ class BOTAN_DLL PK_Decrypting_Key : public virtual Private_Key
class BOTAN_DLL PK_Signing_Key : public virtual Private_Key
{
public:
- virtual SecureVector<byte> sign(const byte[], u32bit) const = 0;
+ virtual SecureVector<byte> sign(const byte[], u32bit,
+ RandomNumberGenerator& rng) const = 0;
virtual ~PK_Signing_Key() {}
};
diff --git a/include/rsa.h b/include/rsa.h
index e9f92db51..7ca8068f9 100644
--- a/include/rsa.h
+++ b/include/rsa.h
@@ -20,7 +20,9 @@ class BOTAN_DLL RSA_PublicKey : public PK_Encrypting_Key,
public:
std::string algo_name() const { return "RSA"; }
- SecureVector<byte> encrypt(const byte[], u32bit) const;
+ SecureVector<byte> encrypt(const byte[], u32bit,
+ RandomNumberGenerator& rng) const;
+
SecureVector<byte> verify(const byte[], u32bit) const;
RSA_PublicKey() {}
@@ -38,8 +40,10 @@ class BOTAN_DLL RSA_PrivateKey : public RSA_PublicKey,
public IF_Scheme_PrivateKey
{
public:
+ SecureVector<byte> sign(const byte[], u32bit,
+ RandomNumberGenerator&) const;
+
SecureVector<byte> decrypt(const byte[], u32bit) const;
- SecureVector<byte> sign(const byte[], u32bit) const;
bool check_key(RandomNumberGenerator& rng, bool) const;
diff --git a/include/rw.h b/include/rw.h
index a809041d1..2cc2fb6a4 100644
--- a/include/rw.h
+++ b/include/rw.h
@@ -35,7 +35,8 @@ class BOTAN_DLL RW_PrivateKey : public RW_PublicKey,
public IF_Scheme_PrivateKey
{
public:
- SecureVector<byte> sign(const byte[], u32bit) const;
+ SecureVector<byte> sign(const byte[], u32bit,
+ RandomNumberGenerator& rng) const;
bool check_key(RandomNumberGenerator& rng, bool) const;