smalltalk
/
osmo-st-gsm
Archived
1
0
Fork 0

GSM48: Handle the AuthRequest and respond with a AuthResponse

This commit is contained in:
Holger Hans Peter Freyther 2010-11-29 20:21:42 +01:00
parent e7c0a15947
commit 373483321d
2 changed files with 52 additions and 1 deletions

31
A3A8.st Normal file
View File

@ -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.
]

View File

@ -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.
]