You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

crypto_null.c 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. /**
  19. * @file
  20. *
  21. * Null crypto algorithm
  22. */
  23. #include <string.h>
  24. #include <gpxe/crypto.h>
  25. static void digest_null_init ( void *ctx __unused ) {
  26. /* Do nothing */
  27. }
  28. static void digest_null_update ( void *ctx __unused, const void *src __unused,
  29. size_t len __unused ) {
  30. /* Do nothing */
  31. }
  32. static void digest_null_final ( void *ctx __unused, void *out __unused ) {
  33. /* Do nothing */
  34. }
  35. struct digest_algorithm digest_null = {
  36. .name = "null",
  37. .ctxsize = 0,
  38. .blocksize = 1,
  39. .digestsize = 0,
  40. .init = digest_null_init,
  41. .update = digest_null_update,
  42. .final = digest_null_final,
  43. };
  44. static int cipher_null_setkey ( void *ctx __unused, const void *key __unused,
  45. size_t keylen __unused ) {
  46. /* Do nothing */
  47. return 0;
  48. }
  49. static void cipher_null_setiv ( void *ctx __unused,
  50. const void *iv __unused ) {
  51. /* Do nothing */
  52. }
  53. static void cipher_null_encrypt ( void *ctx __unused, const void *src,
  54. void *dst, size_t len ) {
  55. memcpy ( dst, src, len );
  56. }
  57. static void cipher_null_decrypt ( void *ctx __unused, const void *src,
  58. void *dst, size_t len ) {
  59. memcpy ( dst, src, len );
  60. }
  61. struct cipher_algorithm cipher_null = {
  62. .name = "null",
  63. .ctxsize = 0,
  64. .blocksize = 1,
  65. .setkey = cipher_null_setkey,
  66. .setiv = cipher_null_setiv,
  67. .encrypt = cipher_null_encrypt,
  68. .decrypt = cipher_null_decrypt,
  69. };
  70. struct pubkey_algorithm pubkey_null = {
  71. .name = "null",
  72. .ctxsize = 0,
  73. };