DEENESPTFRRUARHIKOZHNL

Crypto Interface (CryIf)

ModulCryIf (Crypto Interface)
BSW-Modul-ID112
Standard-Header#include "CryIf.h"
SWS-SpezifikationAUTOSAR_SWS_CryptoInterface.pdf
ClusterCrypto Services

Module guideAI-GENERATED

Forwards crypto jobs and key calls from CSM to the responsible Crypto Drivers via configured channels.
AI-GENERATED unreviewed Model: claude-opus-5-5 · Effort: high · Temperature: not controllable · Prompt: 6b37c73ee677 Provenance Open questions (4)
Causal anchor: R20-11 Valid from R20-11 Synthesized for this specification release.
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Forwards crypto jobs and key calls from CSM to the responsible Crypto Drivers via configured channels.

CryIf acts as an intermediary in the Classic crypto stack between CSM and Crypto Driver, forwarding jobs and key calls via configured channels to the responsible Crypto Driver Object SWS CSM p. 26. The central interface is CryIf_ProcessJob, which operates synchronously or asynchronously depending on configuration [SWS_CryIf_91003]. The driver reports asynchronous results via callback to CryIf, which passes them on to CSM. Prior to forwarding, CryIf maps its own key IDs to those of the driver and checks their range. For R20-11, note that later releases changed error codes and synchronicity rules.

CryIf acts as an intermediary in the Classic crypto stack between CSM in the Service Layer and the Crypto Driver in the MCAL. Requests from applications pass through logical channels down to the hardware engines of an HSM SWS CSM Fig. 7.4 p. 27. A channel is the path from a CSM queue via CryIf to a Crypto Driver Object; each CSM queue is assigned to exactly one channel SWS CSM p. 26. Channels are configured in container CryIfChannel with CryIfChannelId and CryIfDriverObjectRef SWS CryIf p. 51. Prior to any use, CryIf_Init initializes the module with an implementation-specific configuration [SWS_CryIf_91000].

kontext cluster_app Application Layer cluster_srv Service Layer cluster_ecu ECU Abstraction Layer cluster_mcal MCAL cluster_hw Microcontroller (HSM) app1 App1 (AES) rte RTE app1->rte app2 App2 (AES) app2->rte app3 App3 (RSA) app3->rte csm CSM Queue je Kanal rte->csm Krypto-Dienste cryif CryIf CryIfChannel csm->cryif CryIf_ProcessJob, CryIf_CancelJob, CryIf_Key… cryif->csm Csm_CallbackNotification crypto Crypto Driver Crypto Driver Objects cryif->crypto Weiterleitung je Kanal an Crypto Driver Object det DET cryif->det Det_ReportError, Det_ReportRuntimeError crypto->cryif CryIf_CallbackNotification hwaes HW-AES crypto->hwaes Kanal AES hwrsa HW-RSA crypto->hwrsa Kanal RSA

Context diagram: CryIf forwards requests from CSM channel by channel to the Crypto Driver Objects and reports results back to CSM. Sources: SWS CSM Fig. 7.4 p. 27, [SWS_CryIf_91100]

The central interface is CryIf_ProcessJob. The function is reentrant and operates synchronously or asynchronously depending on configuration [SWS_CryIf_91003]. The operating modes START, UPDATE, and FINISH can be combined, so that the same function covers single calls and streaming SWS CryIf p. 22. The driver reports asynchronous results via CryIf_CallbackNotification [SWS_CryIf_91013]. CryIf passes them on to CSM via Csm_CallbackNotification [SWS_CryIf_91100]. CryIf_CancelJob cancels running jobs at the driver [SWS_CryIf_91014].

Job processing via CryIf_ProcessJobCSMCryIfCrypto Driver ObjectDETCryIf_ProcessJob(channelId, job)Check key IDsAnd map to driver IDsoptKey ID out of rangeCRYPTO_E_PARAM_HANDLE meldenE_NOT_OKCrypto_ProcessJob(…, job)altsynchron konfiguriertBerechnungErgebnis (E_OK / CRYPTO_E_…)Pass through return valueasynchron konfiguriertReturn value of handoverPass through return valueBerechnung,E.g. from the main functionCryIf_CallbackNotification(job, result)Csm_CallbackNotification(job, result)

Sequence diagram: CryIf checks the key IDs and then forwards the job. The result is returned synchronously as a return value or asynchronously via two callback stages. Sources: [SWS_CryIf_91003], [SWS_CryIf_91013], SWS Crypto p. 27

Prior to forwarding, CryIf maps its own key IDs to the IDs of the driver. If they are out of range, it reports CRYPTO_E_PARAM_HANDLE to DET and returns E_NOT_OK [SWS_CryIf_00133] [SWS_CryIf_00134]. In addition, CryIf provides synchronous functions for setting, validating, invalidating, reading, generating, deriving, exchanging, and copying keys. If source and target reside in different drivers during partial copying, CryIf reads the element and writes it to the target itself [SWS_CryIf_00140].

Development errors such as CRYIF_E_UNINIT or CRYIF_E_PARAM_POINTER are reported to DET [SWS_CryIf_00009]. Runtime errors such as CRYPTO_E_BUSY or CRYPTO_E_KEY_NOT_VALID are returned as return values [SWS_CryIf_91020]. Later releases deviate from R20-11: They unify CRYIF_E_PARAM_HANDLE and specify CryIf_RandomSeed as well as CryIf_KeyGenerate as synchronous SWS CryIf p. 1.

Role of CryIf Between Crypto Service Manager and Crypto Driver

The Crypto Interface (CryIf) is located in the Classic crypto stack in the ECU Abstraction Layer. Applications request cryptographic services via RTE and CSM. These requests travel through logical channels through CryIf to the Crypto Driver in the MCAL and further to its hardware engines, such as HW-AES and HW-RSA in an HSM SWS CSM Fig. 7.4 p. 27. A Crypto Driver Object represents an independent crypto \"device\" in hardware or software, for example an AES accelerator or an RSA implementation in software SWS CSM p. 26. CryIf performs no computation itself. Its functions forward the respective call to the configured Crypto Driver Object, such as [SWS_CryIf_91005], [SWS_CryIf_91007], [SWS_CryIf_91009], and [SWS_CryIf_91014].

Toward higher layers, CryIf provides three groups of interfaces:

For a job in the state \"ACTIVE\", CSM calls CryIf_ProcessJob and forwards its return value unchanged SWS CSM p. 22. Toward lower layers, CryIf receives the completion notifications of the driver via CryIf_CallbackNotification [SWS_CryIf_91013] SWS Crypto p. 27. From other modules, it requires Csm_CallbackNotification and Det_ReportRuntimeError [SWS_CryIf_91100], optionally in addition Det_ReportError [SWS_CryIf_91101].

