xref: /openbmc/linux/net/rxrpc/insecure.c (revision e0e4d82f3be60cfe8b10304c6daf3ca5973ae9e3)
1*e0e4d82fSDavid Howells /* Null security operations.
2*e0e4d82fSDavid Howells  *
3*e0e4d82fSDavid Howells  * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4*e0e4d82fSDavid Howells  * Written by David Howells (dhowells@redhat.com)
5*e0e4d82fSDavid Howells  *
6*e0e4d82fSDavid Howells  * This program is free software; you can redistribute it and/or
7*e0e4d82fSDavid Howells  * modify it under the terms of the GNU General Public Licence
8*e0e4d82fSDavid Howells  * as published by the Free Software Foundation; either version
9*e0e4d82fSDavid Howells  * 2 of the Licence, or (at your option) any later version.
10*e0e4d82fSDavid Howells  */
11*e0e4d82fSDavid Howells 
12*e0e4d82fSDavid Howells #include <net/af_rxrpc.h>
13*e0e4d82fSDavid Howells #include "ar-internal.h"
14*e0e4d82fSDavid Howells 
15*e0e4d82fSDavid Howells static int none_init_connection_security(struct rxrpc_connection *conn)
16*e0e4d82fSDavid Howells {
17*e0e4d82fSDavid Howells 	return 0;
18*e0e4d82fSDavid Howells }
19*e0e4d82fSDavid Howells 
20*e0e4d82fSDavid Howells static void none_prime_packet_security(struct rxrpc_connection *conn)
21*e0e4d82fSDavid Howells {
22*e0e4d82fSDavid Howells }
23*e0e4d82fSDavid Howells 
24*e0e4d82fSDavid Howells static int none_secure_packet(const struct rxrpc_call *call,
25*e0e4d82fSDavid Howells 			       struct sk_buff *skb,
26*e0e4d82fSDavid Howells 			       size_t data_size,
27*e0e4d82fSDavid Howells 			       void *sechdr)
28*e0e4d82fSDavid Howells {
29*e0e4d82fSDavid Howells 	return 0;
30*e0e4d82fSDavid Howells }
31*e0e4d82fSDavid Howells 
32*e0e4d82fSDavid Howells static int none_verify_packet(const struct rxrpc_call *call,
33*e0e4d82fSDavid Howells 			       struct sk_buff *skb,
34*e0e4d82fSDavid Howells 			       u32 *_abort_code)
35*e0e4d82fSDavid Howells {
36*e0e4d82fSDavid Howells 	return 0;
37*e0e4d82fSDavid Howells }
38*e0e4d82fSDavid Howells 
39*e0e4d82fSDavid Howells static int none_respond_to_challenge(struct rxrpc_connection *conn,
40*e0e4d82fSDavid Howells 				      struct sk_buff *skb,
41*e0e4d82fSDavid Howells 				      u32 *_abort_code)
42*e0e4d82fSDavid Howells {
43*e0e4d82fSDavid Howells 	*_abort_code = RX_PROTOCOL_ERROR;
44*e0e4d82fSDavid Howells 	return -EPROTO;
45*e0e4d82fSDavid Howells }
46*e0e4d82fSDavid Howells 
47*e0e4d82fSDavid Howells static int none_verify_response(struct rxrpc_connection *conn,
48*e0e4d82fSDavid Howells 				 struct sk_buff *skb,
49*e0e4d82fSDavid Howells 				 u32 *_abort_code)
50*e0e4d82fSDavid Howells {
51*e0e4d82fSDavid Howells 	*_abort_code = RX_PROTOCOL_ERROR;
52*e0e4d82fSDavid Howells 	return -EPROTO;
53*e0e4d82fSDavid Howells }
54*e0e4d82fSDavid Howells 
55*e0e4d82fSDavid Howells static void none_clear(struct rxrpc_connection *conn)
56*e0e4d82fSDavid Howells {
57*e0e4d82fSDavid Howells }
58*e0e4d82fSDavid Howells 
59*e0e4d82fSDavid Howells static int none_init(void)
60*e0e4d82fSDavid Howells {
61*e0e4d82fSDavid Howells 	return 0;
62*e0e4d82fSDavid Howells }
63*e0e4d82fSDavid Howells 
64*e0e4d82fSDavid Howells static void none_exit(void)
65*e0e4d82fSDavid Howells {
66*e0e4d82fSDavid Howells }
67*e0e4d82fSDavid Howells 
68*e0e4d82fSDavid Howells /*
69*e0e4d82fSDavid Howells  * RxRPC Kerberos-based security
70*e0e4d82fSDavid Howells  */
71*e0e4d82fSDavid Howells const struct rxrpc_security rxrpc_no_security = {
72*e0e4d82fSDavid Howells 	.name				= "none",
73*e0e4d82fSDavid Howells 	.security_index			= RXRPC_SECURITY_NONE,
74*e0e4d82fSDavid Howells 	.init				= none_init,
75*e0e4d82fSDavid Howells 	.exit				= none_exit,
76*e0e4d82fSDavid Howells 	.init_connection_security	= none_init_connection_security,
77*e0e4d82fSDavid Howells 	.prime_packet_security		= none_prime_packet_security,
78*e0e4d82fSDavid Howells 	.secure_packet			= none_secure_packet,
79*e0e4d82fSDavid Howells 	.verify_packet			= none_verify_packet,
80*e0e4d82fSDavid Howells 	.respond_to_challenge		= none_respond_to_challenge,
81*e0e4d82fSDavid Howells 	.verify_response		= none_verify_response,
82*e0e4d82fSDavid Howells 	.clear				= none_clear,
83*e0e4d82fSDavid Howells };
84