insecure.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Null security operations.
  2. *
  3. * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #include <net/af_rxrpc.h>
  12. #include "ar-internal.h"
  13. static int none_init_connection_security(struct rxrpc_connection *conn)
  14. {
  15. return 0;
  16. }
  17. static int none_prime_packet_security(struct rxrpc_connection *conn)
  18. {
  19. return 0;
  20. }
  21. static int none_secure_packet(struct rxrpc_call *call,
  22. struct sk_buff *skb,
  23. size_t data_size,
  24. void *sechdr)
  25. {
  26. return 0;
  27. }
  28. static int none_verify_packet(struct rxrpc_call *call, struct sk_buff *skb,
  29. unsigned int offset, unsigned int len,
  30. rxrpc_seq_t seq, u16 expected_cksum)
  31. {
  32. return 0;
  33. }
  34. static void none_locate_data(struct rxrpc_call *call, struct sk_buff *skb,
  35. unsigned int *_offset, unsigned int *_len)
  36. {
  37. }
  38. static int none_respond_to_challenge(struct rxrpc_connection *conn,
  39. struct sk_buff *skb,
  40. u32 *_abort_code)
  41. {
  42. struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
  43. trace_rxrpc_rx_eproto(NULL, sp->hdr.serial,
  44. tracepoint_string("chall_none"));
  45. return -EPROTO;
  46. }
  47. static int none_verify_response(struct rxrpc_connection *conn,
  48. struct sk_buff *skb,
  49. u32 *_abort_code)
  50. {
  51. struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
  52. trace_rxrpc_rx_eproto(NULL, sp->hdr.serial,
  53. tracepoint_string("resp_none"));
  54. return -EPROTO;
  55. }
  56. static void none_clear(struct rxrpc_connection *conn)
  57. {
  58. }
  59. static int none_init(void)
  60. {
  61. return 0;
  62. }
  63. static void none_exit(void)
  64. {
  65. }
  66. /*
  67. * RxRPC Kerberos-based security
  68. */
  69. const struct rxrpc_security rxrpc_no_security = {
  70. .name = "none",
  71. .security_index = RXRPC_SECURITY_NONE,
  72. .init = none_init,
  73. .exit = none_exit,
  74. .init_connection_security = none_init_connection_security,
  75. .prime_packet_security = none_prime_packet_security,
  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. };