kontext cluster_app Application Layer cluster_srv Service Layer cluster_ecu ECU Abstraction Layer cluster_mcal MCAL cluster_hw Microcontroller (HSM) app1 App1 (AES) rte RTE app1->rte app2 App2 (AES) app2->rte app3 App3 (RSA) app3->rte csm CSM Queue je Kanal rte->csm Krypto-Dienste cryif CryIf CryIfChannel csm->cryif CryIf_ProcessJob, CryIf_CancelJob, CryIf_Key… cryif->csm Csm_CallbackNotification crypto Crypto Driver Crypto Driver Objects cryif->crypto Weiterleitung je Kanal an Crypto Driver Object det DET cryif->det Det_ReportError, Det_ReportRuntimeError crypto->cryif CryIf_CallbackNotification hwaes HW-AES crypto->hwaes Kanal AES hwrsa HW-RSA crypto->hwrsa Kanal RSA

Context diagram: CryIf connects the CSM queues channel by channel to the Crypto Driver Objects and reports results back to CSM. Sources: SWS CSM Fig. 7.4 p. 27, [SWS_CryIf_91100], [SWS_CryIf_91013]

Channels, Configuration, and Initialization

A channel is the path from a CSM queue via CryIf to a Crypto Driver Object. Each queue of CSM is assigned to exactly one channel; optionally, the Crypto Driver also has its own queue SWS CSM p. 26. Channels are configured in container CryIfChannel, with multiplicity 0..* and pre-compile configuration in all variants. The container contains parameters CryIfChannelId and CryIfDriverObjectRef SWS CryIf p. 51. CryIfChannelId determines which channel a CSM queue is connected to. At runtime, parameter channelId of [SWS_CryIf_91003] and [SWS_CryIf_91014] likewise designates the crypto channel. Interpretation: CryIfDriverObjectRef likely binds the channel to the Crypto Driver Object that executes the jobs of this channel. Question Q-5f8f778dc8552b7f (open)

Prior to any use, CryIf_Init must be called [SWS_CryIf_91000]. The function is synchronous and non-reentrant. It receives a pointer to the selected configuration of type CryIf_ConfigType, whose content is implementation-specific [SWS_CryIf_91118] SWS CryIf p. 20. For a failed initialization, the error list provides CRYIF_E_INIT_FAILED (0x01) [SWS_CryIf_00009]. CryIf_GetVersionInfo is reentrant and provides the version information of the module [SWS_CryIf_91001].

In addition to channels, CryIf maintains its own key identifiers (cryIfKeyId). It maps them to the key IDs of the responsible driver [SWS_CryIf_00133]. If a job uses job processing redirection, CryIf additionally adapts incoming key and key element references to those of the driver [SWS_CryIf_00136]. A key consists of one or more key elements, such as key material, initialization vector, or seed SWS CSM p. 30.

Job Processing from CryIf_ProcessJob to Feedback

Single call and streaming run via the same function CryIf_ProcessJob. The field job->jobPrimitiveInputOutput.mode contains the operation modes "START", "UPDATE", and "FINISH", which can be combined. A complete service in a single call corresponds to the combination of all three modes SWS CryIf p. 22. The function is reentrant and operates synchronously or asynchronously depending on the configuration [SWS_CryIf_91003]. The state transitions of a job are performed by the Crypto Driver, not the CSM SWS CSM p. 22.

In the asynchronous case, the driver only passes the necessary information to the primitive. The computation can then be triggered from the main function. After completion, the driver reports the job and result to the CryIf via CryIf_CallbackNotification SWS Crypto p. 27. This function is synchronous and non-reentrant; the passed job contains a callback ID that identifies it [SWS_CryIf_91013]. The CryIf then reports the completion via Csm_CallbackNotification to the CSM; this function is explicitly intended for the underlying CRYIF layer [SWS_CryIf_91100]. If the FINISH bit is set, the CSM invokes the configured callback SWS CSM p. 82.

Job processing via CryIf_ProcessJobCSMCryIfCrypto Driver ObjectDETCryIf_ProcessJob(channelId, job)Check key IDsAnd map to driver IDsoptKey ID out of rangeCRYPTO_E_PARAM_HANDLE meldenE_NOT_OKCrypto_ProcessJob(…, job)altsynchron konfiguriertBerechnungErgebnis (E_OK / CRYPTO_E_…)Pass through return valueasynchron konfiguriertReturn value of handoverPass through return valueBerechnung,E.g. from the main functionCryIf_CallbackNotification(job, result)Csm_CallbackNotification(job, result)

Sequence diagram: The CryIf first checks the key IDs and then forwards the job. The result is returned either synchronously as a return value or asynchronously via two callback stages. Sources: [SWS_CryIf_91003], [SWS_CryIf_00134], [SWS_CryIf_91013], [SWS_CryIf_91100], SWS Crypto p. 27

Running asynchronous jobs and streaming jobs can be canceled. For this purpose, the CSM removes the job from its own queue or calls CryIf_CancelJob SWS CSM p. 80. CryIf_CancelJob is synchronous and reentrant and forwards the cancellation to the configured Crypto Driver Object. E_OK means that the job was removed; E_NOT_OK means that this was not possible [SWS_CryIf_91014] SWS CryIf p. 24. The documentation passages of later releases (R24-11/R25-11) additionally mention CRYPTO_E_JOB_CANCELED. In this case, the cancellation only takes place at the next suitable processing step and is reported via a negative completion callback SWS CSM p. 80.

Cancellation of a jobApplicationCSMCryIfCrypto Driver ObjectCsm_CancelJob(job, mode)altJob still in CSM queueRemove job from own queueJob already at driverCryIf_CancelJob(channelId, job)Abbruch weiterleiten(Crypto_CancelJob)E_OK / E_NOT_OK(Later also CRYPTO_E_JOB_CANCELED)Return valueE_OK: CSM calls the completion callback of the jobCRYPTO_E_JOB_CANCELED: cancellation at the nextgeeigneten Schritt, negativer Abschluss-CallbackReturn value

Sequence diagram: A cancellation either ends already in the CSM queue or is forwarded via the CryIf to the Crypto Driver Object. Sources: [SWS_CryIf_91014], SWS CSM p. 80, SWS CryIf p. 45

Mapping and checking key IDs in the job

Some jobs carry a key management service: CRYPTO_KEYSETVALID, CRYPTO_KEYSETINVALID, CRYPTO_RANDOMSEED, CRYPTO_KEYGENERATE, CRYPTO_KEYDERIVE, CRYPTO_KEYEXCHANGECALCPUBVAL, or CRYPTO_KEYEXCHANGECALCSECRET. For them, the CryIf checks whether job->jobPrimitiveInputOutput->cryIfKeyId and, if applicable, targetCryIfKeyId lie within the valid range. If this is the case, it sets job->cryptoKeyId and job->targetCryptoKeyId, respectively, to the key IDs of the driver [SWS_CryIf_00133] [SWS_CryIf_00141]. If the source ID lies outside the range, CryIf_ProcessJob reports CRYPTO_E_PARAM_HANDLE to the DET and returns E_NOT_OK [SWS_CryIf_00134]. For CRYPTO_KEYDERIVE, the same also applies to the target ID [SWS_CryIf_00135].

