[VOL-4934] MIC (AES-128) calculation in omci-lib-go does not properly support the Extended Message Set
Change-Id: I74eefe457c57ee8470114c698ef75eee6a7ab534
diff --git a/vendor/github.com/opencord/omci-lib-go/v2/VERSION b/vendor/github.com/opencord/omci-lib-go/v2/VERSION
index b1b25a5..5859406 100644
--- a/vendor/github.com/opencord/omci-lib-go/v2/VERSION
+++ b/vendor/github.com/opencord/omci-lib-go/v2/VERSION
@@ -1 +1 @@
-2.2.2
+2.2.3
diff --git a/vendor/github.com/opencord/omci-lib-go/v2/omci.go b/vendor/github.com/opencord/omci-lib-go/v2/omci.go
index f778382..f14c781 100644
--- a/vendor/github.com/opencord/omci-lib-go/v2/omci.go
+++ b/vendor/github.com/opencord/omci-lib-go/v2/omci.go
@@ -198,18 +198,23 @@
}
func calculateMicAes128(data []byte) (uint32, error) {
- // See if upstream or downstream
+ // See if upstream or downstream. OMCI header should have been validated before this call
var downstreamCDir = [...]byte{0x01}
var upstreamCDir = [...]byte{0x02}
tid := binary.BigEndian.Uint16(data[0:2])
+
+ var length = 44
+ if DeviceIdent(data[3]) == ExtendedIdent {
+ length = 10 + int(binary.BigEndian.Uint16(data[8:10]))
+ }
var sum []byte
var err error
if (data[2]&me.AK) == me.AK || tid == 0 {
- sum, err = aes.Sum(append(upstreamCDir[:], data[:44]...), omciIK, 4)
+ sum, err = aes.Sum(append(upstreamCDir[:], data[:length]...), omciIK, 4)
} else {
- sum, err = aes.Sum(append(downstreamCDir[:], data[:44]...), omciIK, 4)
+ sum, err = aes.Sum(append(downstreamCDir[:], data[:length]...), omciIK, 4)
}
if err != nil {
return 0, err