2 * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
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.
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.
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
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.
24 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL
);
29 * Null crypto algorithm
33 #include <ipxe/crypto.h>
35 void digest_null_init ( void *ctx __unused
) {
39 void digest_null_update ( void *ctx __unused
, const void *src __unused
,
40 size_t len __unused
) {
44 void digest_null_final ( void *ctx __unused
, void *out __unused
) {
48 struct digest_algorithm digest_null
= {
53 .init
= digest_null_init
,
54 .update
= digest_null_update
,
55 .final
= digest_null_final
,
58 int cipher_null_setkey ( void *ctx __unused
, const void *key __unused
,
59 size_t keylen __unused
) {
64 void cipher_null_setiv ( void *ctx __unused
, const void *iv __unused
,
65 size_t ivlen __unused
) {
69 void cipher_null_encrypt ( void *ctx __unused
, const void *src
, void *dst
,
71 memcpy ( dst
, src
, len
);
74 void cipher_null_decrypt ( void *ctx __unused
, const void *src
, void *dst
,
76 memcpy ( dst
, src
, len
);
79 void cipher_null_auth ( void *ctx __unused
, void *auth __unused
) {
83 struct cipher_algorithm cipher_null
= {
89 .setkey
= cipher_null_setkey
,
90 .setiv
= cipher_null_setiv
,
91 .encrypt
= cipher_null_encrypt
,
92 .decrypt
= cipher_null_decrypt
,
93 .auth
= cipher_null_auth
,
96 int pubkey_null_init ( void *ctx __unused
, const void *key __unused
,
97 size_t key_len __unused
) {
101 size_t pubkey_null_max_len ( void *ctx __unused
) {
105 int pubkey_null_encrypt ( void *ctx __unused
, const void *plaintext __unused
,
106 size_t plaintext_len __unused
,
107 void *ciphertext __unused
) {
111 int pubkey_null_decrypt ( void *ctx __unused
, const void *ciphertext __unused
,
112 size_t ciphertext_len __unused
,
113 void *plaintext __unused
) {
117 int pubkey_null_sign ( void *ctx __unused
,
118 struct digest_algorithm
*digest __unused
,
119 const void *value __unused
, void *signature __unused
) {
123 int pubkey_null_verify ( void *ctx __unused
,
124 struct digest_algorithm
*digest __unused
,
125 const void *value __unused
,
126 const void *signature __unused
,
127 size_t signature_len __unused
) {
131 void pubkey_null_final ( void *ctx __unused
) {
135 struct pubkey_algorithm pubkey_null
= {
138 .init
= pubkey_null_init
,
139 .max_len
= pubkey_null_max_len
,
140 .encrypt
= pubkey_null_encrypt
,
141 .decrypt
= pubkey_null_decrypt
,
142 .sign
= pubkey_null_sign
,
143 .verify
= pubkey_null_verify
,
144 .final
= pubkey_null_final
,