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 <ipxe/crypto.h>
35
37 /* Do nothing */
38}
39
40void digest_null_update ( void *ctx __unused, const void *src __unused,
41 size_t len __unused ) {
42 /* Do nothing */
43}
44
45void digest_null_final ( void *ctx __unused, void *out __unused ) {
46 /* Do nothing */
47}
48
50 .name = "null",
51 .ctxsize = 0,
52 .blocksize = 1,
53 .digestsize = 0,
54 .init = digest_null_init,
55 .update = digest_null_update,
56 .final = digest_null_final,
57};
58
59int cipher_null_setkey ( void *ctx __unused, const void *key __unused,
60 size_t keylen __unused ) {
61 /* Do nothing */
62 return 0;
63}
64
65void cipher_null_setiv ( void *ctx __unused, const void *iv __unused,
66 size_t ivlen __unused ) {
67 /* Do nothing */
68}
69
70void cipher_null_encrypt ( void *ctx __unused, const void *src, void *dst,
71 size_t len ) {
72 memcpy ( dst, src, len );
73}
74
75void cipher_null_decrypt ( void *ctx __unused, const void *src, void *dst,
76 size_t len ) {
77 memcpy ( dst, src, len );
78}
79
80void cipher_null_auth ( void *ctx __unused, void *auth __unused ) {
81 /* Do nothing */
82}
83
85 .name = "null",
86 .ctxsize = 0,
87 .blocksize = 1,
88 .alignsize = 1,
89 .authsize = 0,
90 .setkey = cipher_null_setkey,
91 .setiv = cipher_null_setiv,
92 .encrypt = cipher_null_encrypt,
93 .decrypt = cipher_null_decrypt,
94 .auth = cipher_null_auth,
95};
96
98 const struct asn1_cursor *plaintext __unused,
99 struct asn1_builder *ciphertext __unused ) {
100 return 0;
101}
102
104 const struct asn1_cursor *ciphertext __unused,
105 struct asn1_builder *plaintext __unused ) {
106 return 0;
107}
108
110 struct digest_algorithm *digest __unused,
111 const void *value __unused,
113 return 0;
114}
115
117 struct digest_algorithm *digest __unused,
118 const void *value __unused,
119 const struct asn1_cursor *signature __unused ) {
120 return 0;
121}
122
124 .name = "null",
125 .encrypt = pubkey_null_encrypt,
126 .decrypt = pubkey_null_decrypt,
127 .sign = pubkey_null_sign,
128 .verify = pubkey_null_verify,
129};
union @162305117151260234136356364136041353210355154177 key
Sense key.
Definition scsi.h:3
struct golan_eq_context ctx
Definition CIB_PRM.h:0
u8 signature
CPU signature.
Definition CIB_PRM.h:7
__be32 out[4]
Definition CIB_PRM.h:8
pseudo_bit_t value[0x00020]
Definition arbel.h:2
static const void * src
Definition string.h:48
void digest_null_init(void *ctx __unused)
Definition crypto_null.c:36
struct cipher_algorithm cipher_null
Definition crypto_null.c:84
void cipher_null_setiv(void *ctx __unused, const void *iv __unused, size_t ivlen __unused)
Definition crypto_null.c:65
void cipher_null_encrypt(void *ctx __unused, const void *src, void *dst, size_t len)
Definition crypto_null.c:70
int pubkey_null_decrypt(const struct asn1_cursor *key __unused, const struct asn1_cursor *ciphertext __unused, struct asn1_builder *plaintext __unused)
void digest_null_final(void *ctx __unused, void *out __unused)
Definition crypto_null.c:45
int pubkey_null_sign(const struct asn1_cursor *key __unused, struct digest_algorithm *digest __unused, const void *value __unused, struct asn1_builder *signature __unused)
int pubkey_null_verify(const struct asn1_cursor *key __unused, struct digest_algorithm *digest __unused, const void *value __unused, const struct asn1_cursor *signature __unused)
struct pubkey_algorithm pubkey_null
void cipher_null_decrypt(void *ctx __unused, const void *src, void *dst, size_t len)
Definition crypto_null.c:75
void digest_null_update(void *ctx __unused, const void *src __unused, size_t len __unused)
Definition crypto_null.c:40
int pubkey_null_encrypt(const struct asn1_cursor *key __unused, const struct asn1_cursor *plaintext __unused, struct asn1_builder *ciphertext __unused)
Definition crypto_null.c:97
void cipher_null_auth(void *ctx __unused, void *auth __unused)
Definition crypto_null.c:80
int cipher_null_setkey(void *ctx __unused, const void *key __unused, size_t keylen __unused)
Definition crypto_null.c:59
struct digest_algorithm digest_null
Definition crypto_null.c:49
ring len
Length.
Definition dwmac.h:226
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
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:51
A message digest algorithm.
Definition crypto.h:19
A public key algorithm.
Definition crypto.h:122
u8 iv[16]
Initialization vector.
Definition wpa.h:33