DEENESPTFRRUARHIKOZHNL

AUTOSAR Classic Crypto Services

Guía del clústerGENERADO POR IA

Proporciona servicios estandarizados de computación criptográfica y gestión de claves mediante controladores de hardware y software.
GENERADO POR IA no revisado Modelo: gemini-3.8-flash-medium · Esfuerzo: medium · Temperatura: no controlable · Prompt: b0f0d6315c89 Procedencia Preguntas abiertas (1)
Ancla causal: R20-11 Válido desde R20-11 Sintetizado para esta versión de especificación.
traducido de la guía alemanagemini-3.8-flash-low · 2026-10-13 · Original en alemán

Proporciona servicios estandarizados de computación criptográfica y gestión de claves mediante controladores de hardware y software.

El cluster agrupa los módulos CSM, CryIf y Crypto Driver para proporcionar de forma independiente del hardware servicios criptográficos y funciones de gestión de claves en la AUTOSAR Classic Platform EXP_UtilizationOfCryptoServices p. 8. Los trabajos criptográficos se priorizan a través del CSM, se enrutan en el CryIf hacia canales lógicos y se ejecutan de manera síncrona o asíncrona en el Crypto Driver [SWS_CryIf_91003]. Por razones de coherencia, las persistencias de claves en la NVM se realizan estrictamente tras una validación correcta mediante KeySetValid SWS_CryptoDriver p. 37.

El cluster de módulos «Crypto Services & Hardware Abstraction» comprende los módulos de AUTOSAR Classic Crypto Service Manager (csm), Crypto Interface (cryif) y Crypto Driver (crypto) EXP_UtilizationOfCryptoServices p. 8. Proporciona una capa de abstracción independiente del hardware para operaciones criptográficas (entre otras, cifrado, firmas, cálculo de MAC y generación de números aleatorios), así como para una gestión segura de claves [SWS_Csm_00982], [SWS_Csm_00984], SWS_CryptoDriver p. 15.

Las solicitudes criptográficas se encapsulan como Crypto_JobType, el cual define prioridades, búferes de entrada y salida, así como modos de operación (Start, Update, Finish para streaming o SingleCall) [SWS_Csm_01013], [SWS_Csm_01039]. El CSM acepta trabajos, los asigna a colas de software y los reenvía a través de CryIf_ProcessJob() [SWS_Csm_00017], [SWS_CryIf_91003]. El CryIf asume el enrutamiento de canales hacia los controladores y traduce los identificadores de clave del CSM a ID de clave de controlador específicos del módulo [SWS_CryIf_00133].

CryptoArchitecture cluster_app Application Layer / BSW Users cluster_csm Service Layer cluster_cryif ECU Abstraction Layer cluster_crypto Microcontroller Abstraction Layer (MCAL) SecOC SecOC / TLS / SW-C CSM Crypto Service Manager (csm) - Service-APIs (Csm_MacGenerate, ...) - Priorisierte Job-Queues - Csm_MainFunction SecOC->CSM Job / Service Request CSM->SecOC Application Callback CryIf Crypto Interface (cryif) - Channel Dispatching (CryIf_ProcessJob) - Key-ID Mapping (cryIfKeyId -> cryptoKeyId) - Callback Notification Dispatching CSM->CryIf CryIf_ProcessJob() / CryIf_Key*() CryIf->CSM Csm_CallbackNotification() CryptoDrv1 Crypto Driver (crypto) - HW - Crypto Driver Object 0 (p. ej., AES / HSM) - Sincronización de NVM CryIf->CryptoDrv1 Crypto_ProcessJob() [Kanal 0] CryptoDrv2 Crypto Driver (crypto) - SW - Crypto Driver Object 1 (p. ej., Software RSA) CryIf->CryptoDrv2 Crypto_ProcessJob() [Kanal 1] CryptoDrv1->CryIf CryIf_CallbackNotification() CryptoDrv2->CryIf CryIf_CallbackNotification()

Diagrama de contexto: arquitectura de capas y cascada de interfaces de la pila criptográfica de AUTOSAR. Fuentes: SWS_CryptoDriver p. 15, SWS_CryptoServiceManager p. 29

Para la sincronización de trabajos criptográficos asíncronos sirve la Csm_MainFunction() periódica, la cual vacía las colas e inicia los cálculos pendientes [SWS_Csm_00479]. Tras finalizar un cálculo asíncrono por hardware, el Crypto Driver notifica al CryIf mediante CryIf_CallbackNotification(), el cual transmite el aviso a Csm_CallbackNotification() y, en última instancia, a la aplicación llamante [SWS_CryIf_91013], [SWS_Csm_00970].

Secuencia asíncrona de órdenes criptográficas en el clúster de CryptoApplicationcsmcryifcryptoCsm_MacGenerate(jobId, mode, ...)Comprobar trabajo / Comprobación de colaaltTreiberobjekt freiCryIf_ProcessJob(channelId, job)Key-ID Mapping (cryIfKeyId -> cryptoKeyId)Crypto_ProcessJob(objectId, job)E_OK (Auftrag angenommen)E_OKTreiberobjekt belegt / Queuing aktivJob in CSM-Queue einreihenE_OK (Asynchron gepuffert)Csm_MainFunction(): Dequeue JobCryIf_ProcessJob(channelId, job)Crypto_ProcessJob(objectId, job)E_OKUse Case: Hardware-/Treiber-Berechnung & AbschlussKrypto-Primitive berechnen (HW/ISR)CryIf_CallbackNotification(job, result)Csm_CallbackNotification(job, result)CallbackNotification(result)

