/*************************************************************************** smartCard.cpp - description ------------------- begin : vie sep 24 2004 copyright : (C) 2004 by Antonio Araujo, Victor Bravo Jorge Redondo email : antonioaraujo@funmrd.gov.ve victorb@funmrd.gov.ve redondo@funmrd.gov.ve ***************************************************************************/ /*************************************************************************** * * * This program 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 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "smartCardFunc.h" // convierte el formato biginteger_t PKCS#11 a BIGNUM OpenSSL // "to" deberia ser la direccion de un puntero inicializado en NULL para // recibir el BIGNUM. por ejemplo: // biginteger_t from; // BIGNUM *foo = NULL; // cvt_bigint2bn(&from, &foo); //static int cvt_bigint2bn(biginteger_t *from, BIGNUM **to) { BIGNUM *temp = NULL; printf("\n"); printf("inside cvt_bigint2bn\n"); int i; printf("modulus: "); for (i=0; i < (int)from->big_value_len; i++) { printf("%02X ", from->big_value[i]); } printf("\n"); if (from == NULL || to == NULL) return (-1); printf("\ncalling BN_bin2bn\n"); temp = BN_bin2bn((const unsigned char *)from->big_value, (int)from->big_value_len, *to); //printf("verifica if (temp == NULL)\n"); if (temp == NULL) { printf("temp == NULL\n"); return (-1); } *to = temp; return (0); } // funcion para copiar una plantilla de atributos a un biginteger_t void copy_attr_to_bigint(CK_ATTRIBUTE_PTR attr, biginteger_t *big) { printf("copy_attr_to_bigint\n"); big->big_value = (CK_BYTE *) attr->pValue; printf("big->big_value = (CK_BYTE *) attr->pValue\n"); big->big_value_len = (CK_ULONG) attr->ulValueLen; printf("big->big_value_len = (CK_ULONG) attr->ulValueLen\n"); }