Primitives with key reference are checked as well. For CRYPTO_MACGENERATE, CRYPTO_MACVERIFY, CRYPTO_ENCRYPT, CRYPTO_DECRYPT, CRYPTO_AEADENCRYPT, CRYPTO_AEADDECRYPT, CRYPTO_RANDOMGENERATE, CRYPTO_SIGNATUREGENERATE, and CRYPTO_SIGNATUREVERIFY, job->jobPrimitiveInfo->cryIfKeyId is checked for the valid range [SWS_CryIf_00143].

keyid start CryIf_ProcessJob(channelId, job) d1 Key management service? KEYSETVALID, KEYSETINVALID, RANDOMSEED, KEYGENERATE, KEYDERIVE, KEYEXCHANGECALCPUBVAL, KEYEXCHANGECALCSECRET start->d1 c1 jobPrimitiveInputOutput->cryIfKeyId within valid range? d1->c1 yes d3 Primitive with key? MACGENERATE/-VERIFY, (AEAD)ENCRYPT/DECRYPT, RANDOMGENERATE, SIGNATUREGENERATE/-VERIFY d1->d3 no d2 Dienst = CRYPTO_KEYDERIVE? c1->d2 yes err CRYPTO_E_PARAM_HANDLE to DET return E_NOT_OK c1->err no c2 targetCryIfKeyId within valid range? d2->c2 yes map Set job->cryptoKeyId (if applicable job->targetCryptoKeyId) to driver key IDs d2->map no c2->map yes c2->err no fwd Forward to Crypto Driver Object of channel map->fwd c3 jobPrimitiveInfo->cryIfKeyId within valid range? d3->c3 yes d3->fwd no c3->err no c3->fwd yes

Activity diagram: The CryIf checks the key IDs depending on the service type and maps them to driver IDs before forwarding the job. Sources: [SWS_CryIf_00133], [SWS_CryIf_00134], [SWS_CryIf_00135], [SWS_CryIf_00143]

This area has changed between releases. R20-11 mentions CRYPTO_E_PARAM_HANDLE in the checks, whereas the module's error list defines CRYIF_E_PARAM_HANDLE (0x03) [SWS_CryIf_00009]. According to the change history, this was only unified to CRYIF_E_PARAM_HANDLE in R22-11 SWS CryIf p. 1. With the same change, the return values after DET reports were omitted. In addition, the service CRYPTO_CUSTOM was added, which is already included in the list in the later documentation passage SWS CryIf p. 23. For R20-11, the requirements apply in the form cited here.

Key management: material, status, generation, and exchange

The direct key APIs are synchronous. Non-reentrant are CryIf_KeyElementSet [SWS_CryIf_91004], CryIf_KeySetValid [SWS_CryIf_91005], CryIf_KeySetInvalid [SWS_CryIf_91021], and CryIf_KeyGetStatus [SWS_CryIf_91012]. According to the change history, the functionality for the key status was added with R20-11 SWS CryIf p. 1. If setting an element fails, its status is considered unknown according to the CSM specification SWS CSM p. 62. It can be checked with Csm_KeyGetStatus, which in turn calls CryIf_KeyGetStatus SWS CSM p. 63.

CryIf_KeyElementGet is reentrant [SWS_CryIf_91006]. The parameter resultLengthPtr serves as input and output. Upon invocation, it contains the buffer size; for elements with partial access, it contains instead the amount to be read. After completion, it contains the data amount actually stored SWS CryIf p. 30.

schluesselstatus start Start gesetzt Elements set (not yet set to valid, interpretation) start->gesetzt CryIf_KeyElementSet valid Valid gesetzt->valid CryIf_KeySetValid valid->valid Nutzung in Jobs, CryIf_KeyGetStatus invalid Invalid valid->invalid CryIf_KeySetInvalid invalid->valid CryIf_KeySetValid invalid->invalid Nutzung scheitert: CRYPTO_E_KEY_NOT_VALID

State diagram: A key is declared valid after its elements are set and can be set to invalid again. With an invalid key, operations fail with CRYPTO_E_KEY_NOT_VALID. The initial state before CryIf_KeySetValid is an interpretation. Sources: [SWS_CryIf_91004], [SWS_CryIf_91005], [SWS_CryIf_91021], [SWS_CryIf_91012], SWS CSM p. 70

For key generation, CryIf_RandomSeed [SWS_CryIf_91007] provides the seed values, and CryIf_KeyGenerate [SWS_CryIf_91008] generates the key. According to the CSM specification, the key is generated in element CRYPTO_KE_KEYGENERATE_KEY. The basis is the seed in CRYPTO_KE_KEYGENERATE_SEED and the algorithm in CRYPTO_KE_KEYGENERATE_ALGORITHM SWS CSM p. 67. In R20-11, both functions operate synchronously or asynchronously depending on the configuration [SWS_CryIf_91007] [SWS_CryIf_91008]. Only R21-11 specifies them as synchronous SWS CryIf p. 1. CryIf_KeyDerive is synchronous and reentrant and derives from a source key a key that is stored in the target key [SWS_CryIf_91009] SWS CryIf p. 42.

There are two functions for the Diffie-Hellman key exchange. CryIf_KeyExchangeCalcPubVal [SWS_CryIf_91010] calculates its own public value. CryIf_KeyExchangeCalcSecret [SWS_CryIf_91011] calculates the shared secret from the partner's value. The key material resides in elements CRYPTO_KE_KEYEXCHANGE_BASE, CRYPTO_KE_KEYEXCHANGE_PRIVKEY, and CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY SWS CSM p. 70. The driver stores the secret as an element in the same key SWS Crypto p. 84. Interpretation: In the direct key APIs as well, the CryIf likely maps cryIfKeyId to the key ID of the driver, as in the job path [SWS_CryIf_00133]. Question Q-f146ad33e972fa97 (open)

Key exchange via CryIfAnwendung / CSMCryIfCrypto Driver ObjectKommunikationspartnerUse Case: Calculate own public valueCryIf_KeyExchangeCalcPubVal(cryIfKeyId,publicValuePtr, publicValueLengthPtr)an konfiguriertes Crypto Driver Object weiterleitenPublic value, return valuePublic value, return valueUse Case: Exchange outside CryIfSend own public valueSend partner's public valueUse Case: Gemeinsames Geheimnis berechnenCryIf_KeyExchangeCalcSecret(cryIfKeyId,partnerPublicValuePtr, partnerPublicValueLength)Crypto_KeyExchangeCalcSecret(…)Store secret as key elementIn the same keyReturn valueReturn value

