Botan  1.10.9
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 
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 */
43  {
44  public:
45  BN_CTX* value;
46 
48 
49  OSSL_BN_CTX();
50  OSSL_BN_CTX(const OSSL_BN_CTX&);
51  ~OSSL_BN_CTX();
52  };
53 
54 }
55 
56 #endif
size_t bytes() const
Definition: bn_wrap.cpp:68
OSSL_BN(const OSSL_BN &)
Definition: bn_wrap.cpp:35
static SecureVector< byte > encode(const BigInt &n, Base base=Binary)
Definition: big_code.cpp:64
unsigned char byte
Definition: types.h:22
SecureVector< byte > to_bytes() const
Definition: bn_wrap.h:28
BigInt to_bigint() const
Definition: bn_wrap.cpp:76
OSSL_BN_CTX & operator=(const OSSL_BN_CTX &)
Definition: bn_wrap.cpp:110
void encode(byte[], size_t) const
Definition: bn_wrap.cpp:60
OSSL_BN & operator=(const OSSL_BN &)
Definition: bn_wrap.cpp:51
BN_CTX * value
Definition: bn_wrap.h:45
BIGNUM * value
Definition: bn_wrap.h:22