Diagrama de secuencias: flujo de trabajo criptográfico asíncrono con encolamiento y cascada de retrollamadas. Fuentes: [SWS_Csm_00970], [SWS_CryIf_91013], AUTOSAR_CP_SWS_CryptoServiceManager p. 146

La gestión de claves se realiza a través de interfaces estandarizadas como Csm_KeyElementSet() y CryIf_KeyElementCopy() bajo el cumplimiento estricto de los derechos de acceso configurados [SWS_Csm_00957], [SWS_CryIf_91015], [SWS_Crypto_00219]. La persistencia en la NVM solo se activa tras una validación explícita mediante Crypto_KeySetValid(), con lo que se evitan almacenamientos incompletos de claves [SWS_Crypto_91014], SWS_CryptoDriver p. 37. Errores como sobrecargas o estados de clave no válidos se interceptan de manera robusta mediante CRYPTO_E_BUSY o CRYPTO_E_KEY_NOT_VALID [SWS_Csm_00018], [SWS_CryIf_91003].

1. Arquitectura del sistema y rol del clúster de módulos

El cluster de módulos «Crypto Services & Hardware Abstraction» constituye el fundamento funcional para operaciones criptográficas, gestión de claves asistida por software y hardware, y comunicación segura a bordo en la AUTOSAR Classic Platform EXP_UtilizationOfCryptoServices p. 8. La arquitectura se estructura estrictamente a lo largo del modelo de capas de AUTOSAR en tres módulos BSW estandarizados: el Crypto Service Manager (csm) en la capa de servicios, el Crypto Interface (cryif) en la ECU Abstraction Layer y al menos un Crypto Driver (crypto) en la Microcontroller Abstraction Layer (MCAL) SWS_CryptoDriver p. 15. Esta estructura en capas abstrae por completo las aplicaciones de seguridad (por ejemplo, SecOC, establecimientos de conexión TLS y autenticación de diagnóstico UDS) de coprocesadores criptográficos propietarios, como Hardware Security Modules (HSM) o Secure Hardware Extensions (SHE) SWS_SecureOnboardCommunication p. 78.

El Crypto Service Manager (CSM) actúa como proveedor principal de servicios para componentes de aplicación (SW-Cs) y módulos BSW de nivel superior. Proporciona interfaces de programación estandarizadas para algoritmos simétricos y asimétricos (p. ej., AES, RSA), hashing, códigos de autenticación de mensajes (MAC), generación de números aleatorios (RNG) y procedimientos AEAD [SWS_Csm_00980], [SWS_Csm_00982], [SWS_Csm_00984], [SWS_Csm_01023]. Asimismo, el CSM implementa colas de trabajos por software y controla la priorización de trabajos criptográficos paralelos [SWS_Csm_00022], SWS_CryptoServiceManager p. 29.

El Crypto Interface (CryIf), como capa de abstracción, proporciona una interfaz homogénea 1:n entre el CSM y cualquier cantidad de controladores criptográficos. Su tarea central es el despacho (dispatching): reenvía trabajos en función de canales lógicos configurados (channelId) a la instancia de Crypto Driver correspondiente y transforma referencias de clave lógicas (cryIfKeyId) en identificadores específicos del controlador (cryptoKeyId) [SWS_CryIf_00133], [SWS_CryIf_91003]. El Crypto Driver encapsula la unidad de ejecución física (Crypto Driver Object) y atiende primitivas criptográficas puramente de software o módulos de seguridad de hardware específicos [SWS_Crypto_00224], SWS_CryptoDriver p. 15.

CryptoArchitecture cluster_app Application Layer / BSW Users cluster_csm Service Layer cluster_cryif ECU Abstraction Layer cluster_crypto Microcontroller Abstraction Layer (MCAL) SecOC SecOC / TLS / SW-C CSM Crypto Service Manager (csm) - Service-APIs (Csm_MacGenerate, ...) - Priorisierte Job-Queues - Csm_MainFunction SecOC->CSM Job / Service Request CSM->SecOC Application Callback CryIf Crypto Interface (cryif) - Channel Dispatching (CryIf_ProcessJob) - Key-ID Mapping (cryIfKeyId -> cryptoKeyId) - Callback Notification Dispatching CSM->CryIf CryIf_ProcessJob() / CryIf_Key*() CryIf->CSM Csm_CallbackNotification() CryptoDrv1 Crypto Driver (crypto) - HW - Crypto Driver Object 0 (p. ej., AES / HSM) - Sincronización de NVM CryIf->CryptoDrv1 Crypto_ProcessJob() [Kanal 0] CryptoDrv2 Crypto Driver (crypto) - SW - Crypto Driver Object 1 (p. ej., Software RSA) CryIf->CryptoDrv2 Crypto_ProcessJob() [Kanal 1] CryptoDrv1->CryIf CryIf_CallbackNotification() CryptoDrv2->CryIf CryIf_CallbackNotification()

Diagrama de contexto: arquitectura de capas y cascada de interfaces de la pila criptográfica de AUTOSAR. Fuentes: SWS_CryptoDriver p. 15, SWS_CryptoServiceManager p. 29

2. Interacción y rutas de comunicación entre los módulos

