Blame doc/man3/DSA_meth_new.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
DSA_meth_new, DSA_meth_free, DSA_meth_dup, DSA_meth_get0_name,
Packit c4476c
DSA_meth_set1_name, DSA_meth_get_flags, DSA_meth_set_flags,
Packit c4476c
DSA_meth_get0_app_data, DSA_meth_set0_app_data, DSA_meth_get_sign,
Packit c4476c
DSA_meth_set_sign, DSA_meth_get_sign_setup, DSA_meth_set_sign_setup,
Packit c4476c
DSA_meth_get_verify, DSA_meth_set_verify, DSA_meth_get_mod_exp,
Packit c4476c
DSA_meth_set_mod_exp, DSA_meth_get_bn_mod_exp, DSA_meth_set_bn_mod_exp,
Packit c4476c
DSA_meth_get_init, DSA_meth_set_init, DSA_meth_get_finish, DSA_meth_set_finish,
Packit c4476c
DSA_meth_get_paramgen, DSA_meth_set_paramgen, DSA_meth_get_keygen,
Packit c4476c
DSA_meth_set_keygen - Routines to build up DSA methods
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/dsa.h>
Packit c4476c
Packit c4476c
 DSA_METHOD *DSA_meth_new(const char *name, int flags);
Packit c4476c
Packit c4476c
 void DSA_meth_free(DSA_METHOD *dsam);
Packit c4476c
Packit c4476c
 DSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth);
Packit c4476c
Packit c4476c
 const char *DSA_meth_get0_name(const DSA_METHOD *dsam);
Packit c4476c
 int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name);
Packit c4476c
Packit c4476c
 int DSA_meth_get_flags(const DSA_METHOD *dsam);
Packit c4476c
 int DSA_meth_set_flags(DSA_METHOD *dsam, int flags);
Packit c4476c
Packit c4476c
 void *DSA_meth_get0_app_data(const DSA_METHOD *dsam);
Packit c4476c
 int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data);
Packit c4476c
Packit c4476c
 DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))(const unsigned char *,
Packit c4476c
                                                       int, DSA *);
Packit c4476c
 int DSA_meth_set_sign(DSA_METHOD *dsam, DSA_SIG *(*sign)(const unsigned char *,
Packit c4476c
                                                          int, DSA *));
Packit c4476c
Packit c4476c
 int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))(DSA *, BN_CTX *,$
Packit c4476c
                                                        BIGNUM **, BIGNUM **);
Packit c4476c
 int DSA_meth_set_sign_setup(DSA_METHOD *dsam, int (*sign_setup)(DSA *, BN_CTX *,
Packit c4476c
                                                                 BIGNUM **, BIGNUM **));
Packit c4476c
Packit c4476c
 int (*DSA_meth_get_verify(const DSA_METHOD *dsam))(const unsigned char *,
Packit c4476c
                                                    int, DSA_SIG *, DSA *);
Packit c4476c
 int DSA_meth_set_verify(DSA_METHOD *dsam, int (*verify)(const unsigned char *,
Packit c4476c
                                                         int, DSA_SIG *, DSA *));
Packit c4476c
Packit c4476c
 int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
Packit c4476c
                                                     BIGNUM *p1, BIGNUM *a2, BIGNUM *p2,
Packit c4476c
                                                     BIGNUM *m, BN_CTX *ctx,
Packit c4476c
                                                     BN_MONT_CTX *in_mont);
Packit c4476c
 int DSA_meth_set_mod_exp(DSA_METHOD *dsam, int (*mod_exp)(DSA *dsa, BIGNUM *rr,
Packit c4476c
                                                           BIGNUM *a1, BIGNUM *p1,
Packit c4476c
                                                           BIGNUM *a2, BIGNUM *p2,
Packit c4476c
                                                           BIGNUM *m, BN_CTX *ctx,
Packit c4476c
                                                           BN_MONT_CTX *mont));
Packit c4476c
Packit c4476c
 int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *r, BIGNUM *a,
Packit c4476c
                                                        const BIGNUM *p, const BIGNUM *m,
Packit c4476c
                                                        BN_CTX *ctx, BN_MONT_CTX *mont);
