<commit_before>/*
 * card-oberthur.c: Support for Oberthur smart cards 
 *		CosmopolIC  v5; 
 *
 * Copyright (C) 2001, 2002  <NAME> <<EMAIL>>
 * Copyright (C) 2003  <NAME> <<EMAIL>>, idealx <www.idealx.com>
 *
 * 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
 *
 * best view with tabstop=4
 */

#include "internal.h"
#include "cardctl.h"
#include "pkcs15.h"
#ifdef HAVE_OPENSSL

#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#include <openssl/des.h>
#include <openssl/opensslv.h>

#include "log.h"
#include "pkcs15.h"

#include "card-oberthur.h"

/* keep OpenSSL 0.9.6 users happy ;-) */
#if OPENSSL_VERSION_NUMBER < 0x00907000L
#define DES_cblock			des_cblock
#define DES_key_schedule		des_key_schedule
#define DES_set_key_unchecked(a,b)	des_set_key_unchecked(a,*b)
#define DES_ecb_encrypt(a,b,c,d) 	des_ecb_encrypt(a,b,*c,d)
#endif

NTLV_t oberthur_atrs[] = {
	/* not jet supported
	 * { "Oberthur 32k", ATR_OBERTHUR_32K, 20,
	 * "\x3B\x7F\x18\x00\x00\x00\x31\xC0\x73\x9E\x01\x0B\x64\x52\xD9\x04\x00\x82\x90\x00"
	 * },
	 * { "Oberthur 32k BIO", ATR_OBERTHUR_32K_BIO, 20,
	 *  "\x3B\x7F\x18\x00\x00\x00\x31\xC0\x73\x9E\x01\x0B\x64\x52\xD9\x05\x00\x82\x90\x00"
	 * }, */
	{ "Oberthur 64k v4/2.1.1", ATR_OBERTHUR_64K, 18,
	  "\x3B\x7D\x18\x00\x00\x00\x31\x80\x71\x8E\x64\x77\xE3\x01\x00\x82\x90\x00"
	},
	{ "Oberthur 64k v5", ATR_OBERTHUR_64K, 18,
	  "\x3B\x7D\x11\x00\x00\x00\x31\x80\x71\x8E\x64\x77\xE3\x01\x00\x82\x90\x00"
	},
	{ "Oberthur 64k v5/2.2.0", ATR_OBERTHUR_64K, 18,
	  "\x3B\x7D\x11\x00\x00\x00\x31\x80\x71\x8E\x64\x77\xE3\x02\x00\x82\x90\x00"
	},
	{ NULL, 0, 0, NULL	}
};


NTLV_t oberthur_aids[] = {
/*
	{ "AuthentIC v2", AID_OBERTHUR_V2, 14,
	  "\xA0\x00\x00\x00\x77\x58\x35\x30\x39\x23\x56\x32\x2E\x30"<commit_msg>one more ATR for Oberthur 64K card patch supplied by <NAME> <<EMAIL>><commit_after>/*
 * card-oberthur.c: Support for Oberthur smart cards 
 *		CosmopolIC  v5; 
 *
 * Copyright (C) 2001, 2002  <NAME> <<EMAIL>>
 * Copyright (C) 2003  <NAME> <<EMAIL>>, idealx <www.idealx.com>
 *
 * 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
 *
 * best view with tabstop=4
 */

#include "internal.h"
#include "cardctl.h"
#include "pkcs15.h"
#ifdef HAVE_OPENSSL

#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#include <openssl/des.h>
#include <openssl/opensslv.h>

#include "log.h"
#include "pkcs15.h"

#include "card-oberthur.h"

/* keep OpenSSL 0.9.6 users happy ;-) */
#if OPENSSL_VERSION_NUMBER < 0x00907000L
#define DES_cblock			des_cblock
#define DES_key_schedule		des_key_schedule
#define DES_set_key_unchecked(a,b)	des_set_key_unchecked(a,*b)
#define DES_ecb_encrypt(a,b,c,d) 	des_ecb_encrypt(a,b,*c,d)
#endif

NTLV_t oberthur_atrs[] = {
	/* not jet supported
	 * { "Oberthur 32k", ATR_OBERTHUR_32K, 20,
	 * "\x3B\x7F\x18\x00\x00\x00\x31\xC0\x73\x9E\x01\x0B\x64\x52\xD9\x04\x00\x82\x90\x00"
	 * },
	 * { "Oberthur 32k BIO", ATR_OBERTHUR_32K_BIO, 20,
	 *  "\x3B\x7F\x18\x00\x00\x00\x31\xC0\x73\x9E\x01\x0B\x64\x52\xD9\x05\x00\x82\x90\x00"
	 * }, */
	{ "Oberthur 64k v4/2.1.1", ATR_OBERTHUR_64K, 18,
	  "\x3B\x7D\x18\x00\x00\x00\x31\x80\x71\x8E\x64\x77\xE3\x01\x00\x82\x90\x00"
	},
	{ "Oberthur 64k v4/2.1.1", ATR_OBERTHUR_64K, 18,
	  "\x3B\x7D\x18\x00\x00\x00\x31\x80\x71\x8E\x64\x77\xE3\x02\x00\x82\x90\x00"
	},
	{ "Oberthur 64k v5", ATR_OBERTHUR_64K, 18,
	  "\x3B\x7D\x11\x00\x00\x00\x31\x80\x71\x8E\x64\x77\xE3\x01\x00\x82\x90\x00"
	},
	{ "Oberthur 64k v5/2.2.0", ATR_OBERTHUR_64K, 18,
	  "\x3B\x7D\x11\x00\x00\x00\x31\x80\x71\x8E\x64\x77\xE3\x02\x00\x82\x90\x00"
	},
	{ NULL, 0, 0, NULL	}
};


NTLV_t oberthur_aids[] = {
/*
	{ "AuthentIC v2", AID_OBERTHUR_V2, 14,
	  "\xA0\x00\x00\x00\x77\x58\x35\x30\x39\x23\x56\x32\x2E\x30"
{'fraction_non_alphanumeric': 0.1485951721408785, 'fraction_numerical': 0.11990502572220024, 'mean_word_length': 3.7331460674157304, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6318874', 'n_tokens_mistral': 2668, 'n_tokens_neox': 2311, 'n_words': 480}