El procesamiento de trabajos dentro del cluster se realiza principalmente a través del modelo basado en trabajos mediante la estructura Crypto_JobType [SWS_Csm_01013], AUTOSAR_CP_SWS_CryptoServiceManager p. 21. Un trabajo criptográfico agrupa el ID de trabajo, información de prioridad, referencias de clave, metadatos de la primitiva y la estructura Crypto_JobPrimitiveInputOutputType para la gestión de punteros de parámetros de entrada, salida y longitud [SWS_Csm_01012]. Mediante el campo de máscara de bits Crypto_OperationModeType (con las banderas START, UPDATE, FINISH) se controla si un trabajo se calcula como una llamada única coherente (SINGLECALL) o de forma incremental en modo de streaming [SWS_Csm_01039], [SWS_Csm_01029].

Si se llama síncronamente a una función de servicio del CSM, el CSM comprueba el estado del trabajo. Si el controlador está libre o el trabajo está configurado como síncrono, el CSM llama directamente a CryIf_ProcessJob() [SWS_Csm_00017], [SWS_CryIf_91003]. El CryIf mapea los ID de clave y despacha el trabajo a la instancia de controlador asignada mediante Crypto_ProcessJob() [SWS_CryIf_00133]. En solicitudes asíncronas, si el objeto del controlador está ocupado, el trabajo se encola en la cola del CSM [SWS_Csm_00018], AUTOSAR_CP_SWS_CryptoServiceManager p. 30. Tras finalizar el cálculo asíncrono del controlador, el controlador dispara CryIf_CallbackNotification() [SWS_CryIf_91013], el CryIf reenvía la notificación a Csm_CallbackNotification() [SWS_Csm_00970] y, finalmente, el CSM notifica a la aplicación solicitante mediante su retrollamada configurada [SWS_Csm_01044], [SWS_Csm_00928].

Secuencia asíncrona de órdenes criptográficas en el clúster de CryptoApplicationcsmcryifcryptoCsm_MacGenerate(jobId, mode, ...)Comprobar trabajo / Comprobación de colaaltTreiberobjekt freiCryIf_ProcessJob(channelId, job)Key-ID Mapping (cryIfKeyId -> cryptoKeyId)Crypto_ProcessJob(objectId, job)E_OK (Auftrag angenommen)E_OKTreiberobjekt belegt / Queuing aktivJob in CSM-Queue einreihenE_OK (Asynchron gepuffert)Csm_MainFunction(): Dequeue JobCryIf_ProcessJob(channelId, job)Crypto_ProcessJob(objectId, job)E_OKUse Case: Hardware-/Treiber-Berechnung & AbschlussKrypto-Primitive berechnen (HW/ISR)CryIf_CallbackNotification(job, result)Csm_CallbackNotification(job, result)CallbackNotification(result)

Diagrama de secuencias: flujo de trabajo criptográfico asíncrono con encolamiento y cascada de retrollamadas. Fuentes: [SWS_Csm_00970], [SWS_CryIf_91013], AUTOSAR_CP_SWS_CryptoServiceManager p. 146

Junto a la ejecución criptográfica principal, la gestión de claves constituye una ruta de interacción integral del cluster SWS_CryptoDriver p. 24. Una clave consta de varios elementos de clave lógicos (como material de clave, vectores de inicialización o valores de iteración) [SWS_Csm_00954], [SWS_Csm_01022]. Operaciones como el establecimiento de material de clave mediante Csm_KeyElementSet(), la copia mediante Csm_KeyElementCopy() o la derivación de claves mediante Csm_KeyDerive() se reenvían síncronamente a través del CryIf (CryIf_KeyElementCopy(), CryIf_KeyDerive()) a las funciones del controlador [SWS_Csm_00957], [SWS_Csm_00969], [SWS_CryIf_91015], [SWS_CryIf_91009]. En este proceso, el acceso a los elementos de clave se supervisa estrictamente en función de los derechos de acceso configurados (CRYPTO_RA_ALLOWED, CRYPTO_RA_ENCRYPTED, CRYPTO_RA_INTERNAL_COPY) [SWS_Crypto_00219].

3. Sincronización, reentrancia y contextos de tareas

Las operaciones criptográficas varían drásticamente en su duración de ejecución. Mientras que los cifrados por bloques rápidos o los cálculos de hash pueden ejecutarse síncronamente en el contexto de tarea de la entidad llamante, los cálculos asimétricos (p. ej., la generación de firmas RSA) o los procesos de hardware prolongados requieren un procesamiento asíncrono [SWS_Csm_00984], [SWS_Csm_00992]. Para el desacoplamiento, el CSM proporciona la función principal llamada cíclicamente Csm_MainFunction() [SWS_Csm_00479]. Esta supervisa las colas, despacha trabajos pendientes al CryIf e impulsa las máquinas de estados internas de primitivas asíncronas [SWS_Csm_00019].

En arquitecturas multinúcleo y multisector modernas, el CSM admite múltiples instancias Csm_MainFunction_<shortName>(), que se asignan a particiones de OS dedicadas [SWS_Csm_00479], AUTOSAR_SWS_CryptoServiceManager p. 170. En la ejecución asíncrona de controladores, los cálculos se finalizan bien por sondeo en la MainFunction del controlador o bien mediante rutinas de servicio de interrupción (ISR) de motores criptográficos basados en hardware [SWS_Crypto_00027], [SWS_Crypto_00028]. Por definición, un único Crypto Driver Object puede procesar exactamente un trabajo criptográfico a la vez; un controlador con n objetos procesa n trabajos de forma verdaderamente paralela [SWS_Crypto_00014], [SWS_Crypto_00117].

