summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2024-11-24 14:48:12 +0000
committerschwarze <>2024-11-24 14:48:12 +0000
commitff56d47bbc99ed7ac64ae73eaacbc02525a11b04 (patch)
treebb5d1bcbe3decabb7fcd83247dbd2e4875344072 /src
parent4c908616aa50e22645747c285720f6f2addd285c (diff)
downloadopenbsd-ff56d47bbc99ed7ac64ae73eaacbc02525a11b04.tar.gz
openbsd-ff56d47bbc99ed7ac64ae73eaacbc02525a11b04.tar.bz2
openbsd-ff56d47bbc99ed7ac64ae73eaacbc02525a11b04.zip
Fix some inaccuracies and gaps in the paragraph i wrote about CMAC
such that it becomes intelligible but not too long or prominent. In particular, don't talk about EVP_PKEY_CTX_new(3), don't forget to mention EVP_PKEY_keygen(3), mention EVP_PKEY_OP_KEYGEN, and mention how to proceed once you have the desired EVP_PKEY object in hand. Substantial feedback and OK tb@.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.365
1 files changed, 47 insertions, 18 deletions
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
index 9049a11832..0a70e51ad6 100644
--- a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
+++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.25 2024/11/07 17:33:42 schwarze Exp $ 1.\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.26 2024/11/24 14:48:12 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" Parts were split out into RSA_pkey_ctx_ctrl(3). 4.\" Parts were split out into RSA_pkey_ctx_ctrl(3).
@@ -69,7 +69,7 @@
69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70.\" OF THE POSSIBILITY OF SUCH DAMAGE. 70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
71.\" 71.\"
72.Dd $Mdocdate: November 7 2024 $ 72.Dd $Mdocdate: November 24 2024 $
73.Dt EVP_PKEY_CTX_CTRL 3 73.Dt EVP_PKEY_CTX_CTRL 3
74.Os 74.Os
75.Sh NAME 75.Sh NAME
@@ -411,24 +411,34 @@ The return value is the user key material length.
411The resulting pointer is owned by the library and should not be 411The resulting pointer is owned by the library and should not be
412freed by the caller. 412freed by the caller.
413.Ss CMAC parameters 413.Ss CMAC parameters
414Application programs normally initialize an 414Application programs normally implement CMAC as described in
415.Vt EVP_PKEY_CTX 415.Xr EVP_PKEY_new_CMAC_key 3
416object using 416and do not need the control commands documented here.
417.Xr EVP_PKEY_CTX_new 3 , 417.Pp
418specifying the 418Alternatively, the call to
419.Vt EVP_PKEY 419.Xr EVP_PKEY_new_CMAC_key 3
420object containing the symmetric key right away. 420can be replaced as follows,
421Alternatively, an empty 421leaving the rest of the example code given there unchanged:
422.Pp
423.Bl -enum -width 2n -compact
424.It
425Create an empty
422.Vt EVP_PKEY_CTX 426.Vt EVP_PKEY_CTX
423object can be created by passing the 427object by passing the
424.Dv EVP_PKEY_CMAC 428.Dv EVP_PKEY_CMAC
425constant to 429constant to
426.Xr EVP_PKEY_CTX_new_id 3 . 430.Xr EVP_PKEY_CTX_new_id 3 .
427After that, the block cipher can be selected by calling 431.It
432Initialize it with
433.Xr EVP_PKEY_keygen_init 3 .
434.It
435Select the block cipher by calling
428.Fn EVP_PKEY_CTX_ctrl 436.Fn EVP_PKEY_CTX_ctrl
429with an 437with an
430.Fa optype 438.Fa optype
431of \-1, a 439of
440.Dv EVP_PKEY_OP_KEYGEN ,
441a
432.Fa cmd 442.Fa cmd
433of 443of
434.Dv EVP_PKEY_CTRL_CIPHER , 444.Dv EVP_PKEY_CTRL_CIPHER ,
@@ -441,13 +451,14 @@ object, which can be obtained from the functions in the CIPHER LISTING in
441The 451The
442.Fa p1 452.Fa p1
443argument is ignored; passing 0 is recommended. 453argument is ignored; passing 0 is recommended.
444.Pp 454.It
445After selecting the block cipher with 455Call
446.Dv EVP_PKEY_CTRL_CIPHER ,
447.Fn EVP_PKEY_CTX_ctrl 456.Fn EVP_PKEY_CTX_ctrl
448can be called again with an 457again with an
449.Fa optype 458.Fa optype
450of \-1, a 459of
460.Dv EVP_PKEY_OP_KEYGEN ,
461a
451.Fa cmd 462.Fa cmd
452of 463of
453.Dv EVP_PKEY_CTRL_SET_MAC_KEY , 464.Dv EVP_PKEY_CTRL_SET_MAC_KEY ,
@@ -455,6 +466,24 @@ of
455pointing to the symmetric key, and 466pointing to the symmetric key, and
456.Fa p1 467.Fa p1
457specifying the length of the symmetric key in bytes. 468specifying the length of the symmetric key in bytes.
469.It
470Extract the desired
471.Vt EVP_PKEY
472object using
473.Xr EVP_PKEY_keygen 3 ,
474making sure the
475.Fa ppkey
476argument points to a storage location containing a
477.Dv NULL
478pointer.
479.It
480Proceed with
481.Xr EVP_MD_CTX_new 3 ,
482.Xr EVP_DigestSignInit 3 ,
483and
484.Xr EVP_DigestSign 3
485as usual.
486.El
458.Ss Other parameters 487.Ss Other parameters
459The 488The
460.Fn EVP_PKEY_CTX_set1_id , 489.Fn EVP_PKEY_CTX_set1_id ,