diff options
author | Michal Rokos <m.rokos@sh.cvut.cz> | 2002-03-11 17:20:04 +0000 |
---|---|---|
committer | Michal Rokos <m.rokos@sh.cvut.cz> | 2002-03-11 17:20:04 +0000 |
commit | 7ed17afc8c327bc88d1510255d284487d06f226c (patch) | |
tree | 52aa2aed34535a040ba155fef373e4394449dd33 /ossl_bn.c | |
parent | 91e607a11b3862c0aa966712149b2afd2a00d90d (diff) | |
download | ruby-openssl-history-7ed17afc8c327bc88d1510255d284487d06f226c.tar.gz |
* Big internal cleanup (all structs with only 1 member rearranged)
* improved getting time_t from cTime
Diffstat (limited to 'ossl_bn.c')
-rw-r--r-- | ossl_bn.c | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -11,14 +11,8 @@ /* modified by Michal Rokos <m.rokos@sh.cvut.cz> */ #include "ossl.h" -#define WrapBN(obj, bn) {\ - if (!bn) rb_raise(eBNError, "not initialized!");\ - obj = Data_Wrap_Struct(cBN, 0, BN_clear_free, bn);\ -} -#define GetBN(obj, bn) {\ - Data_Get_Struct(obj, BIGNUM, bn);\ - if (!bn) rb_raise(eBNError, "not initialized!");\ -} +#define WrapBN(obj, bn) obj = Data_Wrap_Struct(cBN, 0, BN_clear_free, bn) +#define GetBN(obj, bn) Data_Get_Struct(obj, BIGNUM, bn) /* * Classes @@ -26,7 +20,6 @@ VALUE cBN; VALUE eBNError; - /* * Public */ @@ -51,9 +44,10 @@ ossl_bn_new(BIGNUM *bn) BIGNUM * ossl_bn_get_BIGNUM(VALUE obj) { - BIGNUM *bn = NULL, *new = NULL; + BIGNUM *bn = NULL, *new; OSSL_Check_Type(obj, cBN); + GetBN(obj, bn); if (!(new = BN_dup(bn))) { @@ -338,7 +332,7 @@ ossl_bn_mod_inverse(VALUE self, VALUE other) OSSL_Raise(eBNError, ""); } BN_CTX_init(&ctx); - if (BN_mod_inverse(result, bn1, bn2, &ctx) == NULL) { + if (!BN_mod_inverse(result, bn1, bn2, &ctx)) { BN_free(result); OSSL_Raise(eBNError, ""); } |