blob: 7c2948ac68e073beed935ac0fe7e965e859c8ae4 [file] [log] [blame]
Chip Boling6e27b352020-02-14 09:10:01 -06001/*
2 * Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net)
Andrea Campanella7167ebb2020-02-24 09:56:38 +01003 * Copyright 2020-present Open Networking Foundation
4
Chip Boling6e27b352020-02-14 09:10:01 -06005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
Andrea Campanella7167ebb2020-02-24 09:56:38 +01008
Chip Boling6e27b352020-02-14 09:10:01 -06009 * http://www.apache.org/licenses/LICENSE-2.0
Andrea Campanella7167ebb2020-02-24 09:56:38 +010010
Chip Boling6e27b352020-02-14 09:10:01 -060011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
David K. Bainbridgeadf422d2021-04-09 16:06:41 +000017/*
Chip Boling6e27b352020-02-14 09:10:01 -060018 * NOTE: This file was generated, manual edits will be overwritten!
19 *
20 * Generated by 'goCodeGenerator.py':
21 * https://github.com/cboling/OMCI-parser/README.md
22 */
23
24package generated
25
26import "github.com/deckarep/golang-set"
27
28// EnhancedSecurityControlClassID is the 16-bit ID for the OMCI
29// Managed entity Enhanced security control
Chip Boling610117d2021-09-09 11:24:34 -050030const EnhancedSecurityControlClassID = ClassID(332) // 0x014c
Chip Boling6e27b352020-02-14 09:10:01 -060031
32var enhancedsecuritycontrolBME *ManagedEntityDefinition
33
Chip Boling610117d2021-09-09 11:24:34 -050034// EnhancedSecurityControl (Class ID: #332 / 0x014c)
Chip Boling6e27b352020-02-14 09:10:01 -060035// This ME contains the capabilities, parameters and controls of enhanced GPON security features
36// when they are negotiated via the OMCI (Note). The attributes in this ME are intended to be used
37// to implement a symmetric-key-based three step authentication process as described in the
38// supplemental information section in the following.
39//
40// NOTE - If an ITU-T G.987 system uses 802.1X authentication as defined in [ITU-T G.987.3], the
41// only applicable attribute of this ME is the broadcast key table.
42//
43// Relationships
44// One instance of this ME is associated with the ONU ME.
45//
46// Attributes
47// Managed Entity Id
Chip Boling610117d2021-09-09 11:24:34 -050048// This attribute uniquely identifies each instance of this ME. There is only one instance, number
49// 0. (R) (mandatory) (2 bytes)
Chip Boling6e27b352020-02-14 09:10:01 -060050//
51// Olt Crypto Capabilities
Chip Boling610117d2021-09-09 11:24:34 -050052// This attribute specifies the cryptographic mechanisms available at the OLT. It is written by the
53// OLT during authentication step 1. It is formatted as a bit map, where a 1 bit indicates that the
54// particular algorithm is supported, and a 0 bit indicates it is not supported.
55//
56// Bit position Algorithm
57//
58// 1 (LSB) AES-CMAC-128 (support is mandatory)
59//
60// 2 HMAC-SHA-256
61//
62// 3 HMAC-SHA-512
63//
64// 4-128 Reserved
65//
Chip Boling6e27b352020-02-14 09:10:01 -060066// (W) (mandatory) (16 bytes)
67//
68// Olt Random Challenge Table
Chip Boling610117d2021-09-09 11:24:34 -050069// This attribute specifies the random challenge OLT_challenge issued by the OLT during
70// authentication step 1. It is structured as a table, with each entry being 17 bytes. The first
71// byte is the table row number, starting at 1, and the remaining 16 bytes are the contents of the
72// entry. OLT_challenge is the concatenation of all 16-byte content fields. In normal use, the OLT
73// will write all the entries in the table, and then trigger the ONU's processing of the entire
74// table using the OLT challenge status attribute. The table size is known by the maximum index set
75// by the OLT. The OLT can clear the table with a set operation to row 0. (R, W) (mandatory) (17 *
76// N-bytes)
77//
Chip Boling6e27b352020-02-14 09:10:01 -060078// NOTE - It is assumed that the length of OLT_challenge is always an integer multiple of 16-bytes.
79//
80// Olt Challenge Status
Chip Boling610117d2021-09-09 11:24:34 -050081// This Boolean attribute controls the completion of authentication step 1. This attribute behaves
82// as follows.
83//
84// When the OLT performs the first of possibly several set operations to the OLT crypto
85// capabilities or the OLT random challenge table attributes, a side effect of the set operation is
86// that the ONU sets the OLT challenge status attribute to false.
87//
88// When the OLT completes the set operation(s) to the OLT crypto capabilities and the OLT random
89// challenge table attributes, then it sets the OLT challenge status attribute to true. This
90// triggers the ONU to process the OLT random challenge table, using its choice of the OLT's
91// candidate cryptographic hash algorithms.
92//
Chip Boling6e27b352020-02-14 09:10:01 -060093// The ONU initializes this attribute to the value false. (R, W) (mandatory) (1-byte)
94//
95// Onu Selected Crypto Capabilities
Chip Boling610117d2021-09-09 11:24:34 -050096// This attribute specifies the cryptographic capability selected by the ONU in authentication step
97// 2. Its value specifies one of the bit positions that has the value 1 in the OLT crypto
98// capabilities attribute. (R) (mandatory) (1 byte)
Chip Boling6e27b352020-02-14 09:10:01 -060099//
100// Onu Random Challenge Table
Chip Boling610117d2021-09-09 11:24:34 -0500101// This attribute specifies the random challenge ONU_challenge issued by the ONU during
102// authentication step 2. It is structured as a table, with each entry being 16-bytes of content.
103// ONU_challenge is the concatenation of all 16-byte content fields in the table. Once the OLT
104// triggers a response to be generated using the OLT challenge status attribute, the ONU generates
105// the response and writes the table (in a single operation). The AVC generated by this attribute
106// signals to the OLT that the challenge is ready, so that the OLT can commence a get/get-next
107// sequence to obtain the table's contents. (R) (mandatory) (16 * P-bytes)
Chip Boling6e27b352020-02-14 09:10:01 -0600108//
109// Onu Authentication Result Table
Chip Boling610117d2021-09-09 11:24:34 -0500110// (authentication step 2). This attribute contains the result of the authentication computation
111// from the ONU (ONU_result), according to the ONU's selected crypto capabilities attribute.
112//
113// ONU_result-= SelectedHashFunction (PSK, (ONU_selected_crypto capabilities | OLT_challenge |
114// ONU_challenge | 0x0000 0000 0000 0000)),
115//
116// where "|" denotes concatenation.
117//
118// This attribute is structured as a table, with each entry being 16 bytes of content. The number
119// of rows Q is implicit in the choice of hash algorithm.
120//
Chip Boling6e27b352020-02-14 09:10:01 -0600121// Once the OLT triggers a response to be generated using the OLT challenge status attribute, the
122// ONU generates ONU_result and writes the table (in a single operation). The AVC generated by this
123// attribute signals to the OLT that the response is ready, so that the OLT can commence a get/get-
124// next sequence to obtain the table's contents. (R) (mandatory) (16 * Q-bytes)
125//
126// Olt Authentication Result Table
127// This attribute is structured as a table, with each entry being 17 bytes. The first byte is the
128// table row number, starting at 1; the remaining 16 bytes are content. OLT_result is the
129// concatenation of all 16-byte content fields. The OLT writes all entries into the table, and then
130// triggers the ONU's processing of the table using the OLT result status attribute. The number of
131// rows R is implicit in the choice of hash algorithm. The OLT can clear the table with a set
132// operation to row 0. (W) (mandatory) (17 * R-bytes)
133//
Chip Boling610117d2021-09-09 11:24:34 -0500134// This attribute is used in authentication step 3. It contains OLT_result, the result of the
135// authentication computation from the OLT.
136//
137// OLT_result-= SelectedHashFunction (PSK, (ONU_selected_crypto capabilities | ONU_challenge |
138// OLT_challenge | ONU_serial_number)).
139//
140// The ONU_serial_number is the serial number attribute of the ONU-G ME, 8 bytes.
141//
Chip Boling6e27b352020-02-14 09:10:01 -0600142// Olt Result Status
Chip Boling610117d2021-09-09 11:24:34 -0500143// (authentication step 3). This Boolean attribute controls and reports the status of the OLT
144// authentication result table attribute. This attribute behaves as follows.
145//
146// When the OLT performs the first of possibly several set operations to the OLT authentication
147// result table attribute, a side effect of the set operation is that the ONU sets the OLT result
148// status attribute to false.
149//
150// When the OLT completes the set operation(s) to the OLT authentication result table, then it sets
151// the OLT result status attribute to true. This triggers the ONU to process the OLT authentication
152// result table.
153//
Chip Boling6e27b352020-02-14 09:10:01 -0600154// (R, W) (mandatory) (1 byte)
155//
156// Onu Authentication Status
Chip Boling610117d2021-09-09 11:24:34 -0500157// This attribute indicates the status of the authentication relationship from the perspective of
158// the ONU. It has the following values.
159//
160// 0 Indeterminate. This initial value indicates that the OMCI authentication process has not yet
161// completed, and may not even have been started.
162//
163// 1 Reserved.
164//
165// 2 Reserved.
166//
167// 3 Authentication success: the procedure has completed at least once since the latest ONU
168// activation and in its most recent execution, the ONU has authenticated the OLT.
169//
170// 4 Authentication failure: the procedure has completed at least once since the latest ONU
171// activation, and either its most recent execution resulted in an error or the ONU has failed to
172// authenticate the OLT.
173//
174// 5 Reserved.
175//
176// Upon ONU activation, the ONU sets the attribute to the initial value. When the ONU
177// authentication status has the value 3, encryption keys exchanged in the TC layer will be
178// encrypted using the master session key (ITUT G.984 systems) or the key encryption key (KEK,
179// ITU-T G.987 systems). The OLT should check the value of this attribute before initiating a key
180// switch.
181//
Chip Boling6e27b352020-02-14 09:10:01 -0600182// (R) (mandatory) (1 byte)
183//
184// Master Session Key Name
Chip Boling610117d2021-09-09 11:24:34 -0500185// Following successful authentication, this register contains the "name," or the hash signature,
186// of the current master session key. The master session key is defined as:
187//
188// MSK-= SelectedHashFunction (PSK, (OLT_challenge | ONU_challenge)).
189//
190// The master session key name is defined as:
191//
192// MSKname-= SelectedHashFunction (PSK, (ONU_challenge | OLT_challenge | 0x 3141 5926 5358 9793
193// 3141 5926 5358 9793)).
194//
195// If the selected hash function generates more than 128 bits, the result is truncated to the
196// leftmost (most significant) 128 bits.
197//
Chip Boling6e27b352020-02-14 09:10:01 -0600198// Upon the invalidation of a master session key (e.g., due to an ONU reset or deactivation, or due
199// to an ONU-local decision that the master session key has expired), the ONU sets the master
200// session key name to all zeros. (R) (mandatory) (16 bytes)
201//
202// Broadcast Key Table
Chip Boling610117d2021-09-09 11:24:34 -0500203// 10 Clear the entire table.
204//
205// 11 Reserved.
206//
207// The four MSBs specify the length of the fragment, which is left-justified in the key fragment
208// field. The value 0 indicates 16-bytes of key fragment.
209//
210// The other two bits are reserved.
211//
212// Row identifier (1 byte): The two MSBs of this field are the key index, which appears in the
213// header of encrypted multicast GEM frames. Key index 0 always indicates cleartext, and should
214// therefore not appear in the identifier. The four LSBs identify the key fragment number, starting
215// with 0. The other two bits are reserved.
216//
217// Key fragment (16 bytes): This field contains the specified fragment of the key (encrypted with
218// AES-ECB using the KEK).
219//
Chip Boling6e27b352020-02-14 09:10:01 -0600220// (R, W) (optional) (18N bytes)
221//
Chip Boling610117d2021-09-09 11:24:34 -0500222// This attribute is defined only in ITU-T G.987 systems. It contains the broadcast key generated
223// by the OLT. It is a table, each of whose rows is structured as follows.
224//
225// Row control (1 byte): The two LSBs of this byte determine the attribute's behaviour under the
226// set action. They always read back as 0 under the get next action.
227//
228// 00 Set the specified row.
229//
230// 01 Clear the specified row.
231//
Chip Boling6e27b352020-02-14 09:10:01 -0600232// Effective Key Length
Chip Boling610117d2021-09-09 11:24:34 -0500233// This attribute specifies the maximum effective length, in bits, of keys generated by the ONU.
234// (R) (optional) (2 bytes)
Chip Boling6e27b352020-02-14 09:10:01 -0600235//
236type EnhancedSecurityControl struct {
237 ManagedEntityDefinition
238 Attributes AttributeValueMap
239}
240
241func init() {
242 enhancedsecuritycontrolBME = &ManagedEntityDefinition{
243 Name: "EnhancedSecurityControl",
244 ClassID: 332,
245 MessageTypes: mapset.NewSetWith(
246 Get,
247 GetNext,
248 Set,
249 ),
250 AllowedAttributeMask: 0xfff0,
251 AttributeDefinitions: AttributeDefinitionMap{
252 0: Uint16Field("ManagedEntityId", PointerAttributeType, 0x0000, 0, mapset.NewSetWith(Read), false, false, false, 0),
253 1: MultiByteField("OltCryptoCapabilities", OctetsAttributeType, 0x8000, 16, toOctets("AAAAAAAAAAAAAAAAAAAAAA=="), mapset.NewSetWith(Write), false, false, false, 1),
254 2: TableField("OltRandomChallengeTable", TableAttributeType, 0x4000, TableInfo{nil, 17}, mapset.NewSetWith(Read, Write), false, false, false, 2),
255 3: ByteField("OltChallengeStatus", UnsignedIntegerAttributeType, 0x2000, 0, mapset.NewSetWith(Read, Write), false, false, false, 3),
256 4: ByteField("OnuSelectedCryptoCapabilities", UnsignedIntegerAttributeType, 0x1000, 0, mapset.NewSetWith(Read), false, false, false, 4),
257 5: TableField("OnuRandomChallengeTable", TableAttributeType, 0x0800, TableInfo{nil, 16}, mapset.NewSetWith(Read), true, false, false, 5),
258 6: TableField("OnuAuthenticationResultTable", TableAttributeType, 0x0400, TableInfo{nil, 16}, mapset.NewSetWith(Read), true, false, false, 6),
259 7: TableField("OltAuthenticationResultTable", TableAttributeType, 0x0200, TableInfo{nil, 17}, mapset.NewSetWith(Read, Write), false, false, false, 7),
260 8: ByteField("OltResultStatus", UnsignedIntegerAttributeType, 0x0100, 0, mapset.NewSetWith(Read, Write), false, false, false, 8),
261 9: ByteField("OnuAuthenticationStatus", UnsignedIntegerAttributeType, 0x0080, 0, mapset.NewSetWith(Read), true, false, false, 9),
262 10: MultiByteField("MasterSessionKeyName", OctetsAttributeType, 0x0040, 16, toOctets("AAAAAAAAAAAAAAAAAAAAAA=="), mapset.NewSetWith(Read), false, false, false, 10),
263 11: TableField("BroadcastKeyTable", TableAttributeType, 0x0020, TableInfo{nil, 18}, mapset.NewSetWith(Read, Write), false, true, false, 11),
264 12: Uint16Field("EffectiveKeyLength", UnsignedIntegerAttributeType, 0x0010, 0, mapset.NewSetWith(Read), false, true, false, 12),
265 },
266 Access: CreatedByOnu,
267 Support: UnknownSupport,
268 }
269}
270
271// NewEnhancedSecurityControl (class ID 332) creates the basic
272// Managed Entity definition that is used to validate an ME of this type that
273// is received from or transmitted to the OMCC.
274func NewEnhancedSecurityControl(params ...ParamData) (*ManagedEntity, OmciErrors) {
275 return NewManagedEntity(*enhancedsecuritycontrolBME, params...)
276}