Sequence diagram: Key exchange runs in two CryIf calls. In between, the application exchanges the public values with the partner outside the CryIf. Sources: [SWS_CryIf_91010], [SWS_CryIf_91011], SWS CSM p. 70, SWS Crypto p. 84

Copying keys within and between Crypto Drivers

For copies, there are CryIf_KeyElementCopy [SWS_CryIf_91015], CryIf_KeyCopy [SWS_CryIf_91016], and CryIf_KeyElementCopyPartial [SWS_CryIf_91018]. All three are synchronous and reentrant, but not for the same cryIfKeyId. In addition to E_OK and E_NOT_OK, they can return, among others, CRYPTO_E_KEY_READ_FAIL, CRYPTO_E_KEY_WRITE_FAIL, CRYPTO_E_KEY_SIZE_MISMATCH, and CRYPTO_E_KEY_EMPTY SWS CryIf p. 35.

For partial copying, the specification distinguishes between two cases:

  • Source and target keys reside in the same Crypto Driver: The CryIf calls Crypto_<vi>_<ai>_KeyElementCopyPartial() of the assigned driver and forwards its return value [SWS_CryIf_00139].
  • The keys reside in different drivers: The CryIf reads the element with Crypto_<vi>_<ai>_KeyElementGet(), copies the partial data to its destination, and writes the target element with Crypto_<vi>_<ai>_KeyElementSet() [SWS_CryIf_00140].

The copy functions of the drivers are optional interfaces. If an element resides directly in flash, a call may take significantly longer SWS CryIf p. 45.

copypartial start CryIf_KeyElementCopyPartial(…) fehler Fehler durch CryIf erkannt? start->fehler abbruch No forwarding (see behavior in case of error) fehler->abbruch yes gleich cryIfKeyId and targetCryIfKeyId in the same Crypto Driver? fehler->gleich no ende Ende abbruch->ende partial Call Crypto_<vi>_<ai>_KeyElementCopyPartial(), pass through return value gleich->partial yes lesen Read source element with Crypto_<vi>_<ai>_KeyElementGet() gleich->lesen no partial->ende kopieren Teildaten an Zielposition kopieren lesen->kopieren schreiben Write target element with Crypto_<vi>_<ai>_KeyElementSet() kopieren->schreiben schreiben->ende

Activity diagram: Whether the CryIf delegates directly to the driver or copies itself via read and write depends on whether the keys reside in the same driver. Sources: [SWS_CryIf_00139], [SWS_CryIf_00140]

Behavior in the event of an error

The CryIf reports development errors to the DET. The module's error list comprises [SWS_CryIf_00009]:

Error codeValueReason
CRYIF_E_UNINIT0x00API call prior to initialization
CRYIF_E_INIT_FAILED0x01initialization failed
CRYIF_E_PARAM_POINTER0x02null pointer as parameter
CRYIF_E_PARAM_HANDLE0x03parameter out of range
CRYIF_E_PARAM_VALUE0x04invalid parameter value
CRYIF_E_KEY_SIZE_MISMATCH0x05size of source and target element does not match

Reporting CRYIF_E_UNINIT prior to initialization is documented for several functions: CryIf_KeyDerive SWS CryIf p. 42, CryIf_RandomSeed SWS CryIf p. 37, CryIf_CancelJob SWS CryIf p. 24, CryIf_KeyGetStatus SWS CryIf p. 29, and CryIf_CallbackNotification SWS CryIf p. 44. The same presumably applies to the remaining services. Question (open) Further checks are also documented. CryIf_CancelJob reports CRYIF_E_PARAM_HANDLE in case of an inadmissible channelId, CryIf_KeyGetStatus in case of an inadmissible cryIfKeyId. CryIf_CallbackNotification checks its pointer and reports CRYIF_E_PARAM_POINTER if applicable SWS CryIf p. 44.

Runtime errors arrive as return values from the driver. The CryIf forwards them, as specified, for instance, by [SWS_CryIf_00139] for partial copying. The CSM in turn forwards the return value of CryIf_ProcessJob SWS CSM p. 22. The value range comprises, among others, [SWS_CryIf_91020]:

  • CRYPTO_E_BUSY (0x02): service still busy
  • CRYPTO_E_ENTROPY_EXHAUSTED (0x04)
  • CRYPTO_E_KEY_READ_FAIL (0x06)
  • CRYPTO_E_KEY_WRITE_FAIL (0x07)
  • CRYPTO_E_KEY_NOT_AVAILABLE (0x08)
  • CRYPTO_E_KEY_NOT_VALID (0x09)

If a CSM queue is full, the CSM already rejects the request with CRYPTO_E_BUSY SWS CSM p. 22.

Regarding the return values, a look at the release history is worthwhile. CRYPTO_E_QUEUE_FULL was only removed from [SWS_CryIf_91003] with R23-11. CRYPTO_E_KEY_EMPTY was only added for CryIf_RandomSeed in R24-11 SWS CryIf p. 1. For R20-11, the API requirements of that release are therefore decisive, not the later-dated documentation passages.

Further detailed evidence

AI-generated guide based on the requirements from R20-11 and the associated documentation passages, which partly originate from later releases. The AUTOSAR specification is authoritative.

Crypto Interface (CryIf)

Abstracts cryptographic hardware and software acceleration engines.

Funktionen — Übersicht

Typen — Übersicht

Funktionen & Typen — Detailansicht

function CryIf_Init [SWS_CryIf_91000] 📄 PDF

void CryIf_Init (const CryIf_ConfigType* configPtr);

Initializes the CRYIF module. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoInterface

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 2b39ab06c8cb Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The synchronous function CryIf_Init serves for the complete initialization of the Crypto Interface (CryIf) module according to AUTOSAR Classic Platform [SWS_CryIf_91000]. The function is declared in the header file CryIf.h and has the service ID 0x00 [SWS_CryIf_91000]. As the only input parameter, the interface expects configPtr, a pointer to a selected configuration structure of type CryIf_ConfigType [SWS_CryIf_91000]. The function returns no return value (void) and has neither inout nor out parameters [SWS_CryIf_91000].

Semantics and concurrency

The call to CryIf_Init is executed synchronously [SWS_CryIf_91000]. The module thus completes all required initialization work before execution is returned to the caller. Regarding concurrency, the function is classified as non-reentrant (Non Reentrant) [SWS_CryIf_91000]. Therefore, the routine must not be called in parallel or nested at any time.

Restrictions and Integration

Interpretation: The call to CryIf_Init is likely typically performed centrally during system startup within the initialization phase of the basic software before downstream crypto interface services may be called. Question Q-31b82ca9b144c843 (open) Since the payload does not mention any specific error handling, DET messages, or DEM events, the caller must ensure a valid pointer to the configuration in advance. Related requirements are not defined in the payload.

This usage note was generated automatically and is based exclusively on the specification data for SWS_CryIf_91000.

Implementer's Guide to follow (complexity I1)

