Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

crypto_null.c 2.1KB

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