insecure.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /* Null security operations.
  3. *
  4. * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
  5. * Written by David Howells (dhowells@redhat.com)
  6. */
  7. #include <net/af_rxrpc.h>
  8. #include "ar-internal.h"
  9. static int none_init_connection_security(struct rxrpc_connection *conn)
  10. {
  11. return 0;
  12. }
  13. static int none_prime_packet_security(struct rxrpc_connection *conn)
  14. {
  15. return 0;
  16. }
  17. static int none_secure_packet(struct rxrpc_call *call,
  18. struct sk_buff *skb,
  19. size_t data_size,
  20. void *sechdr)
  21. {
  22. return 0;
  23. }
  24. static int none_verify_packet(struct rxrpc_call *call, struct sk_buff *skb,
  25. unsigned int offset, unsigned int len,
  26. rxrpc_seq_t seq, u16 expected_cksum)
  27. {
  28. return 0;
  29. }
  30. static void none_free_call_crypto(struct rxrpc_call *call)
  31. {
  32. }
  33. static void none_locate_data(struct rxrpc_call *call, struct sk_buff *skb,
  34. unsigned int *_offset, unsigned int *_len)
  35. {
  36. }
  37. static int none_respond_to_challenge(struct rxrpc_connection *conn,
  38. struct sk_buff *skb,
  39. u32 *_abort_code)
  40. {
  41. struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
  42. trace_rxrpc_rx_eproto(NULL, sp->hdr.serial,
  43. tracepoint_string("chall_none"));
  44. return -EPROTO;
  45. }
  46. static int none_verify_response(struct rxrpc_connection *conn,
  47. struct sk_buff *skb,
  48. u32 *_abort_code)
  49. {
  50. struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
  51. trace_rxrpc_rx_eproto(NULL, sp->hdr.serial,
  52. tracepoint_string("resp_none"));
  53. return -EPROTO;
  54. }
  55. static void none_clear(struct rxrpc_connection *conn)
  56. {
  57. }
  58. static int none_init(void)
  59. {
  60. return 0;
  61. }
  62. static void none_exit(void)
  63. {
  64. }
  65. /*
  66. * RxRPC Kerberos-based security
  67. */
  68. const struct rxrpc_security rxrpc_no_security = {
  69. .name = "none",
  70. .security_index = RXRPC_SECURITY_NONE,
  71. .init = none_init,
  72. .exit = none_exit,
  73. .init_connection_security = none_init_connection_security,
  74. .prime_packet_security = none_prime_packet_security,
  75. .free_call_crypto = none_free_call_crypto,
  76. .secure_packet = none_secure_packet,
  77. .verify_packet = none_verify_packet,
  78. .locate_data = none_locate_data,
  79. .respond_to_challenge = none_respond_to_challenge,
  80. .verify_response = none_verify_response,
  81. .clear = none_clear,
  82. };