iPXE
crypto_null.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 *
19 * You can also choose to distribute this program under the terms of
20 * the Unmodified Binary Distribution Licence (as given in the file
21 * COPYING.UBDL), provided that you have satisfied its requirements.
22 */
23
24FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25FILE_SECBOOT ( PERMITTED );
26
27/**
28 * @file
29 *
30 * Null crypto algorithm
31 */
32
33#include <string.h>
34#include <errno.h>
35#include <ipxe/crypto.h>
36
38 void *ctx __unused ) {
39 /* Do nothing */
40}
41
43 void *ctx __unused, const void *src __unused,
44 size_t len __unused ) {
45 /* Do nothing */
46}
47
49 void *ctx __unused, void *out __unused ) {
50 /* Do nothing */
51}
52
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};
62
64 void *ctx __unused, const void *key __unused,
65 size_t keylen __unused ) {
66 /* Do nothing */
67 return 0;
68}
69
71 void *ctx __unused, const void *iv __unused,
72 size_t ivlen __unused ) {
73 /* Do nothing */
74 return 0;
75}
76
78 void *ctx __unused, const void *src, void *dst,
79 size_t len ) {
80 memcpy ( dst, src, len );
81}
82
84 void *ctx __unused, const void *src, void *dst,
85 size_t len ) {
86 memcpy ( dst, src, len );
87}
88
90 void *ctx __unused, void *auth __unused ) {
91 /* Do nothing */
92}
93
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};
107
109 const struct asn1_cursor *key __unused,
110 const struct asn1_cursor *plaintext __unused,
111 struct asn1_builder *ciphertext __unused ) {
112 return -ENOTTY;
113}
114
116 const struct asn1_cursor *key __unused,
117 const struct asn1_cursor *ciphertext __unused,
118 struct asn1_builder *plaintext __unused ) {
119 return -ENOTTY;
120}
121
123 const struct asn1_cursor *key __unused,
124 struct digest_algorithm *digest __unused,
125 const void *value __unused,
127 return -ENOTTY;
128}
129
131 const struct asn1_cursor *key __unused,
132 struct digest_algorithm *digest __unused,
133 const void *value __unused,
134 const struct asn1_cursor *signature __unused ) {
135 return -ENOTTY;
136}
137
139 const struct asn1_cursor *private_key __unused,
140 const struct asn1_cursor *public_key __unused ) {
141 return -ENOTTY;
142}
143
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};
struct golan_eq_context ctx
Definition CIB_PRM.h:0
__be32 out[4]
Definition CIB_PRM.h:8
u8 signature
CPU signature.
Definition CIB_PRM.h:7
union @162305117151260234136356364136041353210355154177 key
pseudo_bit_t value[0x00020]
Definition arbel.h:2
static const void * src
Definition string.h:48
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)
struct cipher_algorithm cipher_null
Definition crypto_null.c:94
void digest_null_init(struct digest_algorithm *digest __unused, void *ctx __unused)
Definition crypto_null.c:37
int pubkey_null_match(struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *private_key __unused, const struct asn1_cursor *public_key __unused)
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 digest_null_update(struct digest_algorithm *digest __unused, void *ctx __unused, const void *src __unused, size_t len __unused)
Definition crypto_null.c:42
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)
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
struct pubkey_algorithm pubkey_null
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
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)
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
void digest_null_final(struct digest_algorithm *digest __unused, void *ctx __unused, void *out __unused)
Definition crypto_null.c:48
struct digest_algorithm digest_null
Definition crypto_null.c:53
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)
ring len
Length.
Definition dwmac.h:226
Error codes.
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:598
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:921
#define ENOTTY
Inappropriate I/O control operation.
Definition errno.h:595
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:951
Cryptographic API.
String functions.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
An ASN.1 object builder.
Definition asn1.h:29
An ASN.1 object cursor.
Definition asn1.h:21
A cipher algorithm.
Definition crypto.h:58
A message digest algorithm.
Definition crypto.h:19
A private key.
Definition privkey.h:17
A public key algorithm.
Definition crypto.h:142
u8 iv[16]
Initialization vector.
Definition wpa.h:33