En cuanto a la reentrancia, las interfaces de servicio como Csm_MacGenerate() o CryIf_ProcessJob() están diseñadas para ser reentrantes para diferentes jobs, pero prohíben la asignación múltiple en paralelo de la misma instancia de job [SWS_Csm_00016], [SWS_CryIf_91003]. Las funciones de gestión de claves como Csm_KeyElementCopy(), CryIf_KeyElementCopy() o Crypto_KeyCopy() están implementadas como reentrantes, pero no deben aplicarse de forma concurrente al mismo identificador de clave de origen (keyId o cryptoKeyId) para evitar inconsistencias de datos y condiciones de carrera [SWS_Csm_00969], [SWS_CryIf_91015], [SWS_Crypto_00155]. Los controladores de hardware podrían utilizar áreas exclusivas internas (Exclusive Areas) para la modificación de áreas de trabajo internas y registros de claves con el fin de interceptar condiciones de carrera entre la ISR y el nivel de tarea SWS_CryptoDriver p. 27. Pregunta Q-b1e9578255723a0e (abierta)

CsmDispatchLogic Start Eintritt Csm_<Service>() CheckActive Job aktiv? (jobState == ACTIVE) Start->CheckActive CheckSync Synchroner Modus? (CRYPTO_PROCESSING_SYNC) CheckActive->CheckSync Nein DirectCall Ejecutar CryIf_ProcessJob() CheckActive->DirectCall Ja (Streaming Update/Finish) CheckSync->DirectCall Ja CheckQueueEmpty CSM-Queue leer? CheckSync->CheckQueueEmpty Nein (Asynchron) CheckPrio ¿Prioridad mayor que el trabajo más prioritario de la cola? CheckQueueEmpty->CheckPrio Nein ForwardCryIf Job sofort dispatchen: CryIf_ProcessJob() CheckQueueEmpty->ForwardCryIf Ja CheckQueueFull CSM-Queue voll? CheckPrio->CheckQueueFull Nein CheckPrio->ForwardCryIf Ja EnqueueJob Job in CSM-Queue einreihen Return E_OK CheckQueueFull->EnqueueJob Nein ReturnBusy Return CRYPTO_E_BUSY (Det: CSM_E_QUEUE_FULL) CheckQueueFull->ReturnBusy Ja

Diagrama de actividades: Lógica de decisión y desacoplamiento de encolado en la aceptación de órdenes en el CSM. Fuentes: AUTOSAR_CP_SWS_CryptoServiceManager p. 30, [SWS_Csm_00017], [SWS_Csm_00018]

4. Ciclos de vida típicos y modos de funcionamiento

La inicialización del clúster de criptografía se realiza durante el arranque del BSW en orden jerárquico. En primer lugar, el EcuM o BswM inicializa el nivel de controlador a través de Crypto_Init() transfiriendo la configuración Crypto_ConfigType [SWS_Crypto_91016], seguido de la capa de interfaz a través de CryIf_Init() con CryIf_ConfigType [SWS_CryIf_91118]. Por último, se inicia el CSM mediante Csm_Init(), debiendo configurarse su puntero de configuración según la especificación siempre a NULL_PTR [SWS_Csm_00646]. Solo tras la inicialización completa de todas las capas se permite la aceptación de órdenes criptográficas o accesos a claves [SWS_CryIf_00076], [SWS_Crypto_00196].

Un aspecto central del ciclo de vida de las claves es la validación y persistencia en memoria no volátil (NVM). Tras cargar nuevos valores de clave a través de Csm_KeyElementSet(), la clave permanece en el estado «incompleta o desconocida» [SWS_Csm_00957]. Solo la llamada explícita a Csm_JobKeySetValid() o Crypto_KeySetValid() comprueba la coherencia y cambia el estado de la clave a válido [SWS_Csm_91027], [SWS_Crypto_91014]. En claves persistidas, únicamente esta validación desencadena el almacenamiento en la NVM [SWS_Crypto_91026], SWS_CryptoDriver p. 37. Esto evita múltiples ciclos de escritura fragmentados en la NVM y protege contra conjuntos de claves incompletos SWS_CryptoDriver p. 37. Para la sincronización con el NVRAM Manager, el Crypto Driver se sirve de las callbacks Crypto_<vi>_<ai>_NvBlock_ReadFrom_<NvBlock>() y Crypto_<vi>_<ai>_NvBlock_WriteTo_<NvBlock>(), así como de NvM_WriteBlock() [SWS_Crypto_91024], [SWS_Crypto_91025], [SWS_Crypto_91017].

Las órdenes de streaming en curso pueden interrumpirse en caso necesario mediante Csm_SaveContextJob(), asegurarse en un búfer propio de la aplicación y continuarse más adelante mediante el restablecimiento del contexto [SWS_Csm_91063], [SWS_Csm_01029]. Antes de un apagado de la ECU o de una transición a modos de bajo consumo (Low-Power), las órdenes asíncronas pueden cancelarse de forma controlada a través de Csm_CancelJob(), con lo cual el CryIf elimina los jobs de las colas de controladores y canales de hardware mediante CryIf_CancelJob() [SWS_Csm_00968], [SWS_CryIf_91014].

5. Tratamiento de errores, rastreo de DET y degradación

El clúster implementa una estrategia de detección y defensa contra errores de varios niveles. Los errores de desarrollo se notifican directamente al módulo Default Error Tracer (DET) cuando el trazado está activado [SWS_Csm_91101], [SWS_Crypto_91017]. Entre los eventos típicos de DET se incluyen llamadas a módulos antes de la inicialización (CRYIF_E_UNINIT, CRYPTO_E_UNINIT), parámetros de handle o clave no válidos (CRYIF_E_PARAM_HANDLE, CRYPTO_E_PARAM_HANDLE), así como transferencias de punteros nulos [SWS_CryIf_00076], [SWS_CryIf_00134], [SWS_Crypto_00196], [SWS_Crypto_00217].

