[openssl] openssl-3.0 update
Dr. Paul Dale
pauli at openssl.org
Sun Nov 7 23:02:16 UTC 2021
The branch openssl-3.0 has been updated
via 65d39565375bb7d0c5df733063ee09f7e8ca292b (commit)
from ed1a12aa5e2b5f312d0f75c90f5d91eafe0e1a89 (commit)
- Log -----------------------------------------------------------------
commit 65d39565375bb7d0c5df733063ee09f7e8ca292b
Author: Matt Caswell <matt at openssl.org>
Date: Fri Nov 5 08:43:10 2021 +0000
Fix errors in EVP_PKEY_fromdata examples
The EVP_PKEY_fromdata man page has some code examples with various
errors in them. This fixes those errors.
Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16973)
(cherry picked from commit 4ce64ed79d301939c7f2844a9e5e5fdd2033605f)
-----------------------------------------------------------------------
Summary of changes:
doc/man3/EVP_PKEY_fromdata.pod | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/doc/man3/EVP_PKEY_fromdata.pod b/doc/man3/EVP_PKEY_fromdata.pod
index b968150bb6..fdab94cd4f 100644
--- a/doc/man3/EVP_PKEY_fromdata.pod
+++ b/doc/man3/EVP_PKEY_fromdata.pod
@@ -138,6 +138,7 @@ TODO Write a set of cookbook documents and link to them.
#include <openssl/evp.h>
#include <openssl/param_build.h>
+ #include <openssl/ec.h>
/*
* Fixed data to represent the private and public key.
@@ -160,12 +161,6 @@ TODO Write a set of cookbook documents and link to them.
0x8f, 0xb9, 0x33, 0x6e, 0xcf, 0x12, 0x16, 0x2f,
0x5c, 0xcd, 0x86, 0x71, 0xa8, 0xbf, 0x1a, 0x47
};
- const OSSL_PARAM params[] = {
- OSSL_PARAM_utf8_string("group", "prime256v1", 10),
- OSSL_PARAM_BN("priv", priv, sizeof(priv)),
- OSSL_PARAM_BN("pub", pub, sizeof(pub)),
- OSSL_PARAM_END
- };
int main()
{
@@ -181,15 +176,15 @@ TODO Write a set of cookbook documents and link to them.
param_bld = OSSL_PARAM_BLD_new();
if (priv != NULL && param_bld != NULL
&& OSSL_PARAM_BLD_push_utf8_string(param_bld, "group",
- "prime256v1", 0);
- && OSSL_PARAM_BLD_push_BN(param_bld, "priv", priv);
+ "prime256v1", 0)
+ && OSSL_PARAM_BLD_push_BN(param_bld, "priv", priv)
&& OSSL_PARAM_BLD_push_octet_string(param_bld, "pub",
pub_data, sizeof(pub_data)))
params = OSSL_PARAM_BLD_to_param(param_bld);
ctx = EVP_PKEY_CTX_new_from_name(NULL, "EC", NULL);
if (ctx == NULL
- || params != NULL
+ || params == NULL
|| EVP_PKEY_fromdata_init(ctx) <= 0
|| EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEYPAIR, params) <= 0) {
exitcode = 1;
@@ -209,12 +204,13 @@ TODO Write a set of cookbook documents and link to them.
=head2 Finding out params for an unknown key type
#include <openssl/evp.h>
+ #include <openssl/core.h>
/* Program expects a key type as first argument */
int main(int argc, char *argv[])
{
EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_from_name(NULL, argv[1], NULL);
- const *OSSL_PARAM *settable_params = NULL;
+ const OSSL_PARAM *settable_params = NULL;
if (ctx == NULL)
exit(1);
@@ -247,9 +243,9 @@ TODO Write a set of cookbook documents and link to them.
}
printf("%s : %s ", settable_params->key, datatype);
if (settable_params->data_size == 0)
- printf("(unlimited size)");
+ printf("(unlimited size)\n");
else
- printf("(maximum size %zu)", settable_params->data_size);
+ printf("(maximum size %zu)\n", settable_params->data_size);
}
}
More information about the openssl-commits
mailing list