xref: /openbsd-src/lib/libcrypto/man/DSA_meth_new.3 (revision 5a38ef86d0b61900239c7913d24a05e7b88a58f0)
1.\" $OpenBSD: DSA_meth_new.3,v 1.1 2018/03/18 13:06:36 schwarze Exp $
2.\" selective merge up to: OpenSSL a970b14f Jul 31 18:58:40 2017 -0400
3.\"
4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
8.\"
9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
21.\" The original file was written by Matt Caswell <matt@openssl.org>.
22.\" Copyright (c) 2016 The OpenSSL Project.  All rights reserved.
23.\"
24.\" Redistribution and use in source and binary forms, with or without
25.\" modification, are permitted provided that the following conditions
26.\" are met:
27.\"
28.\" 1. Redistributions of source code must retain the above copyright
29.\"    notice, this list of conditions and the following disclaimer.
30.\"
31.\" 2. Redistributions in binary form must reproduce the above copyright
32.\"    notice, this list of conditions and the following disclaimer in
33.\"    the documentation and/or other materials provided with the
34.\"    distribution.
35.\"
36.\" 3. All advertising materials mentioning features or use of this
37.\"    software must display the following acknowledgment:
38.\"    "This product includes software developed by the OpenSSL Project
39.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
40.\"
41.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
42.\"    endorse or promote products derived from this software without
43.\"    prior written permission. For written permission, please contact
44.\"    openssl-core@openssl.org.
45.\"
46.\" 5. Products derived from this software may not be called "OpenSSL"
47.\"    nor may "OpenSSL" appear in their names without prior written
48.\"    permission of the OpenSSL Project.
49.\"
50.\" 6. Redistributions of any form whatsoever must retain the following
51.\"    acknowledgment:
52.\"    "This product includes software developed by the OpenSSL Project
53.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
54.\"
55.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
56.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
59.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
62.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
64.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\"
68.Dd $Mdocdate: March 18 2018 $
69.Dt DSA_METH_NEW 3
70.Os
71.Sh NAME
72.Nm DSA_meth_new ,
73.Nm DSA_meth_free ,
74.Nm DSA_meth_dup ,
75.Nm DSA_meth_set_sign ,
76.Nm DSA_meth_set_finish
77.Nd build up DSA methods
78.Sh SYNOPSIS
79.In openssl/dsa.h
80.Ft DSA_METHOD *
81.Fo DSA_meth_new
82.Fa "const char *name"
83.Fa "int flags"
84.Fc
85.Ft void
86.Fo DSA_meth_free
87.Fa "DSA_METHOD *meth"
88.Fc
89.Ft DSA_METHOD *
90.Fo DSA_meth_dup
91.Fa "const DSA_METHOD *meth"
92.Fc
93.Ft int
94.Fo DSA_meth_set_sign
95.Fa "DSA_METHOD *meth"
96.Fa "DSA_SIG *(*sign)(const unsigned char *, int, DSA *)"
97.Fc
98.Ft int
99.Fo DSA_meth_set_finish
100.Fa "DSA_METHOD *meth"
101.Fa "int (*finish)(DSA *)"
102.Fc
103.Sh DESCRIPTION
104The
105.Vt DSA_METHOD
106structure holds function pinters for custom DSA implementations.
107.Pp
108.Fn DSA_meth_new
109creates a new
110.Vt DSA_METHOD
111structure.
112A copy of the NUL-terminated
113.Fa name
114is stored in the new
115.Vt DSA_METHOD
116object.
117Any new
118.Vt DSA
119object constructed from this
120.Vt DSA_METHOD
121will have the given
122.Fa flags
123set by default.
124.Pp
125.Fn DSA_meth_dup
126creates a deep copy of
127.Fa meth .
128This might be useful for creating a new
129.Vt DSA_METHOD
130based on an existing one, but with some differences.
131.Pp
132.Fn DSA_meth_free
133destroys
134.Fa meth
135and frees any memory associated with it.
136.Pp
137.Fn DSA_meth_set_sign
138sets the function used for creating a DSA signature.
139This function will be called from
140.Xr DSA_do_sign 3
141and indirectly from
142.Xr DSA_sign 3 .
143The parameters of
144.Fa sign
145have the same meaning as for
146.Xr DSA_do_sign 3 .
147.Pp
148.Fn DSA_meth_set_finish
149sets an optional function for destroying a
150.Vt DSA
151object.
152Unless
153.Fa finish
154is
155.Dv NULL ,
156it will be called from
157.Xr DSA_free 3 .
158It takes the same argument
159and is intended to do DSA implementation specific cleanup.
160The memory used by the
161.Vt DSA
162object itself should not be freed by the
163.Fa finish
164function.
165.Sh RETURN VALUES
166.Fn DSA_meth_new
167and
168.Fn DSA_meth_dup
169return the newly allocated DSA_METHOD object or NULL on failure.
170.Pp
171All
172.Fn DSA_meth_set_*
173functions return 1 on success or 0 on failure.
174.Sh SEE ALSO
175.Xr DSA_do_sign 3 ,
176.Xr DSA_new 3 ,
177.Xr DSA_set_method 3 ,
178.Xr DSA_SIG_new 3 ,
179.Xr DSA_sign 3
180.Sh HISTORY
181These functions first appeared in OpenSSL 1.1.0
182and have been available since
183.Ox 6.3 .
184