iPXE
crypto_null.c File Reference

Null crypto algorithm. More...

#include <string.h>
#include <errno.h>
#include <ipxe/crypto.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
void digest_null_init (struct digest_algorithm *digest __unused, void *ctx __unused)
void digest_null_update (struct digest_algorithm *digest __unused, void *ctx __unused, const void *src __unused, size_t len __unused)
void digest_null_final (struct digest_algorithm *digest __unused, void *ctx __unused, void *out __unused)
int cipher_null_setkey (struct cipher_algorithm *cipher __unused, void *ctx __unused, const void *key __unused, size_t keylen __unused)
int cipher_null_setiv (struct cipher_algorithm *cipher __unused, void *ctx __unused, const void *iv __unused, size_t ivlen __unused)
void cipher_null_encrypt (struct cipher_algorithm *cipher __unused, void *ctx __unused, const void *src, void *dst, size_t len)
void cipher_null_decrypt (struct cipher_algorithm *cipher __unused, void *ctx __unused, const void *src, void *dst, size_t len)
void cipher_null_auth (struct cipher_algorithm *cipher __unused, void *ctx __unused, void *auth __unused)
int pubkey_null_encrypt (struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key __unused, const struct asn1_cursor *plaintext __unused, struct asn1_builder *ciphertext __unused)
int pubkey_null_decrypt (struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key __unused, const struct asn1_cursor *ciphertext __unused, struct asn1_builder *plaintext __unused)
int pubkey_null_sign (struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key __unused, struct digest_algorithm *digest __unused, const void *value __unused, struct asn1_builder *signature __unused)
int pubkey_null_verify (struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key __unused, struct digest_algorithm *digest __unused, const void *value __unused, const struct asn1_cursor *signature __unused)
int pubkey_null_match (struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *private_key __unused, const struct asn1_cursor *public_key __unused)

Variables

struct digest_algorithm digest_null
struct cipher_algorithm cipher_null
struct pubkey_algorithm pubkey_null

Detailed Description

Null crypto algorithm.

Definition in file crypto_null.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ digest_null_init()

void digest_null_init ( struct digest_algorithm *digest __unused,
void *ctx __unused )

Definition at line 37 of file crypto_null.c.

38 {
39 /* Do nothing */
40}

References __unused, and ctx.

◆ digest_null_update()

void digest_null_update ( struct digest_algorithm *digest __unused,
void *ctx __unused,
const void *src __unused,
size_t len __unused )

Definition at line 42 of file crypto_null.c.

44 {
45 /* Do nothing */
46}

References __unused, ctx, len, and src.

◆ digest_null_final()

void digest_null_final ( struct digest_algorithm *digest __unused,
void *ctx __unused,
void *out __unused )

Definition at line 48 of file crypto_null.c.

49 {
50 /* Do nothing */
51}

References __unused, ctx, and out.

◆ cipher_null_setkey()

int cipher_null_setkey ( struct cipher_algorithm *cipher __unused,
void *ctx __unused,
const void *key __unused,
size_t keylen __unused )

Definition at line 63 of file crypto_null.c.

65 {
66 /* Do nothing */
67 return 0;
68}

References __unused, ctx, and key.

◆ cipher_null_setiv()

int cipher_null_setiv ( struct cipher_algorithm *cipher __unused,
void *ctx __unused,
const void *iv __unused,
size_t ivlen __unused )

Definition at line 70 of file crypto_null.c.

72 {
73 /* Do nothing */
74 return 0;
75}

References __unused, ctx, and iv.

◆ cipher_null_encrypt()

void cipher_null_encrypt ( struct cipher_algorithm *cipher __unused,
void *ctx __unused,
const void * src,
void * dst,
size_t len )

Definition at line 77 of file crypto_null.c.

79 {
80 memcpy ( dst, src, len );
81}
static const void * src
Definition string.h:48
ring len
Length.
Definition dwmac.h:226
void * memcpy(void *dest, const void *src, size_t len) __nonnull

References __unused, ctx, len, memcpy(), and src.

◆ cipher_null_decrypt()

void cipher_null_decrypt ( struct cipher_algorithm *cipher __unused,
void *ctx __unused,
const void * src,
void * dst,
size_t len )

Definition at line 83 of file crypto_null.c.

85 {
86 memcpy ( dst, src, len );
87}

References __unused, ctx, len, memcpy(), and src.

◆ cipher_null_auth()

void cipher_null_auth ( struct cipher_algorithm *cipher __unused,
void *ctx __unused,
void *auth __unused )

Definition at line 89 of file crypto_null.c.

90 {
91 /* Do nothing */
92}

References __unused, and ctx.

◆ pubkey_null_encrypt()

int pubkey_null_encrypt ( struct pubkey_algorithm *pubkey __unused,
const struct asn1_cursor *key __unused,
const struct asn1_cursor *plaintext __unused,
struct asn1_builder *ciphertext __unused )

Definition at line 108 of file crypto_null.c.

111 {
112 return -ENOTTY;
113}
#define ENOTTY
Inappropriate I/O control operation.
Definition errno.h:595

References __unused, ENOTTY, and key.

◆ pubkey_null_decrypt()

int pubkey_null_decrypt ( struct pubkey_algorithm *pubkey __unused,
const struct asn1_cursor *key __unused,
const struct asn1_cursor *ciphertext __unused,
struct asn1_builder *plaintext __unused )

