Skip to content

Conversation

@patch-king
Copy link

Add support for multiple RSA padding modes with OpenSSL provider mechanism.

  1. RSA_X931_PADDING and RSA_PKCS1_PSS_PADDING for signing and verification.
  2. RSA_PKCS1_OAEP_PADDING and RSA_PKCS1_WITH_TLS_PADDING for encryption and
    decryption.

@gaozhangfei
Copy link
Collaborator

可方便直接push到master,现在master上有ci,我再sync到devel

lizhi and others added 11 commits December 18, 2025 14:38
For better code organization and maintainability, original RSA algorithm
is splited into four functional components, including key generation,
encryption/decryption, signing/verification, and public interface
functions.

Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
… padding modes

Several utility functions are introduced to the RSA implementation.
These functions are designed to adapt the existing RSA implementation
to support multiple padding modes, enhancing the Extensibility
of the cryptographic operations.

Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
…padding modes

Add support for RSA signature padding modes with OpenSSL provider
mechanism, including RSA_X931_PADDING and RSA_PKCS1_PSS_PADDING.

Test with:
openssl dgst -sha256 -sign privkey.pem -sigopt rsa_padding_mode:x931
-out signature.bin message.txt
openssl dgst -sha256 -verify pubkey.pem -sigopt rsa_padding_mode:x931
-signature signature.bin message.txt

openssl dgst -sha256 -sign privkey.pem -sigopt rsa_padding_mode:pss
-out signature.bin message.txt
openssl dgst -sha256 -verify pubkey.pem -sigopt rsa_padding_mode:pss
-signature signature.bin message.txt

Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
…H_TLS padding modes

Add support for RSA encryption padding modes with OpenSSL provider
mechanism, including RSA_PKCS1_OAEP_PADDING and
RSA_PKCS1_WITH_TLS_PADDING.

Test with:
openssl pkeyutl -encrypt -in test.txt -out encrypted.bin -pubin
-inkey public.pem -pkeyopt rsa_padding_mode:oaep
openssl pkeyutl -decrypt  -in encrypted.bin -out decrypted.txt
-inkey private.pem -pkeyopt rsa_padding_mode:oaep

openssl s_server -provider uadk_provider -accept 4333 -cert server.pem -www
-cipher AES256-SHA
openssl s_client -provider uadk_provider -connect localhost:4333

Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
…obal variables

Introduce global variables to cache hardware version,
reducing repeated device queries.

Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
Unified provider success and failure return values, and moved
return value macros to uadk_prov.h for better consistency and
maintainability.

Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
uadk_engine will support some algorithms in the OpenSSL 3.0 scenario.
Currently, the framework has adapted to some of these algorithms.
However, when executing the SM3 algorithm, an error related to SM2
is reported. This is because OpenSSL 3.0 has removed SM2 from
the engine scenario in methmods, causing the failure. A fix is needed.

At the same time, the differences in the pkey_ctx structure between
the two OpenSSL versions were resolved, enabling the engine
to support the x25519 and x448 algorithms on OpenSSL 3.0.

Signed-off-by: Zhushuai Yin <yinzhushuai@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
When creating new dh, set the flags from the method
and call the initialization function. In addition,
remove unnecessary parameter checks.

Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
add some general optimization compilation options,
security enhancement options, linker security options, etc.

Signed-off-by: Zhushuai Yin <yinzhushuai@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
Delete several unused functions in asymmetric encryption algorithm to
improve code clarity.

Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
Fix a null pointer dereference bug in RSA X931 mode.

Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
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.

2 participants