summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/dev/sdc_crypto.h
blob: 176483ad160f7544f6d666f15d9c5dbb823e04bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stddef.h>
#include <stdint.h>

typedef void (*eos_sdcc_init_t) (void *, uint8_t *);
typedef void (*eos_sdcc_crypt_t) (void *, uint8_t *, uint8_t *, size_t);
typedef void (*eos_sdcc_essiv_t) (void *, uint8_t *);

typedef struct EOSSDCCrypto {
    void *ctx;
    eos_sdcc_crypt_t enc;
    eos_sdcc_crypt_t dec;
    void *ctx_essiv;
    eos_sdcc_essiv_t enc_essiv;
} EOSSDCCrypto;

void eos_sdcc_init(EOSSDCCrypto *crypto, uint8_t *key, void *ctx, eos_sdcc_init_t init, eos_sdcc_crypt_t enc, eos_sdcc_crypt_t dec, void *ctx_essiv, eos_sdcc_init_t init_essiv, eos_sdcc_essiv_t enc_essiv);
void eos_sdc_encrypt(uint32_t sect, uint8_t *buffer);
void eos_sdc_decrypt(uint32_t sect, uint8_t *buffer);