aboutsummaryrefslogtreecommitdiffstats
path: root/modules/eng_ossl/bn_wrap.h
blob: ce6a0d7bf630ccff676401059fe71917e28d67f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*************************************************
* OpenSSL BN Wrapper Header File                 *
* (C) 1999-2008 The Botan Project                *
*************************************************/

#ifndef BOTAN_EXT_OPENSSL_BN_WRAP_H__
#define BOTAN_EXT_OPENSSL_BN_WRAP_H__

#include <botan/bigint.h>
#include <openssl/bn.h>

namespace Botan {

/*************************************************
* Lightweight OpenSSL BN Wrapper                 *
*************************************************/
class OSSL_BN
   {
   public:
      BIGNUM* value;

      BigInt to_bigint() const;
      void encode(byte[], u32bit) const;
      u32bit bytes() const;

      OSSL_BN& operator=(const OSSL_BN&);

      OSSL_BN(const OSSL_BN&);
      OSSL_BN(const BigInt& = 0);
      OSSL_BN(const byte[], u32bit);
      ~OSSL_BN();
   };

/*************************************************
* Lightweight OpenSSL BN_CTX Wrapper             *
*************************************************/
class OSSL_BN_CTX
   {
   public:
      BN_CTX* value;

      OSSL_BN_CTX& operator=(const OSSL_BN_CTX&);

      OSSL_BN_CTX();
      OSSL_BN_CTX(const OSSL_BN_CTX&);
      ~OSSL_BN_CTX();
   };

}

#endif