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

NetX Secure AEAD Cipher checking #40

Closed
ReKawashima opened this issue Jul 14, 2021 · 3 comments
Closed

NetX Secure AEAD Cipher checking #40

ReKawashima opened this issue Jul 14, 2021 · 3 comments
Assignees

Comments

@ReKawashima
Copy link

ReKawashima commented Jul 14, 2021

If AEAD Cipher is enabled, AEAD Cipher checking is necessary to detect cipher algorithms other than AES-CCM or AES-GCM. NX_SECURE_AEAD_CIPHER_CHECK macro defines whether the AEAD chcking is used or not.

But actually, the AEAD checking is not working even if NX_SECURE_AEAD_CIPHER_CHECK macro is defined (See https://github.com/azure-rtos/netxduo/blob/master/nx_secure/src/nx_secure_tls_record_payload_decrypt.c#L158 ). Also, if using cipher algorithms other than AES-CCM or AES-GCM, the communicating counterparty will raise a Bad Record MAC alert.

I think it's a bug in the code. I suggest the following change.

Note: When apply this change, the warning "NX_SECURE_AEAD_CIPHER_CHECK macro redefined" will happened. Please clear the warning.

https://github.com/azure-rtos/netxduo/blob/master/nx_secure/inc/nx_secure_tls.h#L123

Incorrect #ifndef NX_SECURE_AEAD_CIPHER_CHECK
#define NX_SECURE_AEAD_CIPHER_CHECK(a)                  NX_FALSE
#endif /* NX_SECURE_AEAD_CIPHER_CHECK */
Correct #ifdef NX_SECURE_AEAD_CIPHER_CHECK         <--
#define NX_SECURE_AEAD_CIPHER_CHECK(a)                  NX_FALSE
#endif /* NX_SECURE_AEAD_CIPHER_CHECK */
@yanwucai
Copy link
Contributor

If you are implementing AEAD ciphers other than AES-CCM or AES-GCM, you can define NX_SECURE_AEAD_CIPHER_CHECK to detect your new algorithms. This macro allows you to extend the conditions to check other algorithms. For example, you can define the macro like:
#define NX_SECURE_AEAD_CIPHER_CHECK(a) ((a) == YOUR_ALGORITHM_ID)

@ReKawashima
Copy link
Author

Hi @yanwucai -san,
Thank you for your prompt response.

Sorry. I was misunderstanding.
NX_SECURE_AEAD_CIPHER_CHECK macro defines a additional chcking method, not the use / non-use of the chcking. Right?
If correct, please update sample code (https://github.com/azure-rtos/netxduo/blob/master/nx_secure/inc/nx_secure_user_sample.h#L100) for easy understanding.

Thanks.

@TiejunMS TiejunMS closed this as completed Aug 4, 2021
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

No branches or pull requests

3 participants