mirror of
https://github.com/brunoos/luasec.git
synced 2024-12-27 12:58:21 +01:00
Add popular aliases for commonly used curves
This commit is contained in:
parent
60f02f7701
commit
8762441cd2
31
src/ec.c
31
src/ec.c
@ -40,6 +40,37 @@ void lsec_load_curves(lua_State *L)
|
||||
lua_pushnumber(L, curves[i].nid);
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
switch (curves[i].nid) {
|
||||
case NID_X9_62_prime256v1:
|
||||
lua_pushstring(L, "P-256");
|
||||
lua_pushnumber(L, curves[i].nid);
|
||||
lua_rawset(L, -3);
|
||||
break;
|
||||
case NID_secp384r1:
|
||||
lua_pushstring(L, "P-384");
|
||||
lua_pushnumber(L, curves[i].nid);
|
||||
lua_rawset(L, -3);
|
||||
break;
|
||||
case NID_secp521r1:
|
||||
lua_pushstring(L, "P-521");
|
||||
lua_pushnumber(L, curves[i].nid);
|
||||
lua_rawset(L, -3);
|
||||
break;
|
||||
#ifdef NID_X25519
|
||||
case NID_X25519:
|
||||
lua_pushstring(L, "X25519");
|
||||
lua_pushnumber(L, curves[i].nid);
|
||||
lua_rawset(L, -3);
|
||||
break;
|
||||
#endif
|
||||
#ifdef NID_X448
|
||||
case NID_X448:
|
||||
lua_pushstring(L, "X448");
|
||||
lua_pushnumber(L, curves[i].nid);
|
||||
lua_rawset(L, -3);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
free(curves);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user