globalplatform
loadfile.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005-2026, Karsten Ohme
3  * This file is part of GlobalPlatform.
4  *
5  * GlobalPlatform is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * GlobalPlatform is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with GlobalPlatform. If not, see <https://www.gnu.org/licenses/>.
17  *
18  * In addition, as a special exception, the copyright holders give
19  * permission to link the code of portions of this program with the
20  * OpenSSL library under certain conditions as described in each
21  * individual source file, and distribute linked combinations
22  * including the two.
23  * You must obey the GNU Lesser General Public License in all respects
24  * for all of the code used other than OpenSSL. If you modify
25  * file(s) with this exception, you may extend this exception to your
26  * version of the file(s), but you are not obligated to do so. If you
27  * do not wish to do so, delete this exception statement from your
28  * version.
29  */
30 
35 #ifndef OPGP_LOADFILE_H
36 #define OPGP_LOADFILE_H
37 
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif
42 
43 #ifdef WIN32
44 #include "stdafx.h"
45 #endif
46 
47 #include "globalplatform/types.h"
48 #include "globalplatform/error.h"
49 #include "globalplatform/library.h"
51 
53 OPGP_NO_API
54 OPGP_ERROR_STATUS handle_load_file(OPGP_CSTRING fileName, PBYTE loadFileBuf, PDWORD loadFileBufSize);
55 
57 OPGP_NO_API
58 OPGP_ERROR_STATUS extract_cap_file(OPGP_CSTRING fileName, PBYTE loadFileBuf, PDWORD loadFileBufSize);
59 
61 OPGP_NO_API
62 OPGP_ERROR_STATUS read_load_file_data_block_signature(PBYTE buf, PDWORD bufLength, GP211_DAP_BLOCK loadFileDataBlockSignature);
63 
65 OPGP_NO_API
66 OPGP_ERROR_STATUS cap_to_ijc(OPGP_CSTRING capFileName, OPGP_STRING ijcFileName);
67 
68 
70 OPGP_NO_API
71 OPGP_ERROR_STATUS get_load_data(PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength,
72  PBYTE securityDomainAID,
73  DWORD securityDomainAIDLength, PBYTE loadFileDataBlockHash,
74  DWORD loadFileDataBlockHashLength, DWORD loadTokenLength,
75  DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit,
76  DWORD nonVolatileDataSpaceLimit, PBYTE loadData, PDWORD loadDataLength);
77 
79 OPGP_NO_API
81 
83 OPGP_NO_API
85 
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif
OPGP_NO_API OPGP_ERROR_STATUS get_load_data(PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE loadFileDataBlockHash, DWORD loadFileDataBlockHashLength, DWORD loadTokenLength, DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE loadData, PDWORD loadDataLength)
Gets the data for a GP211_install_for_load() command and Load Token signature input.
Definition: loadfile.c:671
OPGP_NO_API OPGP_ERROR_STATUS read_load_file_data_block_signature(PBYTE buf, PDWORD bufLength, GP211_DAP_BLOCK loadFileDataBlockSignature)
Reads a DAP block and parses it to the buffer buf.
Definition: loadfile.c:806
OPGP_NO_API OPGP_ERROR_STATUS cap_to_ijc(OPGP_CSTRING capFileName, OPGP_STRING ijcFileName)
Converts a CAP file to an IJC file (Executable Load File).
Definition: loadfile.c:458
OPGP_NO_API OPGP_ERROR_STATUS extract_cap_file(OPGP_CSTRING fileName, PBYTE loadFileBuf, PDWORD loadFileBufSize)
Extracts a CAP file.
Definition: loadfile.c:134
OPGP_NO_API OPGP_ERROR_STATUS handle_load_file(OPGP_CSTRING fileName, PBYTE loadFileBuf, PDWORD loadFileBufSize)
Handles a CAP or IJC file and copies the Executable Load File contents.
Definition: loadfile.c:55
OPGP_NO_API OPGP_ERROR_STATUS read_executable_load_file_parameters_from_buffer(PBYTE loadFileBuf, DWORD loadFileBufSize, OPGP_LOAD_FILE_PARAMETERS *loadFileParams)
Reads Executable Load File parameters from a buffer.
Definition: loadfile.c:513
OPGP_NO_API OPGP_ERROR_STATUS read_executable_load_file_parameters(OPGP_STRING loadFileName, OPGP_LOAD_FILE_PARAMETERS *loadFileParams)
Can read CAP and IJC files (concatenated extracted CAP files).
Definition: loadfile.c:418
Definition: security.h:317
Definition: error.h:58
Definition: globalplatform.h:404
unsigned char * PBYTE
A Microsoft/Muscle LPBYTE, pointer to unsigned char.
Definition: types.h:64
unsigned long * PDWORD
A Microsoft LPDWORD/Muscle pointer to a DWORD.
Definition: types.h:66
char * OPGP_STRING
A Microsoft/Muscle LPTSTR.
Definition: types.h:62
unsigned long DWORD
A Microsoft/Muscle DWORD definition.
Definition: types.h:68
const char * OPGP_CSTRING
A Microsoft/Muscle LPCTSTR.
Definition: types.h:63