From ded909db2702a03a081f7e94d1d8d19f670e51aa Mon Sep 17 00:00:00 2001 From: schwarze Date: Mon, 10 Apr 2017 17:45:06 +0000 Subject: [PATCH] new X25519(3) manual page; from Dr. Stephen Henson , OpenSSL commit d218f3c3 --- lib/libcrypto/man/EVP_PKEY_CTX_new.3 | 7 +- lib/libcrypto/man/EVP_PKEY_derive.3 | 7 +- lib/libcrypto/man/EVP_PKEY_keygen.3 | 7 +- lib/libcrypto/man/Makefile | 3 +- lib/libcrypto/man/X25519.3 | 99 ++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 10 deletions(-) create mode 100644 lib/libcrypto/man/X25519.3 diff --git a/lib/libcrypto/man/EVP_PKEY_CTX_new.3 b/lib/libcrypto/man/EVP_PKEY_CTX_new.3 index d08ce022b0e..72c0e36d5e4 100644 --- a/lib/libcrypto/man/EVP_PKEY_CTX_new.3 +++ b/lib/libcrypto/man/EVP_PKEY_CTX_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.4 2016/11/27 15:22:00 schwarze Exp $ +.\" $OpenBSD: EVP_PKEY_CTX_new.3,v 1.5 2017/04/10 17:45:06 schwarze Exp $ .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 .\" .\" This file was written by Dr. Stephen Henson . @@ -48,7 +48,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: November 27 2016 $ +.Dd $Mdocdate: April 10 2017 $ .Dt EVP_PKEY_CTX_NEW 3 .Os .Sh NAME @@ -123,7 +123,8 @@ structure or .Dv NULL if an error occurred. .Sh SEE ALSO -.Xr EVP_PKEY_new 3 +.Xr EVP_PKEY_new 3 , +.Xr X25519 3 .Sh HISTORY These functions were first added to OpenSSL 1.0.0. .Sh CAVEATS diff --git a/lib/libcrypto/man/EVP_PKEY_derive.3 b/lib/libcrypto/man/EVP_PKEY_derive.3 index 1e40fdb57f6..b8c4c4d610d 100644 --- a/lib/libcrypto/man/EVP_PKEY_derive.3 +++ b/lib/libcrypto/man/EVP_PKEY_derive.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: EVP_PKEY_derive.3,v 1.4 2016/11/27 15:27:19 schwarze Exp $ +.\" $OpenBSD: EVP_PKEY_derive.3,v 1.5 2017/04/10 17:45:06 schwarze Exp $ .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 .\" .\" This file was written by Dr. Stephen Henson . @@ -48,7 +48,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: November 27 2016 $ +.Dd $Mdocdate: April 10 2017 $ .Dt EVP_PKEY_DERIVE 3 .Os .Sh NAME @@ -165,6 +165,7 @@ if (EVP_PKEY_derive(ctx, skey, &skeylen) <= 0) .Xr EVP_PKEY_encrypt 3 , .Xr EVP_PKEY_sign 3 , .Xr EVP_PKEY_verify 3 , -.Xr EVP_PKEY_verify_recover 3 +.Xr EVP_PKEY_verify_recover 3 , +.Xr X25519 3 .Sh HISTORY These functions were first added to OpenSSL 1.0.0. diff --git a/lib/libcrypto/man/EVP_PKEY_keygen.3 b/lib/libcrypto/man/EVP_PKEY_keygen.3 index ba26bb684d0..c393c3ad2c5 100644 --- a/lib/libcrypto/man/EVP_PKEY_keygen.3 +++ b/lib/libcrypto/man/EVP_PKEY_keygen.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: EVP_PKEY_keygen.3,v 1.4 2016/11/27 15:23:29 schwarze Exp $ +.\" $OpenBSD: EVP_PKEY_keygen.3,v 1.5 2017/04/10 17:45:06 schwarze Exp $ .\" OpenSSL 99d63d466 Oct 26 13:56:48 2016 -0400 .\" .\" This file was written by Dr. Stephen Henson . @@ -48,7 +48,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: November 27 2016 $ +.Dd $Mdocdate: April 10 2017 $ .Dt EVP_PKEY_KEYGEN 3 .Os .Sh NAME @@ -280,6 +280,7 @@ genpkey_cb(EVP_PKEY_CTX *ctx) .Xr EVP_PKEY_encrypt 3 , .Xr EVP_PKEY_sign 3 , .Xr EVP_PKEY_verify 3 , -.Xr EVP_PKEY_verify_recover 3 +.Xr EVP_PKEY_verify_recover 3 , +.Xr X25519 3 .Sh HISTORY These functions were first added to OpenSSL 1.0.0. diff --git a/lib/libcrypto/man/Makefile b/lib/libcrypto/man/Makefile index eec7ad39b0b..164f7e24b1f 100644 --- a/lib/libcrypto/man/Makefile +++ b/lib/libcrypto/man/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.119 2017/03/26 00:06:10 schwarze Exp $ +# $OpenBSD: Makefile,v 1.120 2017/04/10 17:45:06 schwarze Exp $ .include @@ -197,6 +197,7 @@ MAN= \ UI_create_method.3 \ UI_get_string_type.3 \ UI_new.3 \ + X25519.3 \ X509V3_get_d2i.3 \ X509_ALGOR_dup.3 \ X509_ATTRIBUTE_new.3 \ diff --git a/lib/libcrypto/man/X25519.3 b/lib/libcrypto/man/X25519.3 new file mode 100644 index 00000000000..3d8ccb8fcdd --- /dev/null +++ b/lib/libcrypto/man/X25519.3 @@ -0,0 +1,99 @@ +.\" $OpenBSD: X25519.3,v 1.1 2017/04/10 17:45:06 schwarze Exp $ +.\" OpenSSL X25519.pod 69687aa8 Mar 28 23:57:28 2017 +0200 +.\" +.\" This file was written by Dr. Stephen Henson . +.\" Copyright (c) 2017 The OpenSSL Project. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" +.\" 3. All advertising materials mentioning features or use of this +.\" software must display the following acknowledgment: +.\" "This product includes software developed by the OpenSSL Project +.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" +.\" +.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to +.\" endorse or promote products derived from this software without +.\" prior written permission. For written permission, please contact +.\" openssl-core@openssl.org. +.\" +.\" 5. Products derived from this software may not be called "OpenSSL" +.\" nor may "OpenSSL" appear in their names without prior written +.\" permission of the OpenSSL Project. +.\" +.\" 6. Redistributions of any form whatsoever must retain the following +.\" acknowledgment: +.\" "This product includes software developed by the OpenSSL Project +.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +.\" OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd $Mdocdate: April 10 2017 $ +.Dt X25519 3 +.Os +.Sh NAME +.Nm X25519 +.Nd EVP_PKEY X25519 support +.Sh DESCRIPTION +The +.Nm +.Vt EVP_PKEY +implementation supports key generation and key derivation using X25519. +It has associated private and public key formats compatible with +draft-ietf-curdle-pkix-03. +.Pp +No additional parameters can be set during key generation. +.Pp +The peer public key must be set using +.Xr EVP_PKEY_derive_set_peer 3 +when performing key derivation. +.Pp +A context for the +.Nm +algorithm can be obtained by calling: +.Pp +.Dl EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(NID_X25519, NULL); +.Sh EXAMPLES +Generate an +.Nm +private key and write it to standard output in PEM format: +.Bd -literal +#include +#include + +EVP_PKEY *pkey = NULL; +EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(NID_X25519, NULL); +EVP_PKEY_keygen_init(pctx); +EVP_PKEY_keygen(pctx, &pkey); +EVP_PKEY_CTX_free(pctx); +PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL); +.Ed +.Pp +The key derivation example in +.Xr EVP_PKEY_derive 3 +can be used with +.Nm . +.Sh SEE ALSO +.Xr EVP_PKEY_CTX_new 3 , +.Xr EVP_PKEY_derive 3 , +.Xr EVP_PKEY_keygen 3 -- 2.20.1