1*7eba2f3bSAndroid Build Coastguard Worker /****************************************************************************** 2*7eba2f3bSAndroid Build Coastguard Worker * 3*7eba2f3bSAndroid Build Coastguard Worker * Copyright (C) 2012 Broadcom Corporation 4*7eba2f3bSAndroid Build Coastguard Worker * 5*7eba2f3bSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 6*7eba2f3bSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 7*7eba2f3bSAndroid Build Coastguard Worker * You may obtain a copy of the License at: 8*7eba2f3bSAndroid Build Coastguard Worker * 9*7eba2f3bSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 10*7eba2f3bSAndroid Build Coastguard Worker * 11*7eba2f3bSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 12*7eba2f3bSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 13*7eba2f3bSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*7eba2f3bSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 15*7eba2f3bSAndroid Build Coastguard Worker * limitations under the License. 16*7eba2f3bSAndroid Build Coastguard Worker * 17*7eba2f3bSAndroid Build Coastguard Worker ******************************************************************************/ 18*7eba2f3bSAndroid Build Coastguard Worker #pragma once 19*7eba2f3bSAndroid Build Coastguard Worker 20*7eba2f3bSAndroid Build Coastguard Worker #include <stdbool.h> 21*7eba2f3bSAndroid Build Coastguard Worker #include <stdint.h> 22*7eba2f3bSAndroid Build Coastguard Worker 23*7eba2f3bSAndroid Build Coastguard Worker /******************************************************************************* 24*7eba2f3bSAndroid Build Coastguard Worker ** 25*7eba2f3bSAndroid Build Coastguard Worker ** Function crcChecksumCompute 26*7eba2f3bSAndroid Build Coastguard Worker ** 27*7eba2f3bSAndroid Build Coastguard Worker ** Description Compute a checksum on a buffer of data. 28*7eba2f3bSAndroid Build Coastguard Worker ** 29*7eba2f3bSAndroid Build Coastguard Worker ** Returns 2-byte checksum. 30*7eba2f3bSAndroid Build Coastguard Worker ** 31*7eba2f3bSAndroid Build Coastguard Worker *******************************************************************************/ 32*7eba2f3bSAndroid Build Coastguard Worker uint16_t crcChecksumCompute(const unsigned char* buffer, int bufferLen); 33*7eba2f3bSAndroid Build Coastguard Worker 34*7eba2f3bSAndroid Build Coastguard Worker /******************************************************************************* 35*7eba2f3bSAndroid Build Coastguard Worker ** 36*7eba2f3bSAndroid Build Coastguard Worker ** Function crcChecksumVerifyIntegrity 37*7eba2f3bSAndroid Build Coastguard Worker ** 38*7eba2f3bSAndroid Build Coastguard Worker ** Description Detect any corruption in a file by computing a checksum. 39*7eba2f3bSAndroid Build Coastguard Worker ** filename: file name. 40*7eba2f3bSAndroid Build Coastguard Worker ** 41*7eba2f3bSAndroid Build Coastguard Worker ** Returns True if file is good. 42*7eba2f3bSAndroid Build Coastguard Worker ** 43*7eba2f3bSAndroid Build Coastguard Worker *******************************************************************************/ 44*7eba2f3bSAndroid Build Coastguard Worker bool crcChecksumVerifyIntegrity(const char* filename); 45