Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions include/odp/api/spec/crypto_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,23 @@ typedef enum {
*/
ODP_CIPHER_ALG_ZUC_EEA3,

/** NEA6 confidentiality algorithm
*
* 256-NEA6 algorithm.
*
* Key length is 256 bits. IV size is 16 bytes.
*/
ODP_CIPHER_ALG_ZUC_NEA6,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This change is not really adding a new algorithm in the API as the commit message says but just moves the currently defined 256-bit ZUC variant with 16-byte-IV from ODP_CIPHER_ALG_ZUC_EEA3 to ODP_CIPHER_ALG_ZUC_NEA6.

But, AFAIK, the algorithm defined in the referenced document is not exactly the same as NEA6 (unless things have recently changed), so adding a new algorithm name is fine, but it should not reference that document.

If we are adding ..._NEA6 and ..._NIA6 then maybe ..._NCA6 should be added too.

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.

Thanks Janne.
I am fine with removing the referenced document. I only mentioned it because it describes a ZUC‑256 variant with a 256‑bit key and a fixed 16‑byte IV.
Would you prefer that I remove the reference entirely ? And keep till Line number 181.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this patch could simply leave the EEA3/EIA3 spec unchanged, i.e. leave the 256-bit ZUC variant and the reference to the doc there and just add the new algorithm enums. Then we can later, in a separate PR, either remove the old 256-bit variants or move them to their own algorithm enums.

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.

Done.


/** NCA6 AEAD algorithm
*
* 256-NCA6 algorithm.
*
* Key length is 256 bits. IV size is 16 bytes.
* Integrity tag size is 16 bytes.
*/
ODP_CIPHER_ALG_ZUC_NCA6,

/** SNOW-V stream cipher */
ODP_CIPHER_ALG_SNOW_V,

Expand Down Expand Up @@ -387,6 +404,14 @@ typedef enum {
*/
ODP_AUTH_ALG_ZUC_EIA3,

/** NIA6 integrity algorithm
*
* 256-NIA6 algorithm.
*
* Key length is 256 bits. IV size is 16 bytes.
*/
ODP_AUTH_ALG_ZUC_NIA6,

/** SNOW-V-GCM AEAD algorithm
*
* SNOW-V-GCM provides both authentication and encryption. This auth
Expand Down Expand Up @@ -536,6 +561,12 @@ typedef union odp_crypto_cipher_algos_t {
/** ODP_CIPHER_ALG_ZUC_EEA3 */
uint32_t zuc_eea3 : 1;

/** ODP_CIPHER_ALG_ZUC_NEA6 */
uint32_t zuc_nea6 : 1;

/** ODP_CIPHER_ALG_ZUC_NCA6 */
uint32_t zuc_nca6 : 1;

/** ODP_CIPHER_ALG_SNOW_V */
uint32_t snow_v : 1;

Expand Down Expand Up @@ -638,6 +669,9 @@ typedef union odp_crypto_auth_algos_t {
/** ODP_AUTH_ALG_ZUC_EIA3 */
uint32_t zuc_eia3 : 1;

/** ODP_AUTH_ALG_ZUC_NIA6 */
uint32_t zuc_nia6 : 1;

/** ODP_AUTH_ALG_SNOW_V_GCM */
uint32_t snow_v_gcm : 1;

Expand Down