summaryrefslogtreecommitdiffabout
path: root/include/opkele/util.h
Unidiff
Diffstat (limited to 'include/opkele/util.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/opkele/util.h b/include/opkele/util.h
index 2a7a859..edc1859 100644
--- a/include/opkele/util.h
+++ b/include/opkele/util.h
@@ -1,37 +1,40 @@
1#ifndef __OPKELE_UTIL_H 1#ifndef __OPKELE_UTIL_H
2#define __OPKELE_UTIL_H 2#define __OPKELE_UTIL_H
3 3
4#include <time.h> 4#include <time.h>
5#include <string> 5#include <string>
6#include <vector> 6#include <vector>
7#include <openssl/bn.h> 7#include <openssl/bn.h>
8#include <openssl/dh.h> 8#include <openssl/dh.h>
9 9
10namespace opkele { 10namespace opkele {
11 using std::string; 11 using std::string;
12 using std::vector; 12 using std::vector;
13 13
14 /**
15 * @brief opkele utils namespace
16 */
14 namespace util { 17 namespace util {
15 18
16 /** 19 /**
17 * Convenience class encapsulating SSL BIGNUM object for the purpose of 20 * Convenience class encapsulating SSL BIGNUM object for the purpose of
18 * automatical freeing. 21 * automatical freeing.
19 */ 22 */
20 class bignum_t { 23 class bignum_t {
21 public: 24 public:
22 BIGNUM *_bn; 25 BIGNUM *_bn;
23 26
24 bignum_t() : _bn(0) { } 27 bignum_t() : _bn(0) { }
25 bignum_t(BIGNUM *bn) : _bn(bn) { } 28 bignum_t(BIGNUM *bn) : _bn(bn) { }
26 ~bignum_t() throw() { if(_bn) BN_free(_bn); } 29 ~bignum_t() throw() { if(_bn) BN_free(_bn); }
27 30
28 bignum_t& operator=(BIGNUM *bn) { if(_bn) BN_free(_bn); _bn = bn; return *this; } 31 bignum_t& operator=(BIGNUM *bn) { if(_bn) BN_free(_bn); _bn = bn; return *this; }
29 32
30 operator const BIGNUM*(void) const { return _bn; } 33 operator const BIGNUM*(void) const { return _bn; }
31 operator BIGNUM*(void) { return _bn; } 34 operator BIGNUM*(void) { return _bn; }
32 }; 35 };
33 /** 36 /**
34 * Convenience clas encapsulating SSL DH object for the purpose of 37 * Convenience clas encapsulating SSL DH object for the purpose of
35 * automatic freeing. 38 * automatic freeing.
36 */ 39 */
37 class dh_t { 40 class dh_t {