aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/rw
diff options
context:
space:
mode:
Diffstat (limited to 'src/pubkey/rw')
-rw-r--r--src/pubkey/rw/rw.cpp52
-rw-r--r--src/pubkey/rw/rw.h22
2 files changed, 39 insertions, 35 deletions
diff --git a/src/pubkey/rw/rw.cpp b/src/pubkey/rw/rw.cpp
index a2888a87d..def0ae689 100644
--- a/src/pubkey/rw/rw.cpp
+++ b/src/pubkey/rw/rw.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* Rabin-Williams Source File *
-* (C) 1999-2008 Jack Lloyd *
-*************************************************/
+/*
+* Rabin-Williams
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/rw.h>
#include <botan/numthry.h>
@@ -12,9 +14,9 @@
namespace Botan {
-/*************************************************
-* RW_PublicKey Constructor *
-*************************************************/
+/*
+* RW_PublicKey Constructor
+*/
RW_PublicKey::RW_PublicKey(const BigInt& mod, const BigInt& exp)
{
n = mod;
@@ -22,9 +24,9 @@ RW_PublicKey::RW_PublicKey(const BigInt& mod, const BigInt& exp)
X509_load_hook();
}
-/*************************************************
-* Rabin-Williams Public Operation *
-*************************************************/
+/*
+* Rabin-Williams Public Operation
+*/
BigInt RW_PublicKey::public_op(const BigInt& i) const
{
if((i > (n >> 1)) || i.is_negative())
@@ -41,18 +43,18 @@ BigInt RW_PublicKey::public_op(const BigInt& i) const
throw Invalid_Argument(algo_name() + "::public_op: Invalid input");
}
-/*************************************************
-* Rabin-Williams Verification Function *
-*************************************************/
+/*
+* Rabin-Williams Verification Function
+*/
SecureVector<byte> RW_PublicKey::verify(const byte in[], u32bit len) const
{
BigInt i(in, len);
return BigInt::encode(public_op(i));
}
-/*************************************************
-* Create a Rabin-Williams private key *
-*************************************************/
+/*
+* Create a Rabin-Williams private key
+*/
RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng,
u32bit bits, u32bit exp)
{
@@ -73,9 +75,9 @@ RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng,
throw Self_Test_Failure(algo_name() + " private key generation failed");
}
-/*************************************************
-* RW_PrivateKey Constructor *
-*************************************************/
+/*
+* RW_PrivateKey Constructor
+*/
RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng,
const BigInt& prime1, const BigInt& prime2,
const BigInt& exp, const BigInt& d_exp,
@@ -93,9 +95,9 @@ RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng,
PKCS8_load_hook(rng);
}
-/*************************************************
-* Rabin-Williams Signature Operation *
-*************************************************/
+/*
+* Rabin-Williams Signature Operation
+*/
SecureVector<byte> RW_PrivateKey::sign(const byte in[], u32bit len,
RandomNumberGenerator&) const
{
@@ -114,9 +116,9 @@ SecureVector<byte> RW_PrivateKey::sign(const byte in[], u32bit len,
return BigInt::encode_1363(r, n.bytes());
}
-/*************************************************
-* Check Private Rabin-Williams Parameters *
-*************************************************/
+/*
+* Check Private Rabin-Williams Parameters
+*/
bool RW_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const
{
if(!IF_Scheme_PrivateKey::check_key(rng, strong))
diff --git a/src/pubkey/rw/rw.h b/src/pubkey/rw/rw.h
index d9f95eaa9..900e5ebda 100644
--- a/src/pubkey/rw/rw.h
+++ b/src/pubkey/rw/rw.h
@@ -1,7 +1,9 @@
-/*************************************************
-* Rabin-Williams Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Rabin-Williams
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_RW_H__
#define BOTAN_RW_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* Rabin-Williams Public Key *
-*************************************************/
+/*
+* Rabin-Williams Public Key
+*/
class BOTAN_DLL RW_PublicKey : public PK_Verifying_with_MR_Key,
public virtual IF_Scheme_PublicKey
{
@@ -27,9 +29,9 @@ class BOTAN_DLL RW_PublicKey : public PK_Verifying_with_MR_Key,
BigInt public_op(const BigInt&) const;
};
-/*************************************************
-* Rabin-Williams Private Key *
-*************************************************/
+/*
+* Rabin-Williams Private Key
+*/
class BOTAN_DLL RW_PrivateKey : public RW_PublicKey,
public PK_Signing_Key,
public IF_Scheme_PrivateKey