|
| 1 | + |
1 | 2 | /** |
2 | 3 | * @file |
3 | 4 | * @brief This is the public header file to be included by applications |
@@ -273,7 +274,11 @@ typedef enum acvp_cipher { |
273 | 274 | ACVP_SLH_DSA_KEYGEN, |
274 | 275 | ACVP_SLH_DSA_SIGGEN, |
275 | 276 | ACVP_SLH_DSA_SIGVER, |
276 | | - ACVP_CIPHER_END |
| 277 | + ACVP_ASCON_AEAD128, // 120 |
| 278 | + ACVP_ASCON_CXOF128, |
| 279 | + ACVP_ASCON_HASH256, |
| 280 | + ACVP_ASCON_XOF128, |
| 281 | + ACVP_CIPHER_END |
277 | 282 | } ACVP_CIPHER; |
278 | 283 |
|
279 | 284 |
|
@@ -387,6 +392,14 @@ typedef enum acvp_alg_type_dsa { |
387 | 392 | ACVP_SUB_DSA_SIGVER, |
388 | 393 | } ACVP_SUB_DSA; |
389 | 394 |
|
| 395 | +/** @enum ACVP_SUB_ASCON */ |
| 396 | +typedef enum acvp_alg_type_ascon { |
| 397 | + ACVP_SUB_ASCON_AEAD128 = ACVP_ASCON_AEAD128, |
| 398 | + ACVP_SUB_ASCON_CXOF128, |
| 399 | + ACVP_SUB_ASCON_HASH256, |
| 400 | + ACVP_SUB_ASCON_XOF128, |
| 401 | +} ACVP_SUB_ASCON; |
| 402 | + |
390 | 403 | /** @enum ACVP_SUB_RSA */ |
391 | 404 | typedef enum acvp_alg_type_rsa { |
392 | 405 | ACVP_SUB_RSA_KEYGEN = ACVP_RSA_KEYGEN, |
@@ -1959,6 +1972,70 @@ typedef struct acvp_dsa_tc_t { |
1959 | 1972 | unsigned char *msg; |
1960 | 1973 | } ACVP_DSA_TC; |
1961 | 1974 |
|
| 1975 | +/** @enum ACVP_ASCON_MODE */ |
| 1976 | +typedef enum acvp_ascon_mode { |
| 1977 | + ACVP_ASCON_MODE_AEAD128 = 0, |
| 1978 | + ACVP_ASCON_MODE_CXOF128, |
| 1979 | + ACVP_ASCON_MODE_HASH256, |
| 1980 | + ACVP_ASCON_MODE_XOF128, |
| 1981 | + ACVP_ASCON_MODE_NONE, |
| 1982 | +} ACVP_ASCON_MODE; |
| 1983 | + |
| 1984 | +/** @enum ACVP_ASCON_PARM */ |
| 1985 | +typedef enum acvp_ascon_parm { |
| 1986 | + ACVP_ASCON_MODE_PARM = 1, |
| 1987 | + ACVP_ASCON_REV_PARM, |
| 1988 | + ACVP_ASCON_DIR_PARM, |
| 1989 | + ACVP_ASCON_PAYLEN_PARM, |
| 1990 | + ACVP_ASCON_ADLEN_PARM, |
| 1991 | + ACVP_ASCON_TAGLEN_PARM, |
| 1992 | + ACVP_ASCON_NONCEMASK_PARM, |
| 1993 | + ACVP_ASCON_MSGLEN_PARM, |
| 1994 | + ACVP_ASCON_OUTLEN_PARM, |
| 1995 | + ACVP_ASCON_CUSSTRLEN_PARM, |
| 1996 | +} ACVP_ASCON_PARM; |
| 1997 | + |
| 1998 | +typedef enum acvp_ascon_direction { |
| 1999 | + ACVP_ASCON_ENCRYPT = 1, |
| 2000 | + ACVP_ASCON_DECRYPT, |
| 2001 | +} ACVP_ASCON_DIRECTION; |
| 2002 | + |
| 2003 | +typedef enum acvp_ascon_testtype { |
| 2004 | + ACVP_ASCON_AFT = 1, |
| 2005 | +} ACVP_ASCON_TESTTYPE; |
| 2006 | + |
| 2007 | +/** |
| 2008 | + * @struct ACVP_ASCON_TC |
| 2009 | + * @brief This struct holds data that represents a single test case for ASCON |
| 2010 | + * testing. This data is passed between libacvp and the crypto module. |
| 2011 | + */ |
| 2012 | +typedef struct acvp_ascon_tc_t { |
| 2013 | + int tg_id; |
| 2014 | + int tc_id; |
| 2015 | + ACVP_CIPHER cipher; |
| 2016 | + ACVP_ASCON_TESTTYPE testtype; |
| 2017 | + ACVP_ASCON_MODE mode; |
| 2018 | + ACVP_ASCON_DIRECTION direction; |
| 2019 | + bool supports_nonce_mask; |
| 2020 | + unsigned char *key; |
| 2021 | + unsigned char *second_key; |
| 2022 | + unsigned char *nonce; |
| 2023 | + unsigned char *ad; |
| 2024 | + int ad_len; |
| 2025 | + unsigned char *tag; |
| 2026 | + int tag_len; |
| 2027 | + bool tag_match; |
| 2028 | + unsigned char *pt; |
| 2029 | + unsigned char *ct; |
| 2030 | + int payload_len; |
| 2031 | + unsigned char *msg; |
| 2032 | + int msg_len; |
| 2033 | + unsigned char *md; |
| 2034 | + int out_len; |
| 2035 | + unsigned char *cs; |
| 2036 | + int cs_len; |
| 2037 | +} ACVP_ASCON_TC; |
| 2038 | + |
1962 | 2039 | /** @enum ACVP_KAS_ECC_MODE */ |
1963 | 2040 | typedef enum acvp_kas_ecc_mode { |
1964 | 2041 | ACVP_KAS_ECC_MODE_COMPONENT = 1, |
@@ -2997,11 +3074,14 @@ typedef struct acvp_test_case_t { |
2997 | 3074 | ACVP_ML_DSA_TC *ml_dsa; |
2998 | 3075 | ACVP_ML_KEM_TC *ml_kem; |
2999 | 3076 | ACVP_SLH_DSA_TC *slh_dsa; |
3000 | | - } tc; //!< the union abstracting the test case for passing to the user application |
| 3077 | + ACVP_ASCON_TC *ascon; |
| 3078 | + } tc; //!< the union abstracting the test case for passing to the user |
| 3079 | + //!< application |
3001 | 3080 | } ACVP_TEST_CASE; |
3002 | 3081 |
|
3003 | 3082 |
|
3004 | 3083 |
|
| 3084 | + |
3005 | 3085 | /** @defgroup APIs Public APIs for libacvp |
3006 | 3086 | * @brief this section describes APIs for libacvp. |
3007 | 3087 | */ |
@@ -3332,6 +3412,44 @@ ACVP_RESULT acvp_cap_dsa_set_parm(ACVP_CTX *ctx, |
3332 | 3412 | ACVP_DSA_PARM param, |
3333 | 3413 | int value); |
3334 | 3414 |
|
| 3415 | +/** |
| 3416 | + * @brief acvp_enable_ascon_cap() |
| 3417 | + * This function should be used to enable ASCON capabilities. Specific |
| 3418 | + * modes and parameters can use acvp_cap_ascon_set_parm. |
| 3419 | + * |
| 3420 | + * When the application enables a crypto capability, such as ASCON, it |
| 3421 | + * also needs to specify a callback function that will be used by libacvp when |
| 3422 | + * that crypto capability is needed during a test session. |
| 3423 | + * |
| 3424 | + * @param ctx Pointer to ACVP_CTX that was previously created by calling |
| 3425 | + * acvp_create_test_session. |
| 3426 | + * @param cipher ACVP_CIPHER enum value identifying the crypto capability. |
| 3427 | + * @param crypto_handler Address of function implemented by application that is |
| 3428 | + * invoked by libacvp when the crypto capability is needed during a test |
| 3429 | + * session. This crypto_handler function is expected to return 0 on success and |
| 3430 | + * 1 for failure. |
| 3431 | + * |
| 3432 | + * @return ACVP_RESULT |
| 3433 | + */ |
| 3434 | +ACVP_RESULT |
| 3435 | +acvp_cap_ascon_enable(ACVP_CTX *ctx, ACVP_CIPHER cipher, |
| 3436 | + int (*crypto_handler)(ACVP_TEST_CASE *test_case)); |
| 3437 | + |
| 3438 | +ACVP_RESULT |
| 3439 | +acvp_cap_ascon_set_value(ACVP_CTX *ctx, ACVP_CIPHER cipher, |
| 3440 | + ACVP_ASCON_MODE mode, ACVP_ASCON_PARM param, |
| 3441 | + int value); |
| 3442 | + |
| 3443 | +ACVP_RESULT |
| 3444 | +acvp_cap_ascon_append_value(ACVP_CTX *ctx, ACVP_CIPHER cipher, |
| 3445 | + ACVP_ASCON_MODE mode, ACVP_ASCON_PARM param, |
| 3446 | + int value); |
| 3447 | + |
| 3448 | +ACVP_RESULT |
| 3449 | +acvp_cap_ascon_set_domain(ACVP_CTX *ctx, ACVP_CIPHER cipher, |
| 3450 | + ACVP_ASCON_MODE mode, ACVP_ASCON_PARM param, int min, |
| 3451 | + int max, int increment); |
| 3452 | + |
3335 | 3453 | /** |
3336 | 3454 | * @brief acvp_enable_kas_ecc_cap() |
3337 | 3455 | * This function should be used to enable KAS-ECC capabilities. Specific modes and |
|
0 commit comments