From df95e924884439a1e916754c5117c39e52082041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Sat, 29 Oct 2022 15:51:48 +0200 Subject: [PATCH 1/2] [nrfconnect] Correct factory data JSON schema (#23386) Fix typos and regular expressions do better catch format errors. Signed-off-by: Damian Krolik Signed-off-by: Damian Krolik --- .../nrfconnect/nrfconnect_factory_data.schema | 26 ++++++++++--------- .../tests/test_generate_factory_data.py | 5 ++-- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/scripts/tools/nrfconnect/nrfconnect_factory_data.schema b/scripts/tools/nrfconnect/nrfconnect_factory_data.schema index 73f3ddc4609daf..5c8bbda6d268d2 100644 --- a/scripts/tools/nrfconnect/nrfconnect_factory_data.schema +++ b/scripts/tools/nrfconnect/nrfconnect_factory_data.schema @@ -68,7 +68,10 @@ "date": { "description": "Manufacturing date according to ISO 8601 in notation YYYY-MM-DD", "type": "string", - "format": "date" + "format": "date", + "minLength": 10, + "maxLength": 10, + "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "hw_ver": { "description": "Hardware version - integer", @@ -85,30 +88,29 @@ "rd_uid": { "description": "A randomly-generated 128-bit or longer octet string. Length has been expanded with 'hex:' prefix", "type": "string", - "pattern:": "^hex:{1}", + "pattern": "^hex:([0-9A-Fa-f]{2}){16,}$", "minLength": 20, - "minLength": 5, - "maxLength": 36 + "minLength": 36 }, "dac_cert": { "description": "DAC certificate in hex-string format", "type": "string", - "pattern:": "^hex:{1}([0-9A-Fa-f]){2,}", - "minLength": 5, + "pattern": "^hex:([0-9A-Fa-f]{2})+$", + "minLength": 6, "maxLength": 1204 }, "dac_key": { "description": "DAC Private Key in hex-string format", "type": "string", - "pattern:": "^hex:{1}([0-9A-Fa-f]){2,}", + "pattern": "^hex:([0-9A-Fa-f]{2}){32}$", "minLength": 68, "maxLength": 68 }, "pai_cert": { "description": "PAI certificate in hex-string format", "type": "string", - "pattern:": "^hex:{1}([0-9A-Fa-f]){2,}", - "minLength": 5, + "pattern": "^hex:([0-9A-Fa-f]{2})+$", + "minLength": 6, "maxLength": 1204 }, "passcode": { @@ -126,14 +128,14 @@ "spake2_salt": { "description": "A key-derivation function for the Symmetric Password-Authenticated Key Exchange.", "type": "string", - "pattern:": "^hex:{1}([0-9A-Fa-f]){2,}", + "pattern": "^hex:([0-9A-Fa-f]{2})+$", "minLength": 36, "maxLength": 68 }, "spake2_verifier": { "description": "A verifier for the Symmetric Password-Authenticated Key Exchange", "type": "string", - "pattern:": "^hex:{1}([0-9A-Fa-f]){2,}", + "pattern": "^hex:([0-9A-Fa-f]{2})+$", "minLength": 97 }, "discriminator": { @@ -145,7 +147,7 @@ "enable_key": { "description": "The Enable Key is a 128-bit value that triggers manufacturer-specific action while invoking the TestEventTrigger Command", "type": "string", - "pattern": "^hex:{1}([0-9A-Fa-f]){32}", + "pattern": "^hex:([0-9A-Fa-f]{2}){16}$", "minLength": 36, "maxLength": 36 }, diff --git a/scripts/tools/nrfconnect/tests/test_generate_factory_data.py b/scripts/tools/nrfconnect/tests/test_generate_factory_data.py index dc588959c680e9..5d59a8d4d56538 100755 --- a/scripts/tools/nrfconnect/tests/test_generate_factory_data.py +++ b/scripts/tools/nrfconnect/tests/test_generate_factory_data.py @@ -148,6 +148,7 @@ def test_generate_factory_data_all_specified(self): write_file(os.path.join(outdir, 'PAI_cert.der'), PAI_DER_CERT) subprocess.check_call(['python3', os.path.join(TOOLS_DIR, 'generate_nrfconnect_chip_factory_data.py'), + '-s', os.path.join(TOOLS_DIR, 'nrfconnect_factory_data.schema'), '--include_passcode', '--sn', 'SN:12345678', '--vendor_id', '0x127F', @@ -167,7 +168,7 @@ def test_generate_factory_data_all_specified(self): '--passcode', '13243546', '--spake2_verifier', 'WN0SgEXLfUN19BbJqp6qn4pS69EtdNLReIMZwv/CIM0ECMP7ytiAJ7txIYJ0Ovlha/rQ3E+88mj3qaqqnviMaZzG+OyXEdSocDIT9ZhmkTCgWwERaHz4Vdh3G37RT6kqbw==', '--discriminator', '0xFED', - '--rd_uid', '0123456789ABCDEF', + '--rd_uid', '91a9c12a7c80700a31ddcfa7fce63e44', '--enable_key', '00112233445566778899aabbccddeeff', '-o', os.path.join(outdir, 'fd.json') ]) @@ -194,7 +195,7 @@ def test_generate_factory_data_all_specified(self): 'WN0SgEXLfUN19BbJqp6qn4pS69EtdNLReIMZwv/CIM0ECMP7ytiAJ7txIYJ0Ovlha/rQ3E+88mj3qaqqnviMaZzG+OyXEdSocDIT9ZhmkTCgWwERaHz4Vdh3G37RT6kqbw==')) self.assertEqual(factory_data.get('discriminator'), 0xFED) self.assertEqual(factory_data.get('passcode'), 13243546) - self.assertEqual(factory_data.get('rd_uid'), 'hex:0123456789ABCDEF') + self.assertEqual(factory_data.get('rd_uid'), 'hex:91a9c12a7c80700a31ddcfa7fce63e44') self.assertEqual(factory_data.get('enable_key'), 'hex:00112233445566778899aabbccddeeff') From 81a64dcab42b1108c4bea24ec5310ec7c0a0b59d Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Sat, 29 Oct 2022 16:52:47 +0300 Subject: [PATCH 2/2] [Telink]: Update to Zephyr with factory data (#23378) --- integrations/docker/images/chip-build-telink/Dockerfile | 2 +- integrations/docker/images/chip-build/version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integrations/docker/images/chip-build-telink/Dockerfile b/integrations/docker/images/chip-build-telink/Dockerfile index 766fd55aa4718e..5f6b08c5b04ad8 100644 --- a/integrations/docker/images/chip-build-telink/Dockerfile +++ b/integrations/docker/images/chip-build-telink/Dockerfile @@ -17,7 +17,7 @@ RUN set -x \ && : # last line # Setup Zephyr -ARG ZEPHYR_REVISION=c57ffb4738251a3b670ded02ba514aa5c650563a +ARG ZEPHYR_REVISION=dac17979d626bb820268660b4272a56d04d8083b WORKDIR /opt/telink/zephyrproject RUN set -x \ && python3 -m pip install -U --no-cache-dir \ diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index a7be338c347fae..31a9e441a4fc04 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.6.05 Version bump reason: [nrfconnect] Update nRF Connect SDK version. +0.6.06 Version bump reason: [Telink] Update Telink Docker.