Supreeth Herle | 475dcaa | 2020-03-20 18:57:39 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 3 | # without this, pylint will fail when inner classes are used |
| 4 | # within the 'nested' kwarg of our TlvMeta metaclass on python 3.7 :( |
| 5 | # pylint: disable=undefined-variable |
| 6 | |
Supreeth Herle | 475dcaa | 2020-03-20 18:57:39 +0100 | [diff] [blame] | 7 | """ |
Harald Welte | 2f83103 | 2021-04-20 23:54:53 +0200 | [diff] [blame] | 8 | Various constants from 3GPP TS 31.102 V16.6.0 |
Supreeth Herle | 475dcaa | 2020-03-20 18:57:39 +0100 | [diff] [blame] | 9 | """ |
| 10 | |
| 11 | # |
| 12 | # Copyright (C) 2020 Supreeth Herle <herlesupreeth@gmail.com> |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 13 | # Copyright (C) 2021 Harald Welte <laforge@osmocom.org> |
Supreeth Herle | 475dcaa | 2020-03-20 18:57:39 +0100 | [diff] [blame] | 14 | # |
| 15 | # This program is free software: you can redistribute it and/or modify |
| 16 | # it under the terms of the GNU General Public License as published by |
| 17 | # the Free Software Foundation, either version 2 of the License, or |
| 18 | # (at your option) any later version. |
| 19 | # |
| 20 | # This program is distributed in the hope that it will be useful, |
| 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | # GNU General Public License for more details. |
| 24 | # |
| 25 | # You should have received a copy of the GNU General Public License |
| 26 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 27 | # |
| 28 | |
| 29 | # Mapping between USIM Service Number and its description |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 30 | import pySim.ts_102_221 |
| 31 | from pySim.ts_51_011 import EF_ACMmax, EF_AAeM, EF_eMLPP, EF_CMI, EF_PNN |
| 32 | from pySim.ts_51_011 import EF_MMSN, EF_MMSICP, EF_MMSUP, EF_MMSUCP, EF_VGCS, EF_VGCSS, EF_NIA |
| 33 | from pySim.ts_51_011 import EF_SMSR, EF_DCK, EF_EXT, EF_CNL, EF_OPL, EF_MBI, EF_MWIS |
| 34 | from pySim.ts_51_011 import EF_CBMID, EF_CBMIR, EF_ADN, EF_SMS, EF_MSISDN, EF_SMSP, EF_SMSS |
| 35 | from pySim.ts_51_011 import EF_IMSI, EF_xPLMNwAcT, EF_SPN, EF_CBMI, EF_ACC, EF_PLMNsel |
| 36 | from pySim.ts_102_221 import EF_ARR |
| 37 | from pySim.tlv import * |
| 38 | from pySim.filesystem import * |
| 39 | from pySim.construct import * |
| 40 | from construct import Optional as COptional |
| 41 | from construct import * |
| 42 | from typing import Tuple |
| 43 | from struct import unpack, pack |
| 44 | import enum |
Supreeth Herle | 475dcaa | 2020-03-20 18:57:39 +0100 | [diff] [blame] | 45 | EF_UST_map = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 46 | 1: 'Local Phone Book', |
| 47 | 2: 'Fixed Dialling Numbers (FDN)', |
| 48 | 3: 'Extension 2', |
| 49 | 4: 'Service Dialling Numbers (SDN)', |
| 50 | 5: 'Extension3', |
| 51 | 6: 'Barred Dialling Numbers (BDN)', |
| 52 | 7: 'Extension4', |
| 53 | 8: 'Outgoing Call Information (OCI and OCT)', |
| 54 | 9: 'Incoming Call Information (ICI and ICT)', |
| 55 | 10: 'Short Message Storage (SMS)', |
| 56 | 11: 'Short Message Status Reports (SMSR)', |
| 57 | 12: 'Short Message Service Parameters (SMSP)', |
| 58 | 13: 'Advice of Charge (AoC)', |
| 59 | 14: 'Capability Configuration Parameters 2 (CCP2)', |
| 60 | 15: 'Cell Broadcast Message Identifier', |
| 61 | 16: 'Cell Broadcast Message Identifier Ranges', |
| 62 | 17: 'Group Identifier Level 1', |
| 63 | 18: 'Group Identifier Level 2', |
| 64 | 19: 'Service Provider Name', |
| 65 | 20: 'User controlled PLMN selector with Access Technology', |
| 66 | 21: 'MSISDN', |
| 67 | 22: 'Image (IMG)', |
| 68 | 23: 'Support of Localised Service Areas (SoLSA)', |
| 69 | 24: 'Enhanced Multi-Level Precedence and Pre-emption Service', |
| 70 | 25: 'Automatic Answer for eMLPP', |
| 71 | 26: 'RFU', |
| 72 | 27: 'GSM Access', |
| 73 | 28: 'Data download via SMS-PP', |
| 74 | 29: 'Data download via SMS-CB', |
| 75 | 30: 'Call Control by USIM', |
| 76 | 31: 'MO-SMS Control by USIM', |
| 77 | 32: 'RUN AT COMMAND command', |
| 78 | 33: 'shall be set to 1', |
| 79 | 34: 'Enabled Services Table', |
| 80 | 35: 'APN Control List (ACL)', |
| 81 | 36: 'Depersonalisation Control Keys', |
| 82 | 37: 'Co-operative Network List', |
| 83 | 38: 'GSM security context', |
| 84 | 39: 'CPBCCH Information', |
| 85 | 40: 'Investigation Scan', |
| 86 | 41: 'MexE', |
| 87 | 42: 'Operator controlled PLMN selector with Access Technology', |
| 88 | 43: 'HPLMN selector with Access Technology', |
| 89 | 44: 'Extension 5', |
| 90 | 45: 'PLMN Network Name', |
| 91 | 46: 'Operator PLMN List', |
| 92 | 47: 'Mailbox Dialling Numbers', |
| 93 | 48: 'Message Waiting Indication Status', |
| 94 | 49: 'Call Forwarding Indication Status', |
| 95 | 50: 'Reserved and shall be ignored', |
| 96 | 51: 'Service Provider Display Information', |
| 97 | 52: 'Multimedia Messaging Service (MMS)', |
| 98 | 53: 'Extension 8', |
| 99 | 54: 'Call control on GPRS by USIM', |
| 100 | 55: 'MMS User Connectivity Parameters', |
| 101 | 56: 'Network\'s indication of alerting in the MS (NIA)', |
| 102 | 57: 'VGCS Group Identifier List (EFVGCS and EFVGCSS)', |
| 103 | 58: 'VBS Group Identifier List (EFVBS and EFVBSS)', |
| 104 | 59: 'Pseudonym', |
| 105 | 60: 'User Controlled PLMN selector for I-WLAN access', |
| 106 | 61: 'Operator Controlled PLMN selector for I-WLAN access', |
| 107 | 62: 'User controlled WSID list', |
| 108 | 63: 'Operator controlled WSID list', |
| 109 | 64: 'VGCS security', |
| 110 | 65: 'VBS security', |
| 111 | 66: 'WLAN Reauthentication Identity', |
| 112 | 67: 'Multimedia Messages Storage', |
| 113 | 68: 'Generic Bootstrapping Architecture (GBA)', |
| 114 | 69: 'MBMS security', |
| 115 | 70: 'Data download via USSD and USSD application mode', |
| 116 | 71: 'Equivalent HPLMN', |
| 117 | 72: 'Additional TERMINAL PROFILE after UICC activation', |
| 118 | 73: 'Equivalent HPLMN Presentation Indication', |
| 119 | 74: 'Last RPLMN Selection Indication', |
| 120 | 75: 'OMA BCAST Smart Card Profile', |
| 121 | 76: 'GBA-based Local Key Establishment Mechanism', |
| 122 | 77: 'Terminal Applications', |
| 123 | 78: 'Service Provider Name Icon', |
| 124 | 79: 'PLMN Network Name Icon', |
| 125 | 80: 'Connectivity Parameters for USIM IP connections', |
| 126 | 81: 'Home I-WLAN Specific Identifier List', |
| 127 | 82: 'I-WLAN Equivalent HPLMN Presentation Indication', |
| 128 | 83: 'I-WLAN HPLMN Priority Indication', |
| 129 | 84: 'I-WLAN Last Registered PLMN', |
| 130 | 85: 'EPS Mobility Management Information', |
| 131 | 86: 'Allowed CSG Lists and corresponding indications', |
| 132 | 87: 'Call control on EPS PDN connection by USIM', |
| 133 | 88: 'HPLMN Direct Access', |
| 134 | 89: 'eCall Data', |
| 135 | 90: 'Operator CSG Lists and corresponding indications', |
| 136 | 91: 'Support for SM-over-IP', |
| 137 | 92: 'Support of CSG Display Control', |
| 138 | 93: 'Communication Control for IMS by USIM', |
| 139 | 94: 'Extended Terminal Applications', |
| 140 | 95: 'Support of UICC access to IMS', |
| 141 | 96: 'Non-Access Stratum configuration by USIM', |
| 142 | 97: 'PWS configuration by USIM', |
| 143 | 98: 'RFU', |
| 144 | 99: 'URI support by UICC', |
| 145 | 100: 'Extended EARFCN support', |
| 146 | 101: 'ProSe', |
| 147 | 102: 'USAT Application Pairing', |
| 148 | 103: 'Media Type support', |
| 149 | 104: 'IMS call disconnection cause', |
| 150 | 105: 'URI support for MO SHORT MESSAGE CONTROL', |
| 151 | 106: 'ePDG configuration Information support', |
| 152 | 107: 'ePDG configuration Information configured', |
| 153 | 108: 'ACDC support', |
| 154 | 109: 'MCPTT', |
| 155 | 110: 'ePDG configuration Information for Emergency Service support', |
| 156 | 111: 'ePDG configuration Information for Emergency Service configured', |
| 157 | 112: 'eCall Data over IMS', |
| 158 | 113: 'URI support for SMS-PP DOWNLOAD as defined in 3GPP TS 31.111 [12]', |
| 159 | 114: 'From Preferred', |
| 160 | 115: 'IMS configuration data', |
| 161 | 116: 'TV configuration', |
| 162 | 117: '3GPP PS Data Off', |
| 163 | 118: '3GPP PS Data Off Service List', |
| 164 | 119: 'V2X', |
| 165 | 120: 'XCAP Configuration Data', |
| 166 | 121: 'EARFCN list for MTC/NB-IOT UEs', |
| 167 | 122: '5GS Mobility Management Information', |
| 168 | 123: '5G Security Parameters', |
| 169 | 124: 'Subscription identifier privacy support', |
| 170 | 125: 'SUCI calculation by the USIM', |
| 171 | 126: 'UAC Access Identities support', |
| 172 | 127: 'Expect control plane-based Steering of Roaming information during initial registration in VPLMN', |
| 173 | 128: 'Call control on PDU Session by USIM', |
| 174 | 129: '5GS Operator PLMN List', |
| 175 | 130: 'Support for SUPI of type NSI or GLI or GCI', |
| 176 | 131: '3GPP PS Data Off separate Home and Roaming lists', |
| 177 | 132: 'Support for URSP by USIM', |
| 178 | 133: '5G Security Parameters extended', |
| 179 | 134: 'MuD and MiD configuration data', |
| 180 | 135: 'Support for Trusted non-3GPP access networks by USIM' |
Sebastian Viviani | 0dc8f69 | 2020-05-29 00:14:55 +0100 | [diff] [blame] | 181 | } |
| 182 | |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 183 | # Mapping between USIM Enbled Service Number and its description |
| 184 | EF_EST_map = { |
| 185 | 1: 'Fixed Dialling Numbers (FDN)', |
| 186 | 2: 'Barred Dialling Numbers (BDN)', |
| 187 | 3: 'APN Control List (ACL)' |
| 188 | } |
| 189 | |
Sebastian Viviani | e61170c | 2020-06-03 08:57:00 +0100 | [diff] [blame] | 190 | LOCI_STATUS_map = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 191 | 0: 'updated', |
| 192 | 1: 'not updated', |
| 193 | 2: 'plmn not allowed', |
| 194 | 3: 'locatation area not allowed' |
Sebastian Viviani | e61170c | 2020-06-03 08:57:00 +0100 | [diff] [blame] | 195 | } |
herlesupreeth | a562ea0 | 2020-09-16 20:17:22 +0200 | [diff] [blame] | 196 | |
Sebastian Viviani | 0dc8f69 | 2020-05-29 00:14:55 +0100 | [diff] [blame] | 197 | EF_USIM_ADF_map = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 198 | 'LI': '6F05', |
| 199 | 'ARR': '6F06', |
| 200 | 'IMSI': '6F07', |
| 201 | 'Keys': '6F08', |
| 202 | 'KeysPS': '6F09', |
| 203 | 'DCK': '6F2C', |
| 204 | 'HPPLMN': '6F31', |
| 205 | 'CNL': '6F32', |
| 206 | 'ACMmax': '6F37', |
| 207 | 'UST': '6F38', |
| 208 | 'ACM': '6F39', |
| 209 | 'FDN': '6F3B', |
| 210 | 'SMS': '6F3C', |
| 211 | 'GID1': '6F3E', |
| 212 | 'GID2': '6F3F', |
| 213 | 'MSISDN': '6F40', |
| 214 | 'PUCT': '6F41', |
| 215 | 'SMSP': '6F42', |
| 216 | 'SMSS': '6F42', |
| 217 | 'CBMI': '6F45', |
| 218 | 'SPN': '6F46', |
| 219 | 'SMSR': '6F47', |
| 220 | 'CBMID': '6F48', |
| 221 | 'SDN': '6F49', |
| 222 | 'EXT2': '6F4B', |
| 223 | 'EXT3': '6F4C', |
| 224 | 'BDN': '6F4D', |
| 225 | 'EXT5': '6F4E', |
| 226 | 'CCP2': '6F4F', |
| 227 | 'CBMIR': '6F50', |
| 228 | 'EXT4': '6F55', |
| 229 | 'EST': '6F56', |
| 230 | 'ACL': '6F57', |
| 231 | 'CMI': '6F58', |
| 232 | 'START-HFN': '6F5B', |
| 233 | 'THRESHOLD': '6F5C', |
| 234 | 'PLMNwAcT': '6F60', |
| 235 | 'OPLMNwAcT': '6F61', |
| 236 | 'HPLMNwAcT': '6F62', |
| 237 | 'PSLOCI': '6F73', |
| 238 | 'ACC': '6F78', |
| 239 | 'FPLMN': '6F7B', |
| 240 | 'LOCI': '6F7E', |
| 241 | 'ICI': '6F80', |
| 242 | 'OCI': '6F81', |
| 243 | 'ICT': '6F82', |
| 244 | 'OCT': '6F83', |
| 245 | 'AD': '6FAD', |
| 246 | 'VGCS': '6FB1', |
| 247 | 'VGCSS': '6FB2', |
| 248 | 'VBS': '6FB3', |
| 249 | 'VBSS': '6FB4', |
| 250 | 'eMLPP': '6FB5', |
| 251 | 'AAeM': '6FB6', |
| 252 | 'ECC': '6FB7', |
| 253 | 'Hiddenkey': '6FC3', |
| 254 | 'NETPAR': '6FC4', |
| 255 | 'PNN': '6FC5', |
| 256 | 'OPL': '6FC6', |
| 257 | 'MBDN': '6FC7', |
| 258 | 'EXT6': '6FC8', |
| 259 | 'MBI': '6FC9', |
| 260 | 'MWIS': '6FCA', |
| 261 | 'CFIS': '6FCB', |
| 262 | 'EXT7': '6FCC', |
| 263 | 'SPDI': '6FCD', |
| 264 | 'MMSN': '6FCE', |
| 265 | 'EXT8': '6FCF', |
| 266 | 'MMSICP': '6FD0', |
| 267 | 'MMSUP': '6FD1', |
| 268 | 'MMSUCP': '6FD2', |
| 269 | 'NIA': '6FD3', |
| 270 | 'VGCSCA': '6FD4', |
| 271 | 'VBSCA': '6FD5', |
| 272 | 'GBAP': '6FD6', |
| 273 | 'MSK': '6FD7', |
| 274 | 'MUK': '6FD8', |
| 275 | 'EHPLMN': '6FD9', |
| 276 | 'GBANL': '6FDA', |
| 277 | 'EHPLMNPI': '6FDB', |
| 278 | 'LRPLMNSI': '6FDC', |
| 279 | 'NAFKCA': '6FDD', |
| 280 | 'SPNI': '6FDE', |
| 281 | 'PNNI': '6FDF', |
| 282 | 'NCP-IP': '6FE2', |
| 283 | 'EPSLOCI': '6FE3', |
| 284 | 'EPSNSC': '6FE4', |
| 285 | 'UFC': '6FE6', |
| 286 | 'UICCIARI': '6FE7', |
| 287 | 'NASCONFIG': '6FE8', |
| 288 | 'PWC': '6FEC', |
| 289 | 'FDNURI': '6FED', |
| 290 | 'BDNURI': '6FEE', |
| 291 | 'SDNURI': '6FEF', |
| 292 | 'IWL': '6FF0', |
| 293 | 'IPS': '6FF1', |
| 294 | 'IPD': '6FF2', |
| 295 | 'ePDGId': '6FF3', |
| 296 | 'ePDGSelection': '6FF4', |
| 297 | 'ePDGIdEm': '6FF5', |
| 298 | 'ePDGSelectionEm': '6FF6', |
Sebastian Viviani | 0dc8f69 | 2020-05-29 00:14:55 +0100 | [diff] [blame] | 299 | } |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 300 | |
| 301 | ###################################################################### |
| 302 | # ADF.USIM |
| 303 | ###################################################################### |
| 304 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 305 | |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 306 | # 3GPP TS 31.102 Section 4.4.11.4 (EF_5GS3GPPNSC) |
| 307 | class EF_5GS3GPPNSC(LinFixedEF): |
| 308 | class NgKSI(BER_TLV_IE, tag=0x80): |
| 309 | _construct = Int8ub |
| 310 | |
| 311 | class K_AMF(BER_TLV_IE, tag=0x81): |
| 312 | _construct = HexAdapter(Bytes(32)) |
| 313 | |
| 314 | class UplinkNASCount(BER_TLV_IE, tag=0x82): |
| 315 | _construct = Int32ub |
| 316 | |
| 317 | class DownlinkNASCount(BER_TLV_IE, tag=0x83): |
| 318 | _construct = Int32ub |
| 319 | |
| 320 | class IdsOfSelectedNasAlgos(BER_TLV_IE, tag=0x84): |
| 321 | # 3GPP TS 24.501 Section 9.11.3.34 |
| 322 | _construct = BitStruct('ciphering'/Nibble, 'integrity'/Nibble) |
| 323 | |
| 324 | class IdsOfSelectedEpsAlgos(BER_TLV_IE, tag=0x85): |
| 325 | # 3GPP TS 24.301 Section 9.9.3.23 |
| 326 | _construct = BitStruct('ciphering'/Nibble, 'integrity'/Nibble) |
| 327 | |
| 328 | class FiveGSNasSecurityContext(BER_TLV_IE, tag=0xA0, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 329 | nested=[NgKSI, K_AMF, UplinkNASCount, |
| 330 | DownlinkNASCount, IdsOfSelectedNasAlgos, |
| 331 | IdsOfSelectedEpsAlgos]): |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 332 | pass |
| 333 | |
| 334 | def __init__(self, fid="4f03", sfid=0x03, name='EF.5GS3GPPNSC', rec_len={57, None}, |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 335 | desc='5GS 3GPP Access NAS Security Context', **kwargs): |
| 336 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 6551627 | 2022-02-10 17:51:05 +0100 | [diff] [blame] | 337 | self._tlv = EF_5GS3GPPNSC.FiveGSNasSecurityContext |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 338 | |
| 339 | # 3GPP TS 31.102 Section 4.4.11.6 |
| 340 | class EF_5GAUTHKEYS(TransparentEF): |
| 341 | class K_AUSF(BER_TLV_IE, tag=0x80): |
| 342 | _construct = HexAdapter(GreedyBytes) |
| 343 | |
| 344 | class K_SEAF(BER_TLV_IE, tag=0x81): |
| 345 | _construct = HexAdapter(GreedyBytes) |
| 346 | |
| 347 | class FiveGAuthKeys(TLV_IE_Collection, nested=[K_AUSF, K_SEAF]): |
| 348 | pass |
| 349 | |
| 350 | def __init__(self, fid='4f05', sfid=0x05, name='EF.5GAUTHKEYS', size={68, None}, |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 351 | desc='5G authentication keys', **kwargs): |
| 352 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 6551627 | 2022-02-10 17:51:05 +0100 | [diff] [blame] | 353 | self._tlv = EF_5GAUTHKEYS.FiveGAuthKeys |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 354 | |
| 355 | # 3GPP TS 31.102 Section 4.4.11.8 |
| 356 | class ProtSchemeIdList(BER_TLV_IE, tag=0xa0): |
| 357 | # FIXME: 3GPP TS 24.501 Protection Scheme Identifier |
| 358 | # repeated sequence of (id, index) tuples |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 359 | _construct = GreedyRange( |
| 360 | Struct('id'/Enum(Byte, null=0, A=1, B=2), 'index'/Int8ub)) |
| 361 | |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 362 | |
| 363 | class HomeNetPubKeyId(BER_TLV_IE, tag=0x80): |
| 364 | # 3GPP TS 24.501 / 3GPP TS 23.003 |
| 365 | _construct = Int8ub |
| 366 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 367 | |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 368 | class HomeNetPubKey(BER_TLV_IE, tag=0x81): |
| 369 | # FIXME: RFC 5480 |
| 370 | _construct = HexAdapter(GreedyBytes) |
| 371 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 372 | |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 373 | class HomeNetPubKeyList(BER_TLV_IE, tag=0xa1, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 374 | nested=[HomeNetPubKeyId, HomeNetPubKey]): |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 375 | pass |
| 376 | |
| 377 | # 3GPP TS 31.102 Section 4.4.11.6 |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 378 | class SUCI_CalcInfo(TLV_IE_Collection, nested=[ProtSchemeIdList, HomeNetPubKeyList]): |
Harald Welte | f12979d | 2021-05-29 21:47:13 +0200 | [diff] [blame] | 379 | pass |
| 380 | |
| 381 | |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 382 | # TS 31.102 4.4.11.8 |
| 383 | class EF_SUCI_Calc_Info(TransparentEF): |
| 384 | def __init__(self, fid="4f07", sfid=0x07, name='EF.SUCI_Calc_Info', size={2, None}, |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 385 | desc='SUCI Calc Info', **kwargs): |
| 386 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 387 | |
| 388 | def _encode_prot_scheme_id_list(self, in_list): |
| 389 | out_bytes = [0xa0] |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 390 | out_bytes.append(len(in_list)*2) # two byte per entry |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 391 | |
| 392 | # position in list determines priority; high-priority items (low index) come first |
| 393 | for scheme in sorted(in_list, key=lambda item: item["priority"]): |
| 394 | out_bytes.append(scheme["identifier"]) |
| 395 | out_bytes.append(scheme["key_index"]) |
| 396 | |
| 397 | return out_bytes |
| 398 | |
| 399 | def _encode_hnet_pubkey_list(self, hnet_pubkey_list): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 400 | out_bytes = [0xa1] # pubkey list tag |
| 401 | out_bytes.append(0x00) # length filled later |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 402 | length = 0 |
| 403 | |
| 404 | for key in hnet_pubkey_list: |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 405 | out_bytes.append(0x80) # identifier tag |
| 406 | out_bytes.append(0x01) # TODO size, fixed to 1 byte |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 407 | out_bytes.append(key["hnet_pubkey_identifier"]) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 408 | out_bytes.append(0x81) # key tag |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 409 | out_bytes.append(len(key["hnet_pubkey"])//2) |
| 410 | length += 5+len(key["hnet_pubkey"])//2 |
| 411 | |
| 412 | pubkey_bytes = h2b(key["hnet_pubkey"]) |
| 413 | out_bytes += pubkey_bytes |
| 414 | |
| 415 | # fill length |
| 416 | out_bytes[1] = length |
| 417 | return out_bytes |
| 418 | |
| 419 | def _encode_hex(self, in_json): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 420 | out_bytes = self._encode_prot_scheme_id_list( |
| 421 | in_json['prot_scheme_id_list']) |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 422 | out_bytes += self._encode_hnet_pubkey_list(in_json['hnet_pubkey_list']) |
| 423 | return "".join(["%02X" % i for i in out_bytes]) |
| 424 | |
| 425 | def _decode_prot_scheme_id_list(self, in_bytes): |
| 426 | prot_scheme_id_list = [] |
| 427 | pos = 0 |
| 428 | # two bytes per entry |
| 429 | while pos < len(in_bytes): |
| 430 | prot_scheme = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 431 | 'priority': pos//2, # first in list: high priority |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 432 | 'identifier': in_bytes[pos], |
| 433 | 'key_index': in_bytes[pos+1] |
| 434 | } |
| 435 | pos += 2 |
| 436 | prot_scheme_id_list.append(prot_scheme) |
| 437 | return prot_scheme_id_list |
| 438 | |
| 439 | def _decode_hnet_pubkey_list(self, in_bytes): |
| 440 | hnet_pubkey_list = [] |
| 441 | pos = 0 |
| 442 | if in_bytes[pos] != 0xa1: |
| 443 | print("missing Home Network Public Key List data object") |
| 444 | return {} |
| 445 | pos += 1 |
| 446 | hnet_pubkey_list_len = in_bytes[pos] |
| 447 | pos += 1 |
| 448 | |
| 449 | while pos < hnet_pubkey_list_len: |
| 450 | if in_bytes[pos] != 0x80: |
| 451 | print("missing Home Network Public Key Identifier tag") |
| 452 | return {} |
| 453 | pos += 1 |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 454 | # TODO might be more than 1 byte? |
| 455 | hnet_pubkey_id_len = in_bytes[pos] |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 456 | pos += 1 |
| 457 | hnet_pubkey_id = in_bytes[pos:pos+hnet_pubkey_id_len][0] |
| 458 | pos += hnet_pubkey_id_len |
| 459 | if in_bytes[pos] != 0x81: |
| 460 | print("missing Home Network Public Key tag") |
| 461 | return {} |
| 462 | pos += 1 |
| 463 | hnet_pubkey_len = in_bytes[pos] |
| 464 | pos += 1 |
| 465 | hnet_pubkey = in_bytes[pos:pos+hnet_pubkey_len] |
| 466 | pos += hnet_pubkey_len |
| 467 | |
| 468 | hnet_pubkey_list.append({ |
| 469 | 'hnet_pubkey_identifier': hnet_pubkey_id, |
| 470 | 'hnet_pubkey': b2h(hnet_pubkey) |
| 471 | }) |
| 472 | |
| 473 | return hnet_pubkey_list |
| 474 | |
| 475 | def _decode_bin(self, in_bin): |
Vadim Yanitskiy | 5e41eeb | 2021-05-02 02:20:33 +0200 | [diff] [blame] | 476 | return self._decode_hex(b2h(in_bin)) |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 477 | |
| 478 | def _decode_hex(self, in_hex): |
| 479 | in_bytes = h2b(in_hex) |
| 480 | pos = 0 |
| 481 | |
| 482 | if in_bytes[pos] != 0xa0: |
| 483 | print("missing Protection Scheme Identifier List data object tag") |
| 484 | return {} |
| 485 | pos += 1 |
| 486 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 487 | prot_scheme_id_list_len = in_bytes[pos] # TODO maybe more than 1 byte |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 488 | pos += 1 |
| 489 | # decode Protection Scheme Identifier List data object |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 490 | prot_scheme_id_list = self._decode_prot_scheme_id_list( |
| 491 | in_bytes[pos:pos+prot_scheme_id_list_len]) |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 492 | pos += prot_scheme_id_list_len |
| 493 | |
| 494 | # remaining data holds Home Network Public Key Data Object |
| 495 | hnet_pubkey_list = self._decode_hnet_pubkey_list(in_bytes[pos:]) |
| 496 | |
| 497 | return { |
| 498 | 'prot_scheme_id_list': prot_scheme_id_list, |
| 499 | 'hnet_pubkey_list': hnet_pubkey_list |
| 500 | } |
| 501 | |
| 502 | def _encode_bin(self, in_json): |
| 503 | return h2b(self._encode_hex(in_json)) |
| 504 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 505 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 506 | class EF_LI(TransRecEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 507 | def __init__(self, fid='6f05', sfid=None, name='EF.LI', size={2, None}, rec_len=2, |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 508 | desc='Language Indication'): |
| 509 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 510 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 511 | def _decode_record_bin(self, in_bin): |
| 512 | if in_bin == b'\xff\xff': |
| 513 | return None |
| 514 | else: |
| 515 | # officially this is 7-bit GSM alphabet with one padding bit in each byte |
| 516 | return in_bin.decode('ascii') |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 517 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 518 | def _encode_record_bin(self, in_json): |
| 519 | if in_json == None: |
| 520 | return b'\xff\xff' |
| 521 | else: |
| 522 | # officially this is 7-bit GSM alphabet with one padding bit in each byte |
| 523 | return in_json.encode('ascii') |
| 524 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 525 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 526 | class EF_Keys(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 527 | def __init__(self, fid='6f08', sfid=0x08, name='EF.Keys', size={33, 33}, |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 528 | desc='Ciphering and Integrity Keys'): |
| 529 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 530 | self._construct = Struct( |
| 531 | 'ksi'/Int8ub, 'ck'/HexAdapter(Bytes(16)), 'ik'/HexAdapter(Bytes(16))) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 532 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 533 | # TS 31.102 Section 4.2.6 |
| 534 | class EF_HPPLMN(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 535 | def __init__(self, fid='6f31', sfid=0x12, name='EF.HPPLMN', size={1, 1}, |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 536 | desc='Higher Priority PLMN search period'): |
| 537 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
| 538 | self._construct = Int8ub |
| 539 | |
| 540 | # TS 31.102 Section 4.2.8 |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 541 | class EF_UServiceTable(TransparentEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 542 | def __init__(self, fid, sfid, name, desc, size, table, **kwargs): |
| 543 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 544 | self.table = table |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 545 | |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 546 | @staticmethod |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 547 | def _bit_byte_offset_for_service(service: int) -> Tuple[int, int]: |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 548 | i = service - 1 |
| 549 | byte_offset = i//8 |
| 550 | bit_offset = (i % 8) |
| 551 | return (byte_offset, bit_offset) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 552 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 553 | def _decode_bin(self, in_bin): |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 554 | ret = {} |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 555 | for i in range(0, len(in_bin)): |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 556 | byte = in_bin[i] |
Harald Welte | dd45d8e | 2022-02-25 15:16:39 +0100 | [diff] [blame^] | 557 | for bitno in range(0, 8): |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 558 | service_nr = i * 8 + bitno + 1 |
| 559 | ret[service_nr] = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 560 | 'activated': True if byte & (1 << bitno) else False |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 561 | } |
| 562 | if service_nr in self.table: |
| 563 | ret[service_nr]['description'] = self.table[service_nr] |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 564 | return ret |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 565 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 566 | def _encode_bin(self, in_json): |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 567 | # compute the required binary size |
| 568 | bin_len = 0 |
| 569 | for srv in in_json.keys(): |
| 570 | service_nr = int(srv) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 571 | (byte_offset, bit_offset) = EF_UServiceTable._bit_byte_offset_for_service( |
| 572 | service_nr) |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 573 | if byte_offset >= bin_len: |
| 574 | bin_len = byte_offset+1 |
| 575 | # encode the actual data |
| 576 | out = bytearray(b'\x00' * bin_len) |
| 577 | for srv in in_json.keys(): |
| 578 | service_nr = int(srv) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 579 | (byte_offset, bit_offset) = EF_UServiceTable._bit_byte_offset_for_service( |
| 580 | service_nr) |
Harald Welte | e894749 | 2022-02-10 10:33:20 +0100 | [diff] [blame] | 581 | if in_json[srv]['activated'] == True: |
| 582 | bit = 1 |
| 583 | else: |
| 584 | bit = 0 |
| 585 | out[byte_offset] |= (bit) << bit_offset |
| 586 | return out |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 587 | |
Harald Welte | 82f75c2 | 2022-02-12 18:22:28 +0100 | [diff] [blame] | 588 | def get_active_services(self, cmd): |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 589 | # obtain list of currently active services |
| 590 | (service_data, sw) = cmd.rs.read_binary_dec() |
| 591 | active_services = [] |
| 592 | for s in service_data.keys(): |
| 593 | if service_data[s]['activated']: |
| 594 | active_services.append(s) |
Harald Welte | 82f75c2 | 2022-02-12 18:22:28 +0100 | [diff] [blame] | 595 | return active_services |
| 596 | |
| 597 | def ust_service_check(self, cmd): |
| 598 | """Check consistency between services of this file and files present/activated""" |
| 599 | num_problems = 0 |
| 600 | # obtain list of currently active services |
| 601 | active_services = self.get_active_services(cmd) |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 602 | # iterate over all the service-constraints we know of |
| 603 | files_by_service = self.parent.files_by_service |
| 604 | try: |
| 605 | for s in sorted(files_by_service.keys()): |
| 606 | active_str = 'active' if s in active_services else 'inactive' |
| 607 | cmd.poutput("Checking service No %u (%s)" % (s, active_str)) |
| 608 | for f in files_by_service[s]: |
| 609 | should_exist = f.should_exist_for_services(active_services) |
| 610 | try: |
Harald Welte | aceb2a5 | 2022-02-12 21:41:59 +0100 | [diff] [blame] | 611 | cmd.rs.select_file(f) |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 612 | exists = True |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 613 | except SwMatchError as e: |
| 614 | sw = str(e) |
| 615 | exists = False |
| 616 | if exists != should_exist: |
Harald Welte | 82f75c2 | 2022-02-12 18:22:28 +0100 | [diff] [blame] | 617 | num_problems += 1 |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 618 | if exists: |
Harald Welte | fa8b8d1 | 2022-02-12 18:30:28 +0100 | [diff] [blame] | 619 | cmd.perror(" ERROR: File %s is selectable but should not!" % f) |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 620 | else: |
Harald Welte | fa8b8d1 | 2022-02-12 18:30:28 +0100 | [diff] [blame] | 621 | cmd.perror(" ERROR: File %s is not selectable (%s) but should!" % (f, sw)) |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 622 | finally: |
| 623 | # re-select the EF.UST |
Harald Welte | aceb2a5 | 2022-02-12 21:41:59 +0100 | [diff] [blame] | 624 | cmd.rs.select_file(self) |
Harald Welte | 82f75c2 | 2022-02-12 18:22:28 +0100 | [diff] [blame] | 625 | return num_problems |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 626 | |
| 627 | class EF_UST(EF_UServiceTable): |
| 628 | def __init__(self, **kwargs): |
| 629 | super().__init__(fid='6f38', sfid=0x04, name='EF.UST', desc='USIM Service Table', size={1,17}, table=EF_UST_map, **kwargs) |
| 630 | # add those commands to the general commands of a TransparentEF |
| 631 | self.shell_commands += [self.AddlShellCommands()] |
| 632 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 633 | @with_default_category('File-Specific Commands') |
| 634 | class AddlShellCommands(CommandSet): |
| 635 | def __init__(self): |
| 636 | super().__init__() |
| 637 | |
| 638 | def do_ust_service_activate(self, arg): |
| 639 | """Activate a service within EF.UST""" |
| 640 | self._cmd.card.update_ust(int(arg), 1) |
| 641 | |
| 642 | def do_ust_service_deactivate(self, arg): |
| 643 | """Deactivate a service within EF.UST""" |
| 644 | self._cmd.card.update_ust(int(arg), 0) |
| 645 | |
Harald Welte | 4c5e231 | 2022-02-12 14:37:48 +0100 | [diff] [blame] | 646 | def do_ust_service_check(self, arg): |
Harald Welte | 3bb516b | 2022-02-12 21:53:18 +0100 | [diff] [blame] | 647 | """Check consistency between services of this file and files present/activated. |
| 648 | |
| 649 | Many services determine if one or multiple files shall be present/activated or if they shall be |
| 650 | absent/deactivated. This performs a consistency check to ensure that no services are activated |
| 651 | for files that are not - and vice-versa, no files are activated for services that are not. Error |
| 652 | messages are printed for every inconsistency found.""" |
Harald Welte | 4c5e231 | 2022-02-12 14:37:48 +0100 | [diff] [blame] | 653 | selected_file = self._cmd.rs.selected_file |
Harald Welte | 82f75c2 | 2022-02-12 18:22:28 +0100 | [diff] [blame] | 654 | num_problems = selected_file.ust_service_check(self._cmd) |
| 655 | # obtain list of currently active services |
| 656 | active_services = selected_file.get_active_services(self._cmd) |
| 657 | # Service n°46 can only be declared "available" if service n°45 is declared "available" |
| 658 | if 46 in active_services and not 45 in active_services: |
Harald Welte | fa8b8d1 | 2022-02-12 18:30:28 +0100 | [diff] [blame] | 659 | self._cmd.perror("ERROR: Service 46 available, but it requires Service 45") |
Harald Welte | 82f75c2 | 2022-02-12 18:22:28 +0100 | [diff] [blame] | 660 | num_problems += 1 |
| 661 | # Service n°125 shall only be taken into account if Service n°124 is declared "available" |
| 662 | if 125 in active_services and not 124 in active_services: |
Harald Welte | fa8b8d1 | 2022-02-12 18:30:28 +0100 | [diff] [blame] | 663 | self._cmd.perror("ERROR: Service 125 is ignored as Service 124 not available") |
Harald Welte | 82f75c2 | 2022-02-12 18:22:28 +0100 | [diff] [blame] | 664 | num_problems += 1 |
| 665 | # Service n°95, n°99 and n°115 shall not be declared "available" if an ISIM application is present on the UICC |
| 666 | non_isim_services = [95, 99, 115] |
| 667 | app_names = selected_file.get_mf().get_app_names() |
| 668 | if 'ADF.ISIM' in app_names: |
| 669 | for s in non_isim_services: |
| 670 | if s in active_services: |
Harald Welte | fa8b8d1 | 2022-02-12 18:30:28 +0100 | [diff] [blame] | 671 | self._cmd.perror("ERROR: Service %u shall not be available as ISIM application is present" % s) |
Harald Welte | 82f75c2 | 2022-02-12 18:22:28 +0100 | [diff] [blame] | 672 | num_problems += 1 |
| 673 | self._cmd.poutput("===> %u service / file inconsistencies detected" % num_problems) |
Harald Welte | 4c5e231 | 2022-02-12 14:37:48 +0100 | [diff] [blame] | 674 | |
| 675 | |
Harald Welte | 89e5954 | 2021-04-02 21:33:13 +0200 | [diff] [blame] | 676 | # TS 31.103 Section 4.2.7 - *not* the same as DF.GSM/EF.ECC! |
| 677 | class EF_ECC(LinFixedEF): |
Harald Welte | ff2d86d | 2022-01-21 15:19:47 +0100 | [diff] [blame] | 678 | cc_construct = Rpad(BcdAdapter(Rpad(Bytes(3))), pattern='f') |
| 679 | category_construct = FlagsEnum(Byte, police=1, ambulance=2, fire_brigade=3, marine_guard=4, |
| 680 | mountain_rescue=5, manual_ecall=6, automatic_ecall=7) |
| 681 | alpha_construct = GsmStringAdapter(Rpad(GreedyBytes)) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 682 | |
Harald Welte | 89e5954 | 2021-04-02 21:33:13 +0200 | [diff] [blame] | 683 | def __init__(self, fid='6fb7', sfid=0x01, name='EF.ECC', |
| 684 | desc='Emergency Call Codes'): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 685 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={4, 20}) |
| 686 | |
Harald Welte | ff2d86d | 2022-01-21 15:19:47 +0100 | [diff] [blame] | 687 | def _decode_record_bin(self, in_bin): |
| 688 | # mandatory parts |
| 689 | code = in_bin[:3] |
| 690 | if code == b'\xff\xff\xff': |
| 691 | return None |
| 692 | svc_category = in_bin[-1:] |
| 693 | ret = {'call_code': parse_construct(EF_ECC.cc_construct, code), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 694 | 'service_category': parse_construct(EF_ECC.category_construct, svc_category)} |
Harald Welte | ff2d86d | 2022-01-21 15:19:47 +0100 | [diff] [blame] | 695 | # optional alpha identifier |
| 696 | if len(in_bin) > 4: |
| 697 | alpha_id = in_bin[3:-1] |
| 698 | ret['alpha_id'] = parse_construct(EF_ECC.alpha_construct, alpha_id) |
| 699 | return ret |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 700 | |
Harald Welte | ff2d86d | 2022-01-21 15:19:47 +0100 | [diff] [blame] | 701 | def _encode_record_bin(self, in_json): |
| 702 | if in_json is None: |
| 703 | return b'\xff\xff\xff\xff' |
| 704 | code = EF_ECC.cc_construct.build(in_json['call_code']) |
| 705 | svc_category = EF_ECC.category_construct.build(in_json['category']) |
| 706 | alpha_id = EF_ECC.alpha_construct.build(in_json['alpha_id']) |
| 707 | # FIXME: alpha_id needs padding up to 'record_length - 4' |
| 708 | return code + alpha_id + svc_category |
| 709 | |
Harald Welte | 89e5954 | 2021-04-02 21:33:13 +0200 | [diff] [blame] | 710 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 711 | # TS 31.102 Section 4.2.17 |
| 712 | class EF_LOCI(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 713 | def __init__(self, fid='6f7e', sfid=0x0b, name='EF.LOCI', desc='Location information', size={11, 11}): |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 714 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
| 715 | self._construct = Struct('tmsi'/HexAdapter(Bytes(4)), 'lai'/HexAdapter(Bytes(5)), 'rfu'/Int8ub, |
| 716 | 'lu_status'/Int8ub) |
Harald Welte | 592b32e | 2021-06-05 11:26:36 +0200 | [diff] [blame] | 717 | # TS 31.102 Section 4.2.18 |
| 718 | class EF_AD(TransparentEF): |
| 719 | class OP_MODE(enum.IntEnum): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 720 | normal = 0x00 |
| 721 | type_approval = 0x80 |
| 722 | normal_and_specific_facilities = 0x01 |
| 723 | type_approval_and_specific_facilities = 0x81 |
| 724 | maintenance_off_line = 0x02 |
| 725 | cell_test = 0x04 |
Harald Welte | 592b32e | 2021-06-05 11:26:36 +0200 | [diff] [blame] | 726 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 727 | def __init__(self, fid='6fad', sfid=0x03, name='EF.AD', desc='Administrative Data', size={4, 6}): |
Harald Welte | 592b32e | 2021-06-05 11:26:36 +0200 | [diff] [blame] | 728 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
| 729 | self._construct = BitStruct( |
| 730 | # Byte 1 |
| 731 | 'ms_operation_mode'/Bytewise(Enum(Byte, EF_AD.OP_MODE)), |
| 732 | # Byte 2 + 3 |
| 733 | 'additional_info'/Bytewise(FlagsEnum(Int16ub, ciphering_indicator=1, csg_display_control=2, |
| 734 | prose_services=4, extended_drx=8)), |
| 735 | 'rfu'/BitsRFU(4), |
| 736 | 'mnc_len'/BitsInteger(4), |
| 737 | 'extensions'/COptional(Bytewise(GreedyBytesRFU)) |
| 738 | ) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 739 | |
| 740 | # TS 31.102 Section 4.2.23 |
| 741 | class EF_PSLOCI(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 742 | def __init__(self, fid='6f73', sfid=0x0c, name='EF.PSLOCI', desc='PS Location information', size={14, 14}): |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 743 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
| 744 | self._construct = Struct('ptmsi'/HexAdapter(Bytes(4)), 'ptmsi_sig'/HexAdapter(Bytes(3)), |
| 745 | 'rai'/HexAdapter(Bytes(6)), 'rau_status'/Int8ub) |
| 746 | |
| 747 | # TS 31.102 Section 4.2.33 |
| 748 | class EF_ICI(CyclicEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 749 | def __init__(self, fid='6f80', sfid=0x14, name='EF.ICI', rec_len={28, 48}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 750 | desc='Incoming Call Information', **kwargs): |
| 751 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 752 | self._construct = Struct('alpha_id'/Bytes(this._.total_len-28), |
| 753 | 'len_of_bcd_contents'/Int8ub, |
| 754 | 'ton_npi'/Int8ub, |
| 755 | 'call_number'/BcdAdapter(Bytes(10)), |
| 756 | 'cap_cfg2_record_id'/Int8ub, |
| 757 | 'ext5_record_id'/Int8ub, |
| 758 | 'date_and_time'/BcdAdapter(Bytes(7)), |
| 759 | 'duration'/Int24ub, |
| 760 | 'status'/Byte, |
| 761 | 'link_to_phonebook'/Bytes(3)) |
| 762 | |
| 763 | # TS 31.102 Section 4.2.34 |
| 764 | class EF_OCI(CyclicEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 765 | def __init__(self, fid='6f81', sfid=0x15, name='EF.OCI', rec_len={27, 47}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 766 | desc='Outgoing Call Information', **kwargs): |
| 767 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 768 | self._construct = Struct('alpha_id'/Bytes(this._.total_len-27), |
| 769 | 'len_of_bcd_contents'/Int8ub, |
| 770 | 'ton_npi'/Int8ub, |
| 771 | 'call_number'/BcdAdapter(Bytes(10)), |
| 772 | 'cap_cfg2_record_id'/Int8ub, |
| 773 | 'ext5_record_id'/Int8ub, |
| 774 | 'date_and_time'/BcdAdapter(Bytes(7)), |
| 775 | 'duration'/Int24ub, |
| 776 | 'link_to_phonebook'/Bytes(3)) |
| 777 | |
| 778 | # TS 31.102 Section 4.2.35 |
| 779 | class EF_ICT(CyclicEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 780 | def __init__(self, fid='6f82', sfid=None, name='EF.ICT', rec_len={3, 3}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 781 | desc='Incoming Call Timer', **kwargs): |
| 782 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 783 | self._construct = Struct('accumulated_call_timer'/Int24ub) |
| 784 | |
| 785 | # TS 31.102 Section 4.2.38 |
| 786 | class EF_CCP2(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 787 | def __init__(self, fid='6f4f', sfid=0x16, name='EF.CCP2', desc='Capability Configuration Parameters 2', **kwargs): |
| 788 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={15, None}, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 789 | |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 790 | # TS 31.102 Section 4.2.47 |
| 791 | class EF_EST(EF_UServiceTable): |
| 792 | def __init__(self, **kwargs): |
| 793 | super().__init__(fid='6f56', sfid=0x05, name='EF.EST', desc='Enabled Services Table', size={1,None}, table=EF_EST_map, **kwargs) |
| 794 | # add those commands to the general commands of a TransparentEF |
| 795 | self.shell_commands += [self.AddlShellCommands()] |
| 796 | |
| 797 | @with_default_category('File-Specific Commands') |
| 798 | class AddlShellCommands(CommandSet): |
| 799 | def __init__(self): |
| 800 | super().__init__() |
| 801 | |
| 802 | def do_est_service_activate(self, arg): |
| 803 | """Activate a service within EF.UST""" |
| 804 | self._cmd.card.update_est(int(arg), 1) |
| 805 | |
| 806 | def do_est_service_deactivate(self, arg): |
| 807 | """Deactivate a service within EF.UST""" |
| 808 | self._cmd.card.update_est(int(arg), 0) |
| 809 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 810 | # TS 31.102 Section 4.2.48 |
| 811 | class EF_ACL(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 812 | def __init__(self, fid='6f57', sfid=None, name='EF.ACL', size={32, None}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 813 | desc='Access Point Name Control List', **kwargs): |
| 814 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 815 | self._construct = Struct('num_of_apns'/Int8ub, 'tlvs'/GreedyBytes) |
| 816 | |
| 817 | # TS 31.102 Section 4.2.51 |
| 818 | class EF_START_HFN(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 819 | def __init__(self, fid='6f5b', sfid=0x0f, name='EF.START-HFN', size={6, 6}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 820 | desc='Initialisation values for Hyperframe number', **kwargs): |
| 821 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 822 | self._construct = Struct('start_cs'/Int24ub, 'start_ps'/Int24ub) |
| 823 | |
| 824 | # TS 31.102 Section 4.2.52 |
| 825 | class EF_THRESHOLD(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 826 | def __init__(self, fid='6f5c', sfid=0x10, name='EF.THRESHOLD', size={3, 3}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 827 | desc='Maximum value of START', **kwargs): |
| 828 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 829 | self._construct = Struct('max_start'/Int24ub) |
| 830 | |
| 831 | # TS 31.102 Section 4.2.77 |
| 832 | class EF_VGCSCA(TransRecEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 833 | def __init__(self, fid='6fd4', sfid=None, name='EF.VGCSCA', size={2, 100}, rec_len=2, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 834 | desc='Voice Group Call Service Ciphering Algorithm', **kwargs): |
| 835 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 836 | self._construct = Struct('alg_v_ki_1'/Int8ub, 'alg_v_ki_2'/Int8ub) |
| 837 | |
| 838 | # TS 31.102 Section 4.2.79 |
| 839 | class EF_GBABP(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 840 | def __init__(self, fid='6fd6', sfid=None, name='EF.GBABP', size={3, 50}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 841 | desc='GBA Bootstrapping parameters', **kwargs): |
| 842 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 843 | self._construct = Struct('rand'/LV, 'b_tid'/LV, 'key_lifetime'/LV) |
| 844 | |
| 845 | # TS 31.102 Section 4.2.80 |
| 846 | class EF_MSK(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 847 | def __init__(self, fid='6fd7', sfid=None, name='EF.MSK', desc='MBMS Service Key List', **kwargs): |
| 848 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={20, None}, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 849 | msk_ts_constr = Struct('msk_id'/Int32ub, 'timestamp_counter'/Int32ub) |
| 850 | self._construct = Struct('key_domain_id'/Bytes(3), |
| 851 | 'num_msk_id'/Int8ub, |
| 852 | 'msk_ids'/msk_ts_constr[this.num_msk_id]) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 853 | # TS 31.102 Section 4.2.81 |
| 854 | class EF_MUK(LinFixedEF): |
| 855 | class MUK_Idr(BER_TLV_IE, tag=0x80): |
| 856 | _construct = HexAdapter(GreedyBytes) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 857 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 858 | class MUK_Idi(BER_TLV_IE, tag=0x82): |
| 859 | _construct = HexAdapter(GreedyBytes) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 860 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 861 | class MUK_ID(BER_TLV_IE, tag=0xA0, nested=[MUK_Idr, MUK_Idi]): |
| 862 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 863 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 864 | class TimeStampCounter(BER_TLV_IE, tag=0x81): |
| 865 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 866 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 867 | class EF_MUK_Collection(TLV_IE_Collection, nested=[MUK_ID, TimeStampCounter]): |
| 868 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 869 | |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 870 | def __init__(self, fid='6fd8', sfid=None, name='EF.MUK', desc='MBMS User Key', **kwargs): |
| 871 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={None, None}, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 872 | self._tlv = EF_MUK.EF_MUK_Collection |
| 873 | |
| 874 | # TS 31.102 Section 4.2.83 |
| 875 | class EF_GBANL(LinFixedEF): |
| 876 | class NAF_ID(BER_TLV_IE, tag=0x80): |
| 877 | _construct = HexAdapter(GreedyBytes) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 878 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 879 | class B_TID(BER_TLV_IE, tag=0x81): |
| 880 | _construct = HexAdapter(GreedyBytes) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 881 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 882 | class EF_GBANL_Collection(BER_TLV_IE, nested=[NAF_ID, B_TID]): |
| 883 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 884 | |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 885 | def __init__(self, fid='6fda', sfid=None, name='EF.GBANL', desc='GBA NAF List', **kwargs): |
| 886 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={None, None}, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 887 | self._tlv = EF_GBANL.EF_GBANL_Collection |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 888 | |
| 889 | # TS 31.102 Section 4.2.85 |
| 890 | class EF_EHPLMNPI(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 891 | def __init__(self, fid='6fdb', sfid=None, name='EF.EHPLMNPI', size={1, 1}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 892 | desc='Equivalent HPLMN Presentation Indication', **kwargs): |
| 893 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 894 | self._construct = Struct('presentation_ind' / |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 895 | Enum(Byte, no_preference=0, display_highest_prio_only=1, display_all=2)) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 896 | |
| 897 | # TS 31.102 Section 4.2.87 |
| 898 | class EF_NAFKCA(LinFixedEF): |
| 899 | class NAF_KeyCentreAddress(BER_TLV_IE, tag=0x80): |
| 900 | _construct = HexAdapter(GreedyBytes) |
| 901 | def __init__(self, fid='6fdd', sfid=None, name='EF.NAFKCA', rec_len={None, None}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 902 | desc='NAF Key Centre Address', **kwargs): |
| 903 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 904 | self._tlv = EF_NAFKCA.NAF_KeyCentreAddress |
| 905 | |
| 906 | # TS 31.102 Section 4.2.90 |
| 907 | class EF_NCP_IP(LinFixedEF): |
| 908 | class DataDestAddrRange(TLV_IE, tag=0x83): |
| 909 | _construct = Struct('type_of_address'/Enum(Byte, IPv4=0x21, IPv6=0x56), |
| 910 | 'prefix_length'/Int8ub, |
| 911 | 'prefix'/HexAdapter(GreedyBytes)) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 912 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 913 | class AccessPointName(TLV_IE, tag=0x80): |
| 914 | # coded as per TS 23.003 |
| 915 | _construct = HexAdapter(GreedyBytes) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 916 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 917 | class Login(TLV_IE, tag=0x81): |
| 918 | # as per SMS DCS TS 23.038 |
| 919 | _construct = GsmStringAdapter(GreedyBytes) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 920 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 921 | class Password(TLV_IE, tag=0x82): |
| 922 | # as per SMS DCS TS 23.038 |
| 923 | _construct = GsmStringAdapter(GreedyBytes) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 924 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 925 | class BearerDescription(TLV_IE, tag=0x84): |
| 926 | # Bearer descriptionTLV DO as per TS 31.111 |
| 927 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 928 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 929 | class EF_NCP_IP_Collection(TLV_IE_Collection, |
| 930 | nested=[AccessPointName, Login, Password, BearerDescription]): |
| 931 | pass |
| 932 | def __init__(self, fid='6fe2', sfid=None, name='EF.NCP-IP', rec_len={None, None}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 933 | desc='Network Connectivity Parameters for USIM IP connections', **kwargs): |
| 934 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 935 | self._tlv = EF_NCP_IP.EF_NCP_IP_Collection |
| 936 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 937 | # TS 31.102 Section 4.2.91 |
| 938 | class EF_EPSLOCI(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 939 | def __init__(self, fid='6fe3', sfid=0x1e, name='EF.EPSLOCI', size={18, 18}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 940 | desc='EPS Location Information', **kwargs): |
| 941 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 942 | upd_status_constr = Enum( |
| 943 | Byte, updated=0, not_updated=1, roaming_not_allowed=2) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 944 | self._construct = Struct('guti'/Bytes(12), 'last_visited_registered_tai'/Bytes(5), |
| 945 | 'eps_update_status'/upd_status_constr) |
| 946 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 947 | # TS 31.102 Section 4.2.92 |
| 948 | class EF_EPSNSC(LinFixedEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 949 | class KSI_ASME(BER_TLV_IE, tag=0x80): |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 950 | _construct = Int8ub |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 951 | |
| 952 | class K_ASME(BER_TLV_IE, tag=0x81): |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 953 | _construct = HexAdapter(GreedyBytes) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 954 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 955 | class UplinkNASCount(BER_TLV_IE, tag=0x82): |
| 956 | _construct = Int32ub |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 957 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 958 | class DownlinkNASCount(BER_TLV_IE, tag=0x83): |
| 959 | _construct = Int32ub |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 960 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 961 | class IDofNASAlgorithms(BER_TLV_IE, tag=0x84): |
| 962 | _construct = HexAdapter(GreedyBytes) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 963 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 964 | class EPS_NAS_Security_Context(BER_TLV_IE, tag=0xa0, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 965 | nested=[KSI_ASME, K_ASME, UplinkNASCount, DownlinkNASCount, |
| 966 | IDofNASAlgorithms]): |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 967 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 968 | def __init__(self, fid='6fe4', sfid=0x18, name='EF.EPSNSC', rec_len={54, 128}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 969 | desc='EPS NAS Security Context', **kwargs): |
| 970 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 971 | self._tlv = EF_EPSNSC.EPS_NAS_Security_Context |
| 972 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 973 | # TS 31.102 Section 4.2.96 |
| 974 | class EF_PWS(TransparentEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 975 | def __init__(self, fid='6fec', sfid=None, name='EF.PWS', desc='Public Warning System', size={1, 1}, **kwargs): |
| 976 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 977 | pws_config = FlagsEnum( |
| 978 | Byte, ignore_pws_in_hplmn_and_equivalent=1, ignore_pws_in_vplmn=2) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 979 | self._construct = Struct('pws_configuration'/pws_config) |
| 980 | |
| 981 | # TS 31.102 Section 4.2.101 |
| 982 | class EF_IPS(CyclicEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 983 | def __init__(self, fid='6ff1', sfid=None, name='EF.IPS', rec_len={4, 4}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 984 | desc='IMEI(SV) Pairing Status', **kwargs): |
| 985 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 986 | self._construct = Struct('status'/PaddedString(2, 'ascii'), |
| 987 | 'link_to_ef_ipd'/Int8ub, 'rfu'/Byte) |
| 988 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 989 | # TS 31.102 Section 4.2.103 |
| 990 | class EF_ePDGId(TransparentEF): |
| 991 | class ePDGId(BER_TLV_IE, tag=0x80, nested=[]): |
| 992 | _construct = Struct('type_of_ePDG_address'/Enum(Byte, FQDN=0, IPv4=1, IPv6=2), |
| 993 | 'ePDG_address'/Switch(this.type_of_address, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 994 | {'FQDN': GreedyString("utf8"), |
| 995 | 'IPv4': HexAdapter(GreedyBytes), |
| 996 | 'IPv6': HexAdapter(GreedyBytes)})) |
| 997 | |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 998 | def __init__(self, fid='6ff3', sfid=None, name='EF.eDPDGId', desc='Home ePDG Identifier', **kwargs): |
| 999 | super().__init__(fid, sfid=sfid, name=name, desc=desc, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1000 | self._tlv = EF_ePDGId.ePDGId |
| 1001 | |
Harald Welte | 7129007 | 2021-04-21 10:58:24 +0200 | [diff] [blame] | 1002 | # TS 31.102 Section 4.2.106 |
| 1003 | class EF_FromPreferred(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1004 | def __init__(self, fid='6ff7', sfid=None, name='EF.FromPreferred', size={1, 1}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1005 | desc='From Preferred', **kwargs): |
| 1006 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 7129007 | 2021-04-21 10:58:24 +0200 | [diff] [blame] | 1007 | self._construct = BitStruct('rfu'/BitsRFU(7), 'from_preferred'/Bit) |
| 1008 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 1009 | ###################################################################### |
| 1010 | # DF.5GS |
| 1011 | ###################################################################### |
| 1012 | |
| 1013 | # TS 31.102 Section 4.4.11.2 |
| 1014 | class EF_5GS3GPPLOCI(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1015 | def __init__(self, fid='4f01', sfid=0x01, name='EF.5GS3GPPLOCI', size={20, 20}, |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1016 | desc='5S 3GP location information', **kwargs): |
| 1017 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1018 | upd_status_constr = Enum( |
| 1019 | Byte, updated=0, not_updated=1, roaming_not_allowed=2) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 1020 | self._construct = Struct('5g_guti'/Bytes(13), 'last_visited_registered_tai_in_5gs'/Bytes(6), |
| 1021 | '5gs_update_status'/upd_status_constr) |
| 1022 | |
| 1023 | # TS 31.102 Section 4.4.11.7 |
| 1024 | class EF_UAC_AIC(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1025 | def __init__(self, fid='4f06', sfid=0x06, name='EF.UAC_AIC', size={4, 4}, |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1026 | desc='UAC Access Identities Configuration', **kwargs): |
| 1027 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 1028 | cfg_constr = FlagsEnum(Byte, multimedia_priority_service=1, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1029 | mission_critical_service=2) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 1030 | self._construct = Struct('uac_access_id_config'/cfg_constr) |
| 1031 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1032 | # TS 31.102 Section 4.4.11.9 |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 1033 | class EF_OPL5G(LinFixedEF): |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1034 | def __init__(self, fid='6f08', sfid=0x08, name='EF.OPL5G', desc='5GS Operator PLMN List', **kwargs): |
| 1035 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={10, None}, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 1036 | self._construct = Struct('tai'/Bytes(9), 'pnn_record_id'/Int8ub) |
| 1037 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1038 | # TS 31.102 Section 4.4.11.10 |
| 1039 | class EF_SUPI_NAI(TransparentEF): |
| 1040 | class NetworkSpecificIdentifier(TLV_IE, tag=0x80): |
| 1041 | # RFC 7542 encoded as UTF-8 string |
| 1042 | _construct = GreedyString("utf8") |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1043 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1044 | class GlobalLineIdentifier(TLV_IE, tag=0x81): |
| 1045 | # TS 23.003 clause 28.16.2 |
| 1046 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1047 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1048 | class GlobalCableIdentifier(TLV_IE, tag=0x82): |
| 1049 | # TS 23.003 clause 28.15.2 |
| 1050 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1051 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1052 | class NAI_TLV_Collection(TLV_IE_Collection, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1053 | nested=[NetworkSpecificIdentifier, GlobalLineIdentifier, GlobalCableIdentifier]): |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1054 | pass |
| 1055 | def __init__(self, fid='4f09', sfid=0x09, name='EF.SUPI_NAI', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1056 | desc='SUPI as Network Access Identifier', **kwargs): |
| 1057 | super().__init__(fid, sfid=sfid, name=name, desc=desc, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1058 | self._tlv = EF_SUPI_NAI.NAI_TLV_Collection |
| 1059 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1060 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1061 | class EF_TN3GPPSNN(TransparentEF): |
| 1062 | class ServingNetworkName(BER_TLV_IE, tag=0x80): |
| 1063 | _construct = GreedyString("utf8") |
| 1064 | def __init__(self, fid='4f0c', sfid=0x0c, name='EF.TN3GPPSNN', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1065 | desc='Trusted non-3GPP Serving network names list', **kwargs): |
| 1066 | super().__init__(fid, sfid=sfid, name=name, desc=desc, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 1067 | self._tlv = EF_TN3GPPSNN.ServingNetworkName |
| 1068 | |
Harald Welte | 3990ebb | 2021-04-20 23:55:14 +0200 | [diff] [blame] | 1069 | # TS 31.102 Section 4.4.5 |
| 1070 | class DF_WLAN(CardDF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1071 | def __init__(self, fid='5f40', name='DF.WLAN', desc='Files for WLAN purpose', **kwargs): |
| 1072 | super().__init__(fid=fid, name=name, desc=desc, **kwargs) |
Harald Welte | 3990ebb | 2021-04-20 23:55:14 +0200 | [diff] [blame] | 1073 | files = [ |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1074 | TransparentEF('4f41', 0x01, 'EF.Pseudo', 'Pseudonym', service=59), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1075 | TransparentEF('4f42', 0x02, 'EF.UPLMNWLAN', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1076 | 'User controlled PLMN selector for I-WLAN Access', service=60), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1077 | TransparentEF('4f43', 0x03, 'EF.OPLMNWLAN', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1078 | 'Operator controlled PLMN selector for I-WLAN Access', service=61), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1079 | LinFixedEF('4f44', 0x04, 'EF.UWSIDL', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1080 | 'User controlled WLAN Specific Identifier List', service=62), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1081 | LinFixedEF('4f45', 0x05, 'EF.OWSIDL', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1082 | 'Operator controlled WLAN Specific Identifier List', service=63), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1083 | TransparentEF('4f46', 0x06, 'EF.WRI', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1084 | 'WLAN Reauthentication Identity', service=66), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1085 | LinFixedEF('4f47', 0x07, 'EF.HWSIDL', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1086 | 'Home I-WLAN Specific Identifier List', service=81), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1087 | TransparentEF('4f48', 0x08, 'EF.WEHPLMNPI', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1088 | 'I-WLAN Equivalent HPLMN Presentation Indication', service=82), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1089 | TransparentEF('4f49', 0x09, 'EF.WHPI', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1090 | 'I-WLAN HPLMN Priority Indication', service=83), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1091 | TransparentEF('4f4a', 0x0a, 'EF.WLRPLMN', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1092 | 'I-WLAN Last Registered PLMN', service=84), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1093 | TransparentEF('4f4b', 0x0b, 'EF.HPLMNDAI', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1094 | 'HPLMN Direct Access Indicator', service=88), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1095 | ] |
Harald Welte | 3990ebb | 2021-04-20 23:55:14 +0200 | [diff] [blame] | 1096 | self.add_files(files) |
| 1097 | |
| 1098 | # TS 31.102 Section 4.4.6 |
| 1099 | class DF_HNB(CardDF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1100 | def __init__(self, fid='5f50', name='DF.HNB', desc='Files for HomeNodeB purpose', **kwargs): |
| 1101 | super().__init__(fid=fid, name=name, desc=desc, **kwargs) |
Harald Welte | 3990ebb | 2021-04-20 23:55:14 +0200 | [diff] [blame] | 1102 | files = [ |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1103 | LinFixedEF('4f01', 0x01, 'EF.ACSGL', 'Allowed CSG Lists', service=86), |
| 1104 | LinFixedEF('4f02', 0x02, 'EF.CSGTL', 'CSG Types', service=86), |
| 1105 | LinFixedEF('4f03', 0x03, 'EF.HNBN', 'Home NodeB Name', service=86), |
| 1106 | LinFixedEF('4f04', 0x04, 'EF.OCSGL', 'Operator CSG Lists', service=90), |
| 1107 | LinFixedEF('4f05', 0x05, 'EF.OCSGT', 'Operator CSG Type', service=90), |
| 1108 | LinFixedEF('4f06', 0x06, 'EF.OHNBN', 'Operator Home NodeB Name', service=90), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1109 | ] |
Harald Welte | 3990ebb | 2021-04-20 23:55:14 +0200 | [diff] [blame] | 1110 | self.add_files(files) |
| 1111 | |
| 1112 | # TS 31.102 Section 4.4.8 |
| 1113 | class DF_ProSe(CardDF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1114 | def __init__(self, fid='5f90', name='DF.ProSe', desc='Files for ProSe purpose', **kwargs): |
| 1115 | super().__init__(fid=fid, name=name, desc=desc, **kwargs) |
Harald Welte | 3990ebb | 2021-04-20 23:55:14 +0200 | [diff] [blame] | 1116 | files = [ |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1117 | LinFixedEF('4f01', 0x01, 'EF.PROSE_MON', |
| 1118 | 'ProSe Monitoring Parameters'), |
| 1119 | LinFixedEF('4f02', 0x02, 'EF.PROSE_ANN', |
| 1120 | 'ProSe Announcing Parameters'), |
Harald Welte | 3990ebb | 2021-04-20 23:55:14 +0200 | [diff] [blame] | 1121 | LinFixedEF('4f03', 0x03, 'EF.PROSEFUNC', 'HPLMN ProSe Function'), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1122 | TransparentEF('4f04', 0x04, 'EF.PROSE_RADIO_COM', |
| 1123 | 'ProSe Direct Communication Radio Parameters'), |
| 1124 | TransparentEF('4f05', 0x05, 'EF.PROSE_RADIO_MON', |
| 1125 | 'ProSe Direct Discovery Monitoring Radio Parameters'), |
| 1126 | TransparentEF('4f06', 0x06, 'EF.PROSE_RADIO_ANN', |
| 1127 | 'ProSe Direct Discovery Announcing Radio Parameters'), |
| 1128 | LinFixedEF('4f07', 0x07, 'EF.PROSE_POLICY', |
| 1129 | 'ProSe Policy Parameters'), |
Harald Welte | 3990ebb | 2021-04-20 23:55:14 +0200 | [diff] [blame] | 1130 | LinFixedEF('4f08', 0x08, 'EF.PROSE_PLMN', 'ProSe PLMN Parameters'), |
| 1131 | TransparentEF('4f09', 0x09, 'EF.PROSE_GC', 'ProSe Group Counter'), |
| 1132 | TransparentEF('4f10', 0x10, 'EF.PST', 'ProSe Service Table'), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1133 | TransparentEF('4f11', 0x11, 'EF.UIRC', |
| 1134 | 'ProSe UsageInformationReportingConfiguration'), |
| 1135 | LinFixedEF('4f12', 0x12, 'EF.PROSE_GM_DISCOVERY', |
| 1136 | 'ProSe Group Member Discovery Parameters'), |
| 1137 | LinFixedEF('4f13', 0x13, 'EF.PROSE_RELAY', |
| 1138 | 'ProSe Relay Parameters'), |
| 1139 | TransparentEF('4f14', 0x14, 'EF.PROSE_RELAY_DISCOVERY', |
| 1140 | 'ProSe Relay Discovery Parameters'), |
| 1141 | ] |
Harald Welte | 3990ebb | 2021-04-20 23:55:14 +0200 | [diff] [blame] | 1142 | self.add_files(files) |
| 1143 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1144 | |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 1145 | class DF_USIM_5GS(CardDF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1146 | def __init__(self, fid='5FC0', name='DF.5GS', desc='5GS related files', **kwargs): |
| 1147 | super().__init__(fid=fid, name=name, desc=desc, **kwargs) |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 1148 | files = [ |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1149 | # I'm looking at 31.102 R16.6 |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1150 | EF_5GS3GPPLOCI(service=122), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1151 | EF_5GS3GPPLOCI('4f02', 0x02, 'EF.5GSN3GPPLOCI', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1152 | '5GS non-3GPP location information', service=122), |
| 1153 | EF_5GS3GPPNSC(service=122), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1154 | EF_5GS3GPPNSC('4f04', 0x04, 'EF.5GSN3GPPNSC', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1155 | '5GS non-3GPP Access NAS Security Context', service=122), |
| 1156 | EF_5GAUTHKEYS(service=123), |
| 1157 | EF_UAC_AIC(service=126), |
| 1158 | EF_SUCI_Calc_Info(service=124), |
| 1159 | EF_OPL5G(service=129), |
| 1160 | EF_SUPI_NAI(service=130), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1161 | TransparentEF('4F0A', 0x0a, 'EF.Routing_Indicator', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1162 | 'Routing Indicator', size={4, 4}, service=124), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1163 | TransparentEF('4F0B', 0x0b, 'EF.URSP', |
Harald Welte | 419bb49 | 2022-02-12 21:39:35 +0100 | [diff] [blame] | 1164 | 'UE Route Selector Policies per PLMN', service=132), |
| 1165 | EF_TN3GPPSNN(service=133), |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 1166 | ] |
Merlin Chlosta | 05ca36b | 2021-04-01 16:15:28 +0200 | [diff] [blame] | 1167 | self.add_files(files) |
| 1168 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1169 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 1170 | class ADF_USIM(CardADF): |
| 1171 | def __init__(self, aid='a0000000871002', name='ADF.USIM', fid=None, sfid=None, |
| 1172 | desc='USIM Application'): |
| 1173 | super().__init__(aid=aid, fid=fid, sfid=sfid, name=name, desc=desc) |
Harald Welte | 15fae98 | 2021-04-10 10:22:27 +0200 | [diff] [blame] | 1174 | # add those commands to the general commands of a TransparentEF |
| 1175 | self.shell_commands += [self.AddlShellCommands()] |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 1176 | |
| 1177 | files = [ |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1178 | EF_LI(sfid=0x02), |
| 1179 | EF_IMSI(sfid=0x07), |
| 1180 | EF_Keys(), |
| 1181 | EF_Keys('6f09', 0x09, 'EF.KeysPS', |
| 1182 | desc='Ciphering and Integrity Keys for PS domain'), |
| 1183 | EF_xPLMNwAcT('6f60', 0x0a, 'EF.PLMNwAcT', |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1184 | 'User controlled PLMN Selector with Access Technology', service=20), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1185 | EF_HPPLMN(), |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1186 | EF_ACMmax(service=13), |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 1187 | EF_UST(), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1188 | CyclicEF('6f39', None, 'EF.ACM', |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1189 | 'Accumulated call meter', rec_len={3, 3}, service=13), |
| 1190 | TransparentEF('6f3e', None, 'EF.GID1', 'Group Identifier Level 1', service=17), |
| 1191 | TransparentEF('6f3f', None, 'EF.GID2', 'Group Identifier Level 2', service=18), |
| 1192 | EF_SPN(service=19), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1193 | TransparentEF('6f41', None, 'EF.PUCT', |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1194 | 'Price per unit and currency table', size={5, 5}, service=13), |
| 1195 | EF_CBMI(service=15), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1196 | EF_ACC(sfid=0x06), |
| 1197 | EF_PLMNsel('6f7b', 0x0d, 'EF.FPLMN', |
| 1198 | 'Forbidden PLMNs', size={12, None}), |
| 1199 | EF_LOCI(), |
| 1200 | EF_AD(), |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1201 | EF_CBMID(sfid=0x0e, service=29), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1202 | EF_ECC(), |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1203 | EF_CBMIR(service=16), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1204 | EF_PSLOCI(), |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1205 | EF_ADN('6f3b', None, 'EF.FDN', 'Fixed Dialling Numbers', service=[2, 89]), |
| 1206 | EF_SMS('6f3c', None, service=10), |
| 1207 | EF_MSISDN(service=21), |
| 1208 | EF_SMSP(service=12), |
| 1209 | EF_SMSS(service=10), |
| 1210 | EF_ADN('6f49', None, 'EF.SDN', 'Service Dialling Numbers', service=[4, 89]), |
| 1211 | EF_EXT('6f4b', None, 'EF.EXT2', 'Extension2 (FDN)', service=3), |
| 1212 | EF_EXT('6f4c', None, 'EF.EXT3', 'Extension2 (SDN)', service=5), |
| 1213 | EF_SMSR(service=11), |
| 1214 | EF_ICI(service=9), |
| 1215 | EF_OCI(service=8), |
| 1216 | EF_ICT(service=9), |
| 1217 | EF_ICT('6f83', None, 'EF.OCT', 'Outgoing Call Timer', service=8), |
| 1218 | EF_EXT('6f4e', None, 'EF.EXT5', 'Extension5 (ICI/OCI/MSISDN)', service=44), |
| 1219 | EF_CCP2(service=14), |
| 1220 | EF_eMLPP(service=24), |
| 1221 | EF_AAeM(service=25), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1222 | # EF_Hiddenkey |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1223 | EF_ADN('6f4d', None, 'EF.BDN', 'Barred Dialling Numbers', service=6), |
| 1224 | EF_EXT('6f55', None, 'EF.EXT4', 'Extension4 (BDN/SSC)', service=7), |
| 1225 | EF_CMI(service=6), |
Harald Welte | 6ca2fa7 | 2022-02-12 16:29:31 +0100 | [diff] [blame] | 1226 | EF_EST(service=[2, 6, 34, 35]), |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1227 | EF_ACL(service=35), |
| 1228 | EF_DCK(service=36), |
| 1229 | EF_CNL(service=37), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1230 | EF_START_HFN(), |
| 1231 | EF_THRESHOLD(), |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1232 | EF_xPLMNwAcT('6f61', 0x11, 'EF.OPLMNwAcT', 'User controlled PLMN Selector with Access Technology', service=42), |
| 1233 | EF_xPLMNwAcT('6f62', 0x13, 'EF.HPLMNwAcT', 'HPLMN Selector with Access Technology', service=43), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1234 | EF_ARR('6f06', 0x17), |
| 1235 | TransparentEF('6fc4', None, 'EF.NETPAR', 'Network Parameters'), |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1236 | EF_PNN('6fc5', 0x19, service=45), |
| 1237 | EF_OPL(service=46), |
| 1238 | EF_ADN('6fc7', None, 'EF.MBDN', 'Mailbox Dialling Numbers', service=47), |
| 1239 | EF_EXT('6fc8', None, 'EF.EXT6', 'Extension6 (MBDN)'), |
| 1240 | EF_MBI(service=47), |
| 1241 | EF_MWIS(service=48), |
| 1242 | EF_ADN('6fcb', None, 'EF.CFIS', 'Call Forwarding Indication Status', service=49), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1243 | EF_EXT('6fcc', None, 'EF.EXT7', 'Extension7 (CFIS)'), |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1244 | TransparentEF('6fcd', None, 'EF.SPDI', 'Service Provider Display Information', service=51), |
| 1245 | EF_MMSN(service=52), |
| 1246 | EF_EXT('6fcf', None, 'EF.EXT8', 'Extension8 (MMSN)', service=53), |
| 1247 | EF_MMSICP(service=52), |
| 1248 | EF_MMSUP(service=52), |
| 1249 | EF_MMSUCP(service=(52, 55)), |
| 1250 | EF_NIA(service=56), |
| 1251 | EF_VGCS(service=57), |
| 1252 | EF_VGCSS(service=57), |
| 1253 | EF_VGCS('6fb3', None, 'EF.VBS', 'Voice Broadcast Service', service=58), |
| 1254 | EF_VGCSS('6fb4', None, 'EF.VBSS', 'Voice Broadcast Service Status', service=58), |
| 1255 | EF_VGCSCA(service=64), |
| 1256 | EF_VGCSCA('6fd5', None, 'EF.VBCSCA', 'Voice Broadcast Service Ciphering Algorithm', service=65), |
| 1257 | EF_GBABP(service=68), |
| 1258 | EF_MSK(service=69), |
| 1259 | EF_MUK(service=69), |
| 1260 | EF_GBANL(service=68), |
| 1261 | EF_PLMNsel('6fd9', 0x1d, 'EF.EHPLMN', 'Equivalent HPLMN', size={12, None}, service=71), |
| 1262 | EF_EHPLMNPI(service=(71, 73)), |
| 1263 | # EF_LRPLMNSI ('6fdc', service=74) |
| 1264 | EF_NAFKCA(service=(68, 76)), |
| 1265 | TransparentEF('6fde', None, 'EF.SPNI', 'Service Provider Name Icon', service=78), |
| 1266 | LinFixedEF('6fdf', None, 'EF.PNNI', 'PLMN Network Name Icon', service=79), |
| 1267 | EF_NCP_IP(service=80), |
| 1268 | EF_EPSLOCI('6fe3', 0x1e, 'EF.EPSLOCI', 'EPS location information', service=85), |
| 1269 | EF_EPSNSC(service=85), |
| 1270 | TransparentEF('6fe6', None, 'EF.UFC', 'USAT Facility Control', size={1, 16}), |
| 1271 | TransparentEF('6fe8', None, 'EF.NASCONFIG', 'Non Access Stratum Configuration', service=96), |
| 1272 | # UICC IARI (only in cards that have no ISIM) service=95 |
| 1273 | EF_PWS(service=97), |
| 1274 | LinFixedEF('6fed', None, 'EF.FDNURI', 'Fixed Dialling Numbers URI', service=(2, 99)), |
| 1275 | LinFixedEF('6fee', None, 'EF.BDNURI', 'Barred Dialling Numbers URI', service=(6, 99)), |
| 1276 | LinFixedEF('6fef', None, 'EF.SDNURI', 'Service Dialling Numbers URI', service=(4, 99)), |
| 1277 | # EF_IWL (IMEI(SV) White List) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1278 | EF_IPS(), |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1279 | EF_ePDGId(service=(106, 107)), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1280 | # FIXME: from EF_ePDGSelection onwards |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1281 | EF_FromPreferred(service=114), |
| 1282 | # FIXME: DF_SoLSA service=23 |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1283 | # FIXME: DF_PHONEBOOK |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 1284 | # FIXME: DF_GSM_ACCESS service=27 |
| 1285 | DF_WLAN(service=[59, 60, 61, 62, 63, 66, 81, 82, 83, 84, 88]), |
| 1286 | DF_HNB(service=[86, 90]), |
| 1287 | DF_ProSe(service=101), |
| 1288 | # FIXME: DF_ACDC service=108 |
| 1289 | # FIXME: DF_TV service=116 |
| 1290 | DF_USIM_5GS(service=[122, 123, 124, 125, 126, 127, 129, 130]), |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1291 | ] |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 1292 | self.add_files(files) |
| 1293 | |
| 1294 | def decode_select_response(self, data_hex): |
Philipp Maier | 5998a3a | 2021-11-16 15:16:39 +0100 | [diff] [blame] | 1295 | return pySim.ts_102_221.CardProfileUICC.decode_select_response(data_hex) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 1296 | |
Harald Welte | 15fae98 | 2021-04-10 10:22:27 +0200 | [diff] [blame] | 1297 | @with_default_category('Application-Specific Commands') |
| 1298 | class AddlShellCommands(CommandSet): |
| 1299 | def __init__(self): |
| 1300 | super().__init__() |
| 1301 | |
| 1302 | authenticate_parser = argparse.ArgumentParser() |
| 1303 | authenticate_parser.add_argument('rand', help='Random challenge') |
| 1304 | authenticate_parser.add_argument('autn', help='Authentication Nonce') |
| 1305 | #authenticate_parser.add_argument('--context', help='Authentication context', default='3G') |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1306 | |
Harald Welte | 15fae98 | 2021-04-10 10:22:27 +0200 | [diff] [blame] | 1307 | @cmd2.with_argparser(authenticate_parser) |
| 1308 | def do_authenticate(self, opts): |
| 1309 | """Perform Authentication and Key Agreement (AKA).""" |
| 1310 | (data, sw) = self._cmd.card._scc.authenticate(opts.rand, opts.autn) |
| 1311 | self._cmd.poutput_json(data) |
| 1312 | |
Harald Welte | 12af793 | 2022-02-15 16:39:08 +0100 | [diff] [blame] | 1313 | term_prof_parser = argparse.ArgumentParser() |
| 1314 | term_prof_parser.add_argument('PROFILE', help='Hexstring of encoded terminal profile') |
| 1315 | |
| 1316 | @cmd2.with_argparser(term_prof_parser) |
Harald Welte | 846a898 | 2021-10-08 15:47:16 +0200 | [diff] [blame] | 1317 | def do_terminal_profile(self, arg): |
Harald Welte | 12af793 | 2022-02-15 16:39:08 +0100 | [diff] [blame] | 1318 | """Send a TERMINAL PROFILE command to the card. |
| 1319 | This is used to inform the card about which optional |
| 1320 | features the terminal (modem/phone) supports, particularly |
| 1321 | in the context of SIM Toolkit, Proactive SIM and OTA. You |
| 1322 | must specify a hex-string with the encoded terminal profile |
| 1323 | you want to send to the card.""" |
Harald Welte | 846a898 | 2021-10-08 15:47:16 +0200 | [diff] [blame] | 1324 | (data, sw) = self._cmd.card._scc.terminal_profile(arg) |
| 1325 | self._cmd.poutput('SW: %s, data: %s' % (sw, data)) |
Harald Welte | 15fae98 | 2021-04-10 10:22:27 +0200 | [diff] [blame] | 1326 | |
Harald Welte | 12af793 | 2022-02-15 16:39:08 +0100 | [diff] [blame] | 1327 | envelope_parser = argparse.ArgumentParser() |
| 1328 | envelope_parser.add_argument('PAYLOAD', help='Hexstring of encoded payload to ENVELOPE') |
| 1329 | |
| 1330 | @cmd2.with_argparser(envelope_parser) |
Harald Welte | 7cb94e4 | 2021-10-08 15:47:57 +0200 | [diff] [blame] | 1331 | def do_envelope(self, arg): |
Harald Welte | 12af793 | 2022-02-15 16:39:08 +0100 | [diff] [blame] | 1332 | """Send an ENVELOPE command to the card. This is how a |
| 1333 | variety of information is communicated from the terminal |
| 1334 | (modem/phone) to the card, particularly in the context of |
| 1335 | SIM Toolkit, Proactive SIM and OTA.""" |
Harald Welte | 7cb94e4 | 2021-10-08 15:47:57 +0200 | [diff] [blame] | 1336 | (data, sw) = self._cmd.card._scc.envelope(arg) |
| 1337 | self._cmd.poutput('SW: %s, data: %s' % (sw, data)) |
| 1338 | |
Harald Welte | 12af793 | 2022-02-15 16:39:08 +0100 | [diff] [blame] | 1339 | envelope_sms_parser = argparse.ArgumentParser() |
| 1340 | envelope_sms_parser.add_argument('TPDU', help='Hexstring of encoded SMS TPDU') |
| 1341 | |
| 1342 | @cmd2.with_argparser(envelope_sms_parser) |
Harald Welte | 7cb94e4 | 2021-10-08 15:47:57 +0200 | [diff] [blame] | 1343 | def do_envelope_sms(self, arg): |
Harald Welte | 12af793 | 2022-02-15 16:39:08 +0100 | [diff] [blame] | 1344 | """Send an ENVELOPE(SMS-PP-Download) command to the card. |
| 1345 | This emulates a terminal (modem/phone) having received a SMS |
| 1346 | with a PID of 'SMS for the SIM card'. You can use this |
| 1347 | command in the context of testing OTA related features |
| 1348 | without a modem/phone or a cellular netwokr.""" |
Harald Welte | 7cb94e4 | 2021-10-08 15:47:57 +0200 | [diff] [blame] | 1349 | tpdu_ie = SMS_TPDU() |
| 1350 | tpdu_ie.from_bytes(h2b(arg)) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1351 | dev_ids = DeviceIdentities( |
| 1352 | decoded={'source_dev_id': 'network', 'dest_dev_id': 'uicc'}) |
Harald Welte | 7cb94e4 | 2021-10-08 15:47:57 +0200 | [diff] [blame] | 1353 | sms_dl = SMSPPDownload(children=[dev_ids, tpdu_ie]) |
| 1354 | (data, sw) = self._cmd.card._scc.envelope(b2h(sms_dl.to_tlv())) |
| 1355 | self._cmd.poutput('SW: %s, data: %s' % (sw, data)) |
| 1356 | |
Harald Welte | 15fae98 | 2021-04-10 10:22:27 +0200 | [diff] [blame] | 1357 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 1358 | # TS 31.102 Section 7.3 |
| 1359 | sw_usim = { |
| 1360 | 'Security management': { |
| 1361 | '9862': 'Authentication error, incorrect MAC', |
| 1362 | '9864': 'Authentication error, security context not supported', |
| 1363 | '9865': 'Key freshness failure', |
| 1364 | '9866': 'Authentication error, no memory space available', |
| 1365 | '9867': 'Authentication error, no memory space available in EF MUK', |
| 1366 | } |
| 1367 | } |
| 1368 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1369 | |
Philipp Maier | 57f65ee | 2021-10-18 14:09:02 +0200 | [diff] [blame] | 1370 | class CardApplicationUSIM(CardApplication): |
| 1371 | def __init__(self): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1372 | super().__init__('USIM', adf=ADF_USIM(), sw=sw_usim) |