]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/man3/DEFINE_STACK_OF.3
Merge OpenSSL 1.1.1i.
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / man3 / DEFINE_STACK_OF.3
1 .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{\
60 .    if \nF \{\
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{\
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "DEFINE_STACK_OF 3"
136 .TH DEFINE_STACK_OF 3 "2020-12-08" "1.1.1i" "OpenSSL"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 DEFINE_STACK_OF, DEFINE_STACK_OF_CONST, DEFINE_SPECIAL_STACK_OF, DEFINE_SPECIAL_STACK_OF_CONST, sk_TYPE_num, sk_TYPE_value, sk_TYPE_new, sk_TYPE_new_null, sk_TYPE_reserve, sk_TYPE_free, sk_TYPE_zero, sk_TYPE_delete, sk_TYPE_delete_ptr, sk_TYPE_push, sk_TYPE_unshift, sk_TYPE_pop, sk_TYPE_shift, sk_TYPE_pop_free, sk_TYPE_insert, sk_TYPE_set, sk_TYPE_find, sk_TYPE_find_ex, sk_TYPE_sort, sk_TYPE_is_sorted, sk_TYPE_dup, sk_TYPE_deep_copy, sk_TYPE_set_cmp_func, sk_TYPE_new_reserve \&\- stack container
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 .Vb 1
146 \& #include <openssl/safestack.h>
147 \&
148 \& STACK_OF(TYPE)
149 \& DEFINE_STACK_OF(TYPE)
150 \& DEFINE_STACK_OF_CONST(TYPE)
151 \& DEFINE_SPECIAL_STACK_OF(FUNCTYPE, TYPE)
152 \& DEFINE_SPECIAL_STACK_OF_CONST(FUNCTYPE, TYPE)
153 \&
154 \& typedef int (*sk_TYPE_compfunc)(const TYPE *const *a, const TYPE *const *b);
155 \& typedef TYPE * (*sk_TYPE_copyfunc)(const TYPE *a);
156 \& typedef void (*sk_TYPE_freefunc)(TYPE *a);
157 \&
158 \& int sk_TYPE_num(const STACK_OF(TYPE) *sk);
159 \& TYPE *sk_TYPE_value(const STACK_OF(TYPE) *sk, int idx);
160 \& STACK_OF(TYPE) *sk_TYPE_new(sk_TYPE_compfunc compare);
161 \& STACK_OF(TYPE) *sk_TYPE_new_null(void);
162 \& int sk_TYPE_reserve(STACK_OF(TYPE) *sk, int n);
163 \& void sk_TYPE_free(const STACK_OF(TYPE) *sk);
164 \& void sk_TYPE_zero(const STACK_OF(TYPE) *sk);
165 \& TYPE *sk_TYPE_delete(STACK_OF(TYPE) *sk, int i);
166 \& TYPE *sk_TYPE_delete_ptr(STACK_OF(TYPE) *sk, TYPE *ptr);
167 \& int sk_TYPE_push(STACK_OF(TYPE) *sk, const TYPE *ptr);
168 \& int sk_TYPE_unshift(STACK_OF(TYPE) *sk, const TYPE *ptr);
169 \& TYPE *sk_TYPE_pop(STACK_OF(TYPE) *sk);
170 \& TYPE *sk_TYPE_shift(STACK_OF(TYPE) *sk);
171 \& void sk_TYPE_pop_free(STACK_OF(TYPE) *sk, sk_TYPE_freefunc freefunc);
172 \& int sk_TYPE_insert(STACK_OF(TYPE) *sk, TYPE *ptr, int idx);
173 \& TYPE *sk_TYPE_set(STACK_OF(TYPE) *sk, int idx, const TYPE *ptr);
174 \& int sk_TYPE_find(STACK_OF(TYPE) *sk, TYPE *ptr);
175 \& int sk_TYPE_find_ex(STACK_OF(TYPE) *sk, TYPE *ptr);
176 \& void sk_TYPE_sort(const STACK_OF(TYPE) *sk);
177 \& int sk_TYPE_is_sorted(const STACK_OF(TYPE) *sk);
178 \& STACK_OF(TYPE) *sk_TYPE_dup(const STACK_OF(TYPE) *sk);
179 \& STACK_OF(TYPE) *sk_TYPE_deep_copy(const STACK_OF(TYPE) *sk,
180 \&                                   sk_TYPE_copyfunc copyfunc,
181 \&                                   sk_TYPE_freefunc freefunc);
182 \& sk_TYPE_compfunc (*sk_TYPE_set_cmp_func(STACK_OF(TYPE) *sk,
183 \&                                         sk_TYPE_compfunc compare));
184 \& STACK_OF(TYPE) *sk_TYPE_new_reserve(sk_TYPE_compfunc compare, int n);
185 .Ve
186 .SH "DESCRIPTION"
187 .IX Header "DESCRIPTION"
188 Applications can create and use their own stacks by placing any of the macros
189 described below in a header file. These macros define typesafe inline
190 functions that wrap around the utility \fBOPENSSL_sk_\fR \s-1API.\s0
191 In the description here, \fI\s-1TYPE\s0\fR is used
192 as a placeholder for any of the OpenSSL datatypes, such as \fIX509\fR.
193 .PP
194 \&\s-1\fBSTACK_OF\s0()\fR returns the name for a stack of the specified \fB\s-1TYPE\s0\fR.
195 \&\s-1\fBDEFINE_STACK_OF\s0()\fR creates set of functions for a stack of \fB\s-1TYPE\s0\fR. This
196 will mean that type \fB\s-1TYPE\s0\fR is stored in each stack, the type is referenced by
197 \&\s-1STACK_OF\s0(\s-1TYPE\s0) and each function name begins with \fIsk_TYPE_\fR. For example:
198 .PP
199 .Vb 1
200 \& TYPE *sk_TYPE_value(STACK_OF(TYPE) *sk, int idx);
201 .Ve
202 .PP
203 \&\s-1\fBDEFINE_STACK_OF_CONST\s0()\fR is identical to \s-1\fBDEFINE_STACK_OF\s0()\fR except
204 each element is constant. For example:
205 .PP
206 .Vb 1
207 \& const TYPE *sk_TYPE_value(STACK_OF(TYPE) *sk, int idx);
208 .Ve
209 .PP
210 \&\s-1\fBDEFINE_SPECIAL_STACK_OF\s0()\fR defines a stack of \fB\s-1TYPE\s0\fR but
211 each function uses \fB\s-1FUNCNAME\s0\fR in the function name. For example:
212 .PP
213 .Vb 1
214 \& TYPE *sk_FUNCNAME_value(STACK_OF(TYPE) *sk, int idx);
215 .Ve
216 .PP
217 \&\s-1\fBDEFINE_SPECIAL_STACK_OF_CONST\s0()\fR is similar except that each element is
218 constant:
219 .PP
220 .Vb 1
221 \& const TYPE *sk_FUNCNAME_value(STACK_OF(TYPE) *sk, int idx);
222 .Ve
223 .PP
224 \&\fBsk_TYPE_num()\fR returns the number of elements in \fBsk\fR or \-1 if \fBsk\fR is
225 \&\fB\s-1NULL\s0\fR.
226 .PP
227 \&\fBsk_TYPE_value()\fR returns element \fBidx\fR in \fBsk\fR, where \fBidx\fR starts at
228 zero. If \fBidx\fR is out of range then \fB\s-1NULL\s0\fR is returned.
229 .PP
230 \&\fBsk_TYPE_new()\fR allocates a new empty stack using comparison function \fBcompare\fR.
231 If \fBcompare\fR is \fB\s-1NULL\s0\fR then no comparison function is used. This function is
232 equivalent to sk_TYPE_new_reserve(compare, 0).
233 .PP
234 \&\fBsk_TYPE_new_null()\fR allocates a new empty stack with no comparison function. This
235 function is equivalent to sk_TYPE_new_reserve(\s-1NULL, 0\s0).
236 .PP
237 \&\fBsk_TYPE_reserve()\fR allocates additional memory in the \fBsk\fR structure
238 such that the next \fBn\fR calls to \fBsk_TYPE_insert()\fR, \fBsk_TYPE_push()\fR
239 or \fBsk_TYPE_unshift()\fR will not fail or cause memory to be allocated
240 or reallocated. If \fBn\fR is zero, any excess space allocated in the
241 \&\fBsk\fR structure is freed. On error \fBsk\fR is unchanged.
242 .PP
243 \&\fBsk_TYPE_new_reserve()\fR allocates a new stack. The new stack will have additional
244 memory allocated to hold \fBn\fR elements if \fBn\fR is positive. The next \fBn\fR calls
245 to \fBsk_TYPE_insert()\fR, \fBsk_TYPE_push()\fR or \fBsk_TYPE_unshift()\fR will not fail or cause
246 memory to be allocated or reallocated. If \fBn\fR is zero or less than zero, no
247 memory is allocated. \fBsk_TYPE_new_reserve()\fR also sets the comparison function
248 \&\fBcompare\fR to the newly created stack. If \fBcompare\fR is \fB\s-1NULL\s0\fR then no
249 comparison function is used.
250 .PP
251 \&\fBsk_TYPE_set_cmp_func()\fR sets the comparison function of \fBsk\fR to \fBcompare\fR.
252 The previous comparison function is returned or \fB\s-1NULL\s0\fR if there was
253 no previous comparison function.
254 .PP
255 \&\fBsk_TYPE_free()\fR frees up the \fBsk\fR structure. It does \fBnot\fR free up any
256 elements of \fBsk\fR. After this call \fBsk\fR is no longer valid.
257 .PP
258 \&\fBsk_TYPE_zero()\fR sets the number of elements in \fBsk\fR to zero. It does not free
259 \&\fBsk\fR so after this call \fBsk\fR is still valid.
260 .PP
261 \&\fBsk_TYPE_pop_free()\fR frees up all elements of \fBsk\fR and \fBsk\fR itself. The
262 free function \fBfreefunc()\fR is called on each element to free it.
263 .PP
264 \&\fBsk_TYPE_delete()\fR deletes element \fBi\fR from \fBsk\fR. It returns the deleted
265 element or \fB\s-1NULL\s0\fR if \fBi\fR is out of range.
266 .PP
267 \&\fBsk_TYPE_delete_ptr()\fR deletes element matching \fBptr\fR from \fBsk\fR. It returns
268 the deleted element or \fB\s-1NULL\s0\fR if no element matching \fBptr\fR was found.
269 .PP
270 \&\fBsk_TYPE_insert()\fR inserts \fBptr\fR into \fBsk\fR at position \fBidx\fR. Any existing
271 elements at or after \fBidx\fR are moved downwards. If \fBidx\fR is out of range
272 the new element is appended to \fBsk\fR. \fBsk_TYPE_insert()\fR either returns the
273 number of elements in \fBsk\fR after the new element is inserted or zero if
274 an error (such as memory allocation failure) occurred.
275 .PP
276 \&\fBsk_TYPE_push()\fR appends \fBptr\fR to \fBsk\fR it is equivalent to:
277 .PP
278 .Vb 1
279 \& sk_TYPE_insert(sk, ptr, \-1);
280 .Ve
281 .PP
282 \&\fBsk_TYPE_unshift()\fR inserts \fBptr\fR at the start of \fBsk\fR it is equivalent to:
283 .PP
284 .Vb 1
285 \& sk_TYPE_insert(sk, ptr, 0);
286 .Ve
287 .PP
288 \&\fBsk_TYPE_pop()\fR returns and removes the last element from \fBsk\fR.
289 .PP
290 \&\fBsk_TYPE_shift()\fR returns and removes the first element from \fBsk\fR.
291 .PP
292 \&\fBsk_TYPE_set()\fR sets element \fBidx\fR of \fBsk\fR to \fBptr\fR replacing the current
293 element. The new element value is returned or \fB\s-1NULL\s0\fR if an error occurred:
294 this will only happen if \fBsk\fR is \fB\s-1NULL\s0\fR or \fBidx\fR is out of range.
295 .PP
296 \&\fBsk_TYPE_find()\fR searches \fBsk\fR for the element \fBptr\fR.  In the case
297 where no comparison function has been specified, the function performs
298 a linear search for a pointer equal to \fBptr\fR. The index of the first
299 matching element is returned or \fB\-1\fR if there is no match. In the case
300 where a comparison function has been specified, \fBsk\fR is sorted then
301 \&\fBsk_TYPE_find()\fR returns the index of a matching element or \fB\-1\fR if there
302 is no match. Note that, in this case, the matching element returned is
303 not guaranteed to be the first; the comparison function will usually
304 compare the values pointed to rather than the pointers themselves and
305 the order of elements in \fBsk\fR could change.
306 .PP
307 \&\fBsk_TYPE_find_ex()\fR operates like \fBsk_TYPE_find()\fR except when a comparison
308 function has been specified and no matching element is found. Instead
309 of returning \fB\-1\fR, \fBsk_TYPE_find_ex()\fR returns the index of the element
310 either before or after the location where \fBptr\fR would be if it were
311 present in \fBsk\fR.
312 .PP
313 \&\fBsk_TYPE_sort()\fR sorts \fBsk\fR using the supplied comparison function.
314 .PP
315 \&\fBsk_TYPE_is_sorted()\fR returns \fB1\fR if \fBsk\fR is sorted and \fB0\fR otherwise.
316 .PP
317 \&\fBsk_TYPE_dup()\fR returns a copy of \fBsk\fR. Note the pointers in the copy
318 are identical to the original.
319 .PP
320 \&\fBsk_TYPE_deep_copy()\fR returns a new stack where each element has been copied.
321 Copying is performed by the supplied \fBcopyfunc()\fR and freeing by \fBfreefunc()\fR. The
322 function \fBfreefunc()\fR is only called if an error occurs.
323 .SH "NOTES"
324 .IX Header "NOTES"
325 Care should be taken when accessing stacks in multi-threaded environments.
326 Any operation which increases the size of a stack such as \fBsk_TYPE_insert()\fR or
327 \&\fBsk_push()\fR can \*(L"grow\*(R" the size of an internal array and cause race conditions
328 if the same stack is accessed in a different thread. Operations such as
329 \&\fBsk_find()\fR and \fBsk_sort()\fR can also reorder the stack.
330 .PP
331 Any comparison function supplied should use a metric suitable
332 for use in a binary search operation. That is it should return zero, a
333 positive or negative value if \fBa\fR is equal to, greater than
334 or less than \fBb\fR respectively.
335 .PP
336 Care should be taken when checking the return values of the functions
337 \&\fBsk_TYPE_find()\fR and \fBsk_TYPE_find_ex()\fR. They return an index to the
338 matching element. In particular \fB0\fR indicates a matching first element.
339 A failed search is indicated by a \fB\-1\fR return value.
340 .PP
341 \&\s-1\fBSTACK_OF\s0()\fR, \s-1\fBDEFINE_STACK_OF\s0()\fR, \s-1\fBDEFINE_STACK_OF_CONST\s0()\fR, and
342 \&\s-1\fBDEFINE_SPECIAL_STACK_OF\s0()\fR are implemented as macros.
343 .PP
344 The underlying utility \fBOPENSSL_sk_\fR \s-1API\s0 should not be used directly.
345 It defines these functions: \fBOPENSSL_sk_deep_copy()\fR,
346 \&\fBOPENSSL_sk_delete()\fR, \fBOPENSSL_sk_delete_ptr()\fR, \fBOPENSSL_sk_dup()\fR,
347 \&\fBOPENSSL_sk_find()\fR, \fBOPENSSL_sk_find_ex()\fR, \fBOPENSSL_sk_free()\fR,
348 \&\fBOPENSSL_sk_insert()\fR, \fBOPENSSL_sk_is_sorted()\fR, \fBOPENSSL_sk_new()\fR,
349 \&\fBOPENSSL_sk_new_null()\fR, \fBOPENSSL_sk_num()\fR, \fBOPENSSL_sk_pop()\fR,
350 \&\fBOPENSSL_sk_pop_free()\fR, \fBOPENSSL_sk_push()\fR, \fBOPENSSL_sk_reserve()\fR,
351 \&\fBOPENSSL_sk_set()\fR, \fBOPENSSL_sk_set_cmp_func()\fR, \fBOPENSSL_sk_shift()\fR,
352 \&\fBOPENSSL_sk_sort()\fR, \fBOPENSSL_sk_unshift()\fR, \fBOPENSSL_sk_value()\fR,
353 \&\fBOPENSSL_sk_zero()\fR.
354 .SH "RETURN VALUES"
355 .IX Header "RETURN VALUES"
356 \&\fBsk_TYPE_num()\fR returns the number of elements in the stack or \fB\-1\fR if the
357 passed stack is \fB\s-1NULL\s0\fR.
358 .PP
359 \&\fBsk_TYPE_value()\fR returns a pointer to a stack element or \fB\s-1NULL\s0\fR if the
360 index is out of range.
361 .PP
362 \&\fBsk_TYPE_new()\fR, \fBsk_TYPE_new_null()\fR and \fBsk_TYPE_new_reserve()\fR return an empty
363 stack or \fB\s-1NULL\s0\fR if an error occurs.
364 .PP
365 \&\fBsk_TYPE_reserve()\fR returns \fB1\fR on successful allocation of the required memory
366 or \fB0\fR on error.
367 .PP
368 \&\fBsk_TYPE_set_cmp_func()\fR returns the old comparison function or \fB\s-1NULL\s0\fR if
369 there was no old comparison function.
370 .PP
371 \&\fBsk_TYPE_free()\fR, \fBsk_TYPE_zero()\fR, \fBsk_TYPE_pop_free()\fR and \fBsk_TYPE_sort()\fR do
372 not return values.
373 .PP
374 \&\fBsk_TYPE_pop()\fR, \fBsk_TYPE_shift()\fR, \fBsk_TYPE_delete()\fR and \fBsk_TYPE_delete_ptr()\fR
375 return a pointer to the deleted element or \fB\s-1NULL\s0\fR on error.
376 .PP
377 \&\fBsk_TYPE_insert()\fR, \fBsk_TYPE_push()\fR and \fBsk_TYPE_unshift()\fR return the total
378 number of elements in the stack and 0 if an error occurred.
379 .PP
380 \&\fBsk_TYPE_set()\fR returns a pointer to the replacement element or \fB\s-1NULL\s0\fR on
381 error.
382 .PP
383 \&\fBsk_TYPE_find()\fR and \fBsk_TYPE_find_ex()\fR return an index to the found element
384 or \fB\-1\fR on error.
385 .PP
386 \&\fBsk_TYPE_is_sorted()\fR returns \fB1\fR if the stack is sorted and \fB0\fR if it is
387 not.
388 .PP
389 \&\fBsk_TYPE_dup()\fR and \fBsk_TYPE_deep_copy()\fR return a pointer to the copy of the
390 stack.
391 .SH "HISTORY"
392 .IX Header "HISTORY"
393 Before OpenSSL 1.1.0, this was implemented via macros and not inline functions
394 and was not a public \s-1API.\s0
395 .PP
396 \&\fBsk_TYPE_reserve()\fR and \fBsk_TYPE_new_reserve()\fR were added in OpenSSL 1.1.1.
397 .SH "COPYRIGHT"
398 .IX Header "COPYRIGHT"
399 Copyright 2000\-2017 The OpenSSL Project Authors. All Rights Reserved.
400 .PP
401 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
402 this file except in compliance with the License.  You can obtain a copy
403 in the file \s-1LICENSE\s0 in the source distribution or at
404 <https://www.openssl.org/source/license.html>.