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

Implementation of GCM AES #6334

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

Conversation

jylee9613
Copy link
Contributor

Implementation of GCM mode

  • seclink_crypto
  • security_crypto
  • crypto_test

dec.data_len = 16;

ST_EXPECT_EQ(SECLINK_OK, sl_set_key(g_hnd, HAL_KEY_AES_128, ST_AES_ENC_KEY_IDX, &aes_key, NULL));
ST_EXPECT_EQ(SECLINK_OK, sl_gcm_encrypt(g_hnd, &dec, &param, ST_AES_ENC_KEY_IDX, &enc));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @ZhenBei-Sin
I tested with this tesetcode, but I got error while calling sl_gcm_encrypt.

[ RUN        ] gcm_aes repeat: 1
keymgr request cmd(2580) (0) key(32) isempty(1)
hal_result_e : 0
hal_result_e : 255

security level: 0
===========================================================
Assertion details
===========================================================
print_assert_detail: Assertion Failed CPU0 at file: src/seclink/seclink.c line 130 task: sl_test pid: 20
print_assert_detail: Assert location (PC) : 0x0e179d83
check_assert_location: Code asserted in normal thread!

The location if assert is below.
https://github.com/Samsung/TizenRT/blob/master/framework/src/seclink/seclink.c#L129

When sl_gcm_encrypt called, it returns 255, not the defined value in res_table.
Would you please kindly let me know what I set wrong?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @jylee9613

In this PR was missing the secure bl32.bin. (This image contains the SE API which support AES GCM mode).
image

Verified SUCCESS gcm_aes.
image

Thank You.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OMG...Thank you for checking:)
I confirmed AES GCM runs properly in AIDual.
I'll also check with TP1x, and let you know the result.

Thank you

@jylee9613 jylee9613 changed the title [DO NOT MERGE] Implementation of GCM AES Implementation of GCM AES Sep 23, 2024
There is a hang when enable all below configs
```
CONFIG_DEBUG_WARN=y
CONFIG_DEBUG_VERBOSE=y
CONFIG_DEBUG_SECURE_ELEMENT_ERROR=y
CONFIG_DEBUG_SECURE_ELEMENT_INFO=y
```

To avoid this hang, this commit changes vdbg to dbg.
@jylee9613 jylee9613 force-pushed the AES_GCM_SECURITY_API branch 2 times, most recently from a0eaa87 to efc5c60 Compare September 23, 2024 08:04
Add GCM mode in seclink and security
- sl_gcm_encrypt / sl_gcm_decrypt
- crypto_gcm_encryption / crypto_gcm_decryption

Signed-off-by: Jaeyong Lee <jaeyong1.lee@samsung.com>
Add UTC and examples of GCM API
Keys should be generated before encryption/decryption.
Factory key is not available in GCM mode.

1) sl_crypto_test
- Example of sl_gcm_encrypt / sl_gcm_decrypt

2) utc_crypto
- UTC of crypto_gcm_encryption / crypto_gcm_decryption

Signed-off-by: Jaeyong Lee <jaeyong1.lee@samsung.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