mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 15:38:22 +00:00
parent
1bdc8faa65
commit
245a9c206b
1 changed files with 11 additions and 13 deletions
|
@ -3642,7 +3642,8 @@ static int LuaFetch(lua_State *L) {
|
|||
*/
|
||||
DEBUGF("(ftch) client resolving %s", host);
|
||||
if ((rc = getaddrinfo(host, port, &hints, &addr)) != EAI_SUCCESS) {
|
||||
luaL_error(L, "getaddrinfo(%s:%s) error: EAI_%s", host, port, gai_strerror(rc));
|
||||
luaL_error(L, "getaddrinfo(%s:%s) error: EAI_%s", host, port,
|
||||
gai_strerror(rc));
|
||||
unreachable;
|
||||
}
|
||||
|
||||
|
@ -4653,7 +4654,7 @@ static int LuaSha512(lua_State *L) {
|
|||
return LuaHasher(L, 64, mbedtls_sha512_ret_512);
|
||||
}
|
||||
|
||||
static noinline int LuaGetCryptoHash(lua_State *L) {
|
||||
static dontinline int LuaGetCryptoHash(lua_State *L) {
|
||||
size_t hl, pl, kl;
|
||||
uint8_t d[64];
|
||||
mbedtls_md_context_t ctx;
|
||||
|
@ -4667,10 +4668,8 @@ static noinline int LuaGetCryptoHash(lua_State *L) {
|
|||
|
||||
if (kl == 0) {
|
||||
// no key provided, run generic hash function
|
||||
if ((digest->f_md)(p, pl, d))
|
||||
return luaL_error(L, "bad input data");
|
||||
}
|
||||
else if (mbedtls_md_hmac(digest, k, kl, p, pl, d))
|
||||
if ((digest->f_md)(p, pl, d)) return luaL_error(L, "bad input data");
|
||||
} else if (mbedtls_md_hmac(digest, k, kl, p, pl, d))
|
||||
return luaL_error(L, "bad input data");
|
||||
|
||||
lua_pushlstring(L, (void *)d, digest->size);
|
||||
|
@ -6665,9 +6664,8 @@ static void Listen(void) {
|
|||
}
|
||||
if (bind(servers.p[n].fd, &servers.p[n].addr,
|
||||
sizeof(servers.p[n].addr)) == -1) {
|
||||
DIEF("(srvr) bind error: %m: %hhu.%hhu.%hhu.%hhu:%hu",
|
||||
ips.p[i] >> 24, ips.p[i] >> 16, ips.p[i] >> 8, ips.p[i],
|
||||
ports.p[j]);
|
||||
DIEF("(srvr) bind error: %m: %hhu.%hhu.%hhu.%hhu:%hu", ips.p[i] >> 24,
|
||||
ips.p[i] >> 16, ips.p[i] >> 8, ips.p[i], ports.p[j]);
|
||||
}
|
||||
if (listen(servers.p[n].fd, 10) == -1) {
|
||||
DIEF("(srvr) listen error: %m");
|
||||
|
|
Loading…
Add table
Reference in a new issue