diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Message.be b/lib/libesp32/berry_matter/src/embedded/Matter_Message.be index 3eadf0c55..c9473d68d 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Message.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Message.be @@ -301,9 +301,22 @@ class Matter_Frame import crypto var session = self.session var raw = self.raw + var mic = raw[-16..] # take last 16 bytes as signature + # decrypt the message with `i2r` key var i2r = session.get_i2r() - var mic = raw[-16..] # take last 16 bytes as signature + + # check privacy flag, p.127 + if self.sec_p + # compute privacy key, p.71 + var k = session.get_i2r_privacy() + var n = bytes().add(self.local_session_id, -2) + mic[5..15] # session in Big Endian + var m = self.raw[4 .. self.payload_idx-1] + var m_clear = crypto.AES_CTR(k).decrypt(m, n, 2) + # replace in-place + self.raw = self.raw[0..3] + m_clear + m[self.self.payload_idx .. ] + end + # use AES_CCM var a = raw[0 .. self.payload_idx - 1] var p = raw[self.payload_idx .. -17] diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Session.be b/lib/libesp32/berry_matter/src/embedded/Matter_Session.be index 8c1f56235..028f8a28d 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Session.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Session.be @@ -53,6 +53,7 @@ class Matter_Session # encryption keys and challenges var i2rkey # key initiator to receiver (incoming) var r2ikey # key receiver to initiator (outgoing) + var _i2r_privacy # cache for the i2r privacy key var attestation_challenge # Attestation challenge var peer_node_id # breadcrumb @@ -108,6 +109,7 @@ class Matter_Session self.counter_rcv.reset() self.counter_snd.reset() self.i2rkey = nil + self._i2r_privacy = nil self.r2ikey = nil self.attestation_challenge = nil # clear any attribute starting with `_` @@ -129,6 +131,7 @@ class Matter_Session end def set_keys(i2r, r2i, ac, st) self.i2rkey = i2r + self._i2r_privacy = nil # clear cache self.r2ikey = r2i self.attestation_challenge = ac self.session_timestamp = st @@ -160,6 +163,14 @@ class Matter_Session def get_i2r() return self.i2rkey end + def get_i2r_privacy() # get and cache privacy key + if self._i2r_privacy == nil + import crypto + # compute privacy key according to p.127 + self._i2r_privacy = crypto.HKDF_SHA256().derive(self.get_i2r(), bytes(), bytes().fromstring("PrivacyKey"), 16) + end + return self._i2r_privacy + end def get_r2i() return self.r2ikey end diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Message.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Message.h index 044e02159..4ea63aebd 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Message.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Message.h @@ -19,166 +19,212 @@ be_local_closure(Matter_Frame_decrypt, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[30]) { /* constants */ + ( &(const bvalue[36]) { /* constants */ /* K0 */ be_nested_str_weak(crypto), /* K1 */ be_nested_str_weak(session), /* K2 */ be_nested_str_weak(raw), - /* K3 */ be_nested_str_weak(get_i2r), - /* K4 */ be_const_int(2147483647), - /* K5 */ be_const_int(0), - /* K6 */ be_nested_str_weak(payload_idx), - /* K7 */ be_const_int(1), - /* K8 */ be_nested_str_weak(add), - /* K9 */ be_nested_str_weak(flags), - /* K10 */ be_nested_str_weak(message_counter), - /* K11 */ be_nested_str_weak(source_node_id), - /* K12 */ be_nested_str_weak(peer_node_id), - /* K13 */ be_nested_str_weak(resize), - /* K14 */ be_nested_str_weak(tasmota), - /* K15 */ be_nested_str_weak(log), - /* K16 */ be_nested_str_weak(MTR_X3A_X20_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A), - /* K17 */ be_const_int(3), - /* K18 */ be_nested_str_weak(MTR_X3A_X20i2r_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), - /* K19 */ be_nested_str_weak(tohex), - /* K20 */ be_nested_str_weak(MTR_X3A_X20p_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), - /* K21 */ be_nested_str_weak(MTR_X3A_X20a_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), - /* K22 */ be_nested_str_weak(MTR_X3A_X20n_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), - /* K23 */ be_nested_str_weak(MTR_X3A_X20mic_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), - /* K24 */ be_nested_str_weak(AES_CCM), - /* K25 */ be_nested_str_weak(decrypt), - /* K26 */ be_nested_str_weak(tag), - /* K27 */ be_nested_str_weak(MTR_X3A_X20cleartext_X20_X20_X20_X3D), - /* K28 */ be_nested_str_weak(MTR_X3A_X20tag_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), - /* K29 */ be_nested_str_weak(MTR_X3A_X20rejected_X20packet_X20due_X20to_X20invalid_X20MIC), + /* K3 */ be_const_int(2147483647), + /* K4 */ be_nested_str_weak(get_i2r), + /* K5 */ be_nested_str_weak(sec_p), + /* K6 */ be_nested_str_weak(get_i2r_privacy), + /* K7 */ be_nested_str_weak(add), + /* K8 */ be_nested_str_weak(local_session_id), + /* K9 */ be_nested_str_weak(payload_idx), + /* K10 */ be_const_int(1), + /* K11 */ be_nested_str_weak(AES_CTR), + /* K12 */ be_nested_str_weak(decrypt), + /* K13 */ be_const_int(2), + /* K14 */ be_const_int(0), + /* K15 */ be_const_int(3), + /* K16 */ be_nested_str_weak(self), + /* K17 */ be_nested_str_weak(flags), + /* K18 */ be_nested_str_weak(message_counter), + /* K19 */ be_nested_str_weak(source_node_id), + /* K20 */ be_nested_str_weak(peer_node_id), + /* K21 */ be_nested_str_weak(resize), + /* K22 */ be_nested_str_weak(tasmota), + /* K23 */ be_nested_str_weak(log), + /* K24 */ be_nested_str_weak(MTR_X3A_X20_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A_X2A), + /* K25 */ be_nested_str_weak(MTR_X3A_X20i2r_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), + /* K26 */ be_nested_str_weak(tohex), + /* K27 */ be_nested_str_weak(MTR_X3A_X20p_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), + /* K28 */ be_nested_str_weak(MTR_X3A_X20a_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), + /* K29 */ be_nested_str_weak(MTR_X3A_X20n_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), + /* K30 */ be_nested_str_weak(MTR_X3A_X20mic_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), + /* K31 */ be_nested_str_weak(AES_CCM), + /* K32 */ be_nested_str_weak(tag), + /* K33 */ be_nested_str_weak(MTR_X3A_X20cleartext_X20_X20_X20_X3D), + /* K34 */ be_nested_str_weak(MTR_X3A_X20tag_X20_X20_X20_X20_X20_X20_X20_X20_X20_X3D), + /* K35 */ be_nested_str_weak(MTR_X3A_X20rejected_X20packet_X20due_X20to_X20invalid_X20MIC), }), be_str_weak(decrypt), &be_const_str_solidified, - ( &(const binstruction[125]) { /* code */ + ( &(const binstruction[165]) { /* code */ 0xA4060000, // 0000 IMPORT R1 K0 0x88080101, // 0001 GETMBR R2 R0 K1 0x880C0102, // 0002 GETMBR R3 R0 K2 - 0x8C100503, // 0003 GETMET R4 R2 K3 - 0x7C100200, // 0004 CALL R4 1 - 0x5415FFEF, // 0005 LDINT R5 -16 - 0x40140B04, // 0006 CONNECT R5 R5 K4 - 0x94140605, // 0007 GETIDX R5 R3 R5 - 0x88180106, // 0008 GETMBR R6 R0 K6 - 0x04180D07, // 0009 SUB R6 R6 K7 - 0x401A0A06, // 000A CONNECT R6 K5 R6 - 0x94180606, // 000B GETIDX R6 R3 R6 - 0x881C0106, // 000C GETMBR R7 R0 K6 - 0x5421FFEE, // 000D LDINT R8 -17 - 0x401C0E08, // 000E CONNECT R7 R7 R8 - 0x941C0607, // 000F GETIDX R7 R3 R7 - 0x60200015, // 0010 GETGBL R8 G21 - 0x7C200000, // 0011 CALL R8 0 - 0x8C241108, // 0012 GETMET R9 R8 K8 - 0x882C0109, // 0013 GETMBR R11 R0 K9 - 0x58300007, // 0014 LDCONST R12 K7 - 0x7C240600, // 0015 CALL R9 3 - 0x8C241108, // 0016 GETMET R9 R8 K8 - 0x882C010A, // 0017 GETMBR R11 R0 K10 - 0x54320003, // 0018 LDINT R12 4 - 0x7C240600, // 0019 CALL R9 3 - 0x8824010B, // 001A GETMBR R9 R0 K11 - 0x78260001, // 001B JMPF R9 #001E - 0x40241104, // 001C CONNECT R9 R8 K4 - 0x70020006, // 001D JMP #0025 - 0x8824050C, // 001E GETMBR R9 R2 K12 - 0x78260001, // 001F JMPF R9 #0022 - 0x8824050C, // 0020 GETMBR R9 R2 K12 - 0x40241009, // 0021 CONNECT R9 R8 R9 - 0x8C24110D, // 0022 GETMET R9 R8 K13 - 0x542E000C, // 0023 LDINT R11 13 - 0x7C240400, // 0024 CALL R9 2 - 0xB8261C00, // 0025 GETNGBL R9 K14 - 0x8C24130F, // 0026 GETMET R9 R9 K15 - 0x582C0010, // 0027 LDCONST R11 K16 - 0x58300011, // 0028 LDCONST R12 K17 - 0x7C240600, // 0029 CALL R9 3 - 0xB8261C00, // 002A GETNGBL R9 K14 - 0x8C24130F, // 002B GETMET R9 R9 K15 - 0x8C2C0913, // 002C GETMET R11 R4 K19 - 0x7C2C0200, // 002D CALL R11 1 - 0x002E240B, // 002E ADD R11 K18 R11 - 0x58300011, // 002F LDCONST R12 K17 - 0x7C240600, // 0030 CALL R9 3 - 0xB8261C00, // 0031 GETNGBL R9 K14 - 0x8C24130F, // 0032 GETMET R9 R9 K15 - 0x8C2C0F13, // 0033 GETMET R11 R7 K19 - 0x7C2C0200, // 0034 CALL R11 1 - 0x002E280B, // 0035 ADD R11 K20 R11 - 0x58300011, // 0036 LDCONST R12 K17 - 0x7C240600, // 0037 CALL R9 3 - 0xB8261C00, // 0038 GETNGBL R9 K14 - 0x8C24130F, // 0039 GETMET R9 R9 K15 - 0x8C2C0D13, // 003A GETMET R11 R6 K19 - 0x7C2C0200, // 003B CALL R11 1 - 0x002E2A0B, // 003C ADD R11 K21 R11 - 0x58300011, // 003D LDCONST R12 K17 - 0x7C240600, // 003E CALL R9 3 - 0xB8261C00, // 003F GETNGBL R9 K14 - 0x8C24130F, // 0040 GETMET R9 R9 K15 - 0x8C2C1113, // 0041 GETMET R11 R8 K19 - 0x7C2C0200, // 0042 CALL R11 1 - 0x002E2C0B, // 0043 ADD R11 K22 R11 - 0x58300011, // 0044 LDCONST R12 K17 - 0x7C240600, // 0045 CALL R9 3 - 0xB8261C00, // 0046 GETNGBL R9 K14 - 0x8C24130F, // 0047 GETMET R9 R9 K15 - 0x8C2C0B13, // 0048 GETMET R11 R5 K19 - 0x7C2C0200, // 0049 CALL R11 1 - 0x002E2E0B, // 004A ADD R11 K23 R11 - 0x58300011, // 004B LDCONST R12 K17 - 0x7C240600, // 004C CALL R9 3 - 0x8C240318, // 004D GETMET R9 R1 K24 - 0x5C2C0800, // 004E MOVE R11 R4 - 0x5C301000, // 004F MOVE R12 R8 - 0x5C340C00, // 0050 MOVE R13 R6 - 0x6038000C, // 0051 GETGBL R14 G12 - 0x5C3C0E00, // 0052 MOVE R15 R7 - 0x7C380200, // 0053 CALL R14 1 - 0x543E000F, // 0054 LDINT R15 16 - 0x7C240C00, // 0055 CALL R9 6 - 0x8C281319, // 0056 GETMET R10 R9 K25 - 0x5C300E00, // 0057 MOVE R12 R7 - 0x7C280400, // 0058 CALL R10 2 - 0x8C2C131A, // 0059 GETMET R11 R9 K26 - 0x7C2C0200, // 005A CALL R11 1 - 0xB8321C00, // 005B GETNGBL R12 K14 - 0x8C30190F, // 005C GETMET R12 R12 K15 - 0x58380010, // 005D LDCONST R14 K16 - 0x583C0011, // 005E LDCONST R15 K17 - 0x7C300600, // 005F CALL R12 3 - 0xB8321C00, // 0060 GETNGBL R12 K14 - 0x8C30190F, // 0061 GETMET R12 R12 K15 - 0x8C381513, // 0062 GETMET R14 R10 K19 - 0x7C380200, // 0063 CALL R14 1 - 0x003A360E, // 0064 ADD R14 K27 R14 - 0x583C0011, // 0065 LDCONST R15 K17 - 0x7C300600, // 0066 CALL R12 3 - 0xB8321C00, // 0067 GETNGBL R12 K14 - 0x8C30190F, // 0068 GETMET R12 R12 K15 - 0x8C381713, // 0069 GETMET R14 R11 K19 - 0x7C380200, // 006A CALL R14 1 - 0x003A380E, // 006B ADD R14 K28 R14 - 0x583C0011, // 006C LDCONST R15 K17 - 0x7C300600, // 006D CALL R12 3 - 0xB8321C00, // 006E GETNGBL R12 K14 - 0x8C30190F, // 006F GETMET R12 R12 K15 - 0x58380010, // 0070 LDCONST R14 K16 - 0x583C0011, // 0071 LDCONST R15 K17 - 0x7C300600, // 0072 CALL R12 3 - 0x20301605, // 0073 NE R12 R11 R5 - 0x78320006, // 0074 JMPF R12 #007C - 0xB8321C00, // 0075 GETNGBL R12 K14 - 0x8C30190F, // 0076 GETMET R12 R12 K15 - 0x5838001D, // 0077 LDCONST R14 K29 - 0x583C0011, // 0078 LDCONST R15 K17 - 0x7C300600, // 0079 CALL R12 3 - 0x4C300000, // 007A LDNIL R12 - 0x80041800, // 007B RET 1 R12 - 0x80041400, // 007C RET 1 R10 + 0x5411FFEF, // 0003 LDINT R4 -16 + 0x40100903, // 0004 CONNECT R4 R4 K3 + 0x94100604, // 0005 GETIDX R4 R3 R4 + 0x8C140504, // 0006 GETMET R5 R2 K4 + 0x7C140200, // 0007 CALL R5 1 + 0x88180105, // 0008 GETMBR R6 R0 K5 + 0x781A0025, // 0009 JMPF R6 #0030 + 0x8C180506, // 000A GETMET R6 R2 K6 + 0x7C180200, // 000B CALL R6 1 + 0x601C0015, // 000C GETGBL R7 G21 + 0x7C1C0000, // 000D CALL R7 0 + 0x8C1C0F07, // 000E GETMET R7 R7 K7 + 0x88240108, // 000F GETMBR R9 R0 K8 + 0x5429FFFD, // 0010 LDINT R10 -2 + 0x7C1C0600, // 0011 CALL R7 3 + 0x54220004, // 0012 LDINT R8 5 + 0x5426000E, // 0013 LDINT R9 15 + 0x40201009, // 0014 CONNECT R8 R8 R9 + 0x94200808, // 0015 GETIDX R8 R4 R8 + 0x001C0E08, // 0016 ADD R7 R7 R8 + 0x54220003, // 0017 LDINT R8 4 + 0x88240109, // 0018 GETMBR R9 R0 K9 + 0x0424130A, // 0019 SUB R9 R9 K10 + 0x40201009, // 001A CONNECT R8 R8 R9 + 0x88240102, // 001B GETMBR R9 R0 K2 + 0x94201208, // 001C GETIDX R8 R9 R8 + 0x8C28030B, // 001D GETMET R10 R1 K11 + 0x5C300C00, // 001E MOVE R12 R6 + 0x7C280400, // 001F CALL R10 2 + 0x8C28150C, // 0020 GETMET R10 R10 K12 + 0x5C301000, // 0021 MOVE R12 R8 + 0x5C340E00, // 0022 MOVE R13 R7 + 0x5838000D, // 0023 LDCONST R14 K13 + 0x7C280800, // 0024 CALL R10 4 + 0x5C241400, // 0025 MOVE R9 R10 + 0x402A1D0F, // 0026 CONNECT R10 K14 K15 + 0x882C0102, // 0027 GETMBR R11 R0 K2 + 0x9428160A, // 0028 GETIDX R10 R11 R10 + 0x00281409, // 0029 ADD R10 R10 R9 + 0x882C0110, // 002A GETMBR R11 R0 K16 + 0x882C1709, // 002B GETMBR R11 R11 K9 + 0x402C1703, // 002C CONNECT R11 R11 K3 + 0x942C100B, // 002D GETIDX R11 R8 R11 + 0x0028140B, // 002E ADD R10 R10 R11 + 0x9002040A, // 002F SETMBR R0 K2 R10 + 0x88180109, // 0030 GETMBR R6 R0 K9 + 0x04180D0A, // 0031 SUB R6 R6 K10 + 0x401A1C06, // 0032 CONNECT R6 K14 R6 + 0x94180606, // 0033 GETIDX R6 R3 R6 + 0x881C0109, // 0034 GETMBR R7 R0 K9 + 0x5421FFEE, // 0035 LDINT R8 -17 + 0x401C0E08, // 0036 CONNECT R7 R7 R8 + 0x941C0607, // 0037 GETIDX R7 R3 R7 + 0x60200015, // 0038 GETGBL R8 G21 + 0x7C200000, // 0039 CALL R8 0 + 0x8C241107, // 003A GETMET R9 R8 K7 + 0x882C0111, // 003B GETMBR R11 R0 K17 + 0x5830000A, // 003C LDCONST R12 K10 + 0x7C240600, // 003D CALL R9 3 + 0x8C241107, // 003E GETMET R9 R8 K7 + 0x882C0112, // 003F GETMBR R11 R0 K18 + 0x54320003, // 0040 LDINT R12 4 + 0x7C240600, // 0041 CALL R9 3 + 0x88240113, // 0042 GETMBR R9 R0 K19 + 0x78260001, // 0043 JMPF R9 #0046 + 0x40241103, // 0044 CONNECT R9 R8 K3 + 0x70020006, // 0045 JMP #004D + 0x88240514, // 0046 GETMBR R9 R2 K20 + 0x78260001, // 0047 JMPF R9 #004A + 0x88240514, // 0048 GETMBR R9 R2 K20 + 0x40241009, // 0049 CONNECT R9 R8 R9 + 0x8C241115, // 004A GETMET R9 R8 K21 + 0x542E000C, // 004B LDINT R11 13 + 0x7C240400, // 004C CALL R9 2 + 0xB8262C00, // 004D GETNGBL R9 K22 + 0x8C241317, // 004E GETMET R9 R9 K23 + 0x582C0018, // 004F LDCONST R11 K24 + 0x5830000F, // 0050 LDCONST R12 K15 + 0x7C240600, // 0051 CALL R9 3 + 0xB8262C00, // 0052 GETNGBL R9 K22 + 0x8C241317, // 0053 GETMET R9 R9 K23 + 0x8C2C0B1A, // 0054 GETMET R11 R5 K26 + 0x7C2C0200, // 0055 CALL R11 1 + 0x002E320B, // 0056 ADD R11 K25 R11 + 0x5830000F, // 0057 LDCONST R12 K15 + 0x7C240600, // 0058 CALL R9 3 + 0xB8262C00, // 0059 GETNGBL R9 K22 + 0x8C241317, // 005A GETMET R9 R9 K23 + 0x8C2C0F1A, // 005B GETMET R11 R7 K26 + 0x7C2C0200, // 005C CALL R11 1 + 0x002E360B, // 005D ADD R11 K27 R11 + 0x5830000F, // 005E LDCONST R12 K15 + 0x7C240600, // 005F CALL R9 3 + 0xB8262C00, // 0060 GETNGBL R9 K22 + 0x8C241317, // 0061 GETMET R9 R9 K23 + 0x8C2C0D1A, // 0062 GETMET R11 R6 K26 + 0x7C2C0200, // 0063 CALL R11 1 + 0x002E380B, // 0064 ADD R11 K28 R11 + 0x5830000F, // 0065 LDCONST R12 K15 + 0x7C240600, // 0066 CALL R9 3 + 0xB8262C00, // 0067 GETNGBL R9 K22 + 0x8C241317, // 0068 GETMET R9 R9 K23 + 0x8C2C111A, // 0069 GETMET R11 R8 K26 + 0x7C2C0200, // 006A CALL R11 1 + 0x002E3A0B, // 006B ADD R11 K29 R11 + 0x5830000F, // 006C LDCONST R12 K15 + 0x7C240600, // 006D CALL R9 3 + 0xB8262C00, // 006E GETNGBL R9 K22 + 0x8C241317, // 006F GETMET R9 R9 K23 + 0x8C2C091A, // 0070 GETMET R11 R4 K26 + 0x7C2C0200, // 0071 CALL R11 1 + 0x002E3C0B, // 0072 ADD R11 K30 R11 + 0x5830000F, // 0073 LDCONST R12 K15 + 0x7C240600, // 0074 CALL R9 3 + 0x8C24031F, // 0075 GETMET R9 R1 K31 + 0x5C2C0A00, // 0076 MOVE R11 R5 + 0x5C301000, // 0077 MOVE R12 R8 + 0x5C340C00, // 0078 MOVE R13 R6 + 0x6038000C, // 0079 GETGBL R14 G12 + 0x5C3C0E00, // 007A MOVE R15 R7 + 0x7C380200, // 007B CALL R14 1 + 0x543E000F, // 007C LDINT R15 16 + 0x7C240C00, // 007D CALL R9 6 + 0x8C28130C, // 007E GETMET R10 R9 K12 + 0x5C300E00, // 007F MOVE R12 R7 + 0x7C280400, // 0080 CALL R10 2 + 0x8C2C1320, // 0081 GETMET R11 R9 K32 + 0x7C2C0200, // 0082 CALL R11 1 + 0xB8322C00, // 0083 GETNGBL R12 K22 + 0x8C301917, // 0084 GETMET R12 R12 K23 + 0x58380018, // 0085 LDCONST R14 K24 + 0x583C000F, // 0086 LDCONST R15 K15 + 0x7C300600, // 0087 CALL R12 3 + 0xB8322C00, // 0088 GETNGBL R12 K22 + 0x8C301917, // 0089 GETMET R12 R12 K23 + 0x8C38151A, // 008A GETMET R14 R10 K26 + 0x7C380200, // 008B CALL R14 1 + 0x003A420E, // 008C ADD R14 K33 R14 + 0x583C000F, // 008D LDCONST R15 K15 + 0x7C300600, // 008E CALL R12 3 + 0xB8322C00, // 008F GETNGBL R12 K22 + 0x8C301917, // 0090 GETMET R12 R12 K23 + 0x8C38171A, // 0091 GETMET R14 R11 K26 + 0x7C380200, // 0092 CALL R14 1 + 0x003A440E, // 0093 ADD R14 K34 R14 + 0x583C000F, // 0094 LDCONST R15 K15 + 0x7C300600, // 0095 CALL R12 3 + 0xB8322C00, // 0096 GETNGBL R12 K22 + 0x8C301917, // 0097 GETMET R12 R12 K23 + 0x58380018, // 0098 LDCONST R14 K24 + 0x583C000F, // 0099 LDCONST R15 K15 + 0x7C300600, // 009A CALL R12 3 + 0x20301604, // 009B NE R12 R11 R4 + 0x78320006, // 009C JMPF R12 #00A4 + 0xB8322C00, // 009D GETNGBL R12 K22 + 0x8C301917, // 009E GETMET R12 R12 K23 + 0x58380023, // 009F LDCONST R14 K35 + 0x583C000F, // 00A0 LDCONST R15 K15 + 0x7C300600, // 00A1 CALL R12 3 + 0x4C300000, // 00A2 LDNIL R12 + 0x80041800, // 00A3 RET 1 R12 + 0x80041400, // 00A4 RET 1 R10 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Session.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Session.h index 30d718e06..3857f1e4d 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Session.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Session.h @@ -7,45 +7,9 @@ extern const bclass be_class_Matter_Session; /******************************************************************** -** Solidified function: get_pk +** Solidified function: get_fabric_compressed ********************************************************************/ -be_local_closure(Matter_Session_get_pk, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(no_private_key), - /* K1 */ be_nested_str_weak(crypto), - /* K2 */ be_nested_str_weak(random), - }), - be_str_weak(get_pk), - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x74060004, // 0001 JMPT R1 #0007 - 0xA4060200, // 0002 IMPORT R1 K1 - 0x8C080302, // 0003 GETMET R2 R1 K2 - 0x5412001F, // 0004 LDINT R4 32 - 0x7C080400, // 0005 CALL R2 2 - 0x90020002, // 0006 SETMBR R0 K0 R2 - 0x88040100, // 0007 GETMBR R1 R0 K0 - 0x80040200, // 0008 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_ac -********************************************************************/ -be_local_closure(Matter_Session_get_ac, /* name */ +be_local_closure(Matter_Session_get_fabric_compressed, /* name */ be_nested_proto( 2, /* nstack */ 1, /* argc */ @@ -56,9 +20,9 @@ be_local_closure(Matter_Session_get_ac, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(attestation_challenge), + /* K0 */ be_nested_str_weak(fabric_compressed), }), - be_str_weak(get_ac), + be_str_weak(get_fabric_compressed), &be_const_str_solidified, ( &(const binstruction[ 2]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 @@ -69,6 +33,178 @@ be_local_closure(Matter_Session_get_ac, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: set_no_expiration +********************************************************************/ +be_local_closure(Matter_Session_set_no_expiration, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(expiration), + }), + be_str_weak(set_no_expiration), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x4C040000, // 0000 LDNIL R1 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_ca +********************************************************************/ +be_local_closure(Matter_Session_set_ca, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(root_ca_certificate), + }), + be_str_weak(set_ca), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_fabric_device +********************************************************************/ +be_local_closure(Matter_Session_set_fabric_device, /* name */ + be_nested_proto( + 7, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(fabric), + /* K1 */ be_nested_str_weak(deviceid), + /* K2 */ be_nested_str_weak(fabric_compressed), + /* K3 */ be_nested_str_weak(__store), + /* K4 */ be_nested_str_weak(remove_redundant_session), + }), + be_str_weak(set_fabric_device), + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x90020403, // 0002 SETMBR R0 K2 R3 + 0x88100103, // 0003 GETMBR R4 R0 K3 + 0x8C100904, // 0004 GETMET R4 R4 K4 + 0x5C180000, // 0005 MOVE R6 R0 + 0x7C100400, // 0006 CALL R4 2 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_r2i +********************************************************************/ +be_local_closure(Matter_Session_get_r2i, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(r2ikey), + }), + be_str_weak(get_r2i), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_i2r_privacy +********************************************************************/ +be_local_closure(Matter_Session_get_i2r_privacy, /* name */ + be_nested_proto( + 9, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str_weak(_i2r_privacy), + /* K1 */ be_nested_str_weak(crypto), + /* K2 */ be_nested_str_weak(HKDF_SHA256), + /* K3 */ be_nested_str_weak(derive), + /* K4 */ be_nested_str_weak(get_i2r), + /* K5 */ be_nested_str_weak(fromstring), + /* K6 */ be_nested_str_weak(PrivacyKey), + }), + be_str_weak(get_i2r_privacy), + &be_const_str_solidified, + ( &(const binstruction[22]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x1C040202, // 0002 EQ R1 R1 R2 + 0x7806000F, // 0003 JMPF R1 #0014 + 0xA4060200, // 0004 IMPORT R1 K1 + 0x8C080302, // 0005 GETMET R2 R1 K2 + 0x7C080200, // 0006 CALL R2 1 + 0x8C080503, // 0007 GETMET R2 R2 K3 + 0x8C100104, // 0008 GETMET R4 R0 K4 + 0x7C100200, // 0009 CALL R4 1 + 0x60140015, // 000A GETGBL R5 G21 + 0x7C140000, // 000B CALL R5 0 + 0x60180015, // 000C GETGBL R6 G21 + 0x7C180000, // 000D CALL R6 0 + 0x8C180D05, // 000E GETMET R6 R6 K5 + 0x58200006, // 000F LDCONST R8 K6 + 0x7C180400, // 0010 CALL R6 2 + 0x541E000F, // 0011 LDINT R7 16 + 0x7C080A00, // 0012 CALL R2 5 + 0x90020002, // 0013 SETMBR R0 K0 R2 + 0x88040100, // 0014 GETMBR R1 R0 K0 + 0x80040200, // 0015 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: get_ipk_group_key ********************************************************************/ @@ -126,26 +262,130 @@ be_local_closure(Matter_Session_get_ipk_group_key, /* name */ /******************************************************************** -** Solidified function: set_ca +** Solidified function: fromjson ********************************************************************/ -be_local_closure(Matter_Session_set_ca, /* name */ +be_local_closure(Matter_Session_fromjson, /* name */ be_nested_proto( - 2, /* nstack */ + 16, /* nstack */ 2, /* argc */ - 2, /* varg */ + 4, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(root_ca_certificate), + ( &(const bvalue[19]) { /* constants */ + /* K0 */ be_const_class(be_class_Matter_Session), + /* K1 */ be_nested_str_weak(string), + /* K2 */ be_nested_str_weak(introspect), + /* K3 */ be_nested_str_weak(matter), + /* K4 */ be_nested_str_weak(Session), + /* K5 */ be_nested_str_weak(keys), + /* K6 */ be_nested_str_weak(counter_rcv), + /* K7 */ be_nested_str_weak(reset), + /* K8 */ be_nested_str_weak(counter_snd), + /* K9 */ be_nested_str_weak(find), + /* K10 */ be_nested_str_weak(0x), + /* K11 */ be_const_int(0), + /* K12 */ be_nested_str_weak(set), + /* K13 */ be_nested_str_weak(fromhex), + /* K14 */ be_const_int(2), + /* K15 */ be_const_int(2147483647), + /* K16 */ be_nested_str_weak(_X24_X24), + /* K17 */ be_nested_str_weak(fromb64), + /* K18 */ be_nested_str_weak(stop_iteration), }), - be_str_weak(set_ca), + be_str_weak(fromjson), &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x80000000, // 0001 RET 0 + ( &(const binstruction[88]) { /* code */ + 0x58080000, // 0000 LDCONST R2 K0 + 0xA40E0200, // 0001 IMPORT R3 K1 + 0xA4120400, // 0002 IMPORT R4 K2 + 0xB8160600, // 0003 GETNGBL R5 K3 + 0x8C140B04, // 0004 GETMET R5 R5 K4 + 0x5C1C0000, // 0005 MOVE R7 R0 + 0x7C140400, // 0006 CALL R5 2 + 0x60180010, // 0007 GETGBL R6 G16 + 0x8C1C0305, // 0008 GETMET R7 R1 K5 + 0x7C1C0200, // 0009 CALL R7 1 + 0x7C180200, // 000A CALL R6 1 + 0xA8020047, // 000B EXBLK 0 #0054 + 0x5C1C0C00, // 000C MOVE R7 R6 + 0x7C1C0000, // 000D CALL R7 0 + 0x94200207, // 000E GETIDX R8 R1 R7 + 0x1C240F06, // 000F EQ R9 R7 K6 + 0x78260006, // 0010 JMPF R9 #0018 + 0x88240B06, // 0011 GETMBR R9 R5 K6 + 0x8C241307, // 0012 GETMET R9 R9 K7 + 0x602C0009, // 0013 GETGBL R11 G9 + 0x5C301000, // 0014 MOVE R12 R8 + 0x7C2C0200, // 0015 CALL R11 1 + 0x7C240400, // 0016 CALL R9 2 + 0x7002003A, // 0017 JMP #0053 + 0x1C240F08, // 0018 EQ R9 R7 K8 + 0x78260006, // 0019 JMPF R9 #0021 + 0x88240B08, // 001A GETMBR R9 R5 K8 + 0x8C241307, // 001B GETMET R9 R9 K7 + 0x602C0009, // 001C GETGBL R11 G9 + 0x5C301000, // 001D MOVE R12 R8 + 0x7C2C0200, // 001E CALL R11 1 + 0x7C240400, // 001F CALL R9 2 + 0x70020031, // 0020 JMP #0053 + 0x60240004, // 0021 GETGBL R9 G4 + 0x5C281000, // 0022 MOVE R10 R8 + 0x7C240200, // 0023 CALL R9 1 + 0x1C241301, // 0024 EQ R9 R9 K1 + 0x78260027, // 0025 JMPF R9 #004E + 0x8C240709, // 0026 GETMET R9 R3 K9 + 0x5C2C1000, // 0027 MOVE R11 R8 + 0x5830000A, // 0028 LDCONST R12 K10 + 0x7C240600, // 0029 CALL R9 3 + 0x1C24130B, // 002A EQ R9 R9 K11 + 0x7826000A, // 002B JMPF R9 #0037 + 0x8C24090C, // 002C GETMET R9 R4 K12 + 0x5C2C0A00, // 002D MOVE R11 R5 + 0x5C300E00, // 002E MOVE R12 R7 + 0x60340015, // 002F GETGBL R13 G21 + 0x7C340000, // 0030 CALL R13 0 + 0x8C341B0D, // 0031 GETMET R13 R13 K13 + 0x403E1D0F, // 0032 CONNECT R15 K14 K15 + 0x943C100F, // 0033 GETIDX R15 R8 R15 + 0x7C340400, // 0034 CALL R13 2 + 0x7C240800, // 0035 CALL R9 4 + 0x70020015, // 0036 JMP #004D + 0x8C240709, // 0037 GETMET R9 R3 K9 + 0x5C2C1000, // 0038 MOVE R11 R8 + 0x58300010, // 0039 LDCONST R12 K16 + 0x7C240600, // 003A CALL R9 3 + 0x1C24130B, // 003B EQ R9 R9 K11 + 0x7826000A, // 003C JMPF R9 #0048 + 0x8C24090C, // 003D GETMET R9 R4 K12 + 0x5C2C0A00, // 003E MOVE R11 R5 + 0x5C300E00, // 003F MOVE R12 R7 + 0x60340015, // 0040 GETGBL R13 G21 + 0x7C340000, // 0041 CALL R13 0 + 0x8C341B11, // 0042 GETMET R13 R13 K17 + 0x403E1D0F, // 0043 CONNECT R15 K14 K15 + 0x943C100F, // 0044 GETIDX R15 R8 R15 + 0x7C340400, // 0045 CALL R13 2 + 0x7C240800, // 0046 CALL R9 4 + 0x70020004, // 0047 JMP #004D + 0x8C24090C, // 0048 GETMET R9 R4 K12 + 0x5C2C0A00, // 0049 MOVE R11 R5 + 0x5C300E00, // 004A MOVE R12 R7 + 0x5C341000, // 004B MOVE R13 R8 + 0x7C240800, // 004C CALL R9 4 + 0x70020004, // 004D JMP #0053 + 0x8C24090C, // 004E GETMET R9 R4 K12 + 0x5C2C0A00, // 004F MOVE R11 R5 + 0x5C300E00, // 0050 MOVE R12 R7 + 0x5C341000, // 0051 MOVE R13 R8 + 0x7C240800, // 0052 CALL R9 4 + 0x7001FFB7, // 0053 JMP #000C + 0x58180012, // 0054 LDCONST R6 K18 + 0xAC180200, // 0055 CATCH R6 1 0 + 0xB0080000, // 0056 RAISE 2 R0 R0 + 0x80040A00, // 0057 RET 1 R5 }) ) ); @@ -153,11 +393,11 @@ be_local_closure(Matter_Session_set_ca, /* name */ /******************************************************************** -** Solidified function: save +** Solidified function: get_deviceid ********************************************************************/ -be_local_closure(Matter_Session_save, /* name */ +be_local_closure(Matter_Session_get_deviceid, /* name */ be_nested_proto( - 3, /* nstack */ + 2, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -165,44 +405,14 @@ be_local_closure(Matter_Session_save, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(__store), - /* K1 */ be_nested_str_weak(save), - }), - be_str_weak(save), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_ipk_epoch_key -********************************************************************/ -be_local_closure(Matter_Session_set_ipk_epoch_key, /* name */ - be_nested_proto( - 2, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(ipk_epoch_key), + /* K0 */ be_nested_str_weak(deviceid), }), - be_str_weak(set_ipk_epoch_key), + be_str_weak(get_deviceid), &be_const_str_solidified, ( &(const binstruction[ 2]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x80000000, // 0001 RET 0 + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 }) ) ); @@ -210,29 +420,103 @@ be_local_closure(Matter_Session_set_ipk_epoch_key, /* name */ /******************************************************************** -** Solidified function: set_expire_time +** Solidified function: close ********************************************************************/ -be_local_closure(Matter_Session_set_expire_time, /* name */ +be_local_closure(Matter_Session_close, /* name */ be_nested_proto( - 4, /* nstack */ - 2, /* argc */ + 9, /* nstack */ + 1, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(expiration), + ( &(const bvalue[22]) { /* constants */ + /* K0 */ be_nested_str_weak(_persist), + /* K1 */ be_nested_str_weak(local_session_id), + /* K2 */ be_nested_str_weak(_future_local_session_id), + /* K3 */ be_nested_str_weak(initiator_session_id), + /* K4 */ be_nested_str_weak(_future_initiator_session_id), + /* K5 */ be_nested_str_weak(source_node_id), + /* K6 */ be_nested_str_weak(counter_rcv), + /* K7 */ be_nested_str_weak(reset), + /* K8 */ be_nested_str_weak(counter_snd), + /* K9 */ be_nested_str_weak(i2rkey), + /* K10 */ be_nested_str_weak(_i2r_privacy), + /* K11 */ be_nested_str_weak(r2ikey), + /* K12 */ be_nested_str_weak(attestation_challenge), + /* K13 */ be_nested_str_weak(introspect), + /* K14 */ be_nested_str_weak(members), + /* K15 */ be_nested_str_weak(get), + /* K16 */ be_nested_str_weak(function), + /* K17 */ be_nested_str_weak(instance), + /* K18 */ be_const_int(0), + /* K19 */ be_nested_str_weak(_), + /* K20 */ be_const_int(1), + /* K21 */ be_nested_str_weak(stop_iteration), }), - be_str_weak(set_expire_time), + be_str_weak(close), &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x60080009, // 0000 GETGBL R2 G9 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x90020002, // 0003 SETMBR R0 K0 R2 - 0x80000000, // 0004 RET 0 + ( &(const binstruction[58]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x88080102, // 0001 GETMBR R2 R0 K2 + 0x90020202, // 0002 SETMBR R0 K1 R2 + 0x88080104, // 0003 GETMBR R2 R0 K4 + 0x90020602, // 0004 SETMBR R0 K3 R2 + 0x4C080000, // 0005 LDNIL R2 + 0x90020A02, // 0006 SETMBR R0 K5 R2 + 0x88080106, // 0007 GETMBR R2 R0 K6 + 0x8C080507, // 0008 GETMET R2 R2 K7 + 0x7C080200, // 0009 CALL R2 1 + 0x88080108, // 000A GETMBR R2 R0 K8 + 0x8C080507, // 000B GETMET R2 R2 K7 + 0x7C080200, // 000C CALL R2 1 + 0x4C080000, // 000D LDNIL R2 + 0x90021202, // 000E SETMBR R0 K9 R2 + 0x4C080000, // 000F LDNIL R2 + 0x90021402, // 0010 SETMBR R0 K10 R2 + 0x4C080000, // 0011 LDNIL R2 + 0x90021602, // 0012 SETMBR R0 K11 R2 + 0x4C080000, // 0013 LDNIL R2 + 0x90021802, // 0014 SETMBR R0 K12 R2 + 0xA40A1A00, // 0015 IMPORT R2 K13 + 0x600C0010, // 0016 GETGBL R3 G16 + 0x8C10050E, // 0017 GETMET R4 R2 K14 + 0x5C180000, // 0018 MOVE R6 R0 + 0x7C100400, // 0019 CALL R4 2 + 0x7C0C0200, // 001A CALL R3 1 + 0xA8020018, // 001B EXBLK 0 #0035 + 0x5C100600, // 001C MOVE R4 R3 + 0x7C100000, // 001D CALL R4 0 + 0x8C14050F, // 001E GETMET R5 R2 K15 + 0x5C1C0000, // 001F MOVE R7 R0 + 0x5C200800, // 0020 MOVE R8 R4 + 0x7C140600, // 0021 CALL R5 3 + 0x60180004, // 0022 GETGBL R6 G4 + 0x5C1C0A00, // 0023 MOVE R7 R5 + 0x7C180200, // 0024 CALL R6 1 + 0x20180D10, // 0025 NE R6 R6 K16 + 0x781A000C, // 0026 JMPF R6 #0034 + 0x60180004, // 0027 GETGBL R6 G4 + 0x5C1C0A00, // 0028 MOVE R7 R5 + 0x7C180200, // 0029 CALL R6 1 + 0x20180D11, // 002A NE R6 R6 K17 + 0x781A0007, // 002B JMPF R6 #0034 + 0x94180912, // 002C GETIDX R6 R4 K18 + 0x1C180D13, // 002D EQ R6 R6 K19 + 0x781A0004, // 002E JMPF R6 #0034 + 0x94180914, // 002F GETIDX R6 R4 K20 + 0x20180D13, // 0030 NE R6 R6 K19 + 0x781A0001, // 0031 JMPF R6 #0034 + 0x4C180000, // 0032 LDNIL R6 + 0x90000806, // 0033 SETMBR R0 R4 R6 + 0x7001FFE6, // 0034 JMP #001C + 0x580C0015, // 0035 LDCONST R3 K21 + 0xAC0C0200, // 0036 CATCH R3 1 0 + 0xB0080000, // 0037 RAISE 2 R0 R0 + 0x90020001, // 0038 SETMBR R0 K0 R1 + 0x80000000, // 0039 RET 0 }) ) ); @@ -240,42 +524,35 @@ be_local_closure(Matter_Session_set_expire_time, /* name */ /******************************************************************** -** Solidified function: set_expire_in_seconds +** Solidified function: get_pk ********************************************************************/ -be_local_closure(Matter_Session_set_expire_in_seconds, /* name */ +be_local_closure(Matter_Session_get_pk, /* name */ be_nested_proto( - 6, /* nstack */ - 3, /* argc */ + 5, /* nstack */ + 1, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(rtc), - /* K2 */ be_nested_str_weak(utc), - /* K3 */ be_nested_str_weak(set_expire_time), + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(no_private_key), + /* K1 */ be_nested_str_weak(crypto), + /* K2 */ be_nested_str_weak(random), }), - be_str_weak(set_expire_in_seconds), + be_str_weak(get_pk), &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x4C0C0000, // 0000 LDNIL R3 - 0x1C0C0203, // 0001 EQ R3 R1 R3 - 0x780E0000, // 0002 JMPF R3 #0004 - 0x80000600, // 0003 RET 0 - 0x4C0C0000, // 0004 LDNIL R3 - 0x1C0C0403, // 0005 EQ R3 R2 R3 - 0x780E0003, // 0006 JMPF R3 #000B - 0xB80E0000, // 0007 GETNGBL R3 K0 - 0x8C0C0701, // 0008 GETMET R3 R3 K1 - 0x7C0C0200, // 0009 CALL R3 1 - 0x94080702, // 000A GETIDX R2 R3 K2 - 0x8C0C0103, // 000B GETMET R3 R0 K3 - 0x00140401, // 000C ADD R5 R2 R1 - 0x7C0C0400, // 000D CALL R3 2 - 0x80000000, // 000E RET 0 + ( &(const binstruction[ 9]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x74060004, // 0001 JMPT R1 #0007 + 0xA4060200, // 0002 IMPORT R1 K1 + 0x8C080302, // 0003 GETMET R2 R1 K2 + 0x5412001F, // 0004 LDINT R4 32 + 0x7C080400, // 0005 CALL R2 2 + 0x90020002, // 0006 SETMBR R0 K0 R2 + 0x88040100, // 0007 GETMBR R1 R0 K0 + 0x80040200, // 0008 RET 1 R1 }) ) ); @@ -429,9 +706,66 @@ be_local_closure(Matter_Session_tojson, /* name */ /******************************************************************** -** Solidified function: get_noc +** Solidified function: set_expire_time ********************************************************************/ -be_local_closure(Matter_Session_get_noc, /* name */ +be_local_closure(Matter_Session_set_expire_time, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(expiration), + }), + be_str_weak(set_expire_time), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x60080009, // 0000 GETGBL R2 G9 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x90020002, // 0003 SETMBR R0 K0 R2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_mode +********************************************************************/ +be_local_closure(Matter_Session_set_mode, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(mode), + }), + be_str_weak(set_mode), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_icac +********************************************************************/ +be_local_closure(Matter_Session_get_icac, /* name */ be_nested_proto( 2, /* nstack */ 1, /* argc */ @@ -442,9 +776,301 @@ be_local_closure(Matter_Session_get_noc, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(noc), + /* K0 */ be_nested_str_weak(icac), }), - be_str_weak(get_noc), + be_str_weak(get_icac), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_persist +********************************************************************/ +be_local_closure(Matter_Session_set_persist, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(_persist), + }), + be_str_weak(set_persist), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x60080017, // 0000 GETGBL R2 G23 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x90020002, // 0003 SETMBR R0 K0 R2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_ipk_epoch_key +********************************************************************/ +be_local_closure(Matter_Session_set_ipk_epoch_key, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(ipk_epoch_key), + }), + be_str_weak(set_ipk_epoch_key), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_mode +********************************************************************/ +be_local_closure(Matter_Session_get_mode, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(mode), + }), + be_str_weak(get_mode), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_ca +********************************************************************/ +be_local_closure(Matter_Session_get_ca, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(root_ca_certificate), + }), + be_str_weak(get_ca), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: save +********************************************************************/ +be_local_closure(Matter_Session_save, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(__store), + /* K1 */ be_nested_str_weak(save), + }), + be_str_weak(save), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_ca_pub +********************************************************************/ +be_local_closure(Matter_Session_get_ca_pub, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(root_ca_certificate), + /* K1 */ be_nested_str_weak(matter), + /* K2 */ be_nested_str_weak(TLV), + /* K3 */ be_nested_str_weak(parse), + /* K4 */ be_nested_str_weak(findsubval), + }), + be_str_weak(get_ca_pub), + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x78060008, // 0001 JMPF R1 #000B + 0xB8060200, // 0002 GETNGBL R1 K1 + 0x88040302, // 0003 GETMBR R1 R1 K2 + 0x8C040303, // 0004 GETMET R1 R1 K3 + 0x880C0100, // 0005 GETMBR R3 R0 K0 + 0x7C040400, // 0006 CALL R1 2 + 0x8C080304, // 0007 GETMET R2 R1 K4 + 0x54120008, // 0008 LDINT R4 9 + 0x7C080400, // 0009 CALL R2 2 + 0x80040400, // 000A RET 1 R2 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_ipk_epoch_key +********************************************************************/ +be_local_closure(Matter_Session_get_ipk_epoch_key, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(ipk_epoch_key), + }), + be_str_weak(get_ipk_epoch_key), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_ac +********************************************************************/ +be_local_closure(Matter_Session_get_ac, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(attestation_challenge), + }), + be_str_weak(get_ac), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_noc +********************************************************************/ +be_local_closure(Matter_Session_set_noc, /* name */ + be_nested_proto( + 3, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(noc), + /* K1 */ be_nested_str_weak(icac), + }), + be_str_weak(set_noc), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_i2r +********************************************************************/ +be_local_closure(Matter_Session_get_i2r, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(i2rkey), + }), + be_str_weak(get_i2r), &be_const_str_solidified, ( &(const binstruction[ 2]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 @@ -483,43 +1109,35 @@ be_local_closure(Matter_Session_get_fabric, /* name */ /******************************************************************** -** Solidified function: has_expired +** Solidified function: set_keys ********************************************************************/ -be_local_closure(Matter_Session_has_expired, /* name */ +be_local_closure(Matter_Session_set_keys, /* name */ be_nested_proto( - 4, /* nstack */ - 2, /* argc */ + 6, /* nstack */ + 5, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(rtc), - /* K2 */ be_nested_str_weak(utc), - /* K3 */ be_nested_str_weak(expiration), + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(i2rkey), + /* K1 */ be_nested_str_weak(_i2r_privacy), + /* K2 */ be_nested_str_weak(r2ikey), + /* K3 */ be_nested_str_weak(attestation_challenge), + /* K4 */ be_nested_str_weak(session_timestamp), }), - be_str_weak(has_expired), + be_str_weak(set_keys), &be_const_str_solidified, - ( &(const binstruction[16]) { /* code */ - 0x4C080000, // 0000 LDNIL R2 - 0x1C080202, // 0001 EQ R2 R1 R2 - 0x780A0003, // 0002 JMPF R2 #0007 - 0xB80A0000, // 0003 GETNGBL R2 K0 - 0x8C080501, // 0004 GETMET R2 R2 K1 - 0x7C080200, // 0005 CALL R2 1 - 0x94040502, // 0006 GETIDX R1 R2 K2 - 0x88080103, // 0007 GETMBR R2 R0 K3 - 0x4C0C0000, // 0008 LDNIL R3 - 0x20080403, // 0009 NE R2 R2 R3 - 0x780A0002, // 000A JMPF R2 #000E - 0x88080103, // 000B GETMBR R2 R0 K3 - 0x28080202, // 000C GE R2 R1 R2 - 0x80040400, // 000D RET 1 R2 - 0x50080000, // 000E LDBOOL R2 0 0 - 0x80040400, // 000F RET 1 R2 + ( &(const binstruction[ 7]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x4C140000, // 0001 LDNIL R5 + 0x90020205, // 0002 SETMBR R0 K1 R5 + 0x90020402, // 0003 SETMBR R0 K2 R2 + 0x90020603, // 0004 SETMBR R0 K3 R3 + 0x90020804, // 0005 SETMBR R0 K4 R4 + 0x80000000, // 0006 RET 0 }) ) ); @@ -527,140 +1145,9 @@ be_local_closure(Matter_Session_has_expired, /* name */ /******************************************************************** -** Solidified function: fromjson +** Solidified function: get_noc ********************************************************************/ -be_local_closure(Matter_Session_fromjson, /* name */ - be_nested_proto( - 16, /* nstack */ - 2, /* argc */ - 4, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[19]) { /* constants */ - /* K0 */ be_const_class(be_class_Matter_Session), - /* K1 */ be_nested_str_weak(string), - /* K2 */ be_nested_str_weak(introspect), - /* K3 */ be_nested_str_weak(matter), - /* K4 */ be_nested_str_weak(Session), - /* K5 */ be_nested_str_weak(keys), - /* K6 */ be_nested_str_weak(counter_rcv), - /* K7 */ be_nested_str_weak(reset), - /* K8 */ be_nested_str_weak(counter_snd), - /* K9 */ be_nested_str_weak(find), - /* K10 */ be_nested_str_weak(0x), - /* K11 */ be_const_int(0), - /* K12 */ be_nested_str_weak(set), - /* K13 */ be_nested_str_weak(fromhex), - /* K14 */ be_const_int(2), - /* K15 */ be_const_int(2147483647), - /* K16 */ be_nested_str_weak(_X24_X24), - /* K17 */ be_nested_str_weak(fromb64), - /* K18 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(fromjson), - &be_const_str_solidified, - ( &(const binstruction[88]) { /* code */ - 0x58080000, // 0000 LDCONST R2 K0 - 0xA40E0200, // 0001 IMPORT R3 K1 - 0xA4120400, // 0002 IMPORT R4 K2 - 0xB8160600, // 0003 GETNGBL R5 K3 - 0x8C140B04, // 0004 GETMET R5 R5 K4 - 0x5C1C0000, // 0005 MOVE R7 R0 - 0x7C140400, // 0006 CALL R5 2 - 0x60180010, // 0007 GETGBL R6 G16 - 0x8C1C0305, // 0008 GETMET R7 R1 K5 - 0x7C1C0200, // 0009 CALL R7 1 - 0x7C180200, // 000A CALL R6 1 - 0xA8020047, // 000B EXBLK 0 #0054 - 0x5C1C0C00, // 000C MOVE R7 R6 - 0x7C1C0000, // 000D CALL R7 0 - 0x94200207, // 000E GETIDX R8 R1 R7 - 0x1C240F06, // 000F EQ R9 R7 K6 - 0x78260006, // 0010 JMPF R9 #0018 - 0x88240B06, // 0011 GETMBR R9 R5 K6 - 0x8C241307, // 0012 GETMET R9 R9 K7 - 0x602C0009, // 0013 GETGBL R11 G9 - 0x5C301000, // 0014 MOVE R12 R8 - 0x7C2C0200, // 0015 CALL R11 1 - 0x7C240400, // 0016 CALL R9 2 - 0x7002003A, // 0017 JMP #0053 - 0x1C240F08, // 0018 EQ R9 R7 K8 - 0x78260006, // 0019 JMPF R9 #0021 - 0x88240B08, // 001A GETMBR R9 R5 K8 - 0x8C241307, // 001B GETMET R9 R9 K7 - 0x602C0009, // 001C GETGBL R11 G9 - 0x5C301000, // 001D MOVE R12 R8 - 0x7C2C0200, // 001E CALL R11 1 - 0x7C240400, // 001F CALL R9 2 - 0x70020031, // 0020 JMP #0053 - 0x60240004, // 0021 GETGBL R9 G4 - 0x5C281000, // 0022 MOVE R10 R8 - 0x7C240200, // 0023 CALL R9 1 - 0x1C241301, // 0024 EQ R9 R9 K1 - 0x78260027, // 0025 JMPF R9 #004E - 0x8C240709, // 0026 GETMET R9 R3 K9 - 0x5C2C1000, // 0027 MOVE R11 R8 - 0x5830000A, // 0028 LDCONST R12 K10 - 0x7C240600, // 0029 CALL R9 3 - 0x1C24130B, // 002A EQ R9 R9 K11 - 0x7826000A, // 002B JMPF R9 #0037 - 0x8C24090C, // 002C GETMET R9 R4 K12 - 0x5C2C0A00, // 002D MOVE R11 R5 - 0x5C300E00, // 002E MOVE R12 R7 - 0x60340015, // 002F GETGBL R13 G21 - 0x7C340000, // 0030 CALL R13 0 - 0x8C341B0D, // 0031 GETMET R13 R13 K13 - 0x403E1D0F, // 0032 CONNECT R15 K14 K15 - 0x943C100F, // 0033 GETIDX R15 R8 R15 - 0x7C340400, // 0034 CALL R13 2 - 0x7C240800, // 0035 CALL R9 4 - 0x70020015, // 0036 JMP #004D - 0x8C240709, // 0037 GETMET R9 R3 K9 - 0x5C2C1000, // 0038 MOVE R11 R8 - 0x58300010, // 0039 LDCONST R12 K16 - 0x7C240600, // 003A CALL R9 3 - 0x1C24130B, // 003B EQ R9 R9 K11 - 0x7826000A, // 003C JMPF R9 #0048 - 0x8C24090C, // 003D GETMET R9 R4 K12 - 0x5C2C0A00, // 003E MOVE R11 R5 - 0x5C300E00, // 003F MOVE R12 R7 - 0x60340015, // 0040 GETGBL R13 G21 - 0x7C340000, // 0041 CALL R13 0 - 0x8C341B11, // 0042 GETMET R13 R13 K17 - 0x403E1D0F, // 0043 CONNECT R15 K14 K15 - 0x943C100F, // 0044 GETIDX R15 R8 R15 - 0x7C340400, // 0045 CALL R13 2 - 0x7C240800, // 0046 CALL R9 4 - 0x70020004, // 0047 JMP #004D - 0x8C24090C, // 0048 GETMET R9 R4 K12 - 0x5C2C0A00, // 0049 MOVE R11 R5 - 0x5C300E00, // 004A MOVE R12 R7 - 0x5C341000, // 004B MOVE R13 R8 - 0x7C240800, // 004C CALL R9 4 - 0x70020004, // 004D JMP #0053 - 0x8C24090C, // 004E GETMET R9 R4 K12 - 0x5C2C0A00, // 004F MOVE R11 R5 - 0x5C300E00, // 0050 MOVE R12 R7 - 0x5C341000, // 0051 MOVE R13 R8 - 0x7C240800, // 0052 CALL R9 4 - 0x7001FFB7, // 0053 JMP #000C - 0x58180012, // 0054 LDCONST R6 K18 - 0xAC180200, // 0055 CATCH R6 1 0 - 0xB0080000, // 0056 RAISE 2 R0 R0 - 0x80040A00, // 0057 RET 1 R5 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_no_expiration -********************************************************************/ -be_local_closure(Matter_Session_set_no_expiration, /* name */ +be_local_closure(Matter_Session_get_noc, /* name */ be_nested_proto( 2, /* nstack */ 1, /* argc */ @@ -671,14 +1158,74 @@ be_local_closure(Matter_Session_set_no_expiration, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(expiration), + /* K0 */ be_nested_str_weak(noc), }), - be_str_weak(set_no_expiration), + be_str_weak(get_noc), &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x4C040000, // 0000 LDNIL R1 - 0x90020001, // 0001 SETMBR R0 K0 R1 - 0x80000000, // 0002 RET 0 + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Matter_Session_init, /* name */ + be_nested_proto( + 6, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str_weak(__store), + /* K1 */ be_nested_str_weak(mode), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(local_session_id), + /* K4 */ be_nested_str_weak(initiator_session_id), + /* K5 */ be_nested_str_weak(counter_rcv), + /* K6 */ be_nested_str_weak(matter), + /* K7 */ be_nested_str_weak(Counter), + /* K8 */ be_nested_str_weak(counter_snd), + /* K9 */ be_nested_str_weak(_counter_insecure_rcv), + /* K10 */ be_nested_str_weak(_counter_insecure_snd), + /* K11 */ be_nested_str_weak(breadcrumb), + /* K12 */ be_nested_str_weak(int64), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[24]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020302, // 0001 SETMBR R0 K1 K2 + 0x90020602, // 0002 SETMBR R0 K3 R2 + 0x90020803, // 0003 SETMBR R0 K4 R3 + 0xB8120C00, // 0004 GETNGBL R4 K6 + 0x8C100907, // 0005 GETMET R4 R4 K7 + 0x7C100200, // 0006 CALL R4 1 + 0x90020A04, // 0007 SETMBR R0 K5 R4 + 0xB8120C00, // 0008 GETNGBL R4 K6 + 0x8C100907, // 0009 GETMET R4 R4 K7 + 0x7C100200, // 000A CALL R4 1 + 0x90021004, // 000B SETMBR R0 K8 R4 + 0xB8120C00, // 000C GETNGBL R4 K6 + 0x8C100907, // 000D GETMET R4 R4 K7 + 0x7C100200, // 000E CALL R4 1 + 0x90021204, // 000F SETMBR R0 K9 R4 + 0xB8120C00, // 0010 GETNGBL R4 K6 + 0x8C100907, // 0011 GETMET R4 R4 K7 + 0x7C100200, // 0012 CALL R4 1 + 0x90021404, // 0013 SETMBR R0 K10 R4 + 0xB8121800, // 0014 GETNGBL R4 K12 + 0x7C100000, // 0015 CALL R4 0 + 0x90021604, // 0016 SETMBR R0 K11 R4 + 0x80000000, // 0017 RET 0 }) ) ); @@ -795,71 +1342,11 @@ be_local_closure(Matter_Session_gen_CSR, /* name */ /******************************************************************** -** Solidified function: get_r2i +** Solidified function: set_expire_in_seconds ********************************************************************/ -be_local_closure(Matter_Session_get_r2i, /* name */ +be_local_closure(Matter_Session_set_expire_in_seconds, /* name */ be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(r2ikey), - }), - be_str_weak(get_r2i), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_keys -********************************************************************/ -be_local_closure(Matter_Session_set_keys, /* name */ - be_nested_proto( - 5, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(i2rkey), - /* K1 */ be_nested_str_weak(r2ikey), - /* K2 */ be_nested_str_weak(attestation_challenge), - /* K3 */ be_nested_str_weak(session_timestamp), - }), - be_str_weak(set_keys), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x90020202, // 0001 SETMBR R0 K1 R2 - 0x90020403, // 0002 SETMBR R0 K2 R3 - 0x90020604, // 0003 SETMBR R0 K3 R4 - 0x80000000, // 0004 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_noc -********************************************************************/ -be_local_closure(Matter_Session_set_noc, /* name */ - be_nested_proto( - 3, /* nstack */ + 6, /* nstack */ 3, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -867,16 +1354,30 @@ be_local_closure(Matter_Session_set_noc, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(noc), - /* K1 */ be_nested_str_weak(icac), + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(rtc), + /* K2 */ be_nested_str_weak(utc), + /* K3 */ be_nested_str_weak(set_expire_time), }), - be_str_weak(set_noc), + be_str_weak(set_expire_in_seconds), &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x90020202, // 0001 SETMBR R0 K1 R2 - 0x80000000, // 0002 RET 0 + ( &(const binstruction[15]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x1C0C0203, // 0001 EQ R3 R1 R3 + 0x780E0000, // 0002 JMPF R3 #0004 + 0x80000600, // 0003 RET 0 + 0x4C0C0000, // 0004 LDNIL R3 + 0x1C0C0403, // 0005 EQ R3 R2 R3 + 0x780E0003, // 0006 JMPF R3 #000B + 0xB80E0000, // 0007 GETNGBL R3 K0 + 0x8C0C0701, // 0008 GETMET R3 R3 K1 + 0x7C0C0200, // 0009 CALL R3 1 + 0x94080702, // 000A GETIDX R2 R3 K2 + 0x8C0C0103, // 000B GETMET R3 R0 K3 + 0x00140401, // 000C ADD R5 R2 R1 + 0x7C0C0400, // 000D CALL R3 2 + 0x80000000, // 000E RET 0 }) ) ); @@ -884,154 +1385,9 @@ be_local_closure(Matter_Session_set_noc, /* name */ /******************************************************************** -** Solidified function: set_fabric_device +** Solidified function: has_expired ********************************************************************/ -be_local_closure(Matter_Session_set_fabric_device, /* name */ - be_nested_proto( - 7, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(fabric), - /* K1 */ be_nested_str_weak(deviceid), - /* K2 */ be_nested_str_weak(fabric_compressed), - /* K3 */ be_nested_str_weak(__store), - /* K4 */ be_nested_str_weak(remove_redundant_session), - }), - be_str_weak(set_fabric_device), - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x90020202, // 0001 SETMBR R0 K1 R2 - 0x90020403, // 0002 SETMBR R0 K2 R3 - 0x88100103, // 0003 GETMBR R4 R0 K3 - 0x8C100904, // 0004 GETMET R4 R4 K4 - 0x5C180000, // 0005 MOVE R6 R0 - 0x7C100400, // 0006 CALL R4 2 - 0x80000000, // 0007 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_ipk_epoch_key -********************************************************************/ -be_local_closure(Matter_Session_get_ipk_epoch_key, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(ipk_epoch_key), - }), - be_str_weak(get_ipk_epoch_key), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_mode -********************************************************************/ -be_local_closure(Matter_Session_get_mode, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(mode), - }), - be_str_weak(get_mode), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_fabric_compressed -********************************************************************/ -be_local_closure(Matter_Session_get_fabric_compressed, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(fabric_compressed), - }), - be_str_weak(get_fabric_compressed), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_mode -********************************************************************/ -be_local_closure(Matter_Session_set_mode, /* name */ - be_nested_proto( - 2, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(mode), - }), - be_str_weak(set_mode), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x80000000, // 0001 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_persist -********************************************************************/ -be_local_closure(Matter_Session_set_persist, /* name */ +be_local_closure(Matter_Session_has_expired, /* name */ be_nested_proto( 4, /* nstack */ 2, /* argc */ @@ -1041,328 +1397,31 @@ be_local_closure(Matter_Session_set_persist, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(_persist), + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(rtc), + /* K2 */ be_nested_str_weak(utc), + /* K3 */ be_nested_str_weak(expiration), }), - be_str_weak(set_persist), + be_str_weak(has_expired), &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x60080017, // 0000 GETGBL R2 G23 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x90020002, // 0003 SETMBR R0 K0 R2 - 0x80000000, // 0004 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_ca_pub -********************************************************************/ -be_local_closure(Matter_Session_get_ca_pub, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(root_ca_certificate), - /* K1 */ be_nested_str_weak(matter), - /* K2 */ be_nested_str_weak(TLV), - /* K3 */ be_nested_str_weak(parse), - /* K4 */ be_nested_str_weak(findsubval), - }), - be_str_weak(get_ca_pub), - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x78060008, // 0001 JMPF R1 #000B - 0xB8060200, // 0002 GETNGBL R1 K1 - 0x88040302, // 0003 GETMBR R1 R1 K2 - 0x8C040303, // 0004 GETMET R1 R1 K3 - 0x880C0100, // 0005 GETMBR R3 R0 K0 - 0x7C040400, // 0006 CALL R1 2 - 0x8C080304, // 0007 GETMET R2 R1 K4 - 0x54120008, // 0008 LDINT R4 9 - 0x7C080400, // 0009 CALL R2 2 - 0x80040400, // 000A RET 1 R2 - 0x80000000, // 000B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_icac -********************************************************************/ -be_local_closure(Matter_Session_get_icac, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(icac), - }), - be_str_weak(get_icac), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: close -********************************************************************/ -be_local_closure(Matter_Session_close, /* name */ - be_nested_proto( - 9, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[21]) { /* constants */ - /* K0 */ be_nested_str_weak(_persist), - /* K1 */ be_nested_str_weak(local_session_id), - /* K2 */ be_nested_str_weak(_future_local_session_id), - /* K3 */ be_nested_str_weak(initiator_session_id), - /* K4 */ be_nested_str_weak(_future_initiator_session_id), - /* K5 */ be_nested_str_weak(source_node_id), - /* K6 */ be_nested_str_weak(counter_rcv), - /* K7 */ be_nested_str_weak(reset), - /* K8 */ be_nested_str_weak(counter_snd), - /* K9 */ be_nested_str_weak(i2rkey), - /* K10 */ be_nested_str_weak(r2ikey), - /* K11 */ be_nested_str_weak(attestation_challenge), - /* K12 */ be_nested_str_weak(introspect), - /* K13 */ be_nested_str_weak(members), - /* K14 */ be_nested_str_weak(get), - /* K15 */ be_nested_str_weak(function), - /* K16 */ be_nested_str_weak(instance), - /* K17 */ be_const_int(0), - /* K18 */ be_nested_str_weak(_), - /* K19 */ be_const_int(1), - /* K20 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(close), - &be_const_str_solidified, - ( &(const binstruction[56]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x88080102, // 0001 GETMBR R2 R0 K2 - 0x90020202, // 0002 SETMBR R0 K1 R2 - 0x88080104, // 0003 GETMBR R2 R0 K4 - 0x90020602, // 0004 SETMBR R0 K3 R2 - 0x4C080000, // 0005 LDNIL R2 - 0x90020A02, // 0006 SETMBR R0 K5 R2 - 0x88080106, // 0007 GETMBR R2 R0 K6 - 0x8C080507, // 0008 GETMET R2 R2 K7 - 0x7C080200, // 0009 CALL R2 1 - 0x88080108, // 000A GETMBR R2 R0 K8 - 0x8C080507, // 000B GETMET R2 R2 K7 - 0x7C080200, // 000C CALL R2 1 - 0x4C080000, // 000D LDNIL R2 - 0x90021202, // 000E SETMBR R0 K9 R2 - 0x4C080000, // 000F LDNIL R2 - 0x90021402, // 0010 SETMBR R0 K10 R2 - 0x4C080000, // 0011 LDNIL R2 - 0x90021602, // 0012 SETMBR R0 K11 R2 - 0xA40A1800, // 0013 IMPORT R2 K12 - 0x600C0010, // 0014 GETGBL R3 G16 - 0x8C10050D, // 0015 GETMET R4 R2 K13 - 0x5C180000, // 0016 MOVE R6 R0 - 0x7C100400, // 0017 CALL R4 2 - 0x7C0C0200, // 0018 CALL R3 1 - 0xA8020018, // 0019 EXBLK 0 #0033 - 0x5C100600, // 001A MOVE R4 R3 - 0x7C100000, // 001B CALL R4 0 - 0x8C14050E, // 001C GETMET R5 R2 K14 - 0x5C1C0000, // 001D MOVE R7 R0 - 0x5C200800, // 001E MOVE R8 R4 - 0x7C140600, // 001F CALL R5 3 - 0x60180004, // 0020 GETGBL R6 G4 - 0x5C1C0A00, // 0021 MOVE R7 R5 - 0x7C180200, // 0022 CALL R6 1 - 0x20180D0F, // 0023 NE R6 R6 K15 - 0x781A000C, // 0024 JMPF R6 #0032 - 0x60180004, // 0025 GETGBL R6 G4 - 0x5C1C0A00, // 0026 MOVE R7 R5 - 0x7C180200, // 0027 CALL R6 1 - 0x20180D10, // 0028 NE R6 R6 K16 - 0x781A0007, // 0029 JMPF R6 #0032 - 0x94180911, // 002A GETIDX R6 R4 K17 - 0x1C180D12, // 002B EQ R6 R6 K18 - 0x781A0004, // 002C JMPF R6 #0032 - 0x94180913, // 002D GETIDX R6 R4 K19 - 0x20180D12, // 002E NE R6 R6 K18 - 0x781A0001, // 002F JMPF R6 #0032 - 0x4C180000, // 0030 LDNIL R6 - 0x90000806, // 0031 SETMBR R0 R4 R6 - 0x7001FFE6, // 0032 JMP #001A - 0x580C0014, // 0033 LDCONST R3 K20 - 0xAC0C0200, // 0034 CATCH R3 1 0 - 0xB0080000, // 0035 RAISE 2 R0 R0 - 0x90020001, // 0036 SETMBR R0 K0 R1 - 0x80000000, // 0037 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Matter_Session_init, /* name */ - be_nested_proto( - 6, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[13]) { /* constants */ - /* K0 */ be_nested_str_weak(__store), - /* K1 */ be_nested_str_weak(mode), - /* K2 */ be_const_int(0), - /* K3 */ be_nested_str_weak(local_session_id), - /* K4 */ be_nested_str_weak(initiator_session_id), - /* K5 */ be_nested_str_weak(counter_rcv), - /* K6 */ be_nested_str_weak(matter), - /* K7 */ be_nested_str_weak(Counter), - /* K8 */ be_nested_str_weak(counter_snd), - /* K9 */ be_nested_str_weak(_counter_insecure_rcv), - /* K10 */ be_nested_str_weak(_counter_insecure_snd), - /* K11 */ be_nested_str_weak(breadcrumb), - /* K12 */ be_nested_str_weak(int64), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[24]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x90020302, // 0001 SETMBR R0 K1 K2 - 0x90020602, // 0002 SETMBR R0 K3 R2 - 0x90020803, // 0003 SETMBR R0 K4 R3 - 0xB8120C00, // 0004 GETNGBL R4 K6 - 0x8C100907, // 0005 GETMET R4 R4 K7 - 0x7C100200, // 0006 CALL R4 1 - 0x90020A04, // 0007 SETMBR R0 K5 R4 - 0xB8120C00, // 0008 GETNGBL R4 K6 - 0x8C100907, // 0009 GETMET R4 R4 K7 - 0x7C100200, // 000A CALL R4 1 - 0x90021004, // 000B SETMBR R0 K8 R4 - 0xB8120C00, // 000C GETNGBL R4 K6 - 0x8C100907, // 000D GETMET R4 R4 K7 - 0x7C100200, // 000E CALL R4 1 - 0x90021204, // 000F SETMBR R0 K9 R4 - 0xB8120C00, // 0010 GETNGBL R4 K6 - 0x8C100907, // 0011 GETMET R4 R4 K7 - 0x7C100200, // 0012 CALL R4 1 - 0x90021404, // 0013 SETMBR R0 K10 R4 - 0xB8121800, // 0014 GETNGBL R4 K12 - 0x7C100000, // 0015 CALL R4 0 - 0x90021604, // 0016 SETMBR R0 K11 R4 - 0x80000000, // 0017 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_ca -********************************************************************/ -be_local_closure(Matter_Session_get_ca, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(root_ca_certificate), - }), - be_str_weak(get_ca), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_deviceid -********************************************************************/ -be_local_closure(Matter_Session_get_deviceid, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(deviceid), - }), - be_str_weak(get_deviceid), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_i2r -********************************************************************/ -be_local_closure(Matter_Session_get_i2r, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(i2rkey), - }), - be_str_weak(get_i2r), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 + ( &(const binstruction[16]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x1C080202, // 0001 EQ R2 R1 R2 + 0x780A0003, // 0002 JMPF R2 #0007 + 0xB80A0000, // 0003 GETNGBL R2 K0 + 0x8C080501, // 0004 GETMET R2 R2 K1 + 0x7C080200, // 0005 CALL R2 1 + 0x94040502, // 0006 GETIDX R1 R2 K2 + 0x88080103, // 0007 GETMBR R2 R0 K3 + 0x4C0C0000, // 0008 LDNIL R3 + 0x20080403, // 0009 NE R2 R2 R3 + 0x780A0002, // 000A JMPF R2 #000E + 0x88080103, // 000B GETMBR R2 R0 K3 + 0x28080202, // 000C GE R2 R1 R2 + 0x80040400, // 000D RET 1 R2 + 0x50080000, // 000E LDBOOL R2 0 0 + 0x80040400, // 000F RET 1 R2 }) ) ); @@ -1373,77 +1432,79 @@ be_local_closure(Matter_Session_get_i2r, /* name */ ** Solidified class: Matter_Session ********************************************************************/ be_local_class(Matter_Session, - 33, + 34, NULL, - be_nested_map(67, + be_nested_map(69, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(root_ca_certificate, -1), be_const_var(18) }, - { be_const_key_weak(ipk_epoch_key, -1), be_const_var(21) }, - { be_const_key_weak(get_deviceid, -1), be_const_closure(Matter_Session_get_deviceid_closure) }, - { be_const_key_weak(get_ca, -1), be_const_closure(Matter_Session_get_ca_closure) }, - { be_const_key_weak(resumption_id, 11), be_const_var(22) }, - { be_const_key_weak(expiration, -1), be_const_var(32) }, - { be_const_key_weak(get_pk, 41), be_const_closure(Matter_Session_get_pk_closure) }, - { be_const_key_weak(_Msg2, -1), be_const_var(30) }, - { be_const_key_weak(init, -1), be_const_closure(Matter_Session_init_closure) }, - { be_const_key_weak(get_ac, 29), be_const_closure(Matter_Session_get_ac_closure) }, - { be_const_key_weak(get_ipk_group_key, -1), be_const_closure(Matter_Session_get_ipk_group_key_closure) }, - { be_const_key_weak(session_timestamp, -1), be_const_var(4) }, - { be_const_key_weak(close, -1), be_const_closure(Matter_Session_close_closure) }, - { be_const_key_weak(save, 47), be_const_closure(Matter_Session_save_closure) }, - { be_const_key_weak(_persist, 61), be_const_var(31) }, - { be_const_key_weak(no_private_key, -1), be_const_var(17) }, - { be_const_key_weak(__CASE, -1), be_const_int(2) }, - { be_const_key_weak(_future_initiator_session_id, -1), be_const_var(6) }, - { be_const_key_weak(set_expire_time, -1), be_const_closure(Matter_Session_set_expire_time_closure) }, - { be_const_key_weak(set_ipk_epoch_key, 64), be_const_closure(Matter_Session_set_ipk_epoch_key_closure) }, - { be_const_key_weak(tojson, -1), be_const_closure(Matter_Session_tojson_closure) }, { be_const_key_weak(mode, -1), be_const_var(1) }, - { be_const_key_weak(_Msg1, 28), be_const_var(29) }, - { be_const_key_weak(__store, 15), be_const_var(0) }, - { be_const_key_weak(fabric, -1), be_const_var(24) }, - { be_const_key_weak(get_noc, 54), be_const_closure(Matter_Session_get_noc_closure) }, - { be_const_key_weak(get_icac, -1), be_const_closure(Matter_Session_get_icac_closure) }, - { be_const_key_weak(has_expired, 12), be_const_closure(Matter_Session_has_expired_closure) }, - { be_const_key_weak(get_ca_pub, -1), be_const_closure(Matter_Session_get_ca_pub_closure) }, - { be_const_key_weak(__PASE, -1), be_const_int(1) }, - { be_const_key_weak(initiator_session_id, -1), be_const_var(3) }, - { be_const_key_weak(breadcrumb, -1), be_const_var(16) }, - { be_const_key_weak(_counter_insecure_snd, -1), be_const_var(11) }, - { be_const_key_weak(peer_node_id, -1), be_const_var(15) }, - { be_const_key_weak(set_persist, -1), be_const_closure(Matter_Session_set_persist_closure) }, - { be_const_key_weak(source_node_id, -1), be_const_var(5) }, - { be_const_key_weak(gen_CSR, -1), be_const_closure(Matter_Session_gen_CSR_closure) }, - { be_const_key_weak(get_r2i, -1), be_const_closure(Matter_Session_get_r2i_closure) }, - { be_const_key_weak(noc, -1), be_const_var(19) }, - { be_const_key_weak(counter_snd, 53), be_const_var(9) }, - { be_const_key_weak(_counter_insecure_rcv, -1), be_const_var(10) }, - { be_const_key_weak(set_mode, 60), be_const_closure(Matter_Session_set_mode_closure) }, - { be_const_key_weak(set_noc, -1), be_const_closure(Matter_Session_set_noc_closure) }, - { be_const_key_weak(set_ca, 57), be_const_closure(Matter_Session_set_ca_closure) }, - { be_const_key_weak(__GROUP_KEY, 3), be_nested_str_weak(GroupKey_X20v1_X2E0) }, - { be_const_key_weak(icac, 56), be_const_var(20) }, - { be_const_key_weak(get_ipk_epoch_key, -1), be_const_closure(Matter_Session_get_ipk_epoch_key_closure) }, - { be_const_key_weak(local_session_id, -1), be_const_var(2) }, - { be_const_key_weak(counter_rcv, -1), be_const_var(8) }, - { be_const_key_weak(r2ikey, -1), be_const_var(13) }, - { be_const_key_weak(shared_secret, -1), be_const_var(23) }, - { be_const_key_weak(deviceid, 49), be_const_var(26) }, - { be_const_key_weak(get_fabric_compressed, -1), be_const_closure(Matter_Session_get_fabric_compressed_closure) }, - { be_const_key_weak(set_keys, -1), be_const_closure(Matter_Session_set_keys_closure) }, - { be_const_key_weak(admin_subject, -1), be_const_var(27) }, - { be_const_key_weak(get_fabric, 34), be_const_closure(Matter_Session_get_fabric_closure) }, - { be_const_key_weak(attestation_challenge, 0), be_const_var(14) }, - { be_const_key_weak(set_fabric_device, -1), be_const_closure(Matter_Session_set_fabric_device_closure) }, - { be_const_key_weak(fabric_compressed, 26), be_const_var(25) }, - { be_const_key_weak(get_mode, 21), be_const_closure(Matter_Session_get_mode_closure) }, - { be_const_key_weak(set_no_expiration, -1), be_const_closure(Matter_Session_set_no_expiration_closure) }, + { be_const_key_weak(shared_secret, 45), be_const_var(24) }, + { be_const_key_weak(set_ca, 68), be_const_closure(Matter_Session_set_ca_closure) }, + { be_const_key_weak(has_expired, -1), be_const_closure(Matter_Session_has_expired_closure) }, + { be_const_key_weak(ipk_epoch_key, 2), be_const_var(22) }, + { be_const_key_weak(breadcrumb, 34), be_const_var(17) }, { be_const_key_weak(fromjson, -1), be_const_static_closure(Matter_Session_fromjson_closure) }, - { be_const_key_weak(admin_vendor, -1), be_const_var(28) }, - { be_const_key_weak(_future_local_session_id, 8), be_const_var(7) }, - { be_const_key_weak(set_expire_in_seconds, -1), be_const_closure(Matter_Session_set_expire_in_seconds_closure) }, - { be_const_key_weak(i2rkey, 2), be_const_var(12) }, + { be_const_key_weak(counter_rcv, -1), be_const_var(8) }, + { be_const_key_weak(_Msg1, 6), be_const_var(30) }, + { be_const_key_weak(noc, -1), be_const_var(20) }, + { be_const_key_weak(__PASE, -1), be_const_int(1) }, + { be_const_key_weak(get_deviceid, -1), be_const_closure(Matter_Session_get_deviceid_closure) }, + { be_const_key_weak(_i2r_privacy, 4), be_const_var(14) }, + { be_const_key_weak(counter_snd, -1), be_const_var(9) }, + { be_const_key_weak(set_no_expiration, -1), be_const_closure(Matter_Session_set_no_expiration_closure) }, + { be_const_key_weak(_Msg2, 67), be_const_var(31) }, + { be_const_key_weak(gen_CSR, -1), be_const_closure(Matter_Session_gen_CSR_closure) }, + { be_const_key_weak(set_fabric_device, 18), be_const_closure(Matter_Session_set_fabric_device_closure) }, + { be_const_key_weak(fabric_compressed, -1), be_const_var(26) }, + { be_const_key_weak(get_fabric_compressed, 56), be_const_closure(Matter_Session_get_fabric_compressed_closure) }, + { be_const_key_weak(_counter_insecure_snd, 21), be_const_var(11) }, + { be_const_key_weak(get_noc, 64), be_const_closure(Matter_Session_get_noc_closure) }, + { be_const_key_weak(_future_local_session_id, 11), be_const_var(7) }, + { be_const_key_weak(r2ikey, -1), be_const_var(13) }, + { be_const_key_weak(get_pk, 1), be_const_closure(Matter_Session_get_pk_closure) }, + { be_const_key_weak(set_keys, -1), be_const_closure(Matter_Session_set_keys_closure) }, + { be_const_key_weak(tojson, -1), be_const_closure(Matter_Session_tojson_closure) }, + { be_const_key_weak(set_expire_time, -1), be_const_closure(Matter_Session_set_expire_time_closure) }, + { be_const_key_weak(get_i2r_privacy, -1), be_const_closure(Matter_Session_get_i2r_privacy_closure) }, + { be_const_key_weak(_persist, -1), be_const_var(32) }, + { be_const_key_weak(save, -1), be_const_closure(Matter_Session_save_closure) }, + { be_const_key_weak(root_ca_certificate, -1), be_const_var(19) }, + { be_const_key_weak(set_mode, -1), be_const_closure(Matter_Session_set_mode_closure) }, + { be_const_key_weak(get_r2i, 59), be_const_closure(Matter_Session_get_r2i_closure) }, + { be_const_key_weak(peer_node_id, -1), be_const_var(16) }, + { be_const_key_weak(__store, 23), be_const_var(0) }, + { be_const_key_weak(admin_vendor, -1), be_const_var(29) }, + { be_const_key_weak(set_ipk_epoch_key, -1), be_const_closure(Matter_Session_set_ipk_epoch_key_closure) }, + { be_const_key_weak(set_noc, -1), be_const_closure(Matter_Session_set_noc_closure) }, + { be_const_key_weak(close, -1), be_const_closure(Matter_Session_close_closure) }, + { be_const_key_weak(get_mode, -1), be_const_closure(Matter_Session_get_mode_closure) }, + { be_const_key_weak(get_ca, -1), be_const_closure(Matter_Session_get_ca_closure) }, + { be_const_key_weak(i2rkey, 50), be_const_var(12) }, + { be_const_key_weak(_future_initiator_session_id, 46), be_const_var(6) }, + { be_const_key_weak(get_ac, -1), be_const_closure(Matter_Session_get_ac_closure) }, + { be_const_key_weak(get_ca_pub, 54), be_const_closure(Matter_Session_get_ca_pub_closure) }, + { be_const_key_weak(source_node_id, -1), be_const_var(5) }, + { be_const_key_weak(resumption_id, 43), be_const_var(23) }, + { be_const_key_weak(get_ipk_epoch_key, 0), be_const_closure(Matter_Session_get_ipk_epoch_key_closure) }, + { be_const_key_weak(session_timestamp, 44), be_const_var(4) }, + { be_const_key_weak(icac, 30), be_const_var(21) }, + { be_const_key_weak(initiator_session_id, -1), be_const_var(3) }, + { be_const_key_weak(set_persist, 38), be_const_closure(Matter_Session_set_persist_closure) }, + { be_const_key_weak(__CASE, 36), be_const_int(2) }, + { be_const_key_weak(expiration, -1), be_const_var(33) }, { be_const_key_weak(get_i2r, -1), be_const_closure(Matter_Session_get_i2r_closure) }, + { be_const_key_weak(no_private_key, 28), be_const_var(18) }, + { be_const_key_weak(admin_subject, 25), be_const_var(28) }, + { be_const_key_weak(deviceid, -1), be_const_var(27) }, + { be_const_key_weak(get_icac, 39), be_const_closure(Matter_Session_get_icac_closure) }, + { be_const_key_weak(init, -1), be_const_closure(Matter_Session_init_closure) }, + { be_const_key_weak(fabric, 16), be_const_var(25) }, + { be_const_key_weak(set_expire_in_seconds, -1), be_const_closure(Matter_Session_set_expire_in_seconds_closure) }, + { be_const_key_weak(_counter_insecure_rcv, -1), be_const_var(10) }, + { be_const_key_weak(get_ipk_group_key, -1), be_const_closure(Matter_Session_get_ipk_group_key_closure) }, + { be_const_key_weak(get_fabric, 3), be_const_closure(Matter_Session_get_fabric_closure) }, + { be_const_key_weak(local_session_id, -1), be_const_var(2) }, + { be_const_key_weak(attestation_challenge, -1), be_const_var(15) }, + { be_const_key_weak(__GROUP_KEY, -1), be_nested_str_weak(GroupKey_X20v1_X2E0) }, })), be_str_weak(Matter_Session) );