Update various man pages to place HISTORY section after SEE ALSO
[openssl.git] / doc / man3 / OSSL_CRMF_pbmp_new.pod
1 =pod
2
3 =head1 NAME
4
5 OSSL_CRMF_pbm_new,
6 OSSL_CRMF_pbmp_new
7 - functions for producing Password-Based MAC (PBM)
8
9 =head1 SYNOPSIS
10
11   #include <openssl/crmf.h>
12
13   int OSSL_CRMF_pbm_new(const OSSL_CRMF_PBMPARAMETER *pbmp,
14                         const unsigned char *msg, size_t msglen,
15                         const unsigned char *sec, size_t seclen,
16                         unsigned char **mac, size_t *maclen);
17
18   OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(size_t saltlen, int owfnid,
19                                              int itercnt, int macnid);
20
21 =head1 DESCRIPTION
22
23 OSSL_CRMF_pbm_new() generates a PBM (Password-Based MAC) based on given PBM
24 parameters B<pbmp>, message B<msg>, and secret B<sec>, along with the respective
25 lengths B<msglen> and B<seclen>. On success writes the adddress of the newly
26 allocated MAC via the B<mac> reference parameter and writes the length via the
27 B<maclen> reference parameter unless it its NULL.
28
29 The iteration count must be at least 100, as stipulated by RFC 4211, and is
30 limited to at most 100000 to avoid DoS through manipulated or otherwise
31 malformed input.
32
33 OSSL_CRMF_pbmp_new() initializes and returns a new PBMParameter
34 structure with a new random salt of given length B<saltlen>, OWF (one-way
35 function) NID B<owfnid>, iteration count B<itercnt>, and MAC NID B<macnid>.
36
37 =head1 NOTES
38
39 The algorithms for the OWF (one-way function) and for the MAC (message
40 authentication code) may be any with a NID defined in B<openssl/objects.h>.
41 As specified by RFC 4210, these should include NID_hmac_sha1.
42
43 RFC 4210 recommends that the salt SHOULD be at least 8 bytes (64 bits) long.
44
45 =head1 RETURN VALUES
46
47 OSSL_CRMF_pbm_new() returns 1 on success, 0 on error.
48
49 OSSL_CRMF_pbmp_new() returns a new and initialized OSSL_CRMF_PBMPARAMETER
50 structure, or NULL on error.
51
52 =head1 EXAMPLE
53
54  OSSL_CRMF_PBMPARAMETER *pbm = NULL;
55  unsigned char *msg = "Hello";
56  unsigned char *sec = "SeCrEt";
57  unsigned char *mac = NULL;
58  size_t maclen;
59
60  if ((pbm = OSSL_CRMF_pbmp_new(16, NID_sha256, 500, NID_hmac_sha1) == NULL))
61      goto err;
62  if (!OSSL_CRMF_pbm_new(pbm, msg, 5, sec, 6, &mac, &maclen))
63      goto err;
64
65 =head1 SEE ALSO
66
67 RFC 4211 section 4.4
68
69 =head1 COPYRIGHT
70
71 Copyright 2007-2018 The OpenSSL Project Authors. All Rights Reserved.
72
73 Licensed under the Apache License 2.0 (the "License").  You may not use
74 this file except in compliance with the License.  You can obtain a copy
75 in the file LICENSE in the source distribution or at
76 L<https://www.openssl.org/source/license.html>.
77
78 =cut