8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / man / man3nsl / getipsecalgbyname.3nsl
blob828823672219656e9639d6bd88dcad23b243b6a4
1 '\" te
2 .\" Copyright (C) 2003, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH GETIPSECALGBYNAME 3NSL "Aug 20, 2003"
7 .SH NAME
8 getipsecalgbyname, getipsecalgbynum, freeipsecalgent \- query algorithm mapping
9 entries
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fBcc\fR \fB-flag \&.\|.\|.\fR  \fIfile\fR \&.\|.\|.\fB-l\fRnsl [\fB -library \&.\|.\|. \fR]
14 #include <netdb.h>
18 \fBstruct ipsecalgent *\fR\fBgetipsecalgbyname\fR
19      (\fBconst char *\fR\fIalg_name\fR, \fBint\fR \fIprotocol_num\fR, \fBint *\fR\fIerrnop\fR
20 .fi
22 .LP
23 .nf
24 \fBstruct ipsecalgent *\fR\fBgetipsecalgbynum\fR(\fBint\fR \fIalg_num\fR, \fBint\fR \fIprotocol_num\fR,
25      \fBint *\fR\fIerrnop\fR
26 .fi
28 .LP
29 .nf
30 \fBvoid\fR \fBfreeipsecalgent\fR(\fBstruct ipsecalgent *\fR\fIptr\fR
31 .fi
33 .SH DESCRIPTION
34 .sp
35 .LP
36 Use the \fBgetipsecalgbyname()\fR, \fBgetipsecalgbynum()\fR,
37 \fBfreeipsecalgent()\fR functions to obtain the IPsec algorithm mappings  that
38 are defined by \fBipsecalgs\fR(1M). The IPsec algorithms and associated
39 protocol name spaces are defined by \fIRFC 2407\fR.
40 .sp
41 .LP
42 \fBgetipsecalgbyname()\fR and \fBgetipsecalgbynum()\fR return a structure that
43 describes the algorithm entry found. This structure is described in the
44 \fBRETURN VALUES\fR section below.
45 .sp
46 .LP
47 \fBfreeipsecalgent()\fR must be used by the caller to free the structures
48 returned by \fBgetipsecalgbyname()\fR and \fBgetipsecalgbynum()\fR when they
49 are no longer needed.
50 .sp
51 .LP
52 Both \fBgetipsecalgbyname()\fR and \fBgetipsecalgbynum()\fR take as parameter
53 the protocol identifier in which the algorithm is defined. See
54 \fBgetipsecprotobyname\fR(3NSL) and \fBgetipsecprotobyname\fR(3NSL).
55 .sp
56 .LP
57 The following protocol numbers are pre-defined:
58 .sp
59 .ne 2
60 .na
61 \fB\fBIPSEC_PROTO_ESP\fR\fR
62 .ad
63 .RS 19n
64 Defines the encryption algorithms (transforms) that can be used by IPsec to
65 provide data confidentiality.
66 .RE
68 .sp
69 .ne 2
70 .na
71 \fB\fBIPSEC_PROTO_AH\fR\fR
72 .ad
73 .RS 19n
74 Defines the authentication algorithms (transforms) that can be used by IPsec to
75 provide authentication.
76 .RE
78 .sp
79 .LP
80 \fBgetipsecalgbyname()\fR looks up the algorithm by its name, while
81 \fBgetipsecalgbynum()\fR looks up the algorithm by its assigned number.
82 .SH PARAMETERS
83 .sp
84 .ne 2
85 .na
86 \fB\fIerrnop\fR\fR
87 .ad
88 .RS 10n
89 A  pointer to an integer used to return an error status value on certain error
90 conditions. See \fBERRORS\fR.
91 .RE
93 .SH RETURN VALUES
94 .sp
95 .LP
96 The \fBgetipsecalgbyname()\fR and \fBgetipsecalgbynum()\fR functions return a
97 pointer to the structure \fBipsecalgent_t\fR, defined in <\fBnetdb.h\fR>.   If
98 the requested algorithm cannot be found, these functions return \fINULL\fR.
99 .sp
101 The structure \fBipsecalgent_t\fR is defined as follows:
103 .in +2
105 typedef struct ipsecalgent {
106      char **a_names;      /* algorithm names */
107      int a_proto_num;     /* protocol number */
108      int a_alg_num;       /* algorithm number */
109      char *a_mech_name;   /* mechanism name */
110      int *a_block_sizes;  /* supported block sizes */
111      int *a_key_sizes;    /* supported key sizes */
112      int a_key_increment; /* key size increment */
113 } ipsecalgent_t;
115 .in -2
119 If \fBa_key_increment\fR is non-zero, \fBa_key_sizes[0]\fR contains the default
120 key size for the algorithm. \fBa_key_sizes[1]\fR and \fBa_key_sizes[2]\fR
121 specify the smallest and biggest key sizes support by the algorithm, and
122 \fBa_key_increment\fR specifies the valid key size increments in that range.
125 If \fBa_key_increment\fR is zero, the array \fBa_key_sizes\fR  contains the set
126 of key sizes, in bits, supported by the  algorithm. The last key length in the
127 array is followed by an element of value \fB0\fR. The first element of this
128 array is used as the default key size for the algorithm.
131 \fBa_name\fR is an array of algorithm names, terminated by an element
132 containing a \fINULL\fR pointer. \fBa_name[0]\fR is the  primary name for the
133 algorithm.
136 \fBa_proto_num\fR is the protocol identifer of this algorithm. \fBa_alg_num\fR
137 is the algorithm number. \fBa_mech_name\fR contains the mechanism name
138 associated with the algorithm.
141 \fBa_block_sizes\fR is an array containing the supported block lengths or MAC
142 lengths, in bytes, supported by the algorithm.  The last valid value in the
143 array is followed by an element containing the value \fB0\fR.
144 .SH ERRORS
147 When the specified algorithm cannot be returned to the caller,
148 \fBgetipsecalgbynam()\fR and \fBgetipsecalgbynum()\fR return a value of
149 \fINULL\fR and set the integer pointed to by the \fIerrnop\fR parameter to one
150 of the following values:
152 .ne 2
154 \fB\fBENOMEM\fR\fR
156 .RS 10n
157 Not enough memory
161 .ne 2
163 \fB\fBENOENT\fR\fR
165 .RS 10n
166 Specified algorithm not found
170 .ne 2
172 \fB\fBEINVAL\fR\fR
174 .RS 10n
175 Specified protocol number not found
178 .SH ATTRIBUTES
181 See \fBattributes\fR(5)  for descriptions of the following attributes:
186 box;
187 c | c
188 l | l .
189 ATTRIBUTE TYPE  ATTRIBUTE VALUE
190 MT Level        MT Safe
192 Interface Stability     Evolving
195 .SH SEE ALSO
198 \fBcryptoadm\fR(1M), \fBipsecalgs\fR(1M), \fBgetipsecprotobyname\fR(3NSL),
199 \fBgetipsecprotobyname\fR(3NSL), \fBattributes\fR(5)
202 Piper, D. \fIRFC 2407, The Internet IP Security Domain of Interpretation for
203 ISAKMP\fR. Network Working Group. November, 1998.