summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-06-29 20:47:28 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-06-29 20:47:28 -0400
commite7d85aa1b6e18fb68b23dfe34bf6cb970ba3d15f (patch)
tree40ac498e72d00490ad38dc0bd5aa6fa114fac345 /lib
parentcdb98133c282ee2fb51430001ad0bd8ee8328f7e (diff)
lib: srp: update session key mac
Use `HmacSha256`.
Diffstat (limited to 'lib')
-rw-r--r--lib/srp.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/srp.go b/lib/srp.go
index 892ba8c..2c165fc 100644
--- a/lib/srp.go
+++ b/lib/srp.go
@@ -254,7 +254,10 @@ func (u *SRPUser) ComputeSessionKey(a *big.Int) error {
}
func (u *SRPUser) SessionKeyMacVerify(mac []byte) bool {
- return u.h.MacVerify(u.salt, u.sk, mac)
+ if BytesEqual(HmacSha256(u.sk, u.salt), mac) {
+ return true
+ }
+ return false
}
func (u *SRPUser) LoggedIn() bool {
@@ -487,5 +490,5 @@ func (s *SRPClientSession) SessionKeyMac(salt []byte) ([]byte, error) {
if len(salt) < 1 {
return nil, CPError{"salt is invalid"}
}
- return s.h.Mac(salt, s.sk), nil
+ return HmacSha256(s.sk, salt), nil
}