aboutsummaryrefslogtreecommitdiffstats
path: root/ossl_bn.c
diff options
context:
space:
mode:
authorMichal Rokos <m.rokos@sh.cvut.cz>2002-03-05 15:05:29 +0000
committerMichal Rokos <m.rokos@sh.cvut.cz>2002-03-05 15:05:29 +0000
commit3c8abbf103555809d110c21f89de60869a4a6bea (patch)
tree71beab86d7d0e6fc143a6d5c55a25cc2a75e0b6f /ossl_bn.c
parent59dd8c5696d83aff78c506d2a161ea4ffb404088 (diff)
downloadruby-openssl-history-3c8abbf103555809d110c21f89de60869a4a6bea.tar.gz
* WARNING! All to_str methods are not used any longer (use to_text instead)
* made an aliases to_pem as to_s * more relaxed params checking - everywhere where string was needed it is OK that obj implements to_s method
Diffstat (limited to 'ossl_bn.c')
-rw-r--r--ossl_bn.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/ossl_bn.c b/ossl_bn.c
index 4f548fc..0f39458 100644
--- a/ossl_bn.c
+++ b/ossl_bn.c
@@ -80,11 +80,11 @@ ossl_bn_s_new(int argc, VALUE *argv, VALUE klass)
#define BIGNUM_FROM(func) \
static VALUE \
- ossl_bn_from_##func(VALUE self, VALUE str) \
+ ossl_bn_from_s_##func(VALUE self, VALUE str) \
{ \
BIGNUM *bn = NULL; \
\
- Check_Type(str, T_STRING); \
+ str = rb_String(str); \
\
GetBN(self, bn); \
\
@@ -98,11 +98,11 @@ BIGNUM_FROM(mpi);
#define BIGNUM_FROM2(func) \
static VALUE \
- ossl_bn_from_##func(VALUE self, VALUE str) \
+ ossl_bn_from_s_##func(VALUE self, VALUE str) \
{ \
BIGNUM *bn = NULL; \
\
- Check_Type(str, T_STRING); \
+ str = rb_String(str); \
\
GetBN(self, bn); \
\
@@ -164,9 +164,9 @@ ossl_bn_to_mpi(VALUE self)
return str;
}
-#define BIGNUM_TO_STR(func) \
+#define BIGNUM_TO_S(func) \
static VALUE \
- ossl_bn_to_##func(VALUE self) \
+ ossl_bn_to_s_##func(VALUE self) \
{ \
BIGNUM *bn = NULL; \
char *txt = NULL; \
@@ -669,15 +669,15 @@ Init_bn(VALUE module)
rb_define_singleton_method(cBN, "new", ossl_bn_s_new, -1);
- rb_define_private_method(cBN, "from_s_bin", ossl_bn_from_bin, 1);
- rb_define_private_method(cBN, "from_s_mpi", ossl_bn_from_mpi, 1);
- rb_define_private_method(cBN, "from_s_dec", ossl_bn_from_dec, 1);
- rb_define_private_method(cBN, "from_s_hex", ossl_bn_from_hex, 1);
+ rb_define_private_method(cBN, "from_s_bin", ossl_bn_from_s_bin, 1);
+ rb_define_private_method(cBN, "from_s_mpi", ossl_bn_from_s_mpi, 1);
+ rb_define_private_method(cBN, "from_s_dec", ossl_bn_from_s_dec, 1);
+ rb_define_private_method(cBN, "from_s_hex", ossl_bn_from_s_hex, 1);
- rb_define_method(cBN, "to_s_bin", ossl_bn_to_bin, 0);
- rb_define_method(cBN, "to_s_mpi", ossl_bn_to_mpi, 0);
- rb_define_method(cBN, "to_s_dec", ossl_bn_to_dec, 0);
- rb_define_method(cBN, "to_s_hex", ossl_bn_to_hex, 0);
+ rb_define_method(cBN, "to_s_bin", ossl_bn_to_s_bin, 0);
+ rb_define_method(cBN, "to_s_mpi", ossl_bn_to_s_mpi, 0);
+ rb_define_method(cBN, "to_s_dec", ossl_bn_to_s_dec, 0);
+ rb_define_method(cBN, "to_s_hex", ossl_bn_to_s_hex, 0);
rb_define_method(cBN, "zero?", ossl_bn_is_zero, 0);
rb_define_method(cBN, "one?", ossl_bn_is_one, 0);