checked-in too much, undo; refs #10

master
Marc Wäckerlin 13 years ago
parent 6d344928da
commit 83e4bcbc65
  1. 8
      install-64-and-32-bit-linux.sh
  2. 20
      src/cryptoki.cxx
  3. 5
      src/cryptoki.hxx
  4. 2
      src/pcsc.hxx

@ -1,8 +1,7 @@
touch iostream && \
./bootstrap.sh && \
LDFLAGS="-L/usr/lib32 -L/usr/local/lib32 -m32" \
CXXFLAGS="-m32" \
CPPFLAGS="-include iostream -DCRYPTOKI_LOG\(X\)='std::clog<<"'"CRYPTOKI_"'"<<X<<"'"_@_"'"<<__PRETTY_FUNCTION__<<std::endl' -DPCSC_LOG\(X\)='std::clog<<"'"PCSC_"'"<<X<<"'"_@_"'"<<__PRETTY_FUNCTION__<<std::endl' -DOPENSSL_LOG\(X\)='std::clog<<"'"OPENSSL_"'"<<X<<"'"_@_"'"<<__PRETTY_FUNCTION__<<std::endl'" \
CPPFLAGS="-DCRYPTOKI_LOG\(X\)='std::clog<<X<<"'"@"'"<<__PRETTY_FUNCTION__<<std::endl'" \
./configure \
--libdir=/usr/local/lib32 \
--build=x86_64 \
@ -19,9 +18,6 @@ LDFLAGS="-L/opt/local/i586-mingw32msvc/lib" \
make && \
sudo make install && \
make clean && \
CPPFLAGS="-include iostream -DCRYPTOKI_LOG\(X\)='std::clog<<"'"CRYPTOKI_"'"<<X<<"'"_@_"'"<<__PRETTY_FUNCTION__<<std::endl' -DPCSC_LOG\(X\)='std::clog<<"'"PCSC_"'"<<X<<"'"_@_"'"<<__PRETTY_FUNCTION__<<std::endl' -DOPENSSL_LOG\(X\)='std::clog<<"'"OPENSSL_"'"<<X<<"'"_@_"'"<<__PRETTY_FUNCTION__<<std::endl'" \
./configure && \
make check && \
sudo make install && \
rm iostream
sudo make install

@ -203,22 +203,16 @@ namespace cryptoki {
CRYPTOKI_LOG("log");
SlotList res;
CK_ULONG count(0);
std::cout<<"CALL: C_GetSlotList"<<std::endl;
//! calls @c C_GetSlotList
check(_fn->C_GetSlotList(tokenPresent?TRUE:FALSE, 0, &count),
CRYPTOKI_FN_LOG("C_GetSlotList"));
std::cout<<"C_GetSlotList returns "<<count<<" slots"<<std::endl;
if (!count || !*this) return res;
CK_SLOT_ID* slots = 0;
try {
do {
delete[] slots;
slots = new CK_SLOT_ID[count];
std::cout<<"CALL: C_GetSlotList to get IDs"<<std::endl;
_res = _fn->C_GetSlotList(tokenPresent?TRUE:FALSE, slots, &count);
std::cout<<"C_GetSlotList returns "<<count<<" slots"<<std::endl;
if (_res==CKR_BUFFER_TOO_SMALL)
std::cout<<"Buffer too small - repeat"<<std::endl;
} while (_res==CKR_BUFFER_TOO_SMALL);
check(_res, CRYPTOKI_FN_LOG("C_GetSlotList"));
if (!*this) return res;
@ -300,6 +294,7 @@ namespace cryptoki {
attrs.push_back(Attribute(CKA_ISSUER, cert.issuerDER()));
attrs.push_back(Attribute(CKA_SERIAL_NUMBER, cert.serial()));
attrs.push_back(Attribute(CKA_VALUE, cert.valueDER()));
CRYPTOKI_LOG("create: serial = "<<crypto::hex(cert.serial()));
return create(attrs);
}
@ -344,19 +339,6 @@ namespace cryptoki {
attrs.push_back(Attribute(CKA_COEFFICIENT, key.coefficient()));
return create(attrs);
}
//----------------------------------------------------------------------------
Object Session::create(const std::string& application,
const std::string& label,
const std::string& data) {
AttributeList attrs;
attrs.push_back(Attribute(CKA_CLASS).from<CK_OBJECT_CLASS>(CKO_DATA));
attrs.push_back(Attribute(CKA_TOKEN).from<CK_BBOOL>(TRUE));
attrs.push_back(Attribute(CKA_APPLICATION, application));
attrs.push_back(Attribute(CKA_LABEL, label));
attrs.push_back(Attribute(CKA_VALUE, data));
return create(attrs);
}
//----------------------------------------------------------------------------
Object Session::create(const AttributeList& attrs) {

@ -257,7 +257,7 @@ namespace cryptoki {
case CKA_CLASS:
switch (*((CK_OBJECT_CLASS*)&value[0])) {
case CKO_DATA: return "DATA";
case CKO_CERTIFICATE: return "CERTIFICATE";
case CKO_CERTIFICATE: return "CERTIFICATE";
case CKO_PUBLIC_KEY: return "PUBLIC_KEY";
case CKO_PRIVATE_KEY: return "PRIVATE_KEY";
case CKO_SECRET_KEY: return "SECRET_KEY";
@ -976,9 +976,6 @@ namespace cryptoki {
//! Create a new PrivateKey Object.
Object create(const std::string& label, const openssl::PrivateKey& key,
const openssl::X509& cert);
//!
Object create(const std::string& application, const std::string& label,
const std::string& data);
//@}

@ -239,7 +239,7 @@ namespace pcsc {
Status status() {
DWORD dummy(0);
DWORD s;
DWORD len(10*(MAX_ATR_SIZE+33)); // 33 is default on Linux
DWORD len(MAX_ATR_SIZE);
unsigned char a[len];
check(SCardStatus(_id, 0, &dummy, &s, &_protocol, a, &len),
"query smartcard status");

Loading…
Cancel
Save