mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
raise error when DH param is 0
This commit is contained in:
@@ -725,10 +725,8 @@ ldhsecret(lua_State *L) {
|
||||
read64(L, x, y);
|
||||
uint64_t xx = (uint64_t)x[0] | (uint64_t)x[1]<<32;
|
||||
uint64_t yy = (uint64_t)y[0] | (uint64_t)y[1]<<32;
|
||||
if (xx == 0)
|
||||
xx = 1;
|
||||
if (yy == 0)
|
||||
yy = 1;
|
||||
if (xx == 0 || yy == 0)
|
||||
return luaL_error(L, "Can't be 0");
|
||||
uint64_t r = powmodp(xx, yy);
|
||||
|
||||
push64(L, r);
|
||||
@@ -751,7 +749,7 @@ ldhexchange(lua_State *L) {
|
||||
|
||||
uint64_t x64 = (uint64_t)xx[0] | (uint64_t)xx[1]<<32;
|
||||
if (x64 == 0)
|
||||
x64 = 1;
|
||||
return luaL_error(L, "Can't be 0");
|
||||
|
||||
uint64_t r = powmodp(5, x64);
|
||||
push64(L, r);
|
||||
|
||||
Reference in New Issue
Block a user