Las sobrecargas de tiempo de ejecución y los cuellos de botella de recursos se interceptan de forma determinista mediante valores de retorno definidos. Si la cola del CSM para un job asíncrono se agota, el CSM rechaza la orden con el código de estado CRYPTO_E_BUSY y genera el error de tiempo de ejecución CSM_E_QUEUE_FULL [SWS_Csm_00018], [SWS_Csm_01089]. Si un búfer de resultados proporcionado está dimensionado de forma insuficiente, el controlador cancela la operación con CRYPTO_E_SMALL_BUFFER [SWS_Crypto_00195]. Si un servicio criptográfico hace referencia a una clave no inicializada o invalidada explícitamente (por ejemplo, tras invocar Csm_JobKeySetInvalid() o Crypto_KeySetInvalid()), las solicitudes de servicio fallan de manera controlada con CRYPTO_E_KEY_NOT_VALID o CRYPTO_E_KEY_EMPTY [SWS_Csm_91002], [SWS_CryIf_91003], [SWS_Crypto_91020].

Los mecanismos de degradación y fallback se habilitan a nivel de sistema: las aplicaciones pueden comprobar el estado de integridad de las claves antes de transmitir una orden a través de Csm_KeyGetStatus() [SWS_Csm_91047], [SWS_CryIf_91012]. En caso de que un acelerador criptográfico de hardware esté permanentemente ocupado o falle, la configuración de canales del CryIf permite una ruta alternativa basada en software, siempre que esté integrado un controlador de software redundante SWS_CryptoDriver p. 15.

Esta guía se basa exclusivamente en la especificación AUTOSAR Classic R20-11 y ha sido generada por el asistente de comisariado de autodocs.

Die Crypto Services bieten hardware- und softwaregestützte Kryptographie-Primitive (CSM, CryIf, Crypto-Treiber) für symmetrische/asymmetrische Verschlüsselung, Signaturen und Hashing.

Module im Cluster

Crypto Abstraction Library (Cal)

AUTOSAR Classic Crypto Services-Modul Crypto Abstraction Library (Cal, Spezifikation: AUTOSAR_SWS_CryptoAbstractionLibrary.pdf).

BSW ID 206 Keine C-API · 0 Records #include "Cal.h"

Crypto Interface (CryIf)

Abstracts cryptographic hardware and software acceleration engines.

BSW ID 112 19 APIs (18 Funktionen, 1 Typen) #include "CryIf.h"

Crypto Driver (Crypto)

Low-level driver executing cryptographic primitives on hardware security modules (HSM) or software libraries.

BSW ID 114 20 APIs (19 Funktionen, 1 Typen) #include "Crypto.h"

Crypto Service Manager (CSM)

Provides standardized cryptographic services (encryption, hashing, digital signatures, key management) to applications and BSW.

BSW ID 110 82 APIs (38 Funktionen, 44 Typen) #include "Csm.h"

Mapa de temas

CSM

82
<Csm_ApplicationCallbackNotification>Csm_AEADDecryptCsm_AEADEncryptCsm_CallbackNotificationCsm_CancelJobCsm_DecryptCsm_EncryptCsm_GetVersionInfoCsm_HashCsm_InitCsm_JobKeyDeriveCsm_JobKeyExchangeCalcPubValCsm_JobKeyExchangeCalcSecretCsm_JobKeyGenerateCsm_JobKeySetInvalidCsm_JobKeySetValidCsm_JobRandomSeedCsm_KeyCopyCsm_KeyDeriveCsm_KeyElementCopyCsm_KeyElementCopyPartialCsm_KeyElementGetCsm_KeyElementSetCsm_KeyExchangeCalcPubValCsm_KeyExchangeCalcSecretCsm_KeyGenerateCsm_KeyGetStatusCsm_KeySetInvalidCsm_KeySetValidCsm_MacGenerateCsm_MacVerifyCsm_MainFunctionCsm_RandomGenerateCsm_RandomSeedCsm_RestoreContextJobCsm_SaveContextJobCsm_SignatureGenerateCsm_SignatureVerifyCrypto_AlgorithmFamilyTypeCrypto_AlgorithmInfoTypeCrypto_AlgorithmModeTypeCrypto_InputOutputRedirectionConfigTypeCrypto_JobPrimitiveInfoTypeCrypto_JobPrimitiveInputOutputTypeCrypto_JobRedirectionInfoTypeCrypto_JobStateTypeCrypto_JobTypeCrypto_KeyStatusTypeCrypto_OperationModeTypeCrypto_PrimitiveInfoTypeCrypto_ProcessingTypeCrypto_ResultTypeCrypto_ServiceInfoTypeCrypto_VerifyResultTypeCsm_AEADDecryptAssociatedDataTypeCsm_AEADDecryptCiphertextTypeCsm_AEADDecryptPlaintextTypeCsm_AEADDecryptTagTypeCsm_AEADEncryptAssociatedDataTypeCsm_AEADEncryptCiphertextTypeCsm_AEADEncryptPlaintextTypeCsm_AEADEncryptTagTypeCsm_ConfigIdTypeCsm_ConfigTypeCsm_DecryptDataTypeCsm_DecryptResultTypeCsm_EncryptDataTypeCsm_EncryptResultTypeCsm_HashDataTypeCsm_HashResultTypeCsm_KeyDataTypeCsm_LengthPtrCsm_MacGenerateDataTypeCsm_MacGenerateResultTypeCsm_MacVerifyCompareTypeCsm_MacVerifyDataTypeCsm_RandomGenerateResultTypeCsm_SignatureGenerateDataTypeCsm_SignatureGenerateResultTypeCsm_SignatureVerifyCompareTypeCsm_SignatureVerifyDataTypeCsm_VerifyResultPtr

Vista de detalle

Selecciona una entrada en el índice.

CryIf

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

void CryIf_CallbackNotification (Crypto_JobType* job, Crypto_ResultType result);

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

Std_ReturnType CryIf_CancelJob (uint32 channelId, Crypto_JobType* job);

Returns the version information of this module.

void CryIf_GetVersionInfo (Std_VersionInfoType* versioninfo);
CryIf_Init función

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

void CryIf_Init (const CryIf_ConfigType* configPtr);
CryIf_KeyCopy función

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

Std_ReturnType CryIf_KeyCopy (uint32 cryIfKeyId, uint32 targetCryIfKeyId);

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

Std_ReturnType CryIf_KeyDerive (uint32 cryIfKeyId, uint32 targetCryIfKeyId);

Service CryIf_KeyElementCopy.

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

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

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

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

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

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

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

Std_ReturnType CryIf_KeyGenerate (uint32 cryIfKeyId);

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

Std_ReturnType CryIf_KeyGetStatus (uint32 cryIfKeyId, Crypto_KeyStatusType* keyStatusPtr);

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

Std_ReturnType CryIf_KeySetInvalid (uint32 cryIfKeyId);

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

Std_ReturnType CryIf_KeySetValid (uint32 cryIfKeyId);

Service CryIf_ProcessJob.

Std_ReturnType CryIf_ProcessJob (uint32 channelId, Crypto_JobType* job);

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

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

Configuration data structure of Cry If module

Crypto

This interface removes the provided job from the queue and cancels the processing of the job if possible.

Std_ReturnType Crypto_CancelJob (uint32 objectId, Crypto_JobType* job);

Returns the version information of this module.

void Crypto_GetVersionInfo (Std_VersionInfoType* versioninfo);
Crypto_Init función

Initializes the Crypto Driver.

void Crypto_Init (const Crypto_ConfigType* configPtr);

Copies a key with all its elements to another key in the same crypto driver. Note: If the actual key element is directly mapped to flash memory, there could be a bigger delay when calling this function (synchronous operation)

Std_ReturnType Crypto_KeyCopy (uint32 cryptoKeyId, uint32 targetCryptoKeyId);

Derives a new key by using the key elements in the given key identified by the crypto Key Id. The given key contains the key elements for the password, salt. The derived key is stored in the key element with the id 1 of the key identified by target Crypto Key Id. The number of iterations is given in the key element CRYPTO_ KE_ KEYDERIVATION_ ITERATIONS.

Std_ReturnType Crypto_KeyDerive (uint32 cryptoKeyId, uint32 targetCryptoKeyId);

Service Crypto_KeyElementCopy.

Std_ReturnType Crypto_KeyElementCopy (uint32 cryptoKeyId, uint32 keyElementId, uint32 targetCryptoKeyId, uint32 targetKeyElementId);

Service Crypto_KeyElementCopyPartial.

Std_ReturnType Crypto_KeyElementCopyPartial (uint32 cryptoKeyId, uint32 keyElementId, uint32 keyElementSourceOffset, uint32 keyElementTargetOffset, uint32 keyElementCopyLength, uint32 targetCryptoKeyId, uint32 targetKeyElementId);

This interface shall be used to get a key element of the key identified by the crypto

Std_ReturnType Crypto_KeyElementGet (uint32 cryptoKeyId, uint32 keyElementId, uint8* resultPtr, uint32* resultLengthPtr);

Used to retrieve information which key elements are available in a given key.

Std_ReturnType Crypto_KeyElementIdsGet (uint32 cryptoKeyId, uint32* keyElementIdsPtr, uint32* keyElementIdsLengthPtr);

Sets the given key element bytes to the key identified by crypto Key Id.

Std_ReturnType Crypto_KeyElementSet (uint32 cryptoKeyId, uint32 keyElementId, const uint8* keyPtr, uint32 keyLength);

Calculates the public value for the key exchange a nd stores the public key in the memory location pointed by the public value pointer.

Std_ReturnType Crypto_KeyExchangeCalcPubVal (uint32 cryptoKeyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);

Calculates the shared secret key for the key exchange with the key material of the key identified by the crypto Key Id and the partner public key. The shared secret key is stored as a key element in the same key.

Std_ReturnType Crypto_KeyExchangeCalcSecret (uint32 cryptoKeyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);

Generates new key material store it in the key identified by crypto Key Id.

Std_ReturnType Crypto_KeyGenerate (uint32 cryptoKeyId);

Returns the key state of the key identified by crypto Key Id.

Std_ReturnType Crypto_KeyGetStatus (uint32 cryptoKeyId, Crypto_KeyStatusType* keyStatusPtr);

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

Std_ReturnType Crypto_KeySetInvalid (uint32 cryptoKeyId);

Sets the key state of the key identified by crypto Key Id to valid.

Std_ReturnType Crypto_KeySetValid (uint32 cryptoKeyId);

If asynchronous job processing is configured and there are job queues, the function is called cyclically to process queued jobs. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoDriver

void Crypto_MainFunction (void);

Service Crypto_ProcessJob.

Std_ReturnType Crypto_ProcessJob (uint32 objectId, Crypto_JobType* job);

This function generates the internal seed state using the pro vided entropy source. Furthermore, this function can be used to update the seed state with new entropy

Std_ReturnType Crypto_RandomSeed (uint32 cryptoKeyId, const uint8* seedPtr, uint32 seedLength);

Configuration data structure of Cry If module

CSM

CSM notifies the application that a job has finished. The function name is configurable. The function name itself is derived from "{CSM Job/ CSM Job Primitive Callback Ref}/CSM Callback Func".

void <Csm_ApplicationCallbackNotification> (uint32 jobId, Crypto_ResultType result);

Service Csm_AEADDecryptManager.

Std_ReturnType Csm_AEADDecrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* ciphertextPtr, uint32 ciphertextLength, const uint8* associatedDataPtr, uint32 associatedDataLength, const uint8* tagPtr, uint32 tagLength, uint8* plaintextPtr, uint32* plaintextLengthPtr, Crypto_VerifyResultType* verifyPtr);

Service Csm_AEADEncrypt.

Std_ReturnType Csm_AEADEncrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* plaintextPtr, uint32 plaintextLength, const uint8* associatedDataPtr, uint32 associatedDataLength, uint8* ciphertextPtr, uint32* ciphertextLengthPtr, uint8* tagPtr, uint32* tagLengthPtr);

Notifies the CSM that a job has finished. This function is used by the underlying layer (CRYIF).

void Csm_CallbackNotification (Crypto_JobType* job, Crypto_ResultType result);
Csm_CancelJob función

Cancels the job processing from asynchronous or streaming jobs .

Csm_Decrypt función

Service Csm_Decrypt.

Std_ReturnType Csm_Decrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* resultPtr, uint32* resultLengthPtr);
Csm_Encrypt función

Service Csm_Encrypt.

Std_ReturnType Csm_Encrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* resultPtr, uint32* resultLengthPtr);

Returns the version information of this module.

void Csm_GetVersionInfo (Std_VersionInfoType* versioninfo);
Csm_Hash función

Uses the given data to perform the hash calculation and stores the hash.

Std_ReturnType Csm_Hash (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* resultPtr, uint32* resultLengthPtr);
Csm_Init función

Initializes the CSM module. In configurations, in which CSM is assigned to more than one partition (i.e. Csm_ Main Functions are mapped to partitions), CSM may provide one init function per partition.

void Csm_Init (const Csm_ConfigType* configPtr);

Derives a new key by using the key elements in the given key identified by the key Id. The given key contains the key elements for the password and salt. The derived key is stored in the key element with the id 1 of the key identified by target Crypto

Std_ReturnType Csm_JobKeyDerive (uint32 jobId, uint32 keyId, uint32 targetKeyId);

Calculates the public value of the current user for the key exchange and stores the

Std_ReturnType Csm_JobKeyExchangeCalcPubVal (uint32 jobId, uint32 keyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);

Calculates the shared secret key for the key exchange with the key material of the key identified by the key Id and the partner public key. The shared secret key is stored as a key element in the same key.

Std_ReturnType Csm_JobKeyExchangeCalcSecret (uint32 jobId, uint32 keyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);

Generates new key material and stores it in the key identified by key Id.

Std_ReturnType Csm_JobKeyGenerate (uint32 jobId, uint32 keyId);

Sets the key status to invalid. The key cannot be used any longer for cryptographic operations until it has been set to valid state again.

Std_ReturnType Csm_JobKeySetInvalid (uint32 jobId, uint32 keyId);

Stores the key if necessary and sets the key state of the key identified by key Id to valid.

Std_ReturnType Csm_JobKeySetValid (uint32 jobId, uint32 keyId);

Provides a new seed for the specified key that is used for an associated random number generator.

Std_ReturnType Csm_JobRandomSeed (uint32 jobId, uint32 keyId, const uint8* seedPtr, Manager uint32 seedLength);
Csm_KeyCopy función

This function shall copy all key elements from the source key to a target key. Ava ilable via Csm.h

Std_ReturnType Csm_KeyCopy (const uint32 keyId, const uint32 targetKeyId);
Csm_KeyDerive función

Derives a new key by using the key elements in the given key identified by the key Id. The given key contains the key elements for the password and salt. The derived key is stored in the k ey element with the id 1 of the key identified by target Crypto Key Id.

Std_ReturnType Csm_KeyDerive (uint32 keyId, uint32 targetKeyId);

Service Csm_KeyElementCopyManager.

Std_ReturnType Csm_KeyElementCopy (const uint32 keyId, const uint32 keyElementId, const uint32 targetKeyId, const uint32 targetKeyElementId);

Service Csm_KeyElementCopyPartial.

Std_ReturnType Csm_KeyElementCopyPartial (uint32 keyId, uint32 keyElementId, uint32 keyElementSourceOffset, uint32 keyElementTargetOffset, uint32 keyElementCopyLength, uint32 targetKeyId, uint32 targetKeyElementId);

Service Csm_KeyElementGet.

Std_ReturnType Csm_KeyElementGet (uint32 keyId, uint32 keyElementId, uint8* keyElementPtr, Manager uint32* keyElementLengthPtr);

Sets the given key element bytes to the key identified by key Id.

Std_ReturnType Csm_KeyElementSet (uint32 keyId, uint32 keyElementId, const uint8* keyElementPtr, uint32 keyElementLength);

