xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/doc/man3/EVP_OpenInit.pod (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos=pod
2*4724848cSchristos
3*4724848cSchristos=head1 NAME
4*4724848cSchristos
5*4724848cSchristosEVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption
6*4724848cSchristos
7*4724848cSchristos=head1 SYNOPSIS
8*4724848cSchristos
9*4724848cSchristos #include <openssl/evp.h>
10*4724848cSchristos
11*4724848cSchristos int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,
12*4724848cSchristos                  int ekl, unsigned char *iv, EVP_PKEY *priv);
13*4724848cSchristos int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
14*4724848cSchristos                    int *outl, unsigned char *in, int inl);
15*4724848cSchristos int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
16*4724848cSchristos
17*4724848cSchristos=head1 DESCRIPTION
18*4724848cSchristos
19*4724848cSchristosThe EVP envelope routines are a high-level interface to envelope
20*4724848cSchristosdecryption. They decrypt a public key encrypted symmetric key and
21*4724848cSchristosthen decrypt data using it.
22*4724848cSchristos
23*4724848cSchristosEVP_OpenInit() initializes a cipher context B<ctx> for decryption
24*4724848cSchristoswith cipher B<type>. It decrypts the encrypted symmetric key of length
25*4724848cSchristosB<ekl> bytes passed in the B<ek> parameter using the private key B<priv>.
26*4724848cSchristosThe IV is supplied in the B<iv> parameter.
27*4724848cSchristos
28*4724848cSchristosEVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties
29*4724848cSchristosas the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as
30*4724848cSchristosdocumented on the L<EVP_EncryptInit(3)> manual
31*4724848cSchristospage.
32*4724848cSchristos
33*4724848cSchristos=head1 NOTES
34*4724848cSchristos
35*4724848cSchristosIt is possible to call EVP_OpenInit() twice in the same way as
36*4724848cSchristosEVP_DecryptInit(). The first call should have B<priv> set to NULL
37*4724848cSchristosand (after setting any cipher parameters) it should be called again
38*4724848cSchristoswith B<type> set to NULL.
39*4724848cSchristos
40*4724848cSchristosIf the cipher passed in the B<type> parameter is a variable length
41*4724848cSchristoscipher then the key length will be set to the value of the recovered
42*4724848cSchristoskey length. If the cipher is a fixed length cipher then the recovered
43*4724848cSchristoskey length must match the fixed cipher length.
44*4724848cSchristos
45*4724848cSchristos=head1 RETURN VALUES
46*4724848cSchristos
47*4724848cSchristosEVP_OpenInit() returns 0 on error or a non zero integer (actually the
48*4724848cSchristosrecovered secret key size) if successful.
49*4724848cSchristos
50*4724848cSchristosEVP_OpenUpdate() returns 1 for success or 0 for failure.
51*4724848cSchristos
52*4724848cSchristosEVP_OpenFinal() returns 0 if the decrypt failed or 1 for success.
53*4724848cSchristos
54*4724848cSchristos=head1 SEE ALSO
55*4724848cSchristos
56*4724848cSchristosL<evp(7)>, L<RAND_bytes(3)>,
57*4724848cSchristosL<EVP_EncryptInit(3)>,
58*4724848cSchristosL<EVP_SealInit(3)>
59*4724848cSchristos
60*4724848cSchristos=head1 COPYRIGHT
61*4724848cSchristos
62*4724848cSchristosCopyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
63*4724848cSchristos
64*4724848cSchristosLicensed under the OpenSSL license (the "License").  You may not use
65*4724848cSchristosthis file except in compliance with the License.  You can obtain a copy
66*4724848cSchristosin the file LICENSE in the source distribution or at
67*4724848cSchristosL<https://www.openssl.org/source/license.html>.
68*4724848cSchristos
69*4724848cSchristos=cut
70