Check replay only for AEAD connection

pull/2561/head
Shelikhoo 2020-06-06 20:51:01 +08:00
parent 6a29fa5fe2
commit 9fc37646b6
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
1 changed files with 5 additions and 3 deletions

View File

@ -89,15 +89,17 @@ func (a *AuthIDDecoderHolder) RemoveUser(key [16]byte) {
}
func (a *AuthIDDecoderHolder) Match(AuthID [16]byte) (interface{}, error) {
if !a.apw.Check(AuthID[:]) {
return nil, ErrReplay
}
for _, v := range a.aidhi {
t, z, r, d := v.dec.Decode(AuthID)
if z != crc32.ChecksumIEEE(d[:12]) {
continue
}
if !a.apw.Check(AuthID[:]) {
return nil, ErrReplay
}
if math.Abs(float64(t-time.Now().Unix())) > 120 {
continue
}