Skip to content

crypto/aes: prefix public AES API with nx_ to avoid symbol clashes#19428

Closed
FelipeMdeO wants to merge 1 commit into
apache:masterfrom
FelipeMdeO:crypto/rename-aes-symbols
Closed

crypto/aes: prefix public AES API with nx_ to avoid symbol clashes#19428
FelipeMdeO wants to merge 1 commit into
apache:masterfrom
FelipeMdeO:crypto/rename-aes-symbols

Conversation

@FelipeMdeO

Copy link
Copy Markdown
Contributor

Summary

Prefix the public AES API in crypto/aes.h (aes_setkey, aes_encrypt,
aes_decrypt, their _ecb variants and aes_keysetup_*) with nx_, and
update the in-tree callers under crypto/.

The unprefixed aes_encrypt/aes_decrypt symbols exported by the NuttX
software AES (CRYPTO_SW_AES) collide at link time with identically named
symbols from third-party crypto libraries built into the arch tree (e.g. the
Espressif esp-hal wpa_supplicant mbedTLS wrapper). The nx_ prefix gives the
NuttX implementation its own namespace.

Impact

API rename only; no behavior change. Any out-of-tree user of crypto/aes.h
must adopt the nx_ names.

Testing

Built sim:nsh (with CRYPTO_SW_AES).

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

Comment thread crypto/aes.c
Comment thread crypto/aes.c
Comment thread crypto/aes.c
}

void aes_encrypt(FAR AES_CTX *ctx, FAR const uint8_t *src, FAR uint8_t *dst)
void nx_aes_encrypt(FAR AES_CTX *ctx, FAR const uint8_t *src,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

but do you need add nx_ to all software crypto function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hello @xiaoxiang781216, Perhaps I misunderstood your comment. what do you mean with "add nx_ to all software crypto function"

@xiaoxiang781216 xiaoxiang781216 Jul 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hello @xiaoxiang781216, Perhaps I misunderstood your comment. what do you mean with "add nx_ to all software crypto function"

Yes, at least. BTW, why not change third party library?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried, but I haven’t received any updates from them for a while, so I decided to try to solve it here.

@FelipeMdeO FelipeMdeO Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Add nx_ to all software crypto isn't good idea, it is a big change...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes, that's why I prefer fixing the 3rd party library instead

@FelipeMdeO FelipeMdeO force-pushed the crypto/rename-aes-symbols branch 4 times, most recently from 09c16a9 to b15d4ab Compare July 14, 2026 02:40
The NuttX software AES aes_encrypt()/aes_decrypt() symbols collide at
link time with the identically named symbols exported by third-party
crypto libraries built into the arch tree, e.g. the Espressif esp-hal
wpa_supplicant mbedTLS wrapper.  When a board enables both the NuttX
software crypto backend (CRYPTO_SW_AES) and such a library, the link
fails with a multiple definition of aes_encrypt/aes_decrypt.

Rename only the two clashing functions to nx_aes_encrypt/nx_aes_decrypt
and update their in-tree callers under crypto/.  The rest of the
crypto/aes.h API is left unchanged.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>

Assisted-by: Claude Sonnet <noreply@anthropic.com>
@FelipeMdeO FelipeMdeO force-pushed the crypto/rename-aes-symbols branch from b15d4ab to c82ae07 Compare July 14, 2026 02:53
@FelipeMdeO FelipeMdeO closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Crypto Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants