AUTOSAR Classic Crypto Services
Cluster guideAI-GENERATED
Provides standardized cryptographic computing and key management services via hardware and software drivers.
Provides standardized cryptographic computing and key management services via hardware and software drivers.
The cluster bundles the CSM, CryIf, and Crypto Driver modules for hardware-independent provision of cryptographic services and key management functions in the AUTOSAR Classic Platform EXP_UtilizationOfCryptoServices p. 8. Cryptographic jobs are prioritized via the CSM, routed to logical channels in the CryIf, and executed synchronously or asynchronously in the Crypto Driver [SWS_CryIf_91003]. For consistency reasons, key persistences in the NVM strictly occur only after successful validation using KeySetValid SWS_CryptoDriver p. 37.
The "Crypto Services & Hardware Abstraction" module cluster comprises the AUTOSAR Classic modules Crypto Service Manager (csm), Crypto Interface (cryif), and Crypto Driver (crypto) EXP_UtilizationOfCryptoServices p. 8. It provides a hardware-independent abstraction layer for cryptographic operations (including encryption, signatures, MAC calculation, and random number generation) as well as for secure key management [SWS_Csm_00982], [SWS_Csm_00984], SWS_CryptoDriver p. 15.
Cryptographic requests are encapsulated as Crypto_JobType, which defines priorities, input and output buffers, and operation modes (start, update, finish for streaming or single-call) [SWS_Csm_01013], [SWS_Csm_01039]. The CSM accepts jobs, assigns them to software queues, and forwards them via CryIf_ProcessJob() [SWS_Csm_00017], [SWS_CryIf_91003]. The CryIf performs channel routing to the drivers and translates CSM key identifiers into module-specific driver key IDs [SWS_CryIf_00133].
Context diagram: Layered architecture and interface cascade of the AUTOSAR crypto stack. Sources: SWS_CryptoDriver p. 15, SWS_CryptoServiceManager p. 29
The periodic Csm_MainFunction() serves to synchronize asynchronous crypto jobs, emptying queues and triggering pending calculations [SWS_Csm_00479]. After completion of an asynchronous hardware calculation, the Crypto Driver notifies the CryIf via CryIf_CallbackNotification(), which passes the notification to Csm_CallbackNotification() and ultimately to the calling application [SWS_CryIf_91013], [SWS_Csm_00970].
Sequence diagram: Asynchronous crypto job flow with queuing and callback cascade. Sources: [SWS_Csm_00970], [SWS_CryIf_91013], AUTOSAR_CP_SWS_CryptoServiceManager p. 146
Key management is performed via standardized interfaces such as Csm_KeyElementSet() and CryIf_KeyElementCopy() under strict adherence to configured access rights [SWS_Csm_00957], [SWS_CryIf_91015], [SWS_Crypto_00219]. Persistence in the NVM is only triggered upon explicit validation via Crypto_KeySetValid(), thereby preventing incomplete key storage operations [SWS_Crypto_91014], SWS_CryptoDriver p. 37. Errors such as overloads or invalid key states are robustly handled via CRYPTO_E_BUSY or CRYPTO_E_KEY_NOT_VALID [SWS_Csm_00018], [SWS_CryIf_91003].
1. System Architecture & Role of the Module Cluster
The "Crypto Services & Hardware Abstraction" module cluster forms the functional foundation for cryptographic operations, software- and hardware-based key management, and secure on-board communication in the AUTOSAR Classic Platform EXP_UtilizationOfCryptoServices p. 8. The architecture is strictly structured along the AUTOSAR layer model into three standardized BSW modules: the Crypto Service Manager (csm) in the service layer, the Crypto Interface (cryif) in the ECU abstraction layer, and at least one Crypto Driver (crypto) on the microcontroller abstraction layer (MCAL) SWS_CryptoDriver p. 15. This layered structure completely abstracts security applications (such as SecOC, TLS connection setups, and UDS diagnostic authentication) from proprietary crypto coprocessors such as Hardware Security Modules (HSM) or Secure Hardware Extensions (SHE) SWS_SecureOnboardCommunication p. 78.
The Crypto Service Manager (CSM) acts as the primary service provider for application components (SW-Cs) and upper-layer BSW modules. It provides standardized programming interfaces for symmetric and asymmetric algorithms (e.g., AES, RSA), hashing, message authentication codes (MAC), random number generation (RNG), and AEAD schemes [SWS_Csm_00980], [SWS_Csm_00982], [SWS_Csm_00984], [SWS_Csm_01023]. In addition, the CSM implements software job queues and controls the prioritization of concurrent crypto jobs [SWS_Csm_00022], SWS_CryptoServiceManager p. 29.
As an abstraction layer, the Crypto Interface (CryIf) provides a uniform 1:n interface between the CSM and any number of crypto drivers. Its central task is dispatching: it forwards jobs based on configured logical channels (channelId) to the corresponding Crypto Driver instance and transforms logical key references (cryIfKeyId) into driver-specific identifiers (cryptoKeyId) [SWS_CryIf_00133], [SWS_CryIf_91003]. The Crypto Driver encapsulates the physical execution unit (Crypto Driver Object) and serves either pure software crypto primitives or dedicated hardware security modules [SWS_Crypto_00224], SWS_CryptoDriver p. 15.
Context diagram: Layered architecture and interface cascade of the AUTOSAR crypto stack. Sources: SWS_CryptoDriver p. 15, SWS_CryptoServiceManager p. 29
2. Interplay & Interaction Paths between the Modules
Job processing within the cluster is primarily performed via the job-based model using the structure Crypto_JobType [SWS_Csm_01013], AUTOSAR_CP_SWS_CryptoServiceManager p. 21. A crypto job bundles the job ID, priority information, key references, primitive metadata, and the structure Crypto_JobPrimitiveInputOutputType for managing pointers of input, output, and length parameters [SWS_Csm_01012]. The bitmask field Crypto_OperationModeType (with flags START, UPDATE, FINISH) controls whether a job is computed as a contiguous single call (SINGLECALL) or incrementally in streaming mode [SWS_Csm_01039], [SWS_Csm_01029].
If a CSM service function is called synchronously, the CSM checks the job state. If the driver is free or the job is configured as synchronous, the CSM directly calls CryIf_ProcessJob() [SWS_Csm_00017], [SWS_CryIf_91003]. The CryIf maps the key IDs and dispatches the job to the assigned driver instance via Crypto_ProcessJob() [SWS_CryIf_00133]. For asynchronous requests, if the driver object is busy, the job is queued in the CSM queue [SWS_Csm_00018], AUTOSAR_CP_SWS_CryptoServiceManager p. 30. After completion of the asynchronous driver computation, the driver triggers CryIf_CallbackNotification() [SWS_CryIf_91013], the CryIf forwards the notification to Csm_CallbackNotification() [SWS_Csm_00970], and the CSM finally notifies the requesting application via its configured callback [SWS_Csm_01044], [SWS_Csm_00928].
Sequence diagram: Asynchronous crypto job flow with queuing and callback cascade. Sources: [SWS_Csm_00970], [SWS_CryIf_91013], AUTOSAR_CP_SWS_CryptoServiceManager p. 146
In addition to primary crypto execution, key management constitutes an integral interaction path of the cluster SWS_CryptoDriver p. 24. A key consists of multiple logical key elements (such as key material, initialization vectors, or iteration counts) [SWS_Csm_00954], [SWS_Csm_01022]. Operations such as setting key material via Csm_KeyElementSet(), copying via Csm_KeyElementCopy(), or key derivation via Csm_KeyDerive() are forwarded synchronously via the CryIf (CryIf_KeyElementCopy(), CryIf_KeyDerive()) to the driver functions [SWS_Csm_00957], [SWS_Csm_00969], [SWS_CryIf_91015], [SWS_CryIf_91009]. Access to key elements is strictly monitored based on configured access rights (CRYPTO_RA_ALLOWED, CRYPTO_RA_ENCRYPTED, CRYPTO_RA_INTERNAL_COPY) [SWS_Crypto_00219].
3. Synchronization, Reentrancy, and Task Contexts
Cryptographic operations vary drastically in their execution duration. While fast block ciphers or hash calculations can be executed synchronously in the task context of the caller, asymmetric computations (e.g., RSA signature generation) or time-intensive hardware processes require asynchronous processing [SWS_Csm_00984], [SWS_Csm_00992]. For decoupling, the CSM provides the cyclically called main function Csm_MainFunction() [SWS_Csm_00479]. This function monitors queues, dispatches pending jobs to the CryIf, and drives internal state machines of asynchronous primitives [SWS_Csm_00019].
In modern multi-core and multi-sector architectures, the CSM supports multiple instances Csm_MainFunction_<shortName>() mapped to dedicated OS partitions [SWS_Csm_00479], AUTOSAR_SWS_CryptoServiceManager p. 170. In asynchronous driver execution, computations are completed either by polling in the driver MainFunction or by interrupt service routines (ISR) of hardware-based crypto engines [SWS_Crypto_00027], [SWS_Crypto_00028]. A single Crypto Driver Object can, by definition, process exactly one crypto job at a time; a driver with n objects processes n jobs truly concurrently [SWS_Crypto_00014], [SWS_Crypto_00117].
Regarding reentrancy, service interfaces such as Csm_MacGenerate() or CryIf_ProcessJob() are designed to be reentrant for different jobs, but forbid parallel multiple requests for the same job instance [SWS_Csm_00016], [SWS_CryIf_91003]. Key management functions such as Csm_KeyElementCopy(), CryIf_KeyElementCopy(), or Crypto_KeyCopy() are implemented as reentrant, but must not be applied concurrently to the same source key identifier (keyId or cryptoKeyId) to avoid data inconsistencies and race conditions [SWS_Csm_00969], [SWS_CryIf_91015], [SWS_Crypto_00155]. Hardware drivers may use internal exclusive areas for modifying internal workspaces and key registers to handle race conditions between ISR and task level SWS_CryptoDriver p. 27. Question Q-b1e9578255723a0e (open)
Activity diagram: Decision logic and queuing decoupling during job acceptance in the CSM. Sources: AUTOSAR_CP_SWS_CryptoServiceManager p. 30, [SWS_Csm_00017], [SWS_Csm_00018]
4. Typical Lifecycles and Operating Modes
Initialization of the crypto cluster takes place during BSW startup in hierarchical order. First, the EcuM or BswM initializes the driver layer via Crypto_Init(), passing the configuration Crypto_ConfigType [SWS_Crypto_91016], followed by the interface layer via CryIf_Init() with CryIf_ConfigType [SWS_CryIf_91118]. Finally, the CSM is started using Csm_Init(), where its configuration pointer must always be set to NULL_PTR according to the specification [SWS_Csm_00646]. Cryptographic jobs or key access requests may only be accepted after all layers are completely initialized [SWS_CryIf_00076], [SWS_Crypto_00196].
A central aspect of the key lifecycle is validation and persistence in non-volatile memory (NVM). After loading new key values via Csm_KeyElementSet(), the key remains in the state "incomplete or unknown" [SWS_Csm_00957]. Only the explicit call of Csm_JobKeySetValid() or Crypto_KeySetValid() verifies consistency and transitions the key state to valid [SWS_Csm_91027], [SWS_Crypto_91014]. For persisted keys, only this validation triggers storage in the NVM [SWS_Crypto_91026], SWS_CryptoDriver p. 37. This prevents multiple fragmented NVM write cycles and protects against incomplete key sets SWS_CryptoDriver p. 37. For synchronization with the NVRAM Manager, the Crypto Driver utilizes the callbacks Crypto_<vi>_<ai>_NvBlock_ReadFrom_<NvBlock>() and Crypto_<vi>_<ai>_NvBlock_WriteTo_<NvBlock>() as well as NvM_WriteBlock() [SWS_Crypto_91024], [SWS_Crypto_91025], [SWS_Crypto_91017].
Running streaming jobs can be interrupted if necessary via Csm_SaveContextJob(), saved in an application-owned buffer, and resumed later via context restore [SWS_Csm_91063], [SWS_Csm_01029]. Prior to an ECU shutdown or a transition to low-power modes, asynchronous jobs can be canceled in a controlled manner via Csm_CancelJob(), whereby the CryIf removes the jobs from driver queues and hardware channels via CryIf_CancelJob() [SWS_Csm_00968], [SWS_CryIf_91014].
5. Error Handling, DET Tracing, and Degradation
The cluster implements a multi-stage error detection and mitigation strategy. If tracing is enabled, development errors are reported directly to the Default Error Tracer (DET) module [SWS_Csm_91101], [SWS_Crypto_91017]. Typical DET events include module calls prior to successful initialization (CRYIF_E_UNINIT, CRYPTO_E_UNINIT), invalid handle or key parameters (CRYIF_E_PARAM_HANDLE, CRYPTO_E_PARAM_HANDLE), and null pointer passes [SWS_CryIf_00076], [SWS_CryIf_00134], [SWS_Crypto_00196], [SWS_Crypto_00217].
Runtime overloads and resource bottlenecks are handled deterministically via defined return values. If the CSM queue for an asynchronous job is exhausted, the CSM rejects the job with the status code CRYPTO_E_BUSY and generates the runtime error CSM_E_QUEUE_FULL [SWS_Csm_00018], [SWS_Csm_01089]. If a provided result buffer is insufficiently sized, the driver aborts the operation with CRYPTO_E_SMALL_BUFFER [SWS_Crypto_00195]. If a cryptographic service refers to an uninitialized or explicitly invalidated key (for example after calling Csm_JobKeySetInvalid() or Crypto_KeySetInvalid()), service requests fail in a controlled manner with CRYPTO_E_KEY_NOT_VALID or CRYPTO_E_KEY_EMPTY [SWS_Csm_91002], [SWS_CryIf_91003], [SWS_Crypto_91020].
Degradation and fallback mechanisms are enabled at the system level: applications can check the integrity status of keys via Csm_KeyGetStatus() before transmitting a job [SWS_Csm_91047], [SWS_CryIf_91012]. If a hardware crypto accelerator is permanently busy or fails, the CryIf channel configuration allows a software-based alternative route, provided a redundant software driver is integrated SWS_CryptoDriver p. 15.
This guide is based exclusively on the AUTOSAR Classic specification R20-11 and was generated by the autodocs curation assistant.
Die Crypto Services bieten hardware- und softwaregestützte Kryptographie-Primitive (CSM, CryIf, Crypto-Treiber) für symmetrische/asymmetrische Verschlüsselung, Signaturen und Hashing.
Module im Cluster
Crypto Abstraction Library (Cal)
AUTOSAR Classic Crypto Services-Modul Crypto Abstraction Library (Cal, Spezifikation: AUTOSAR_SWS_CryptoAbstractionLibrary.pdf).
Crypto Interface (CryIf)
Abstracts cryptographic hardware and software acceleration engines.
Crypto Driver (Crypto)
Low-level driver executing cryptographic primitives on hardware security modules (HSM) or software libraries.
Crypto Service Manager (CSM)
Provides standardized cryptographic services (encryption, hashing, digital signatures, key management) to applications and BSW.
Initialization and status
CryIf_GetVersionInfoCryIf_InitCrypto_GetVersionInfoCrypto_InitCsm_GetVersionInfoCsm_InitServices · Key…
Services · Job…
Services · Random…
Services · Cancel…
Services · More
CryIf_CallbackNotificationCryIf_ProcessJobCrypto_ProcessJobCsm_AEADDecryptCsm_AEADEncryptCsm_CallbackNotificationCsm_DecryptCsm_EncryptCsm_HashCsm_MacGenerateCsm_MacVerifyCsm_RestoreContextJobCsm_SaveContextJobCsm_SignatureGenerateCsm_SignatureVerifyCallouts and expected interfaces
<Csm_ApplicationCallbackNotification>Cyclic
Crypto_MainFunctionCsm_MainFunctionTypes
CryIf_ConfigTypeCrypto_AlgorithmFamilyTypeCrypto_AlgorithmInfoTypeCrypto_AlgorithmModeTypeCrypto_ConfigTypeCrypto_InputOutputRedirectionConfigTypeCrypto_JobPrimitiveInfoTypeCrypto_JobPrimitiveInputOutputTypeCrypto_JobRedirectionInfoTypeCrypto_JobStateTypeCrypto_JobTypeCrypto_KeyStatusTypeCrypto_OperationModeTypeCrypto_PrimitiveInfoTypeCrypto_ProcessingTypeCrypto_ResultTypeCrypto_ServiceInfoTypeCrypto_VerifyResultTypeCsm_AEADDecryptAssociatedDataTypeCsm_AEADDecryptCiphertextTypeCsm_AEADDecryptPlaintextTypeCsm_AEADDecryptTagTypeCsm_AEADEncryptAssociatedDataTypeCsm_AEADEncryptCiphertextTypeCsm_AEADEncryptPlaintextTypeCsm_AEADEncryptTagTypeCsm_ConfigIdTypeCsm_ConfigTypeCsm_DecryptDataTypeCsm_DecryptResultTypeCsm_EncryptDataTypeCsm_EncryptResultTypeCsm_HashDataTypeCsm_HashResultTypeCsm_KeyDataTypeCsm_LengthPtrCsm_MacGenerateDataTypeCsm_MacGenerateResultTypeCsm_MacVerifyCompareTypeCsm_MacVerifyDataTypeCsm_RandomGenerateResultTypeCsm_SignatureGenerateDataTypeCsm_SignatureGenerateResultTypeCsm_SignatureVerifyCompareTypeCsm_SignatureVerifyDataTypeCsm_VerifyResultPtrFunctions
<Csm_ApplicationCallbackNotification>CryIf_CallbackNotificationCryIf_CancelJobCryIf_GetVersionInfoCryIf_InitCryIf_KeyCopyCryIf_KeyDeriveCryIf_KeyElementCopyCryIf_KeyElementCopyPartialCryIf_KeyElementGetCryIf_KeyElementSetCryIf_KeyExchangeCalcPubValCryIf_KeyExchangeCalcSecretCryIf_KeyGenerateCryIf_KeyGetStatusCryIf_KeySetInvalidCryIf_KeySetValidCryIf_ProcessJobCryIf_RandomSeedCrypto_CancelJobCrypto_GetVersionInfoCrypto_InitCrypto_KeyCopyCrypto_KeyDeriveCrypto_KeyElementCopyCrypto_KeyElementCopyPartialCrypto_KeyElementGetCrypto_KeyElementIdsGetCrypto_KeyElementSetCrypto_KeyExchangeCalcPubValCrypto_KeyExchangeCalcSecretCrypto_KeyGenerateCrypto_KeyGetStatusCrypto_KeySetInvalidCrypto_KeySetValidCrypto_MainFunctionCrypto_ProcessJobCrypto_RandomSeedCsm_AEADDecryptCsm_AEADEncryptCsm_CallbackNotificationCsm_CancelJobCsm_DecryptCsm_EncryptCsm_GetVersionInfoCsm_HashCsm_InitCsm_JobKeyDeriveCsm_JobKeyExchangeCalcPubValCsm_JobKeyExchangeCalcSecretCsm_JobKeyGenerateCsm_JobKeySetInvalidCsm_JobKeySetValidCsm_JobRandomSeedCsm_KeyCopyCsm_KeyDeriveCsm_KeyElementCopyCsm_KeyElementCopyPartialCsm_KeyElementGetCsm_KeyElementSetCsm_KeyExchangeCalcPubValCsm_KeyExchangeCalcSecretCsm_KeyGenerateCsm_KeyGetStatusCsm_KeySetInvalidCsm_KeySetValidCsm_MacGenerateCsm_MacVerifyCsm_MainFunctionCsm_RandomGenerateCsm_RandomSeedCsm_RestoreContextJobCsm_SaveContextJobCsm_SignatureGenerateCsm_SignatureVerifyTypes
CryIf_ConfigTypeCrypto_AlgorithmFamilyTypeCrypto_AlgorithmInfoTypeCrypto_AlgorithmModeTypeCrypto_ConfigTypeCrypto_InputOutputRedirectionConfigTypeCrypto_JobPrimitiveInfoTypeCrypto_JobPrimitiveInputOutputTypeCrypto_JobRedirectionInfoTypeCrypto_JobStateTypeCrypto_JobTypeCrypto_KeyStatusTypeCrypto_OperationModeTypeCrypto_PrimitiveInfoTypeCrypto_ProcessingTypeCrypto_ResultTypeCrypto_ServiceInfoTypeCrypto_VerifyResultTypeCsm_AEADDecryptAssociatedDataTypeCsm_AEADDecryptCiphertextTypeCsm_AEADDecryptPlaintextTypeCsm_AEADDecryptTagTypeCsm_AEADEncryptAssociatedDataTypeCsm_AEADEncryptCiphertextTypeCsm_AEADEncryptPlaintextTypeCsm_AEADEncryptTagTypeCsm_ConfigIdTypeCsm_ConfigTypeCsm_DecryptDataTypeCsm_DecryptResultTypeCsm_EncryptDataTypeCsm_EncryptResultTypeCsm_HashDataTypeCsm_HashResultTypeCsm_KeyDataTypeCsm_LengthPtrCsm_MacGenerateDataTypeCsm_MacGenerateResultTypeCsm_MacVerifyCompareTypeCsm_MacVerifyDataTypeCsm_RandomGenerateResultTypeCsm_SignatureGenerateDataTypeCsm_SignatureGenerateResultTypeCsm_SignatureVerifyCompareTypeCsm_SignatureVerifyDataTypeCsm_VerifyResultPtrTopic map
CryIf
19Crypto
20CSM
82No element data available for this release
CryIf
Notifies the CRYIF about the completion of the request with the result of the cryptographic operation.
void CryIf_CallbackNotification (Crypto_JobType* job, Crypto_ResultType result);This interface dispatches the job cancellation function to the configured crypto driver object.
Std_ReturnType CryIf_CancelJob (uint32 channelId, Crypto_JobType* job);Returns the version information of this module.
void CryIf_GetVersionInfo (Std_VersionInfoType* versioninfo);Initializes the CRYIF module. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoInterface
void CryIf_Init (const CryIf_ConfigType* configPtr);This function shall co py all key elements from the source key to a target key.
Std_ReturnType CryIf_KeyCopy (uint32 cryIfKeyId, uint32 targetCryIfKeyId);This function shall dispatch th e key derive function to the configured crypto driver object.
Std_ReturnType CryIf_KeyDerive (uint32 cryIfKeyId, uint32 targetCryIfKeyId);Service CryIf_KeyElementCopy.
Std_ReturnType CryIf_KeyElementCopy (uint32 cryIfKeyId, uint32 keyElementId, uint32 targetCryIfKeyId, uint32 targetKeyElementId);This function shall dispatch the get key ele ment function to the configured crypto driver object.
Std_ReturnType CryIf_KeyElementGet (uint32 cryIfKeyId, uint32 keyElementId, uint8* resultPtr, uint32* resultLengthPtr);This function shall dispatch the set key element function to the configured crypto driver object.
Std_ReturnType CryIf_KeyElementSet (uint32 cryIfKeyId, uint32 keyElementId, const uint8* keyPtr, uint32 keyLength);This function shall dispatch the key exchange public value calculation function to the configured crypto driver object. Available
Std_ReturnType CryIf_KeyExchangeCalcPubVal (uint32 cryIfKeyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);This function shall dispatch the key exchange common shared secret calculation function to the configured crypto driver object.
Std_ReturnType CryIf_KeyExchangeCalcSecret (uint32 cryIfKeyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);This function shall dispatch the key generate function to the configured crypto driver object.
Std_ReturnType CryIf_KeyGenerate (uint32 cryIfKeyId);Returns the key state of the key identified by cry If Key Id.
Std_ReturnType CryIf_KeyGetStatus (uint32 cryIfKeyId, Crypto_KeyStatusType* keyStatusPtr);Sets invalid for the status of the key identifi ed by cry If Key Id.
Std_ReturnType CryIf_KeySetInvalid (uint32 cryIfKeyId);This function shall dispatch the set key valid function to the configured crypto driver object.
Std_ReturnType CryIf_KeySetValid (uint32 cryIfKeyId);Service CryIf_ProcessJob.
Std_ReturnType CryIf_ProcessJob (uint32 channelId, Crypto_JobType* job);This function shall dispatch the random seed function to the configured crypto driver object.
Std_ReturnType CryIf_RandomSeed (uint32 cryIfKeyId, const uint8* seedPtr, uint32 seedLength);Configuration data structure of Cry If module
Crypto
This interface removes the provided job from the queue and cancels the processing of the job if possible.
Std_ReturnType Crypto_CancelJob (uint32 objectId, Crypto_JobType* job);Returns the version information of this module.
void Crypto_GetVersionInfo (Std_VersionInfoType* versioninfo);Initializes the Crypto Driver.
void Crypto_Init (const Crypto_ConfigType* configPtr);Copies a key with all its elements to another key in the same crypto driver. Note: If the actual key element is directly mapped to flash memory, there could be a bigger delay when calling this function (synchronous operation)
Std_ReturnType Crypto_KeyCopy (uint32 cryptoKeyId, uint32 targetCryptoKeyId);Derives a new key by using the key elements in the given key identified by the crypto Key Id. The given key contains the key elements for the password, salt. The derived key is stored in the key element with the id 1 of the key identified by target Crypto Key Id. The number of iterations is given in the key element CRYPTO_ KE_ KEYDERIVATION_ ITERATIONS.
Std_ReturnType Crypto_KeyDerive (uint32 cryptoKeyId, uint32 targetCryptoKeyId);Service Crypto_KeyElementCopy.
Std_ReturnType Crypto_KeyElementCopy (uint32 cryptoKeyId, uint32 keyElementId, uint32 targetCryptoKeyId, uint32 targetKeyElementId);This interface shall be used to get a key element of the key identified by the crypto
Std_ReturnType Crypto_KeyElementGet (uint32 cryptoKeyId, uint32 keyElementId, uint8* resultPtr, uint32* resultLengthPtr);Used to retrieve information which key elements are available in a given key.
Std_ReturnType Crypto_KeyElementIdsGet (uint32 cryptoKeyId, uint32* keyElementIdsPtr, uint32* keyElementIdsLengthPtr);Sets the given key element bytes to the key identified by crypto Key Id.
Std_ReturnType Crypto_KeyElementSet (uint32 cryptoKeyId, uint32 keyElementId, const uint8* keyPtr, uint32 keyLength);Calculates the public value for the key exchange a nd stores the public key in the memory location pointed by the public value pointer.
Std_ReturnType Crypto_KeyExchangeCalcPubVal (uint32 cryptoKeyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);Calculates the shared secret key for the key exchange with the key material of the key identified by the crypto Key Id and the partner public key. The shared secret key is stored as a key element in the same key.
Std_ReturnType Crypto_KeyExchangeCalcSecret (uint32 cryptoKeyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);Generates new key material store it in the key identified by crypto Key Id.
Std_ReturnType Crypto_KeyGenerate (uint32 cryptoKeyId);Returns the key state of the key identified by crypto Key Id.
Std_ReturnType Crypto_KeyGetStatus (uint32 cryptoKeyId, Crypto_KeyStatusType* keyStatusPtr);Sets invalid for the status of the key identifi ed by crypto Key Id.
Std_ReturnType Crypto_KeySetInvalid (uint32 cryptoKeyId);Sets the key state of the key identified by crypto Key Id to valid.
Std_ReturnType Crypto_KeySetValid (uint32 cryptoKeyId);If asynchronous job processing is configured and there are job queues, the function is called cyclically to process queued jobs. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoDriver
void Crypto_MainFunction (void);Service Crypto_ProcessJob.
Std_ReturnType Crypto_ProcessJob (uint32 objectId, Crypto_JobType* job);This function generates the internal seed state using the pro vided entropy source. Furthermore, this function can be used to update the seed state with new entropy
Std_ReturnType Crypto_RandomSeed (uint32 cryptoKeyId, const uint8* seedPtr, uint32 seedLength);Configuration data structure of Cry If module
CSM
CSM notifies the application that a job has finished. The function name is configurable. The function name itself is derived from "{CSM Job/ CSM Job Primitive Callback Ref}/CSM Callback Func".
void <Csm_ApplicationCallbackNotification> (uint32 jobId, Crypto_ResultType result);Service Csm_AEADDecryptManager.
Std_ReturnType Csm_AEADDecrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* ciphertextPtr, uint32 ciphertextLength, const uint8* associatedDataPtr, uint32 associatedDataLength, const uint8* tagPtr, uint32 tagLength, uint8* plaintextPtr, uint32* plaintextLengthPtr, Crypto_VerifyResultType* verifyPtr);Service Csm_AEADEncrypt.
Notifies the CSM that a job has finished. This function is used by the underlying layer (CRYIF).
void Csm_CallbackNotification (Crypto_JobType* job, Crypto_ResultType result);Cancels the job processing from asynchronous or streaming jobs .
Std_ReturnType Csm_CancelJob (uint32 job, Crypto_OperationModeType mode);Service Csm_Decrypt.
Std_ReturnType Csm_Decrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* resultPtr, uint32* resultLengthPtr);Service Csm_Encrypt.
Std_ReturnType Csm_Encrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* resultPtr, uint32* resultLengthPtr);Returns the version information of this module.
void Csm_GetVersionInfo (Std_VersionInfoType* versioninfo);Uses the given data to perform the hash calculation and stores the hash.
Std_ReturnType Csm_Hash (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* resultPtr, uint32* resultLengthPtr);Initializes the CSM module. In configurations, in which CSM is assigned to more than one partition (i.e. Csm_ Main Functions are mapped to partitions), CSM may provide one init function per partition.
void Csm_Init (const Csm_ConfigType* configPtr);Derives a new key by using the key elements in the given key identified by the key Id. The given key contains the key elements for the password and salt. The derived key is stored in the key element with the id 1 of the key identified by target Crypto
Std_ReturnType Csm_JobKeyDerive (uint32 jobId, uint32 keyId, uint32 targetKeyId);Calculates the public value of the current user for the key exchange and stores the
Std_ReturnType Csm_JobKeyExchangeCalcPubVal (uint32 jobId, uint32 keyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);Calculates the shared secret key for the key exchange with the key material of the key identified by the key Id and the partner public key. The shared secret key is stored as a key element in the same key.
Std_ReturnType Csm_JobKeyExchangeCalcSecret (uint32 jobId, uint32 keyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);Generates new key material and stores it in the key identified by key Id.
Std_ReturnType Csm_JobKeyGenerate (uint32 jobId, uint32 keyId);Sets the key status to invalid. The key cannot be used any longer for cryptographic operations until it has been set to valid state again.
Std_ReturnType Csm_JobKeySetInvalid (uint32 jobId, uint32 keyId);Stores the key if necessary and sets the key state of the key identified by key Id to valid.
Std_ReturnType Csm_JobKeySetValid (uint32 jobId, uint32 keyId);Provides a new seed for the specified key that is used for an associated random number generator.
Std_ReturnType Csm_JobRandomSeed (uint32 jobId, uint32 keyId, const uint8* seedPtr, Manager uint32 seedLength);This function shall copy all key elements from the source key to a target key. Ava ilable via Csm.h
Std_ReturnType Csm_KeyCopy (const uint32 keyId, const uint32 targetKeyId);Derives a new key by using the key elements in the given key identified by the key Id. The given key contains the key elements for the password and salt. The derived key is stored in the k ey element with the id 1 of the key identified by target Crypto Key Id.
Std_ReturnType Csm_KeyDerive (uint32 keyId, uint32 targetKeyId);Service Csm_KeyElementCopyManager.
Std_ReturnType Csm_KeyElementCopy (const uint32 keyId, const uint32 keyElementId, const uint32 targetKeyId, const uint32 targetKeyElementId);Service Csm_KeyElementGet.
Std_ReturnType Csm_KeyElementGet (uint32 keyId, uint32 keyElementId, uint8* keyElementPtr, Manager uint32* keyElementLengthPtr);Sets the given key element bytes to the key identified by key Id.
Std_ReturnType Csm_KeyElementSet (uint32 keyId, uint32 keyElementId, const uint8* keyElementPtr, uint32 keyElementLength);Calculates the public value of the current user for the key exchange and stores the pub lic key in the memory location pointed by the public value pointer.
Std_ReturnType Csm_KeyExchangeCalcPubVal (uint32 keyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);Calculates the shared secret key for the key exchange with the key material of the key identified by the key Id and the partner public key. The shared secret key is stored as a key element in the same key.
Std_ReturnType Csm_KeyExchangeCalcSecret (uint32 keyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);Generates new key material and store it in the key identified by key Id.
Std_ReturnType Csm_KeyGenerate (uint32 keyId);Returns the key state of the key identified by key Id.
Std_ReturnType Csm_KeyGetStatus (uint32 keyId, Crypto_KeyStatusType* keyStatusPtr);Sets the key status to invalid. The key cannot be used any longer for cryptographic operations until it has been set to valid state again.
Std_ReturnType Csm_KeySetInvalid (uint32 keyId);Sets the key state of the key identified by key Id to valid.
Std_ReturnType Csm_KeySetValid (uint32 keyId);Service Csm_MacGenerate.
Std_ReturnType Csm_MacGenerate (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* macPtr, uint32* macLengthPtr);Service Csm_MacVerify.
Std_ReturnType Csm_MacVerify (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, const uint8* macPtr, const uint32 macLength, Crypto_VerifyResultType* verifyPtr);API to be called cyclically to process the requested jobs. The Csm_ Main Function shall check the queues for jobs to pass to the underlying CRYIF. Per configured CSM Main Function ins tance one Csm_ Main Function_ shall be implemented. Hereby is the short name of the CSM Main Function configuration container in the ECU configuration.
void Csm_MainFunction (void);Generate a random number and stores it in the memory location pointed by th e result pointer.
Std_ReturnType Csm_RandomGenerate (uint32 jobId, uint8* resultPtr, uint32* resultLengthPtr);Feeds the key element CRYPTO_ KE_ RANDOM_ SEED with a random seed. Manager AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoServiceManager
Std_ReturnType Csm_RandomSeed (uint32 keyId, const uint8* seedPtr, uint32 seedLength);The Crypto Driver extracts the context data from the context Buffer and restores the internal state so that further crypto operation of this crypto service will continue at the exact point when the context was taken.
Std_ReturnType Csm_RestoreContextJob (uint32 jobId, uint8* contextBufferPtr, uint32 contextBufferLength);The Crypto Driver stores the internal context of the respective crypto operation to the context Buffer.
Std_ReturnType Csm_SaveContextJob (uint32 jobId, uint8* contextBufferPtr, uint32* contextBufferLengthPtr);Service Csm_SignatureGenerate.
Std_ReturnType Csm_SignatureGenerate (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* signaturePtr, uint32* signatureLengthPtr);Service Csm_SignatureVerify.
Std_ReturnType Csm_SignatureVerify (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, const uint8* signaturePtr, uint32 signatureLength, Crypto_VerifyResultType* verifyPtr);Type Crypto_AlgorithmFamilyType.
Structure which determines the exact algorithm. Note, not every algorithm needs to specify all fields. AUTOSAR shall only allow valid combinations.
Type Crypto_AlgorithmModeType.
Defines which of the input/ output parameters are re - directed to a key element. The values can be combined to define a bit field.
Structure which contains further information, which depends on the job and the crypto primitive.
Type Crypto_JobPrimitiveInputOutputType.
Type Crypto_JobRedirectionInfoType.
Enumeration of the current job state.
Structure which contains further information, which depends on the job and the crypto primitive.
Enumeration for key status.
Enume ration which operation shall be performed. This enumeration is constructed from a bit mask, where the first bit indicates "Start", the second "Update" and the third "Finish".
Structure which contains basic information about the crypto primitive. Manager AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoServiceManager
Enumeration of the processing type.
Return for Std_ Return Type for Cryptostack.
Enumeration of the kind of the service.
Enumeration of the result type of verification operations.
Array long enough to store the data of the header.
Array long enough to store the ciphertext to be decrypted with AEAD.
Array long enough to store the data of the plaintext.
Array long enough to store the data of the Tag.
Array long enough to store the data of the header.
Array long enough to store the data of the cipher.
Array long enough to store the plaintext to be encrypted with AEAD.
Array long enough to store the data of the Tag.
Identification of a CSM service configuration via a numeric identifier, that is unique within a service. The name of a CSM service configuration, i.e. the name of the container Csm_Config, shall serve as a symbolic name for this parameter Avail able via Csm.h
Configuration data structure of CSM module
Array long enough to store the data to be decrypted.
Array long enough to store the data of the decrypted plaintext.
Array long enough to store the data to be encrypted.
Array long enough to store the data of the cipher.
Array long enough to store the data which shall be hashed.
Array long enough to store the data of the hash.
Array long enough to store any key element of the considered key
Implementation Data Type of category DATA_ REFERENCE with the pointer target uint32 to be able to return asynchronously the length.
Array long enough to store the data from which a MAC shall be generated.
Array long enough to store the data of the MAC.
Array long enough to store a MAC to be verified.
Array long enough to store the data for whichs MAC shall be verified.
Array long enough to store the data of the random number.
Array long enough to store the data from which the signature shall be generated.
Array long enough to store the signature and its length.
Array long enough to store a signature to be verified.
Array long enough to store the data for whichs signature shall be verified.
Implementation Data Type of category DATA_ REFERENCE with the pointer target Csm_ Verify Result Type to be able to return asynchronously the verify result.
gemini-3.8-flash-low· 2026-10-13 · German original