GSM48: Handle the AuthRequest and respond with a AuthResponse
This commit is contained in:
parent
e7c0a15947
commit
373483321d
|
@ -0,0 +1,31 @@
|
|||
Object subclass: A3A8 [
|
||||
A3A8 class >> initialize [
|
||||
DLD addLibrary: 'liba3a8.so'
|
||||
]
|
||||
|
||||
A3A8 class >> COMP128_v3: aKI rand: aRand [
|
||||
| str |
|
||||
|
||||
aKI size = 16 ifFalse: [
|
||||
^ self error: 'KI needs to be 16 bytes'
|
||||
].
|
||||
|
||||
aRand size = 16 ifFalse: [
|
||||
^ self error: 'RAND needs to be 16 bytes'
|
||||
].
|
||||
|
||||
|
||||
str := ByteArray new: 16.
|
||||
self int_COMP128_v3: aKI rand: aRand res: (CObject new storage: str).
|
||||
|
||||
^ str
|
||||
]
|
||||
|
||||
A3A8 class >> int_COMP128_v3: aKI rand: aRand res: aRes [
|
||||
<cCall: 'COMP128_3' returning: #void args: #(#string #string #cObject)>
|
||||
]
|
||||
]
|
||||
|
||||
Eval [
|
||||
A3A8 initialize.
|
||||
]
|
22
GSMDriver.st
22
GSMDriver.st
|
@ -75,6 +75,26 @@ classes.'>
|
|||
aMsg inspect.
|
||||
]
|
||||
|
||||
auKey [
|
||||
^ ByteArray new: 16
|
||||
]
|
||||
|
||||
dispatchDTAP: aMsg [
|
||||
<category: 'private'>
|
||||
aMsg class messageType = GSM48MMMessage msgAuReq ifTrue: [
|
||||
| auth resp |
|
||||
auth := A3A8 COMP128_v3: self auKey rand: aMsg auth data.
|
||||
resp := GSM48AuthResp new.
|
||||
resp sres data: (auth copyFrom: 1 to: 4).
|
||||
|
||||
sccp nextPutData: (BSSAPDTAP initWith: resp linkIdentifier: 0).
|
||||
^ true
|
||||
].
|
||||
|
||||
'Unhandled DTAP message' printNl.
|
||||
aMsg inspect.
|
||||
]
|
||||
|
||||
dispatch: aMsg [
|
||||
<category: 'protected'>
|
||||
aMsg class msgType = BSSAPHelper msgManagemnt
|
||||
|
@ -82,7 +102,7 @@ classes.'>
|
|||
self dispatchMan: aMsg data.
|
||||
]
|
||||
ifFalse: [
|
||||
'DTAP message' printNl.
|
||||
self dispatchDTAP: aMsg data.
|
||||
].
|
||||
aMsg inspect.
|
||||
]
|
||||
|
|
Reference in New Issue