Skip to content

Remove pattern constraint from location field#720

Open
parmi93 wants to merge 1 commit intoMbed-TLS:developmentfrom
parmi93:patch-1
Open

Remove pattern constraint from location field#720
parmi93 wants to merge 1 commit intoMbed-TLS:developmentfrom
parmi93:patch-1

Conversation

@parmi93
Copy link
Copy Markdown

@parmi93 parmi93 commented Mar 20, 2026

According to the "PSA Certified Crypto Driver Interface" (Section 3.2) https://arm-software.github.io/psa-api/crypto-driver/1.0/body/manifest.html#driver-description-top-level-element, the location field may be either a non-negative integer or a C constant expression of type psa_key_location_t. For this reason, the pattern constraint is being removed, allowing the user to input any value.

According to the
"PSA Certified Crypto Driver Interface" (Section 3.2) https://arm-software.github.io/psa-api/crypto-driver/1.0/body/manifest.html#driver-description-top-level-element, the location field may be either a non-negative integer or a C constant expression of type psa_key_location_t. For this reason, the pattern constraint is being removed, allowing the user to input any value.

Signed-off-by: Parminder Singh <61920513+parmi93@users.noreply.github.com>
@parmi93
Copy link
Copy Markdown
Author

parmi93 commented Mar 20, 2026

Now user can set up a JSON manifest file like this:

{
    "prefix": "stsafe_a110",
    "type": "opaque",
    "location": "STSAFE_A110_LOCATION", /* <- Previously, only hexadecimal values were permitted. */
    "headers": [
        "stsafe_a110_psa_driver.h"
    ],
    "capabilities": [
        {
            "entry_points": [
                "_comment": "bla bla"
            ],
        }
    ]
}

stsafe_a110_psa_driver.h:

#define STSAFE_A110_LOCATION ((psa_key_location_t)0x800001)

Copy link
Copy Markdown
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gilles-peskine-arm
Copy link
Copy Markdown
Contributor

I'm curious, are you finding the script to be usable as it is? I'm aware that only a small subset of the functionality is implemented.

@gilles-peskine-arm gilles-peskine-arm added enhancement New feature or request needs-review Every commit must be reviewed by at least two team members needs-reviewer This PR needs someone to pick it up for review size-xs Estimated task size: extra small (a few hours at most) priority-medium Medium priority - this can be reviewed as time permits labels Mar 22, 2026
@gilles-peskine-arm gilles-peskine-arm moved this to Scoped in Community Mar 22, 2026
@parmi93
Copy link
Copy Markdown
Author

parmi93 commented Mar 22, 2026

The script (generate_driver_wrappers.py) does the job. As for the Jinja templates (psa_crypto_driver_wrappers.h.jinja and psa_crypto_driver_wrappers_no_static.c.jinja), they are still incomplete since only a small number of entry points are supported. So I end up patching the templates for my needs, but apart from that I didn’t have to touch anything else (except having to manually call the script (generate_driver_wrappers.py) because I need to pass it the path to my patched Jinja templates).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs-review Every commit must be reviewed by at least two team members needs-reviewer This PR needs someone to pick it up for review priority-medium Medium priority - this can be reviewed as time permits size-xs Estimated task size: extra small (a few hours at most)

Projects

Status: Scoped
Status: In Development

Development

Successfully merging this pull request may close these issues.

2 participants