aboutsummaryrefslogblamecommitdiff
path: root/src/cc20rng/cc20_prng.h
blob: 08f78d767315d50ad0dbd47eb1c15c458ec041c8 (plain) (tree)
1
2
3
4
5
6
7
8
9




                          

                                                           

                   








                                              

  

                                                              

                               
#ifndef __STM32_CHACHA20_H
#define __STM32_CHACHA20_H

#include <stdint.h>

#define CHACHA20_BLOCK_SIZE_WORDS 16
#define CHACHA20_BLOCK_SIZE (CHACHA20_BLOCK_SIZE_WORDS * 4)

struct cc20_state {
    union {
        struct {
            uint32_t constant[4];
            uint32_t key[8];
            uint32_t counter;
            uint32_t nonce[3];
        } s;
        uint32_t i[CHACHA20_BLOCK_SIZE_WORDS];
    };
};

void chacha20_prng_block(struct cc20_state *cc, uint8_t *out);
int chacha20_prng_self_test();

#endif /* __STM32_CHACHA20_H */