function CryIf_ProcessJob [SWS_CryIf_91003] 📄 PDF

Std_ReturnType CryIf_ProcessJob (uint32 channelId, Crypto_JobType* job);

Service CryIf_ProcessJob.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 7b2b73dd3704 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Function CryIf_ProcessJob (service ID 0x03), provided via header CryIf.h, forwards cryptographic processing jobs to the respectively configured crypto driver object [SWS_CryIf_91003]. As parameters, it takes the identifier of the crypto channel (channelId) and a pointer to the job configuration (job) [SWS_CryIf_91003]. Structure job contains all information relevant to the user as well as to the specific crypto primitive [SWS_CryIf_91003]. Depending on the configuration, job processing is performed synchronously or asynchronously; in addition, the interface is implemented as reentrant [SWS_CryIf_91003].

Upon error-free acceptance, the function returns E_OK [SWS_CryIf_91003]. If the request fails, the return value signals either E_NOT_OK or a specific error state of the driver: CRYPTO_E_BUSY (driver object busy), CRYPTO_E_QUEUE_FULL (queue full), errors regarding key states such as CRYPTO_E_KEY_NOT_VALID, CRYPTO_E_KEY_SIZE_MISMATCH, CRYPTO_E_KEY_NOT_AVAILABLE, CRYPTO_E_KEY_EMPTY, CRYPTO_E_KEY_READ_FAIL, or CRYPTO_E_KEY_WRITE_FAIL, as well as CRYPTO_E_JOB_CANCELED upon cancellation of a synchronous job and CRYPTO_E_ENTROPY_EXHAUSTED [SWS_CryIf_91003].

In addition, the interface performs pre-checks of the key identifiers:

  • If job->jobPrimitiveInfo->primitiveInfo->service is set to CRYPTO_KEYSETVALID, CRYPTO_KEYSETINVALID, CRYPTO_RANDOMSEED, CRYPTO_KEYGENERATE, CRYPTO_KEYDERIVE, CRYPTO_KEYEXCHANGECALCPUBVAL, or CRYPTO_KEYEXCHANGECALCSECRET, job->cryIfKeyId must be within the valid range of values [SWS_CryIf_00134]. Otherwise, the function reports the error CRYPTO_E_PARAM_HANDLE to the DET and aborts with E_NOT_OK [SWS_CryIf_00134].
  • If service CRYPTO_KEYDERIVE is requested, the target key identifier job->cryIfTargetKeyId must additionally be within the valid range; otherwise, CRYPTO_E_PARAM_HANDLE is likewise reported to the DET and E_NOT_OK is returned [SWS_CryIf_00135].

This text was created by an AI and is based on the AUTOSAR CP R20-11 specification.

function CryIf_CancelJob [SWS_CryIf_91014] 📄 PDF

Std_ReturnType CryIf_CancelJob (uint32 channelId, Crypto_JobType* job);

This interface dispatches the job cancellation function to the configured crypto driver object.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: feb9ccdcc6c2 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Function CryIf_CancelJob serves to forward a cancellation request for a crypto job to the configured crypto driver object [SWS_CryIf_91014]. It provides the standardized interface of the crypto interface, is declared via header CryIf.h, and has service ID 0x0e [SWS_CryIf_91014].

To make the call, the identifier of the target channel and the configuration of the job must be passed [SWS_CryIf_91014]:

  • channelId (input, uint32): Holds the identifier of the respective crypto channel [SWS_CryIf_91014].
  • job (in/out, Crypto_JobType*): Pointer to the job configuration, which comprises structures with user- and primitive-relevant information [SWS_CryIf_91014].

Execution is synchronous and returns a status of type Std_ReturnType to the caller [SWS_CryIf_91014]:

  • E_OK: The request was successful and the job was removed from the driver [SWS_CryIf_91014].
  • E_NOT_OK: The request failed because the job could not be removed [SWS_CryIf_91014].
  • CRYPTO_E_JOB_CANCELED: Specified crypto return value confirming job cancellation [SWS_CryIf_91014].

Regarding concurrency behavior, CryIf_CancelJob is specified as reentrant [SWS_CryIf_91014]. This permits parallel calls for job cancellation, with processing being delegated to the underlying driver object in a blocking manner [SWS_CryIf_91014].

This text was generated by an AI based on the AUTOSAR specification R20-11.

function CryIf_KeyElementSet [SWS_CryIf_91004] 📄 PDF

Std_ReturnType CryIf_KeyElementSet (uint32 cryIfKeyId, uint32 keyElementId, const uint8* keyPtr, uint32 keyLength);

This function shall dispatch the set key element function to the configured crypto driver object.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: b1d8a6a46a48 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function CryIf_KeyElementSet (service ID 0x04) forwards the request to set a key element to the configured Crypto Driver Object [SWS_CryIf_91004]. The function declaration is provided via the header file CryIf.h [SWS_CryIf_91004].

The call is made via four input parameters [SWS_CryIf_91004]:

  • cryIfKeyId: Denotes the identifier of the key whose key element is to be updated.
  • keyElementId: Denotes the identifier of the specific key element to be set.
  • keyPtr: Pointer to the buffer containing the key data to be applied as the element.
  • keyLength: Specifies the length of the key element to be set in bytes.

The function is specified as non-reentrant (Non Reentrant) [SWS_CryIf_91004]. Therefore, callers must ensure that calls do not occur uncoordinatedly in parallel.

The return value of type Std_ReturnType signals the result of the forwarding or execution [SWS_CryIf_91004]:

  • E_OK: The request was successful.
  • E_NOT_OK: The request has failed.
  • CRYPTO_E_BUSY: The associated Crypto Driver Object is currently busy.
  • CRYPTO_E_KEY_WRITE_FAIL: Write access to the key element was denied.
  • CRYPTO_E_KEY_NOT_AVAILABLE: The requested key is not available.
  • CRYPTO_E_KEY_SIZE_MISMATCH: The size of the key element does not match the length of the provided data.

This usage note was generated by an AI based on the AUTOSAR R20-11 specification.

Implementer's Guide to follow (complexity I1)

function CryIf_KeySetValid [SWS_CryIf_91005] 📄 PDF

Std_ReturnType CryIf_KeySetValid (uint32 cryIfKeyId);

This function shall dispatch the set key valid function to the configured crypto driver object.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: f4147bfa82e2 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The synchronous interface CryIf_KeySetValid (service ID 0x05) is provided via the header file CryIf.h and forwards the request to set a key valid to the respectively configured Crypto Driver Object [SWS_CryIf_91005]. As the only parameter, the identifier cryIfKeyId is passed, which determines the target key whose key elements are to be marked as valid [SWS_CryIf_91005]. Additional input/output or output parameters do not exist for this function [SWS_CryIf_91005].

Return Values and Error Handling