Packit c4476c
 int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, int (*bn_mod_exp)(DSA *dsa,
Packit c4476c
                                                                 BIGNUM *r,
Packit c4476c
                                                                 BIGNUM *a,
Packit c4476c
                                                                 const BIGNUM *p,
Packit c4476c
                                                                 const BIGNUM *m,
Packit c4476c
                                                                 BN_CTX *ctx,
Packit c4476c
                                                                 BN_MONT_CTX *mont));
Packit c4476c
Packit c4476c
 int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);
Packit c4476c
 int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *));
Packit c4476c
Packit c4476c
 int (*DSA_meth_get_finish(const DSA_METHOD *dsam))(DSA *);
Packit c4476c
 int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish)(DSA *));
Packit c4476c
Packit c4476c
 int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))(DSA *, int,
Packit c4476c
                                                      const unsigned char *,
Packit c4476c
                                                      int, int *, unsigned long *,
Packit c4476c
                                                      BN_GENCB *);
Packit c4476c
 int DSA_meth_set_paramgen(DSA_METHOD *dsam,
Packit c4476c
                           int (*paramgen)(DSA *, int, const unsigned char *,
Packit c4476c
                                           int, int *, unsigned long *, BN_GENCB *));
Packit c4476c
Packit c4476c
 int (*DSA_meth_get_keygen(const DSA_METHOD *dsam))(DSA *);
Packit c4476c
 int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen)(DSA *));
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
The B<DSA_METHOD> type is a structure used for the provision of custom DSA
Packit c4476c
implementations. It provides a set of functions used by OpenSSL for the
Packit c4476c
implementation of the various DSA capabilities. See the L<dsa> page for more
Packit c4476c
information.
Packit c4476c
Packit c4476c
DSA_meth_new() creates a new B<DSA_METHOD> structure. It should be given a
Packit c4476c
unique B<name> and a set of B<flags>. The B<name> should be a NULL terminated
Packit c4476c
string, which will be duplicated and stored in the B<DSA_METHOD> object. It is
Packit c4476c
the callers responsibility to free the original string. The flags will be used
Packit c4476c
during the construction of a new B<DSA> object based on this B<DSA_METHOD>. Any
Packit c4476c
new B<DSA> object will have those flags set by default.
Packit c4476c
Packit c4476c
DSA_meth_dup() creates a duplicate copy of the B<DSA_METHOD> object passed as a
Packit c4476c
parameter. This might be useful for creating a new B<DSA_METHOD> based on an
Packit c4476c
existing one, but with some differences.
Packit c4476c
Packit c4476c
DSA_meth_free() destroys a B<DSA_METHOD> structure and frees up any memory
Packit c4476c
associated with it.
Packit c4476c
Packit c4476c
DSA_meth_get0_name() will return a pointer to the name of this DSA_METHOD. This
Packit c4476c
is a pointer to the internal name string and so should not be freed by the
Packit c4476c
caller. DSA_meth_set1_name() sets the name of the DSA_METHOD to B<name>. The
Packit c4476c
string is duplicated and the copy is stored in the DSA_METHOD structure, so the
Packit c4476c
caller remains responsible for freeing the memory associated with the name.
Packit c4476c
Packit c4476c
DSA_meth_get_flags() returns the current value of the flags associated with this
Packit c4476c
DSA_METHOD. DSA_meth_set_flags() provides the ability to set these flags.
Packit c4476c
Packit c4476c
The functions DSA_meth_get0_app_data() and DSA_meth_set0_app_data() provide the
Packit c4476c
ability to associate implementation specific data with the DSA_METHOD. It is
Packit c4476c
the application's responsibility to free this data before the DSA_METHOD is
Packit c4476c
freed via a call to DSA_meth_free().
Packit c4476c
Packit c4476c
DSA_meth_get_sign() and DSA_meth_set_sign() get and set the function used for
Packit c4476c
creating a DSA signature respectively. This function will be
Packit c4476c
called in response to the application calling DSA_do_sign() (or DSA_sign()). The
Packit c4476c
parameters for the function have the same meaning as for DSA_do_sign().
Packit c4476c
Packit c4476c
DSA_meth_get_sign_setup() and DSA_meth_set_sign_setup() get and set the function
Packit c4476c
used for precalculating the DSA signature values B<k^-1> and B<r>. This function
Packit c4476c
will be called in response to the application calling DSA_sign_setup(). The
Packit c4476c
parameters for the function have the same meaning as for DSA_sign_setup().
Packit c4476c
Packit c4476c
DSA_meth_get_verify() and DSA_meth_set_verify() get and set the function used
Packit c4476c
for verifying a DSA signature respectively. This function will be called in
Packit c4476c
response to the application calling DSA_do_verify() (or DSA_verify()). The
Packit c4476c
parameters for the function have the same meaning as for DSA_do_verify().
Packit c4476c
Packit c4476c
DSA_meth_get_mod_exp() and DSA_meth_set_mod_exp() get and set the function used
Packit c4476c
for computing the following value:
Packit c4476c
Packit c4476c
 rr = a1^p1 * a2^p2 mod m
