pamlibdir = @pamlibdir@
noinst_HEADERS = pcsc_cr.h token.h
+noinst_PROGRAMS = test_cr
+test_cr_DEPENDENCIES = pam_pcsc_cr.la
lib_LTLIBRARIES = pam_pcsc_cr.la
EXTRA_pam_pcsc_cr_la_SOURCES = ossl_crypto.c tom_prypto.c
AM_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG
-PKG_CHECK_MODULES([PCSC], [pcsclite])
-AC_ARG_WITH(pcsc-include-path,
- [ --with-pcsc-include-path=PATH path to pcsclite includes],
+PKG_CHECK_MODULES([PCSC], [libpcsclite])
+AC_ARG_WITH(pcsclite-include-path,
+ [ --with-pcsclite-include-path=PATH path to pcsclite includes],
[PCSC_CFLAGS="-I $withval"],
[])
-AC_ARG_WITH(pcsc-lib-path,
- [ --with-pcsc-lib-path=PATH path to pcsclite libs],
+AC_ARG_WITH(pcsclite-lib-path,
+ [ --with-pcsclite-lib-path=PATH path to pcsclite libs],
[PCSC_LIBS="-L $withval -lpcsclite"],
[])
AC_SUBST(PCSC_LIBS)
AC_SUBST(PCSC_CFLAGS)
+CFLAGS="$PCSC_CFLAGS $CFLAGS"
+LIBS="$PCSC_LIBS $LIBS"
+
+AC_SUBST(CRYPTO_OBJS)
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
-AC_CHECK_LIB(libpcsclite, SCardEstablishContext)
-if test x$ac_cv_lib_SCardEstablishContext != xyes; then
- AC_MSG_ERROR([Cannot find usable libpcsclite])
-fi
+AC_CHECK_HEADERS([winscard.h reader.h], [],
+ [AC_MSG_ERROR([[pcsclite headers not found]])])
+AC_CHECK_LIB([pcsclite], [SCardEstablishContext], [],
+ [AC_MSG_ERROR([[pcsclite library not useable]])])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
#include <openssl/evp.h>
#include <openssl/hmac.h>
-int main()
-{
- EVP_CIPHER_CTX ctx;
- unsigned char key[32] = {0};
- unsigned char iv[16] = {0};
- unsigned char in[16] = {0};
- unsigned char out[32]; /* at least one block longer than in[] */
- int outlen1, outlen2;
-
- EVP_EncryptInit(&ctx, EVP_aes_256_cbc(), key, iv);
- EVP_EncryptUpdate(&ctx, out, &outlen1, in, sizeof(in));
- EVP_EncryptFinal(&ctx, out + outlen1, &outlen2);
-
- printf("ciphertext length: %d\n", outlen1 + outlen2);
-
- return 0;
-}
+//int main()
+//{
+// EVP_CIPHER_CTX ctx;
+// unsigned char key[32] = {0};
+// unsigned char iv[16] = {0};
+// unsigned char in[16] = {0};
+// unsigned char out[32]; /* at least one block longer than in[] */
+// int outlen1, outlen2;
+//
+// EVP_EncryptInit(&ctx, EVP_aes_256_cbc(), key, iv);
+// EVP_EncryptUpdate(&ctx, out, &outlen1, in, sizeof(in));
+// EVP_EncryptFinal(&ctx, out + outlen1, &outlen2);
+//
+// printf("ciphertext length: %d\n", outlen1 + outlen2);
+//
+// return 0;
+//}
// result = HMAC(EVP_sha256(), key, 999, data, 888, NULL, NULL);
// EVP_MD *
SCARD_IO_REQUEST pioSendPci;
-static LONG find_hb(LPTSTR atr, DWORD atrsize, LPTSTR *hb, LPDWORD hbsize)
+static LONG find_hb(BYTE *atr, DWORD atrsize, BYTE **hb, LPDWORD hbsize)
{
int i, j, cont;
if (atrsize < 2) return SCARD_W_UNSUPPORTED_CARD;
DWORD nrdrs = SCARD_AUTOALLOCATE, activeproto;
BYTE atr[33];
DWORD atrsize;
- LPTSTR hb;
+ BYTE *hb;
DWORD hbsize;
DWORD lrsize;
int i;
#include <string.h>
#include "pcsc_cr.h"
-char chal[] = {
+unsigned char chal[] = {
0x0f,0x65,0xd1,0x3a,0xfe,0xcb,0xc4,0xb9,0x52,0xb1,0x60,0xcf,0xe8,0x55,0x6a,0xdd,0xfb,0xef,0xf6,0x55,0x83,0x4c,0x8d,0xea,0x38,0xea,0x3b,0x26,0xf7,0x0a,0xe8,0x0d,0x31,0x38,0xee,0x16,0x5d,0xab,0x8b,0x7f,0xf0,0x1b,0xe3,0xbe,0xd8,0x4b,0x6e,0x44,0x42,0x8d,0x0f,0xc1,0x3b,0x23,0xea,0xfe,0xc0,0x68,0xc1,0x0f,0x60,0x6c,0xf4};
static void usage(const char const *cmd)
struct token_interface {
char *name;
int (*parse_option)(char *key, char *val);
- DWORD (*check_atr_hb)(LPTSTR str, DWORD size);
+ DWORD (*check_atr_hb)(BYTE *str, DWORD size);
DWORD (*prologue)(SCARDHANDLE hCard,LPTSTR envp[]);
DWORD (*trancieve)(SCARDHANDLE hCard,LPTSTR envp[],
- LPTSTR send, DWORD sendsize, LPTSTR recv, LPDWORD recvsize_p);
+ LPTSTR send, DWORD sendsize, BYTE *recv, LPDWORD recvsize_p);
DWORD (*epilogue)(SCARDHANDLE hCard,LPTSTR envp[]);
};
return 0;
}
-static DWORD ykn_check_atr_hb(LPTSTR str, DWORD size)
+static DWORD ykn_check_atr_hb(BYTE *str, DWORD size)
{
if (size < strlen(NAMEPFX)) return SCARD_W_UNSUPPORTED_CARD;
if (memcmp(str, NAMEPFX, strlen(NAMEPFX)))
}
static DWORD ykn_trancieve(SCARDHANDLE hCard,LPTSTR envp[],
- LPTSTR send, DWORD sendsize, LPTSTR recv, LPDWORD recvsize_p)
+ LPTSTR send, DWORD sendsize, BYTE *recv, LPDWORD recvsize_p)
{
DWORD rc;
DWORD rsize = *recvsize_p + 2;