2001-12-27 17:25:10 +00:00
|
|
|
|
/*
|
2002-04-05 10:44:51 +00:00
|
|
|
|
* internal.h: Internal definitions for libopensc
|
2001-12-27 17:25:10 +00:00
|
|
|
|
*
|
2002-04-05 14:46:44 +00:00
|
|
|
|
* Copyright (C) 2001, 2002 Juha Yrj<EFBFBD>l<EFBFBD> <juha.yrjola@iki.fi>
|
2001-12-27 17:25:10 +00:00
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library 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
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*/
|
|
|
|
|
|
2001-12-30 21:17:34 +00:00
|
|
|
|
#ifndef _SC_INTERNAL_H
|
|
|
|
|
#define _SC_INTERNAL_H
|
2001-12-27 17:25:10 +00:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2005-02-02 10:21:10 +00:00
|
|
|
|
#ifdef __cplusplus
|
2002-04-19 14:23:31 +00:00
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-12-27 17:25:10 +00:00
|
|
|
|
#include "opensc.h"
|
2003-09-03 09:28:55 +00:00
|
|
|
|
#include "log.h"
|
2003-10-22 18:16:21 +00:00
|
|
|
|
#include "ui.h"
|
2002-03-24 14:12:38 +00:00
|
|
|
|
#include <assert.h>
|
2001-12-27 17:25:10 +00:00
|
|
|
|
|
|
|
|
|
#define SC_FILE_MAGIC 0x14426950
|
|
|
|
|
#define SC_CARD_MAGIC 0x27182818
|
2002-03-24 14:12:38 +00:00
|
|
|
|
#define SC_CTX_MAGIC 0x0A550335
|
2001-12-27 17:25:10 +00:00
|
|
|
|
|
2002-03-01 11:52:55 +00:00
|
|
|
|
struct sc_atr_table {
|
2005-02-09 14:05:19 +00:00
|
|
|
|
const char *atr; /* The atr fields are required to
|
|
|
|
|
be in aa:bb:cc hex format. */
|
|
|
|
|
const char *atrmask; /* The atrmask is logically AND'd with an
|
|
|
|
|
card atr prior to comparison with the
|
|
|
|
|
atr reference value above. */
|
2005-02-04 15:57:38 +00:00
|
|
|
|
const char *name;
|
|
|
|
|
int id;
|
2005-02-06 19:40:40 +00:00
|
|
|
|
unsigned long flags;
|
2005-02-04 15:57:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
2001-12-27 17:25:10 +00:00
|
|
|
|
/* Internal use only */
|
2002-02-15 23:17:58 +00:00
|
|
|
|
int sc_check_sw(struct sc_card *card, int sw1, int sw2);
|
2002-03-01 11:52:55 +00:00
|
|
|
|
size_t _sc_count_bit_string_size(const void * buf, size_t bufsize);
|
2002-03-08 05:59:57 +00:00
|
|
|
|
|
2002-02-24 19:32:14 +00:00
|
|
|
|
int _sc_add_reader(struct sc_context *ctx, struct sc_reader *reader);
|
2002-03-26 11:38:40 +00:00
|
|
|
|
int _sc_parse_atr(struct sc_context *ctx, struct sc_slot_info *slot);
|
2002-02-24 19:32:14 +00:00
|
|
|
|
struct sc_slot_info * _sc_get_slot_info(struct sc_reader *reader, int slot_id);
|
2002-01-05 19:01:55 +00:00
|
|
|
|
|
2002-12-03 15:40:40 +00:00
|
|
|
|
/* Add an ATR to the card driver's struct sc_atr_table */
|
2005-02-06 19:40:40 +00:00
|
|
|
|
int _sc_add_atr(struct sc_context *ctx, struct sc_card_driver *driver, struct sc_atr_table *src);
|
2002-12-03 15:40:40 +00:00
|
|
|
|
|
2002-03-08 05:59:57 +00:00
|
|
|
|
/* Returns an index number if a match was found, -1 otherwise. table has to
|
|
|
|
|
* be null terminated. */
|
|
|
|
|
int _sc_match_atr(struct sc_card *card, struct sc_atr_table *table, int *id_out);
|
|
|
|
|
|
|
|
|
|
int _sc_card_add_algorithm(struct sc_card *card, const struct sc_algorithm_info *info);
|
|
|
|
|
int _sc_card_add_rsa_alg(struct sc_card *card, unsigned int key_length,
|
2002-03-10 11:48:57 +00:00
|
|
|
|
unsigned long flags, unsigned long exponent);
|
2002-03-08 05:59:57 +00:00
|
|
|
|
struct sc_algorithm_info * _sc_card_find_rsa_alg(struct sc_card *card,
|
|
|
|
|
unsigned int key_length);
|
|
|
|
|
|
2002-08-21 10:02:55 +00:00
|
|
|
|
int sc_asn1_read_tag(const u8 ** buf, size_t buflen, unsigned int *cla_out,
|
|
|
|
|
unsigned int *tag_out, size_t *taglen);
|
|
|
|
|
|
2005-02-02 10:21:10 +00:00
|
|
|
|
#ifdef __cplusplus
|
2002-04-19 14:23:31 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-12-27 17:25:10 +00:00
|
|
|
|
#endif
|