mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 22:19:10 +00:00
Add LuaCrypto compatible functions (plus some auxiliary functions) as per #1136
This commit is contained in:
parent
4ca513cba2
commit
55dcce4f7d
6 changed files with 1161 additions and 1 deletions
2
third_party/mbedtls/config.h
vendored
2
third_party/mbedtls/config.h
vendored
|
@ -71,10 +71,10 @@
|
||||||
/* eliptic curves */
|
/* eliptic curves */
|
||||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||||
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
||||||
|
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
|
||||||
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
|
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
|
||||||
#ifndef TINY
|
#ifndef TINY
|
||||||
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
|
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
|
||||||
/*#define MBEDTLS_ECP_DP_SECP521R1_ENABLED*/
|
|
||||||
/*#define MBEDTLS_ECP_DP_BP384R1_ENABLED*/
|
/*#define MBEDTLS_ECP_DP_BP384R1_ENABLED*/
|
||||||
/*#define MBEDTLS_ECP_DP_SECP192R1_ENABLED*/
|
/*#define MBEDTLS_ECP_DP_SECP192R1_ENABLED*/
|
||||||
/*#define MBEDTLS_ECP_DP_SECP224R1_ENABLED*/
|
/*#define MBEDTLS_ECP_DP_SECP224R1_ENABLED*/
|
||||||
|
|
|
@ -100,6 +100,7 @@ TOOL_NET_REDBEAN_LUA_MODULES = \
|
||||||
o/$(MODE)/tool/net/lmaxmind.o \
|
o/$(MODE)/tool/net/lmaxmind.o \
|
||||||
o/$(MODE)/tool/net/lsqlite3.o \
|
o/$(MODE)/tool/net/lsqlite3.o \
|
||||||
o/$(MODE)/tool/net/largon2.o \
|
o/$(MODE)/tool/net/largon2.o \
|
||||||
|
o/$(MODE)/tool/net/lcrypto.o \
|
||||||
o/$(MODE)/tool/net/launch.o
|
o/$(MODE)/tool/net/launch.o
|
||||||
|
|
||||||
o/$(MODE)/tool/net/redbean.dbg: \
|
o/$(MODE)/tool/net/redbean.dbg: \
|
||||||
|
|
1147
tool/net/lcrypto.c
Normal file
1147
tool/net/lcrypto.c
Normal file
File diff suppressed because it is too large
Load diff
10
tool/net/lcrypto.h
Normal file
10
tool/net/lcrypto.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef COSMOPOLITAN_TOOL_NET_LCRYPTO_H_
|
||||||
|
#define COSMOPOLITAN_TOOL_NET_LCRYPTO_H_
|
||||||
|
#include "third_party/lua/lauxlib.h"
|
||||||
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
|
int LuaCrypto(lua_State *L);
|
||||||
|
int luaopen_lcrypto(lua_State *L);
|
||||||
|
|
||||||
|
COSMOPOLITAN_C_END_
|
||||||
|
#endif /* COSMOPOLITAN_TOOL_NET_LCRYPTO_H_ */
|
|
@ -8,6 +8,7 @@ int LuaMaxmind(lua_State *);
|
||||||
int LuaRe(lua_State *);
|
int LuaRe(lua_State *);
|
||||||
int luaopen_argon2(lua_State *);
|
int luaopen_argon2(lua_State *);
|
||||||
int luaopen_lsqlite3(lua_State *);
|
int luaopen_lsqlite3(lua_State *);
|
||||||
|
int LuaCrypto(lua_State *);
|
||||||
|
|
||||||
int LuaBarf(lua_State *);
|
int LuaBarf(lua_State *);
|
||||||
int LuaBenchmark(lua_State *);
|
int LuaBenchmark(lua_State *);
|
||||||
|
|
|
@ -5426,6 +5426,7 @@ static const luaL_Reg kLuaLibs[] = {
|
||||||
{"path", LuaPath}, //
|
{"path", LuaPath}, //
|
||||||
{"re", LuaRe}, //
|
{"re", LuaRe}, //
|
||||||
{"unix", LuaUnix}, //
|
{"unix", LuaUnix}, //
|
||||||
|
{"crypto", LuaCrypto}, //
|
||||||
};
|
};
|
||||||
|
|
||||||
static void LuaSetArgv(lua_State *L) {
|
static void LuaSetArgv(lua_State *L) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue