DEENESPTFRRUARHIKOZHNL

AUTOSAR Classic Crypto Services

Guide du clusterGÉNÉRÉ PAR IA

Fournit des services standardisés de calcul cryptographique et de gestion des clés par l'intermédiaire de pilotes matériels et logiciels.
GÉNÉRÉ PAR IA non vérifié Modèle : gemini-3.8-flash-medium · Effort : medium · Température : non réglable · Prompt : b0f0d6315c89 Provenance Questions ouvertes (1)
Ancre causale : R20-11 Valable à partir de R20-11 Synthétisé pour cette version de spécification.
traduit du guide allemandgemini-3.8-flash-low · 2026-10-13 · Original allemand

Fournit des services standardisés de calcul cryptographique et de gestion des clés par l'intermédiaire de pilotes matériels et logiciels.

Le cluster regroupe les modules CSM, CryIf et Crypto Driver afin de fournir, de manière indépendante du matériel, des services cryptographiques et des fonctions de gestion des clés au sein de l'AUTOSAR Classic Platform EXP_UtilizationOfCryptoServices p. 8. Les jobs cryptographiques sont priorisés via le CSM, routés vers des canaux logiques dans le CryIf et exécutés de manière synchrone ou asynchrone dans le Crypto Driver [SWS_CryIf_91003]. Pour des raisons de cohérence, les persistances de clés dans la NVM ne s'effectuent strictement qu'après une validation réussie au moyen de KeySetValid SWS_CryptoDriver p. 37.

Le cluster de modules « Crypto Services & Hardware Abstraction » comprend les modules AUTOSAR Classic Crypto Service Manager (csm), Crypto Interface (cryif) et Crypto Driver (crypto) EXP_UtilizationOfCryptoServices p. 8. Il fournit une couche d'abstraction indépendante du matériel pour les opérations cryptographiques (notamment chiffrement, signatures, calcul de MAC et génération de nombres aléatoires) ainsi que pour une gestion sécurisée des clés [SWS_Csm_00982], [SWS_Csm_00984], SWS_CryptoDriver p. 15.

Les requêtes cryptographiques sont encapsulées sous la forme d'un Crypto_JobType, qui définit des priorités, des mémoires tampon d'entrée et de sortie ainsi que des modes de fonctionnement (Start, Update, Finish pour le streaming ou SingleCall) [SWS_Csm_01013], [SWS_Csm_01039]. Le CSM prend en charge les requêtes, les affecte à des files d'attente logicielles et les transmet via CryIf_ProcessJob() [SWS_Csm_00017], [SWS_CryIf_91003]. Le CryIf assure le routage des canaux vers les pilotes et traduit les identifiants de clés du CSM en ID de clés de pilote spécifiques aux modules [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 (par ex. AES / HSM) - Synchronisation NVM CryIf->CryptoDrv1 Crypto_ProcessJob() [Kanal 0] CryptoDrv2 Crypto Driver (crypto) - SW - Crypto Driver Object 1 (par ex. Software RSA) CryIf->CryptoDrv2 Crypto_ProcessJob() [Kanal 1] CryptoDrv1->CryIf CryIf_CallbackNotification() CryptoDrv2->CryIf CryIf_CallbackNotification()

Diagramme de contexte : architecture en couches et cascade d'interfaces de la pile cryptographique AUTOSAR. Sources : SWS_CryptoDriver p. 15, SWS_CryptoServiceManager p. 29

La synchronisation des requêtes cryptographiques asynchrones repose sur la fonction périodique Csm_MainFunction(), qui vide les files d'attente et déclenche les calculs en attente [SWS_Csm_00479]. Une fois un calcul matériel asynchrone achevé, le Crypto Driver notifie le CryIf via CryIf_CallbackNotification(), lequel retransmet le message à Csm_CallbackNotification() et finalement à l'application appelante [SWS_CryIf_91013], [SWS_Csm_00970].

Déroulement asynchrone des ordres cryptographiques dans le cluster cryptoApplicationcsmcryifcryptoCsm_MacGenerate(jobId, mode, ...)Vérifier le job / contrôle de la file d'attentealtTreiberobjekt 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)

