Latest update.
This commit is contained in:
@@ -15,6 +15,7 @@ B<openssl> B<cms>
|
||||
[B<-verify>]
|
||||
[B<-cmsout>]
|
||||
[B<-resign>]
|
||||
[B<-cades>]
|
||||
[B<-data_create>]
|
||||
[B<-data_out>]
|
||||
[B<-digest_create>]
|
||||
@@ -158,6 +159,12 @@ Takes an input message and writes out a PEM encoded CMS structure.
|
||||
|
||||
Resign a message: take an existing message and one or more new signers.
|
||||
|
||||
=item B<-cades>
|
||||
|
||||
Add an ESS signing-certificate or ESS signing-certificate-v2 signed-attribute to the SignerInfo, in order to make
|
||||
the signature comply with the requirements for a CAdES Basic Electronic Signature (CAdES-BES). See the NOTES
|
||||
section for more details.
|
||||
|
||||
=item B<-data_create>
|
||||
|
||||
Create a CMS B<Data> type.
|
||||
@@ -553,6 +560,40 @@ The B<-debug_decrypt> option can be used to disable the MMA attack protection
|
||||
and return an error if no recipient can be found: this option should be used
|
||||
with caution. For a fuller description see L<CMS_decrypt(3)>).
|
||||
|
||||
=head1 CAdES Basic Electronic Signature (CAdES-BES)
|
||||
|
||||
A CAdES Basic Electronic Signature (CAdES-BES), as defined in the European Standard ETSI EN 319 122-1 V1.1.1, contains:
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
The signed user data as defined in CMS (RFC 3852);
|
||||
|
||||
=item *
|
||||
|
||||
Content-type of the EncapsulatedContentInfo value being signed;
|
||||
|
||||
=item *
|
||||
|
||||
Message-digest of the eContent OCTET STRING within encapContentInfo being signed;
|
||||
|
||||
=item *
|
||||
|
||||
An ESS signing-certificate or ESS signing-certificate-v2 attribute, as defined in Enhanced Security Services (ESS), RFC 2634 and RFC 5035.
|
||||
An ESS signing-certificate attribute only allows for the use of SHA-1 as a digest algorithm.
|
||||
An ESS signing-certificate-v2 attribute allows for the use of any digest algorithm.
|
||||
|
||||
=item *
|
||||
|
||||
The digital signature value computed on the user data and, when present, on the signed attributes.
|
||||
|
||||
Note that currently the B<-cades> option applies only to the B<-sign> operation and is ignored during
|
||||
the B<-verify> operation, i.e. the signing certification is not checked during the verification process.
|
||||
This feature might be added in a future version.
|
||||
|
||||
=back
|
||||
|
||||
=head1 EXIT CODES
|
||||
|
||||
=over 4
|
||||
|
||||
@@ -101,10 +101,6 @@ Prints out the public, private key components and parameters.
|
||||
|
||||
This option prevents output of the encoded version of the key.
|
||||
|
||||
=item B<-modulus>
|
||||
|
||||
This option prints out the value of the public key component of the key.
|
||||
|
||||
=item B<-pubin>
|
||||
|
||||
By default, a private key is read from the input file. With this option a
|
||||
|
||||
@@ -12,6 +12,8 @@ B<openssl> B<s_client>
|
||||
[B<-connect host:port>]
|
||||
[B<-bind host:port>]
|
||||
[B<-proxy host:port>]
|
||||
[B<-proxy_user userid>]
|
||||
[B<-proxy_pass arg>]
|
||||
[B<-unix path>]
|
||||
[B<-4>]
|
||||
[B<-6>]
|
||||
@@ -175,6 +177,21 @@ When used with the B<-connect> flag, the program uses the host and port
|
||||
specified with this flag and issues an HTTP CONNECT command to connect
|
||||
to the desired server.
|
||||
|
||||
=item B<-proxy_user userid>
|
||||
|
||||
When used with the B<-proxy> flag, the program will attempt to authenticate
|
||||
with the specified proxy using basic (base64) authentication.
|
||||
NB: Basic authentication is insecure; the credentials are sent to the proxy
|
||||
in easily reversible base64 encoding before any TLS/SSL session is established.
|
||||
Therefore these credentials are easily recovered by anyone able to sniff/trace
|
||||
the network. Use with caution.
|
||||
|
||||
=item B<-proxy_pass arg>
|
||||
|
||||
The proxy password source, used with the B<-proxy_user> flag.
|
||||
For more information about the format of B<arg> see the B<PASS PHRASE ARGUMENTS>
|
||||
section in L<openssl(1)>.
|
||||
|
||||
=item B<-unix path>
|
||||
|
||||
Connect over the specified Unix-domain socket.
|
||||
|
||||
@@ -4,13 +4,22 @@
|
||||
|
||||
ASYNC_WAIT_CTX_new, ASYNC_WAIT_CTX_free, ASYNC_WAIT_CTX_set_wait_fd,
|
||||
ASYNC_WAIT_CTX_get_fd, ASYNC_WAIT_CTX_get_all_fds,
|
||||
ASYNC_WAIT_CTX_get_changed_fds, ASYNC_WAIT_CTX_clear_fd - functions to manage
|
||||
waiting for asynchronous jobs to complete
|
||||
ASYNC_WAIT_CTX_get_changed_fds, ASYNC_WAIT_CTX_clear_fd,
|
||||
ASYNC_WAIT_CTX_set_callback, ASYNC_WAIT_CTX_get_callback,
|
||||
ASYNC_WAIT_CTX_set_status, ASYNC_WAIT_CTX_get_status, ASYNC_callback_fn,
|
||||
ASYNC_STATUS_UNSUPPORTED, ASYNC_STATUS_ERR, ASYNC_STATUS_OK,
|
||||
ASYNC_STATUS_EAGAIN
|
||||
- functions to manage waiting for asynchronous jobs to complete
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/async.h>
|
||||
|
||||
#define ASYNC_STATUS_UNSUPPORTED 0
|
||||
#define ASYNC_STATUS_ERR 1
|
||||
#define ASYNC_STATUS_OK 2
|
||||
#define ASYNC_STATUS_EAGAIN 3
|
||||
typedef int (*ASYNC_callback_fn)(void *arg);
|
||||
ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);
|
||||
void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);
|
||||
int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||
@@ -26,6 +35,14 @@ waiting for asynchronous jobs to complete
|
||||
size_t *numaddfds, OSSL_ASYNC_FD *delfd,
|
||||
size_t *numdelfds);
|
||||
int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);
|
||||
int ASYNC_WAIT_CTX_set_callback(ASYNC_WAIT_CTX *ctx,
|
||||
ASYNC_callback_fn callback,
|
||||
void *callback_arg);
|
||||
int ASYNC_WAIT_CTX_get_callback(ASYNC_WAIT_CTX *ctx,
|
||||
ASYNC_callback_fn *callback,
|
||||
void **callback_arg);
|
||||
int ASYNC_WAIT_CTX_set_status(ASYNC_WAIT_CTX *ctx, int status);
|
||||
int ASYNC_WAIT_CTX_get_status(ASYNC_WAIT_CTX *ctx);
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
@@ -103,14 +120,58 @@ code that the job should be resumed by making the wait file descriptor
|
||||
"readable". Once resumed the engine should clear the wake signal on the wait
|
||||
file descriptor.
|
||||
|
||||
As well as a file descriptor, user code may also be notified via a callback. The
|
||||
callback and data pointers are stored within the ASYNC_WAIT_CTX along with an
|
||||
additional status field that can be used for the notification of retries from an
|
||||
engine. This additional method can be used when the user thinks that a file
|
||||
descriptor is too costly in terms of CPU cycles or in some context where a file
|
||||
descriptor is not appropriate.
|
||||
|
||||
ASYNC_WAIT_CTX_set_callback() sets the callback and the callback argument. The
|
||||
callback will be called to notify user code when an engine completes a
|
||||
cryptography operation. It is a requirement that the callback function is small
|
||||
and non-blocking as it will be run in the context of a polling mechanism or an
|
||||
interrupt.
|
||||
|
||||
ASYNC_WAIT_CTX_get_callback() returns the callback set in the ASYNC_WAIT_CTX
|
||||
structure.
|
||||
|
||||
ASYNC_WAIT_CTX_set_status() allows an engine to set the current engine status.
|
||||
The possible status values are the following:
|
||||
ASYNC_STATUS_UNSUPPORTED: The engine does not support the callback mechanism.
|
||||
This is the default value. The engine must call ASYNC_WAIT_CTX_set_status() to
|
||||
set the status to some value other than ASYNC_STATUS_UNSUPPORTED if it intends
|
||||
to enable the callback mechanism.
|
||||
ASYNC_STATUS_ERR: The engine has a fatal problem with this request. The user
|
||||
code should clean up this session.
|
||||
ASYNC_STATUS_OK: The request has been successfully submitted.
|
||||
ASYNC_STATUS_EAGAIN: The engine has some problem which will be recovered soon,
|
||||
such as a buffer is full, so user code should resume the job.
|
||||
|
||||
ASYNC_WAIT_CTX_get_status() allows user code to obtain the current status value.
|
||||
If the status is any value other than ASYNC_STATUS_OK then the user code should
|
||||
not expect to receive a callback from the engine even if one has been set.
|
||||
|
||||
An example of the usage of the callback method might be the following. User
|
||||
code would initiate cryptographic operations, and the engine code would dispatch
|
||||
this operation to hardware, and if the dispatch is successful, then the engine
|
||||
code would call ASYNC_pause_job() to return control to the user code. After
|
||||
that, user code can perform other tasks. When the hardware completes the
|
||||
operation, normally it is detected by a polling function or an interrupt, as the
|
||||
user code set a callback by calling ASYNC_WAIT_CTX_set_callback() previously,
|
||||
then the registered callback will be called.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
ASYNC_WAIT_CTX_new() returns a pointer to the newly allocated ASYNC_WAIT_CTX or
|
||||
NULL on error.
|
||||
|
||||
ASYNC_WAIT_CTX_set_wait_fd, ASYNC_WAIT_CTX_get_fd, ASYNC_WAIT_CTX_get_all_fds,
|
||||
ASYNC_WAIT_CTX_get_changed_fds and ASYNC_WAIT_CTX_clear_fd all return 1 on
|
||||
success or 0 on error.
|
||||
ASYNC_WAIT_CTX_get_changed_fds, ASYNC_WAIT_CTX_clear_fd,
|
||||
ASYNC_WAIT_CTX_set_callback, ASYNC_WAIT_CTX_get_callback and
|
||||
ASYNC_WAIT_CTX_set_status all return 1 on success or 0 on error.
|
||||
ASYNC_WAIT_CTX_get_status() returs the engine status.
|
||||
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
@@ -132,6 +193,10 @@ ASYNC_WAIT_CTX_get_fd(), ASYNC_WAIT_CTX_get_all_fds(),
|
||||
ASYNC_WAIT_CTX_get_changed_fds() and ASYNC_WAIT_CTX_clear_fd()
|
||||
were added in OpenSSL 1.1.0.
|
||||
|
||||
ASYNC_WAIT_CTX_set_callback(), ASYNC_WAIT_CTX_get_callback(),
|
||||
ASYNC_WAIT_CTX_set_status(), and ASYNC_WAIT_CTX_get_status()
|
||||
were added in OpenSSL 3.0.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
@@ -107,22 +107,26 @@ ASYNC_pause_job() is called whilst not within the context of a job then no
|
||||
action is taken and ASYNC_pause_job() returns immediately.
|
||||
|
||||
ASYNC_get_wait_ctx() can be used to get a pointer to the ASYNC_WAIT_CTX
|
||||
for the B<job>. ASYNC_WAIT_CTXs can have a "wait" file descriptor associated
|
||||
with them. Applications can wait for the file descriptor to be ready for "read"
|
||||
using a system function call such as select or poll (being ready for "read"
|
||||
indicates that the job should be resumed). If no file descriptor is made
|
||||
available then an application will have to periodically "poll" the job by
|
||||
attempting to restart it to see if it is ready to continue.
|
||||
for the B<job>. ASYNC_WAIT_CTXs contain two different ways to notify
|
||||
applications that a job is ready to be resumed. One is a "wait" file
|
||||
descriptor, and the other is a "callback" mechanism.
|
||||
|
||||
An example of typical usage might be an async capable engine. User code would
|
||||
initiate cryptographic operations. The engine would initiate those operations
|
||||
asynchronously and then call L<ASYNC_WAIT_CTX_set_wait_fd(3)> followed by
|
||||
ASYNC_pause_job() to return control to the user code. The user code can then
|
||||
perform other tasks or wait for the job to be ready by calling "select" or other
|
||||
similar function on the wait file descriptor. The engine can signal to the user
|
||||
code that the job should be resumed by making the wait file descriptor
|
||||
"readable". Once resumed the engine should clear the wake signal on the wait
|
||||
file descriptor.
|
||||
The "wait" file descriptor associated with ASYNC_WAIT_CTX is used for
|
||||
applications to wait for the file descriptor to be ready for "read" using a
|
||||
system function call such as select or poll (being ready for "read" indicates
|
||||
that the job should be resumed). If no file descriptor is made available then
|
||||
an application will have to periodically "poll" the job by attempting to restart
|
||||
it to see if it is ready to continue.
|
||||
|
||||
ASYNC_WAIT_CTXs also have a "callback" mechanism to notify applications. The
|
||||
callback is set by an application, and it will be automatically called when an
|
||||
engine completes a cryptography operation, so that the application can resume
|
||||
the paused work flow without polling. An engine could be written to look whether
|
||||
the callback has been set. If it has then it would use the callback mechanism
|
||||
in preference to the file descriptor notifications. If a callback is not set
|
||||
then the engine may use file descriptor based notifications. Please note that
|
||||
not all engines may support the callback mechanism, so the callback may not be
|
||||
used even if it has been set. See ASYNC_WAIT_CTX_new() for more details.
|
||||
|
||||
The ASYNC_block_pause() function will prevent the currently active job from
|
||||
pausing. The block will remain in place until a subsequent call to
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
CMS_add1_signing_cert, CMS_add1_signing_cert_v2
|
||||
- add ESS signing-certificate signed attribute to a
|
||||
CMS_SignerInfo data structure
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/cms.h>
|
||||
|
||||
int CMS_add1_signing_cert(CMS_SignerInfo *si, ESS_SIGNING_CERT *sc);
|
||||
|
||||
int CMS_add1_signing_cert_v2(CMS_SignerInfo *si, ESS_SIGNING_CERT_V2 *sc2);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
CMS_add1_signing_cert() adds an ESS Signing Certificate B<sc> (version 1) signed
|
||||
attribute to the CMS_SignerInfo B<si>.
|
||||
CMS_add1_signing_cert_v2() adds an ESS Signing Certificate B<sc2> (version 2) signed
|
||||
attribute to the CMS_SignerInfo B<si>.
|
||||
The ESS Signing Certificate attributes version 1 and 2 are defined in RFC 5035
|
||||
which updates Section 5.4 of RFC 2634.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
This attribute is mandatory to make a CMS compliant with CAdES-BES
|
||||
(European Standard ETSI EN 319 122-1 V1.1.1).
|
||||
For a fuller description see L<cms(1)>).
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
CMS_add1_signing_cert() and CMS_add1_signing_cert_v2() return 1 if attribute is added or 0 if an error occurred.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
in the file LICENSE in the source distribution or at
|
||||
L<https://www.openssl.org/source/license.html>.
|
||||
|
||||
=cut
|
||||
@@ -20,7 +20,8 @@ an ASN1_OBJECT pointer. An application can then decide how to process the
|
||||
CMS_ContentInfo structure based on this value.
|
||||
|
||||
CMS_set1_eContentType() sets the embedded content type of a CMS_ContentInfo
|
||||
structure. It should be called with CMS functions with the B<CMS_PARTIAL>
|
||||
structure. It should be called with CMS functions (such as L<CMS_sign>, L<CMS_encrypt>)
|
||||
with the B<CMS_PARTIAL>
|
||||
flag and B<before> the structure is finalised, otherwise the results are
|
||||
undefined.
|
||||
|
||||
|
||||
+75
-13
@@ -2,17 +2,17 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
EVP_MD_CTX_new, EVP_MD_CTX_reset, EVP_MD_CTX_free, EVP_MD_CTX_copy_ex,
|
||||
EVP_MD_CTX_ctrl, EVP_MD_CTX_set_flags, EVP_MD_CTX_clear_flags,
|
||||
EVP_MD_CTX_test_flags, EVP_DigestInit_ex, EVP_DigestInit, EVP_DigestUpdate,
|
||||
EVP_MD_CTX_new, EVP_MD_CTX_reset, EVP_MD_CTX_free, EVP_MD_CTX_copy,
|
||||
EVP_MD_CTX_copy_ex, EVP_MD_CTX_ctrl, EVP_MD_CTX_set_flags,
|
||||
EVP_MD_CTX_clear_flags, EVP_MD_CTX_test_flags,
|
||||
EVP_Digest, EVP_DigestInit_ex, EVP_DigestInit, EVP_DigestUpdate,
|
||||
EVP_DigestFinal_ex, EVP_DigestFinalXOF, EVP_DigestFinal,
|
||||
EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size,
|
||||
EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size,
|
||||
EVP_MD_CTX_block_size, EVP_MD_CTX_type, EVP_MD_CTX_md_data,
|
||||
EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, EVP_MD_block_size, EVP_MD_flags,
|
||||
EVP_MD_CTX_md, EVP_MD_CTX_type, EVP_MD_CTX_size, EVP_MD_CTX_block_size,
|
||||
EVP_MD_CTX_md_data, EVP_MD_CTX_update_fn, EVP_MD_CTX_set_update_fn,
|
||||
EVP_md_null,
|
||||
EVP_get_digestbyname, EVP_get_digestbynid,
|
||||
EVP_get_digestbyobj,
|
||||
EVP_MD_CTX_set_pkey_ctx - EVP digest routines
|
||||
EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj,
|
||||
EVP_MD_CTX_pkey_ctx, EVP_MD_CTX_set_pkey_ctx - EVP digest routines
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -26,6 +26,8 @@ EVP_MD_CTX_set_pkey_ctx - EVP digest routines
|
||||
void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
|
||||
int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags);
|
||||
|
||||
int EVP_Digest(const void *data, size_t count, unsigned char *md,
|
||||
unsigned int *size, const EVP_MD *type, ENGINE *impl);
|
||||
int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
|
||||
int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);
|
||||
int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
|
||||
@@ -42,12 +44,18 @@ EVP_MD_CTX_set_pkey_ctx - EVP digest routines
|
||||
int EVP_MD_pkey_type(const EVP_MD *md);
|
||||
int EVP_MD_size(const EVP_MD *md);
|
||||
int EVP_MD_block_size(const EVP_MD *md);
|
||||
unsigned long EVP_MD_flags(const EVP_MD *md);
|
||||
|
||||
const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
|
||||
int EVP_MD_CTX_size(const EVP_MD *ctx);
|
||||
int EVP_MD_CTX_block_size(const EVP_MD *ctx);
|
||||
int EVP_MD_CTX_type(const EVP_MD *ctx);
|
||||
void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx);
|
||||
int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx,
|
||||
const void *data, size_t count);
|
||||
void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx,
|
||||
int (*update)(EVP_MD_CTX *ctx,
|
||||
const void *data, size_t count));
|
||||
|
||||
const EVP_MD *EVP_md_null(void);
|
||||
|
||||
@@ -55,6 +63,7 @@ EVP_MD_CTX_set_pkey_ctx - EVP digest routines
|
||||
const EVP_MD *EVP_get_digestbynid(int type);
|
||||
const EVP_MD *EVP_get_digestbyobj(const ASN1_OBJECT *o);
|
||||
|
||||
EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx);
|
||||
void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
@@ -79,12 +88,24 @@ Cleans up digest context B<ctx> and frees up the space allocated to it.
|
||||
|
||||
=item EVP_MD_CTX_ctrl()
|
||||
|
||||
Performs digest-specific control actions on context B<ctx>.
|
||||
Performs digest-specific control actions on context B<ctx>. The control command
|
||||
is indicated in B<cmd> and any additional arguments in B<p1> and B<p2>.
|
||||
EVP_MD_CTX_ctrl() must be called after EVP_DigestInit_ex(). Other restrictions
|
||||
may apply depending on the control type and digest implementation.
|
||||
See L</CONTROLS> below for more information.
|
||||
|
||||
=item EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags(), EVP_MD_CTX_test_flags()
|
||||
|
||||
Sets, clears and tests B<ctx> flags. See L</FLAGS> below for more information.
|
||||
|
||||
=item EVP_Digest()
|
||||
|
||||
A wrapper around the Digest Init_ex, Update and Final_ex functions.
|
||||
Hashes B<count> bytes of data at B<data> using a digest B<type> from ENGINE
|
||||
B<impl>. The digest value is placed in B<md> and its length is written at B<size>
|
||||
if the pointer is not NULL. At most B<EVP_MAX_MD_SIZE> bytes will be written.
|
||||
If B<impl> is NULL the default implementation of digest B<type> is used.
|
||||
|
||||
=item EVP_DigestInit_ex()
|
||||
|
||||
Sets up digest context B<ctx> to use a digest B<type> from ENGINE B<impl>.
|
||||
@@ -163,6 +184,21 @@ EVP_MD_meth_set_app_datasize().
|
||||
|
||||
Returns the B<EVP_MD> structure corresponding to the passed B<EVP_MD_CTX>.
|
||||
|
||||
=item EVP_MD_CTX_set_update_fn()
|
||||
|
||||
Sets the update function for B<ctx> to B<update>.
|
||||
This is the function that is called by EVP_DigestUpdate. If not set, the
|
||||
update function from the B<EVP_MD> type specified at initialization is used.
|
||||
|
||||
=item EVP_MD_CTX_update_fn()
|
||||
|
||||
Returns the update function for B<ctx>.
|
||||
|
||||
=item EVP_MD_flags()
|
||||
|
||||
Returns the B<md> flags. Note that these are different from the B<EVP_MD_CTX>
|
||||
ones. See L<EVP_MD_meth_set_flags(3)> for more information.
|
||||
|
||||
=item EVP_MD_pkey_type()
|
||||
|
||||
Returns the NID of the public key signing algorithm associated with this
|
||||
@@ -182,10 +218,15 @@ EVP_get_digestbyobj()
|
||||
Returns an B<EVP_MD> structure when passed a digest name, a digest B<NID> or an
|
||||
B<ASN1_OBJECT> structure respectively.
|
||||
|
||||
=item EVP_MD_CTX_pkey_ctx()
|
||||
|
||||
Returns the B<EVP_PKEY_CTX> assigned to B<ctx>. The returned pointer should not
|
||||
be freed by the caller.
|
||||
|
||||
=item EVP_MD_CTX_set_pkey_ctx()
|
||||
|
||||
Assigns an B<EVP_PKEY_CTX> to B<EVP_MD_CTX>. This is usually used to provide
|
||||
a customzied B<EVP_PKEY_CTX> to L<EVP_DigestSignInit(3)> or
|
||||
a customized B<EVP_PKEY_CTX> to L<EVP_DigestSignInit(3)> or
|
||||
L<EVP_DigestVerifyInit(3)>. The B<pctx> passed to this function should be freed
|
||||
by the caller. A NULL B<pctx> pointer is also allowed to clear the B<EVP_PKEY_CTX>
|
||||
assigned to B<ctx>. In such case, freeing the cleared B<EVP_PKEY_CTX> or not
|
||||
@@ -193,6 +234,27 @@ depends on how the B<EVP_PKEY_CTX> is created.
|
||||
|
||||
=back
|
||||
|
||||
=head1 CONTROLS
|
||||
|
||||
EVP_MD_CTX_ctrl() can be used to send the following standard controls:
|
||||
|
||||
=over 4
|
||||
|
||||
=item EVP_MD_CTRL_MICALG
|
||||
|
||||
Gets the digest Message Integrity Check algorithm string. This is used when
|
||||
creating S/MIME multipart/signed messages, as specified in RFC 3851.
|
||||
The string value is written to B<p2>.
|
||||
|
||||
=item EVP_MD_CTRL_XOF_LEN
|
||||
|
||||
This control sets the digest length for extendable output functions to B<p1>.
|
||||
Sending this control directly should not be necessary, the use of
|
||||
C<EVP_DigestFinalXOF()> is preferred.
|
||||
Currently used by SHAKE.
|
||||
|
||||
=back
|
||||
|
||||
=head1 FLAGS
|
||||
|
||||
EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags() and EVP_MD_CTX_test_flags()
|
||||
@@ -245,8 +307,7 @@ Returns 1 if successful or 0 for failure.
|
||||
Returns 1 if successful or 0 for failure.
|
||||
|
||||
=item EVP_MD_type(),
|
||||
EVP_MD_pkey_type(),
|
||||
EVP_MD_type()
|
||||
EVP_MD_pkey_type()
|
||||
|
||||
Returns the NID of the corresponding OBJECT IDENTIFIER or NID_undef if none
|
||||
exists.
|
||||
@@ -350,6 +411,7 @@ digest name passed on the command line.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<EVP_MD_meth_new(3)>,
|
||||
L<dgst(1)>,
|
||||
L<evp(7)>
|
||||
|
||||
|
||||
@@ -84,7 +84,12 @@ together. The available flags are:
|
||||
|
||||
=item EVP_MD_FLAG_ONESHOT
|
||||
|
||||
This digest method can only handles one block of input.
|
||||
This digest method can only handle one block of input.
|
||||
|
||||
=item EVP_MD_FLAG_XOF
|
||||
|
||||
This digest method is an extensible-output function (XOF) and supports
|
||||
the B<EVP_MD_CTRL_XOF_LEN> control.
|
||||
|
||||
=item EVP_MD_FLAG_DIGALGID_NULL
|
||||
|
||||
@@ -105,19 +110,24 @@ B<EVP_MD_FLAG_DIGALGID_ABSENT> as default. I<Note: if combined with
|
||||
EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.>
|
||||
Currently unused.
|
||||
|
||||
=item EVP_MD_FLAG_FIPS
|
||||
|
||||
This digest method is suitable for use in FIPS mode.
|
||||
Currently unused.
|
||||
|
||||
=back
|
||||
|
||||
EVP_MD_meth_set_init() sets the digest init function for B<md>.
|
||||
The digest init function is called by EVP_DigestInit(),
|
||||
The digest init function is called by EVP_Digest(), EVP_DigestInit(),
|
||||
EVP_DigestInit_ex(), EVP_SignInit, EVP_SignInit_ex(), EVP_VerifyInit()
|
||||
and EVP_VerifyInit_ex().
|
||||
|
||||
EVP_MD_meth_set_update() sets the digest update function for B<md>.
|
||||
The digest update function is called by EVP_DigestUpdate(),
|
||||
The digest update function is called by EVP_Digest(), EVP_DigestUpdate() and
|
||||
EVP_SignUpdate().
|
||||
|
||||
EVP_MD_meth_set_final() sets the digest final function for B<md>.
|
||||
The digest final function is called by EVP_DigestFinal(),
|
||||
The digest final function is called by EVP_Digest(), EVP_DigestFinal(),
|
||||
EVP_DigestFinal_ex(), EVP_SignFinal() and EVP_VerifyFinal().
|
||||
|
||||
EVP_MD_meth_set_copy() sets the function for B<md> to do extra
|
||||
@@ -138,6 +148,7 @@ This cleanup function is called by EVP_MD_CTX_reset() and
|
||||
EVP_MD_CTX_free().
|
||||
|
||||
EVP_MD_meth_set_ctrl() sets the control function for B<md>.
|
||||
See L<EVP_MD_CTX_ctrl(3)> for the available controls.
|
||||
|
||||
EVP_MD_meth_get_input_blocksize(), EVP_MD_meth_get_result_size(),
|
||||
EVP_MD_meth_get_app_datasize(), EVP_MD_meth_get_flags(),
|
||||
@@ -169,7 +180,7 @@ The B<EVP_MD> structure was openly available in OpenSSL before version
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SSL_CTX_set_async_callback,
|
||||
SSL_CTX_set_async_callback_arg,
|
||||
SSL_set_async_callback,
|
||||
SSL_set_async_callback_arg,
|
||||
SSL_get_async_status,
|
||||
SSL_async_callback_fn
|
||||
- manage asynchronous operations
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
=for comment multiple includes
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
typedef int (*SSL_async_callback_fn)(SSL *s, void *arg);
|
||||
int SSL_CTX_set_async_callback(SSL_CTX *ctx, SSL_async_callback_fn callback);
|
||||
int SSL_CTX_set_async_callback_arg(SSL_CTX *ctx, void *arg);
|
||||
int SSL_set_async_callback(SSL *s, SSL_async_callback_fn callback);
|
||||
int SSL_set_async_callback_arg(SSL *s, void *arg);
|
||||
int SSL_get_async_status(SSL *s, int *status);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
SSL_CTX_set_async_callback() sets an asynchronous callback function. All SSL
|
||||
objects generated based on this SSL_CTX will get this callback. If an engine
|
||||
supports the callback mechanism, it will be automatically called if
|
||||
SSL_MODE_ASYNC has been set and an asynchronous capable engine completes a
|
||||
cryptography operation to notify the application to resume the paused work flow.
|
||||
|
||||
SSL_CTX_set_async_callback_arg() sets the callback argument.
|
||||
|
||||
SSL_set_async_callback() allows an application to set a callback in an
|
||||
asynchronous SSL object, so that when an engine completes a cryptography
|
||||
operation, the callback will be called to notify the application to resume the
|
||||
paused work flow.
|
||||
|
||||
SSL_set_async_callback_arg() sets an argument for the SSL object when the above
|
||||
callback is called.
|
||||
|
||||
SSL_get_async_status() returns the engine status. This function facilitates the
|
||||
communication from the engine to the application. During an SSL session,
|
||||
cryptographic operations are dispatched to an engine. The engine status is very
|
||||
useful for an application to know if the operation has been successfully
|
||||
dispatched. If the engine does not support this additional callback method,
|
||||
"ASYNC_STATUS_UNSUPPORTED" will be returned. See ASYNC_WAIT_CTX_set_status() for
|
||||
a description of all of the status values.
|
||||
|
||||
An example of the above functions would be the following.
|
||||
1. Application sets the async callback and callback data on an SSL connection
|
||||
by calling SSL_set_async_callback().
|
||||
2. Application sets SSL_MODE_ASYNC and makes an asynchronous SSL call
|
||||
3. OpenSSL submits the asynchronous request to the engine. If a retry occurs at
|
||||
this point then the status within the ASYNC_WAIT_CTX would be set and the async
|
||||
callback function would be called (goto Step 7).
|
||||
4. The OpenSSL engine pauses the current job and returns, so that the
|
||||
application can continue processing other connections.
|
||||
5. At a future point in time (probably via a polling mechanism or via an
|
||||
interrupt) the engine will become aware that the asynchronous request has
|
||||
finished processing.
|
||||
6. The engine will call the application's callback passing the callback data as
|
||||
a parameter.
|
||||
7. The callback function should then run. Note: it is a requirement that the
|
||||
callback function is small and non-blocking as it will be run in the context of
|
||||
a polling mechanism or an interrupt.
|
||||
8. It is the application's responsibility via the callback function to schedule
|
||||
recalling the OpenSSL asynchronous function and to continue processing.
|
||||
9. The callback function has the option to check the status returned via
|
||||
SSL_get_async_status() to determine whether a retry happened instead of the
|
||||
request being submitted, allowing different processing if required.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
SSL_CTX_set_async_callback(), SSL_set_async_callback(),
|
||||
SSL_CTX_set_async_callback_arg(), SSL_CTX_set_async_callback_arg() and
|
||||
SSL_get_async_status() return 1 on success or 0 on error.
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
SSL_CTX_set_async_callback(), SSL_CTX_set_async_callback_arg(),
|
||||
SSL_set_async_callback(), SSL_set_async_callback_arg() and
|
||||
SSL_get_async_status() were first added to OpenSSL 3.0.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
in the file LICENSE in the source distribution or at
|
||||
L<https://www.openssl.org/source/license.html>.
|
||||
|
||||
=cut
|
||||
Reference in New Issue
Block a user