Update to track current version of bearssl.
This commit is contained in:
1 parent
0870073f08
commit
ac61d90585
7 files changed
+59
-60
No files matched your search
@@ -26,13 +26,13 @@ proc bearHMAC(message: string, alg: JwtAlgorithm, key: string): string =
|
||||
var keyCtx: HmacKeyContext
|
||||
var hmacCtx: HmacContext
|
||||
|
||||
hmacKeyInit(addr keyCtx, vtable, key.cstring, key.len)
|
||||
hmacInit(addr hmacCtx, addr keyCtx, 0)
|
||||
hmacUpdate(addr hmacCtx, message.cstring, message.len)
|
||||
hmacKeyInit(keyCtx, vtable, key.cstring, uint key.len)
|
||||
hmacInit(hmacCtx, keyCtx, uint 0)
|
||||
hmacUpdate(hmacCtx, message.cstring, uint message.len)
|
||||
|
||||
let resLen = hmacSize(addr hmacCtx)
|
||||
let resLen = hmacSize(hmacCtx)
|
||||
result = newString(resLen)
|
||||
discard hmacOut(addr hmacCtx, addr result[0])
|
||||
discard hmacOut(hmacCtx, addr result[0])
|
||||
|
||||
proc hmac*(message: string, alg: JwtAlgorithm, key: string): string =
|
||||
return bearHMAC(message, alg, key)
|
||||
|
||||
Reference in new issue
Block a user