Skip to content

Block Cipher Mode of Operation (BCMO)

Snoopy87 edited this page Jan 22, 2018 · 2 revisions

Overview

Block cipher mode of operation ca be used with any symmetric algorithms implemented with the SymmetricCryptoBlockIO interface.

Interface BCMO_Std

Interface Signal Description
cmd Stream valid/ready Bool Stream handshake
key Bits The key used for the encryption/decryption
iv* Bits Initialization Vector
block Bits The block message to encrypt/decrypt
enc* Bool Mode encrypt (1) or decrypt (0)
mode BCMO_Std_CmdMode INIT/UPDATE
rsp Flow valid Bool Data valid

*this signal is optional

Block Cipher Mode of Operation

Electronic Codebook (ECB)

import spinal.core._
import spinal.lib._
import spinal.crypto.symmetric.des.DESCore_Std
import spinal.crypto.symmetric._

val core     = new DESCore_Std()
val chaining = ECB_Std(core.io.g, ENC_DEC)
chaining.io.core <> core.io
chaining.io.bcmo <> ...

Cipher Block Chaining (CBC)

import spinal.core._
import spinal.lib._
import spinal.crypto.symmetric.des.DESCore_Std
import spinal.crypto.symmetric._

val core     = new DESCore_Std()
val chaining = CBC_Std(core.io.g, ENC_DEC)
chaining.io.core <> core.io
chaining.io.bcmo <> ...

Output Feedback (OFB)

import spinal.core._
import spinal.lib._
import spinal.crypto.symmetric.des.DESCore_Std
import spinal.crypto.symmetric._

val core     = new DESCore_Std()
val chaining = OFB_Std(core.io.g, chainingMode = ENC_DEC, algoMode = ENCRYPT) 
chaining.io.core <> core.io
chaining.io.bcmo <> ...

Cipher Feedback (CFB)

import spinal.core._
import spinal.lib._
import spinal.crypto.symmetric.des.DESCore_Std
import spinal.crypto.symmetric._

val core     = new DESCore_Std()
val chaining = CFB_Std(core.io.g, chainingMode = ENC_DEC, algoMode = ENCRYPT) 
chaining.io.core <> core.io
chaining.io.bcmo <> ...