aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/openssl.c b/src/openssl.c
index e146098..a73917a 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -1924,8 +1924,9 @@ static int bn__shr(lua_State *L) {
static int bn__unm(lua_State *L) {
BIGNUM *a = checksimple(L, 1, BIGNUM_CLASS);
+ BIGNUM *r = bn_dup(L, a);
- BN_set_negative(a, !BN_is_negative(a));
+ BN_set_negative(r, !BN_is_negative(a));
return 1;
} /* bn__unm() */