diff options
author | Michal Rokos <m.rokos@sh.cvut.cz> | 2002-06-04 06:44:42 +0000 |
---|---|---|
committer | Michal Rokos <m.rokos@sh.cvut.cz> | 2002-06-04 06:44:42 +0000 |
commit | a5180750f7ab485fba73dd6e9861536adf3b693b (patch) | |
tree | cd2cea7862bed69939cb64d20346a3f975b5a9cc /ossl_bn.h | |
parent | bc603852659675cd0c7420dd4d126780f7ba6ee2 (diff) | |
download | ruby-openssl-history-a5180750f7ab485fba73dd6e9861536adf3b693b.tar.gz |
Initial revision
Diffstat (limited to 'ossl_bn.h')
-rw-r--r-- | ossl_bn.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ossl_bn.h b/ossl_bn.h new file mode 100644 index 0000000..74be2a5 --- /dev/null +++ b/ossl_bn.h @@ -0,0 +1,40 @@ +/* + * $Id$ + * 'OpenSSL for Ruby' project + * Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz> + * All rights reserved. + */ +/* + * This program is licenced under the same licence as Ruby. + * (See the file 'LICENCE'.) + */ +#if !defined(_OSSL_BN_H_) +#define _OSSL_BN_H_ + +extern VALUE cBN; +extern VALUE eBNError; + +#define OSSLWrapBN(obj, bn) do { \ + if (!bn) { \ + rb_raise(rb_eRuntimeError, "BN wasn't initialized!"); \ + } \ + obj = Data_Wrap_Struct(cBN, 0, BN_clear_free, bn); \ +} while (0) + +#define OSSLGetBN(obj, bn) do { \ + OSSL_Check_Instance(obj, cBN); \ + Data_Get_Struct(obj, BIGNUM, bn); \ + if (!bn) { \ + rb_raise(rb_eRuntimeError, "BN wasn't initialized!"); \ + } \ +} while (0) + +#define OSSLBNValue(obj) OSSL_Check_Instance((obj), cBN) +#define OSSLBNValuePtr(obj) ossl_bn_get_BIGNUM((obj)) + +VALUE ossl_bn_new(BIGNUM *); +BIGNUM *ossl_bn_get_BIGNUM(VALUE); +void Init_ossl_bn(void); + +#endif /* _OSS_BN_H_ */ + |