# aes.rs - source
Source of the Rust file `/home/runner/.cargo/git/checkouts/k210-hal-1069b16e3180bc3a/795ac3f/src/aes.rs`.
Keywords: rust, rustlang, rust-lang

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79

    //! (TODO) Hardware AES calculator (AES)
    use core::marker::PhantomData;
    use crate::pac::AES;

    pub struct Aes<MODE, KLEN> {
        aes: AES,
        _mode: PhantomData<MODE>,
        _klen: PhantomData<KLEN>,
    }

    pub struct Ecb;

    pub struct Cbc;

    pub struct Gcm;

    pub struct K128;

    pub struct K192;

    pub struct K256;

    #[allow(unused)] // todo: remove
    impl<MODE, KLEN> Aes<MODE, KLEN> {
        pub fn ecb128(aes: AES) -> Aes<Ecb, K128> {
            todo!()
        }

        pub fn ecb192(aes: AES) -> Aes<Ecb, K192> {
            todo!()
        }

        pub fn ecb256(aes: AES) -> Aes<Ecb, K256> {
            todo!()
        }

        pub fn cbc128(aes: AES) -> Aes<Cbc, K128> {
            todo!()
        }

        pub fn cbc192(aes: AES) -> Aes<Cbc, K192> {
            todo!()
        }

        pub fn cbc256(aes: AES) -> Aes<Cbc, K256> {
            todo!()
        }

        pub fn gcm128(aes: AES) -> Aes<Gcm, K128> {
            todo!()
        }

        pub fn gcm192(aes: AES) -> Aes<Gcm, K192> {
            todo!()
        }

        pub fn gcm256(aes: AES) -> Aes<Gcm, K256> {
            todo!()
        }
    }

    impl<MODE, KLEN> Aes<MODE, KLEN> {
        // todo: clock
        pub fn free(self) -> AES {
            self.aes
        }
    }

    #[allow(unused)] // todo: remove
    impl<MODE, KLEN> Aes<MODE, KLEN> {
        // entrypt block in-place
        pub fn encrypt_block(&self, block: &mut [u8], key: &[u8]) {
            todo!()
        }
        // decrypt block in-place
        pub fn decrypt_block(&self, block: &mut [u8], key: &[u8]) {
            todo!()
        }
    }