Package: LSC.AES.CBC

Dependencies

with LSC.AES;
 inherit
    LSC.AES,
    LSC.Ops32;

Description

The AES-CBC cipher mode

Header

package LSC.AES.CBC is
 

Other Items:

procedure Encrypt (Context    : in     AES.AES_Enc_Context;
                   IV         : in     AES.Block_Type;
                   Plaintext  : in     AES.Message_Type;
                   Length     : in     AES.Message_Index;
                   Ciphertext :    out AES.Message_Type);
Encrypt Length elements of the Plaintext array using the AES context Context and the initialization vector IV. The result is placed into Ciphertext.
 derives
    Ciphertext from Context, IV, Plaintext, Length;
 pre
    Plaintext'First = Ciphertext'First and
    Plaintext'Last  = Ciphertext'Last and
    Plaintext'First + Length - 1 in Plaintext'Range and
    Plaintext'First + Length - 1 in AES.Message_Index and
    Ciphertext'First + Length - 1 in Ciphertext'Range and
    Ciphertext'First + Length - 1 in AES.Message_Index;

procedure Decrypt (Context    : in     AES.AES_Dec_Context;
                   IV         : in     AES.Block_Type;
                   Ciphertext : in     AES.Message_Type;
                   Length     : in     AES.Message_Index;
                   Plaintext  :    out AES.Message_Type);
Decrypt Length elements of the Ciphertext array using the AES context Context and the initialization vector IV. The result is placed into Plaintext.
 derives
    Plaintext from Context, IV, Ciphertext, Length;
 pre
    Plaintext'First = Ciphertext'First and
    Plaintext'Last  = Ciphertext'Last and
    Plaintext'First + Length - 1 in Plaintext'Range and
    Plaintext'First + Length - 1 in AES.Message_Index and
    Ciphertext'First + Length - 1 in Ciphertext'Range and
    Ciphertext'First + Length - 1 in AES.Message_Index;
end LSC.AES.CBC;