Blame doc/man3/DH_generate_key.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
DH_generate_key, DH_compute_key - perform Diffie-Hellman key exchange
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/dh.h>
Packit c4476c
Packit c4476c
 int DH_generate_key(DH *dh);
Packit c4476c
Packit c4476c
 int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
DH_generate_key() performs the first step of a Diffie-Hellman key
Packit c4476c
exchange by generating private and public DH values. By calling
Packit c4476c
DH_compute_key(), these are combined with the other party's public
Packit c4476c
value to compute the shared key.
Packit c4476c
Packit c4476c
DH_generate_key() expects B<dh> to contain the shared parameters
Packit c4476c
B<dh-E<gt>p> and B<dh-E<gt>g>. It generates a random private DH value
Packit c4476c
unless B<dh-E<gt>priv_key> is already set, and computes the
Packit c4476c
corresponding public value B<dh-E<gt>pub_key>, which can then be
Packit c4476c
published.
Packit c4476c
Packit c4476c
DH_compute_key() computes the shared secret from the private DH value
Packit c4476c
in B<dh> and the other party's public value in B<pub_key> and stores
Packit c4476c
it in B<key>. B<key> must point to B<DH_size(dh)> bytes of memory.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
DH_generate_key() returns 1 on success, 0 otherwise.
Packit c4476c
Packit c4476c
DH_compute_key() returns the size of the shared secret on success, -1
Packit c4476c
on error.
Packit c4476c
Packit c4476c
The error codes can be obtained by L<ERR_get_error(3)>.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<DH_new(3)>, L<ERR_get_error(3)>, L<RAND_bytes(3)>, L<DH_size(3)>
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut