aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2007-09-16 22:34:00 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:32 -0400
commit65b07e5d0d09c77e98050b5f0146ead29e5add32 (patch)
treeb5c5ac79969401238ce2c01d3999016238b02b93 /include
parentbbd0d59809f923ea2b540cbd781b32110e249f6e (diff)
[SCTP]: API updates to suport SCTP-AUTH extensions.
Add SCTP-AUTH API. The API implemented here was agreed to between implementors at the 9th SCTP Interop. It will be documented in the next revision of the SCTP socket API spec. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/sctp/auth.h16
-rw-r--r--include/net/sctp/ulpevent.h4
-rw-r--r--include/net/sctp/user.h90
3 files changed, 110 insertions, 0 deletions
diff --git a/include/net/sctp/auth.h b/include/net/sctp/auth.h
index 10c8010552ff..4945954a16af 100644
--- a/include/net/sctp/auth.h
+++ b/include/net/sctp/auth.h
@@ -43,6 +43,7 @@
43struct sctp_endpoint; 43struct sctp_endpoint;
44struct sctp_association; 44struct sctp_association;
45struct sctp_authkey; 45struct sctp_authkey;
46struct sctp_hmacalgo;
46 47
47/* 48/*
48 * Define a generic struct that will hold all the info 49 * Define a generic struct that will hold all the info
@@ -109,4 +110,19 @@ int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc);
109void sctp_auth_calculate_hmac(const struct sctp_association *asoc, 110void sctp_auth_calculate_hmac(const struct sctp_association *asoc,
110 struct sk_buff *skb, 111 struct sk_buff *skb,
111 struct sctp_auth_chunk *auth, gfp_t gfp); 112 struct sctp_auth_chunk *auth, gfp_t gfp);
113
114/* API Helpers */
115int sctp_auth_ep_add_chunkid(struct sctp_endpoint *ep, __u8 chunk_id);
116int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep,
117 struct sctp_hmacalgo *hmacs);
118int sctp_auth_set_key(struct sctp_endpoint *ep,
119 struct sctp_association *asoc,
120 struct sctp_authkey *auth_key);
121int sctp_auth_set_active_key(struct sctp_endpoint *ep,
122 struct sctp_association *asoc,
123 __u16 key_id);
124int sctp_auth_del_key_id(struct sctp_endpoint *ep,
125 struct sctp_association *asoc,
126 __u16 key_id);
127
112#endif 128#endif
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index de88ed5b0ba6..922a151eb93c 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -128,6 +128,10 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
128 struct sctp_chunk *chunk, 128 struct sctp_chunk *chunk,
129 gfp_t gfp); 129 gfp_t gfp);
130 130
131struct sctp_ulpevent *sctp_ulpevent_make_authkey(
132 const struct sctp_association *asoc, __u16 key_id,
133 __u32 indication, gfp_t gfp);
134
131void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, 135void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
132 struct msghdr *); 136 struct msghdr *);
133__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); 137__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 6d2b57758cca..00848b641f59 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -103,6 +103,21 @@ enum sctp_optname {
103#define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT 103#define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT
104 SCTP_MAX_BURST, /* Set/Get max burst */ 104 SCTP_MAX_BURST, /* Set/Get max burst */
105#define SCTP_MAX_BURST SCTP_MAX_BURST 105#define SCTP_MAX_BURST SCTP_MAX_BURST
106 SCTP_AUTH_CHUNK, /* Set only: add a chunk type to authenticat */
107#define SCTP_AUTH_CHUNK SCTP_AUTH_CHUNK
108 SCTP_HMAC_IDENT,
109#define SCTP_HMAC_IDENT SCTP_HMAC_IDENT
110 SCTP_AUTH_KEY,
111#define SCTP_AUTH_KEY SCTP_AUTH_KEY
112 SCTP_AUTH_ACTIVE_KEY,
113#define SCTP_AUTH_ACTIVE_KEY SCTP_AUTH_ACTIVE_KEY
114 SCTP_AUTH_DELETE_KEY,
115#define SCTP_AUTH_DELETE_KEY SCTP_AUTH_DELETE_KEY
116 SCTP_PEER_AUTH_CHUNKS, /* Read only */
117#define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS
118 SCTP_LOCAL_AUTH_CHUNKS, /* Read only */
119#define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS
120
106 121
107 /* Internal Socket Options. Some of the sctp library functions are 122 /* Internal Socket Options. Some of the sctp library functions are
108 * implemented using these socket options. 123 * implemented using these socket options.
@@ -370,6 +385,19 @@ struct sctp_pdapi_event {
370 385
371enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; 386enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
372 387
388struct sctp_authkey_event {
389 __u16 auth_type;
390 __u16 auth_flags;
391 __u32 auth_length;
392 __u16 auth_keynumber;
393 __u16 auth_altkeynumber;
394 __u32 auth_indication;
395 sctp_assoc_t auth_assoc_id;
396};
397
398enum { SCTP_AUTH_NEWKEY = 0, };
399
400
373/* 401/*
374 * Described in Section 7.3 402 * Described in Section 7.3
375 * Ancillary Data and Notification Interest Options 403 * Ancillary Data and Notification Interest Options
@@ -405,6 +433,7 @@ union sctp_notification {
405 struct sctp_shutdown_event sn_shutdown_event; 433 struct sctp_shutdown_event sn_shutdown_event;
406 struct sctp_adaptation_event sn_adaptation_event; 434 struct sctp_adaptation_event sn_adaptation_event;
407 struct sctp_pdapi_event sn_pdapi_event; 435 struct sctp_pdapi_event sn_pdapi_event;
436 struct sctp_authkey_event sn_authkey_event;
408}; 437};
409 438
410/* Section 5.3.1 439/* Section 5.3.1
@@ -421,6 +450,7 @@ enum sctp_sn_type {
421 SCTP_SHUTDOWN_EVENT, 450 SCTP_SHUTDOWN_EVENT,
422 SCTP_PARTIAL_DELIVERY_EVENT, 451 SCTP_PARTIAL_DELIVERY_EVENT,
423 SCTP_ADAPTATION_INDICATION, 452 SCTP_ADAPTATION_INDICATION,
453 SCTP_AUTHENTICATION_EVENT,
424}; 454};
425 455
426/* Notification error codes used to fill up the error fields in some 456/* Notification error codes used to fill up the error fields in some
@@ -539,6 +569,54 @@ struct sctp_paddrparams {
539 __u32 spp_flags; 569 __u32 spp_flags;
540} __attribute__((packed, aligned(4))); 570} __attribute__((packed, aligned(4)));
541 571
572/*
573 * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
574 *
575 * This set option adds a chunk type that the user is requesting to be
576 * received only in an authenticated way. Changes to the list of chunks
577 * will only effect future associations on the socket.
578 */
579struct sctp_authchunk {
580 __u8 sauth_chunk;
581};
582
583/*
584 * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
585 *
586 * This option gets or sets the list of HMAC algorithms that the local
587 * endpoint requires the peer to use.
588*/
589struct sctp_hmacalgo {
590 __u16 shmac_num_idents;
591 __u16 shmac_idents[];
592};
593
594/*
595 * 7.1.20. Set a shared key (SCTP_AUTH_KEY)
596 *
597 * This option will set a shared secret key which is used to build an
598 * association shared key.
599 */
600struct sctp_authkey {
601 sctp_assoc_t sca_assoc_id;
602 __u16 sca_keynumber;
603 __u16 sca_keylen;
604 __u8 sca_key[];
605};
606
607/*
608 * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
609 *
610 * This option will get or set the active shared key to be used to build
611 * the association shared key.
612 */
613
614struct sctp_authkeyid {
615 sctp_assoc_t scact_assoc_id;
616 __u16 scact_keynumber;
617};
618
619
542/* 7.1.23. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) 620/* 7.1.23. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME)
543 * 621 *
544 * This options will get or set the delayed ack timer. The time is set 622 * This options will get or set the delayed ack timer. The time is set
@@ -608,6 +686,18 @@ struct sctp_status {
608}; 686};
609 687
610/* 688/*
689 * 7.2.3. Get the list of chunks the peer requires to be authenticated
690 * (SCTP_PEER_AUTH_CHUNKS)
691 *
692 * This option gets a list of chunks for a specified association that
693 * the peer requires to be received authenticated only.
694 */
695struct sctp_authchunks {
696 sctp_assoc_t gauth_assoc_id;
697 uint8_t gauth_chunks[];
698};
699
700/*
611 * 8.3, 8.5 get all peer/local addresses in an association. 701 * 8.3, 8.5 get all peer/local addresses in an association.
612 * This parameter struct is used by SCTP_GET_PEER_ADDRS and 702 * This parameter struct is used by SCTP_GET_PEER_ADDRS and
613 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement 703 * SCTP_GET_LOCAL_ADDRS socket options used internally to implement