Skip to content

OpenTitan_AES: Add AES CBC mode support#206

Open
rknastenka wants to merge 1 commit into
renode:masterfrom
rknastenka:aes-cbc-support
Open

OpenTitan_AES: Add AES CBC mode support#206
rknastenka wants to merge 1 commit into
renode:masterfrom
rknastenka:aes-cbc-support

Conversation

@rknastenka

Copy link
Copy Markdown

Description

This PR introduces Cipher Block Chaining (CBC) mode support to the OpenTitan_AES peripheral. It implements initialization vector (IV) register handling and proper integration with the underlying .NET cryptography engine.

Dependency Note

⚠️ Important: This PR is stacked directly on top of my previous bug fix in PR #205 (which addresses the underlying 128-bit vs 256-bit key-slicing issue outlined in Issue renode/renode#914).

Changes

  • OpenTitan_AES.cs:
    • Added CipherBlockChaining mode handling inside ConfigureAES().
    • Implemented internal IV tracking and automated register processing.
    • Explicitly configured PaddingMode.None to ensure hardware-accurate block alignment.
  • OpenTitan_AES_Test.cs:
    • Added comprehensive 128-bit CBC test vector verification (ShouldEncryptInCBCModeWithNistVector) using official NIST SP 800-38A Example F.2.1 vectors.

How Has This Been Tested?

Ran the full OpenTitan_AES_Tests suite locally using the Release configuration:

dotnet test src/Infrastructure/src/Emulator/Peripherals/Test/PeripheralsTests/PeripheralsTests.csproj -c Release --filter "FullyQualifiedName~OpenTitan_AES_Tests" -p:SignAssembly=false
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant