VSF Documented
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
source
component
crypto
hash
crc
vsf_crc.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* Copyright(C)2009-2022 by VSF Team *
3
* *
4
* Licensed under the Apache License, Version 2.0 (the "License"); *
5
* you may not use this file except in compliance with the License. *
6
* You may obtain a copy of the License at *
7
* *
8
* http://www.apache.org/licenses/LICENSE-2.0 *
9
* *
10
* Unless required by applicable law or agreed to in writing, software *
11
* distributed under the License is distributed on an "AS IS" BASIS, *
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13
* See the License for the specific language governing permissions and *
14
* limitations under the License. *
15
* *
16
****************************************************************************/
17
18
#ifndef __VSF_CRC_H__
19
#define __VSF_CRC_H__
20
21
/*============================ INCLUDES ======================================*/
22
23
#include "../../vsf_crypto_cfg.h"
24
25
#if VSF_HASH_USE_CRC == ENABLED
26
27
// for stdint.h
28
#include "
utilities/vsf_utilities.h
"
29
30
#ifdef __cplusplus
31
extern
"C"
{
32
#endif
33
34
/*============================ MACROS ========================================*/
35
/*============================ MACROFIED FUNCTIONS ===========================*/
36
/*============================ TYPES =========================================*/
37
38
typedef
struct
vsf_crc_t
{
39
enum
{
40
VSF_CRC_BITLEN8
= 8,
41
VSF_CRC_BITLEN16
= 16,
42
VSF_CRC_BITLEN32
= 32,
43
}
bitlen
;
44
uint32_t
poly
;
45
}
vsf_crc_t
;
46
47
/*============================ GLOBAL VARIABLES ==============================*/
48
49
extern
const
vsf_crc_t
vsf_crc8_ccitt
;
50
extern
const
vsf_crc_t
vsf_crc16_ccitt
;
51
52
/*============================ PROTOTYPES ====================================*/
53
54
extern
uint_fast32_t
vsf_crc
(
const
vsf_crc_t
*crc,
uint_fast32_t
initial,
uint8_t
*
buff
,
uint_fast32_t
bytesize);
55
56
#ifdef __cplusplus
57
}
58
#endif
59
60
#endif
61
#endif
62
/* EOF */
uint32_t
unsigned int uint32_t
Definition
lvgl.h:43
uint8_t
unsigned char uint8_t
Definition
lvgl.h:40
uint_fast32_t
unsigned int uint_fast32_t
Definition
stdint.h:27
vsf_crc_t
Definition
vsf_crc.h:38
vsf_crc_t::bitlen
enum vsf_crc_t::@3 bitlen
vsf_crc_t::VSF_CRC_BITLEN32
@ VSF_CRC_BITLEN32
Definition
vsf_crc.h:42
vsf_crc_t::VSF_CRC_BITLEN16
@ VSF_CRC_BITLEN16
Definition
vsf_crc.h:41
vsf_crc_t::VSF_CRC_BITLEN8
@ VSF_CRC_BITLEN8
Definition
vsf_crc.h:40
vsf_crc_t::poly
uint32_t poly
Definition
vsf_crc.h:44
vsf_crc8_ccitt
const vsf_crc_t vsf_crc8_ccitt
Definition
vsf_crc.c:29
vsf_crc
uint_fast32_t vsf_crc(const vsf_crc_t *crc, uint_fast32_t initial, uint8_t *buff, uint_fast32_t bytesize)
Definition
vsf_crc.c:43
vsf_crc16_ccitt
const vsf_crc_t vsf_crc16_ccitt
Definition
vsf_crc.c:34
buff
uint8_t * buff
Definition
vsf_memfs.h:51
vsf_utilities.h
Generated by
1.9.8