The return value of type Std_ReturnType informs the caller about the result of the forwarding and processing in the driver [SWS_CryIf_91005]:

  • E_OK: The operation was successfully forwarded to the Crypto Driver Object and completed successfully [SWS_CryIf_91005].
  • E_NOT_OK: The forwarding or the execution of the request failed [SWS_CryIf_91005].
  • CRYPTO_E_BUSY: The request could not be executed because the responsible Crypto Driver Object is currently busy [SWS_CryIf_91005].

Concurrency and Limitations

The function is explicitly designated as non-reentrant (Non Reentrant) in the specification [SWS_CryIf_91005]. Calling instances must therefore ensure that calls to CryIf_KeySetValid are never executed concurrently or interrupting, in order to reliably prevent conflicts during forwarding to the driver object.

This usage note was generated automatically based on the specification.

function CryIf_KeySetInvalid [SWS_CryIf_91021] 📄 PDF

Std_ReturnType CryIf_KeySetInvalid (uint32 cryIfKeyId);

Sets invalid for the status of the key identifi ed by cry If Key Id.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: de4f767c5cce Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous interface CryIf_KeySetInvalid (service ID 0x14) sets the state of the key identified via the parameter cryIfKeyId to invalid [SWS_CryIf_91021]. The declaration of the function is provided via the header file CryIf.h [SWS_CryIf_91021].

The following parameters and return values apply to the use of the function [SWS_CryIf_91021]:

  • Passing parameters: The identifier of the key whose validity is to be revoked is passed via the input parameter cryIfKeyId of type uint32. Input/output parameters do not exist.
  • Return value (Std_ReturnType):
    • E_OK: The request to change the status was successful.
    • E_NOT_OK: The request has failed.
    • CRYPTO_E_BUSY: Execution failed because the responsible Crypto Driver Object is busy.

Regarding concurrency and execution context, CryIf_KeySetInvalid is specified as non-reentrant (Non Reentrant) [SWS_CryIf_91021]. Calling instances must therefore ensure that calls proceed sequentially and do not mutually overlap. If the return value CRYPTO_E_BUSY occurs, the Crypto Driver Object is temporarily blocked [SWS_CryIf_91021]; in this case, the caller is likely responsible for retrying the status invalidation later. Question Q-4377065d4d4eecab (open)

This text was created by an AI and is based exclusively on the specification data of AUTOSAR R20-11.

Implementer's Guide to follow (complexity I1)

function CryIf_KeyGetStatus [SWS_CryIf_91012] 📄 PDF

Std_ReturnType CryIf_KeyGetStatus (uint32 cryIfKeyId, Crypto_KeyStatusType* keyStatusPtr);

Returns the key state of the key identified by cry If Key Id.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 5bef488620f3 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Usage and Call Context

Function CryIf_KeyGetStatus serves to synchronously query the status of a cryptographic key within the crypto interface [SWS_CryIf_91012]. It is available via header CryIf.h with service ID 0x13 [SWS_CryIf_91012]. When called, the following parameters are passed:

  • cryIfKeyId (input): Unique identifier of the key whose status is to be determined [SWS_CryIf_91012].
  • keyStatusPtr (output): Pointer to a variable of type Crypto_KeyStatusType into which the key status is written [SWS_CryIf_91012].

Error Handling and Return Values

The return value of type Std_ReturnType signals the result of the execution [SWS_CryIf_91012]:

Specific error codes, DET reports, or DEM events are not designated in the element specification; caller-side error handling relies primarily on evaluating the return value.

Concurrency and Limitations

The function is specified as non-reentrant (Non Reentrant) [SWS_CryIf_91012]. Callers must therefore ensure that no concurrent or interrupting calls occur for the same or different key instances. In addition, the caller presumably has to provide a valid memory area for output pointer keyStatusPtr, as it is written directly by the function. Question Q-da3a034d4f2e9442 (open)

This text was generated by an AI based on the AUTOSAR specification R20-11.

Implementer's Guide to follow (complexity I1)

function CryIf_KeyElementGet [SWS_CryIf_91006] 📄 PDF

Std_ReturnType CryIf_KeyElementGet (uint32 cryIfKeyId, uint32 keyElementId, uint8* resultPtr, uint32* resultLengthPtr);

This function shall dispatch the get key ele ment function to the configured crypto driver object.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: ab8ed66ea380 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function CryIf_KeyElementGet forwards the query of a key element to the configured Crypto Driver Object [SWS_CryIf_91006]. It is declared via the header file CryIf.h and specified as reentrant [SWS_CryIf_91006].

Usage and Parameters

Upon invocation, cryIfKeyId identifies the affected key and keyElementId the key element to be retrieved [SWS_CryIf_91006]. The payload data is stored in the buffer resultPtr [SWS_CryIf_91006]. The pointer resultLengthPtr serves as a combined input and output parameter for length control [SWS_CryIf_91006]:

  • Prior to execution, the caller passes the available buffer size of resultPtr therein [SWS_CryIf_91006].
  • If the key element allows partial access, the value defines instead the amount of data to be retrieved, which does not have to correspond to the buffer size [SWS_CryIf_91006].
  • After completion of the operation, the function stores the amount of data actually written at this memory location [SWS_CryIf_91006].

Error Handling and Return Values

The return value of type Std_ReturnType signals the success or error status [SWS_CryIf_91006]:

This usage note was generated automatically based on the specification of AUTOSAR R20-11.

Implementer's Guide to follow (complexity I1)

function CryIf_KeyElementCopy [SWS_CryIf_91015] 📄 PDF

Std_ReturnType CryIf_KeyElementCopy (uint32 cryIfKeyId, uint32 keyElementId, uint32 targetCryIfKeyId, uint32 targetKeyElementId);

Service CryIf_KeyElementCopy.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 98ca892724e4 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function CryIf_KeyElementCopy serves to copy a key element from a source key to a target key according to [SWS_CryIf_91015]. The service is available via header file CryIf.h.

For the call, the source key (cryIfKeyId), the source element to be copied (keyElementId), the target key (targetCryIfKeyId), and the target element (targetKeyElementId) are passed via the input parameters [SWS_CryIf_91015]. The function is designed to be reentrant, but explicitly not for the same cryIfKeyId [SWS_CryIf_91015]. As an interpretation, it would seem reasonable that concurrent write accesses to the same target key (targetCryIfKeyId) should also be synchronized by the caller to avoid data conflicts. Question Q-cba3554c537dd498 (open)

The return value of type Std_ReturnType signals the result of the operation [SWS_CryIf_91015]:

  • E_OK: The copy operation was successful.
  • E_NOT_OK: The request has failed.
  • CRYPTO_E_BUSY: The associated crypto driver object is busy.
  • CRYPTO_E_KEY_NOT_AVAILABLE: The requested key element is not available.
  • CRYPTO_E_KEY_READ_FAIL: Reading the source key element is not allowed.
  • CRYPTO_E_KEY_WRITE_FAIL: Writing the target key element is not allowed.
  • CRYPTO_E_KEY_SIZE_MISMATCH: The sizes of the involved key elements are not compatible.
  • CRYPTO_E_KEY_EMPTY: The source key element is uninitialized.

This usage note was generated automatically based on AUTOSAR R20-11.

Implementer's Guide to follow (complexity I1)

function CryIf_KeyElementCopyPartial [SWS_CryIf_91018] 📄 PDF

Std_ReturnType CryIf_KeyElementCopyPartial (uint32 cryIfKeyId, uint32 keyElementId, uint32 keyElementSourceOffset, uint32 keyElementTargetOffset, uint32 keyElementCopyLength, uint32 targetCryIfKeyId, uint32 targetKeyElementId);

Service CryIf_KeyElementCopyPartial.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 1703918a24fa Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function CryIf_KeyElementCopyPartial, provided via the header CryIf.h, copies subparts of a key element into another key element [SWS_CryIf_91018]. The source and target keys as well as the respective elements are specified via the parameters cryIfKeyId, keyElementId, targetCryIfKeyId, and targetKeyElementId [SWS_CryIf_91018]. The start positions within the two elements are determined by keyElementSourceOffset and keyElementTargetOffset, while keyElementCopyLength specifies the exact number of bytes to be transferred [SWS_CryIf_91018].

Regarding concurrency, the routine is designed to be reentrant, but explicitly not for the same source key (cryIfKeyId) [SWS_CryIf_91018]. Parallel calls with an identical source key ID must therefore be synchronized or avoided by the caller.

The return value reports the detailed execution status of the synchronous request [SWS_CryIf_91018]:

  • E_OK: The copy operation was performed successfully.
  • E_NOT_OK: The request has failed.
  • CRYPTO_E_BUSY: The responsible Crypto Driver Object is busy.
  • CRYPTO_E_KEY_NOT_AVAILABLE: The requested source or target key element is not available.
  • CRYPTO_E_KEY_READ_FAIL: Reading the source key element is not allowed.
  • CRYPTO_E_KEY_WRITE_FAIL: Writing to the target key element is not permitted.
  • CRYPTO_E_KEY_SIZE_MISMATCH: The element sizes or offset and length specifications are incompatible.
  • CRYPTO_E_KEY_EMPTY: The source key element is uninitialized.

This usage note was generated automatically based on the specification of AUTOSAR R20-11.

Implementer's Guide to follow (complexity I1)

function CryIf_KeyCopy [SWS_CryIf_91016] 📄 PDF

Std_ReturnType CryIf_KeyCopy (uint32 cryIfKeyId, uint32 targetCryIfKeyId);

This function shall co py all key elements from the source key to a target key.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: e2c4b04b20c3 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The synchronous function CryIf_KeyCopy copies all key elements from a source key to a specified target key ([SWS_CryIf_91016]). It is provided via the header file CryIf.h and has the service ID 0x10 ([SWS_CryIf_91016]).

The function expects two input parameters ([SWS_CryIf_91016]):

  • cryIfKeyId: Identifier of the key whose key elements serve as the source.
  • targetCryIfKeyId: Identifier of the key that receives the key elements as the target.

Concurrency and Limitations

The interface is specified as reentrant, but must not be called simultaneously for the same source key identifier (cryIfKeyId) ([SWS_CryIf_91016]).

Error handling

The return value of type Std_ReturnType signals the result of the operation ([SWS_CryIf_91016]):

  • E_OK: Copy operation completed successfully.
  • E_NOT_OK: Request failed.
  • CRYPTO_E_BUSY: Failed because the underlying Crypto Driver Object is busy.
  • CRYPTO_E_KEY_NOT_AVAILABLE: The requested key element is not available.
  • CRYPTO_E_KEY_READ_FAIL: Reading out the key element is not permitted.
  • CRYPTO_E_KEY_WRITE_FAIL: Writing the target key element is not allowed.
  • CRYPTO_E_KEY_SIZE_MISMATCH: The sizes of the key elements are not compatible with each other.
  • CRYPTO_E_KEY_EMPTY: The source key element is uninitialized.

This usage note was generated automatically based on the specification.

function CryIf_RandomSeed [SWS_CryIf_91007] 📄 PDF

Std_ReturnType CryIf_RandomSeed (uint32 cryIfKeyId, const uint8* seedPtr, uint32 seedLength);

This function shall dispatch the random seed function to the configured crypto driver object.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: cb0539e3124c Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The function CryIf_RandomSeed serves to forward the generation or feeding of a random seed to the configured crypto driver object [SWS_CryIf_91007]. It is available via the header file CryIf.h and has the service ID 0x07 [SWS_CryIf_91007].

The interface expects three input parameters [SWS_CryIf_91007]:

  • cryIfKeyId: Identifier of the key for which a new seed is to be generated.
  • seedPtr: Pointer to the memory area containing the data for seeding.
  • seedLength: Length of the seed in bytes.

The execution behavior (synchronous or asynchronous) is not fixed, but depends on the respective configuration [SWS_CryIf_91007]. With respect to concurrency, the function is specified as reentrant [SWS_CryIf_91007].

As a return value, the function returns a Std_ReturnType with the following status values [SWS_CryIf_91007]:

  • E_OK: The request was successful.
  • E_NOT_OK: The request has failed.
  • CRYPTO_E_KEY_NOT_VALID: The request failed because the key state of the key is \"invalid\".

Interpretation: Upon returning CRYPTO_E_KEY_NOT_VALID, the check is likely to refer to the passed key cryIfKeyId, even though the specification text speaks of cryptoKeyId instead [SWS_CryIf_91007]. Question Q-22b20256f21f131b (open)

This text was generated by an AI and is based on the AUTOSAR CP R20-11 specification.

function CryIf_KeyGenerate [SWS_CryIf_91008] 📄 PDF

Std_ReturnType CryIf_KeyGenerate (uint32 cryIfKeyId);

This function shall dispatch the key generate function to the configured crypto driver object.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: d582a843edfa Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The function CryIf_KeyGenerate forwards the function call for key generation to the configured Crypto Driver Object [SWS_CryIf_91008]. Via the input parameter cryIfKeyId, the unique identifier of the key is passed, which is to be updated with the newly generated key value [SWS_CryIf_91008]. The declaration of this interface is provided via the header CryIf.h [SWS_CryIf_91008].

Synchronization Behavior and Concurrency

Execution is performed either synchronously or asynchronously depending on the underlying configuration [SWS_CryIf_91008]. Regarding call context and concurrency, the function is specified as reentrant [SWS_CryIf_91008].

Return Values and Error Handling

