4 * Copyright (c) 2017 - 2022 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef _SS_PATCHDELTA_H
20 #define _SS_PATCHDELTA_H
29 #define SHA_DIGEST_SIZE 20
31 typedef struct _FileInfo {
32 unsigned char sha1[20]; //SHA_DIGEST_SIZE 20
37 typedef ssize_t(*SinkFn) (unsigned char *, ssize_t, void *);
39 int ParseSha1(const char *str, uint8_t * digest);
41 int SS_LoadFile(const char *filename, FileInfo * file);
42 extern void SS_SetUpgradeState(int Val);
43 extern long SS_GetAvailableFreeSpace(const char *partition_name, SS_UINT32 * available_flash_size);
44 extern int SS_BackupSource(const char *source_filename, char *backup_path);
45 extern int SS_ApplyBsdiff(char *oldfile, char *newfile, char *patch, SinkFn sink, void *token, SHA1_CTX * ctx1);
46 extern int SS_BackupSourceClear(char * backup_path);
47 extern int SS_PatchSourceClear(char *patch_path);
48 extern long SS_WriteFile(long wHandle, SS_UINT32 dwPosition, unsigned char *pbBuffer, SS_UINT32 dwSize);
49 extern void SS_Free(void * pMemBlock);
50 extern long SS_CopyFile(const char * strFromPath, const char * strToPath);
51 extern long SS_DeleteFolder(const char * strPath);
52 extern long SS_DeleteFile(const char * strPath);
53 extern int tar_get_item_size(char * tar, char * item);
54 extern int tar_extract_file(char * tar, char * item, char * pathname);
55 extern int _system_cmd_wait(const char * command);