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