Definition at line 115 of file crypto_null.c.

118 {
119 return -ENOTTY;
120}

References __unused, ENOTTY, and key.

◆ pubkey_null_sign()

int pubkey_null_sign ( struct pubkey_algorithm *pubkey __unused,
const struct asn1_cursor *key __unused,
struct digest_algorithm *digest __unused,
const void *value __unused,
struct asn1_builder *signature __unused )

Definition at line 122 of file crypto_null.c.

126 {
127 return -ENOTTY;
128}

References __unused, ENOTTY, key, signature, and value.

◆ pubkey_null_verify()

int pubkey_null_verify ( struct pubkey_algorithm *pubkey __unused,
const struct asn1_cursor *key __unused,
struct digest_algorithm *digest __unused,
const void *value __unused,
const struct asn1_cursor *signature __unused )

Definition at line 130 of file crypto_null.c.

134 {
135 return -ENOTTY;
136}

References __unused, ENOTTY, key, signature, and value.

◆ pubkey_null_match()

int pubkey_null_match ( struct pubkey_algorithm *pubkey __unused,
const struct asn1_cursor *private_key __unused,
const struct asn1_cursor *public_key __unused )

Definition at line 138 of file crypto_null.c.

140 {
141 return -ENOTTY;
142}

References __unused, and ENOTTY.

Variable Documentation

◆ digest_null

struct digest_algorithm digest_null
Initial value:
= {
.name = "null",
.ctxsize = 0,
.blocksize = 1,
.digestsize = 0,
.update = digest_null_update,
}
void digest_null_init(struct digest_algorithm *digest __unused, void *ctx __unused)
Definition crypto_null.c:37
void digest_null_update(struct digest_algorithm *digest __unused, void *ctx __unused, const void *src __unused, size_t len __unused)
Definition crypto_null.c:42
void digest_null_final(struct digest_algorithm *digest __unused, void *ctx __unused, void *out __unused)
Definition crypto_null.c:48

Definition at line 53 of file crypto_null.c.

53 {
54 .name = "null",
55 .ctxsize = 0,
56 .blocksize = 1,
57 .digestsize = 0,
58 .init = digest_null_init,
59 .update = digest_null_update,
60 .final = digest_null_final,
61};

Referenced by cms_parse_participants(), pubkey_null_match(), and tls_clear_digest().

◆ cipher_null

struct cipher_algorithm cipher_null
Initial value:
= {
.name = "null",
.ctxsize = 0,
.blocksize = 1,
.alignsize = 1,
.authsize = 0,
.confidential = 0,
.setkey = cipher_null_setkey,
.encrypt = cipher_null_encrypt,
.decrypt = cipher_null_decrypt,
}
int cipher_null_setiv(struct cipher_algorithm *cipher __unused, void *ctx __unused, const void *iv __unused, size_t ivlen __unused)
Definition crypto_null.c:70
void cipher_null_auth(struct cipher_algorithm *cipher __unused, void *ctx __unused, void *auth __unused)
Definition crypto_null.c:89
void cipher_null_decrypt(struct cipher_algorithm *cipher __unused, void *ctx __unused, const void *src, void *dst, size_t len)
Definition crypto_null.c:83
int cipher_null_setkey(struct cipher_algorithm *cipher __unused, void *ctx __unused, const void *key __unused, size_t keylen __unused)
Definition crypto_null.c:63
void cipher_null_encrypt(struct cipher_algorithm *cipher __unused, void *ctx __unused, const void *src, void *dst, size_t len)
Definition crypto_null.c:77

Definition at line 94 of file crypto_null.c.

94 {
95 .name = "null",
96 .ctxsize = 0,
97 .blocksize = 1,
98 .alignsize = 1,
99 .authsize = 0,
100 .confidential = 0,
101 .setkey = cipher_null_setkey,
102 .setiv = cipher_null_setiv,
103 .encrypt = cipher_null_encrypt,
104 .decrypt = cipher_null_decrypt,
105 .auth = cipher_null_auth,
106};

Referenced by cms_message(), and pubkey_null_match().

◆ pubkey_null

struct pubkey_algorithm pubkey_null
Initial value:
= {
.name = "null",
.encrypt = pubkey_null_encrypt,
.decrypt = pubkey_null_decrypt,
.verify = pubkey_null_verify,
}
int pubkey_null_decrypt(struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key __unused, const struct asn1_cursor *ciphertext __unused, struct asn1_builder *plaintext __unused)
int pubkey_null_match(struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *private_key __unused, const struct asn1_cursor *public_key __unused)
int pubkey_null_verify(struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key __unused, struct digest_algorithm *digest __unused, const void *value __unused, const struct asn1_cursor *signature __unused)
int pubkey_null_sign(struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key __unused, struct digest_algorithm *digest __unused, const void *value __unused, struct asn1_builder *signature __unused)
int pubkey_null_encrypt(struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key __unused, const struct asn1_cursor *plaintext __unused, struct asn1_builder *ciphertext __unused)

Definition at line 144 of file crypto_null.c.

144 {
145 .name = "null",
146 .encrypt = pubkey_null_encrypt,
147 .decrypt = pubkey_null_decrypt,
148 .sign = pubkey_null_sign,
149 .verify = pubkey_null_verify,
150 .match = pubkey_null_match,
151};

Referenced by cms_parse_participants(), and pubkey_null_match().