added header file for pace library functions
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@76 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -10,7 +10,6 @@ bindir = $(exec_prefix)/bin
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -Wall -g
|
CFLAGS = -Wall -g
|
||||||
EXTRA_CFLAGS = -DNO_PACE
|
EXTRA_CFLAGS = -DNO_PACE
|
||||||
#LIBPCSCLITE_CFLAGS = `pkg-config --cflags --libs libpcsclite`
|
|
||||||
OPENSSL_CFLAGS = `pkg-config --cflags --libs libssl`
|
OPENSSL_CFLAGS = `pkg-config --cflags --libs libssl`
|
||||||
OPENSC_CFLAGS = `pkg-config --cflags --libs libopensc`
|
OPENSC_CFLAGS = `pkg-config --cflags --libs libopensc`
|
||||||
PTHREAD_CFLAGS = -pthread
|
PTHREAD_CFLAGS = -pthread
|
||||||
@@ -23,7 +22,8 @@ TARGETS = ccid
|
|||||||
|
|
||||||
CCID_SRC = ccid.h ccid.c \
|
CCID_SRC = ccid.h ccid.c \
|
||||||
sm.c sm.h \
|
sm.c sm.h \
|
||||||
pace.h pace.c pace_lib.c \
|
pace.h pace.c \
|
||||||
|
pace_lib.c pace_lib.h \
|
||||||
usbstring.c usbstring.h usb.c
|
usbstring.c usbstring.h usb.c
|
||||||
|
|
||||||
# top-level rule
|
# top-level rule
|
||||||
@@ -31,7 +31,7 @@ all: $(TARGETS)
|
|||||||
|
|
||||||
|
|
||||||
ccid: $(CCID_SRC)
|
ccid: $(CCID_SRC)
|
||||||
$(CC) $(LIBPCSCLITE_CFLAGS) $(OPENSC_CFLAGS) $(OPENSSL_CFLAGS) \
|
$(CC) $(OPENSC_CFLAGS) $(OPENSSL_CFLAGS) \
|
||||||
$(PTHREAD_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) \
|
$(PTHREAD_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) \
|
||||||
$(filter %.c, $(CCID_SRC)) -o $@
|
$(filter %.c, $(CCID_SRC)) -o $@
|
||||||
|
|
||||||
|
|||||||
19
ccid/pace.h
19
ccid/pace.h
@@ -19,11 +19,12 @@
|
|||||||
#ifndef _CCID_PACE_H
|
#ifndef _CCID_PACE_H
|
||||||
#define _CCID_PACE_H
|
#define _CCID_PACE_H
|
||||||
|
|
||||||
|
#include "pace_lib.h"
|
||||||
#include "sm.h"
|
#include "sm.h"
|
||||||
#include <linux/usb/ch9.h>
|
#include <linux/usb/ch9.h>
|
||||||
#include <opensc/opensc.h>
|
#include <opensc/opensc.h>
|
||||||
#include <openssl/pace.h>
|
|
||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
|
#include <openssl/pace.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -42,22 +43,6 @@ extern "C" {
|
|||||||
|
|
||||||
#define MAX_EF_CARDACCESS 2048
|
#define MAX_EF_CARDACCESS 2048
|
||||||
|
|
||||||
struct pace_sm_ctx {
|
|
||||||
/* XXX SSC is up to 16 Bytes long, not only 16 Bits */
|
|
||||||
BIGNUM *ssc;
|
|
||||||
const BUF_MEM *key_mac;
|
|
||||||
const BUF_MEM *key_enc;
|
|
||||||
PACE_CTX *ctx;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct pace_sm_ctx *
|
|
||||||
pace_sm_ctx_create(const BUF_MEM *key_mac,
|
|
||||||
const BUF_MEM *key_enc, PACE_CTX *ctx);
|
|
||||||
void
|
|
||||||
pace_sm_ctx_free(struct pace_sm_ctx *ctx);
|
|
||||||
void
|
|
||||||
pace_sm_ctx_clear_free(struct pace_sm_ctx *ctx);
|
|
||||||
|
|
||||||
int increment_ssc(struct pace_sm_ctx *psmctx);
|
int increment_ssc(struct pace_sm_ctx *psmctx);
|
||||||
int decrement_ssc(struct pace_sm_ctx *psmctx);
|
int decrement_ssc(struct pace_sm_ctx *psmctx);
|
||||||
int reset_ssc(struct pace_sm_ctx *psmctx);
|
int reset_ssc(struct pace_sm_ctx *psmctx);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* ccid. If not, see <http://www.gnu.org/licenses/>.
|
* ccid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "pace.h"
|
#include "pace_lib.h"
|
||||||
#include <openssl/buffer.h>
|
#include <openssl/buffer.h>
|
||||||
#include <openssl/pace.h>
|
#include <openssl/pace.h>
|
||||||
|
|
||||||
|
|||||||
44
ccid/pace_lib.h
Normal file
44
ccid/pace_lib.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010 Frank Morgner
|
||||||
|
*
|
||||||
|
* This file is part of ccid.
|
||||||
|
*
|
||||||
|
* ccid is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU General Public License as published by the Free Software
|
||||||
|
* Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* ccid is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* ccid. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef _CCID_PACE_LIB_H
|
||||||
|
#define _CCID_PACE_LIB_H
|
||||||
|
|
||||||
|
#include <openssl/pace.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct pace_sm_ctx {
|
||||||
|
BIGNUM *ssc;
|
||||||
|
const BUF_MEM *key_mac;
|
||||||
|
const BUF_MEM *key_enc;
|
||||||
|
PACE_CTX *ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct pace_sm_ctx * pace_sm_ctx_create(const BUF_MEM *key_mac,
|
||||||
|
const BUF_MEM *key_enc, PACE_CTX *ctx);
|
||||||
|
void pace_sm_ctx_free(struct pace_sm_ctx *ctx);
|
||||||
|
void pace_sm_ctx_clear_free(struct pace_sm_ctx *ctx);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user