]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - common/polarssl/aes_cmac128.h
b792755fc41c4329738410633e0a6cb5b2067ac9
2 * AES-CMAC from NIST Special Publication 800-38B \97 Recommendation for block cipher modes of operation: The CMAC mode for authentication.
4 * Copyright (C) 2006-2014, Brainspark B.V.
5 * Copyright (C) 2014, Anargyros Plemenos
6 * Tests added Merkok, 2018
8 * This file is part of PolarSSL (http://www.polarssl.org)
9 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
11 * All rights reserved.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * Reference : https://polarssl.org/discussions/generic/authentication-token
28 * NIST Special Publication 800-38B \97 Recommendation for block cipher modes of operation: The CMAC mode for authentication.
30 * https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/AES_CMAC.pdf
37 typedef struct aes_cmac_128_context
{
51 * \brief AES-CMAC-128 context setup
53 * \param ctx context to be initialized
54 * \param key secret key for AES-128
56 void aes_cmac128_starts(aes_cmac128_context
*ctx
, const uint8_t K
[16]);
59 * \brief AES-CMAC-128 process message
61 * \param ctx context to be initialized
62 * \param _msg the given message
63 * \param _msg_len the length of message
65 void aes_cmac128_update(aes_cmac128_context
*ctx
, const uint8_t *_msg
, size_t _msg_len
);
68 * \brief AES-CMAC-128 compute T
70 * \param ctx context to be initialized
71 * \param T the generated MAC which is used to validate the message
73 void aes_cmac128_final(aes_cmac128_context
*ctx
, uint8_t T
[16]);
76 * \brief Checkup routine
78 * \return 0 if successful, or 1 if the test failed
80 int aes_cmac_self_test( int verbose
);