diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/openssl.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/openssl.c b/src/openssl.c index ffe3d4f..ed7222e 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
@@ -2427,7 +2427,7 @@ static BN_CTX *getctx(lua_State *L) { | |||
2427 | } /* getctx() */ | 2427 | } /* getctx() */ |
2428 | 2428 | ||
2429 | 2429 | ||
2430 | static int bn_tobin(lua_State *L) { | 2430 | static int bn_toBinary(lua_State *L) { |
2431 | BIGNUM *bn = checksimple(L, 1, BIGNUM_CLASS); | 2431 | BIGNUM *bn = checksimple(L, 1, BIGNUM_CLASS); |
2432 | size_t len; | 2432 | size_t len; |
2433 | void *dst; | 2433 | void *dst; |
@@ -2438,7 +2438,7 @@ static int bn_tobin(lua_State *L) { | |||
2438 | lua_pushlstring(L, dst, len); | 2438 | lua_pushlstring(L, dst, len); |
2439 | 2439 | ||
2440 | return 1; | 2440 | return 1; |
2441 | } /* bn_tobin() */ | 2441 | } /* bn_toBinary() */ |
2442 | 2442 | ||
2443 | 2443 | ||
2444 | static int bn__add(lua_State *L) { | 2444 | static int bn__add(lua_State *L) { |
@@ -2669,7 +2669,7 @@ static int bn_isPrime(lua_State *L) { | |||
2669 | 2669 | ||
2670 | static BIO *getbio(lua_State *); | 2670 | static BIO *getbio(lua_State *); |
2671 | 2671 | ||
2672 | static int bn_todec(lua_State *L) { | 2672 | static int bn_toDecimal(lua_State *L) { |
2673 | BIGNUM *bn = checksimple(L, 1, BIGNUM_CLASS); | 2673 | BIGNUM *bn = checksimple(L, 1, BIGNUM_CLASS); |
2674 | char *txt = NULL; | 2674 | char *txt = NULL; |
2675 | BIO *bio; | 2675 | BIO *bio; |
@@ -2694,11 +2694,11 @@ static int bn_todec(lua_State *L) { | |||
2694 | sslerr: | 2694 | sslerr: |
2695 | OPENSSL_free(txt); | 2695 | OPENSSL_free(txt); |
2696 | 2696 | ||
2697 | return auxL_error(L, auxL_EOPENSSL, "bignum:todec"); | 2697 | return auxL_error(L, auxL_EOPENSSL, "bignum:toDecimal"); |
2698 | } /* bn_todec() */ | 2698 | } /* bn_toDecimal() */ |
2699 | 2699 | ||
2700 | 2700 | ||
2701 | static int bn_tohex(lua_State *L) { | 2701 | static int bn_toHex(lua_State *L) { |
2702 | BIGNUM *bn = checksimple(L, 1, BIGNUM_CLASS); | 2702 | BIGNUM *bn = checksimple(L, 1, BIGNUM_CLASS); |
2703 | char *txt = NULL; | 2703 | char *txt = NULL; |
2704 | BIO *bio; | 2704 | BIO *bio; |
@@ -2723,27 +2723,31 @@ static int bn_tohex(lua_State *L) { | |||
2723 | sslerr: | 2723 | sslerr: |
2724 | OPENSSL_free(txt); | 2724 | OPENSSL_free(txt); |
2725 | 2725 | ||
2726 | return auxL_error(L, auxL_EOPENSSL, "bignum:tohex"); | 2726 | return auxL_error(L, auxL_EOPENSSL, "bignum:toHex"); |
2727 | } /* bn_tohex() */ | 2727 | } /* bn_toHex() */ |
2728 | 2728 | ||
2729 | 2729 | ||
2730 | static const auxL_Reg bn_methods[] = { | 2730 | static const auxL_Reg bn_methods[] = { |
2731 | { "add", &bn__add }, | 2731 | { "add", &bn__add }, |
2732 | { "sub", &bn__sub }, | 2732 | { "sub", &bn__sub }, |
2733 | { "mul", &bn__mul }, | 2733 | { "mul", &bn__mul }, |
2734 | { "sqr", &bn_sqr }, | 2734 | { "sqr", &bn_sqr }, |
2735 | { "idiv", &bn__idiv }, | 2735 | { "idiv", &bn__idiv }, |
2736 | { "mod", &bn__mod }, | 2736 | { "mod", &bn__mod }, |
2737 | { "nnmod", &bn_nnmod }, | 2737 | { "nnmod", &bn_nnmod }, |
2738 | { "exp", &bn__pow }, | 2738 | { "exp", &bn__pow }, |
2739 | { "gcd", &bn_gcd }, | 2739 | { "gcd", &bn_gcd }, |
2740 | { "lshift", &bn__shl }, | 2740 | { "lshift", &bn__shl }, |
2741 | { "rshift", &bn__shr }, | 2741 | { "rshift", &bn__shr }, |
2742 | { "isPrime", &bn_isPrime }, | 2742 | { "isPrime", &bn_isPrime }, |
2743 | { "tobin", &bn_tobin }, | 2743 | { "toBinary", &bn_toBinary }, |
2744 | { "todec", &bn_todec }, | 2744 | { "toDecimal", &bn_toDecimal }, |
2745 | { "tohex", &bn_tohex }, | 2745 | { "toHex", &bn_toHex }, |
2746 | { NULL, NULL }, | 2746 | /* deprecated */ |
2747 | { "tobin", &bn_toBinary }, | ||
2748 | { "todec", &bn_toDecimal }, | ||
2749 | { "tohex", &bn_toHex }, | ||
2750 | { NULL, NULL }, | ||
2747 | }; | 2751 | }; |
2748 | 2752 | ||
2749 | static const auxL_Reg bn_metatable[] = { | 2753 | static const auxL_Reg bn_metatable[] = { |
@@ -2761,7 +2765,7 @@ static const auxL_Reg bn_metatable[] = { | |||
2761 | { "__lt", &bn__lt }, | 2765 | { "__lt", &bn__lt }, |
2762 | { "__le", &bn__le }, | 2766 | { "__le", &bn__le }, |
2763 | { "__gc", &bn__gc }, | 2767 | { "__gc", &bn__gc }, |
2764 | { "__tostring", &bn_todec }, | 2768 | { "__tostring", &bn_toDecimal }, |
2765 | { NULL, NULL }, | 2769 | { NULL, NULL }, |
2766 | }; | 2770 | }; |
2767 | 2771 | ||