PicoWAN SDK Documentation
cmac.h
1 /**************************************************************************
2 Copyright (C) 2009 Lander Casado, Philippas Tsigas
3 Copyright (C) 2018 Archos S.A.
4 
5 All rights reserved.
6 
7 Permission is hereby granted, free of charge, to any person obtaining
8 a copy of this software and associated documentation files
9 (the "Software"), to deal with the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sublicense, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
14 
15 Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimers. Redistributions in
17 binary form must reproduce the above copyright notice, this list of
18 conditions and the following disclaimers in the documentation and/or
19 other materials provided with the distribution.
20 
21 In no event shall the authors or copyright holders be liable for any special,
22 incidental, indirect or consequential damages of any kind, or any damages
23 whatsoever resulting from loss of use, data or profits, whether or not
24 advised of the possibility of damage, and on any theory of liability,
25 arising out of or in connection with the use or performance of this software.
26 
27 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
28 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30 CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
32 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
33 DEALINGS WITH THE SOFTWARE
34 
35 *****************************************************************************/
36 
37 #ifndef _CMAC_H_
38 #define _CMAC_H_
39 
40 #define AES_CMAC_KEY_LENGTH 16
41 #define AES_CMAC_DIGEST_LENGTH 16
42 
43 typedef struct _AES_CMAC_CTX {
44  uint8_t X[16];
45  uint8_t M_last[16];
46  uint32_t M_n;
47 } AES_CMAC_CTX;
48 
49 //#include <sys/cdefs.h>
50 
51 //__BEGIN_DECLS
52 void AES_CMAC_Init(AES_CMAC_CTX *ctx);
53 void AES_CMAC_SetKey(AES_CMAC_CTX *ctx, const uint8_t key[AES_CMAC_KEY_LENGTH]);
54 void AES_CMAC_Update(AES_CMAC_CTX *ctx, const uint8_t *data, uint32_t len);
55 // __attribute__((__bounded__(__string__,2,3)));
56 void AES_CMAC_Final(uint8_t digest[AES_CMAC_DIGEST_LENGTH], AES_CMAC_CTX *ctx);
57 // __attribute__((__bounded__(__minbytes__,1,AES_CMAC_DIGEST_LENGTH)));
58 //__END_DECLS
59 
60 #endif /* _CMAC_H_ */
Definition: cmac.h:43