AUTOSAR Classic Crypto Services
دليل العنقودمولَّد بالذكاء الاصطناعي
يوفر خدمات الحساب والتشفير القياسية وإدارة المفاتيح عبر برامج تشغيل الأجهزة والبرمجيات.
يوفر خدمات الحساب والتشفير القياسية وإدارة المفاتيح عبر برامج تشغيل الأجهزة والبرمجيات.
تجمع المجموعة وحدات CSM وCryIf وCrypto Driver لتوفير خدمات التشفير ووظائف إدارة المفاتيح بشكل مستقل عن الأجهزة في AUTOSAR Classic Platform EXP_UtilizationOfCryptoServices ص. 8. يتم تحديد أولويات مهام التشفير عبر CSM، وتوجيهها في CryIf إلى قنوات منطقية، وتنفيذها بشكل متزامن أو غير متزامن في Crypto Driver [SWS_CryIf_91003]. ولأسباب تتعلق بالاتساق، لا تتم عمليات استمرار المفاتيح في NVM بصرامة إلا بعد التحقق الناجح بواسطة KeySetValid SWS_CryptoDriver ص. 37.
تشمل مجموعة الوحدات «Crypto Services & Hardware Abstraction» وحدات AUTOSAR Classic وهي Crypto Service Manager (csm)، وCrypto Interface (cryif)، وCrypto Driver (crypto) EXP_UtilizationOfCryptoServices ص. 8. وتوفر طبقة تجريد مستقلة عن الأجهزة لعمليات التشفير (بما في ذلك التشفير والتوقيعات وحساب MAC وتوليد الأرقام العشوائية) وكذلك لإدارة المفاتيح بشكل آمن [SWS_Csm_00982]، [SWS_Csm_00984]، SWS_CryptoDriver ص. 15.
يتم تغليف متطلبات التشفير كـ Crypto_JobType، والذي يحدد الأولويات، ومخازن الإدخال والإخراج المؤقتة، بالإضافة إلى أوضاع التشغيل (Start وUpdate وFinish للتدفق أو SingleCall) [SWS_Csm_01013]، [SWS_Csm_01039]. يستقبل CSM الطلبات، ويعينها لقوائم انتظار برمجية، ويمررها عبر CryIf_ProcessJob() [SWS_Csm_00017]، [SWS_CryIf_91003]. تتولى CryIf توجيه القنوات إلى برامج التشغيل وترجمة معرفات مفاتيح CSM إلى معرفات ID لمفاتيح برامج التشغيل خاصة بالوحدة [SWS_CryIf_00133].
مخطط السياق: البنية الطبقية وتسلسل الواجهات لحزمة تشفير AUTOSAR. المصادر: SWS_CryptoDriver ص. 15، SWS_CryptoServiceManager ص. 29
لمزامنة مهام التشفير غير المتزامنة، تُستخدم الدالة الدورية Csm_MainFunction()، والتي تفرغ قوائم الانتظار وتبدأ الحسابات المعلقة [SWS_Csm_00479]. بعد اكتمال حساب الأجهزة غير المتزامن، يقوم Crypto Driver بإخطار CryIf عبر CryIf_CallbackNotification()، والتي تمرر الرسالة إلى Csm_CallbackNotification() وفي النهاية إلى التطبيق المستدعي [SWS_CryIf_91013]، [SWS_Csm_00970].
مخطط التسلسل: سير عمل مهام التشفير غير المتزامنة مع وضع قائمة الانتظار وتسلسل الاستدعاءات الرجعية. المصادر: [SWS_Csm_00970]، [SWS_CryIf_91013]، AUTOSAR_CP_SWS_CryptoServiceManager ص. 146
تتم إدارة المفاتيح عبر واجهات قياسية مثل Csm_KeyElementSet() وCryIf_KeyElementCopy() مع مراعاة صارمة لحقوق الوصول المكونة [SWS_Csm_00957]، [SWS_CryIf_91015]، [SWS_Crypto_00219]. لا يتم تشغيل الاستمرار في NVM إلا عند التحقق الصريح عبر Crypto_KeySetValid()، مما يتجنب عمليات تخزين المفاتيح غير المكتملة [SWS_Crypto_91014]، SWS_CryptoDriver ص. 37. يتم اعتراض الأخطاء مثل الحمولات الزائدة أو حالات المفاتيح غير الصالحة بمتانة عبر CRYPTO_E_BUSY أو CRYPTO_E_KEY_NOT_VALID [SWS_Csm_00018]، [SWS_CryIf_91003].
1. بنية النظام ودور مجموعة الوحدات
تشكل مجموعة الوحدات «Crypto Services & Hardware Abstraction» الأساس الوظيفي لعمليات التشفير، وإدارة المفاتيح المدعومة بالبرمجيات والأجهزة، وكذلك الاتصال الآمن على متن المركبة (On-Board) في AUTOSAR Classic Platform EXP_UtilizationOfCryptoServices ص. 8. تنقسم البنية بدقة على طول نموذج طبقات AUTOSAR إلى ثلاث وحدات BSW قياسية: Crypto Service Manager (csm) في طبقة الخدمة، وCrypto Interface (cryif) في ECU Abstraction Layer، بالإضافة إلى برنامج تشغيل واحد على الأقل Crypto Driver (crypto) في Microcontroller Abstraction Layer (MCAL) SWS_CryptoDriver ص. 15. تجرد هذه المنظومة الطبقية تطبيقات الأمان (مثل SecOC، وإعداد اتصالات TLS، ومصادقة تشخيص UDS) تمامًا عن معالجات التشفير المساعدة الخاصة مثل Hardware Security Modules (HSM) أو Secure Hardware Extensions (SHE) SWS_SecureOnboardCommunication ص. 78.
يعمل Crypto Service Manager (CSM) كمزود خدمة أساسي لمكونات التطبيق (SW-Cs) ووحدات BSW ذات المستوى الأعلى. ويوفر واجهات برمجة قياسية للخوارزميات المتماثلة وغير المتماثلة (مثل AES وRSA)، والتجزئة (Hashing)، ورموز مصادقة الرسائل (MAC)، وتوليد الأرقام العشوائية (RNG)، وإجراءات AEAD [SWS_Csm_00980]، [SWS_Csm_00982]، [SWS_Csm_00984]، [SWS_Csm_01023]. بالإضافة إلى ذلك، ينفذ CSM قوائم انتظار المهام البرمجية ويتحكم في تحديد أولويات مهام التشفير المتوازية [SWS_Csm_00022]، SWS_CryptoServiceManager ص. 29.
توفر Crypto Interface (CryIf) كطبقة تجريد واجهة موحدة 1:n بين CSM وأي عدد من برامج تشغيل التشفير. وتتمثل مهمتها المركزية في التوزيع (Dispatching): إذ تقوم بإعادة توجيه المهام بناءً على القنوات المنطقية المكونة (channelId) إلى مثيل Crypto Driver المقابل، وتحول مراجع المفاتيح المنطقية (cryIfKeyId) إلى معرفات خاصة ببرنامج التشغيل (cryptoKeyId) [SWS_CryIf_00133]، [SWS_CryIf_91003]. يغلف Crypto Driver وحدة التنفيذ المادية (Crypto Driver Object) ويخدم إما أوليات تشفير برمجية بحتة أو وحدات أمان أجهزة مخصصة [SWS_Crypto_00224]، SWS_CryptoDriver ص. 15.
مخطط السياق: البنية الطبقية وتسلسل الواجهات لحزمة تشفير AUTOSAR. المصادر: SWS_CryptoDriver ص. 15، SWS_CryptoServiceManager ص. 29
2. التفاعل ومسارات الاتصال المتبادل بين الوحدات
تتم معالجة المهام داخل المجموعة بشكل أساسي عبر النموذج القائم على المهام بواسطة الهيكل Crypto_JobType [SWS_Csm_01013]، AUTOSAR_CP_SWS_CryptoServiceManager ص. 21. وتجمع مهمة التشفير بين معرف ID للمهمة، ومعلومات الأولوية، ومراجع المفاتيح، والبيانات الوصفية الأولية، والهيكل Crypto_JobPrimitiveInputOutputType لإدارة المؤشرات لمعاملات الإدخال والإخراج والطول [SWS_Csm_01012]. ومن خلال حقل قناع البتات Crypto_OperationModeType (مع العلامات START وUPDATE وFINISH)، يتم التحكم فيما إذا كان سيتم حساب المهمة كاستدعاء فردي متصل (SINGLECALL) أو تزايديًا في وضع التدفق [SWS_Csm_01039]، [SWS_Csm_01029].
إذا تم استدعاء دالة خدمة CSM بشكل متزامن، يتحقق CSM من حالة المهمة. وإذا كان برنامج التشغيل حرًا أو كانت المهمة مهيأة لتكون متزامنة، يستدعي CSM مباشرةً CryIf_ProcessJob() [SWS_Csm_00017]، [SWS_CryIf_91003]. تقوم CryIf بتعيين معرفات ID للمفاتيح وتوزع المهمة إلى مثيل برنامج التشغيل المخصص عبر Crypto_ProcessJob() [SWS_CryIf_00133]. وفي حالة الطلبات غير المتزامنة، يتم إدراج المهمة في قائمة انتظار CSM إذا كان كائن برنامج التشغيل مشغولاً [SWS_Csm_00018]، AUTOSAR_CP_SWS_CryptoServiceManager ص. 30. وبعد اكتمال حساب برنامج التشغيل غير المتزامن، يقوم برنامج التشغيل بإطلاق CryIf_CallbackNotification() [SWS_CryIf_91013]، وتمرر CryIf الرسالة إلى Csm_CallbackNotification() [SWS_Csm_00970]، وأخيرًا يخطر CSM التطبيق الطالب عبر الاستدعاء الرجعي المكون له [SWS_Csm_01044]، [SWS_Csm_00928].
مخطط التسلسل: سير عمل مهام التشفير غير المتزامنة مع وضع قائمة الانتظار وتسلسل الاستدعاءات الرجعية. المصادر: [SWS_Csm_00970]، [SWS_CryIf_91013]، AUTOSAR_CP_SWS_CryptoServiceManager ص. 146
إلى جانب تنفيذ التشفير الأساسي، تشكل إدارة المفاتيح مسار تفاعل متكامل للمجموعة SWS_CryptoDriver ص. 24. ويتكون المفتاح من عدة عناصر مفاتيح منطقية (مثل مادة المفتاح أو متجهات التهيئة أو قيم التكرار) [SWS_Csm_00954]، [SWS_Csm_01022]. وتتم إعادة توجيه عمليات مثل تعيين مادة المفتاح عبر Csm_KeyElementSet()، أو النسخ بواسطة Csm_KeyElementCopy()، أو اشتقاق المفتاح عبر Csm_KeyDerive() بشكل متزامن عبر CryIf (CryIf_KeyElementCopy()، CryIf_KeyDerive()) إلى دوال برنامج التشغيل [SWS_Csm_00957]، [SWS_Csm_00969]، [SWS_CryIf_91015]، [SWS_CryIf_91009]. وتتم مراقبة الوصول إلى عناصر المفاتيح في هذه الأثناء بصرامة بناءً على حقوق الوصول المكونة (CRYPTO_RA_ALLOWED، CRYPTO_RA_ENCRYPTED، CRYPTO_RA_INTERNAL_COPY) [SWS_Crypto_00219].
3. التزامن وإعادة الدخول وسياقات المهام
تختلف العمليات التشفيرية تفاوتًا كبيرًا في مدة تنفيذها. فبينما يمكن تنفيذ شفرات الكتل السريعة أو حسابات التجزئة بشكل متزامن في سياق مهمة المستدعي، تتطلب الحسابات غير المتماثلة (مثل توليد توقيع RSA) أو عمليات الأجهزة المستهلكة للوقت معالجة غير متزامنة [SWS_Csm_00984]، [SWS_Csm_00992]. ولفصل الارتباط، يوفر CSM الدالة الرئيسية Csm_MainFunction() التي يتم استدعاؤها دوريًا [SWS_Csm_00479]. وتقوم هذه الدالة بمراقبة قوائم الانتظار، وتوزيع المهام المعلقة إلى CryIf، وتدفع آلات الحالة الداخلية للأوليات غير المتزامنة إلى الأمام [SWS_Csm_00019].
في البنى الحديثة متعددة النوى ومتعددة القطاعات، يدعم CSM مثيلات متعددة Csm_MainFunction_<shortName>()، والتي يتم تخصيصها لأقسام OS مخصصة [SWS_Csm_00479]، AUTOSAR_SWS_CryptoServiceManager ص. 170. وعند تنفيذ برنامج التشغيل غير المتزامن، يتم إنهاء الحسابات إما عن طريق الاستقصاء (Polling) في دالة برنامج التشغيل MainFunction أو بواسطة روتينات خدمة المقاطعة (ISR) لمحركات التشفير القائمة على الأجهزة [SWS_Crypto_00027]، [SWS_Crypto_00028]. يمكن لكائن Crypto Driver Object فردي بحكم التعريف معالجة مهمة تشفير واحدة فقط بالضبط في الوقت نفسه؛ ويعالج برنامج تشغيل يحتوي على n من الكائنات n من المهام بشكل متوازٍ حقًا [SWS_Crypto_00014]، [SWS_Crypto_00117].
فيما يتعلق بإمكانية إعادة الدخول (Reentrancy)، تم تصميم واجهات الخدمة مثل Csm_MacGenerate() أو CryIf_ProcessJob() لتكون قابلة لإعادة الدخول لوظائف مختلفة، إلا أنها تمنع التكليف المتزامن المتعدد لنفس نسخة الوظيفة (Job Instance) [SWS_Csm_00016]، [SWS_CryIf_91003]. تم تنفيذ دوال إدارة المفاتيح مثل Csm_KeyElementCopy()، CryIf_KeyElementCopy() أو Crypto_KeyCopy() لتكون قابلة لإعادة الدخول، ولكن لا يجوز تطبيقها بشكل متزامن على نفس معرّف المفتاح المصدري (keyId أو cryptoKeyId)، وذلك لتجنب عدم اتساق البيانات وحالات السباق (Race Conditions) [SWS_Csm_00969]، [SWS_CryIf_91015]، [SWS_Crypto_00155]. ويُرجح أن تستخدم برامج تشغيل الأجهزة مساحات حصرية داخلية (Exclusive Areas) لتعديل مناطق العمل الداخلية وسجلات المفاتيح، بهدف اعتراض حالات السباق بين روتين خدمة المقاطعة (ISR) ومستوى المهام (Task Level) SWS_CryptoDriver ص. 27. سؤال Q-b1e9578255723a0e (مفتوح)
مخطط النشاط: منطق اتخاذ القرار وفك ارتباط قائمة الانتظار (Queuing) عند قبول الطلبات في CSM. المصادر: AUTOSAR_CP_SWS_CryptoServiceManager ص. 30، [SWS_Csm_00017]، [SWS_Csm_00018]
4. دورات الحياة النموذجية وأوضاع التشغيل
تتم تهيئة عنقود التشفير أثناء بدء تشغيل BSW بترتيب هرمي. أولاً، يقوم EcuM أو BswM بتهيئة مستوى برنامج التشغيل عبر Crypto_Init() مع تمرير التكوين Crypto_ConfigType [SWS_Crypto_91016]، تليها طبقة الواجهة عبر CryIf_Init() مع CryIf_ConfigType [SWS_CryIf_91118]. وأخيرًا، يتم بدء تشغيل CSM بواسطة Csm_Init()، حيث يجب ضبط مؤشر التكوين الخاص به دائمًا على NULL_PTR وفقًا للمواصفة [SWS_Csm_00646]. ولا يجوز قبول طلبات التشفير أو عمليات الوصول إلى المفاتيح إلا بعد التهيئة الكاملة لجميع الطبقات [SWS_CryIf_00076]، [SWS_Crypto_00196].
يُعد التحقق من الصحة واستمرار التخزين في الذاكرة غير المتطايرة (NVM) جانبًا محوريًا في دورة حياة المفتاح. بعد تحميل قيم المفاتيح الجديدة عبر Csm_KeyElementSet()، يظل المفتاح في الحالة «غير مكتمل أو غير معروف» [SWS_Csm_00957]. ولا يتحقق من الاتساق وتغيير حالة المفتاح إلى صالح إلا الاستدعاء الصريح لـ Csm_JobKeySetValid() أو Crypto_KeySetValid() [SWS_Csm_91027]، [SWS_Crypto_91014]. وبالنسبة للمفاتيح المستمرة، فإن هذا التحقق من الصحة وحده هو الذي يطلق التخزين في NVM [SWS_Crypto_91026]، SWS_CryptoDriver ص. 37. ويمنع هذا دورات كتابة NVM المجزأة المتعددة ويحمي من مجموعات المفاتيح غير المكتملة SWS_CryptoDriver ص. 37. ولمزامنة العمليات مع NVRAM Manager، يستعين برنامج تشغيل التشفير (Crypto Driver) باستدعاءات الرد (Callbacks) Crypto_<vi>_<ai>_NvBlock_ReadFrom_<NvBlock>() وCrypto_<vi>_<ai>_NvBlock_WriteTo_<NvBlock>() بالإضافة إلى NvM_WriteBlock() [SWS_Crypto_91024]، [SWS_Crypto_91025]، [SWS_Crypto_91017].
يمكن مقاطعة طلبات البث المستمر (Streaming Jobs) قيد التشغيل عند الحاجة عبر Csm_SaveContextJob()، وحفظها في مخزن مؤقت خاص بالتطبيق، واستئنافها لاحقًا عن طريق استعادة السياق [SWS_Csm_91063]، [SWS_Csm_01029]. وقبل إيقاف تشغيل وحدة التحكم الإلكترونية (ECU) أو الانتقال إلى أوضاع الطاقة المنخفضة، يمكن إلغاء الطلبات غير المتزامنة بطريقة محكومة عبر Csm_CancelJob()، مما يجعل CryIf يزيل الوظائف من قوائم انتظار برامج التشغيل وقنوات الأجهزة عبر CryIf_CancelJob() [SWS_Csm_00968]، [SWS_CryIf_91014].
5. معالجة الأخطاء، وتتبع DET، وتخفيض الأداء
يطبق العنقود استراتيجية متعددة المستويات لاكتشاف الأخطاء وتفاديها. عند تمكين التتبع، يتم الإبلاغ عن أخطاء التطوير مباشرة إلى وحدة Default Error Tracer (DET) [SWS_Csm_91101]، [SWS_Crypto_91017]. وتشمل أحداث DET النموذجية استدعاءات الوحدات قبل اكتمال التهيئة (CRYIF_E_UNINIT، CRYPTO_E_UNINIT)، ومعلمات المعرّفات (Handles) أو المفاتيح غير الصالحة (CRYIF_E_PARAM_HANDLE، CRYPTO_E_PARAM_HANDLE)، بالإضافة إلى تمرير المؤشرات الصفرية (Null Pointers) [SWS_CryIf_00076]، [SWS_CryIf_00134]، [SWS_Crypto_00196]، [SWS_Crypto_00217].
يتم اعتراض أحمال وقت التشغيل الزائدة واختناقات الموارد بشكل حتمي عبر قيم إرجاع محددة. إذا امتلأت قائمة انتظار CSM لوظيفة غير متزامنة، يرفض CSM الطلب برمز الحالة CRYPTO_E_BUSY ويولّد خطأ وقت التشغيل CSM_E_QUEUE_FULL [SWS_Csm_00018]، [SWS_Csm_01089]. وإذا كان المخزن المؤقت للنتائج المقدم ذا أبعاد غير كافية، يُلغي برنامج التشغيل العملية باستخدام CRYPTO_E_SMALL_BUFFER [SWS_Crypto_00195]. وإذا كانت خدمة التشفير تشير إلى مفتاح غير مهيأ أو مفتاح تم إبطال صلاحيته صراحةً (على سبيل المثال بعد استدعاء Csm_JobKeySetInvalid() أو Crypto_KeySetInvalid())، تفشل طلبات الخدمة بشكل محكوم باستخدام CRYPTO_E_KEY_NOT_VALID أو CRYPTO_E_KEY_EMPTY [SWS_Csm_91002]، [SWS_CryIf_91003]، [SWS_Crypto_91020].
تتوفر آليات تقليل الكفاءة التدريجي (Degradation) والمسار البديل (Fallback) على مستوى النظام: يمكن للتطبيقات التحقق من حالة سلامة المفاتيح قبل إرسال الطلب عبر Csm_KeyGetStatus() [SWS_Csm_91047]، [SWS_CryIf_91012]. وفي حال كان مسرع التشفير العتادي مشغولاً بشكل دائم أو تعرض للعطل، فإن تكوين قناة CryIf يتيح مسارًا بديلاً قائمًا على البرمجيات، بشرط دمج برنامج تشغيل برمجي فائض (Redundant) SWS_CryptoDriver ص. 15.
يستند هذا الدليل حصريًا إلى مواصفة AUTOSAR Classic R20-11 وقد تم إنشاؤه بواسطة مساعد التنظيم 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).
Crypto Interface (CryIf)
Abstracts cryptographic hardware and software acceleration engines.
Crypto Driver (Crypto)
Low-level driver executing cryptographic primitives on hardware security modules (HSM) or software libraries.
Crypto Service Manager (CSM)
Provides standardized cryptographic services (encryption, hashing, digital signatures, key management) to applications and BSW.
التهيئة والحالة
CryIf_GetVersionInfoCryIf_InitCrypto_GetVersionInfoCrypto_InitCsm_GetVersionInfoCsm_Initالخدمات · Key…
الخدمات · Job…
الخدمات · Random…
الخدمات · Cancel…
الخدمات · أخرى
CryIf_CallbackNotificationCryIf_ProcessJobCrypto_ProcessJobCsm_AEADDecryptCsm_AEADEncryptCsm_CallbackNotificationCsm_DecryptCsm_EncryptCsm_HashCsm_MacGenerateCsm_MacVerifyCsm_RestoreContextJobCsm_SaveContextJobCsm_SignatureGenerateCsm_SignatureVerifyدوال Callout والواجهات المتوقعة
<Csm_ApplicationCallbackNotification>دورية
Crypto_MainFunctionCsm_MainFunctionالأنواع
CryIf_ConfigTypeCrypto_AlgorithmFamilyTypeCrypto_AlgorithmInfoTypeCrypto_AlgorithmModeTypeCrypto_ConfigTypeCrypto_InputOutputRedirectionConfigTypeCrypto_JobPrimitiveInfoTypeCrypto_JobPrimitiveInputOutputTypeCrypto_JobRedirectionInfoTypeCrypto_JobStateTypeCrypto_JobTypeCrypto_KeyStatusTypeCrypto_OperationModeTypeCrypto_PrimitiveInfoTypeCrypto_ProcessingTypeCrypto_ResultTypeCrypto_ServiceInfoTypeCrypto_VerifyResultTypeCsm_AEADDecryptAssociatedDataTypeCsm_AEADDecryptCiphertextTypeCsm_AEADDecryptPlaintextTypeCsm_AEADDecryptTagTypeCsm_AEADEncryptAssociatedDataTypeCsm_AEADEncryptCiphertextTypeCsm_AEADEncryptPlaintextTypeCsm_AEADEncryptTagTypeCsm_ConfigIdTypeCsm_ConfigTypeCsm_DecryptDataTypeCsm_DecryptResultTypeCsm_EncryptDataTypeCsm_EncryptResultTypeCsm_HashDataTypeCsm_HashResultTypeCsm_KeyDataTypeCsm_LengthPtrCsm_MacGenerateDataTypeCsm_MacGenerateResultTypeCsm_MacVerifyCompareTypeCsm_MacVerifyDataTypeCsm_RandomGenerateResultTypeCsm_SignatureGenerateDataTypeCsm_SignatureGenerateResultTypeCsm_SignatureVerifyCompareTypeCsm_SignatureVerifyDataTypeCsm_VerifyResultPtrالدوال
<Csm_ApplicationCallbackNotification>CryIf_CallbackNotificationCryIf_CancelJobCryIf_GetVersionInfoCryIf_InitCryIf_KeyCopyCryIf_KeyDeriveCryIf_KeyElementCopyCryIf_KeyElementCopyPartialCryIf_KeyElementGetCryIf_KeyElementSetCryIf_KeyExchangeCalcPubValCryIf_KeyExchangeCalcSecretCryIf_KeyGenerateCryIf_KeyGetStatusCryIf_KeySetInvalidCryIf_KeySetValidCryIf_ProcessJobCryIf_RandomSeedCrypto_CancelJobCrypto_GetVersionInfoCrypto_InitCrypto_KeyCopyCrypto_KeyDeriveCrypto_KeyElementCopyCrypto_KeyElementCopyPartialCrypto_KeyElementGetCrypto_KeyElementIdsGetCrypto_KeyElementSetCrypto_KeyExchangeCalcPubValCrypto_KeyExchangeCalcSecretCrypto_KeyGenerateCrypto_KeyGetStatusCrypto_KeySetInvalidCrypto_KeySetValidCrypto_MainFunctionCrypto_ProcessJobCrypto_RandomSeedCsm_AEADDecryptCsm_AEADEncryptCsm_CallbackNotificationCsm_CancelJobCsm_DecryptCsm_EncryptCsm_GetVersionInfoCsm_HashCsm_InitCsm_JobKeyDeriveCsm_JobKeyExchangeCalcPubValCsm_JobKeyExchangeCalcSecretCsm_JobKeyGenerateCsm_JobKeySetInvalidCsm_JobKeySetValidCsm_JobRandomSeedCsm_KeyCopyCsm_KeyDeriveCsm_KeyElementCopyCsm_KeyElementCopyPartialCsm_KeyElementGetCsm_KeyElementSetCsm_KeyExchangeCalcPubValCsm_KeyExchangeCalcSecretCsm_KeyGenerateCsm_KeyGetStatusCsm_KeySetInvalidCsm_KeySetValidCsm_MacGenerateCsm_MacVerifyCsm_MainFunctionCsm_RandomGenerateCsm_RandomSeedCsm_RestoreContextJobCsm_SaveContextJobCsm_SignatureGenerateCsm_SignatureVerifyالأنواع
CryIf_ConfigTypeCrypto_AlgorithmFamilyTypeCrypto_AlgorithmInfoTypeCrypto_AlgorithmModeTypeCrypto_ConfigTypeCrypto_InputOutputRedirectionConfigTypeCrypto_JobPrimitiveInfoTypeCrypto_JobPrimitiveInputOutputTypeCrypto_JobRedirectionInfoTypeCrypto_JobStateTypeCrypto_JobTypeCrypto_KeyStatusTypeCrypto_OperationModeTypeCrypto_PrimitiveInfoTypeCrypto_ProcessingTypeCrypto_ResultTypeCrypto_ServiceInfoTypeCrypto_VerifyResultTypeCsm_AEADDecryptAssociatedDataTypeCsm_AEADDecryptCiphertextTypeCsm_AEADDecryptPlaintextTypeCsm_AEADDecryptTagTypeCsm_AEADEncryptAssociatedDataTypeCsm_AEADEncryptCiphertextTypeCsm_AEADEncryptPlaintextTypeCsm_AEADEncryptTagTypeCsm_ConfigIdTypeCsm_ConfigTypeCsm_DecryptDataTypeCsm_DecryptResultTypeCsm_EncryptDataTypeCsm_EncryptResultTypeCsm_HashDataTypeCsm_HashResultTypeCsm_KeyDataTypeCsm_LengthPtrCsm_MacGenerateDataTypeCsm_MacGenerateResultTypeCsm_MacVerifyCompareTypeCsm_MacVerifyDataTypeCsm_RandomGenerateResultTypeCsm_SignatureGenerateDataTypeCsm_SignatureGenerateResultTypeCsm_SignatureVerifyCompareTypeCsm_SignatureVerifyDataTypeCsm_VerifyResultPtrخريطة المواضيع
CryIf
19Crypto
20CSM
82لا توجد بيانات عناصر لهذا الإصدار
CryIf
Notifies the CRYIF about the completion of the request with the result of the cryptographic operation.
void CryIf_CallbackNotification (Crypto_JobType* job, Crypto_ResultType result);This interface dispatches the job cancellation function to the configured crypto driver object.
Std_ReturnType CryIf_CancelJob (uint32 channelId, Crypto_JobType* job);Returns the version information of this module.
void CryIf_GetVersionInfo (Std_VersionInfoType* versioninfo);Initializes the CRYIF module. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoInterface
void CryIf_Init (const CryIf_ConfigType* configPtr);This function shall co py all key elements from the source key to a target key.
Std_ReturnType CryIf_KeyCopy (uint32 cryIfKeyId, uint32 targetCryIfKeyId);This function shall dispatch th e key derive function to the configured crypto driver object.
Std_ReturnType CryIf_KeyDerive (uint32 cryIfKeyId, uint32 targetCryIfKeyId);Service CryIf_KeyElementCopy.
Std_ReturnType CryIf_KeyElementCopy (uint32 cryIfKeyId, uint32 keyElementId, uint32 targetCryIfKeyId, uint32 targetKeyElementId);This function shall dispatch the get key ele ment function to the configured crypto driver object.
Std_ReturnType CryIf_KeyElementGet (uint32 cryIfKeyId, uint32 keyElementId, uint8* resultPtr, uint32* resultLengthPtr);This function shall dispatch the set key element function to the configured crypto driver object.
Std_ReturnType CryIf_KeyElementSet (uint32 cryIfKeyId, uint32 keyElementId, const uint8* keyPtr, uint32 keyLength);This function shall dispatch the key exchange public value calculation function to the configured crypto driver object. Available
Std_ReturnType CryIf_KeyExchangeCalcPubVal (uint32 cryIfKeyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);This function shall dispatch the key exchange common shared secret calculation function to the configured crypto driver object.
Std_ReturnType CryIf_KeyExchangeCalcSecret (uint32 cryIfKeyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);This function shall dispatch the key generate function to the configured crypto driver object.
Std_ReturnType CryIf_KeyGenerate (uint32 cryIfKeyId);Returns the key state of the key identified by cry If Key Id.
Std_ReturnType CryIf_KeyGetStatus (uint32 cryIfKeyId, Crypto_KeyStatusType* keyStatusPtr);Sets invalid for the status of the key identifi ed by cry If Key Id.
Std_ReturnType CryIf_KeySetInvalid (uint32 cryIfKeyId);This function shall dispatch the set key valid function to the configured crypto driver object.
Std_ReturnType CryIf_KeySetValid (uint32 cryIfKeyId);Service CryIf_ProcessJob.
Std_ReturnType CryIf_ProcessJob (uint32 channelId, Crypto_JobType* job);This function shall dispatch the random seed function to the configured crypto driver object.
Std_ReturnType CryIf_RandomSeed (uint32 cryIfKeyId, const uint8* seedPtr, uint32 seedLength);Configuration data structure of Cry If module
Crypto
This interface removes the provided job from the queue and cancels the processing of the job if possible.
Std_ReturnType Crypto_CancelJob (uint32 objectId, Crypto_JobType* job);Returns the version information of this module.
void Crypto_GetVersionInfo (Std_VersionInfoType* versioninfo);Initializes the Crypto Driver.
void Crypto_Init (const Crypto_ConfigType* configPtr);Copies a key with all its elements to another key in the same crypto driver. Note: If the actual key element is directly mapped to flash memory, there could be a bigger delay when calling this function (synchronous operation)
Std_ReturnType Crypto_KeyCopy (uint32 cryptoKeyId, uint32 targetCryptoKeyId);Derives a new key by using the key elements in the given key identified by the crypto Key Id. The given key contains the key elements for the password, salt. The derived key is stored in the key element with the id 1 of the key identified by target Crypto Key Id. The number of iterations is given in the key element CRYPTO_ KE_ KEYDERIVATION_ ITERATIONS.
Std_ReturnType Crypto_KeyDerive (uint32 cryptoKeyId, uint32 targetCryptoKeyId);Service Crypto_KeyElementCopy.
Std_ReturnType Crypto_KeyElementCopy (uint32 cryptoKeyId, uint32 keyElementId, uint32 targetCryptoKeyId, uint32 targetKeyElementId);This interface shall be used to get a key element of the key identified by the crypto
Std_ReturnType Crypto_KeyElementGet (uint32 cryptoKeyId, uint32 keyElementId, uint8* resultPtr, uint32* resultLengthPtr);Used to retrieve information which key elements are available in a given key.
Std_ReturnType Crypto_KeyElementIdsGet (uint32 cryptoKeyId, uint32* keyElementIdsPtr, uint32* keyElementIdsLengthPtr);Sets the given key element bytes to the key identified by crypto Key Id.
Std_ReturnType Crypto_KeyElementSet (uint32 cryptoKeyId, uint32 keyElementId, const uint8* keyPtr, uint32 keyLength);Calculates the public value for the key exchange a nd stores the public key in the memory location pointed by the public value pointer.
Std_ReturnType Crypto_KeyExchangeCalcPubVal (uint32 cryptoKeyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);Calculates the shared secret key for the key exchange with the key material of the key identified by the crypto Key Id and the partner public key. The shared secret key is stored as a key element in the same key.
Std_ReturnType Crypto_KeyExchangeCalcSecret (uint32 cryptoKeyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);Generates new key material store it in the key identified by crypto Key Id.
Std_ReturnType Crypto_KeyGenerate (uint32 cryptoKeyId);Returns the key state of the key identified by crypto Key Id.
Std_ReturnType Crypto_KeyGetStatus (uint32 cryptoKeyId, Crypto_KeyStatusType* keyStatusPtr);Sets invalid for the status of the key identifi ed by crypto Key Id.
Std_ReturnType Crypto_KeySetInvalid (uint32 cryptoKeyId);Sets the key state of the key identified by crypto Key Id to valid.
Std_ReturnType Crypto_KeySetValid (uint32 cryptoKeyId);If asynchronous job processing is configured and there are job queues, the function is called cyclically to process queued jobs. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoDriver
void Crypto_MainFunction (void);Service Crypto_ProcessJob.
Std_ReturnType Crypto_ProcessJob (uint32 objectId, Crypto_JobType* job);This function generates the internal seed state using the pro vided entropy source. Furthermore, this function can be used to update the seed state with new entropy
Std_ReturnType Crypto_RandomSeed (uint32 cryptoKeyId, const uint8* seedPtr, uint32 seedLength);Configuration data structure of Cry If module
CSM
CSM notifies the application that a job has finished. The function name is configurable. The function name itself is derived from "{CSM Job/ CSM Job Primitive Callback Ref}/CSM Callback Func".
void <Csm_ApplicationCallbackNotification> (uint32 jobId, Crypto_ResultType result);Service Csm_AEADDecryptManager.
Std_ReturnType Csm_AEADDecrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* ciphertextPtr, uint32 ciphertextLength, const uint8* associatedDataPtr, uint32 associatedDataLength, const uint8* tagPtr, uint32 tagLength, uint8* plaintextPtr, uint32* plaintextLengthPtr, Crypto_VerifyResultType* verifyPtr);Service Csm_AEADEncrypt.
Notifies the CSM that a job has finished. This function is used by the underlying layer (CRYIF).
void Csm_CallbackNotification (Crypto_JobType* job, Crypto_ResultType result);Cancels the job processing from asynchronous or streaming jobs .
Std_ReturnType Csm_CancelJob (uint32 job, Crypto_OperationModeType mode);Service Csm_Decrypt.
Std_ReturnType Csm_Decrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* resultPtr, uint32* resultLengthPtr);Service Csm_Encrypt.
Std_ReturnType Csm_Encrypt (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* resultPtr, uint32* resultLengthPtr);Returns the version information of this module.
void Csm_GetVersionInfo (Std_VersionInfoType* versioninfo);Uses the given data to perform the hash calculation and stores the hash.
Std_ReturnType Csm_Hash (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* resultPtr, uint32* resultLengthPtr);Initializes the CSM module. In configurations, in which CSM is assigned to more than one partition (i.e. Csm_ Main Functions are mapped to partitions), CSM may provide one init function per partition.
void Csm_Init (const Csm_ConfigType* configPtr);Derives a new key by using the key elements in the given key identified by the key Id. The given key contains the key elements for the password and salt. The derived key is stored in the key element with the id 1 of the key identified by target Crypto
Std_ReturnType Csm_JobKeyDerive (uint32 jobId, uint32 keyId, uint32 targetKeyId);Calculates the public value of the current user for the key exchange and stores the
Std_ReturnType Csm_JobKeyExchangeCalcPubVal (uint32 jobId, uint32 keyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);Calculates the shared secret key for the key exchange with the key material of the key identified by the key Id and the partner public key. The shared secret key is stored as a key element in the same key.
Std_ReturnType Csm_JobKeyExchangeCalcSecret (uint32 jobId, uint32 keyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);Generates new key material and stores it in the key identified by key Id.
Std_ReturnType Csm_JobKeyGenerate (uint32 jobId, uint32 keyId);Sets the key status to invalid. The key cannot be used any longer for cryptographic operations until it has been set to valid state again.
Std_ReturnType Csm_JobKeySetInvalid (uint32 jobId, uint32 keyId);Stores the key if necessary and sets the key state of the key identified by key Id to valid.
Std_ReturnType Csm_JobKeySetValid (uint32 jobId, uint32 keyId);Provides a new seed for the specified key that is used for an associated random number generator.
Std_ReturnType Csm_JobRandomSeed (uint32 jobId, uint32 keyId, const uint8* seedPtr, Manager uint32 seedLength);This function shall copy all key elements from the source key to a target key. Ava ilable via Csm.h
Std_ReturnType Csm_KeyCopy (const uint32 keyId, const uint32 targetKeyId);Derives a new key by using the key elements in the given key identified by the key Id. The given key contains the key elements for the password and salt. The derived key is stored in the k ey element with the id 1 of the key identified by target Crypto Key Id.
Std_ReturnType Csm_KeyDerive (uint32 keyId, uint32 targetKeyId);Service Csm_KeyElementCopyManager.
Std_ReturnType Csm_KeyElementCopy (const uint32 keyId, const uint32 keyElementId, const uint32 targetKeyId, const uint32 targetKeyElementId);Service Csm_KeyElementGet.
Std_ReturnType Csm_KeyElementGet (uint32 keyId, uint32 keyElementId, uint8* keyElementPtr, Manager uint32* keyElementLengthPtr);Sets the given key element bytes to the key identified by key Id.
Std_ReturnType Csm_KeyElementSet (uint32 keyId, uint32 keyElementId, const uint8* keyElementPtr, uint32 keyElementLength);Calculates the public value of the current user for the key exchange and stores the pub lic key in the memory location pointed by the public value pointer.
Std_ReturnType Csm_KeyExchangeCalcPubVal (uint32 keyId, uint8* publicValuePtr, uint32* publicValueLengthPtr);Calculates the shared secret key for the key exchange with the key material of the key identified by the key Id and the partner public key. The shared secret key is stored as a key element in the same key.
Std_ReturnType Csm_KeyExchangeCalcSecret (uint32 keyId, const uint8* partnerPublicValuePtr, uint32 partnerPublicValueLength);Generates new key material and store it in the key identified by key Id.
Std_ReturnType Csm_KeyGenerate (uint32 keyId);Returns the key state of the key identified by key Id.
Std_ReturnType Csm_KeyGetStatus (uint32 keyId, Crypto_KeyStatusType* keyStatusPtr);Sets the key status to invalid. The key cannot be used any longer for cryptographic operations until it has been set to valid state again.
Std_ReturnType Csm_KeySetInvalid (uint32 keyId);Sets the key state of the key identified by key Id to valid.
Std_ReturnType Csm_KeySetValid (uint32 keyId);Service Csm_MacGenerate.
Std_ReturnType Csm_MacGenerate (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* macPtr, uint32* macLengthPtr);Service Csm_MacVerify.
Std_ReturnType Csm_MacVerify (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, const uint8* macPtr, const uint32 macLength, Crypto_VerifyResultType* verifyPtr);API to be called cyclically to process the requested jobs. The Csm_ Main Function shall check the queues for jobs to pass to the underlying CRYIF. Per configured CSM Main Function ins tance one Csm_ Main Function_ shall be implemented. Hereby is the short name of the CSM Main Function configuration container in the ECU configuration.
void Csm_MainFunction (void);Generate a random number and stores it in the memory location pointed by th e result pointer.
Std_ReturnType Csm_RandomGenerate (uint32 jobId, uint8* resultPtr, uint32* resultLengthPtr);Feeds the key element CRYPTO_ KE_ RANDOM_ SEED with a random seed. Manager AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoServiceManager
Std_ReturnType Csm_RandomSeed (uint32 keyId, const uint8* seedPtr, uint32 seedLength);The Crypto Driver extracts the context data from the context Buffer and restores the internal state so that further crypto operation of this crypto service will continue at the exact point when the context was taken.
Std_ReturnType Csm_RestoreContextJob (uint32 jobId, uint8* contextBufferPtr, uint32 contextBufferLength);The Crypto Driver stores the internal context of the respective crypto operation to the context Buffer.
Std_ReturnType Csm_SaveContextJob (uint32 jobId, uint8* contextBufferPtr, uint32* contextBufferLengthPtr);Service Csm_SignatureGenerate.
Std_ReturnType Csm_SignatureGenerate (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, uint8* signaturePtr, uint32* signatureLengthPtr);Service Csm_SignatureVerify.
Std_ReturnType Csm_SignatureVerify (uint32 jobId, Crypto_OperationModeType mode, const uint8* dataPtr, uint32 DataLength, const uint8* signaturePtr, uint32 signatureLength, Crypto_VerifyResultType* verifyPtr);Type Crypto_AlgorithmFamilyType.
Structure which determines the exact algorithm. Note, not every algorithm needs to specify all fields. AUTOSAR shall only allow valid combinations.
Type Crypto_AlgorithmModeType.
Defines which of the input/ output parameters are re - directed to a key element. The values can be combined to define a bit field.
Structure which contains further information, which depends on the job and the crypto primitive.
Type Crypto_JobPrimitiveInputOutputType.
Type Crypto_JobRedirectionInfoType.
Enumeration of the current job state.
Structure which contains further information, which depends on the job and the crypto primitive.
Enumeration for key status.
Enume ration which operation shall be performed. This enumeration is constructed from a bit mask, where the first bit indicates "Start", the second "Update" and the third "Finish".
Structure which contains basic information about the crypto primitive. Manager AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_CryptoServiceManager
Enumeration of the processing type.
Return for Std_ Return Type for Cryptostack.
Enumeration of the kind of the service.
Enumeration of the result type of verification operations.
Array long enough to store the data of the header.
Array long enough to store the ciphertext to be decrypted with AEAD.
Array long enough to store the data of the plaintext.
Array long enough to store the data of the Tag.
Array long enough to store the data of the header.
Array long enough to store the data of the cipher.
Array long enough to store the plaintext to be encrypted with AEAD.
Array long enough to store the data of the Tag.
Identification of a CSM service configuration via a numeric identifier, that is unique within a service. The name of a CSM service configuration, i.e. the name of the container Csm_Config, shall serve as a symbolic name for this parameter Avail able via Csm.h
Configuration data structure of CSM module
Array long enough to store the data to be decrypted.
Array long enough to store the data of the decrypted plaintext.
Array long enough to store the data to be encrypted.
Array long enough to store the data of the cipher.
Array long enough to store the data which shall be hashed.
Array long enough to store the data of the hash.
Array long enough to store any key element of the considered key
Implementation Data Type of category DATA_ REFERENCE with the pointer target uint32 to be able to return asynchronously the length.
Array long enough to store the data from which a MAC shall be generated.
Array long enough to store the data of the MAC.
Array long enough to store a MAC to be verified.
Array long enough to store the data for whichs MAC shall be verified.
Array long enough to store the data of the random number.
Array long enough to store the data from which the signature shall be generated.
Array long enough to store the signature and its length.
Array long enough to store a signature to be verified.
Array long enough to store the data for whichs signature shall be verified.
Implementation Data Type of category DATA_ REFERENCE with the pointer target Csm_ Verify Result Type to be able to return asynchronously the verify result.
gemini-3.8-flash-low· 2026-10-13 · الأصل الألماني