mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +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);
|
read64(L, x, y);
|
||||||
uint64_t xx = (uint64_t)x[0] | (uint64_t)x[1]<<32;
|
uint64_t xx = (uint64_t)x[0] | (uint64_t)x[1]<<32;
|
||||||
uint64_t yy = (uint64_t)y[0] | (uint64_t)y[1]<<32;
|
uint64_t yy = (uint64_t)y[0] | (uint64_t)y[1]<<32;
|
||||||
if (xx == 0)
|
if (xx == 0 || yy == 0)
|
||||||
xx = 1;
|
return luaL_error(L, "Can't be 0");
|
||||||
if (yy == 0)
|
|
||||||
yy = 1;
|
|
||||||
uint64_t r = powmodp(xx, yy);
|
uint64_t r = powmodp(xx, yy);
|
||||||
|
|
||||||
push64(L, r);
|
push64(L, r);
|
||||||
@@ -751,7 +749,7 @@ ldhexchange(lua_State *L) {
|
|||||||
|
|
||||||
uint64_t x64 = (uint64_t)xx[0] | (uint64_t)xx[1]<<32;
|
uint64_t x64 = (uint64_t)xx[0] | (uint64_t)xx[1]<<32;
|
||||||
if (x64 == 0)
|
if (x64 == 0)
|
||||||
x64 = 1;
|
return luaL_error(L, "Can't be 0");
|
||||||
|
|
||||||
uint64_t r = powmodp(5, x64);
|
uint64_t r = powmodp(5, x64);
|
||||||
push64(L, r);
|
push64(L, r);
|
||||||
|
|||||||
Reference in New Issue
Block a user