DEENESPTFRRUARHIKOZHNL

struct ara::crypto::SecureCounter

[SWS_CRYPT_30001] Upstream: RS_CRYPTO_02401

struct SecureCounter {...};

128 bit secure counter made up of two uint64_t’s representing the most significant and least significant bits

Header-Datei#include "ara/crypto/common/base_id_types.h"
Forwarding-Header#include "ara/crypto/crypto_fwd.h"
Scopenamespace ara::crypto

User GuideAI-GENERATED

Provides a 128-bit secure counter composed of two 64-bit values for low-order and high-order bits.
AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: b4749477e882 Provenance Open questions (3)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Provides a 128-bit secure counter composed of two 64-bit values for low-order and high-order bits.

The structure ara::crypto::SecureCounter serves in module crypto as a 128-bit secure counter consisting of two 64-bit integers for the least significant bits ([SWS_CRYPT_30002]) and the most significant bits ([SWS_CRYPT_30003]). Calling components use this data type to represent robust counter values, whereby incrementations and carry logics between the subwords must be controlled manually. As a pure value type, the structure provides no internal synchronization, which is why concurrent accesses in multithreading environments must strictly be coordinated externally.

Context

The structure ara::crypto::SecureCounter functions within module crypto of the AUTOSAR Adaptive Platform as a fundamental data type for representing a 128-bit wide cryptographic counter. Defined in the header file ara/crypto/common/base_id_types.h, the data structure is composed of two 64-bit integers of type std::uint64_t: the data element mLSQW for the least significant 64 bits according to [SWS_CRYPT_30002] and the data element mMSQW for the most significant 64 bits according to [SWS_CRYPT_30003]. In security architectures, counter values of this magnitude serve to ensure the temporal freshness of messages and effectively counter replay attacks. Interpretation: As a standardized data type, the structure is likely to serve primarily as an interface and storage format for monotonic counters or sequence numbers exchanged by cryptographic protocols, drivers, and hardware-oriented security components. Question Q-57197e2ecabd5cab (open) Since the specification declares ara::crypto::SecureCounter as a pure data container without direct algorithmic binding, higher-level layers interact directly with the two member components to check, persist, or embed counter values into protocol messages.

Lifecycle

As a classic C++ structure (struct), ara::crypto::SecureCounter is subject to a lightweight lifecycle without dynamic memory management or stateful management logic. Instantiation usually takes place directly on the stack as a local value type or embedded as a field element in higher-level contexts such as security event headers or cryptographic session descriptors. As a simple data container, the structure presumably exhibits regular C++ value semantics with implicit copy and assignment behavior, but provides no internal synchronization mechanisms for concurrent access. Question Q-a4d95542ea77870d (open) For developers, this means that simultaneous read and write accesses from different threads must be protected by external synchronization primitives to prevent data inconsistencies during counter updates. The lifecycle of an instance ends automatically upon leaving the respective scope, with no explicit releases or cleanups being necessary.

Usage Path

The typical usage path comprises initialization, step-by-step incrementation, and reading of the combined 128-bit counter value via the two structural components. A caller first instantiates the structure and assigns the initial counter values to the low-order subword mLSQW ([SWS_CRYPT_30002]) and the high-order subword mMSQW ([SWS_CRYPT_30003]). During continuous counting operations, primarily the low-order word mLSQW is incremented. When mLSQW reaches the maximum value of the 64-bit range, a computational carry-over occurs to the high-order word mMSQW, which is increased by one. Interpretation: Arithmetic operations such as incrementation and carry handling are likely to be implemented on the caller side, since the specification declares no member functions of its own for ara::crypto::SecureCounter. Question Q-68babc70b53a5745 (open) During transmission or persistence, the two 64-bit members are serialized in a structured manner, whereby attention must be paid to consistent byte and word order in order to preclude misinterpretations of the overall value on the receiver side.

Error Scenarios

Since ara::crypto::SecureCounter represents a pure data structure without member functions of its own, the structure neither throws exceptions nor returns error specifications or error codes of type ara::core::ErrorCode during operations. Consequently, error scenarios do not arise within the structure itself, but through incorrect handling of the two subwords in the calling software layers. A critical error scenario is an unnoticed arithmetic overflow of the overall counter when both mLSQW ([SWS_CRYPT_30002]) and mMSQW ([SWS_CRYPT_30003]) exhaust their maximum value range and wrap around to zero, which can lead to security vulnerabilities in replay protection mechanisms. Further pre- and postcondition violations occur if the carry from mLSQW to mMSQW is missed during updates, or if undefined memory values enter calculations due to incomplete initialization. Calling components must therefore ensure prior to further processing that both data elements are initialized consistently and that carry logics are implemented correctly.

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

UML class diagram

Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.

G nara__crypto__SecureCounter126 «struct» SecureCounter + mLSQW + mMSQW

Constants

mLSQW variable

least significant 64 bits

mMSQW variable

most significant 64 bits

Documentation of constants / variables

variable mLSQW [SWS_CRYPT_30002] Upstream: RS_CRYPTO_02401

std::uint64_t mLSQW;

least significant 64 bits

Header-Datei#include "ara/crypto/common/base_id_types.h"
Scopestruct ara::crypto::SecureCounter
SymbolmLSQW
Typstd::uint64_t

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

Record
AUTOSAR/AP/record/SWS_CRYPT_30002
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_30002@rel:R25-11#cc293c04
Content hash
cc293c04
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_30002
Status: valid/unmigrated Version: rel:R25-11#9c1bba58 Versionshistorie & Revisions (1 transition, 8 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CRYPT_30002@rel:R25-11#9c1bba58
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#cc293c042026-09-30
  • R19-11rel:R19-11#5e8b1de42026-10-14
  • R20-11rel:R20-11#2cbc47402026-10-14
  • R21-11rel:R21-11#2cbc47402026-10-14
  • R22-11rel:R22-11#7b43d24b2026-10-14
  • R23-11rel:R23-11#2949b7102026-10-14
  • R24-11rel:R24-11#2949b7102026-10-14
  • R25-11rel:R25-11#9c1bba582026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

variable mMSQW [SWS_CRYPT_30003] Upstream: RS_CRYPTO_02401

std::uint64_t mMSQW;

most significant 64 bits

Header-Datei#include "ara/crypto/common/base_id_types.h"
Scopestruct ara::crypto::SecureCounter
SymbolmMSQW
Typstd::uint64_t

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

Record
AUTOSAR/AP/record/SWS_CRYPT_30003
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CRYPT_30003@rel:R25-11#2c3bfe79
Content hash
2c3bfe79
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Cryptography.pdf#nameddest=SWS_CRYPT_30003
Status: valid/unmigrated Version: rel:R25-11#f08f9154 Versionshistorie & Revisions (1 transition, 8 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CRYPT_30003@rel:R25-11#f08f9154
Point-in-Time History:
Recorded Revisions (8):
  • R25-11rel:R25-11#2c3bfe792026-09-30
  • R19-11rel:R19-11#5f040e0b2026-10-14
  • R20-11rel:R20-11#df9cc1732026-10-14
  • R21-11rel:R21-11#64ce58302026-10-14
  • R22-11rel:R22-11#f838a21c2026-10-14
  • R23-11rel:R23-11#e9d5ab982026-10-14
  • R24-11rel:R24-11#0cbd132d2026-10-14
  • R25-11rel:R25-11#f08f91542026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill