aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--teal-src/util/hashes.d.tl2
-rw-r--r--util-src/hashes.c10
-rw-r--r--util/hmac.lua2
3 files changed, 14 insertions, 0 deletions
diff --git a/teal-src/util/hashes.d.tl b/teal-src/util/hashes.d.tl
index cbb06f8e..2784a59b 100644
--- a/teal-src/util/hashes.d.tl
+++ b/teal-src/util/hashes.d.tl
@@ -11,6 +11,8 @@ local record lib
md5 : hash
hmac_sha1 : hmac
hmac_sha256 : hmac
+ hmac_sha224 : hmac
+ hmac_sha384 :hmac
hmac_sha512 : hmac
hmac_md5 : hmac
scram_Hi_sha1 : kdf
diff --git a/util-src/hashes.c b/util-src/hashes.c
index 6b7a28d8..00661531 100644
--- a/util-src/hashes.c
+++ b/util-src/hashes.c
@@ -169,10 +169,18 @@ static int Lhmac_sha1(lua_State *L) {
return Levp_hmac(L, EVP_sha1());
}
+static int Lhmac_sha224(lua_State *L) {
+ return Levp_hmac(L, EVP_sha224());
+}
+
static int Lhmac_sha256(lua_State *L) {
return Levp_hmac(L, EVP_sha256());
}
+static int Lhmac_sha384(lua_State *L) {
+ return Levp_hmac(L, EVP_sha384());
+}
+
static int Lhmac_sha512(lua_State *L) {
return Levp_hmac(L, EVP_sha512());
}
@@ -236,7 +244,9 @@ static const luaL_Reg Reg[] = {
{ "sha512", Lsha512 },
{ "md5", Lmd5 },
{ "hmac_sha1", Lhmac_sha1 },
+ { "hmac_sha224", Lhmac_sha224 },
{ "hmac_sha256", Lhmac_sha256 },
+ { "hmac_sha384", Lhmac_sha384 },
{ "hmac_sha512", Lhmac_sha512 },
{ "hmac_md5", Lhmac_md5 },
{ "scram_Hi_sha1", Lpbkdf2_sha1 }, /* COMPAT */
diff --git a/util/hmac.lua b/util/hmac.lua
index 4cad17cc..994ea93b 100644
--- a/util/hmac.lua
+++ b/util/hmac.lua
@@ -13,6 +13,8 @@ local hashes = require "util.hashes"
return {
md5 = hashes.hmac_md5,
sha1 = hashes.hmac_sha1,
+ sha224 = hashes.hmac_sha224,
sha256 = hashes.hmac_sha256,
+ sha384 = hashes.hmac_sha384,
sha512 = hashes.hmac_sha512,
};