DSA_meth_new.3ossl 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "DSA_METH_NEW 3ossl"
  58. .TH DSA_METH_NEW 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. DSA_meth_new, DSA_meth_free, DSA_meth_dup, DSA_meth_get0_name,
  65. DSA_meth_set1_name, DSA_meth_get_flags, DSA_meth_set_flags,
  66. DSA_meth_get0_app_data, DSA_meth_set0_app_data, DSA_meth_get_sign,
  67. DSA_meth_set_sign, DSA_meth_get_sign_setup, DSA_meth_set_sign_setup,
  68. DSA_meth_get_verify, DSA_meth_set_verify, DSA_meth_get_mod_exp,
  69. DSA_meth_set_mod_exp, DSA_meth_get_bn_mod_exp, DSA_meth_set_bn_mod_exp,
  70. DSA_meth_get_init, DSA_meth_set_init, DSA_meth_get_finish, DSA_meth_set_finish,
  71. DSA_meth_get_paramgen, DSA_meth_set_paramgen, DSA_meth_get_keygen,
  72. DSA_meth_set_keygen \- Routines to build up DSA methods
  73. .SH SYNOPSIS
  74. .IX Header "SYNOPSIS"
  75. .Vb 1
  76. \& #include <openssl/dsa.h>
  77. .Ve
  78. .PP
  79. The following functions have been deprecated since OpenSSL 3.0, and can be
  80. hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value,
  81. see \fBopenssl_user_macros\fR\|(7):
  82. .PP
  83. .Vb 1
  84. \& DSA_METHOD *DSA_meth_new(const char *name, int flags);
  85. \&
  86. \& void DSA_meth_free(DSA_METHOD *dsam);
  87. \&
  88. \& DSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth);
  89. \&
  90. \& const char *DSA_meth_get0_name(const DSA_METHOD *dsam);
  91. \& int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name);
  92. \&
  93. \& int DSA_meth_get_flags(const DSA_METHOD *dsam);
  94. \& int DSA_meth_set_flags(DSA_METHOD *dsam, int flags);
  95. \&
  96. \& void *DSA_meth_get0_app_data(const DSA_METHOD *dsam);
  97. \& int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data);
  98. \&
  99. \& DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))(const unsigned char *,
  100. \& int, DSA *);
  101. \& int DSA_meth_set_sign(DSA_METHOD *dsam, DSA_SIG *(*sign)(const unsigned char *,
  102. \& int, DSA *));
  103. \&
  104. \& int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))(DSA *, BN_CTX *,$
  105. \& BIGNUM **, BIGNUM **);
  106. \& int DSA_meth_set_sign_setup(DSA_METHOD *dsam, int (*sign_setup)(DSA *, BN_CTX *,
  107. \& BIGNUM **, BIGNUM **));
  108. \&
  109. \& int (*DSA_meth_get_verify(const DSA_METHOD *dsam))(const unsigned char *,
  110. \& int, DSA_SIG *, DSA *);
  111. \& int DSA_meth_set_verify(DSA_METHOD *dsam, int (*verify)(const unsigned char *,
  112. \& int, DSA_SIG *, DSA *));
  113. \&
  114. \& int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
  115. \& BIGNUM *p1, BIGNUM *a2, BIGNUM *p2,
  116. \& BIGNUM *m, BN_CTX *ctx,
  117. \& BN_MONT_CTX *in_mont);
  118. \& int DSA_meth_set_mod_exp(DSA_METHOD *dsam, int (*mod_exp)(DSA *dsa, BIGNUM *rr,
  119. \& BIGNUM *a1, BIGNUM *p1,
  120. \& BIGNUM *a2, BIGNUM *p2,
  121. \& BIGNUM *m, BN_CTX *ctx,
  122. \& BN_MONT_CTX *mont));
  123. \&
  124. \& int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *r, BIGNUM *a,
  125. \& const BIGNUM *p, const BIGNUM *m,
  126. \& BN_CTX *ctx, BN_MONT_CTX *mont);
  127. \& int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, int (*bn_mod_exp)(DSA *dsa,
  128. \& BIGNUM *r,
  129. \& BIGNUM *a,
  130. \& const BIGNUM *p,
  131. \& const BIGNUM *m,
  132. \& BN_CTX *ctx,
  133. \& BN_MONT_CTX *mont));
  134. \&
  135. \& int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);
  136. \& int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *));
  137. \&
  138. \& int (*DSA_meth_get_finish(const DSA_METHOD *dsam))(DSA *);
  139. \& int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish)(DSA *));
  140. \&
  141. \& int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))(DSA *, int,
  142. \& const unsigned char *,
  143. \& int, int *, unsigned long *,
  144. \& BN_GENCB *);
  145. \& int DSA_meth_set_paramgen(DSA_METHOD *dsam,
  146. \& int (*paramgen)(DSA *, int, const unsigned char *,
  147. \& int, int *, unsigned long *, BN_GENCB *));
  148. \&
  149. \& int (*DSA_meth_get_keygen(const DSA_METHOD *dsam))(DSA *);
  150. \& int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen)(DSA *));
  151. .Ve
  152. .SH DESCRIPTION
  153. .IX Header "DESCRIPTION"
  154. All of the functions described on this page are deprecated.
  155. Applications and extension implementations should instead use the
  156. OSSL_PROVIDER APIs.
  157. .PP
  158. The \fBDSA_METHOD\fR type is a structure used for the provision of custom DSA
  159. implementations. It provides a set of functions used by OpenSSL for the
  160. implementation of the various DSA capabilities.
  161. .PP
  162. \&\fBDSA_meth_new()\fR creates a new \fBDSA_METHOD\fR structure. It should be given a
  163. unique \fBname\fR and a set of \fBflags\fR. The \fBname\fR should be a NULL terminated
  164. string, which will be duplicated and stored in the \fBDSA_METHOD\fR object. It is
  165. the callers responsibility to free the original string. The flags will be used
  166. during the construction of a new \fBDSA\fR object based on this \fBDSA_METHOD\fR. Any
  167. new \fBDSA\fR object will have those flags set by default.
  168. .PP
  169. \&\fBDSA_meth_dup()\fR creates a duplicate copy of the \fBDSA_METHOD\fR object passed as a
  170. parameter. This might be useful for creating a new \fBDSA_METHOD\fR based on an
  171. existing one, but with some differences.
  172. .PP
  173. \&\fBDSA_meth_free()\fR destroys a \fBDSA_METHOD\fR structure and frees up any memory
  174. associated with it. If the argument is NULL, nothing is done.
  175. .PP
  176. \&\fBDSA_meth_get0_name()\fR will return a pointer to the name of this DSA_METHOD. This
  177. is a pointer to the internal name string and so should not be freed by the
  178. caller. \fBDSA_meth_set1_name()\fR sets the name of the DSA_METHOD to \fBname\fR. The
  179. string is duplicated and the copy is stored in the DSA_METHOD structure, so the
  180. caller remains responsible for freeing the memory associated with the name.
  181. .PP
  182. \&\fBDSA_meth_get_flags()\fR returns the current value of the flags associated with this
  183. DSA_METHOD. \fBDSA_meth_set_flags()\fR provides the ability to set these flags.
  184. .PP
  185. The functions \fBDSA_meth_get0_app_data()\fR and \fBDSA_meth_set0_app_data()\fR provide the
  186. ability to associate implementation specific data with the DSA_METHOD. It is
  187. the application's responsibility to free this data before the DSA_METHOD is
  188. freed via a call to \fBDSA_meth_free()\fR.
  189. .PP
  190. \&\fBDSA_meth_get_sign()\fR and \fBDSA_meth_set_sign()\fR get and set the function used for
  191. creating a DSA signature respectively. This function will be
  192. called in response to the application calling \fBDSA_do_sign()\fR (or \fBDSA_sign()\fR). The
  193. parameters for the function have the same meaning as for \fBDSA_do_sign()\fR.
  194. .PP
  195. \&\fBDSA_meth_get_sign_setup()\fR and \fBDSA_meth_set_sign_setup()\fR get and set the function
  196. used for precalculating the DSA signature values \fBk^\-1\fR and \fBr\fR. This function
  197. will be called in response to the application calling \fBDSA_sign_setup()\fR. The
  198. parameters for the function have the same meaning as for \fBDSA_sign_setup()\fR.
  199. .PP
  200. \&\fBDSA_meth_get_verify()\fR and \fBDSA_meth_set_verify()\fR get and set the function used
  201. for verifying a DSA signature respectively. This function will be called in
  202. response to the application calling \fBDSA_do_verify()\fR (or \fBDSA_verify()\fR). The
  203. parameters for the function have the same meaning as for \fBDSA_do_verify()\fR.
  204. .PP
  205. \&\fBDSA_meth_get_mod_exp()\fR and \fBDSA_meth_set_mod_exp()\fR get and set the function used
  206. for computing the following value:
  207. .PP
  208. .Vb 1
  209. \& rr = a1^p1 * a2^p2 mod m
  210. .Ve
  211. .PP
  212. This function will be called by the default OpenSSL method during verification
  213. of a DSA signature. The result is stored in the \fBrr\fR parameter. This function
  214. may be NULL.
  215. .PP
  216. \&\fBDSA_meth_get_bn_mod_exp()\fR and \fBDSA_meth_set_bn_mod_exp()\fR get and set the function
  217. used for computing the following value:
  218. .PP
  219. .Vb 1
  220. \& r = a ^ p mod m
  221. .Ve
  222. .PP
  223. This function will be called by the default OpenSSL function for
  224. \&\fBDSA_sign_setup()\fR. The result is stored in the \fBr\fR parameter. This function
  225. may be NULL.
  226. .PP
  227. \&\fBDSA_meth_get_init()\fR and \fBDSA_meth_set_init()\fR get and set the function used
  228. for creating a new DSA instance respectively. This function will be
  229. called in response to the application calling \fBDSA_new()\fR (if the current default
  230. DSA_METHOD is this one) or \fBDSA_new_method()\fR. The \fBDSA_new()\fR and \fBDSA_new_method()\fR
  231. functions will allocate the memory for the new DSA object, and a pointer to this
  232. newly allocated structure will be passed as a parameter to the function. This
  233. function may be NULL.
  234. .PP
  235. \&\fBDSA_meth_get_finish()\fR and \fBDSA_meth_set_finish()\fR get and set the function used
  236. for destroying an instance of a DSA object respectively. This function will be
  237. called in response to the application calling \fBDSA_free()\fR. A pointer to the DSA
  238. to be destroyed is passed as a parameter. The destroy function should be used
  239. for DSA implementation specific clean up. The memory for the DSA itself should
  240. not be freed by this function. This function may be NULL.
  241. .PP
  242. \&\fBDSA_meth_get_paramgen()\fR and \fBDSA_meth_set_paramgen()\fR get and set the function
  243. used for generating DSA parameters respectively. This function will be called in
  244. response to the application calling \fBDSA_generate_parameters_ex()\fR (or
  245. \&\fBDSA_generate_parameters()\fR). The parameters for the function have the same
  246. meaning as for \fBDSA_generate_parameters_ex()\fR.
  247. .PP
  248. \&\fBDSA_meth_get_keygen()\fR and \fBDSA_meth_set_keygen()\fR get and set the function
  249. used for generating a new DSA key pair respectively. This function will be
  250. called in response to the application calling \fBDSA_generate_key()\fR. The parameter
  251. for the function has the same meaning as for \fBDSA_generate_key()\fR.
  252. .SH "RETURN VALUES"
  253. .IX Header "RETURN VALUES"
  254. \&\fBDSA_meth_new()\fR and \fBDSA_meth_dup()\fR return the newly allocated DSA_METHOD object
  255. or NULL on failure.
  256. .PP
  257. \&\fBDSA_meth_get0_name()\fR and \fBDSA_meth_get_flags()\fR return the name and flags
  258. associated with the DSA_METHOD respectively.
  259. .PP
  260. All other DSA_meth_get_*() functions return the appropriate function pointer
  261. that has been set in the DSA_METHOD, or NULL if no such pointer has yet been
  262. set.
  263. .PP
  264. \&\fBDSA_meth_set1_name()\fR and all DSA_meth_set_*() functions return 1 on success or
  265. 0 on failure.
  266. .SH "SEE ALSO"
  267. .IX Header "SEE ALSO"
  268. \&\fBDSA_new\fR\|(3), \fBDSA_new\fR\|(3), \fBDSA_generate_parameters\fR\|(3), \fBDSA_generate_key\fR\|(3),
  269. \&\fBDSA_dup_DH\fR\|(3), \fBDSA_do_sign\fR\|(3), \fBDSA_set_method\fR\|(3), \fBDSA_SIG_new\fR\|(3),
  270. \&\fBDSA_sign\fR\|(3), \fBDSA_size\fR\|(3), \fBDSA_get0_pqg\fR\|(3)
  271. .SH HISTORY
  272. .IX Header "HISTORY"
  273. The functions described here were deprecated in OpenSSL 3.0.
  274. .PP
  275. The functions described here were added in OpenSSL 1.1.0.
  276. .SH COPYRIGHT
  277. .IX Header "COPYRIGHT"
  278. Copyright 2016\-2024 The OpenSSL Project Authors. All Rights Reserved.
  279. .PP
  280. Licensed under the Apache License 2.0 (the "License"). You may not use
  281. this file except in compliance with the License. You can obtain a copy
  282. in the file LICENSE in the source distribution or at
  283. <https://www.openssl.org/source/license.html>.