xref: /openbsd-src/lib/libcrypto/man/crypto.3 (revision 99fd087599a8791921855f21bd7e36130f39aadc)
1.\"	$OpenBSD: crypto.3,v 1.23 2019/11/02 15:28:04 schwarze Exp $
2.\"	OpenSSL a9c85cea Nov 11 09:33:55 2016 +0100
3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org> and
5.\" Dr. Stephen Henson <steve@openssl.org>.
6.\" Copyright (c) 2000, 2002 The OpenSSL Project.  All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\"
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\"
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in
17.\"    the documentation and/or other materials provided with the
18.\"    distribution.
19.\"
20.\" 3. All advertising materials mentioning features or use of this
21.\"    software must display the following acknowledgment:
22.\"    "This product includes software developed by the OpenSSL Project
23.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24.\"
25.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26.\"    endorse or promote products derived from this software without
27.\"    prior written permission. For written permission, please contact
28.\"    openssl-core@openssl.org.
29.\"
30.\" 5. Products derived from this software may not be called "OpenSSL"
31.\"    nor may "OpenSSL" appear in their names without prior written
32.\"    permission of the OpenSSL Project.
33.\"
34.\" 6. Redistributions of any form whatsoever must retain the following
35.\"    acknowledgment:
36.\"    "This product includes software developed by the OpenSSL Project
37.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38.\"
39.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\"
52.Dd $Mdocdate: November 2 2019 $
53.Dt CRYPTO 3
54.Os
55.Sh NAME
56.Nm crypto
57.Nd OpenSSL cryptographic library
58.Sh DESCRIPTION
59The OpenSSL crypto library implements a wide range of cryptographic
60algorithms used in various Internet standards.
61The services provided by this library are used by the OpenSSL
62implementations of TLS and S/MIME, and they have also been used to
63implement SSH, OpenPGP, and other cryptographic standards.
64.Pp
65.Sy Symmetric ciphers
66including AES, Blowfish, CAST, Chacha20, IDEA, DES, RC2, and RC4
67are provided by the generic interface
68.Xr EVP_EncryptInit 3 .
69Low-level stand-alone interfaces include
70.Xr AES_encrypt 3 ,
71.Xr BF_set_key 3 ,
72.Xr DES_set_key 3 ,
73and
74.Xr RC4 3 .
75.Pp
76.Sy Public key cryptography and key agreement
77are provided by
78.Xr DH_new 3 ,
79.Xr ECDH_compute_key 3 ,
80.Xr X25519 3 ,
81.Xr DSA_new 3 ,
82.Xr ECDSA_SIG_new 3 ,
83.Xr RSA_new 3 ,
84and
85.Xr EVP_PKEY_new 3 .
86.Pp
87.Sy Certificates
88are handled by
89.Xr X509_new 3
90and
91.Xr X509v3_add_ext 3 .
92.Pp
93.Sy Authentication codes and hash functions
94offered include
95.Xr EVP_DigestInit 3 ,
96.Xr HMAC 3 ,
97.Xr MD4 3 ,
98.Xr MD5 3 ,
99.Xr RIPEMD160 3 ,
100.Xr SHA1 3 ,
101and
102.Xr SHA256 3 .
103.Pp
104.Sy Input, output, and data encoding
105facilities include
106.Xr ASN1_TYPE_get 3 ,
107.Xr BIO_new 3 ,
108.Xr CMS_ContentInfo_new 3 ,
109.Xr evp 3 ,
110.Xr EVP_EncodeInit 3 ,
111.Xr PEM_read 3 ,
112.Xr PKCS7_encrypt 3 ,
113.Xr PKCS7_sign 3 ,
114.Xr PKCS12_create 3 ,
115and
116.Xr SMIME_write_PKCS7 3 .
117.Pp
118.Sy Auxiliary features include:
119.Bl -dash -compact
120.It
121configuration file handling: see
122.Xr OPENSSL_config 3
123.It
124error reporting: see
125.Xr ERR 3
126.It
127.Xr OCSP_REQUEST_new 3
128.It
129.Xr UI_new 3
130.El
131.Pp
132.Sy Internal utilities
133include
134.Xr BIO_f_buffer 3 ,
135.Xr BN_new 3 ,
136.Xr EC_GROUP_new 3 ,
137.Xr lh_new 3 ,
138and
139.Xr STACK_OF 3 .
140.Pp
141Some of the newer functions follow a naming convention using the numbers
142.Sq 0
143and
144.Sq 1 .
145For example consider the names of these functions:
146.Pp
147.Ft int
148.Fo X509_CRL_add0_revoked
149.Fa "X509_CRL *crl"
150.Fa "X509_REVOKED *rev"
151.Fc
152.br
153.Ft int
154.Fo X509_add1_trust_object
155.Fa "X509 *x"
156.Fa "ASN1_OBJECT *obj"
157.Fc
158.Pp
159The
160.Sq 0
161version uses the supplied structure pointer directly in the parent and
162it will be freed up when the parent is freed.
163In the above example
164.Fa crl
165would be freed but
166.Fa rev
167would not.
168.Pp
169The
170.Sq 1
171function uses a copy of the supplied structure pointer (or in some cases
172increases its link count) in the parent and so both
173.Pf ( Fa x
174and
175.Fa obj
176above) should be freed up.
177.Sh SEE ALSO
178.Xr openssl 1 ,
179.Xr ssl 3
180