Skip to content

sign_verify: Add dynamic algorithm selection with sign and verify sup… #130

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Akshay-Belsare
Copy link

…port

Add support for new RSA PKCS PSS and V1_5 algorithms:

  • TEE_ALG_RSASSA_PKCS1_V1_5_SHA1
  • TEE_ALG_RSASSA_PKCS1_V1_5_SHA224
  • TEE_ALG_RSASSA_PKCS1_V1_5_SHA256
  • TEE_ALG_RSASSA_PKCS1_V1_5_SHA384
  • TEE_ALG_RSASSA_PKCS1_V1_5_SHA512
  • TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1
  • TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224
  • TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256
  • TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384
  • TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512

Also add support to select algorithm at runtime. The user can now run the optee_example_sign_verify <key_size> <algo name> command, and the specified algorithm will be used during sign/verify.

The user can now invoke:
optee_example_sign_verify <key_size>

Supported values for <key_size> are:

  • 2048 bits
  • 3072 bits
  • 4096 bits

Supported values for are:

  • TA_ALG_PKCS1_V1_5_SHA1
  • TA_ALG_PKCS1_V1_5_SHA224
  • TA_ALG_PKCS1_V1_5_SHA256
  • TA_ALG_PKCS1_V1_5_SHA384
  • TA_ALG_PKCS1_V1_5_SHA512
  • TA_ALG_PKCS1_PSS_MGF1_SHA1
  • TA_ALG_PKCS1_PSS_MGF1_SHA224
  • TA_ALG_PKCS1_PSS_MGF1_SHA256
  • TA_ALG_PKCS1_PSS_MGF1_SHA384
  • TA_ALG_PKCS1_PSS_MGF1_SHA512

If no algorithm is specified, TA_ALG_PKCS1_V1_5_SHA256 is selected by default.

Based on the input, the corresponding algorithm and key size is selected and used for sign/verify operations. This enhancement improves flexibility by allowing users to test different RSA modes using a single binary.

Copy link
Contributor

@jforissier jforissier left a comment

Choose a reason for hiding this comment

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

Hi @Akshay-Belsare, thanks for the PR.

This is a new application so please update the commit subject and description to state that fact. And, as mentioned below the detailed help text would be better in the usage() function.

amey-raghatate and others added 2 commits August 25, 2025 16:52
…port

Add new example for RSA PKCS PSS and V1_5 algorithms:
- TEE_ALG_RSASSA_PKCS1_V1_5_SHA1
- TEE_ALG_RSASSA_PKCS1_V1_5_SHA224
- TEE_ALG_RSASSA_PKCS1_V1_5_SHA256
- TEE_ALG_RSASSA_PKCS1_V1_5_SHA384
- TEE_ALG_RSASSA_PKCS1_V1_5_SHA512
- TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1
- TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224
- TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256
- TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384
- TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512

Also add support to select algorithm at runtime. The user can now run
the `optee_example_sign_verify <key_size> <algo name>` command, and the
specified algorithm will be used during sign/verify.

The user can now invoke:
optee_example_sign_verify <key_size> <algo name>

Supported values for <key_size> are:
- 2048 bits
- 3072 bits
- 4096 bits

Supported values for <algo name> are:
- TA_ALG_PKCS1_V1_5_SHA1
- TA_ALG_PKCS1_V1_5_SHA224
- TA_ALG_PKCS1_V1_5_SHA256
- TA_ALG_PKCS1_V1_5_SHA384
- TA_ALG_PKCS1_V1_5_SHA512
- TA_ALG_PKCS1_PSS_MGF1_SHA1
- TA_ALG_PKCS1_PSS_MGF1_SHA224
- TA_ALG_PKCS1_PSS_MGF1_SHA256
- TA_ALG_PKCS1_PSS_MGF1_SHA384
- TA_ALG_PKCS1_PSS_MGF1_SHA512

If no algorithm is specified, TA_ALG_PKCS1_V1_5_SHA256 is selected
by default.

Based on the input, the corresponding algorithm and key size is selected
and used for sign/verify operations. This enhancement improves flexibility
by allowing users to test different RSA modes using a single binary.

Signed-off-by: Amey Avinash Raghatate <[email protected]>
Address review comments for the new example

Signed-off-by: Amey Avinash Raghatate <[email protected]>
@Akshay-Belsare
Copy link
Author

@jforissier
review comments are addressed.
CC: @amey-raghatate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants