Crypto Driver (Crypto)
Low-level driver executing cryptographic primitives on hardware security modules (HSM) or software libraries.
Funktionen — Übersicht
void Crypto_Init (const Crypto_ConfigType* configPtr);Initializes the Crypto Driver.void Crypto_GetVersionInfo (Std_VersionInfoType* versioninfo);Returns the version information of this module.Std_ReturnType Crypto_ProcessJob (uint32 objectId, Crypto_JobType* job);Service Crypto_ProcessJob.Std_ReturnType Crypto_CancelJob (uint32 objectId, Crypto_JobType* job);This interface removes the provided job from the queue and cancels the processing of the job if possible.Std_ReturnType Crypto_KeyElementSet (uint32 cryptoKeyId, uint32 keyElementId, const uint8* keyPtr, uint32 keyLength);Sets the given key element bytes to the key identified by crypto Key Id.Std_ReturnType Crypto_KeySetValid (uint32 cryptoKeyId);Sets the key state of the key identified by crypto Key Id to valid.Std_ReturnType Crypto_KeySetInvalid (uint32 cryptoKeyId);Sets invalid for the status of the key identifi ed by crypto Key Id.Std_ReturnType Crypto_KeyElementGet (uint32 cryptoKeyId, uint32 keyElementId, uint8* resultPtr, uint32* resultLengthPtr);This interface shall be used to get a key element of the key identified by the cryptoStd_ReturnType Crypto_KeyGetStatus (uint32 cryptoKeyId, Crypto_KeyStatusType* keyStatusPtr);Returns the key state of the key identified by crypto Key Id.Std_ReturnType Crypto_KeyElementCopy (uint32 cryptoKeyId, uint32 keyElementId, uint32 targetCryptoKeyId, uint32 targetKeyElementId);Service Crypto_KeyElementCopy.Std_ReturnType Crypto_KeyElementCopyPartial (uint32 cryptoKeyId, uint32 keyElementId, uint32 keyElementSourceOffset, uint32 keyElementTargetOffset, uint32 keyElementCopyLength, uint32 targetCryptoKeyId, uint32 targetKeyElementId);Service Crypto_KeyElementCopyPartial.Std_ReturnType Crypto_KeyCopy (uint32 cryptoKeyId, uint32 targetCryptoKeyId);Copies a key with all its elements to another key in the same crypto driver.Std_ReturnType Crypto_KeyElementIdsGet (uint32 cryptoKeyId, uint32* keyElementIdsPtr, uint32* keyElementIdsLengthPtr);Used to retrieve information which key elements are available in a given key.Std_ReturnType Crypto_RandomSeed (uint32 cryptoKeyId, const uint8* seedPtr, uint32 seedLength);This function generates the internal seed state using the pro vided entropy source.Std_ReturnType Crypto_KeyGenerate (uint32 cryptoKeyId);Generates new key material store it in the key identified by crypto Key Id.Std_ReturnType Crypto_KeyDerive (uint32 cryptoKeyId, uint32 targetCryptoKeyId);Derives a new key by using the key elements in the given key identified by the crypto Key Id.Std_ReturnType Crypto_KeyExchangeCalcPubVal (uint32 cryptoKeyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);Calculates the public value for the key exchange a nd stores the public key in the memory location pointed by the public value...Std_ReturnType Crypto_KeyExchangeCalcSecret (uint32 cryptoKeyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);Calculates the shared secret key for the key exchange with the key material of the key identified by the crypto Key Id and the...void Crypto_MainFunction (void);If asynchronous job processing is configured and there are job queues, the function is called cyclically to process queued jobs.
Typen — Übersicht
struct Crypto_ConfigTypeConfiguration data structure of Cry If module
Funktionen & Typen — Detailansicht
function Crypto_Init [SWS_Crypto_91000] 📄 PDF
void Crypto_Init (const Crypto_ConfigType* configPtr);
Initializes the Crypto Driver.
The function Crypto_Init serves to initialize the Crypto Driver according to [SWS_Crypto_91000]. The interface is declared in the header Crypto.h and has the service ID 0x00 [SWS_Crypto_91000].
The following properties are specified for the call and interface parameters:
- Configuration pointer: A pointer to the selected configuration structure is passed via the input parameter
configPtrof typeconst Crypto_ConfigType*[SWS_Crypto_91000]. - Return value: The function has no return value (
void); neither input/output parameters nor separate output parameters exist [SWS_Crypto_91000]. - Execution behavior: The initialization routine is executed synchronously (
Synchronous) [SWS_Crypto_91000]. - Reentrancy: The function is defined as non-reentrant (
Non Reentrant) [SWS_Crypto_91000]. Parallel or overlapping calls are not permissible.
Due to the classification as non-reentrant and because the specification does not return any specific error codes, the call is likely to occur centrally during the startup phase of the ECU before any other driver accesses (interpretation). Question Q-008bb5a45b823891 (open) The caller is likely also responsible for ensuring that the referenced configuration structure remains permanently valid in memory (interpretation). Question Q-6271a86fad440121 (open)
This usage note was generated by an AI based on the specification AUTOSAR CP R20-11.
Implementer's Guide to follow (complexity I1)
function Crypto_GetVersionInfo [SWS_Crypto_91001] 📄 PDF
void Crypto_GetVersionInfo (Std_VersionInfoType* versioninfo);
Returns the version information of this module.
function Crypto_ProcessJob [SWS_Crypto_91003] 📄 PDF
Std_ReturnType Crypto_ProcessJob (uint32 objectId, Crypto_JobType* job);
Service Crypto_ProcessJob.
The function Crypto_ProcessJob executes the cryptographic primitive configured in parameter job on the Crypto Driver Object referenced by objectId [SWS_Crypto_91003]. The call is reentrant and operates synchronously or asynchronously depending on the job configuration [SWS_Crypto_91003]. Via the pointer to Crypto_JobType, both configuration data for the primitive and buffers for the result data are passed [SWS_Crypto_91003].
Before the actual execution of a job, the driver checks the key identifiers for validity: If job->cryptoKeyId or optionally job->targetCryptoKeyId lie outside the permissible range, the function reports the error CRYPTO_E_PARAM_HANDLE to the DET and returns E_NOT_OK [SWS_Crypto_00217]. This also applies to the service CRYPTO_KEYDERIVE (job->jobPrimitiveInfo->primitiveInfo->service), provided job->targetCryptoKeyId is invalid [SWS_Crypto_00202].
In addition to E_OK and E_NOT_OK, specific error codes signal the failure of the request [SWS_Crypto_91003]:
CRYPTO_E_BUSY, if the driver object is busy or its queue is full [SWS_Crypto_91003],- key-related errors such as
CRYPTO_E_KEY_NOT_VALID,CRYPTO_E_KEY_SIZE_MISMATCH,CRYPTO_E_KEY_READ_FAIL,CRYPTO_E_KEY_WRITE_FAIL,CRYPTO_E_KEY_NOT_AVAILABLE, orCRYPTO_E_KEY_EMPTY[SWS_Crypto_91003], CRYPTO_E_JOB_CANCELEDupon cancellation of a synchronous job [SWS_Crypto_91003], andCRYPTO_E_ENTROPY_EXHAUSTEDin case of insufficient entropy of a random number generator; in this case, the function additionally reports the runtime errorCRYPTO_E_RE_ENTROPY_EXHAUSTED[SWS_Crypto_00141], [SWS_Crypto_91003].
This text was created by an AI based on AUTOSAR R20-11 specification data.
Implementer's Guide to follow (complexity I1)
function Crypto_CancelJob [SWS_Crypto_00122] 📄 PDF
Std_ReturnType Crypto_CancelJob (uint32 objectId, Crypto_JobType* job);
This interface removes the provided job from the queue and cancels the processing of the job if possible.
use
The synchronous function Crypto_CancelJob removes a passed job from the queue and cancels its processing if possible [SWS_Crypto_00122]. Upon the call, the identifier of the Crypto Driver Object (objectId) and a pointer to the job configuration (job) are passed [SWS_Crypto_00122].
The return values signal the result of the cancellation attempt:
E_OK: The request was successful and the job was removed [SWS_Crypto_00122]. If there is no error in the driver and the job is currently not being processed, the service also returnsE_OKwithout further actions [SWS_Crypto_00214].E_NOT_OK: The request failed because the job could not be removed [SWS_Crypto_00122].CRYPTO_E_JOB_CANCELED: The job was canceled, but continues to be executed; no results are reported back to the application [SWS_Crypto_00122]. This applies if the driver operates error-free, but cannot cancel the job (for example due to hardware limitations) [SWS_Crypto_00183].
Concurrency and Limitations
The interface is reentrant for different instances, but must not be called simultaneously for the same Crypto Driver Object [SWS_Crypto_00122].
This usage note was created automatically and is based exclusively on the specification data of AUTOSAR R20-11.
Implementer's Guide to follow (complexity I1)
function Crypto_KeyElementSet [SWS_Crypto_91004] 📄 PDF
Std_ReturnType Crypto_KeyElementSet (uint32 cryptoKeyId, uint32 keyElementId, const uint8* keyPtr, uint32 keyLength);
Sets the given key element bytes to the key identified by crypto Key Id.
The synchronous function Crypto_KeyElementSet serves to set the raw data of a specific key element for a key identified via cryptoKeyId in the crypto driver [SWS_Crypto_91004].
Parameters and Return Values
The destination key element is addressed via keyElementId, while keyPtr points to the data buffer and keyLength to its byte size [SWS_Crypto_91004]. Upon successful assignment, the interface returns E_OK [SWS_Crypto_91004].
Error handling
If an error occurs during processing, the function provides specific return values [SWS_Crypto_91004]:
CRYPTO_E_BUSY: The associated Crypto Driver Object is busy.CRYPTO_E_KEY_WRITE_FAIL: Write access to the key element was denied.CRYPTO_E_KEY_NOT_AVAILABLE: The requested key element or the key is not available.CRYPTO_E_KEY_SIZE_MISMATCH: The passed data length does not match the size of the key element.E_NOT_OK: The request failed for other reasons.
Concurrency
The function is specified as non-reentrant (Non Reentrant) [SWS_Crypto_91004]. Interpretation: Callers are likely responsible for synchronizing parallel calls against each other in order to prevent data inconsistencies in the driver. Question Q-d7ef7a774052a212 (open)
This usage note was created automatically based on the specification SWS_Crypto_91004 (R20-11).
Implementer's Guide to follow (complexity I1)
function Crypto_KeySetValid [SWS_Crypto_91014] 📄 PDF
Std_ReturnType Crypto_KeySetValid (uint32 cryptoKeyId);
Sets the key state of the key identified by crypto Key Id to valid.
The synchronous function Crypto_KeySetValid serves to set the state of a key specified via the identifier cryptoKeyId to valid ([SWS_Crypto_91014]). The interface is available via the header file Crypto.h and has the service ID 0x05 ([SWS_Crypto_91014]).
The following parameters and return values are defined during usage ([SWS_Crypto_91014]):
- Input parameters: Via
cryptoKeyId(typeuint32), the identifier of the key whose state is to be set to valid is passed ([SWS_Crypto_91014]). Additional input or output parameters do not exist ([SWS_Crypto_91014]). - Return value: A status code of type
Std_ReturnTypeinforms about the result of the request ([SWS_Crypto_91014]):E_OK: The request was successful ([SWS_Crypto_91014]).E_NOT_OK: The request failed ([SWS_Crypto_91014]).CRYPTO_E_BUSY: Execution failed because the responsible Crypto Driver Object is busy ([SWS_Crypto_91014]).
Regarding concurrency, the function is specified as non-reentrant (\"Non Reentrant\") ([SWS_Crypto_91014]). Interpretation: Callers are likely to have to coordinate parallel calls across tasks externally in order to avoid conflicts, and should plan to retry the call at a later time upon receiving CRYPTO_E_BUSY. Question Q-32d775a9e61e5731 (open)
This text was created by an AI and is based on the AUTOSAR R20-11 specification status.
Implementer's Guide to follow (complexity I1)
function Crypto_KeySetInvalid [SWS_Crypto_91020] 📄 PDF
Std_ReturnType Crypto_KeySetInvalid (uint32 cryptoKeyId);
Sets invalid for the status of the key identifi ed by crypto Key Id.
Usage and Semantics
The synchronous function Crypto_KeySetInvalid sets the status of a key identified by cryptoKeyId to invalid [SWS_Crypto_91020]. The function is defined in the header file Crypto.h and is addressed via the service ID 0x15 [SWS_Crypto_91020]. The input value cryptoKeyId (type uint32), which contains the unique identifier of the target key, serves as the only passed parameter; input/output and output parameters do not exist [SWS_Crypto_91020].
Error Handling and Return Values
The result of the function execution is signaled via the return value of type Std_ReturnType [SWS_Crypto_91020]:
E_OK: The request was successful and the key status was set to invalid [SWS_Crypto_91020].E_NOT_OK: Execution of the request failed [SWS_Crypto_91020].CRYPTO_E_BUSY: The request failed because the responsible crypto driver object (Crypto Driver Object) is currently busy [SWS_Crypto_91020].
Concurrency and Limitations
The interface is specified as non-reentrant (Non Reentrant) [SWS_Crypto_91020]. A concurrent or interrupting call is therefore not permitted. Because the function is executed synchronously, it returns to the caller only after completion of the status change or after determination of the error [SWS_Crypto_91020].
This usage note was generated automatically based on the specification.
Implementer's Guide to follow (complexity I1)
function Crypto_KeyElementGet [SWS_Crypto_91006] 📄 PDF
Std_ReturnType Crypto_KeyElementGet (uint32 cryptoKeyId, uint32 keyElementId, uint8* resultPtr, uint32* resultLengthPtr);
This interface shall be used to get a key element of the key identified by the crypto
The synchronous and reentrant function Crypto_KeyElementGet serves to read a key element identified by keyElementId from the key cryptoKeyId and store it in the memory area resultPtr [SWS_Crypto_91006]. The interface is provided via the header Crypto.h and has the service ID 0x06 [SWS_Crypto_91006]. Upon the call, the caller passes the buffer size or, in the case of configured partial access, the desired read size via the in-out parameter resultLengthPtr; after completion of execution, the driver stores the actually copied amount of data there [SWS_Crypto_91006].
In case of success, the function returns E_OK [SWS_Crypto_91006]. If the operation fails, it signals this via specific error codes: CRYPTO_E_BUSY if the crypto driver object is busy, CRYPTO_E_KEY_NOT_AVAILABLE if the key element is not available, CRYPTO_E_KEY_READ_FAIL if read access is denied, CRYPTO_E_KEY_EMPTY for an uninitialized source element, as well as generically E_NOT_OK [SWS_Crypto_91006].
Although the interface is specified as reentrant, the specification points out that noticeable latencies can occur during synchronous execution if the key element is directly mapped into the flash memory [SWS_Crypto_91006]. Interpretation: Due to these potential delays, calling primarily in the task context and not within time-critical interrupt service routines is likely to be appropriate. Question Q-ff4e2843b9aad46d (open)
This usage note was generated automatically and is based on the specification status of AUTOSAR Classic R20-11.
Implementer's Guide to follow (complexity I1)
function Crypto_KeyGetStatus [SWS_Crypto_91019] 📄 PDF
Std_ReturnType Crypto_KeyGetStatus (uint32 cryptoKeyId, Crypto_KeyStatusType* keyStatusPtr);
Returns the key state of the key identified by crypto Key Id.
The synchronous function Crypto_KeyGetStatus serves to query the current state of a specific key within the crypto driver [SWS_Crypto_91019]. It is provided via the header Crypto.h and carries the service ID 0x14 [SWS_Crypto_91019].
Usage and Parameters
The call is synchronous and expects two parameters [SWS_Crypto_91019]:
cryptoKeyId: The identifier of the key whose status is to be determined.keyStatusPtr: Pointer to the memory area of typeCrypto_KeyStatusTypeto which the state is returned.
The interface returns Std_ReturnType as the return value. Upon successful execution, E_OK is reported, whereas in case of error, E_NOT_OK is returned [SWS_Crypto_91019].
Concurrency and Limitations
The function is declared as non-reentrant (Non Reentrant) [SWS_Crypto_91019]. Callers must therefore ensure that concurrent calls are avoided by higher-level synchronization mechanisms. Specific DET error messages are not listed; presumably, an erroneous call such as an invalid pointer or an invalid ID directly leads to the return of E_NOT_OK [SWS_Crypto_91019]. Question Q-5703fab02905e91a (open)
This text was created by an AI and is based on the specification of AUTOSAR R20-11.
Implementer's Guide to follow (complexity I1)
function Crypto_KeyElementCopy [SWS_Crypto_00148] 📄 PDF
Std_ReturnType Crypto_KeyElementCopy (uint32 cryptoKeyId, uint32 keyElementId, uint32 targetCryptoKeyId, uint32 targetKeyElementId);
Service Crypto_KeyElementCopy.
The synchronous function Crypto_KeyElementCopy serves to copy a key element to another key element within the same crypto driver [SWS_Crypto_00148]. The identifiers of the source key (cryptoKeyId) and the source key element (keyElementId) as well as the destination key (targetCryptoKeyId) and the destination key element (targetKeyElementId) are passed [SWS_Crypto_00148].
Regarding timing behavior, it should be noted that for key elements mapped directly in flash memory, greater delays may occur during the function call due to synchronous execution [SWS_Crypto_00148]. The runtime behavior must therefore be taken into account, especially in time-critical contexts.
The function is designed to be reentrant, but explicitly not for the same cryptoKeyId [SWS_Crypto_00148]. Simultaneous calls with an identical source key must consequently be synchronized or precluded by the caller.
In case of success, the function returns E_OK [SWS_Crypto_00148]. In case of errors, the return value signals the specific cause [SWS_Crypto_00148]:
CRYPTO_E_BUSY: The crypto driver object is busy [SWS_Crypto_00148].CRYPTO_E_KEY_NOT_AVAILABLE: The requested key element of at least one key is not available [SWS_Crypto_00148].CRYPTO_E_KEY_READ_FAILorCRYPTO_E_KEY_WRITE_FAIL: Reading the source element or writing the destination element is not permitted [SWS_Crypto_00148].CRYPTO_E_KEY_SIZE_MISMATCH: The sizes of the key elements are not compatible with each other [SWS_Crypto_00148].CRYPTO_E_KEY_EMPTY: The source key element is not initialized [SWS_Crypto_00148].E_NOT_OK: The request failed generally [SWS_Crypto_00148].
This usage note was generated automatically based on the specification of AUTOSAR Classic R20-11.
Implementer's Guide to follow (complexity I1)
function Crypto_KeyElementCopyPartial [SWS_Crypto_91015] 📄 PDF
Std_ReturnType Crypto_KeyElementCopyPartial (uint32 cryptoKeyId, uint32 keyElementId, uint32 keyElementSourceOffset, uint32 keyElementTargetOffset, uint32 keyElementCopyLength, uint32 targetCryptoKeyId, uint32 targetKeyElementId);
Service Crypto_KeyElementCopyPartial.
The synchronous function Crypto_KeyElementCopyPartial serves for the partial copying of data from a source key element to a target key element within the same crypto driver [SWS_Crypto_91015]. The parameters keyElementSourceOffset and keyElementCopyLength define the segment of the source element to be copied (cryptoKeyId, keyElementId), while keyElementTargetOffset determines the starting position in the target element (targetCryptoKeyId, targetKeyElementId). If checks are error-free, the driver performs the copying synchronously and returns E_OK [SWS_Crypto_00209].
Prior to execution, the driver validates the buffer and driver states:
- If the crypto driver is not initialized and development error detection is enabled, the function reports
CRYPTO_E_UNINITto the DET and returnsE_NOT_OK[SWS_Crypto_00205]. - If the total length of the source key element is less than
keyElementSourceOffset + keyElementCopyLength, the call fails withCRYPTO_E_KEY_SIZE_MISMATCH[SWS_Crypto_00207]. - If the maximum buffer of the target key element provides less space than
keyElementTargetOffset + keyElementCopyLength,CRYPTO_E_KEY_SIZE_MISMATCHis likewise reported [SWS_Crypto_00208]. - Other specified error values include
CRYPTO_E_BUSY(driver object busy),CRYPTO_E_KEY_EMPTY(uninitialized source element),CRYPTO_E_KEY_NOT_AVAILABLE, and read or write access errors (CRYPTO_E_KEY_READ_FAIL,CRYPTO_E_KEY_WRITE_FAIL) [SWS_Crypto_91015].
The function is reentrant, but must not be called simultaneously for the same key ID cryptoKeyId [SWS_Crypto_91015]. If a key element is stored directly in flash memory, the synchronous execution can lead to noticeable time delays [SWS_Crypto_91015].
This usage note was generated automatically based on the AUTOSAR specification R20-11.
Implementer's Guide to follow (complexity I2)
function Crypto_KeyCopy [SWS_Crypto_00155] 📄 PDF
Std_ReturnType Crypto_KeyCopy (uint32 cryptoKeyId, uint32 targetCryptoKeyId);
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)
use
The synchronous function Crypto_KeyCopy copies a key together with all its key elements to a target key within the same crypto driver [SWS_Crypto_00155]. The assignment takes place via the input parameters cryptoKeyId for the source key and targetCryptoKeyId for the target key [SWS_Crypto_00155]. A successful copy operation is confirmed with E_OK [SWS_Crypto_00155].
Concurrency and Runtime Behavior
The interface is designed to be reentrant, but must not be executed at the same time for the same cryptoKeyId [SWS_Crypto_00155]. Since execution is synchronous, noticeable time delays can occur during the call for key elements stored directly in flash memory [SWS_Crypto_00155].
Error handling
In case of an error, the function returns specific return values of type Std_ReturnType [SWS_Crypto_00155]:
CRYPTO_E_BUSY: The associated Crypto Driver Object is busy [SWS_Crypto_00155].CRYPTO_E_KEY_NOT_AVAILABLE: At least one of the requested keys is not available [SWS_Crypto_00155].CRYPTO_E_KEY_READ_FAIL: Reading the source key element is not permitted [SWS_Crypto_00155].CRYPTO_E_KEY_WRITE_FAIL: Writing to the target key element is not permitted [SWS_Crypto_00155].CRYPTO_E_KEY_SIZE_MISMATCH: The sizes of the key elements are not compatible with each other [SWS_Crypto_00155].CRYPTO_E_KEY_EMPTY: The key element of the source key is not initialized [SWS_Crypto_00155].E_NOT_OK: Execution of the request failed [SWS_Crypto_00155].
This usage note was generated by an AI based on the AUTOSAR CP R20-11 specification.
function Crypto_KeyElementIdsGet [SWS_Crypto_00160] 📄 PDF
Std_ReturnType Crypto_KeyElementIdsGet (uint32 cryptoKeyId, uint32* keyElementIdsPtr, uint32* keyElementIdsLengthPtr);
Used to retrieve information which key elements are available in a given key.
The synchronous function Crypto_KeyElementIdsGet serves to query information about which key elements are available in a given key [SWS_Crypto_00160]. The identifier of the key whose available element IDs are to be exported is passed via the input parameter cryptoKeyId [SWS_Crypto_00160]. The determined identifiers are stored in the array referenced by the pointer keyElementIdsPtr [SWS_Crypto_00160].
The buffer size is managed via the input and output parameter keyElementIdsLengthPtr: Upon the call, this parameter must contain the provided size of the buffer keyElementIdsPtr [SWS_Crypto_00160]. After completion of the operation, the actual number of available key elements is stored there [SWS_Crypto_00160].
As a return value, the service provides E_OK upon a successful query, or E_NOT_OK if the request failed [SWS_Crypto_00160]. If the responsible crypto driver object is busy at the time of the call, the error code CRYPTO_E_BUSY is returned [SWS_Crypto_00160].
Regarding concurrency, the function is reentrant, but must not be called simultaneously for the same cryptoKeyId [SWS_Crypto_00160]. The declaration is available via the header Crypto.h [SWS_Crypto_00160].
This text was generated by an AI based on the AUTOSAR specification.
Implementer's Guide to follow (complexity I1)
function Crypto_RandomSeed [SWS_Crypto_91013] 📄 PDF
Std_ReturnType Crypto_RandomSeed (uint32 cryptoKeyId, const uint8* seedPtr, uint32 seedLength);
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
The synchronous function Crypto_RandomSeed (service ID 0x0d) serves according to [SWS_Crypto_91013] for the generation and update of the internal seed state of a key using a provided entropy source. The function declaration is contained in the header file Crypto.h.
Usage and Call Parameters
In addition to the initial generation, according to [SWS_Crypto_91013] the function can also be used to update the seed state with new entropy. The synchronous call requires three input parameters:
cryptoKeyId: Passes the identifier of the key for which a new seed is to be generated.seedPtr: Holds a pointer to the memory area containing the data for feeding the seed.seedLength: Defines the length of the passed seed data in bytes.
Return Values and Error Handling
As a return value, Crypto_RandomSeed reports a status of type Std_ReturnType according to [SWS_Crypto_91013]:
E_OK: The request was executed successfully.E_NOT_OK: The request has failed.CRYPTO_E_KEY_NOT_VALID: Execution fails because the key state of the key identified bycryptoKeyIdis in the status "invalid".
Concurrency and Limitations
According to [SWS_Crypto_91013], the function is specified as reentrant, but explicitly not for the same cryptoKeyId. Parallel calls for the same key must therefore be prevented on the caller side.
This text was generated by an AI and is based exclusively on the specification data from the payload.
Implementer's Guide to follow (complexity I1)
function Crypto_KeyGenerate [SWS_Crypto_91007] 📄 PDF
Std_ReturnType Crypto_KeyGenerate (uint32 cryptoKeyId);
Generates new key material store it in the key identified by crypto Key Id.
use
The function Crypto_KeyGenerate provided via the header file Crypto.h generates new key material and updates the key addressed via the identifier cryptoKeyId [SWS_Crypto_91007]. The function operates completely synchronously and is defined under the service ID 0x07 [SWS_Crypto_91007]. Other parameters besides the key identifier do not exist [SWS_Crypto_91007].
Concurrency and Limitations
With regard to concurrency, Crypto_KeyGenerate is specified as reentrant, but expressly with the restriction that this does not apply to the same cryptoKeyId [SWS_Crypto_91007]. If multiple requests are made for the same key, these must be synchronized on the caller side to avoid driver conflicts.
Return Values and Error Handling
Via the return value of base type Std_ReturnType, the caller receives detailed feedback on success or specific error causes of the operation [SWS_Crypto_91007]:
E_OK: Key generation was executed successfully [SWS_Crypto_91007].CRYPTO_E_BUSY: The request failed because the responsible Crypto Driver Object is currently busy [SWS_Crypto_91007].CRYPTO_E_KEY_EMPTY: Generation failed because a required source key element is uninitialized [SWS_Crypto_91007].CRYPTO_E_KEY_NOT_VALID: The operation failed because the key state of the key referenced bycryptoKeyIdis marked as invalid [SWS_Crypto_91007].E_NOT_OK: The request for key generation failed for other reasons [SWS_Crypto_91007].
This usage note was generated automatically based on the specification of AUTOSAR Classic R20-11.
function Crypto_KeyDerive [SWS_Crypto_91008] 📄 PDF
Std_ReturnType Crypto_KeyDerive (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.
The synchronous function Crypto_KeyDerive derives a new cryptographic key from the key elements of a source key (cryptoKeyId) and stores it in the key element with ID 1 of the destination key (targetCryptoKeyId) [SWS_Crypto_91008]. The source key must contain the required key elements for password and salt; the number of iterations is specified via the key element CRYPTO_KE_KEYDERIVATION_ITERATIONS [SWS_Crypto_91008].
Invocation and Concurrency
The interface is reentrant, but must not be called simultaneously for the same cryptoKeyId [SWS_Crypto_91008]. Callers must therefore ensure that parallel derivation processes operate on different source keys.
Return Values and Error Handling
The function signals the result via defined return values of type Std_ReturnType [SWS_Crypto_91008]:
E_OK: Key derivation successfully performed.E_NOT_OK: Derivation failed. If the parametertargetCryptoKeyIdis outside the valid range, the function also reportsCRYPTO_E_PARAM_HANDLEto the DET when development error detection is activated [SWS_Crypto_00180].CRYPTO_E_BUSY: The responsible crypto driver object is busy [SWS_Crypto_91008].CRYPTO_E_KEY_EMPTY: A required source key element is not initialized [SWS_Crypto_91008].CRYPTO_E_KEY_NOT_VALID: The state of the key referenced bycryptoKeyIdis invalid [SWS_Crypto_91008].
This usage note was generated automatically based on the specification.
Implementer's Guide to follow (complexity I1)
function Crypto_KeyExchangeCalcPubVal [SWS_Crypto_91009] 📄 PDF
Std_ReturnType Crypto_KeyExchangeCalcPubVal (uint32 cryptoKeyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);
Calculates the public value for the key exchange a nd stores the public key in the memory location pointed by the public value pointer.
use
The synchronous function Crypto_KeyExchangeCalcPubVal calculates the public value for a key exchange protocol and stores it at the memory location of publicValuePtr ([SWS_Crypto_91009]). The caller passes the identifier of the key to be used for the protocol via cryptoKeyId. The buffer size of the provided memory must be passed upon the call via the input and output parameter publicValueLengthPtr; after completion of execution, the actual length of the calculated public value is stored there ([SWS_Crypto_91009]).
Error Handling and Return Values
The function returns E_OK upon successful execution. If an error occurs, E_NOT_OK or a specific error code is returned ([SWS_Crypto_91009]):
CRYPTO_E_BUSY: The request fails because the Crypto Driver Object is busy.CRYPTO_E_KEY_EMPTY: The request fails because the source key element is not initialized.CRYPTO_E_KEY_NOT_VALID: The request fails because the status of the key referenced viacryptoKeyIdis invalid.
Concurrency and system integration
According to [SWS_Crypto_91009], the function is reentrant, but not for the same cryptoKeyId. If the crypto driver requires services of a random number generator (RNG) for internal purposes such as Crypto_KeyExchangeCalcPubVal, the first Crypto Driver Object (object number 0) must be configured for this purpose ([SWS_Crypto_00224]).
This text was generated by an AI. All information is based on the specification AUTOSAR Classic R20-11.
Implementer's Guide to follow (complexity I1)
function Crypto_KeyExchangeCalcSecret [SWS_Crypto_91010] 📄 PDF
Std_ReturnType Crypto_KeyExchangeCalcSecret (uint32 cryptoKeyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);
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.
The synchronous function Crypto_KeyExchangeCalcSecret serves to calculate a shared secret (shared secret key) for a key exchange protocol [SWS_Crypto_91010]. It processes the key material of the key specified via cryptoKeyId together with the partner's public value passed via partnerPublicValuePtr, whose byte count is specified via partnerPublicValueLength [SWS_Crypto_91010]. The calculated shared secret is stored directly as a key element within the same key [SWS_Crypto_91010].
As a return value, the function provides the status via Std_ReturnType [SWS_Crypto_91010]:
E_OK: The calculation and storage of the secret were completed successfully [SWS_Crypto_91010].E_NOT_OK: The request has failed [SWS_Crypto_91010].CRYPTO_E_BUSY: Execution failed because the responsible Crypto Driver Object is busy [SWS_Crypto_91010].CRYPTO_E_KEY_EMPTY: The source key element is uninitialized [SWS_Crypto_91010].CRYPTO_E_KEY_NOT_VALID: The state of the key referenced bycryptoKeyIdis invalid [SWS_Crypto_91010].
The interface is implemented as reentrant, but must not be called concurrently for the same cryptoKeyId [SWS_Crypto_91010]. Callers must therefore ensure that concurrent calls with an identical key ID are avoided and that the referenced key material is initialized beforehand and in a valid state to prevent error states [SWS_Crypto_91010].
This usage note was generated automatically based on the specification of SWS_Crypto_91010.
function Crypto_MainFunction [SWS_Crypto_91012] 📄 PDF
void Crypto_MainFunction (void);
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
The function Crypto_MainFunction serves for the cyclic processing of queued cryptographic jobs in the job queues of the crypto driver [SWS_Crypto_91012]. A prerequisite for its use is that asynchronous job processing has been configured in the module and corresponding job queues are present [SWS_Crypto_91012].
Call and Semantics
The function has the signature void Crypto_MainFunction(void) and is specified with the service ID 0x0c [SWS_Crypto_91012]. It takes no input parameters and returns no return value. The interface is provided via the header SchM_Crypto.h [SWS_Crypto_91012]. This allows the interpretation that the cyclic call is triggered as scheduled by the BSW Scheduler (Schedule Manager) in the context of a periodic task of the operating system.
Concurrency and Limitations
The call is strictly bound to the configuration of asynchronous job queues [SWS_Crypto_91012]. Since the specification does not indicate reentrancy for Crypto_MainFunction, the function is likely to be treated as non-reentrant; parallel calls from multiple threads or tasks should therefore be avoided. Question Q-038d384305c8c5c3 (open)
Error handling
No specific error codes or DET entries are recorded in the specification for this function [SWS_Crypto_91012]. Since the function provides no return values, any errors during asynchronous processing are presumably passed to higher layers via status queries or via the feedback channels of the respective jobs. Question (open)
This usage note was generated by an AI based on the specification AUTOSAR CP R20-11.
type Crypto_ConfigType [SWS_Crypto_91016] 📄 PDF
Configuration data structure of Cry If module
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/CP_MOD_Crypto- Status
- unspecified
- Version
AUTOSAR/AP/record/CP_MOD_Crypto@rel:R20-11#d5886321- Content hash
d5886321- Source
- https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_CryptoDriver.pdf#nameddest=SWS_Crypto_91000
gemini-3.8-flash-low· 2026-10-13 · German original