Packit c4476c
Packit c4476c
This function will be called by the default OpenSSL method during verification
Packit c4476c
of a DSA signature. The result is stored in the B<rr> parameter. This function
Packit c4476c
may be NULL.
Packit c4476c
Packit c4476c
DSA_meth_get_bn_mod_exp() and DSA_meth_set_bn_mod_exp() get and set the function
Packit c4476c
used for computing the following value:
Packit c4476c
Packit c4476c
 r = a ^ p mod m
Packit c4476c
Packit c4476c
This function will be called by the default OpenSSL function for
Packit c4476c
DSA_sign_setup(). The result is stored in the B<r> parameter. This function
Packit c4476c
may be NULL.
Packit c4476c
Packit c4476c
DSA_meth_get_init() and DSA_meth_set_init() get and set the function used
Packit c4476c
for creating a new DSA instance respectively. This function will be
Packit c4476c
called in response to the application calling DSA_new() (if the current default
Packit c4476c
DSA_METHOD is this one) or DSA_new_method(). The DSA_new() and DSA_new_method()
Packit c4476c
functions will allocate the memory for the new DSA object, and a pointer to this
Packit c4476c
newly allocated structure will be passed as a parameter to the function. This
Packit c4476c
function may be NULL.
Packit c4476c
Packit c4476c
DSA_meth_get_finish() and DSA_meth_set_finish() get and set the function used
Packit c4476c
for destroying an instance of a DSA object respectively. This function will be
Packit c4476c
called in response to the application calling DSA_free(). A pointer to the DSA
Packit c4476c
to be destroyed is passed as a parameter. The destroy function should be used
Packit c4476c
for DSA implementation specific clean up. The memory for the DSA itself should
Packit c4476c
not be freed by this function. This function may be NULL.
Packit c4476c
Packit c4476c
DSA_meth_get_paramgen() and DSA_meth_set_paramgen() get and set the function
Packit c4476c
used for generating DSA parameters respectively. This function will be called in
Packit c4476c
response to the application calling DSA_generate_parameters_ex() (or
Packit c4476c
DSA_generate_parameters()). The parameters for the function have the same
Packit c4476c
meaning as for DSA_generate_parameters_ex().
Packit c4476c
Packit c4476c
DSA_meth_get_keygen() and DSA_meth_set_keygen() get and set the function
Packit c4476c
used for generating a new DSA key pair respectively. This function will be
Packit c4476c
called in response to the application calling DSA_generate_key(). The parameter
Packit c4476c
for the function has the same meaning as for DSA_generate_key().
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
DSA_meth_new() and DSA_meth_dup() return the newly allocated DSA_METHOD object
Packit c4476c
or NULL on failure.
Packit c4476c
Packit c4476c
DSA_meth_get0_name() and DSA_meth_get_flags() return the name and flags
Packit c4476c
associated with the DSA_METHOD respectively.
Packit c4476c
Packit c4476c
All other DSA_meth_get_*() functions return the appropriate function pointer
Packit c4476c
that has been set in the DSA_METHOD, or NULL if no such pointer has yet been
Packit c4476c
set.
Packit c4476c
Packit c4476c
DSA_meth_set1_name() and all DSA_meth_set_*() functions return 1 on success or
Packit c4476c
0 on failure.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<DSA_new(3)>, L<DSA_new(3)>, L<DSA_generate_parameters(3)>, L<DSA_generate_key(3)>,
Packit c4476c
L<DSA_dup_DH(3)>, L<DSA_do_sign(3)>, L<DSA_set_method(3)>, L<DSA_SIG_new(3)>,
Packit c4476c
L<DSA_sign(3)>, L<DSA_size(3)>, L<DSA_get0_pqg(3)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
The functions described here were added in OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2016-2018 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