nRF Connect SDK API 3.4.99
Loading...
Searching...
No Matches
cracen_psa_primitives.h File Reference
#include <psa/crypto_sizes.h>
#include <psa/crypto_types.h>
#include <psa/crypto_values.h>
#include <silexpk/blinding.h>
#include <stdbool.h>
#include <stdint.h>
#include <sxsymcrypt/cmac.h>
#include <sxsymcrypt/internal.h>
#include <sxsymcrypt/trng.h>
#include <sxsymcrypt/hashdefs.h>
#include <string.h>
#include <zephyr/sys/byteorder.h>

Go to the source code of this file.

Data Structures

struct  cracen_hash_operation_s
struct  cracen_xof_operation_s
struct  cracen_cipher_operation
struct  cracen_sw_ccm_context_s
struct  cracen_sw_gcm_context_s
struct  cracen_aead_operation
struct  cracen_cmac_context_s
struct  cracen_mac_operation_s
struct  cracen_key_derivation_operation
struct  cracen_jpake_operation
struct  cracen_prng_context
struct  cracen_srp_operation
struct  cracen_spake2p_operation
struct  cracen_wpa3_sae_operation
struct  cracen_pake_operation
struct  cracen_signature
struct  cracen_const_signature
struct  cracen_ecc_priv_key
struct  cracen_ecc_pub_key
struct  cracen_ecc_keypair
struct  cracen_rsa_key
struct  cracen_crypt_text
struct  cracen_coprimecheck
struct  cracen_rsacheckpq
struct  cracen_rsagenpq

Macros

#define SX_BLKCIPHER_IV_SZ   (16U)
#define SX_BLKCIPHER_AES_BLK_SZ   (16U)
#define SX_BLKCIPHER_CHACHA20_BLK_SZ   (64U)
#define CCM_STAR_L   2
#define CCM_STAR_NONCE_LENGTH   PSA_CIPHER_IV_LENGTH(PSA_KEY_TYPE_AES, PSA_ALG_CCM_STAR_NO_TAG)
#define CCM_STAR_MAX_MESSAGE_LEN   (BIT(8 * CCM_STAR_L) - 1)
#define SX_BLKCIPHER_MAX_BLK_SZ   SX_BLKCIPHER_AES_BLK_SZ
#define CRACEN_MAX_AES_KEY_SIZE   (32u)
#define CRACEN_MAX_AEAD_BLOCK_SIZE   (64u)
#define CRACEN_MAC_CTR_MAX_KEY_SIZE   CRACEN_MAX_AES_KEY_SIZE
#define CRACEN_MAX_AEAD_KEY_SIZE   (32u)
#define CRACEN_MAX_CHACHA20_KEY_SIZE   (32u)
#define CRACEN_CHACHA20_COUNTER_SIZE   (4u)
#define CRACEN_POLY1305_TAG_SIZE   (16u)
#define CRACEN_POLY1305_KEY_SIZE   (32u)
#define CRACEN_POLY1305_ACC_SIZE   (17u)
#define CRACEN_MAX_CIPHER_KEY_SIZE   (32u)
#define CRACEN_PBKDF_MAX_SALT_SIZE   128
#define CRACEN_HKDF_MAX_INFO_SIZE   128
#define CRACEN_MAC_MAX_LABEL_SIZE   127
#define CRACEN_MAC_MAX_CONTEXT_SIZE   160
#define CRACEN_JPAKE_USER_ID_MAX_SIZE   16
#define CRACEN_P256_KEY_SIZE   32
#define CRACEN_P256_POINT_SIZE   64
#define CRACEN_TLS12_PRF_MAX_LABEL_SIZE   128
#define CRACEN_TLS12_PRF_MAX_SEED_SIZE   128
#define CRACEN_PRNG_KEY_SIZE   (32u)
#define CRACEN_PRNG_ENTROPY_SIZE   (48u)
#define CRACEN_PRNG_NONCE_SIZE   (0u)
#define CRACEN_PRNG_PERSONALIZATION_MAX_SIZE   (48u)
#define CRACEN_PRNG_WORKMEM_SIZE   (176u)
#define CRACEN_PRNG_MAX_REQUEST_SIZE   (1u << 16)
#define CRACEN_SPAKE2P_HASH_LEN   PSA_HASH_LENGTH(PSA_ALG_SHA_256)
#define CRACEN_WPA3_SAE_MAX_SSID_LEN   (32u)
#define CRACEN_WPA3_SAE_MAX_PWD_LEN   (256u)
#define CRACEN_WPA3_SAE_MAX_PWID_LEN   (256u)
#define CRACEN_WPA3_SAE_PMK_LEN   (32u)
#define CRACEN_WPA3_SAE_PMKID_SIZE   (16u)
#define CRACEN_WPA3_SAE_STA_ID_LEN   (6u)
#define CRACEN_WPA3_SAE_IANA_GROUP_SIZE   (2u)
#define CRACEN_WPA3_SAE_COMMIT_SIZE
#define CRACEN_WPA3_SAE_SEND_CONFIRM_SIZE   (2u)
#define CRACEN_WPA3_SAE_CONFIRM_SIZE
#define CRACEN_AES_GCM_HTABLE_SIZE   16
#define CRACEN_SRP_HASH_ALG   PSA_ALG_SHA_512
#define CRACEN_SRP_HASH_LENGTH   PSA_HASH_LENGTH(CRACEN_SRP_HASH_ALG)
#define CRACEN_SRP_RFC3526_KEY_BITS_SIZE   3072
#define CRACEN_SRP_FIELD_SIZE   PSA_BITS_TO_BYTES(CRACEN_SRP_RFC3526_KEY_BITS_SIZE)
#define CRACEN_SRP_MAX_SALT_LENGTH   64

