Skip to content

Commit

Permalink
Revise IKE SA output foramt
Browse files Browse the repository at this point in the history
  • Loading branch information
yt8956gh committed Oct 9, 2021
1 parent cdd9c31 commit 8518436
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/free5gc/logger_conf v1.0.0
github.com/free5gc/logger_util v1.0.0
github.com/free5gc/ngap v1.0.2
github.com/free5gc/openapi v1.0.2 // indirect
github.com/free5gc/openapi v1.0.0 // indirect
github.com/free5gc/path_util v1.0.0
github.com/free5gc/version v1.0.0
github.com/gin-gonic/gin v1.7.4 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ github.com/free5gc/ngap v1.0.2 h1:/89OIJVR0AWdMfiUuoe325RnjlF45UvIFdAxWrrbiYU=
github.com/free5gc/ngap v1.0.2/go.mod h1:n9BWKtM58fxSSjvGFbsYlGiB9B3FAqMAi8ckkOP/X4Q=
github.com/free5gc/openapi v1.0.0 h1:DaGVt05b1pSDBOailKAlLj6hAk6vunN0Nhzvl/xcWCY=
github.com/free5gc/openapi v1.0.0/go.mod h1:7OzxoWBj6KQgznMW2ZiUtZdCGY+t89v4wtgKLhluKgU=
github.com/free5gc/openapi v1.0.2 h1:vcn6iaOIQR0CK1gUVtReQZ1Mbw5vBcYBRkhIJcrR9mQ=
github.com/free5gc/openapi v1.0.2/go.mod h1:8QZ1MGq0GRkOelToQ5mII9aASiTnAWb5eOdGtDy+92g=
github.com/free5gc/path_util v1.0.0 h1:vJPGTymaWtavz6fJ/7k6WKEYv5BQLAq/O04RP54sab0=
github.com/free5gc/path_util v1.0.0/go.mod h1:OpmcebEKrMPnH7Jg5lZ8y9ZWJNAjQ4l9FGWXUv58Mo0=
github.com/free5gc/version v1.0.0 h1:Kn4uOhyHT1IAgerBgWRHag4xLMDXrRsqubLeMv5Nb/w=
Expand Down
31 changes: 24 additions & 7 deletions ike/handler/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,17 @@ func GenerateKeyForIKESA(ikeSecurityAssociation *context.IKESecurityAssociation)
ikeSecurityAssociation.SK_pr = keyStream[:length_SK_pr]
// keyStream = keyStream[length_SK_pr:]

ikeLog.Tracef("SK_d:\n%s", hex.Dump(ikeSecurityAssociation.SK_d))
ikeLog.Tracef("SK_ai:\n%s", hex.Dump(ikeSecurityAssociation.SK_ai))
ikeLog.Tracef("SK_ar:\n%s", hex.Dump(ikeSecurityAssociation.SK_ar))
ikeLog.Tracef("SK_ei:\n%s", hex.Dump(ikeSecurityAssociation.SK_ei))
ikeLog.Tracef("SK_er:\n%s", hex.Dump(ikeSecurityAssociation.SK_er))
ikeLog.Tracef("SK_pi:\n%s", hex.Dump(ikeSecurityAssociation.SK_pi))
ikeLog.Tracef("SK_pr:\n%s", hex.Dump(ikeSecurityAssociation.SK_pr))
ikeLog.Debugln("====== IKE Security Association Info =====")
ikeLog.Debugf("Remote SPI: %016x", ikeSecurityAssociation.RemoteSPI)
ikeLog.Debugf("Local SPI: %016x", ikeSecurityAssociation.LocalSPI)
ikeLog.Debugf("Encryption Algorithm: %d", ikeSecurityAssociation.EncryptionAlgorithm.TransformID)
ikeLog.Debugf("SK_ei: %x", ikeSecurityAssociation.SK_ei)
ikeLog.Debugf("SK_er: %x", ikeSecurityAssociation.SK_er)
ikeLog.Debugf("Integrity Algorithm: %d", ikeSecurityAssociation.IntegrityAlgorithm.TransformID)
ikeLog.Debugf("SK_ai: %x", ikeSecurityAssociation.SK_ai)
ikeLog.Debugf("SK_ar: %x", ikeSecurityAssociation.SK_ar)
ikeLog.Debugf("SK_pi: %x", ikeSecurityAssociation.SK_pi)
ikeLog.Debugf("SK_pr: %x", ikeSecurityAssociation.SK_pr)

return nil
}
Expand Down Expand Up @@ -528,6 +532,19 @@ func GenerateKeyForChildSA(ikeSecurityAssociation *context.IKESecurityAssociatio
childSecurityAssociation.ResponderToInitiatorIntegrityKey =
append(childSecurityAssociation.ResponderToInitiatorIntegrityKey, keyStream[:lengthIntegrityKeyIPSec]...)

ikeLog.Debugln("====== IPSec/Child SA: Initiator To Responder =====")
ikeLog.Debugf("IPSec SPI: %016x", childSecurityAssociation.SPI)
ikeLog.Debugf("IPSec Encryption Algorithm: %d", childSecurityAssociation.EncryptionAlgorithm)
ikeLog.Debugf("IPSec Encryption Key: %x", childSecurityAssociation.InitiatorToResponderEncryptionKey)
ikeLog.Debugf("IPSec Integrity Algorithm: %d", childSecurityAssociation.IntegrityAlgorithm)
ikeLog.Debugf("IPSec Integrity Key: %x", childSecurityAssociation.InitiatorToResponderIntegrityKey)
ikeLog.Debugln("====== IPSec/Child SA: Responder To Initiator =====")
ikeLog.Debugf("IPSec SPI: %016x", childSecurityAssociation.SPI)
ikeLog.Debugf("IPSec Encryption Algorithm: %d", childSecurityAssociation.EncryptionAlgorithm)
ikeLog.Debugf("IPSec Encryption Key: %x", childSecurityAssociation.ResponderToInitiatorEncryptionKey)
ikeLog.Debugf("IPSec Integrity Algorithm: %d", childSecurityAssociation.IntegrityAlgorithm)
ikeLog.Debugf("IPSec Integrity Key: %x", childSecurityAssociation.ResponderToInitiatorIntegrityKey)

return nil
}

Expand Down

0 comments on commit 8518436

Please sign in to comment.