crypto_null.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00018 
00019 FILE_LICENCE ( GPL2_OR_LATER );
00020 
00021 /**
00022  * @file
00023  *
00024  * Null crypto algorithm
00025  */
00026 
00027 #include <string.h>
00028 #include <gpxe/crypto.h>
00029 
00030 static void digest_null_init ( void *ctx __unused ) {
00031         /* Do nothing */
00032 }
00033 
00034 static void digest_null_update ( void *ctx __unused, const void *src __unused,
00035                                  size_t len __unused ) {
00036         /* Do nothing */
00037 }
00038 
00039 static void digest_null_final ( void *ctx __unused, void *out __unused ) {
00040         /* Do nothing */
00041 }
00042 
00043 struct digest_algorithm digest_null = {
00044         .name = "null",
00045         .ctxsize = 0,
00046         .blocksize = 1,
00047         .digestsize = 0,
00048         .init = digest_null_init,
00049         .update = digest_null_update,
00050         .final = digest_null_final,
00051 };
00052 
00053 static int cipher_null_setkey ( void *ctx __unused, const void *key __unused,
00054                                 size_t keylen __unused ) {
00055         /* Do nothing */
00056         return 0;
00057 }
00058 
00059 static void cipher_null_setiv ( void *ctx __unused,
00060                                 const void *iv __unused ) {
00061         /* Do nothing */
00062 }
00063 
00064 static void cipher_null_encrypt ( void *ctx __unused, const void *src,
00065                                   void *dst, size_t len ) {
00066         memcpy ( dst, src, len );
00067 }
00068 
00069 static void cipher_null_decrypt ( void *ctx __unused, const void *src,
00070                                   void *dst, size_t len ) {
00071         memcpy ( dst, src, len );
00072 }
00073 
00074 struct cipher_algorithm cipher_null = {
00075         .name = "null",
00076         .ctxsize = 0,
00077         .blocksize = 1,
00078         .setkey = cipher_null_setkey,
00079         .setiv = cipher_null_setiv,
00080         .encrypt = cipher_null_encrypt,
00081         .decrypt = cipher_null_decrypt,
00082 };
00083 
00084 struct pubkey_algorithm pubkey_null = {
00085         .name = "null",
00086         .ctxsize = 0,
00087 };

Generated on Tue Apr 6 20:00:52 2010 for gPXE by  doxygen 1.5.7.1