compiled on mac

master
Marc Wäckerlin 15 years ago
parent e8d763cf89
commit 9f09371c4b
  1. 2
      COPYING
  2. 2
      INSTALL
  3. 3
      src/cryptoki.cxx
  4. 8
      src/cryptoki.hxx
  5. 7
      src/openssl.hxx

@ -1 +1 @@
/usr/share/automake-1.11/COPYING /opt/local/share/automake-1.11/COPYING

@ -1 +1 @@
/usr/share/automake-1.11/INSTALL /opt/local/share/automake-1.11/INSTALL

@ -21,9 +21,6 @@ typedef CK_RV (*CK_C_GetFunctionList)
#undef ERROR #undef ERROR
#endif #endif
// no logging
#define CRYPTOKI_LOG(X)
namespace cryptoki { namespace cryptoki {
bool Init::functionList(const std::string& library) { bool Init::functionList(const std::string& library) {

@ -992,6 +992,10 @@ namespace cryptoki {
friend class Login; friend class Login;
friend class Object; friend class Object;
CK_FUNCTION_LIST* fn() {
return _slot._init->_fn;
}
Slot& _slot; Slot& _slot;
CK_SESSION_HANDLE _session; CK_SESSION_HANDLE _session;
CK_RV _res; CK_RV _res;
@ -1268,7 +1272,7 @@ namespace cryptoki {
CK_USER_TYPE userType=CKU_USER): _session(session) { CK_USER_TYPE userType=CKU_USER): _session(session) {
CRYPTOKI_LOG("log"); CRYPTOKI_LOG("log");
//! calls @c C_Login //! calls @c C_Login
_session.check(_session._slot._init->_fn->C_Login _session.check(_session.fn()->C_Login
(_session._session, userType, (_session._session, userType,
(CK_CHAR*)pin.c_str(), (CK_CHAR*)pin.c_str(),
pin.size()), pin.size()),
@ -1278,7 +1282,7 @@ namespace cryptoki {
~Login() { ~Login() {
try { try {
//! calls @c C_Logout //! calls @c C_Logout
_session.check(_session._slot._init->_fn->C_Logout _session.check(_session.fn()->C_Logout
(_session._session), (_session._session),
CRYPTOKI_FN_LOG("C_Logout")); CRYPTOKI_FN_LOG("C_Logout"));
} catch (...) { } catch (...) {

@ -697,7 +697,7 @@ namespace openssl {
rsa(o); rsa(o);
dsa(o); dsa(o);
dh(o); dh(o);
ec(o); /*ec(o);*/
} }
std::string string(BIGNUM* a) const { std::string string(BIGNUM* a) const {
std::string res(BN_num_bytes(a), '0'); std::string res(BN_num_bytes(a), '0');
@ -717,10 +717,12 @@ namespace openssl {
DH* tmp(o.dh()); DH* tmp(o.dh());
if (tmp&&!EVP_PKEY_set1_DH(_key, tmp)) throw key_copy_failed(); if (tmp&&!EVP_PKEY_set1_DH(_key, tmp)) throw key_copy_failed();
} }
/* Not available on mac osx
void ec(const PrivateKey& o) { void ec(const PrivateKey& o) {
EC_KEY* tmp(o.ec()); EC_KEY* tmp(o.ec());
if (tmp&&!EVP_PKEY_set1_EC_KEY(_key, tmp)) throw key_copy_failed(); if (tmp&&!EVP_PKEY_set1_EC_KEY(_key, tmp)) throw key_copy_failed();
} }
*/
RSA* rsa() const { RSA* rsa() const {
//! @todo throw exception if 0? //! @todo throw exception if 0?
return EVP_PKEY_get1_RSA(_key); return EVP_PKEY_get1_RSA(_key);
@ -731,9 +733,10 @@ namespace openssl {
DH* dh() const { DH* dh() const {
return EVP_PKEY_get1_DH(_key); return EVP_PKEY_get1_DH(_key);
} }
/* Not available on mac osx
EC_KEY* ec() const { EC_KEY* ec() const {
return EVP_PKEY_get1_EC_KEY(_key); return EVP_PKEY_get1_EC_KEY(_key);
} }*/
EVP_PKEY* _key; EVP_PKEY* _key;
}; };

Loading…
Cancel
Save