1238384Sjkim/* crypto/cmac/cmac.h */
2238384Sjkim/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3238384Sjkim * project.
4238384Sjkim */
5238384Sjkim/* ====================================================================
6238384Sjkim * Copyright (c) 2010 The OpenSSL Project.  All rights reserved.
7238384Sjkim *
8238384Sjkim * Redistribution and use in source and binary forms, with or without
9238384Sjkim * modification, are permitted provided that the following conditions
10238384Sjkim * are met:
11238384Sjkim *
12238384Sjkim * 1. Redistributions of source code must retain the above copyright
13238384Sjkim *    notice, this list of conditions and the following disclaimer.
14238384Sjkim *
15238384Sjkim * 2. Redistributions in binary form must reproduce the above copyright
16238384Sjkim *    notice, this list of conditions and the following disclaimer in
17238384Sjkim *    the documentation and/or other materials provided with the
18238384Sjkim *    distribution.
19238384Sjkim *
20238384Sjkim * 3. All advertising materials mentioning features or use of this
21238384Sjkim *    software must display the following acknowledgment:
22238384Sjkim *    "This product includes software developed by the OpenSSL Project
23238384Sjkim *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24238384Sjkim *
25238384Sjkim * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26238384Sjkim *    endorse or promote products derived from this software without
27238384Sjkim *    prior written permission. For written permission, please contact
28238384Sjkim *    licensing@OpenSSL.org.
29238384Sjkim *
30238384Sjkim * 5. Products derived from this software may not be called "OpenSSL"
31238384Sjkim *    nor may "OpenSSL" appear in their names without prior written
32238384Sjkim *    permission of the OpenSSL Project.
33238384Sjkim *
34238384Sjkim * 6. Redistributions of any form whatsoever must retain the following
35238384Sjkim *    acknowledgment:
36238384Sjkim *    "This product includes software developed by the OpenSSL Project
37238384Sjkim *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38238384Sjkim *
39238384Sjkim * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40238384Sjkim * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41238384Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42238384Sjkim * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43238384Sjkim * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44238384Sjkim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45238384Sjkim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46238384Sjkim * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47238384Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48238384Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49238384Sjkim * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50238384Sjkim * OF THE POSSIBILITY OF SUCH DAMAGE.
51238384Sjkim * ====================================================================
52238384Sjkim */
53238384Sjkim
54238384Sjkim
55238384Sjkim#ifndef HEADER_CMAC_H
56238384Sjkim#define HEADER_CMAC_H
57238384Sjkim
58238384Sjkim#ifdef __cplusplus
59238384Sjkimextern "C" {
60238384Sjkim#endif
61238384Sjkim
62238384Sjkim#include <openssl/evp.h>
63238384Sjkim
64238384Sjkim/* Opaque */
65238384Sjkimtypedef struct CMAC_CTX_st CMAC_CTX;
66238384Sjkim
67238384SjkimCMAC_CTX *CMAC_CTX_new(void);
68238384Sjkimvoid CMAC_CTX_cleanup(CMAC_CTX *ctx);
69238384Sjkimvoid CMAC_CTX_free(CMAC_CTX *ctx);
70238384SjkimEVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx);
71238384Sjkimint CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);
72238384Sjkim
73238384Sjkimint CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
74238384Sjkim			const EVP_CIPHER *cipher, ENGINE *impl);
75238384Sjkimint CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen);
76238384Sjkimint CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen);
77238384Sjkimint CMAC_resume(CMAC_CTX *ctx);
78238384Sjkim
79238384Sjkim#ifdef  __cplusplus
80238384Sjkim}
81238384Sjkim#endif
82238384Sjkim#endif
83