44 const void *
src,
size_t len );
94 const void *
key,
size_t keylen );
104 const void *
iv,
size_t ivlen );
116 const void *
src,
void *dst,
size_t len );
128 const void *
src,
void *dst,
size_t len );
228 const void *
private,
void *public );
239 const void *
private,
const void *
partner,
278 const void *scalar,
void *
result );
288 const void *augend,
void *
result );
300 const void *
data,
size_t len ) {
311 const void *
key,
size_t keylen ) {
317 const void *
iv,
size_t ivlen ) {
318 return cipher->
setiv ( cipher,
ctx,
iv, ivlen );
323 const void *
src,
void *dst,
size_t len ) {
326#define cipher_encrypt( cipher, ctx, src, dst, len ) do { \
327 assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 ); \
328 cipher_encrypt ( (cipher), (ctx), (src), (dst), (len) ); \
333 const void *
src,
void *dst,
size_t len ) {
336#define cipher_decrypt( cipher, ctx, src, dst, len ) do { \
337 assert ( ( (len) & ( (cipher)->blocksize - 1 ) ) == 0 ); \
338 cipher_decrypt ( (cipher), (ctx), (src), (dst), (len) ); \
343 cipher->
auth ( cipher,
ctx, auth );
365 return pubkey->
encrypt ( pubkey,
key, plaintext, ciphertext );
372 return pubkey->
decrypt ( pubkey,
key, ciphertext, plaintext );
399 return exchange->
share ( exchange,
private,
public );
404 const void *
partner,
void *shared ) {
405 return exchange->
agree ( exchange,
private,
partner, shared );
415 const void *
base,
const void *scalar,
void *
result ) {
421 const void *augend,
void *
result ) {
422 return curve->
add ( curve, addend, augend,
result );
427 const void *
src,
size_t len );
432 const void *
key,
size_t keylen );
434 const void *
iv,
size_t ivlen );
436 const void *
src,
void *dst,
size_t len );
438 const void *
src,
void *dst,
size_t len );
struct golan_eq_context ctx
u8 signature
CPU signature.
union @162305117151260234136356364136041353210355154177 key
pseudo_bit_t value[0x00020]
struct cipher_algorithm cipher_null
struct pubkey_algorithm pubkey_null
struct digest_algorithm digest_null
uint8_t data[48]
Additional event data.
struct eth_slow_lacp_entity_tlv partner
Partner information.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
static int is_block_cipher(struct cipher_algorithm *cipher)
int pubkey_null_match(struct pubkey_algorithm *pubkey, const struct asn1_cursor *private_key, const struct asn1_cursor *public_key)
static int pubkey_match(struct pubkey_algorithm *pubkey, const struct asn1_cursor *private_key, const struct asn1_cursor *public_key)
static void digest_init(struct digest_algorithm *digest, void *ctx)
static int elliptic_multiply(struct elliptic_curve *curve, const void *base, const void *scalar, void *result)
void cipher_null_auth(struct cipher_algorithm *cipher, void *ctx, void *auth)
void cipher_null_decrypt(struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len)
int pubkey_null_encrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext)
static int cipher_setkey(struct cipher_algorithm *cipher, void *ctx, const void *key, size_t keylen)
void digest_null_update(struct digest_algorithm *digest, void *ctx, const void *src, size_t len)
int pubkey_null_verify(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature)
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
static int elliptic_is_infinity(struct elliptic_curve *curve, const void *point)
int cipher_null_setkey(struct cipher_algorithm *cipher, void *ctx, const void *key, size_t keylen)
static int is_stream_cipher(struct cipher_algorithm *cipher)
static int pubkey_encrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext)
void cipher_null_encrypt(struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len)
static int exchange_share(struct exchange_algorithm *exchange, const void *private, void *public)
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)
static int exchange_agree(struct exchange_algorithm *exchange, const void *private, const void *partner, void *shared)
static int cipher_setiv(struct cipher_algorithm *cipher, void *ctx, const void *iv, size_t ivlen)
static int elliptic_add(struct elliptic_curve *curve, const void *addend, const void *augend, void *result)
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
#define cipher_decrypt(cipher, ctx, src, dst, len)
void digest_null_final(struct digest_algorithm *digest, void *ctx, void *out)
void digest_null_init(struct digest_algorithm *digest, void *ctx)
int cipher_null_setiv(struct cipher_algorithm *cipehr, void *ctx, const void *iv, size_t ivlen)
static int pubkey_decrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext)
int pubkey_null_sign(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *signature)
static int is_auth_cipher(struct cipher_algorithm *cipher)
static int pubkey_sign(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *signature)
#define cipher_encrypt(cipher, ctx, src, dst, len)
int pubkey_null_decrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext)
static void cipher_auth(struct cipher_algorithm *cipher, void *ctx, void *auth)
void(* decrypt)(struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len)
Decrypt data.
int(* setiv)(struct cipher_algorithm *cipher, void *ctx, const void *iv, size_t ivlen)
Set initialisation vector.
void(* encrypt)(struct cipher_algorithm *cipher, void *ctx, const void *src, void *dst, size_t len)
Encrypt data.
void * priv
Algorithm private data.
const char * name
Algorithm name.
size_t blocksize
Block size.
int confidential
Cipher is capable of providing confidentiality.
size_t ctxsize
Context size.
size_t authsize
Authentication tag size.
void(* auth)(struct cipher_algorithm *cipher, void *ctx, void *auth)
Generate authentication tag.
int(* setkey)(struct cipher_algorithm *cipher, void *ctx, const void *key, size_t keylen)
Set key.
size_t alignsize
Alignment size.
A message digest algorithm.
size_t digestsize
Digest size.
size_t blocksize
Block size.
void * priv
Algorithm private data.
void(* update)(struct digest_algorithm *digest, void *ctx, const void *src, size_t len)
Update digest with new data.
void(* final)(struct digest_algorithm *digest, void *ctx, void *out)
Finalise digest.
size_t ctxsize
Context size.
const char * name
Algorithm name.
void(* init)(struct digest_algorithm *digest, void *ctx)
Initialise digest.
const void * order
Order of the generator (if prime).
const char * name
Curve name.
size_t keysize
Scalar (and private key) size.
size_t pointsize
Point (and public key) size.
int(* is_infinity)(struct elliptic_curve *curve, const void *point)
Check if this is the point at infinity.
void * priv
Algorithm private data.
const void * base
Generator base point.
int(* multiply)(struct elliptic_curve *curve, const void *base, const void *scalar, void *result)
Multiply scalar by curve point.
int(* add)(struct elliptic_curve *curve, const void *addend, const void *augend, void *result)
Add curve points (as a one-off operation).
A key exchange algorithm.
int(* agree)(struct exchange_algorithm *exchange, const void *private, const void *partner, void *shared)
Agree shared secret.
size_t sharedsize
Shared secret size.
size_t privsize
Private key size.
size_t pubsize
Public key size.
void * priv
Algorithm private data.
int(* share)(struct exchange_algorithm *exchange, const void *private, void *public)
Share public key.
const char * name
Algorithm name.
int(* sign)(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *builder)
Sign digest value.
int(* decrypt)(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext)
Decrypt.
int(* verify)(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature)
Verify signed digest value.
void * priv
Algorithm private data.
int(* match)(struct pubkey_algorithm *pubkey, const struct asn1_cursor *private_key, const struct asn1_cursor *public_key)
Check that public key matches private key.
const char * name
Algorithm name.
int(* encrypt)(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext)
Encrypt.
u8 iv[16]
Initialization vector.