Skip to content
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

uadk: support aead stream mode and sm4-sm3 alg #657

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

Conversation

lin755
Copy link
Collaborator

@lin755 lin755 commented Dec 30, 2024

Wenkai Lin (6):
uadk/v1: support the hmac(sm3)-cbc(sm4) algorithm
uadk: fix for the algorithm name of the aead cbc mode
uadk/v1: Add stream mode for AES-GCM and SM4-GCM
uadk/v1: add assoc bytes check
uadk/v1: set aead msg state for the hardware v2
uadk/v1: fix input length check for aead stream mode.

Wenkai Lin added 6 commits December 30, 2024 14:46
Add the algorithm hmac(sm3)-cbc(sm4) to the nosva scene,
the following fileds of the session setup need to be set,
the calg(WCRYPTO_CIPHER_SM4), the cmode(WCRYPTO_CIPHER_CBC),
the dalg(WCRYPTO_SM3) and the dmode(WCRYPTO_DIGEST_HMAC).

Signed-off-by: Wenkai Lin <[email protected]>
Signed-off-by: Qi Tao <[email protected]>
Currently, the algorithm name of the aead cbc mode
is designed only for sha256, but it is not suitable
any more when other algorithms are added, such as
hmac(sm3)-cbc(aes).
Now a common name is used, authenc(generic,cbc(aes)),
the actual algorithm and mode are still specified
by dalg and dmode in the session setup.

Signed-off-by: Wenkai Lin <[email protected]>
Signed-off-by: Qi Tao <[email protected]>
In stream processing encryption mode, a long file
needs to be encrypted. When the accelerator is invoked,
the encryption result of each block is assembled.
The assembled result is the same as the result of
encrypting the entire file at a time.
For hisi_sec, the AAD is filled to the first message,
plaintext are done with the middle and the end message.
In an encrypted stream, the first and the end message
are unique and must be delivered to hardware.

Signed-off-by: Wenkai Lin <[email protected]>
Signed-off-by: Qi Tao <[email protected]>
For the gcm stream mode, assoc bytes should not be 0,
check it to avoid hardware error.

Signed-off-by: Wenkai Lin <[email protected]>
Signed-off-by: Qi Tao <[email protected]>
The hardware only uses the block mode, so set the aead
message state to the block mode first.

Signed-off-by: Wenkai Lin <[email protected]>
Signed-off-by: Qi Tao <[email protected]>
The hardware supports only 16-byte alignment for the aead
middle messages, the invalid length check is added now.

Signed-off-by: Wenkai Lin <[email protected]>
Signed-off-by: Qi Tao <[email protected]>
@gaozhangfei
Copy link
Collaborator

close this pr? only keep pr to develop?

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