#ifndef _CORECRYPTO_CCMODE_IMPL_H_
#define _CORECRYPTO_CCMODE_IMPL_H_
#include <corecrypto/cc.h>
cc_aligned_struct(16) ccecb_ctx;
struct ccmode_ecb {
size_t size;
unsigned long block_size;
void (*init)(const struct ccmode_ecb *ecb, ccecb_ctx *ctx,
unsigned long key_len, const void *key);
void (*ecb)(const ccecb_ctx *ctx, unsigned long nblocks, const void *in,
void *out);
};
cc_aligned_struct(16) cccbc_ctx;
cc_aligned_struct(16) cccbc_iv;
struct ccmode_cbc {
size_t size;
unsigned long block_size;
void (*init)(const struct ccmode_cbc *cbc, cccbc_ctx *ctx,
unsigned long key_len, const void *key);
void (*cbc)(const cccbc_ctx *ctx, cccbc_iv *iv, unsigned long nblocks,
const void *in, void *out);
const void *custom;
};
cc_aligned_struct(16) cccfb_ctx;
struct ccmode_cfb {
size_t size;
unsigned long block_size;
void (*init)(const struct ccmode_cfb *cfb, cccfb_ctx *ctx,
unsigned long key_len, const void *key,
const void *iv);
void (*cfb)(cccfb_ctx *ctx, unsigned long nblocks,
const void *in, void *out);
const void *custom;
};
cc_aligned_struct(16) cccfb8_ctx;
struct ccmode_cfb8 {
size_t size;
unsigned long block_size;
void (*init)(const struct ccmode_cfb8 *cfb8, cccfb8_ctx *ctx,
unsigned long key_len, const void *key,
const void *iv);
void (*cfb8)(cccfb8_ctx *ctx, unsigned long nbytes,
const void *in, void *out);
const void *custom;
};
cc_aligned_struct(16) ccctr_ctx;
struct ccmode_ctr {
size_t size;
unsigned long block_size;
void (*init)(const struct ccmode_ctr *ctr, ccctr_ctx *ctx,
unsigned long key_len, const void *key,
const void *iv);
void (*ctr)(ccctr_ctx *ctx, unsigned long nblocks,
const void *in, void *out);
const void *custom;
};
cc_aligned_struct(16) ccofb_ctx;
struct ccmode_ofb {
size_t size;
unsigned long block_size;
void (*init)(const struct ccmode_ofb *ofb, ccofb_ctx *ctx,
unsigned long key_len, const void *key,
const void *iv);
void (*ofb)(ccofb_ctx *ctx, unsigned long nblocks,
const void *in, void *out);
const void *custom;
};
cc_aligned_struct(16) ccxts_ctx;
cc_aligned_struct(16) ccxts_tweak;
struct ccmode_xts {
size_t size;
size_t tweak_size;
unsigned long block_size;
void (*init)(const struct ccmode_xts *xts, ccxts_ctx *ctx,
unsigned long key_len, const void *key,
const void *tweak_key);
void (*set_tweak)(const ccxts_ctx *ctx, ccxts_tweak *tweak, const void *iv);
void *(*xts)(const ccxts_ctx *ctx, ccxts_tweak *tweak, unsigned long nblocks,
const void *in, void *out);
const void *custom;
const void *custom1;
};
cc_aligned_struct(16) ccgcm_ctx;
struct ccmode_gcm {
size_t size;
unsigned long block_size;
void (*init)(const struct ccmode_gcm *gcm, ccgcm_ctx *ctx,
unsigned long key_len, const void *key);
void (*set_iv)(ccgcm_ctx *ctx, size_t iv_size, const void *iv);
void (*gmac)(ccgcm_ctx *ctx, unsigned long nbytes, const void *in); void (*gcm)(ccgcm_ctx *ctx, unsigned long nbytes, const void *in, void *out);
void (*finalize)(ccgcm_ctx *key, size_t tag_size, void *tag);
void (*reset)(ccgcm_ctx *ctx);
const void *custom;
};
cc_aligned_struct(16) ccomac_ctx;
struct ccmode_omac {
size_t size;
unsigned long block_size;
void (*init)(const struct ccmode_omac *omac, ccomac_ctx *ctx,
unsigned long tweak_len, unsigned long key_len,
const void *key);
int (*omac)(ccomac_ctx *ctx, unsigned long nblocks,
const void *tweak, const void *in, void *out);
const void *custom;
};
#endif