Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support LoRaWAN 1.2.0 default cipher suite #7248

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions api/ttn/lorawan/v3/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@
- [Enum `ADRAckLimitExponent`](#ttn.lorawan.v3.ADRAckLimitExponent)
- [Enum `AggregatedDutyCycle`](#ttn.lorawan.v3.AggregatedDutyCycle)
- [Enum `CFListType`](#ttn.lorawan.v3.CFListType)
- [Enum `CipherEnum`](#ttn.lorawan.v3.CipherEnum)
- [Enum `Class`](#ttn.lorawan.v3.Class)
- [Enum `DataRateIndex`](#ttn.lorawan.v3.DataRateIndex)
- [Enum `DataRateOffset`](#ttn.lorawan.v3.DataRateOffset)
Expand Down Expand Up @@ -4361,6 +4362,7 @@ This is used internally by the Network Server.
| `last_adr_change_f_cnt_up` | [`uint32`](#uint32) | | Frame counter of uplink, which confirmed the last ADR parameter change. |
| `recent_mac_command_identifiers` | [`MACCommandIdentifier`](#ttn.lorawan.v3.MACCommandIdentifier) | repeated | MAC command identifiers sent by the end device in the last received uplink. The Network Server may choose to store only certain types of MAC command identifiers in the underlying implementation. |
| `pending_relay_downlink` | [`RelayForwardDownlinkReq`](#ttn.lorawan.v3.RelayForwardDownlinkReq) | | Pending relay downlink contents. The pending downlink will be scheduled to the relay in either Rx1 or Rx2. The pending downlink will be cleared after the scheduling attempt. |
| `cipher_id` | [`uint32`](#uint32) | | Used cipher suite for the device. |

#### Field Rules

Expand All @@ -4373,6 +4375,7 @@ This is used internally by the Network Server.
| `rejected_adr_data_rate_indexes` | <p>`repeated.max_items`: `15`</p><p>`repeated.items.enum.defined_only`: `true`</p> |
| `rejected_adr_tx_power_indexes` | <p>`repeated.max_items`: `15`</p><p>`repeated.items.uint32.lte`: `15`</p> |
| `rejected_frequencies` | <p>`repeated.items.uint64.gte`: `100000`</p> |
| `cipher_id` | <p>`uint32.lte`: `64`</p> |

### <a name="ttn.lorawan.v3.MACState.DataRateRange">Message `MACState.DataRateRange`</a>

Expand Down Expand Up @@ -7618,24 +7621,28 @@ Only the components for which the keys were meant, will have the key-encryption-
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `minor_version` | [`Minor`](#ttn.lorawan.v3.Minor) | | |
| `cipher` | [`CipherEnum`](#ttn.lorawan.v3.CipherEnum) | | |

#### Field Rules

| Field | Validations |
| ----- | ----------- |
| `minor_version` | <p>`enum.defined_only`: `true`</p> |
| `cipher` | <p>`enum.defined_only`: `true`</p> |

### <a name="ttn.lorawan.v3.MACCommand.RekeyInd">Message `MACCommand.RekeyInd`</a>

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `minor_version` | [`Minor`](#ttn.lorawan.v3.Minor) | | |
| `cipher` | [`CipherEnum`](#ttn.lorawan.v3.CipherEnum) | | |

#### Field Rules

| Field | Validations |
| ----- | ----------- |
| `minor_version` | <p>`enum.defined_only`: `true`</p> |
| `cipher` | <p>`enum.defined_only`: `true`</p> |

### <a name="ttn.lorawan.v3.MACCommand.RelayConfAns">Message `MACCommand.RelayConfAns`</a>

Expand Down Expand Up @@ -7778,24 +7785,28 @@ Only the components for which the keys were meant, will have the key-encryption-
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `minor_version` | [`Minor`](#ttn.lorawan.v3.Minor) | | |
| `cipher` | [`CipherEnum`](#ttn.lorawan.v3.CipherEnum) | | |

#### Field Rules

| Field | Validations |
| ----- | ----------- |
| `minor_version` | <p>`enum.defined_only`: `true`</p><p>`enum.in`: `[1]`</p> |
| `minor_version` | <p>`enum.defined_only`: `true`</p><p>`enum.in`: `[1 2]`</p> |
| `cipher` | <p>`enum.defined_only`: `true`</p> |

### <a name="ttn.lorawan.v3.MACCommand.ResetInd">Message `MACCommand.ResetInd`</a>

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `minor_version` | [`Minor`](#ttn.lorawan.v3.Minor) | | |
| `cipher` | [`CipherEnum`](#ttn.lorawan.v3.CipherEnum) | | |

#### Field Rules

| Field | Validations |
| ----- | ----------- |
| `minor_version` | <p>`enum.defined_only`: `true`</p><p>`enum.in`: `[1]`</p> |
| `minor_version` | <p>`enum.defined_only`: `true`</p><p>`enum.in`: `[1 2]`</p> |
| `cipher` | <p>`enum.defined_only`: `true`</p> |

### <a name="ttn.lorawan.v3.MACCommand.RxParamSetupAns">Message `MACCommand.RxParamSetupAns`</a>

Expand Down Expand Up @@ -8067,6 +8078,7 @@ Otherwise, the Gateway Server attempts to schedule the request and creates the T
| `priority` | [`TxSchedulePriority`](#ttn.lorawan.v3.TxSchedulePriority) | | Priority for scheduling. Requests with a higher priority are allocated more channel time than messages with a lower priority, in duty-cycle limited regions. A priority of HIGH or higher sets the HiPriorityFlag in the DLMetadata Object. |
| `absolute_time` | [`google.protobuf.Timestamp`](#google.protobuf.Timestamp) | | Time when the downlink message should be transmitted. This value is only valid for class C downlink; class A downlink uses uplink tokens and class B downlink is scheduled on ping slots. This requires the gateway to have GPS time sychronization. If the absolute time is not set, the first available time will be used that does not conflict or violate regional limitations. |
| `frequency_plan_id` | [`string`](#string) | | Frequency plan ID from which the frequencies in this message are retrieved. |
| `rx2_mic` | [`bytes`](#bytes) | | MIC for Rx2. |
| `advanced` | [`google.protobuf.Struct`](#google.protobuf.Struct) | | Advanced metadata fields - can be used for advanced information or experimental features that are not yet formally defined in the API - field names are written in snake_case |

#### Field Rules
Expand All @@ -8076,6 +8088,7 @@ Otherwise, the Gateway Server attempts to schedule the request and creates the T
| `rx1_delay` | <p>`enum.defined_only`: `true`</p> |
| `priority` | <p>`enum.defined_only`: `true`</p> |
| `frequency_plan_id` | <p>`string.max_len`: `64`</p> |
| `rx2_mic` | <p>`bytes.min_len`: `0`</p><p>`bytes.max_len`: `4`</p> |

### <a name="ttn.lorawan.v3.TxSettings">Message `TxSettings`</a>

Expand Down Expand Up @@ -8208,6 +8221,27 @@ Transmission settings for downlink.
| `FREQUENCIES` | 0 | |
| `CHANNEL_MASKS` | 1 | |

### <a name="ttn.lorawan.v3.CipherEnum">Enum `CipherEnum`</a>

| Name | Number | Description |
| ---- | ------ | ----------- |
| `CIPHER_0` | 0 | |
| `CIPHER_1` | 1 | |
| `CIPHER_2` | 2 | |
| `CIPHER_3` | 3 | |
| `CIPHER_4` | 4 | |
| `CIPHER_5` | 5 | |
| `CIPHER_6` | 6 | |
| `CIPHER_7` | 7 | |
| `CIPHER_8` | 8 | |
| `CIPHER_9` | 9 | |
| `CIPHER_10` | 10 | |
| `CIPHER_11` | 11 | |
| `CIPHER_12` | 12 | |
| `CIPHER_13` | 13 | |
| `CIPHER_14` | 14 | |
| `CIPHER_15` | 15 | |

### <a name="ttn.lorawan.v3.Class">Enum `Class`</a>

| Name | Number | Description |
Expand Down Expand Up @@ -8324,6 +8358,7 @@ Transmission settings for downlink.
| `MAC_V1_1` | 4 | |
| `MAC_V1_0_3` | 5 | |
| `MAC_V1_0_4` | 6 | |
| `MAC_V1_2_0` | 7 | |

### <a name="ttn.lorawan.v3.MType">Enum `MType`</a>

Expand All @@ -8350,7 +8385,7 @@ Transmission settings for downlink.
| ---- | ------ | ----------- |
| `MINOR_RFU_0` | 0 | |
| `MINOR_1` | 1 | |
| `MINOR_RFU_2` | 2 | |
| `MINOR_2` | 2 | |
| `MINOR_RFU_3` | 3 | |
| `MINOR_RFU_4` | 4 | |
| `MINOR_RFU_5` | 5 | |
Expand Down
49 changes: 47 additions & 2 deletions api/ttn/lorawan/v3/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -18020,6 +18020,9 @@
"properties": {
"minor_version": {
"$ref": "#/definitions/v3Minor"
},
"cipher": {
"$ref": "#/definitions/v3CipherEnum"
}
}
},
Expand All @@ -18028,6 +18031,9 @@
"properties": {
"minor_version": {
"$ref": "#/definitions/v3Minor"
},
"cipher": {
"$ref": "#/definitions/v3CipherEnum"
}
}
},
Expand Down Expand Up @@ -18232,6 +18238,9 @@
"properties": {
"minor_version": {
"$ref": "#/definitions/v3Minor"
},
"cipher": {
"$ref": "#/definitions/v3CipherEnum"
}
}
},
Expand All @@ -18240,6 +18249,9 @@
"properties": {
"minor_version": {
"$ref": "#/definitions/v3Minor"
},
"cipher": {
"$ref": "#/definitions/v3CipherEnum"
}
}
},
Expand Down Expand Up @@ -21724,6 +21736,28 @@
},
"description": "DEPRECATED: This message is deprecated and will be removed in a future version of The Things Stack."
},
"v3CipherEnum": {
"type": "string",
"enum": [
"CIPHER_0",
"CIPHER_1",
"CIPHER_2",
"CIPHER_3",
"CIPHER_4",
"CIPHER_5",
"CIPHER_6",
"CIPHER_7",
"CIPHER_8",
"CIPHER_9",
"CIPHER_10",
"CIPHER_11",
"CIPHER_12",
"CIPHER_13",
"CIPHER_14",
"CIPHER_15"
],
"default": "CIPHER_0"
},
"v3ClaimEndDeviceRequest": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -26054,6 +26088,11 @@
"pending_relay_downlink": {
"$ref": "#/definitions/v3RelayForwardDownlinkReq",
"description": "Pending relay downlink contents.\nThe pending downlink will be scheduled to the relay in either Rx1 or Rx2.\nThe pending downlink will be cleared after the scheduling attempt."
},
"cipher_id": {
"type": "integer",
"format": "int64",
"description": "Used cipher suite for the device."
}
},
"description": "MACState represents the state of MAC layer of the device.\nMACState is reset on each join for OTAA or ResetInd for ABP devices.\nThis is used internally by the Network Server."
Expand Down Expand Up @@ -26129,7 +26168,8 @@
"MAC_V1_0_2",
"MAC_V1_1",
"MAC_V1_0_3",
"MAC_V1_0_4"
"MAC_V1_0_4",
"MAC_V1_2_0"
],
"default": "MAC_UNKNOWN"
},
Expand Down Expand Up @@ -26774,7 +26814,7 @@
"enum": [
"MINOR_RFU_0",
"MINOR_1",
"MINOR_RFU_2",
"MINOR_2",
"MINOR_RFU_3",
"MINOR_RFU_4",
"MINOR_RFU_5",
Expand Down Expand Up @@ -28829,6 +28869,11 @@
"type": "string",
"description": "Frequency plan ID from which the frequencies in this message are retrieved."
},
"rx2_mic": {
"type": "string",
"format": "byte",
"description": "MIC for Rx2."
},
"advanced": {
"type": "object",
"title": "Advanced metadata fields\n- can be used for advanced information or experimental features that are not yet formally defined in the API\n- field names are written in snake_case"
Expand Down
3 changes: 3 additions & 0 deletions api/ttn/lorawan/v3/end_device.proto
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,9 @@ message MACState {
// The pending downlink will be scheduled to the relay in either Rx1 or Rx2.
// The pending downlink will be cleared after the scheduling attempt.
RelayForwardDownlinkReq pending_relay_downlink = 24;

// Used cipher suite for the device.
uint32 cipher_id = 25 [(validate.rules).uint32.lte = 64];
}

// Power state of the device.
Expand Down
52 changes: 49 additions & 3 deletions api/ttn/lorawan/v3/lorawan.proto
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ enum MACVersion {
MAC_V1_0_4 = 6 [(thethings.json.enum_value) = {
aliases: ["1.0.4"]
}];
MAC_V1_2_0 = 7 [(thethings.json.enum_value) = {
aliases: [
"1.2",
"1.2.0"
]
}];
}

enum PHYVersion {
Expand Down Expand Up @@ -687,6 +693,12 @@ message TxRequest {
string frequency_plan_id = 10 [(validate.rules).string.max_len = 64];
reserved 11; // lorawan_phy_version

// MIC for Rx2.
bytes rx2_mic = 14 [(validate.rules).bytes = {
min_len: 0,
max_len: 4
}];

// Advanced metadata fields
// - can be used for advanced information or experimental features that are not yet formally defined in the API
// - field names are written in snake_case
Expand Down Expand Up @@ -937,14 +949,22 @@ message MACCommand {
message ResetInd {
Minor minor_version = 1 [(validate.rules).enum = {
defined_only: true,
in: [1]
in: [
1,
2
]
}];
CipherEnum cipher = 2 [(validate.rules).enum.defined_only = true];
}
message ResetConf {
Minor minor_version = 1 [(validate.rules).enum = {
defined_only: true,
in: [1]
in: [
1,
2
]
}];
CipherEnum cipher = 2 [(validate.rules).enum.defined_only = true];
}
message LinkCheckAns {
// Indicates the link margin in dB of the received LinkCheckReq, relative to the demodulation floor.
Expand Down Expand Up @@ -1022,9 +1042,11 @@ message MACCommand {
}
message RekeyInd {
Minor minor_version = 1 [(validate.rules).enum.defined_only = true];
CipherEnum cipher = 2 [(validate.rules).enum.defined_only = true];
}
message RekeyConf {
Minor minor_version = 1 [(validate.rules).enum.defined_only = true];
CipherEnum cipher = 2 [(validate.rules).enum.defined_only = true];
}
message ADRParamSetupReq {
// Exponent e that configures the ADR_ACK_LIMIT = 2^e messages.
Expand Down Expand Up @@ -1438,7 +1460,7 @@ enum Minor {

MINOR_RFU_0 = 0;
MINOR_1 = 1;
MINOR_RFU_2 = 2;
MINOR_2 = 2;
MINOR_RFU_3 = 3;
MINOR_RFU_4 = 4;
MINOR_RFU_5 = 5;
Expand All @@ -1454,6 +1476,30 @@ enum Minor {
MINOR_RFU_15 = 15;
}

enum CipherEnum {
option (thethings.json.enum) = {
marshal_as_string: true,
prefix: "CIPHER"
};

CIPHER_0 = 0;
CIPHER_1 = 1;
CIPHER_2 = 2;
CIPHER_3 = 3;
CIPHER_4 = 4;
CIPHER_5 = 5;
CIPHER_6 = 6;
CIPHER_7 = 7;
CIPHER_8 = 8;
CIPHER_9 = 9;
CIPHER_10 = 10;
CIPHER_11 = 11;
CIPHER_12 = 12;
CIPHER_13 = 13;
CIPHER_14 = 14;
CIPHER_15 = 15;
}

message FrequencyValue {
option (thethings.flags.message) = {
select: true,
Expand Down
Loading
Loading