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