Skip to content

Commit

Permalink
Remove use of UeauCommon and start using ueauth from the util repo (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
gab-arrobo authored Feb 6, 2024
1 parent be1c017 commit 9d0d429
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/antonfisher/nested-logrus-formatter v1.3.1
github.com/gin-gonic/gin v1.9.1
github.com/google/uuid v1.6.0
github.com/omec-project/UeauCommon v1.1.0
github.com/omec-project/config5g v1.2.0
github.com/omec-project/http2_util v1.1.0
github.com/omec-project/http_wrapper v1.1.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/omec-project/UeauCommon v1.1.0 h1:ynW22r/Xx/z6saviuzUeNjYlqdJfiMNtNwlv6Ot76Wk=
github.com/omec-project/UeauCommon v1.1.0/go.mod h1:brKbJNGvDPgHcubWt6G45hVuxZ2Crdp/1tKXWw6zTCY=
github.com/omec-project/config5g v1.2.0 h1:fyIg+1LZ9jn8DTkVUbD4jyxA4FgMICdIBwZVnzCyMd4=
github.com/omec-project/config5g v1.2.0/go.mod h1:AWFzCbbgCBx/iJwt+zWbpDGLHRpFzg24OYHqIkdcMVA=
github.com/omec-project/http2_util v1.1.0 h1:8H2NME/V8iONth8TlyK/3w4pguAzaeUnEv9pmeAocwQ=
Expand Down
25 changes: 17 additions & 8 deletions producer/generate_auth_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"strings"

"github.com/antihax/optional"
"github.com/omec-project/UeauCommon"
"github.com/omec-project/http_wrapper"
"github.com/omec-project/milenage"
"github.com/omec-project/openapi"
Expand All @@ -25,6 +24,7 @@ import (
udm_context "github.com/omec-project/udm/context"
"github.com/omec-project/udm/logger"
"github.com/omec-project/udm/util"
"github.com/omec-project/util/ueauth"
"github.com/omec-project/util_3gpp/suci"
)

Expand Down Expand Up @@ -506,21 +506,27 @@ func GenerateAuthDataProcedure(authInfoRequest models.AuthenticationInfoRequest,

// derive XRES*
key := append(CK, IK...)
FC := UeauCommon.FC_FOR_RES_STAR_XRES_STAR_DERIVATION
FC := ueauth.FC_FOR_RES_STAR_XRES_STAR_DERIVATION
P0 := []byte(authInfoRequest.ServingNetworkName)
P1 := RAND
P2 := RES

kdfValForXresStar := UeauCommon.GetKDFValue(
key, FC, P0, UeauCommon.KDFLen(P0), P1, UeauCommon.KDFLen(P1), P2, UeauCommon.KDFLen(P2))
kdfValForXresStar, err := ueauth.GetKDFValue(
key, FC, P0, ueauth.KDFLen(P0), P1, ueauth.KDFLen(P1), P2, ueauth.KDFLen(P2))
if err != nil {
logger.UeauLog.Error(err)
}
xresStar := kdfValForXresStar[len(kdfValForXresStar)/2:]
// fmt.Printf("xresStar = %x\n", xresStar)

// derive Kausf
FC = UeauCommon.FC_FOR_KAUSF_DERIVATION
FC = ueauth.FC_FOR_KAUSF_DERIVATION
P0 = []byte(authInfoRequest.ServingNetworkName)
P1 = SQNxorAK
kdfValForKausf := UeauCommon.GetKDFValue(key, FC, P0, UeauCommon.KDFLen(P0), P1, UeauCommon.KDFLen(P1))
kdfValForKausf, err := ueauth.GetKDFValue(key, FC, P0, ueauth.KDFLen(P0), P1, ueauth.KDFLen(P1))
if err != nil {
logger.UeauLog.Error(err)
}
// fmt.Printf("Kausf = %x\n", kdfValForKausf)

// Fill in rand, xresStar, autn, kausf
Expand All @@ -533,10 +539,13 @@ func GenerateAuthDataProcedure(authInfoRequest models.AuthenticationInfoRequest,

// derive CK' and IK'
key := append(CK, IK...)
FC := UeauCommon.FC_FOR_CK_PRIME_IK_PRIME_DERIVATION
FC := ueauth.FC_FOR_CK_PRIME_IK_PRIME_DERIVATION
P0 := []byte(authInfoRequest.ServingNetworkName)
P1 := SQNxorAK
kdfVal := UeauCommon.GetKDFValue(key, FC, P0, UeauCommon.KDFLen(P0), P1, UeauCommon.KDFLen(P1))
kdfVal, err := ueauth.GetKDFValue(key, FC, P0, ueauth.KDFLen(P0), P1, ueauth.KDFLen(P1))
if err != nil {
logger.UeauLog.Error(err)
}
// fmt.Printf("kdfVal = %x (len = %d)\n", kdfVal, len(kdfVal))

// For TS 35.208 test set 19 & RFC 5448 test vector 1
Expand Down

0 comments on commit 9d0d429

Please sign in to comment.