Embedded SDK
Embedded SDK
cx_crc16.c
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * Ledger Nano S - Secure firmware
4  * (c) 2022 Ledger
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  ********************************************************************************/
18 
19 #include "app_config.h"
20 
21 #ifdef HAVE_CRC
22 
23 #include "lcx_crc.h"
24 #include "cx_ram.h"
25 
26 uint16_t cx_crc16_update(uint16_t crc, const void *buf, size_t len)
27 {
28  return cx_crc_hw(CRC_TYPE_CRC16_CCITT_FALSE, crc, buf, len);
29 }
30 
31 uint16_t cx_crc16(const void *buf, size_t len)
32 {
33  return cx_crc_hw(CRC_TYPE_CRC16_CCITT_FALSE, CX_CRC16_INIT, buf, len);
34 }
35 
36 #endif // HAVE_CRC
CRC (Cyclic Redundancy Check).
unsigned short uint16_t
Definition: usbd_conf.h:54