Typedefs

typedef struct cracen_hash_operation_s cracen_hash_operation_t
typedef struct cracen_xof_operation_s cracen_xof_operation_t
typedef struct cracen_cipher_operation cracen_cipher_operation_t
typedef struct cracen_sw_ccm_context_s cracen_sw_ccm_context_t
typedef struct cracen_sw_gcm_context_s cracen_sw_gcm_context_t
typedef struct cracen_aead_operation cracen_aead_operation_t
typedef struct cracen_cmac_context_s cracen_cmac_context_t
typedef struct cracen_mac_operation_s cracen_mac_operation_t
typedef struct cracen_key_derivation_operation cracen_key_derivation_operation_t
typedef struct cracen_jpake_operation cracen_jpake_operation_t
typedef struct cracen_prng_context cracen_prng_context_t
typedef struct cracen_srp_operation cracen_srp_operation_t
typedef struct cracen_spake2p_operation cracen_spake2p_operation_t
typedef struct cracen_wpa3_sae_operation cracen_wpa3_sae_operation_t
typedef struct cracen_pake_operation cracen_pake_operation_t

Enumerations

enum  cipher_operation { CRACEN_DECRYPT , CRACEN_ENCRYPT }
enum  cracen_kd_state {
  CRACEN_KD_STATE_INVALID = 0 , CRACEN_KD_STATE_HKDF_INIT = 0x10 , CRACEN_KD_STATE_HKDF_STARTED , CRACEN_KD_STATE_HKDF_KEYED ,
  CRACEN_KD_STATE_HKDF_OUTPUT , CRACEN_KD_STATE_PBKDF2_INIT = 0x20 , CRACEN_KD_STATE_PBKDF2_SALT , CRACEN_KD_STATE_PBKDF2_PASSWORD ,
  CRACEN_KD_STATE_PBKDF2_OUTPUT , CRACEN_KD_STATE_MAC_CTR_INIT = 0x40 , CRACEN_KD_STATE_MAC_CTR_KEY_LOADED , CRACEN_KD_STATE_MAC_CTR_INPUT_LABEL ,
  CRACEN_KD_STATE_MAC_CTR_INPUT_CONTEXT , CRACEN_KD_STATE_MAC_CTR_OUTPUT , CRACEN_KD_STATE_TLS12_PRF_INIT = 0x80 , CRACEN_KD_STATE_TLS12_PRF_OUTPUT ,
  CRACEN_KD_STATE_TLS12_PSK_TO_MS_INIT = 0x100 , CRACEN_KD_STATE_TLS12_PSK_TO_MS_OUTPUT , CRACEN_KD_STATE_TLS12_ECJPAKE_TO_PMS_INIT = 0x200 , CRACEN_KD_STATE_TLS12_ECJPAKE_TO_PMS_OUTPUT ,
  CRACEN_KD_STATE_WPA3_SAE_H2E_INIT = 0x400 , CRACEN_KD_STATE_WPA3_SAE_H2E_SALT , CRACEN_KD_STATE_WPA3_SAE_H2E_PASSWORD , CRACEN_KD_STATE_WPA3_SAE_H2E_INFO ,
  CRACEN_KD_STATE_WPA3_SAE_H2E_OUTPUT
}
enum  cracen_context_state { CRACEN_NOT_INITIALIZED = 0x0 , CRACEN_CONTEXT_INITIALIZED = 0x1 , CRACEN_HW_RESERVED = 0x2 }

Functions

static void cracen_ccm_star_build_a1 (uint8_t iv[(16U)], const uint8_t *nonce)
static psa_status_t cracen_ccm_star_add_length (cracen_cipher_operation_t *operation, size_t input_length)