The call returns a status value of type Std_ReturnType [SWS_CryIf_91008]:

  • E_OK: The request for key generation was executed successfully [SWS_CryIf_91008].
  • E_NOT_OK: The request failed [SWS_CryIf_91008].
  • CRYPTO_E_BUSY: The request failed because the addressed Crypto Driver Object is currently busy [SWS_CryIf_91008].
  • CRYPTO_E_KEY_EMPTY: The request failed because a required source key element is uninitialized [SWS_CryIf_91008].
  • CRYPTO_E_KEY_NOT_VALID: The request failed because the state of the key referenced by the key identifier is invalid [SWS_CryIf_91008].

This usage note was generated automatically based on the specification of AUTOSAR Release R20-11.

function CryIf_KeyDerive [SWS_CryIf_91009] 📄 PDF

Std_ReturnType CryIf_KeyDerive (uint32 cryIfKeyId, uint32 targetCryIfKeyId);

This function shall dispatch th e key derive function to the configured crypto driver object.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: e0c725352dab Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

Function CryIf_KeyDerive serves to synchronously forward a request for key derivation to the respectively configured crypto driver object [SWS_CryIf_91009]. The interface is declared via the header file CryIf.h with service ID 0x09 [SWS_CryIf_91009].

When called, two key identifiers are passed [SWS_CryIf_91009]:

  • cryIfKeyId: Identifier of the key used as the basis for the derivation.
  • targetCryIfKeyId: Identifier of the key in which the derived key is stored.

Error Handling and Return Values

The result of the operation is transmitted via return type Std_ReturnType [SWS_CryIf_91009]:

Concurrency and Constraints

The interface is specified as reentrant [SWS_CryIf_91009]. Since the execution is synchronous, callers are likely to have to consider the execution time of the driver in the respective call context. Question Q-2b2fd50249878177 (open)

This usage note was generated automatically based on the AUTOSAR specification R20-11.

function CryIf_KeyExchangeCalcPubVal [SWS_CryIf_91010] 📄 PDF

Std_ReturnType CryIf_KeyExchangeCalcPubVal (uint32 cryIfKeyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);

This function shall dispatch the key exchange public value calculation function to the configured crypto driver object. Available

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 5f03ab0336af Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous and reentrant function CryIf_KeyExchangeCalcPubVal forwards the calculation of the public key exchange value to the configured Crypto Driver Object [SWS_CryIf_91010]. The service is available via the header CryIf.h [SWS_CryIf_91010].

During the function call, the following parameters are processed [SWS_CryIf_91010]:

  • cryIfKeyId: Identifier of the key to be used for the key exchange protocol.
  • publicValuePtr: Pointer to the memory area where the calculated public value is stored.
  • publicValueLengthPtr: Pointer to the length information. When called, this parameter must contain the provided buffer size; upon completion, it stores the actual length of the calculated value.

The function returns a status of type Std_ReturnType [SWS_CryIf_91010]:

  • E_OK: The request was successful.
  • E_NOT_OK: The request has failed.
  • CRYPTO_E_BUSY: Error because the responsible Crypto Driver Object is busy.
  • CRYPTO_E_KEY_EMPTY: Error due to an uninitialized source key element.
  • CRYPTO_E_KEY_NOT_VALID: Error because the addressed key is in the invalid state.

This text was generated by an AI-supported system and is based exclusively on the specification data from AUTOSAR R20-11.

function CryIf_KeyExchangeCalcSecret [SWS_CryIf_91011] 📄 PDF

Std_ReturnType CryIf_KeyExchangeCalcSecret (uint32 cryIfKeyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);

This function shall dispatch the key exchange common shared secret calculation function to the configured crypto driver object.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: ecfeb27c89f0 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function CryIf_KeyExchangeCalcSecret forwards the calculation of the shared secret during key exchange to the configured Crypto Driver Object [SWS_CryIf_91011]. The identifier of the key (cryIfKeyId), a pointer to the public key value of the communication partner (partnerPublicValuePtr), and its length in bytes (partnerPublicValueLength) are passed to the service [SWS_CryIf_91011].

Error handling: The function returns the result via Std_ReturnType [SWS_CryIf_91011]:

Concurrency: The interface is specified as reentrant [SWS_CryIf_91011]. Since the sequence is executed synchronously, the call is likely typically made in task context. Question Q-b3bca3645b0ef468 (open) The service is provided via the header file CryIf.h [SWS_CryIf_91011].

This usage note was automatically generated based on the AUTOSAR R20-11 specification.

function CryIf_CallbackNotification [SWS_CryIf_91013] 📄 PDF

void CryIf_CallbackNotification (Crypto_JobType* job, Crypto_ResultType result);

Notifies the CRYIF about the completion of the request with the result of the cryptographic operation.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 781636a3f50e Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

According to [SWS_CryIf_91013], function CryIf_CallbackNotification serves to inform the Crypto Interface (CryIf) about the completion of a cryptographic operation and its result. The declaration is available via header CryIf.h and has service ID 0x0d [SWS_CryIf_91013].

The call is synchronous and processes two mandatory input parameters [SWS_CryIf_91013]:

  • job (input, Crypto_JobType*): Points to the information structure of the completed job and contains a callback ID for correlating the completed job [SWS_CryIf_91013].
  • result (input, Crypto_ResultType): Transmits the result of the executed cryptographic operation [SWS_CryIf_91013].

Specific error codes or error messages (DET/DEM) are not defined for this service; functional error checking is performed via parameter result, which reflects the success or error status of the operation [SWS_CryIf_91013].

Regarding concurrency, the function is specified as non-reentrant (Non Reentrant) according to [SWS_CryIf_91013] and has no return value (void). Callers must therefore ensure that calls proceed sequentially and that no nested or parallel executions occur. Interpretation: The notification is likely typically called by underlying crypto drivers to return the result of asynchronously processed crypto jobs to the crypto interface. Question Q-ae17af188a970e00 (open)

This usage note was generated automatically based on the specification of AUTOSAR R20-11.

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/CP_MOD_CryIf
Status
unspecified
Version
AUTOSAR/AP/record/CP_MOD_CryIf@rel:R20-11#4354bd72
Content hash
4354bd72
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_CryptoInterface.pdf#nameddest=SWS_CryIf_91000

Initialization and status

Returns the version information of this module.

void CryIf_GetVersionInfo (Std_VersionInfoType* versioninfo);
CryIf_Init function

Initializes the CRYIF module. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoInterface

void CryIf_Init (const CryIf_ConfigType* configPtr);

Services · KeyElement…

Service CryIf_KeyElementCopy.

Std_ReturnType CryIf_KeyElementCopy (uint32 cryIfKeyId, uint32 keyElementId, uint32 targetCryIfKeyId, uint32 targetKeyElementId);

Service CryIf_KeyElementCopyPartial.

Std_ReturnType CryIf_KeyElementCopyPartial (uint32 cryIfKeyId, uint32 keyElementId, uint32 keyElementSourceOffset, uint32 keyElementTargetOffset, uint32 keyElementCopyLength, 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);

Services · Key…

CryIf_KeyCopy function

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);

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);

Services · More

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);

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);

Types

Configuration data structure of Cry If module