1 /* Wrapper for hmac openssl implementation.
2 *
3 * Copyright (c) 2021 Red Hat, Inc.
4 * Written by Iker Pedrosa <ipedrosa@redhat.com>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, and the entire permission notice in its entirety,
11 * including the disclaimer of warranties.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote
16 * products derived from this software without specific prior
17 * written permission.
18 *
19 * ALTERNATIVELY, this product may be distributed under the terms of
20 * the GNU Public License, in which case the provisions of the GPL are
21 * required INSTEAD OF the above restrictions. (This clause is
22 * necessary due to a potential bad interaction between the GPL and
23 * the restrictions contained in a BSD-style copyright.)
24 *
25 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35 * OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 */
38 #ifndef PAM_TIMESTAMP_HMAC_OPENSSL_WRAPPER_H
39 #define PAM_TIMESTAMP_HMAC_OPENSSL_WRAPPER_H
40
41 #include "config.h"
42
43 #ifdef WITH_OPENSSL
44
45 #include <openssl/hmac.h>
46 #include <security/pam_modules.h>
47
48 int
49 hmac_size(pam_handle_t *pamh, int debug, size_t *hmac_length);
50
51 int
52 hmac_generate(pam_handle_t *pamh, int debug, void **mac, size_t *mac_length,
53 const char *key_file, uid_t owner, gid_t group,
54 const void *text, size_t text_length);
55
56 #endif /* WITH_OPENSSL */
57 #endif /* PAM_TIMESTAMP_HMAC_OPENSSL_WRAPPER_H */