diff options
author | lloyd <[email protected]> | 2009-03-30 18:27:18 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-03-30 18:27:18 +0000 |
commit | 96d6eb6f29c55e16a37cf11899547886f735b065 (patch) | |
tree | 9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/engine/openssl/bn_wrap.cpp | |
parent | 3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (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/engine/openssl/bn_wrap.cpp')
-rw-r--r-- | src/engine/openssl/bn_wrap.cpp | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/src/engine/openssl/bn_wrap.cpp b/src/engine/openssl/bn_wrap.cpp index 4f7ea0078..e1cfe3f95 100644 --- a/src/engine/openssl/bn_wrap.cpp +++ b/src/engine/openssl/bn_wrap.cpp @@ -1,15 +1,17 @@ -/************************************************* -* OpenSSL BN Wrapper Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL BN Wrapper +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/bn_wrap.h> namespace Botan { -/************************************************* -* OSSL_BN Constructor * -*************************************************/ +/* +* OSSL_BN Constructor +*/ OSSL_BN::OSSL_BN(const BigInt& in) { value = BN_new(); @@ -18,59 +20,59 @@ OSSL_BN::OSSL_BN(const BigInt& in) BN_bin2bn(encoding, encoding.size(), value); } -/************************************************* -* OSSL_BN Constructor * -*************************************************/ +/* +* OSSL_BN Constructor +*/ OSSL_BN::OSSL_BN(const byte in[], u32bit length) { value = BN_new(); BN_bin2bn(in, length, value); } -/************************************************* -* OSSL_BN Copy Constructor * -*************************************************/ +/* +* OSSL_BN Copy Constructor +*/ OSSL_BN::OSSL_BN(const OSSL_BN& other) { value = BN_dup(other.value); } -/************************************************* -* OSSL_BN Destructor * -*************************************************/ +/* +* OSSL_BN Destructor +*/ OSSL_BN::~OSSL_BN() { BN_clear_free(value); } -/************************************************* -* OSSL_BN Assignment Operator * -*************************************************/ +/* +* OSSL_BN Assignment Operator +*/ OSSL_BN& OSSL_BN::operator=(const OSSL_BN& other) { BN_copy(value, other.value); return (*this); } -/************************************************* -* Export the BIGNUM as a bytestring * -*************************************************/ +/* +* Export the BIGNUM as a bytestring +*/ void OSSL_BN::encode(byte out[], u32bit length) const { BN_bn2bin(value, out + (length - bytes())); } -/************************************************* -* Return the number of significant bytes * -*************************************************/ +/* +* Return the number of significant bytes +*/ u32bit OSSL_BN::bytes() const { return BN_num_bytes(value); } -/************************************************* -* OpenSSL to BigInt Conversions * -*************************************************/ +/* +* OpenSSL to BigInt Conversions +*/ BigInt OSSL_BN::to_bigint() const { SecureVector<byte> out(bytes()); @@ -78,33 +80,33 @@ BigInt OSSL_BN::to_bigint() const return BigInt::decode(out); } -/************************************************* -* OSSL_BN_CTX Constructor * -*************************************************/ +/* +* OSSL_BN_CTX Constructor +*/ OSSL_BN_CTX::OSSL_BN_CTX() { value = BN_CTX_new(); } -/************************************************* -* OSSL_BN_CTX Copy Constructor * -*************************************************/ +/* +* OSSL_BN_CTX Copy Constructor +*/ OSSL_BN_CTX::OSSL_BN_CTX(const OSSL_BN_CTX&) { value = BN_CTX_new(); } -/************************************************* -* OSSL_BN_CTX Destructor * -*************************************************/ +/* +* OSSL_BN_CTX Destructor +*/ OSSL_BN_CTX::~OSSL_BN_CTX() { BN_CTX_free(value); } -/************************************************* -* OSSL_BN_CTX Assignment Operator * -*************************************************/ +/* +* OSSL_BN_CTX Assignment Operator +*/ OSSL_BN_CTX& OSSL_BN_CTX::operator=(const OSSL_BN_CTX&) { value = BN_CTX_new(); |