diff options
| -rw-r--r-- | src/openssl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/openssl.c b/src/openssl.c index 2bb5d70..cb7470a 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
| @@ -1755,10 +1755,14 @@ static BN_CTX *getctx(lua_State *L) { | |||
| 1755 | 1755 | ||
| 1756 | static int bn_tobin(lua_State *L) { | 1756 | static int bn_tobin(lua_State *L) { |
| 1757 | BIGNUM *bn = checksimple(L, 1, BIGNUM_CLASS); | 1757 | BIGNUM *bn = checksimple(L, 1, BIGNUM_CLASS); |
| 1758 | size_t len = BN_num_bytes(bn); | 1758 | size_t len; |
| 1759 | unsigned char* dst = lua_newuserdata(L, len); | 1759 | void *dst; |
| 1760 | |||
| 1761 | len = BN_num_bytes(bn); | ||
| 1762 | dst = lua_newuserdata(L, len); | ||
| 1760 | BN_bn2bin(bn, dst); | 1763 | BN_bn2bin(bn, dst); |
| 1761 | lua_pushlstring(L, dst, len); | 1764 | lua_pushlstring(L, dst, len); |
| 1765 | |||
| 1762 | return 1; | 1766 | return 1; |
| 1763 | } /* bn_tobin() */ | 1767 | } /* bn_tobin() */ |
| 1764 | 1768 | ||
