From f304fed517659d4c7e853294a975e63f8834415e Mon Sep 17 00:00:00 2001 From: vtarasov Date: Sun, 9 Jan 2011 09:13:47 +0000 Subject: [PATCH] libopensc: add 'crts' array to 'struct sc_acl_entry' ... For some cards the acl bytes, retrived from 'select' response, can reference a SE (and not directly PIN). In such case, to proceed an authentication for the card operation the information about the SE's CRTs is needed. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5066 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/libopensc/sc.c | 6 +++--- src/libopensc/types.h | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libopensc/sc.c b/src/libopensc/sc.c index 3baddacc..9393f336 100644 --- a/src/libopensc/sc.c +++ b/src/libopensc/sc.c @@ -395,13 +395,13 @@ const sc_acl_entry_t * sc_file_get_acl_entry(const sc_file_t *file, { sc_acl_entry_t *p; static const sc_acl_entry_t e_never = { - SC_AC_NEVER, SC_AC_KEY_REF_NONE, NULL + SC_AC_NEVER, SC_AC_KEY_REF_NONE, {}, NULL }; static const sc_acl_entry_t e_none = { - SC_AC_NONE, SC_AC_KEY_REF_NONE, NULL + SC_AC_NONE, SC_AC_KEY_REF_NONE, {}, NULL }; static const sc_acl_entry_t e_unknown = { - SC_AC_UNKNOWN, SC_AC_KEY_REF_NONE, NULL + SC_AC_UNKNOWN, SC_AC_KEY_REF_NONE, {}, NULL }; assert(file != NULL); diff --git a/src/libopensc/types.h b/src/libopensc/types.h index 13eaaf3a..c2b6a50d 100644 --- a/src/libopensc/types.h +++ b/src/libopensc/types.h @@ -39,8 +39,8 @@ typedef unsigned char u8; #define SC_MAX_OBJECT_ID_OCTETS 16 #define SC_MAX_PATH_SIZE 16 #define SC_MAX_PATH_STRING_SIZE (SC_MAX_PATH_SIZE * 2 + 1) - #define SC_MAX_SDO_ACLS 8 +#define SC_MAX_CRTS_IN_SE 12 /* When changing this value, pay attention to the initialization of the ASN1 * static variables that use this macro, like, for example, @@ -97,6 +97,13 @@ typedef struct sc_path { struct sc_aid aid; } sc_path_t; +/* Control reference template */ +struct sc_crt { + unsigned tag; + unsigned usage; /* Usage Qualifier Byte */ + unsigned algo; /* Algorithm ID */ + unsigned refs[8]; /* Security Object References */ +}; /* Access Control flags */ #define SC_AC_NONE 0x00000000 @@ -149,10 +156,13 @@ typedef struct sc_path { #define SC_AC_KEY_REF_NONE 0xFFFFFFFF + typedef struct sc_acl_entry { unsigned int method; /* See SC_AC_* */ unsigned int key_ref; /* SC_AC_KEY_REF_NONE or an integer */ + struct sc_crt crts[SC_MAX_CRTS_IN_SE]; + struct sc_acl_entry *next; } sc_acl_entry_t;