globalplatform
projects
globalplatform
globalplatform
src
testUtil.h
1
/* Copyright (c) 2020, Karsten Ohme
2
* This file is part of GlobalPlatform.
3
*
4
* GlobalPlatform is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* GlobalPlatform is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public License
15
* along with GlobalPlatform. If not, see <http://www.gnu.org/licenses/>.
16
*
17
* In addition, as a special exception, the copyright holders give
18
* permission to link the code of portions of this program with the
19
* OpenSSL library under certain conditions as described in each
20
* individual source file, and distribute linked combinations
21
* including the two.
22
* You must obey the GNU Lesser General Public License in all respects
23
* for all of the code used other than OpenSSL. If you modify
24
* file(s) with this exception, you may extend this exception to your
25
* version of the file(s), but you are not obligated to do so. If you
26
* do not wish to do so, delete this exception statement from your
27
* version. If you delete this exception statement from all source
28
* files in the program, then also delete it here.
29
*/
30
#ifndef OPGP_TESTUTIL_H
31
#define OPGP_TESTUTIL_H
32
33
#ifdef __cplusplus
34
extern
"C"
35
{
36
#endif
37
38
// MSVC does not the linker wrap flag to mock functions, it must be done in the code by using #pragma comment(linker, "/alternatename:real_foo=foo")
39
// https://stackoverflow.com/questions/33790425/visual-studio-c-linker-wrap-option
40
//#if _MSC_VER
41
//#define RAND_bytes real_RAND_bytes
42
//#include <openssl/rand.h>
43
//#undef RAND_bytes
44
//#pragma comment(linker, "/alternatename:real_RAND_bytes=RAND_bytes")
45
//#endif
46
47
//#define RAND_bytes __wrap_RAND_bytes
48
49
#include "
globalplatform/globalplatform.h
"
50
51
void
mock_setup();
52
53
void
hex_to_byte_array(
OPGP_CSTRING
hexString,
PBYTE
buffer,
PDWORD
bufferLength);
54
55
int
__wrap_RAND_bytes(
unsigned
char
*buf,
int
num);
56
57
OPGP_ERROR_STATUS
send_APDU(
OPGP_CARD_CONTEXT
cardContext,
OPGP_CARD_INFO
cardInfo,
PBYTE
capdu,
DWORD
capduLength,
PBYTE
rapdu,
PDWORD
rapduLength);
58
59
void
enqueue_commands(
OPGP_CSTRING
*commands,
OPGP_CSTRING
*responses,
int
size);
60
61
#ifdef __cplusplus
62
}
63
#endif
64
65
#endif
globalplatform.h
OPGP_CARD_CONTEXT
Definition:
connection.h:69
OPGP_CARD_INFO
Definition:
connection.h:80
OPGP_ERROR_STATUS
Definition:
error.h:45
PBYTE
unsigned char * PBYTE
A Microsoft/Muscle LPBYTE, pointer to unsigned char.
Definition:
types.h:48
PDWORD
unsigned long * PDWORD
A Microsoft LPDWORD/Muscle pointer to a DWORD.
Definition:
types.h:50
DWORD
unsigned long DWORD
A Microsoft/Muscle DWORD definition.
Definition:
types.h:52
OPGP_CSTRING
const char * OPGP_CSTRING
A Microsoft/Muscle LPCTSTR.
Definition:
types.h:47
Generated by
1.9.1