Botan 1.10.17

bn_wrap.h
Go to the documentation of this file.
1 /*
2 * OpenSSL BN Wrapper
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_OPENSSL_BN_WRAP_H__
9 #define BOTAN_OPENSSL_BN_WRAP_H__
10
11 #include <botan/bigint.h>
12 #include <openssl/bn.h>
13
14 namespace Botan {
15
16 /**
17 * Lightweight OpenSSL BN wrapper. For internal use only.
18 */
19 class OSSL_BN
20 {
21 public:
22 BIGNUM* value;
23
24 BigInt to_bigint() const;
25 void encode(byte[], size_t) const;
26 size_t bytes() const;
27
28 SecureVector<byte> to_bytes() const
29 { return BigInt::encode(to_bigint()); }
30
31 OSSL_BN& operator=(const OSSL_BN&);
32
33 OSSL_BN(const OSSL_BN&);
34 OSSL_BN(const BigInt& = 0);
35 OSSL_BN(const byte[], size_t);
36 ~OSSL_BN();
37 };
38
39 /**
40 * Lightweight OpenSSL BN_CTX wrapper. For internal use only.
41 */
42 class OSSL_BN_CTX
43 {
44 public:
45 BN_CTX* value;
46
47 OSSL_BN_CTX& operator=(const OSSL_BN_CTX&);
48
49 OSSL_BN_CTX();
50 OSSL_BN_CTX(const OSSL_BN_CTX&);
51 ~OSSL_BN_CTX();
52 };
53
54 }
55
56 #endif
Botan::OSSL_BN::to_bytes
SecureVector< byte > to_bytes() const
Definition: bn_wrap.h:28
Botan::OSSL_BN::encode
void encode(byte[], size_t) const
Definition: bn_wrap.cpp:60
Botan::BigInt
Definition: bigint.h:22
Botan::OSSL_BN_CTX::OSSL_BN_CTX
OSSL_BN_CTX()
Definition: bn_wrap.cpp:86
Botan::OSSL_BN::OSSL_BN
OSSL_BN(const OSSL_BN &)
Definition: bn_wrap.cpp:35
Botan::BigInt::encode
static SecureVector< byte > encode(const BigInt &n, Base base=Binary)
Definition: big_code.cpp:64
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::OSSL_BN_CTX::operator=
OSSL_BN_CTX & operator=(const OSSL_BN_CTX &)
Definition: bn_wrap.cpp:110
Botan::OSSL_BN_CTX
Definition: bn_wrap.h:42
Botan
Definition: algo_base.h:14
Botan::OSSL_BN::~OSSL_BN
~OSSL_BN()
Definition: bn_wrap.cpp:43
Botan::OSSL_BN::operator=
OSSL_BN & operator=(const OSSL_BN &)
Definition: bn_wrap.cpp:51
Botan::OSSL_BN::to_bigint
BigInt to_bigint() const
Definition: bn_wrap.cpp:76
Botan::OSSL_BN::bytes
size_t bytes() const
Definition: bn_wrap.cpp:68
Botan::OSSL_BN
Definition: bn_wrap.h:19
Botan::SecureVector< byte >
Botan::OSSL_BN_CTX::~OSSL_BN_CTX
~OSSL_BN_CTX()
Definition: bn_wrap.cpp:102
Botan::OSSL_BN_CTX::value
BN_CTX * value
Definition: bn_wrap.h:45
Botan::OSSL_BN::value
BIGNUM * value
Definition: bn_wrap.h:22