Calculates the public value of the current user for the key exchange and stores the pub lic key in the memory location pointed by the public value pointer.

Std_ReturnType Csm_KeyExchangeCalcPubVal (uint32 keyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);

Calculates the shared secret key for the key exchange with the key material of the key identified by the key Id and the partner public key. The shared secret key is stored as a key element in the same key.

Std_ReturnType Csm_KeyExchangeCalcSecret (uint32 keyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);

Generates new key material and store it in the key identified by key Id.

Std_ReturnType Csm_KeyGenerate (uint32 keyId);

Returns the key state of the key identified by key Id.

Std_ReturnType Csm_KeyGetStatus (uint32 keyId, Crypto_KeyStatusType* keyStatusPtr);

Sets the key status to invalid. The key cannot be used any longer for cryptographic operations until it has been set to valid state again.

Std_ReturnType Csm_KeySetInvalid (uint32 keyId);

Sets the key state of the key identified by key Id to valid.

Std_ReturnType Csm_KeySetValid (uint32 keyId);

Service Csm_MacGenerate.

Std_ReturnType Csm_MacGenerate (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* macPtr, uint32* macLengthPtr);
Csm_MacVerify función

Service Csm_MacVerify.

Std_ReturnType Csm_MacVerify (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, const uint8* macPtr, const uint32 macLength, Crypto_VerifyResultType* verifyPtr);

API to be called cyclically to process the requested jobs. The Csm_ Main Function shall check the queues for jobs to pass to the underlying CRYIF. Per configured CSM Main Function ins tance one Csm_ Main Function_ shall be implemented. Hereby is the short name of the CSM Main Function configuration container in the ECU configuration.

void Csm_MainFunction (void);

Generate a random number and stores it in the memory location pointed by th e result pointer.

Std_ReturnType Csm_RandomGenerate (uint32 jobId, uint8* resultPtr, uint32* resultLengthPtr);

Feeds the key element CRYPTO_ KE_ RANDOM_ SEED with a random seed. Manager AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoServiceManager

Std_ReturnType Csm_RandomSeed (uint32 keyId, const uint8* seedPtr, uint32 seedLength);

The Crypto Driver extracts the context data from the context Buffer and restores the internal state so that further crypto operation of this crypto service will continue at the exact point when the context was taken.

Std_ReturnType Csm_RestoreContextJob (uint32 jobId, uint8* contextBufferPtr, uint32 contextBufferLength);

The Crypto Driver stores the internal context of the respective crypto operation to the context Buffer.

Std_ReturnType Csm_SaveContextJob (uint32 jobId, uint8* contextBufferPtr, uint32* contextBufferLengthPtr);

Service Csm_SignatureGenerate.

Std_ReturnType Csm_SignatureGenerate (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* signaturePtr, uint32* signatureLengthPtr);

Service Csm_SignatureVerify.

Std_ReturnType Csm_SignatureVerify (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, const uint8* signaturePtr, uint32 signatureLength, Crypto_VerifyResultType* verifyPtr);

Type Crypto_AlgorithmFamilyType.

Structure which determines the exact algorithm. Note, not every algorithm needs to specify all fields. AUTOSAR shall only allow valid combinations.

Type Crypto_AlgorithmModeType.

Defines which of the input/ output parameters are re - directed to a key element. The values can be combined to define a bit field.

Structure which contains further information, which depends on the job and the crypto primitive.

Type Crypto_JobPrimitiveInputOutputType.

Type Crypto_JobRedirectionInfoType.

Enumeration of the current job state.

Structure which contains further information, which depends on the job and the crypto primitive.

Enumeration for key status.

Enume ration which operation shall be performed. This enumeration is constructed from a bit mask, where the first bit indicates "Start", the second "Update" and the third "Finish".

Structure which contains basic information about the crypto primitive. Manager AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoServiceManager

Enumeration of the processing type.

Return for Std_ Return Type for Cryptostack.

Enumeration of the kind of the service.

Enumeration of the result type of verification operations.

Array long enough to store the data of the header.

Array long enough to store the ciphertext to be decrypted with AEAD.

Array long enough to store the data of the plaintext.

Array long enough to store the data of the Tag.

Array long enough to store the data of the header.

Array long enough to store the data of the cipher.

Array long enough to store the plaintext to be encrypted with AEAD.

Array long enough to store the data of the Tag.

Identification of a CSM service configuration via a numeric identifier, that is unique within a service. The name of a CSM service configuration, i.e. the name of the container Csm_Config, shall serve as a symbolic name for this parameter Avail able via Csm.h

Configuration data structure of CSM module

Array long enough to store the data to be decrypted.

Array long enough to store the data of the decrypted plaintext.

Array long enough to store the data to be encrypted.

Array long enough to store the data of the cipher.

Array long enough to store the data which shall be hashed.

Array long enough to store the data of the hash.

Array long enough to store any key element of the considered key

Implementation Data Type of category DATA_ REFERENCE with the pointer target uint32 to be able to return asynchronously the length.

Array long enough to store the data from which a MAC shall be generated.

Array long enough to store the data of the MAC.

Array long enough to store a MAC to be verified.

Array long enough to store the data for whichs MAC shall be verified.

Array long enough to store the data of the random number.

Array long enough to store the data from which the signature shall be generated.

Array long enough to store the signature and its length.

Array long enough to store a signature to be verified.

Array long enough to store the data for whichs signature shall be verified.

Implementation Data Type of category DATA_ REFERENCE with the pointer target Csm_ Verify Result Type to be able to return asynchronously the verify result.