aboutsummaryrefslogtreecommitdiffstats
path: root/common/chapters/oap.adoc
blob: 3c5ad358e5ba5747018667036381021d1d7aa0bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
== Osmocom Authentication Protocol (OAP)

=== General
The Osmocom Authentication Protocol employs mutual authentication to
register a client with a server over an IPA connection. Milenage is used
as the authentication algorithm, where client and server have a shared
secret.

For example, an SGSN, as OAP client, may use its SGSN ID to register
with a MAP proxy, an OAP server.

=== Connection

The protocol expects that a reliable, ordered, packet boundaries
preserving connection is used (e.g. IPA over TCP).

=== Using IPA

By default, the following identifiers should be used:
  - IPA protocol: 0xee (OSMO)
  - IPA OSMO protocol extension: 0x06 (OAP)

=== Procedures

.Ideal communication sequence
[mscgen]
----
msc {
	cli [label="Client"], srv [label="Server"];

	cli => srv [label="Register (ID)"];
	cli <= srv [label="Challenge (RAND+AUTN)"];
	cli => srv [label="Challenge Result (XRES)"];
	cli <= srv [label="Register Result"];
}
----

.Variation "test setup"
[mscgen]
----
msc {
	cli [label="Client"], srv [label="Server"];

	cli => srv [label="Register (ID)"];
	cli <= srv [label="Register Result"];
}
----

.Variation "invalid sequence nr":
[mscgen]
----
msc {
	cli [label="Client"], srv [label="Server"];

	cli => srv [label="Register (ID)"];
	cli <= srv [label="Challenge (RAND+AUTN)"];
	cli => srv [label="Sync Request (AUTS)"];
	cli <= srv [label="Challenge (RAND+AUTN')"];
	cli => srv [label="Challenge Result (XRES)"];
	cli <= srv [label="Register Result"];
}
----

==== Register

The client sends a REGISTER_REQ message containing an identifier number.

[[oap-challenge]]
==== Challenge

The OAP server (optionally) sends back a CHALLENGE_REQ, containing random bytes
and a milenage authentication token generated from these random bytes, using a
shared secret, to authenticate itself to the OAP client. The server may omit
this challenge entirely, based on its configuration, and immediately reply with
a Register Result response. If the client cannot be registered (e.g. id is
invalid), the server sends a REGISTER_ERR response.

==== Challenge Result

When the client has received a Challenge, it may verify the server's
authenticity and validity of the sequence number (included in AUTN), and, if
valid, reply with a CHALLENGE_RES message. This shall contain an XRES
authentication token generated by milenage from the same random bytes received
from the server and the same shared secet. If the client decides to cancel the
registration (e.g. invalid AUTN), it shall not reply to the CHALLENGE_REQ; a
CHALLENGE_ERR message may be sent, but is not mandatory. For example, the
client may directly start with a new REGISTER_REQ message.

==== Sync Request

When the client has received a Challenge but sees an invalid sequence number
(embedded in AUTN, according to the milenage algorithm), the client may send a
SYNC_REQ message containing an AUTS synchronisation token.

==== Sync Result

If the server has received a valid Sync Request, it shall answer by directly
sending another Challenge (see <<oap-challenge>>). If an invalid Sync
Request is received, the server shall reply with a REGISTER_ERR message.

==== Register Result

The server sends a REGISTER_RES message to indicate that registration has been
successful. If the server cannot register the client (e.g. invalid challenge
response), it shall send a REGISTER_ERR message.

=== Message Format

Every message is based on the following message format

[options="header",cols="5%,20%,45%,10%,10%,10%"]
|===
|IEI|IE|Type|Presence|Format|Length
|  |Message Type|<<common-oap-ie-msgtype>>|M|V|1
|===

The receiver shall be able to receive IEs in any order. Unknown IEs shall be
ignored.

==== Register Request

Direction: Client -> Server

[options="header",cols="5%,20%,45%,10%,10%,10%"]
|===
|IEI|IE|Type|Presence|Format|Length
|  |Message Type|<<common-oap-ie-msgtype>>|M|V|1
|30|Client ID|<<common-oap-ie-clientid>>|M|TLV|4
|===

==== Register Error

Direction: Server -> Client

[options="header",cols="5%,20%,45%,10%,10%,10%"]
|===
|IEI|IE|Type|Presence|Format|Length
|  |Message Type|<<common-oap-ie-msgtype>>|M|V|1
|02|Cause|GMM Cause, TS 04.08: 10.5.5.14|M|TLV|3
|===

==== Register Result

Direction: Server -> Client

[options="header",cols="5%,20%,45%,10%,10%,10%"]
|===
|IEI|IE|Type|Presence|Format|Length
|  |Message Type|<<common-oap-ie-msgtype>>|M|V|1
|===

==== Challenge

Direction: Server -> Client

[options="header",cols="5%,20%,45%,10%,10%,10%"]
|===
|IEI|IE|Type|Presence|Format|Length
|  |Message Type|<<common-oap-ie-msgtype>>|M|V|1
|20|RAND|octet string (16)|TLV|18
|23|AUTN|octet string (16)|TLV|18
|===

==== Challenge Error

Direction: Client -> Server

[options="header",cols="5%,20%,45%,10%,10%,10%"]
|===
|IEI|IE|Type|Presence|Format|Length
|  |Message Type|<<common-oap-ie-msgtype>>|M|V|1
|02|Cause|GMM Cause, TS 04.08: 10.5.5.14|M|TLV|3
|===

==== Challenge Result

Direction: Client -> Server

[options="header",cols="5%,20%,45%,10%,10%,10%"]
|===
|IEI|IE|Type|Presence|Format|Length
|  |Message Type|<<common-oap-ie-msgtype>>|M|V|1
|21|XRES|octet string (8)|TLV|10
|===

==== Sync Request

Direction: Client -> Server

[options="header",cols="5%,20%,45%,10%,10%,10%"]
|===
|IEI|IE|Type|Presence|Format|Length
|  |Message Type|<<common-oap-ie-msgtype>>|M|V|1
|20|AUTS|octet string (14)|TLV|16
|===

==== Sync Error

Not used.

==== Sync Result

Not used.

=== Information Elements

[[common-oap-ie-msgtype]]
==== Message Type

[options="header",cols="15%,85%"]
|===
|0x04|Register Requst
|0x05|Register Error
|0x06|Register Result
|0x08|Challenge Request
|0x09|Challenge Error
|0x0a|Challenge Result
|0x0c|Sync Request
|0x0d|Sync Error (not used)
|0x0e|Sync Result (not used)
|===

[[common-oap-iei]]
==== IE Identifier (informational)

These are the standard values for the IEI.

[options="header",cols="15%,15%,70%"]
|===
|IEI|Info Element|Type
|0x02|Cause|GMM Cause, 04.08: 10.5.5.14
|0x20|RAND|Octet String
|0x23|AUTN|Octet Strong
|0x24|XRES|Octet String
|0x25|AUTS|Octet String
|0x30|Client ID|big endian integer, 16 bit
|===

[[common-oap-ie-clientid]]
==== Client ID

[packetdiag]
----
{
	colwidth = 32
	node_height = 24

	0-7:	Client ID IEI
	8-15:	Length (2)
	16-31:	Client ID (big endian)
}
----

The Client ID number shall be interpreted as an unsigned 16bit integer, where 0
indicates an invalid / unset ID.