1*f5b1c8a1SJohn Marino /* $OpenBSD: cmac.h,v 1.2 2014/06/12 15:49:28 deraadt Exp $ */ 2*f5b1c8a1SJohn Marino /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3*f5b1c8a1SJohn Marino * project. 4*f5b1c8a1SJohn Marino */ 5*f5b1c8a1SJohn Marino /* ==================================================================== 6*f5b1c8a1SJohn Marino * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 7*f5b1c8a1SJohn Marino * 8*f5b1c8a1SJohn Marino * Redistribution and use in source and binary forms, with or without 9*f5b1c8a1SJohn Marino * modification, are permitted provided that the following conditions 10*f5b1c8a1SJohn Marino * are met: 11*f5b1c8a1SJohn Marino * 12*f5b1c8a1SJohn Marino * 1. Redistributions of source code must retain the above copyright 13*f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer. 14*f5b1c8a1SJohn Marino * 15*f5b1c8a1SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 16*f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer in 17*f5b1c8a1SJohn Marino * the documentation and/or other materials provided with the 18*f5b1c8a1SJohn Marino * distribution. 19*f5b1c8a1SJohn Marino * 20*f5b1c8a1SJohn Marino * 3. All advertising materials mentioning features or use of this 21*f5b1c8a1SJohn Marino * software must display the following acknowledgment: 22*f5b1c8a1SJohn Marino * "This product includes software developed by the OpenSSL Project 23*f5b1c8a1SJohn Marino * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 24*f5b1c8a1SJohn Marino * 25*f5b1c8a1SJohn Marino * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26*f5b1c8a1SJohn Marino * endorse or promote products derived from this software without 27*f5b1c8a1SJohn Marino * prior written permission. For written permission, please contact 28*f5b1c8a1SJohn Marino * licensing@OpenSSL.org. 29*f5b1c8a1SJohn Marino * 30*f5b1c8a1SJohn Marino * 5. Products derived from this software may not be called "OpenSSL" 31*f5b1c8a1SJohn Marino * nor may "OpenSSL" appear in their names without prior written 32*f5b1c8a1SJohn Marino * permission of the OpenSSL Project. 33*f5b1c8a1SJohn Marino * 34*f5b1c8a1SJohn Marino * 6. Redistributions of any form whatsoever must retain the following 35*f5b1c8a1SJohn Marino * acknowledgment: 36*f5b1c8a1SJohn Marino * "This product includes software developed by the OpenSSL Project 37*f5b1c8a1SJohn Marino * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 38*f5b1c8a1SJohn Marino * 39*f5b1c8a1SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40*f5b1c8a1SJohn Marino * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41*f5b1c8a1SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42*f5b1c8a1SJohn Marino * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43*f5b1c8a1SJohn Marino * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44*f5b1c8a1SJohn Marino * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45*f5b1c8a1SJohn Marino * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46*f5b1c8a1SJohn Marino * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47*f5b1c8a1SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48*f5b1c8a1SJohn Marino * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49*f5b1c8a1SJohn Marino * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50*f5b1c8a1SJohn Marino * OF THE POSSIBILITY OF SUCH DAMAGE. 51*f5b1c8a1SJohn Marino * ==================================================================== 52*f5b1c8a1SJohn Marino */ 53*f5b1c8a1SJohn Marino 54*f5b1c8a1SJohn Marino 55*f5b1c8a1SJohn Marino #ifndef HEADER_CMAC_H 56*f5b1c8a1SJohn Marino #define HEADER_CMAC_H 57*f5b1c8a1SJohn Marino 58*f5b1c8a1SJohn Marino #ifdef __cplusplus 59*f5b1c8a1SJohn Marino extern "C" { 60*f5b1c8a1SJohn Marino #endif 61*f5b1c8a1SJohn Marino 62*f5b1c8a1SJohn Marino #include <openssl/evp.h> 63*f5b1c8a1SJohn Marino 64*f5b1c8a1SJohn Marino /* Opaque */ 65*f5b1c8a1SJohn Marino typedef struct CMAC_CTX_st CMAC_CTX; 66*f5b1c8a1SJohn Marino 67*f5b1c8a1SJohn Marino CMAC_CTX *CMAC_CTX_new(void); 68*f5b1c8a1SJohn Marino void CMAC_CTX_cleanup(CMAC_CTX *ctx); 69*f5b1c8a1SJohn Marino void CMAC_CTX_free(CMAC_CTX *ctx); 70*f5b1c8a1SJohn Marino EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 71*f5b1c8a1SJohn Marino int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 72*f5b1c8a1SJohn Marino 73*f5b1c8a1SJohn Marino int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 74*f5b1c8a1SJohn Marino const EVP_CIPHER *cipher, ENGINE *impl); 75*f5b1c8a1SJohn Marino int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 76*f5b1c8a1SJohn Marino int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 77*f5b1c8a1SJohn Marino int CMAC_resume(CMAC_CTX *ctx); 78*f5b1c8a1SJohn Marino 79*f5b1c8a1SJohn Marino #ifdef __cplusplus 80*f5b1c8a1SJohn Marino } 81*f5b1c8a1SJohn Marino #endif 82*f5b1c8a1SJohn Marino #endif 83