From 6c3b1a760a1b17c52112b08e52f34de25328b435 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 7 Feb 2022 16:29:04 +0100 Subject: [PATCH 1/3] Allow comments in driver descriptions Signed-off-by: Gilles Peskine --- docs/proposed/psa-driver-interface.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/proposed/psa-driver-interface.md b/docs/proposed/psa-driver-interface.md index 125a415f46..ccf10fceb0 100644 --- a/docs/proposed/psa-driver-interface.md +++ b/docs/proposed/psa-driver-interface.md @@ -60,6 +60,8 @@ How to provide the driver description file, the C header files and the object co The concrete syntax for a driver description file is JSON. +In addition to the properties described here, any JSON object may have a property called `"_comment"` of type string, which will be ignored. + #### Driver description list PSA Cryptography core implementations should support multiple drivers. The driver description files are passed to the implementation as an ordered list in an unspecified manner. This may be, for example, a list of file names passed on a command line, or a JSON list whose elements are individual driver descriptions. From 272ff9c3092c92145a3d3bbc90131318c104c7cb Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 7 Feb 2022 16:29:18 +0100 Subject: [PATCH 2/3] Open a namespace for implementation-specific properties "IMPLEMENTATION/PROPERTY" Signed-off-by: Gilles Peskine --- docs/proposed/psa-driver-interface.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/proposed/psa-driver-interface.md b/docs/proposed/psa-driver-interface.md index ccf10fceb0..5d2c5de304 100644 --- a/docs/proposed/psa-driver-interface.md +++ b/docs/proposed/psa-driver-interface.md @@ -62,6 +62,8 @@ The concrete syntax for a driver description file is JSON. In addition to the properties described here, any JSON object may have a property called `"_comment"` of type string, which will be ignored. +PSA Cryptography core implementations may support additional properties. Such properties must use names consisting of the implementation's name, a slash, and additional characters. For example, the Yoyodyne implementation may use property names such as `"yoyodyne/foo"` and `"yoyodyne/widgets/girth"`. + #### Driver description list PSA Cryptography core implementations should support multiple drivers. The driver description files are passed to the implementation as an ordered list in an unspecified manner. This may be, for example, a list of file names passed on a command line, or a JSON list whose elements are individual driver descriptions. From 08fb89d251731559700cc1019d6f1c9898de2e51 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 7 Feb 2022 16:30:16 +0100 Subject: [PATCH 3/3] Require a driver prefix to be non-empty Signed-off-by: Gilles Peskine --- docs/proposed/psa-driver-interface.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/proposed/psa-driver-interface.md b/docs/proposed/psa-driver-interface.md index 5d2c5de304..8147562009 100644 --- a/docs/proposed/psa-driver-interface.md +++ b/docs/proposed/psa-driver-interface.md @@ -72,7 +72,7 @@ PSA Cryptography core implementations should support multiple drivers. The drive A driver description is a JSON object containing the following properties: -* `"prefix"` (mandatory, string). This must be a valid prefix for a C identifier. All the types and functions provided by the driver have a name that starts with this prefix unless overridden with a `"name"` element in the applicable capability as described below. +* `"prefix"` (mandatory, string). This must be a valid, non-empty prefix for a C identifier. All the types and functions provided by the driver have a name that starts with this prefix unless overridden with a `"name"` element in the applicable capability as described below. * `"type"` (mandatory, string). One of `"transparent"` or `"opaque"`. * `"headers"` (optional, array of strings). A list of header files. These header files must define the types, macros and constants referenced by the driver description. They may declare the entry point functions, but this is not required. They may include other PSA headers and standard headers of the platform. Whether they may include other headers is implementation-specific. If omitted, the list of headers is empty. The header files must be present at the specified location relative to a directory on the compiler's include path when compiling glue code between the core and the drivers. * `"capabilities"` (mandatory, array of [capabilities](#driver-description-capability)).