File: lib

package info (click to toggle)
globalplatform 2.4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,596 kB
  • sloc: ansic: 13,384; xml: 244; sh: 87; java: 19; makefile: 10
file content (79 lines) | stat: -rwxr-xr-x 1,947 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh

set -e

# setup pcscd with NO polkit control to avoid " Access denied." errors
echo "PCSCD_ARGS=--disable-polkit" | sudo tee /etc/default/pcscd
sudo systemctl restart pcscd.service

dir=`dirname "$0"`

# change directory to $AUTOPKGTEST_TMP if available
cd "${AUTOPKGTEST_TMP:-.}"

cleanup() {
  ex=$?
  rm -f testglobalplatform.c testglobalplatform.bin
  exit "${ex}"
}
trap "cleanup" EXIT TERM INT

CC="cc -O"
LIBDIR="/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`"

cat<<EOF > testglobalplatform.c
#include <string.h>
#include <stdio.h>
#include <globalplatform/globalplatform.h>

int main ()
{
  OPGP_ERROR_STATUS status;
  OPGP_CARD_CONTEXT cardContext;

  memset (&cardContext, 0, sizeof cardContext);

  status = OPGP_establish_context(&cardContext);
  if (!OPGP_ERROR_CHECK(status))
    {
      printf ("establish_context unexpected error 0x%08X (%s)\n",
              (unsigned int)status.errorCode,
              status.errorMessage);
      return 1;
    }

  strcpy (cardContext.libraryName, "gppcscconnectionplugin");

  status = OPGP_establish_context(&cardContext);
  if (OPGP_ERROR_CHECK(status))
    {
      printf ("establish_context error 0x%08X (%s)\n",
              (unsigned int)status.errorCode,
              status.errorMessage);
      return 1;
    }

  status = OPGP_release_context(&cardContext);
  if (OPGP_ERROR_CHECK(status))
    {
      printf ("establish_context error 0x%08X (%s)\n",
              (unsigned int)status.errorCode,
              status.errorMessage);
      return 1;
    }

  return 0;
}
EOF

CMD="${CC} -o testglobalplatform.bin testglobalplatform.c ${LIBDIR}/libglobalplatform.a $(pkg-config --cflags globalplatform) -lcrypto"
echo "libglobalplatform - static - $CMD"
$CMD
./testglobalplatform.bin

CMD="${CC} -o testglobalplatform.bin testglobalplatform.c $(pkg-config --cflags --libs globalplatform)"
echo "libglobalplatform - shared - $CMD"
$CMD
./testglobalplatform.bin

exit 0