46 void ( *
final ) (
void *
ctx,
void *
out );
89 void ( *
setiv ) (
void *
ctx,
const void *
iv,
size_t ivlen );
202 const void *
data,
size_t len ) {
213 const void *
key,
size_t keylen ) {
219 const void *
iv,
size_t ivlen ) {
225 const void *
src,
void *dst,
size_t len ) {
228 #define cipher_encrypt( cipher, ctx, src, dst, len ) do { \ 229 assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 ); \ 230 cipher_encrypt ( (cipher), (ctx), (src), (dst), (len) ); \ 235 const void *
src,
void *dst,
size_t len ) {
238 #define cipher_decrypt( cipher, ctx, src, dst, len ) do { \ 239 assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 ); \ 240 cipher_decrypt ( (cipher), (ctx), (src), (dst), (len) ); \ 267 return pubkey->
encrypt (
key, plaintext, ciphertext );
274 return pubkey->
decrypt (
key, ciphertext, plaintext );
300 const void *
base,
const void *scalar,
void *
result ) {
int(* multiply)(const void *base, const void *scalar, void *result)
Multiply scalar by curve point.
int pubkey_null_verify(const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature)
static int is_auth_cipher(struct cipher_algorithm *cipher)
size_t blocksize
Block size.
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
void(* decrypt)(void *ctx, const void *src, void *dst, size_t len)
Decrypt data.
static int elliptic_multiply(struct elliptic_curve *curve, const void *base, const void *scalar, void *result)
struct cipher_algorithm cipher_null
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
void(* init)(void *ctx)
Initialise digest.
size_t alignsize
Alignment size.
void cipher_null_setiv(void *ctx, const void *iv, size_t ivlen)
struct golan_eq_context ctx
int pubkey_null_sign(const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *signature)
void(* final)(void *ctx, void *out)
Finalise digest.
u8 iv[16]
Initialization vector.
static int pubkey_match(struct pubkey_algorithm *pubkey, const struct asn1_cursor *private_key, const struct asn1_cursor *public_key)
struct digest_algorithm digest_null
void cipher_null_auth(void *ctx, void *auth)
void(* encrypt)(void *ctx, const void *src, void *dst, size_t len)
Encrypt data.
#define cipher_encrypt(cipher, ctx, src, dst, len)
size_t authsize
Authentication tag size.
size_t blocksize
Block size.
static int pubkey_sign(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *signature)
void(* setiv)(void *ctx, const void *iv, size_t ivlen)
Set initialisation vector.
void digest_null_update(void *ctx, const void *src, size_t len)
pseudo_bit_t value[0x00020]
int(* verify)(const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature)
Verify signed digest value.
void(* update)(void *ctx, const void *src, size_t len)
Update digest with new data.
struct pubkey_algorithm pubkey_null
const char * name
Curve name.
int(* match)(const struct asn1_cursor *private_key, const struct asn1_cursor *public_key)
Check that public key matches private key.
static void digest_init(struct digest_algorithm *digest, void *ctx)
size_t keysize
Scalar (and private key) size.
void cipher_null_encrypt(void *ctx, const void *src, void *dst, size_t len)
static void cipher_setiv(struct cipher_algorithm *cipher, void *ctx, const void *iv, size_t ivlen)
void(* auth)(void *ctx, void *auth)
Generate authentication tag.
int(* decrypt)(const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext)
Decrypt.
static int is_stream_cipher(struct cipher_algorithm *cipher)
size_t ctxsize
Context size.
#define cipher_decrypt(cipher, ctx, src, dst, len)
int pubkey_null_decrypt(const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext)
void digest_null_final(void *ctx, void *out)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static int pubkey_verify(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature)
size_t ctxsize
Context size.
static int pubkey_encrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext)
int(* setkey)(void *ctx, const void *key, size_t keylen)
Set key.
size_t digestsize
Digest size.
const char * name
Algorithm name.
int cipher_null_setkey(void *ctx, const void *key, size_t keylen)
void cipher_null_decrypt(void *ctx, const void *src, void *dst, size_t len)
int(* encrypt)(const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext)
Encrypt.
A message digest algorithm.
uint8_t data[48]
Additional event data.
void digest_null_init(void *ctx)
static void cipher_auth(struct cipher_algorithm *cipher, void *ctx, void *auth)
int pubkey_null_encrypt(const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext)
const char * name
Algorithm name.
size_t pointsize
Point (and public key) size.
u8 signature
CPU signature.
struct private_key private_key
Private key.
int(* sign)(const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *builder)
Sign digest value.
static int pubkey_decrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext)
const char * name
Algorithm name.
static int cipher_setkey(struct cipher_algorithm *cipher, void *ctx, const void *key, size_t keylen)
static int is_block_cipher(struct cipher_algorithm *cipher)