summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/ENGINE_new.3
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/man/ENGINE_new.3154
1 files changed, 154 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/ENGINE_new.3 b/src/lib/libcrypto/man/ENGINE_new.3
new file mode 100644
index 0000000000..ab875ce662
--- /dev/null
+++ b/src/lib/libcrypto/man/ENGINE_new.3
@@ -0,0 +1,154 @@
1.\" $OpenBSD: ENGINE_new.3,v 1.1 2018/04/15 17:02:03 schwarze Exp $
2.\" content checked up to:
3.\" OpenSSL ENGINE_add 1f13ad31 Dec 25 17:50:39 2017 +0800
4.\"
5.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
6.\"
7.\" Permission to use, copy, modify, and distribute this software for any
8.\" purpose with or without fee is hereby granted, provided that the above
9.\" copyright notice and this permission notice appear in all copies.
10.\"
11.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\"
19.Dd $Mdocdate: April 15 2018 $
20.Dt ENGINE_NEW 3
21.Os
22.Sh NAME
23.Nm ENGINE_new ,
24.Nm ENGINE_up_ref ,
25.Nm ENGINE_free ,
26.Nm ENGINE_set_destroy_function ,
27.Nm ENGINE_get_destroy_function
28.Nd create and destroy ENGINE objects
29.Sh SYNOPSIS
30.In openssl/engine.h
31.Ft ENGINE *
32.Fn ENGINE_new void
33.Ft int
34.Fo ENGINE_up_ref
35.Fa "ENGINE *e"
36.Fc
37.Ft int
38.Fo ENGINE_free
39.Fa "ENGINE *e"
40.Fc
41.Ft typedef int
42.Fo (*ENGINE_GEN_INT_FUNC_PTR)
43.Fa "ENGINE *e"
44.Fc
45.Ft int
46.Fo ENGINE_set_destroy_function
47.Fa "ENGINE *e"
48.Fa "ENGINE_GEN_INT_FUNC_PTR destroy_f"
49.Fc
50.Ft ENGINE_GEN_INT_FUNC_PTR
51.Fo ENGINE_get_destroy_function
52.Fa "const ENGINE *e"
53.Fc
54.Sh DESCRIPTION
55.Fn ENGINE_new
56allocates and initializes an empty
57.Vt ENGINE
58object and sets its structural reference count to 1
59and its functional reference count to 0.
60For more information about the functional reference count, see the
61.Xr ENGINE_init 3
62manual page.
63.Pp
64Many functions increment the structural reference count by 1
65when successful.
66Some of them, including
67.Xr ENGINE_get_first 3 ,
68.Xr ENGINE_get_last 3 ,
69.Xr ENGINE_get_next 3 ,
70.Xr ENGINE_get_prev 3 ,
71and
72.Xr ENGINE_by_id 3 ,
73do so because they return a structural reference to the user.
74Other functions, including
75.Xr ENGINE_add 3 ,
76.Xr ENGINE_init 3 ,
77.Xr ENGINE_get_cipher_engine 3 ,
78.Xr ENGINE_get_digest_engine 3 ,
79and the
80.Xr ENGINE_get_default_RSA 3
81and
82.Xr ENGINE_set_default 3
83families of functions
84do so when they store a structural refence internally.
85.Pp
86.Fn ENGINE_up_ref
87explicitly increment the structural reference count by 1.
88.Pp
89.Fn ENGINE_free
90decrements the structural reference count by 1,
91and if it reaches 0, the optional
92.Fa destroy_f
93previously installed with
94.Fn ENGINE_set_destroy_function
95is called, if one is installed, and both the memory used internally by
96.Fa e
97and
98.Fa e
99itself are freed.
100If
101.Fa e
102is a
103.Dv NULL
104pointer, no action occurs.
105.Pp
106Many functions internally call the equivalent of
107.Fn ENGINE_free .
108Some of them, including
109.Xr ENGINE_get_next 3
110and
111.Xr ENGINE_get_prev 3 ,
112thus invalidate the structural reference passed in by the user.
113Other functions, including
114.Xr ENGINE_finish 3 ,
115.Xr ENGINE_remove 3 ,
116and the
117.Xr ENGINE_set_default 3
118family of functions
119do so when an internally stored structural reference is no longer needed.
120.Pp
121.Fn ENGINE_set_destroy_function
122installs a callback function that will be called by
123.Fn ENGINE_free ,
124but only when
125.Fa e
126actually gets destroyed,
127not when only its reference count gets decremented.
128The value returned from the
129.Fa destroy_f
130will be ignored.
131.Sh RETURN VALUES
132.Fn ENGINE_new
133returns a structural reference to the new
134.Vt ENGINE
135object or
136.Dv NULL
137if an error occurs.
138.Pp
139.Fn ENGINE_up_ref
140returns 0 if
141.Fa e
142is
143.Dv NULL
144and 1 otherwise.
145.Pp
146.Fn ENGINE_free
147and
148.Fn ENGINE_set_destroy_function
149always return 1.
150.Pp
151.Fn ENGINE_get_destroy_function
152returns a function pointer to the callback, or
153.Dv NULL
154if none is installed.