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