aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/rsa
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-03-30 18:27:18 +0000
committerlloyd <[email protected]>2009-03-30 18:27:18 +0000
commit96d6eb6f29c55e16a37cf11899547886f735b065 (patch)
tree9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/pubkey/rsa
parent3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (diff)
Thomas Moschny passed along a request from the Fedora packagers which came
up during the Fedora submission review, that each source file include some text about the license. One handy Perl script later and each file now has the line Distributed under the terms of the Botan license after the copyright notices. While I was in there modifying every file anyway, I also stripped out the remainder of the block comments (lots of astericks before and after the text); this is stylistic thing I picked up when I was first learning C++ but in retrospect it is not a good style as the structure makes it harder to modify comments (with the result that comments become fewer, shorter and are less likely to be updated, which are not good things).
Diffstat (limited to 'src/pubkey/rsa')
-rw-r--r--src/pubkey/rsa/rsa.cpp70
-rw-r--r--src/pubkey/rsa/rsa.h10
2 files changed, 42 insertions, 38 deletions
diff --git a/src/pubkey/rsa/rsa.cpp b/src/pubkey/rsa/rsa.cpp
index 7b74f3c57..83e6e1b17 100644
--- a/src/pubkey/rsa/rsa.cpp
+++ b/src/pubkey/rsa/rsa.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* RSA Source File *
-* (C) 1999-2008 Jack Lloyd *
-*************************************************/
+/*
+* RSA
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/rsa.h>
#include <botan/parsing.h>
@@ -11,9 +13,9 @@
namespace Botan {
-/*************************************************
-* RSA_PublicKey Constructor *
-*************************************************/
+/*
+* RSA_PublicKey Constructor
+*/
RSA_PublicKey::RSA_PublicKey(const BigInt& mod, const BigInt& exp)
{
n = mod;
@@ -21,9 +23,9 @@ RSA_PublicKey::RSA_PublicKey(const BigInt& mod, const BigInt& exp)
X509_load_hook();
}
-/*************************************************
-* RSA Public Operation *
-*************************************************/
+/*
+* RSA Public Operation
+*/
BigInt RSA_PublicKey::public_op(const BigInt& i) const
{
if(i >= n)
@@ -31,9 +33,9 @@ BigInt RSA_PublicKey::public_op(const BigInt& i) const
return core.public_op(i);
}
-/*************************************************
-* RSA Encryption Function *
-*************************************************/
+/*
+* RSA Encryption Function
+*/
SecureVector<byte> RSA_PublicKey::encrypt(const byte in[], u32bit len,
RandomNumberGenerator&) const
{
@@ -41,18 +43,18 @@ SecureVector<byte> RSA_PublicKey::encrypt(const byte in[], u32bit len,
return BigInt::encode_1363(public_op(i), n.bytes());
}
-/*************************************************
-* RSA Verification Function *
-*************************************************/
+/*
+* RSA Verification Function
+*/
SecureVector<byte> RSA_PublicKey::verify(const byte in[], u32bit len) const
{
BigInt i(in, len);
return BigInt::encode(public_op(i));
}
-/*************************************************
-* Create a RSA private key *
-*************************************************/
+/*
+* Create a RSA private key
+*/
RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng,
u32bit bits, u32bit exp)
{
@@ -73,9 +75,9 @@ RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng,
throw Self_Test_Failure(algo_name() + " private key generation failed");
}
-/*************************************************
-* RSA_PrivateKey Constructor *
-*************************************************/
+/*
+* RSA_PrivateKey Constructor
+*/
RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng,
const BigInt& prime1, const BigInt& prime2,
const BigInt& exp, const BigInt& d_exp,
@@ -93,9 +95,9 @@ RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng,
PKCS8_load_hook(rng);
}
-/*************************************************
-* RSA Private Operation *
-*************************************************/
+/*
+* RSA Private Operation
+*/
BigInt RSA_PrivateKey::private_op(const byte in[], u32bit length) const
{
BigInt i(in, length);
@@ -108,26 +110,26 @@ BigInt RSA_PrivateKey::private_op(const byte in[], u32bit length) const
return r;
}
-/*************************************************
-* RSA Decryption Operation *
-*************************************************/
+/*
+* RSA Decryption Operation
+*/
SecureVector<byte> RSA_PrivateKey::decrypt(const byte in[], u32bit len) const
{
return BigInt::encode(private_op(in, len));
}
-/*************************************************
-* RSA Signature Operation *
-*************************************************/
+/*
+* RSA Signature Operation
+*/
SecureVector<byte> RSA_PrivateKey::sign(const byte in[], u32bit len,
RandomNumberGenerator&) const
{
return BigInt::encode_1363(private_op(in, len), n.bytes());
}
-/*************************************************
-* Check Private RSA Parameters *
-*************************************************/
+/*
+* Check Private RSA Parameters
+*/
bool RSA_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const
{
if(!IF_Scheme_PrivateKey::check_key(rng, strong))
diff --git a/src/pubkey/rsa/rsa.h b/src/pubkey/rsa/rsa.h
index b8404b77c..f07533a4f 100644
--- a/src/pubkey/rsa/rsa.h
+++ b/src/pubkey/rsa/rsa.h
@@ -1,7 +1,9 @@
-/*************************************************
-* RSA Header File *
-* (C) 1999-2008 Jack Lloyd *
-*************************************************/
+/*
+* RSA
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_RSA_H__
#define BOTAN_RSA_H__