Diagramme de séquence : déroulement d'une requête cryptographique asynchrone avec mise en file d'attente et cascade de rappels. Sources : [SWS_Csm_00970], [SWS_CryIf_91013], AUTOSAR_CP_SWS_CryptoServiceManager p. 146

La gestion des clés s'effectue via des interfaces standardisées telles que Csm_KeyElementSet() et CryIf_KeyElementCopy(), dans le respect strict des droits d'accès configurés [SWS_Csm_00957], [SWS_CryIf_91015], [SWS_Crypto_00219]. Une persistance dans la NVM n'est déclenchée que lors d'une validation explicite via Crypto_KeySetValid(), ce qui évite les enregistrements de clés incomplets [SWS_Crypto_91014], SWS_CryptoDriver p. 37. Les erreurs telles que les surcharges ou les états de clé invalides sont interceptées de manière robuste via CRYPTO_E_BUSY ou CRYPTO_E_KEY_NOT_VALID [SWS_Csm_00018], [SWS_CryIf_91003].

1. Architecture système & rôle du cluster de modules

Le cluster de modules « Crypto Services & Hardware Abstraction » constitue le fondement fonctionnel pour les opérations cryptographiques, la gestion des clés assistée par logiciel et matériel ainsi que la communication embarquée sécurisée au sein de l'AUTOSAR Classic Platform EXP_UtilizationOfCryptoServices p. 8. L'architecture se structure rigoureusement le long du modèle en couches AUTOSAR en trois modules BSW standardisés : le Crypto Service Manager (csm) dans la couche de service, la Crypto Interface (cryif) dans l'ECU Abstraction Layer ainsi qu'au moins un Crypto Driver (crypto) sur la Microcontroller Abstraction Layer (MCAL) SWS_CryptoDriver p. 15. Cet ensemble de couches abstrait totalement les applications de sécurité (par exemple SecOC, les établissements de connexion TLS et l'authentification de diagnostic UDS) des coprocesseurs cryptographiques propriétaires tels que les Hardware Security Modules (HSM) ou les Secure Hardware Extensions (SHE) SWS_SecureOnboardCommunication p. 78.

Le Crypto Service Manager (CSM) agit en tant que fournisseur de services principal pour les composants logiciels applicatifs (SW-Cs) et les modules BSW de niveau supérieur. Il met à disposition des interfaces de programmation standardisées pour les algorithmes symétriques et asymétriques (par ex. AES, RSA), le hachage, les codes d'authentification de message (MAC), la génération de nombres aléatoires (RNG) et les procédés AEAD [SWS_Csm_00980], [SWS_Csm_00982], [SWS_Csm_00984], [SWS_Csm_01023]. De plus, le CSM met en œuvre des files d'attente de jobs côté logiciel et gère la priorisation des requêtes cryptographiques parallèles [SWS_Csm_00022], SWS_CryptoServiceManager p. 29.

En tant que couche d'abstraction, la Crypto Interface (CryIf) fournit une interface 1:n uniforme entre le CSM et un nombre quelconque de pilotes cryptographiques. Sa tâche centrale est le dispatching : elle achemine les requêtes vers l'instance correspondante du Crypto Driver sur la base de canaux logiques configurés (channelId) et transforme les références logiques de clés (cryIfKeyId) en identifiants spécifiques au pilote (cryptoKeyId) [SWS_CryIf_00133], [SWS_CryIf_91003]. Le Crypto Driver encapsule l'unité d'exécution physique (Crypto Driver Object) et dessert soit des primitives cryptographiques purement logicielles, soit des modules de sécurité matériels dédiés [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 (par ex. AES / HSM) - Synchronisation NVM CryIf->CryptoDrv1 Crypto_ProcessJob() [Kanal 0] CryptoDrv2 Crypto Driver (crypto) - SW - Crypto Driver Object 1 (par ex. Software RSA) CryIf->CryptoDrv2 Crypto_ProcessJob() [Kanal 1] CryptoDrv1->CryIf CryIf_CallbackNotification() CryptoDrv2->CryIf CryIf_CallbackNotification()

Diagramme de contexte : architecture en couches et cascade d'interfaces de la pile cryptographique AUTOSAR. Sources : SWS_CryptoDriver p. 15, SWS_CryptoServiceManager p. 29

2. Interaction & voies d'interaction entre les modules

Le traitement des requêtes au sein du cluster repose principalement sur le modèle basé sur les jobs au moyen de la structure Crypto_JobType [SWS_Csm_01013], AUTOSAR_CP_SWS_CryptoServiceManager p. 21. Un job cryptographique regroupe l'ID de job, des informations de priorité, des références de clés, des métadonnées de primitives et la structure Crypto_JobPrimitiveInputOutputType pour la gestion par pointeurs des paramètres d'entrée, de sortie et de longueur [SWS_Csm_01012]. Le champ de masque de bits Crypto_OperationModeType (comportant les indicateurs START, UPDATE, FINISH) permet de commander si une requête est calculée sous la forme d'un appel unique continu (SINGLECALL) ou de manière incrémentale en mode streaming [SWS_Csm_01039], [SWS_Csm_01029].

Lorsqu'une fonction de service du CSM est appelée de manière synchrone, le CSM vérifie l'état du job. Si le pilote est libre ou si la requête est configurée comme synchrone, le CSM appelle directement CryIf_ProcessJob() [SWS_Csm_00017], [SWS_CryIf_91003]. Le CryIf mappe les ID de clés et distribue le job à l'instance de pilote assignée via Crypto_ProcessJob() [SWS_CryIf_00133]. En cas de requêtes asynchrones, le job est inséré dans la file d'attente du CSM si l'objet de pilote est occupé [SWS_Csm_00018], AUTOSAR_CP_SWS_CryptoServiceManager p. 30. À l'issue du calcul asynchrone du pilote, ce dernier déclenche CryIf_CallbackNotification() [SWS_CryIf_91013], le CryIf transmet le message à Csm_CallbackNotification() [SWS_Csm_00970], et le CSM notifie finalement l'application demandeuse via son rappel configuré [SWS_Csm_01044], [SWS_Csm_00928].

Déroulement asynchrone des ordres cryptographiques dans le cluster cryptoApplicationcsmcryifcryptoCsm_MacGenerate(jobId, mode, ...)Vérifier le job / contrôle de la file d'attentealtTreiberobjekt 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)

Diagramme de séquence : déroulement d'une requête cryptographique asynchrone avec mise en file d'attente et cascade de rappels. Sources : [SWS_Csm_00970], [SWS_CryIf_91013], AUTOSAR_CP_SWS_CryptoServiceManager p. 146

Outre l'exécution cryptographique principale, la gestion des clés constitue un chemin d'interaction à part entière du cluster SWS_CryptoDriver p. 24. Une clé se compose de plusieurs éléments de clé logiques (tels que du matériel de clé, des vecteurs d'initialisation ou des valeurs d'itération) [SWS_Csm_00954], [SWS_Csm_01022]. Les opérations telles que la définition de matériel de clé via Csm_KeyElementSet(), la copie au moyen de Csm_KeyElementCopy() ou la dérivation de clé via Csm_KeyDerive() sont transmises de manière synchrone aux fonctions du pilote par l'intermédiaire du CryIf (CryIf_KeyElementCopy(), CryIf_KeyDerive()) [SWS_Csm_00957], [SWS_Csm_00969], [SWS_CryIf_91015], [SWS_CryIf_91009]. L'accès aux éléments de clé est alors strictement contrôlé sur la base des droits d'accès configurés (CRYPTO_RA_ALLOWED, CRYPTO_RA_ENCRYPTED, CRYPTO_RA_INTERNAL_COPY) [SWS_Crypto_00219].

3. Synchronisation, réentrance et contextes de tâche

Les opérations cryptographiques varient considérablement en durée d'exécution. Alors que les chiffrements par blocs rapides ou les calculs de hachage peuvent être exécutés de manière synchrone dans le contexte de tâche de l'appelant, les calculs asymétriques (par ex. la génération de signature RSA) ou les opérations matérielles longues exigent un traitement asynchrone [SWS_Csm_00984], [SWS_Csm_00992]. Pour assurer ce découplage, le CSM fournit la fonction principale Csm_MainFunction(), appelée cycliquement [SWS_Csm_00479]. Celle-ci surveille les files d'attente, distribue les jobs en attente au CryIf et fait progresser les machines à états internes des primitives asynchrones [SWS_Csm_00019].

Dans les architectures multicœurs et multisecteurs modernes, le CSM prend en charge plusieurs instances Csm_MainFunction_<shortName>() qui sont assignées à des partitions d'OS dédiées [SWS_Csm_00479], AUTOSAR_SWS_CryptoServiceManager p. 170. En cas d'exécution asynchrone du pilote, les calculs se terminent soit par scrutation (polling) dans la MainFunction du pilote, soit par des routines de service d'interruption (ISR) de moteurs cryptographiques matériels [SWS_Crypto_00027], [SWS_Crypto_00028]. Par définition, un Crypto Driver Object individuel ne peut traiter simultanément qu'un seul job cryptographique à la fois ; un pilote doté de n objets traite n requêtes en véritable parallélisme [SWS_Crypto_00014], [SWS_Crypto_00117].

En matière de réentrance, les interfaces de service telles que Csm_MacGenerate() ou CryIf_ProcessJob() sont conçues pour être réentrantes pour des jobs différents, mais interdisent la soumission parallèle multiple d'une même instance de job [SWS_Csm_00016], [SWS_CryIf_91003]. Les fonctions de gestion des clés telles que Csm_KeyElementCopy(), CryIf_KeyElementCopy() ou Crypto_KeyCopy() sont implémentées de manière réentrante, mais ne doivent pas être appliquées de façon concurrente au même identifiant de clé source (keyId ou cryptoKeyId), afin d'éviter les incohérences de données et les conditions de concurrence [SWS_Csm_00969], [SWS_CryIf_91015], [SWS_Crypto_00155]. Les pilotes matériels utiliseraient des zones exclusives internes (Exclusive Areas) pour modifier les zones de travail internes et les registres de clés, afin d'intercepter les conditions de concurrence entre le niveau ISR et le niveau tâche SWS_CryptoDriver p. 27. Question Q-b1e9578255723a0e (ouverte)

CsmDispatchLogic Start Eintritt Csm_<Service>() CheckActive Job aktiv? (jobState == ACTIVE) Start->CheckActive CheckSync Synchroner Modus? (CRYPTO_PROCESSING_SYNC) CheckActive->CheckSync Nein DirectCall Exécuter CryIf_ProcessJob() CheckActive->DirectCall Ja (Streaming Update/Finish) CheckSync->DirectCall Ja CheckQueueEmpty CSM-Queue leer? CheckSync->CheckQueueEmpty Nein (Asynchron) CheckPrio Priorité supérieure à celle du job le plus prioritaire de la file d'attente ? 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

Diagramme d'activité : logique de décision et découplage par file d'attente lors de l'acceptation de requêtes dans le CSM. Sources : AUTOSAR_CP_SWS_CryptoServiceManager p. 30, [SWS_Csm_00017], [SWS_Csm_00018]

4. Cycles de vie et modes de fonctionnement typiques

L'initialisation du cluster cryptographique s'effectue selon un ordre hiérarchique au cours du démarrage du BSW. L'EcuM ou le BswM initialise d'abord l'étage de pilote via Crypto_Init() en lui transmettant la configuration Crypto_ConfigType [SWS_Crypto_91016], suivi de la couche d'interface via CryIf_Init() avec CryIf_ConfigType [SWS_CryIf_91118]. Enfin, le CSM est démarré au moyen de Csm_Init(), son pointeur de configuration devant toujours être défini sur NULL_PTR conformément à la spécification [SWS_Csm_00646]. Ce n'est qu'après l'initialisation complète de toutes les couches que des requêtes cryptographiques ou des accès aux clés peuvent être acceptés [SWS_CryIf_00076], [SWS_Crypto_00196].

Un aspect fondamental du cycle de vie des clés est la validation et la persistance en mémoire non volatile (NVM). Après le chargement de nouvelles valeurs de clé via Csm_KeyElementSet(), la clé demeure à l'état « incomplet ou inconnu » [SWS_Csm_00957]. Seul l'appel explicite de Csm_JobKeySetValid() ou Crypto_KeySetValid() vérifie la cohérence et fait passer l'état de la clé à valide [SWS_Csm_91027], [SWS_Crypto_91014]. Pour les clés persistées, seule cette validation déclenche l'enregistrement dans la NVM [SWS_Crypto_91026], SWS_CryptoDriver p. 37. Cela empêche de multiples cycles d'écriture fragmentés en NVM et protège contre les jeux de clés incomplets SWS_CryptoDriver p. 37. Pour la synchronisation avec le NVRAM Manager, le Crypto Driver utilise les rappels Crypto_<vi>_<ai>_NvBlock_ReadFrom_<NvBlock>() et Crypto_<vi>_<ai>_NvBlock_WriteTo_<NvBlock>() ainsi que NvM_WriteBlock() [SWS_Crypto_91024], [SWS_Crypto_91025], [SWS_Crypto_91017].

Les requêtes de streaming en cours peuvent au besoin être interrompues via Csm_SaveContextJob(), sauvegardées dans une mémoire tampon propre à l'application et reprises ultérieurement par restauration du contexte [SWS_Csm_91063], [SWS_Csm_01029]. Avant l'arrêt d'un ECU ou un passage dans des modes basse consommation, les requêtes asynchrones peuvent être annulées de manière contrôlée via Csm_CancelJob(), ce par quoi le CryIf retire les jobs des files d'attente de pilote et des canaux matériels via CryIf_CancelJob() [SWS_Csm_00968], [SWS_CryIf_91014].

5. Gestion des erreurs, traçage DET et dégradation

Le cluster implémente une stratégie de détection et de défense contre les erreurs à plusieurs niveaux. Lorsque le traçage est activé, les erreurs de développement sont directement signalées au module Default Error Tracer (DET) [SWS_Csm_91101], [SWS_Crypto_91017]. Parmi les événements DET typiques figurent les appels de module avant initialisation effective (CRYIF_E_UNINIT, CRYPTO_E_UNINIT), les paramètres de handle ou de clé non valides (CRYIF_E_PARAM_HANDLE, CRYPTO_E_PARAM_HANDLE) ainsi que la transmission de pointeurs nuls [SWS_CryIf_00076], [SWS_CryIf_00134], [SWS_Crypto_00196], [SWS_Crypto_00217].

Les surcharges au temps d'exécution et les pénuries de ressources sont interceptées de manière déterministe via des valeurs de retour définies. Si la file d'attente CSM pour une tâche asynchrone est épuisée, le CSM rejette la requête avec le code d'état CRYPTO_E_BUSY et génère l'erreur d'exécution CSM_E_QUEUE_FULL [SWS_Csm_00018], [SWS_Csm_01089]. Si un tampon de résultat fourni est dimensionné de manière insuffisante, le pilote interrompt l'opération avec CRYPTO_E_SMALL_BUFFER [SWS_Crypto_00195]. Si un service cryptographique fait référence à une clé non initialisée ou explicitement invalidée (par exemple après l'appel de Csm_JobKeySetInvalid() ou Crypto_KeySetInvalid()), les demandes de service échouent de manière contrôlée avec CRYPTO_E_KEY_NOT_VALID ou CRYPTO_E_KEY_EMPTY [SWS_Csm_91002], [SWS_CryIf_91003], [SWS_Crypto_91020].

Des mécanismes de dégradation et de repli sont rendus possibles au niveau système : les applications peuvent vérifier l'état d'intégrité des clés avant la soumission de la tâche via Csm_KeyGetStatus() [SWS_Csm_91047], [SWS_CryIf_91012]. Si un accélérateur cryptographique matériel devait être occupé en permanence ou défaillant, la configuration de canal CryIf permet une route de repli logicielle, pour autant qu'un pilote logiciel redondant soit intégré SWS_CryptoDriver p. 15.

Ce guide se base exclusivement sur la spécification AUTOSAR Classic R20-11 et a été généré par l'assistant de curation 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"

Carte des thèmes

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

Vue détaillée

Sélectionnez une entrée dans le plan.

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 fonction

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

void CryIf_Init (const CryIf_ConfigType* configPtr);
CryIf_KeyCopy fonction

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 fonction

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 fonction

Cancels the job processing from asynchronous or streaming jobs .

Csm_Decrypt fonction

Service Csm_Decrypt.

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

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 fonction

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 fonction

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 fonction

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 fonction

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 fonction

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.