summaryrefslogtreecommitdiff
path: root/usr/src/man/man3nsl/getipsecalgbyname.3nsl
blob: 0d486bd224f2ff9a7b453ea22cef723ca0ae3b06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
'\" te
.\" Copyright (C) 2003, Sun Microsystems, Inc. All Rights Reserved
.\" 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.
.\" 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.
.\" 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]
.TH GETIPSECALGBYNAME 3NSL "Nov 26, 2017"
.SH NAME
getipsecalgbyname, getipsecalgbynum, freeipsecalgent \- query algorithm mapping
entries
.SH SYNOPSIS
.LP
.nf
\fBcc\fR \fB-flag \&.\|.\|.\fR  \fIfile\fR \&.\|.\|.\fB-l\fRnsl [\fB -library \&.\|.\|. \fR]
#include <netdb.h>



\fBstruct ipsecalgent *\fR\fBgetipsecalgbyname\fR
     (\fBconst char *\fR\fIalg_name\fR, \fBint\fR \fIprotocol_num\fR, \fBint *\fR\fIerrnop\fR
.fi

.LP
.nf
\fBstruct ipsecalgent *\fR\fBgetipsecalgbynum\fR(\fBint\fR \fIalg_num\fR, \fBint\fR \fIprotocol_num\fR,
     \fBint *\fR\fIerrnop\fR
.fi

.LP
.nf
\fBvoid\fR \fBfreeipsecalgent\fR(\fBstruct ipsecalgent *\fR\fIptr\fR
.fi

.SH DESCRIPTION
.LP
Use the \fBgetipsecalgbyname()\fR, \fBgetipsecalgbynum()\fR,
\fBfreeipsecalgent()\fR functions to obtain the IPsec algorithm mappings  that
are defined by \fBipsecalgs\fR(8). The IPsec algorithms and associated
protocol name spaces are defined by \fIRFC 2407\fR.
.sp
.LP
\fBgetipsecalgbyname()\fR and \fBgetipsecalgbynum()\fR return a structure that
describes the algorithm entry found. This structure is described in the
\fBRETURN VALUES\fR section below.
.sp
.LP
\fBfreeipsecalgent()\fR must be used by the caller to free the structures
returned by \fBgetipsecalgbyname()\fR and \fBgetipsecalgbynum()\fR when they
are no longer needed.
.sp
.LP
Both \fBgetipsecalgbyname()\fR and \fBgetipsecalgbynum()\fR take as parameter
the protocol identifier in which the algorithm is defined. See
\fBgetipsecprotobyname\fR(3NSL) and \fBgetipsecprotobyname\fR(3NSL).
.sp
.LP
The following protocol numbers are pre-defined:
.sp
.ne 2
.na
\fB\fBIPSEC_PROTO_ESP\fR\fR
.ad
.RS 19n
Defines the encryption algorithms (transforms) that can be used by IPsec to
provide data confidentiality.
.RE

.sp
.ne 2
.na
\fB\fBIPSEC_PROTO_AH\fR\fR
.ad
.RS 19n
Defines the authentication algorithms (transforms) that can be used by IPsec to
provide authentication.
.RE

.sp
.LP
\fBgetipsecalgbyname()\fR looks up the algorithm by its name, while
\fBgetipsecalgbynum()\fR looks up the algorithm by its assigned number.
.SH PARAMETERS
.ne 2
.na
\fB\fIerrnop\fR\fR
.ad
.RS 10n
A  pointer to an integer used to return an error status value on certain error
conditions. See \fBERRORS\fR.
.RE

.SH RETURN VALUES
.LP
The \fBgetipsecalgbyname()\fR and \fBgetipsecalgbynum()\fR functions return a
pointer to the structure \fBipsecalgent_t\fR, defined in <\fBnetdb.h\fR>.   If
the requested algorithm cannot be found, these functions return \fINULL\fR.
.sp
.LP
The structure \fBipsecalgent_t\fR is defined as follows:
.sp
.in +2
.nf
typedef struct ipsecalgent {
     char **a_names;      /* algorithm names */
     int a_proto_num;     /* protocol number */
     int a_alg_num;       /* algorithm number */
     char *a_mech_name;   /* mechanism name */
     int *a_block_sizes;  /* supported block sizes */
     int *a_key_sizes;    /* supported key sizes */
     int a_key_increment; /* key size increment */
} ipsecalgent_t;
.fi
.in -2

.sp
.LP
If \fBa_key_increment\fR is non-zero, \fBa_key_sizes[0]\fR contains the default
key size for the algorithm. \fBa_key_sizes[1]\fR and \fBa_key_sizes[2]\fR
specify the smallest and biggest key sizes support by the algorithm, and
\fBa_key_increment\fR specifies the valid key size increments in that range.
.sp
.LP
If \fBa_key_increment\fR is zero, the array \fBa_key_sizes\fR  contains the set
of key sizes, in bits, supported by the  algorithm. The last key length in the
array is followed by an element of value \fB0\fR. The first element of this
array is used as the default key size for the algorithm.
.sp
.LP
\fBa_name\fR is an array of algorithm names, terminated by an element
containing a \fINULL\fR pointer. \fBa_name[0]\fR is the  primary name for the
algorithm.
.sp
.LP
\fBa_proto_num\fR is the protocol identifier of this algorithm. \fBa_alg_num\fR
is the algorithm number. \fBa_mech_name\fR contains the mechanism name
associated with the algorithm.
.sp
.LP
\fBa_block_sizes\fR is an array containing the supported block lengths or MAC
lengths, in bytes, supported by the algorithm.  The last valid value in the
array is followed by an element containing the value \fB0\fR.
.SH ERRORS
.LP
When the specified algorithm cannot be returned to the caller,
\fBgetipsecalgbynam()\fR and \fBgetipsecalgbynum()\fR return a value of
\fINULL\fR and set the integer pointed to by the \fIerrnop\fR parameter to one
of the following values:
.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
Not enough memory
.RE

.sp
.ne 2
.na
\fB\fBENOENT\fR\fR
.ad
.RS 10n
Specified algorithm not found
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
Specified protocol number not found
.RE

.SH ATTRIBUTES
.LP
See \fBattributes\fR(7)  for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
MT Level	MT Safe
_
Interface Stability	Evolving
.TE

.SH SEE ALSO
.LP
.BR getipsecprotobyname (3NSL),
.BR getipsecprotobyname (3NSL),
.BR attributes (7),
.BR cryptoadm (8),
.BR ipsecalgs (8)
.sp
.LP
Piper, D. \fIRFC 2407, The Internet IP Security Domain of Interpretation for
ISAKMP\fR. Network Working Group. November, 1998.