xref: /freebsd/crypto/openssl/doc/man3/EVP_OpenInit.pod (revision e71b70530d95c4f34d8bdbd78d1242df1ba4a945)
1*e71b7053SJung-uk Kim=pod
2*e71b7053SJung-uk Kim
3*e71b7053SJung-uk Kim=head1 NAME
4*e71b7053SJung-uk Kim
5*e71b7053SJung-uk KimEVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption
6*e71b7053SJung-uk Kim
7*e71b7053SJung-uk Kim=head1 SYNOPSIS
8*e71b7053SJung-uk Kim
9*e71b7053SJung-uk Kim #include <openssl/evp.h>
10*e71b7053SJung-uk Kim
11*e71b7053SJung-uk Kim int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,
12*e71b7053SJung-uk Kim                  int ekl, unsigned char *iv, EVP_PKEY *priv);
13*e71b7053SJung-uk Kim int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
14*e71b7053SJung-uk Kim                    int *outl, unsigned char *in, int inl);
15*e71b7053SJung-uk Kim int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
16*e71b7053SJung-uk Kim
17*e71b7053SJung-uk Kim=head1 DESCRIPTION
18*e71b7053SJung-uk Kim
19*e71b7053SJung-uk KimThe EVP envelope routines are a high level interface to envelope
20*e71b7053SJung-uk Kimdecryption. They decrypt a public key encrypted symmetric key and
21*e71b7053SJung-uk Kimthen decrypt data using it.
22*e71b7053SJung-uk Kim
23*e71b7053SJung-uk KimEVP_OpenInit() initializes a cipher context B<ctx> for decryption
24*e71b7053SJung-uk Kimwith cipher B<type>. It decrypts the encrypted symmetric key of length
25*e71b7053SJung-uk KimB<ekl> bytes passed in the B<ek> parameter using the private key B<priv>.
26*e71b7053SJung-uk KimThe IV is supplied in the B<iv> parameter.
27*e71b7053SJung-uk Kim
28*e71b7053SJung-uk KimEVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties
29*e71b7053SJung-uk Kimas the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as
30*e71b7053SJung-uk Kimdocumented on the L<EVP_EncryptInit(3)> manual
31*e71b7053SJung-uk Kimpage.
32*e71b7053SJung-uk Kim
33*e71b7053SJung-uk Kim=head1 NOTES
34*e71b7053SJung-uk Kim
35*e71b7053SJung-uk KimIt is possible to call EVP_OpenInit() twice in the same way as
36*e71b7053SJung-uk KimEVP_DecryptInit(). The first call should have B<priv> set to NULL
37*e71b7053SJung-uk Kimand (after setting any cipher parameters) it should be called again
38*e71b7053SJung-uk Kimwith B<type> set to NULL.
39*e71b7053SJung-uk Kim
40*e71b7053SJung-uk KimIf the cipher passed in the B<type> parameter is a variable length
41*e71b7053SJung-uk Kimcipher then the key length will be set to the value of the recovered
42*e71b7053SJung-uk Kimkey length. If the cipher is a fixed length cipher then the recovered
43*e71b7053SJung-uk Kimkey length must match the fixed cipher length.
44*e71b7053SJung-uk Kim
45*e71b7053SJung-uk Kim=head1 RETURN VALUES
46*e71b7053SJung-uk Kim
47*e71b7053SJung-uk KimEVP_OpenInit() returns 0 on error or a non zero integer (actually the
48*e71b7053SJung-uk Kimrecovered secret key size) if successful.
49*e71b7053SJung-uk Kim
50*e71b7053SJung-uk KimEVP_OpenUpdate() returns 1 for success or 0 for failure.
51*e71b7053SJung-uk Kim
52*e71b7053SJung-uk KimEVP_OpenFinal() returns 0 if the decrypt failed or 1 for success.
53*e71b7053SJung-uk Kim
54*e71b7053SJung-uk Kim=head1 SEE ALSO
55*e71b7053SJung-uk Kim
56*e71b7053SJung-uk KimL<evp(7)>, L<RAND_bytes(3)>,
57*e71b7053SJung-uk KimL<EVP_EncryptInit(3)>,
58*e71b7053SJung-uk KimL<EVP_SealInit(3)>
59*e71b7053SJung-uk Kim
60*e71b7053SJung-uk Kim=head1 COPYRIGHT
61*e71b7053SJung-uk Kim
62*e71b7053SJung-uk KimCopyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
63*e71b7053SJung-uk Kim
64*e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License").  You may not use
65*e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
66*e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
67*e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
68*e71b7053SJung-uk Kim
69*e71b7053SJung-uk Kim=cut
70