DSA_set_method.pod 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. =pod
  2. =head1 NAME
  3. DSA_set_default_openssl_method, DSA_get_default_openssl_method,
  4. DSA_set_method, DSA_new_method, DSA_OpenSSL - select DSA method
  5. =head1 SYNOPSIS
  6. #include <openssl/dsa.h>
  7. #include <openssl/engine.h>
  8. void DSA_set_default_openssl_method(DSA_METHOD *meth);
  9. DSA_METHOD *DSA_get_default_openssl_method(void);
  10. int DSA_set_method(DSA *dsa, ENGINE *engine);
  11. DSA *DSA_new_method(ENGINE *engine);
  12. DSA_METHOD *DSA_OpenSSL(void);
  13. =head1 DESCRIPTION
  14. A B<DSA_METHOD> specifies the functions that OpenSSL uses for DSA
  15. operations. By modifying the method, alternative implementations
  16. such as hardware accelerators may be used.
  17. Initially, the default is to use the OpenSSL internal implementation.
  18. DSA_OpenSSL() returns a pointer to that method.
  19. DSA_set_default_openssl_method() makes B<meth> the default method for
  20. all DSA structures created later. B<NB:> This is true only whilst the
  21. default engine for DSA operations remains as "openssl". ENGINEs
  22. provide an encapsulation for implementations of one or more algorithms at a
  23. time, and all the DSA functions mentioned here operate within the scope
  24. of the default "openssl" engine.
  25. DSA_get_default_openssl_method() returns a pointer to the current default
  26. method for the "openssl" engine.
  27. DSA_set_method() selects B<engine> for all operations using the structure B<dsa>.
  28. DSA_new_method() allocates and initializes a DSA structure so that
  29. B<engine> will be used for the DSA operations. If B<engine> is NULL,
  30. the default engine for DSA operations is used.
  31. =head1 THE DSA_METHOD STRUCTURE
  32. struct
  33. {
  34. /* name of the implementation */
  35. const char *name;
  36. /* sign */
  37. DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen,
  38. DSA *dsa);
  39. /* pre-compute k^-1 and r */
  40. int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
  41. BIGNUM **rp);
  42. /* verify */
  43. int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
  44. DSA_SIG *sig, DSA *dsa);
  45. /* compute rr = a1^p1 * a2^p2 mod m (May be NULL for some
  46. implementations) */
  47. int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
  48. BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
  49. BN_CTX *ctx, BN_MONT_CTX *in_mont);
  50. /* compute r = a ^ p mod m (May be NULL for some implementations) */
  51. int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a,
  52. const BIGNUM *p, const BIGNUM *m,
  53. BN_CTX *ctx, BN_MONT_CTX *m_ctx);
  54. /* called at DSA_new */
  55. int (*init)(DSA *DSA);
  56. /* called at DSA_free */
  57. int (*finish)(DSA *DSA);
  58. int flags;
  59. char *app_data; /* ?? */
  60. } DSA_METHOD;
  61. =head1 RETURN VALUES
  62. DSA_OpenSSL() and DSA_get_default_openssl_method() return pointers to the
  63. respective DSA_METHODs.
  64. DSA_set_default_openssl_method() returns no value.
  65. DSA_set_method() returns non-zero if the ENGINE associated with B<dsa>
  66. was successfully changed to B<engine>.
  67. DSA_new_method() returns NULL and sets an error code that can be
  68. obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation
  69. fails. Otherwise it returns a pointer to the newly allocated structure.
  70. =head1 SEE ALSO
  71. L<dsa(3)|dsa(3)>, L<DSA_new(3)|DSA_new(3)>
  72. =head1 HISTORY
  73. DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(),
  74. DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4.
  75. DSA_set_default_openssl_method() and DSA_get_default_openssl_method()
  76. replaced DSA_set_default_method() and DSA_get_default_method() respectively,
  77. and DSA_set_method() and DSA_new_method() were altered to use B<ENGINE>s
  78. rather than B<DSA_METHOD>s during development of OpenSSL 0.9.6.
  79. =cut