@ -830,6 +830,10 @@ namespace cryptoki {
//@}
Library & library ( ) {
return _library ;
}
MechanismInfo mechanisminfo ( CK_MECHANISM_TYPE mechanism ) {
CRYPTOLOG ( " log " ) ;
MechanismInfo info ( mechanism ) ;
@ -962,7 +966,7 @@ namespace cryptoki {
bool check ( CK_RV result , const std : : string & context = " " ) {
_res = result ;
if ( _slot . _ library. exc ( ) & & ! * this ) {
if ( _slot . library ( ) . exc ( ) & & ! * this ) {
if ( ! context . empty ( ) ) {
throw access_error ( context + " : " + error ( ) ) ;
} else {
@ -976,7 +980,7 @@ namespace cryptoki {
void open ( bool rw = false ) {
CRYPTOLOG ( " references: " < < slots ( ) . count ( _slot . _slot ) ) ;
if ( slots ( ) . count ( _slot . _slot ) = = 0 ) {
check ( _slot . _ library- > C_OpenSession
check ( _slot . library ( ) - > C_OpenSession
( _slot . _slot , CKF_SERIAL_SESSION | ( rw ? CKF_RW_SESSION : 0 ) ,
0 , 0 , & _session ) ,
CRYPTOKI_FN_LOG ( " C_OpenSession " ) ) ;
@ -991,7 +995,7 @@ namespace cryptoki {
CRYPTOLOG ( " references: " < < slots ( ) . count ( _slot . _slot ) ) ;
if ( slots ( ) . count ( _slot . _slot ) = = 1 ) {
slots ( ) . erase ( slots ( ) . find ( _slot . _slot ) ) ;
check ( _slot . _ library- > C_CloseSession ( _session ) ,
check ( _slot . library ( ) - > C_CloseSession ( _session ) ,
CRYPTOKI_FN_LOG ( " C_CloseSession " ) ) ;
} else {
slots ( ) . erase ( slots ( ) . find ( _slot . _slot ) ) ;
@ -1078,7 +1082,7 @@ namespace cryptoki {
/*! @return error text of last cryptoki call */
std : : string error ( ) {
return _slot . _ library. error ( _res ) ;
return _slot . library ( ) . error ( _res ) ;
}
//@}
@ -1092,7 +1096,7 @@ namespace cryptoki {
bool cancel ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_CancelFunction
return check ( _slot . _ library- > C_CancelFunction ( _session ) ,
return check ( _slot . library ( ) - > C_CancelFunction ( _session ) ,
CRYPTOKI_FN_LOG ( " C_CancelFunction " ) ) ;
}
@ -1105,7 +1109,7 @@ namespace cryptoki {
res . resize ( in . size ( ) ) ;
CK_ULONG size ( res . size ( ) ) ; //! @todo check if size is ok
//! calls @c C_Digest
check ( _slot . _ library- > C_Digest
check ( _slot . library ( ) - > C_Digest
( _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1120,7 +1124,7 @@ namespace cryptoki {
res . resize ( in . size ( ) ) ;
CK_ULONG size ( res . size ( ) ) ; //! @todo check if size is ok
//! calls @c C_DigestEncryptUpdate
check ( _slot . _ library- > C_DigestEncryptUpdate
check ( _slot . library ( ) - > C_DigestEncryptUpdate
( _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1134,7 +1138,7 @@ namespace cryptoki {
bool digestfinal ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_DigestFinal
return check ( _slot . _ library- > C_DigestFinal ( _session , CK_BYTE_PTR , CK_ULONG_PTR ) ,
return check ( _slot . library ( ) - > C_DigestFinal ( _session , CK_BYTE_PTR , CK_ULONG_PTR ) ,
CRYPTOKI_FN_LOG ( " C_DigestFinal " ) ) ;
}
@ endcode */
@ -1144,7 +1148,7 @@ namespace cryptoki {
bool digestinit ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_DigestInit
return check ( _slot . _ library- > C_DigestInit ( _session , CK_MECHANISM_PTR ) ,
return check ( _slot . library ( ) - > C_DigestInit ( _session , CK_MECHANISM_PTR ) ,
CRYPTOKI_FN_LOG ( " C_DigestInit " ) ) ;
}
@ endcode */
@ -1154,7 +1158,7 @@ namespace cryptoki {
bool digestupdate ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_DigestUpdate
return check ( _slot . _ library- > C_DigestUpdate ( _session , CK_BYTE_PTR , CK_ULONG ) ,
return check ( _slot . library ( ) - > C_DigestUpdate ( _session , CK_BYTE_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_DigestUpdate " ) ) ;
}
@ endcode */
@ -1164,7 +1168,7 @@ namespace cryptoki {
bool findobjectsfinal ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_FindObjectsFinal
return check ( _slot . _ library- > C_FindObjectsFinal ( _session ) ,
return check ( _slot . library ( ) - > C_FindObjectsFinal ( _session ) ,
CRYPTOKI_FN_LOG ( " C_FindObjectsFinal " ) ) ;
}
@ endcode */
@ -1174,7 +1178,7 @@ namespace cryptoki {
bool findobjectsinit ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_FindObjectsInit
return check ( _slot . _ library- > C_FindObjectsInit ( _session , CK_ATTRIBUTE_PTR , CK_ULONG ) ,
return check ( _slot . library ( ) - > C_FindObjectsInit ( _session , CK_ATTRIBUTE_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_FindObjectsInit " ) ) ;
}
@ endcode */
@ -1184,7 +1188,7 @@ namespace cryptoki {
bool findobjects ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_FindObjects
return check ( _session - > _slot . _ library- > C_FindObjects ( _session , CK_OBJECT_HANDLE_PTR , CK_ULONG ,
return check ( _session - > _slot . library ( ) - > C_FindObjects ( _session , CK_OBJECT_HANDLE_PTR , CK_ULONG ,
CK_ULONG_PTR ) ,
CRYPTOKI_FN_LOG ( " C_FindObjects " ) ) ;
}
@ -1195,7 +1199,7 @@ namespace cryptoki {
bool generaterandom ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_GenerateRandom
return check ( _slot . _ library- > C_GenerateRandom ( _session , CK_BYTE_PTR , CK_ULONG ) ,
return check ( _slot . library ( ) - > C_GenerateRandom ( _session , CK_BYTE_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_GenerateRandom " ) ) ;
}
@ endcode */
@ -1205,7 +1209,7 @@ namespace cryptoki {
bool getfunctionstatus ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_GetFunctionStatus
return check ( _slot . _ library- > C_GetFunctionStatus ( _session ) ,
return check ( _slot . library ( ) - > C_GetFunctionStatus ( _session ) ,
CRYPTOKI_FN_LOG ( " C_GetFunctionStatus " ) ) ;
}
@ endcode */
@ -1215,7 +1219,7 @@ namespace cryptoki {
bool getoperationstate ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_GetOperationState
return check ( _slot . _ library- > C_GetOperationState ( _session , CK_BYTE_PTR , CK_ULONG_PTR ) ,
return check ( _slot . library ( ) - > C_GetOperationState ( _session , CK_BYTE_PTR , CK_ULONG_PTR ) ,
CRYPTOKI_FN_LOG ( " C_GetOperationState " ) ) ;
}
@ endcode */
@ -1255,7 +1259,7 @@ namespace cryptoki {
CRYPTOLOG ( " log " ) ;
CK_SESSION_INFO info ;
//! calls @c C_GetSessionInfo
check ( _slot . _ library- > C_GetSessionInfo ( _session , & info ) ,
check ( _slot . library ( ) - > C_GetSessionInfo ( _session , & info ) ,
CRYPTOKI_FN_LOG ( " C_GetSessionInfo " ) ) ;
return info ;
}
@ -1276,7 +1280,7 @@ namespace cryptoki {
bool initpin ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_InitPIN
return check ( _slot . _ library- > C_InitPIN ( _session , CK_CHAR_PTR , CK_ULONG ) ,
return check ( _slot . library ( ) - > C_InitPIN ( _session , CK_CHAR_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_InitPIN " ) ) ;
}
@ endcode */
@ -1292,7 +1296,7 @@ namespace cryptoki {
CK_USER_TYPE userType = CKU_USER ) : _session ( session ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_Login
_session . check ( _session . _slot . _ library- > C_Login
_session . check ( _session . _slot . library ( ) - > C_Login
( _session . _session , userType ,
( CK_CHAR * ) pin . c_str ( ) ,
pin . size ( ) ) ,
@ -1302,7 +1306,7 @@ namespace cryptoki {
~ Login ( ) {
try {
//! calls @c C_Logout
_session . check ( _session . _slot . _ library- > C_Logout
_session . check ( _session . _slot . library ( ) - > C_Logout
( _session . _session ) ,
CRYPTOKI_FN_LOG ( " C_Logout " ) ) ;
} catch ( const std : : exception & x ) {
@ -1339,7 +1343,7 @@ namespace cryptoki {
bool seedrandom ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_SeedRandom
return check ( _slot . _ library- > C_SeedRandom ( _session , CK_BYTE_PTR , CK_ULONG ) ,
return check ( _slot . library ( ) - > C_SeedRandom ( _session , CK_BYTE_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_SeedRandom " ) ) ;
}
@ endcode */
@ -1349,7 +1353,7 @@ namespace cryptoki {
bool setpin ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_SetPIN
return check ( _slot . _ library- > C_SetPIN ( _session , CK_CHAR_PTR , CK_ULONG , CK_CHAR_PTR , CK_ULONG ) ,
return check ( _slot . library ( ) - > C_SetPIN ( _session , CK_CHAR_PTR , CK_ULONG , CK_CHAR_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_SetPIN " ) ) ;
}
@ endcode */
@ -1367,7 +1371,7 @@ namespace cryptoki {
bool check ( CK_RV result , const std : : string & context = " " ) {
_res = result ;
if ( _session . _slot . _ library. exc ( ) & & ! * this ) {
if ( _session . _slot . library ( ) . exc ( ) & & ! * this ) {
if ( ! context . empty ( ) ) {
throw access_error ( context + " : " + error ( ) ) ;
} else {
@ -1450,7 +1454,7 @@ namespace cryptoki {
/*! @return error text of last cryptoki call */
std : : string error ( ) {
return _session . _slot . _ library. error ( _res ) ;
return _session . _slot . library ( ) . error ( _res ) ;
}
//@}
@ -1466,7 +1470,7 @@ namespace cryptoki {
bool copyobject ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_CopyObject
return check ( _session . _slot . _ library- > C_CopyObject ( _session . _session , CK_OBJECT_HANDLE ,
return check ( _session . _slot . library ( ) - > C_CopyObject ( _session . _session , CK_OBJECT_HANDLE ,
CK_ATTRIBUTE_PTR , CK_ULONG , CK_OBJECT_HANDLE_PTR ) ,
CRYPTOKI_FN_LOG ( " C_CopyObject " ) ) ;
}
@ -1480,7 +1484,7 @@ namespace cryptoki {
CRYPTOLOG ( " decryptinit: type= " < < type < < " ; mech=( " < < mech . mechanism
< < " , " < < mech . pParameter < < " , " < < mech . ulParameterLen < < ' ) ' ) ;
//! calls @c C_DecryptInit
return check ( _session . _slot . _ library- > C_DecryptInit
return check ( _session . _slot . library ( ) - > C_DecryptInit
( _session . _session , & mech , _object ) ,
CRYPTOKI_FN_LOG ( " C_DecryptInit " ) ) ;
}
@ -1492,13 +1496,13 @@ namespace cryptoki {
CK_ULONG size ( 0 ) ; // two calls, first to get minimum buffer length
CRYPTOLOG ( " get size " ) ;
//! calls @c C_Decrypt
check ( _session . _slot . _ library- > C_Decrypt
check ( _session . _slot . library ( ) - > C_Decrypt
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) , 0 , & size ) ,
CRYPTOKI_FN_LOG ( " C_Decrypt " ) ) ;
CRYPTOLOG ( " maximum size is " < < size < < " Bytes " ) ;
res . resize ( size , 0 ) ;
check ( _session . _slot . _ library- > C_Decrypt
check ( _session . _slot . library ( ) - > C_Decrypt
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1514,7 +1518,7 @@ namespace cryptoki {
res . resize ( in . size ( ) ) ;
CK_ULONG size ( res . size ( ) ) ; //! @todo check if size is ok
//! calls @c C_DecryptDigestUpdate
check ( _session . _slot . _ library- > C_DecryptDigestUpdate
check ( _session . _slot . library ( ) - > C_DecryptDigestUpdate
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1526,7 +1530,7 @@ namespace cryptoki {
bool decryptfinal ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_DecryptFinal
return check ( _session . _slot . _ library- > C_DecryptFinal
return check ( _session . _slot . library ( ) - > C_DecryptFinal
( _session . _session , 0 , 0 ) ,
CRYPTOKI_FN_LOG ( " C_DecryptFinal " ) ) ;
//! @todo does this work?
@ -1538,7 +1542,7 @@ namespace cryptoki {
res . resize ( in . size ( ) ) ;
CK_ULONG size ( res . size ( ) ) ; //! @todo check if size is ok
//! calls @c C_DecryptUpdate
check ( _session . _slot . _ library- > C_DecryptUpdate
check ( _session . _slot . library ( ) - > C_DecryptUpdate
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1553,7 +1557,7 @@ namespace cryptoki {
res . resize ( in . size ( ) ) ;
CK_ULONG size ( res . size ( ) ) ; //! @todo check if size is ok
//! calls @c C_DecryptVerifyUpdate
check ( _session . _slot . _ library- > C_DecryptVerifyUpdate
check ( _session . _slot . library ( ) - > C_DecryptVerifyUpdate
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1567,14 +1571,14 @@ namespace cryptoki {
CRYPTOLOG ( " log " ) ;
std : : string res ;
CK_ULONG size ( 0 ) ;
check ( _session . _slot . _ library- > C_Sign
check ( _session . _slot . library ( ) - > C_Sign
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) , 0 , & size ) ,
CRYPTOKI_FN_LOG ( " C_Sign " ) ) ;
CRYPTOLOG ( " maximum size is " < < size < < " Bytes " ) ;
res . resize ( size , 0 ) ;
//! calls @c C_Sign
check ( _session . _slot . _ library- > C_Sign
check ( _session . _slot . library ( ) - > C_Sign
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1590,7 +1594,7 @@ namespace cryptoki {
res . resize ( in . size ( ) ) ;
CK_ULONG size ( res . size ( ) ) ; //! @todo check if size is ok
//! calls @c C_SignEncryptUpdate
check ( _session . _slot . _ library- > C_SignEncryptUpdate
check ( _session . _slot . library ( ) - > C_SignEncryptUpdate
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1604,7 +1608,7 @@ namespace cryptoki {
bool signfinal ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_SignFinal
return check ( _slot . _ library- > C_SignFinal ( _session , CK_BYTE_PTR , CK_ULONG_PTR ) ,
return check ( _slot . library ( ) - > C_SignFinal ( _session , CK_BYTE_PTR , CK_ULONG_PTR ) ,
CRYPTOKI_FN_LOG ( " C_SignFinal " ) ) ;
}
@ endcode */
@ -1615,7 +1619,7 @@ namespace cryptoki {
res . resize ( in . size ( ) ) ;
CK_ULONG size ( res . size ( ) ) ; //! @todo check if size is ok
//! calls @c C_SignRecover
check ( _session . _slot . _ library- > C_SignRecover
check ( _session . _slot . library ( ) - > C_SignRecover
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1629,7 +1633,7 @@ namespace cryptoki {
bool signupdate ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_SignUpdate
return check ( _session . _slot . _ library- > C_SignUpdate ( _session . _session , CK_BYTE_PTR , CK_ULONG ) ,
return check ( _session . _slot . library ( ) - > C_SignUpdate ( _session . _session , CK_BYTE_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_SignUpdate " ) ) ;
}
@ endcode */
@ -1637,7 +1641,7 @@ namespace cryptoki {
bool verify ( std : : string data , std : : string signature ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_Verify
return check ( _session . _slot . _ library- > C_Verify
return check ( _session . _slot . library ( ) - > C_Verify
( _session . _session ,
( unsigned char * ) & data [ 0 ] , data . size ( ) ,
( unsigned char * ) & signature [ 0 ] , signature . size ( ) ) ,
@ -1649,7 +1653,7 @@ namespace cryptoki {
bool verifyfinal ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_VerifyFinal
return check ( _session . _slot . _ library- > C_VerifyFinal ( _session . _session , CK_BYTE_PTR , CK_ULONG ) ,
return check ( _session . _slot . library ( ) - > C_VerifyFinal ( _session . _session , CK_BYTE_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_VerifyFinal " ) ) ;
}
@ endcode */
@ -1660,7 +1664,7 @@ namespace cryptoki {
res . resize ( in . size ( ) ) ;
CK_ULONG size ( res . size ( ) ) ; //! @todo check if size is ok
//! calls @c C_VerifyRecover
check ( _session . _slot . _ library- > C_VerifyRecover
check ( _session . _slot . library ( ) - > C_VerifyRecover
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1674,7 +1678,7 @@ namespace cryptoki {
bool verifyupdate ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_VerifyUpdate
return check ( _session . _slot . _ library- > C_VerifyUpdate ( _session . _session , CK_BYTE_PTR , CK_ULONG ) ,
return check ( _session . _slot . library ( ) - > C_VerifyUpdate ( _session . _session , CK_BYTE_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_VerifyUpdate " ) ) ;
}
@ endcode */
@ -1685,7 +1689,7 @@ namespace cryptoki {
bool derivekey ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_DeriveKey
return check ( _session . _slot . _ library- > C_DeriveKey ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ,
return check ( _session . _slot . library ( ) - > C_DeriveKey ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ,
CK_ATTRIBUTE_PTR , CK_ULONG , CK_OBJECT_HANDLE_PTR ) ,
CRYPTOKI_FN_LOG ( " C_DeriveKey " ) ) ;
}
@ -1694,7 +1698,7 @@ namespace cryptoki {
bool destroy ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_DestroyObject
return check ( _session . _slot . _ library- > C_DestroyObject
return check ( _session . _slot . library ( ) - > C_DestroyObject
( _session . _session , _object ) ,
CRYPTOKI_FN_LOG ( " C_DestroyObject " ) ) ;
}
@ -1705,7 +1709,7 @@ namespace cryptoki {
bool digestkey ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_DigestKey
return check ( _session . _slot . _ library- > C_DigestKey ( _session . _session , CK_OBJECT_HANDLE ) ,
return check ( _session . _slot . library ( ) - > C_DigestKey ( _session . _session , CK_OBJECT_HANDLE ) ,
CRYPTOKI_FN_LOG ( " C_DigestKey " ) ) ;
}
@ endcode */
@ -1718,7 +1722,7 @@ namespace cryptoki {
CRYPTOLOG ( " encryptinit: type= " < < type < < " ; mech=( " < < mech . mechanism
< < " , " < < mech . pParameter < < " , " < < mech . ulParameterLen < < ' ) ' ) ;
//! calls @c C_EncryptInit
return check ( _session . _slot . _ library- > C_EncryptInit
return check ( _session . _slot . library ( ) - > C_EncryptInit
( _session . _session , & mech , _object ) ,
CRYPTOKI_FN_LOG ( " C_EncryptInit " ) ) ;
}
@ -1729,13 +1733,13 @@ namespace cryptoki {
CK_ULONG size ( 0 ) ; // two calls, first to get minimum buffer length
CRYPTOLOG ( " get size " ) ;
//! calls @c C_Encrypt
check ( _session . _slot . _ library- > C_Encrypt
check ( _session . _slot . library ( ) - > C_Encrypt
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) , 0 , & size ) ,
CRYPTOKI_FN_LOG ( " C_Decrypt " ) ) ;
CRYPTOLOG ( " maximum size is " < < size < < " Bytes " ) ;
res . resize ( size , 0 ) ;
check ( _session . _slot . _ library- > C_Encrypt
check ( _session . _slot . library ( ) - > C_Encrypt
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1749,7 +1753,7 @@ namespace cryptoki {
bool encryptfinal ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_EncryptFinal
return check ( _session . _slot . _ library- > C_EncryptFinal ( _session . _session , CK_BYTE_PTR , CK_ULONG_PTR ) ,
return check ( _session . _slot . library ( ) - > C_EncryptFinal ( _session . _session , CK_BYTE_PTR , CK_ULONG_PTR ) ,
CRYPTOKI_FN_LOG ( " C_EncryptFinal " ) ) ;
}
@ endcode */
@ -1760,7 +1764,7 @@ namespace cryptoki {
res . resize ( in . size ( ) ) ;
CK_ULONG size ( res . size ( ) ) ; //! @todo check if size is ok
//! calls @c C_EncryptUpdate
check ( _session . _slot . _ library- > C_EncryptUpdate
check ( _session . _slot . library ( ) - > C_EncryptUpdate
( _session . _session ,
( unsigned char * ) & in [ 0 ] , in . size ( ) ,
( unsigned char * ) & res [ 0 ] , & size ) ,
@ -1774,7 +1778,7 @@ namespace cryptoki {
bool generatekey ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_GenerateKey
return check ( _session . _slot . _ library- > C_GenerateKey ( _session . _session , CK_MECHANISM_PTR , CK_ATTRIBUTE_PTR ,
return check ( _session . _slot . library ( ) - > C_GenerateKey ( _session . _session , CK_MECHANISM_PTR , CK_ATTRIBUTE_PTR ,
CK_ULONG , CK_OBJECT_HANDLE_PTR ) ,
CRYPTOKI_FN_LOG ( " C_GenerateKey " ) ) ;
}
@ -1786,7 +1790,7 @@ namespace cryptoki {
bool generatekeypair ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_GenerateKeyPair
return check ( _session . _slot . _ library- > C_GenerateKeyPair ( _session . _session , CK_MECHANISM_PTR , CK_ATTRIBUTE_PTR ,
return check ( _session . _slot . library ( ) - > C_GenerateKeyPair ( _session . _session , CK_MECHANISM_PTR , CK_ATTRIBUTE_PTR ,
CK_ULONG , CK_ATTRIBUTE_PTR , CK_ULONG ,
CK_OBJECT_HANDLE_PTR , CK_OBJECT_HANDLE_PTR ) ,
CRYPTOKI_FN_LOG ( " C_GenerateKeyPair " ) ) ;
@ -1806,7 +1810,7 @@ namespace cryptoki {
Attribute res ;
CK_ATTRIBUTE attr ( ( CK_ATTRIBUTE ) { a , 0 , 0 } ) ;
//! calls @c C_GetAttributeValue
if ( ! check ( _session . _slot . _ library- > C_GetAttributeValue
if ( ! check ( _session . _slot . library ( ) - > C_GetAttributeValue
( _session . _session , _object , & attr , 1 ) ,
CRYPTOKI_FN_LOG ( " C_GetAttributeValue " ) )
| | ! ( long ) attr . ulValueLen > 0l )
@ -1815,7 +1819,7 @@ namespace cryptoki {
try {
attr . pValue = malloc ( attr . ulValueLen ) ;
attr . pValue = memset ( attr . pValue , 0 , attr . ulValueLen ) ;
if ( check ( _session . _slot . _ library- > C_GetAttributeValue
if ( check ( _session . _slot . library ( ) - > C_GetAttributeValue
( _session . _session , _object , & attr , 1 ) ,
CRYPTOKI_FN_LOG ( " C_GetAttributeValue " ) ) )
/*! @todo There's no @c CKA_WRAP_TEMPLATE in Open
@ -1931,7 +1935,7 @@ namespace cryptoki {
attr = ( CK_ATTRIBUTE ) { * it , 0 , 0 } ;
try {
//! calls @c C_GetAttributeValue
if ( _session . _slot . _ library- > C_GetAttributeValue
if ( _session . _slot . library ( ) - > C_GetAttributeValue
( _session . _session , _object , & attr , 1 )
= = CKR_ATTRIBUTE_TYPE_INVALID
| | _res = = CKR_ATTRIBUTE_SENSITIVE ) {
@ -1941,7 +1945,7 @@ namespace cryptoki {
if ( ( long ) attr . ulValueLen > 0l ) {
attr . pValue = malloc ( attr . ulValueLen ) ;
attr . pValue = memset ( attr . pValue , 0 , attr . ulValueLen ) ;
if ( check ( _session . _slot . _ library- > C_GetAttributeValue
if ( check ( _session . _slot . library ( ) - > C_GetAttributeValue
( _session . _session , _object , & attr , 1 ) ,
CRYPTOKI_FN_LOG ( " C_GetAttributeValue " ) ) )
/*! @todo There's no @c CKA_WRAP_TEMPLATE in Open
@ -2003,7 +2007,7 @@ namespace cryptoki {
bool getobjectsize ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_GetObjectSize
return check ( _session . _slot . _ library- > C_GetObjectSize ( _session . _session , CK_OBJECT_HANDLE , CK_ULONG_PTR ) ,
return check ( _session . _slot . library ( ) - > C_GetObjectSize ( _session . _session , CK_OBJECT_HANDLE , CK_ULONG_PTR ) ,
CRYPTOKI_FN_LOG ( " C_GetObjectSize " ) ) ;
}
@ endcode */
@ -2014,7 +2018,7 @@ namespace cryptoki {
bool setattributevalue ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_SetAttributeValue
return check ( _session . _slot . _ library- > C_SetAttributeValue ( _session . _session , CK_OBJECT_HANDLE ,
return check ( _session . _slot . library ( ) - > C_SetAttributeValue ( _session . _session , CK_OBJECT_HANDLE ,
CK_ATTRIBUTE_PTR , CK_ULONG ) ,
CRYPTOKI_FN_LOG ( " C_SetAttributeValue " ) ) ;
}
@ -2025,7 +2029,7 @@ namespace cryptoki {
bool setoperationstate ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_SetOperationState
return check ( _session . _slot . _ library- > C_SetOperationState ( _session . _session , CK_BYTE_PTR , CK_ULONG ,
return check ( _session . _slot . library ( ) - > C_SetOperationState ( _session . _session , CK_BYTE_PTR , CK_ULONG ,
CK_OBJECT_HANDLE , CK_OBJECT_HANDLE ) ,
CRYPTOKI_FN_LOG ( " C_SetOperationState " ) ) ;
}
@ -2039,7 +2043,7 @@ namespace cryptoki {
CRYPTOLOG ( " signinit: type= " < < type < < " ; mech=( " < < mech . mechanism
< < " , " < < mech . pParameter < < " , " < < mech . ulParameterLen < < ' ) ' ) ;
//! calls @c C_SignInit
return check ( _session . _slot . _ library- > C_SignInit
return check ( _session . _slot . library ( ) - > C_SignInit
( _session . _session , & mech , _object ) ,
CRYPTOKI_FN_LOG ( " C_SignInit " ) ) ;
}
@ -2049,7 +2053,7 @@ namespace cryptoki {
bool signrecoverinit ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_SignRecoverInit
return check ( _session . _slot . _ library- > C_SignRecoverInit ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ) ,
return check ( _session . _slot . library ( ) - > C_SignRecoverInit ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ) ,
CRYPTOKI_FN_LOG ( " C_SignRecoverInit " ) ) ;
}
@ endcode */
@ -2059,7 +2063,7 @@ namespace cryptoki {
bool unwrapkey ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_UnwrapKey
return check ( _session . _slot . _ library- > C_UnwrapKey ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ,
return check ( _session . _slot . library ( ) - > C_UnwrapKey ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ,
CK_BYTE_PTR , CK_ULONG , CK_ATTRIBUTE_PTR , CK_ULONG ,
CK_OBJECT_HANDLE_PTR ) ,
CRYPTOKI_FN_LOG ( " C_UnwrapKey " ) ) ;
@ -2074,7 +2078,7 @@ namespace cryptoki {
CRYPTOLOG ( " verifyinit: type= " < < type < < " ; mech=( " < < mech . mechanism
< < " , " < < mech . pParameter < < " , " < < mech . ulParameterLen < < ' ) ' ) ;
//! calls @c C_VerifyInit
return check ( _session . _slot . _ library- > C_VerifyInit
return check ( _session . _slot . library ( ) - > C_VerifyInit
( _session . _session , & mech , _object ) ,
CRYPTOKI_FN_LOG ( " C_VerifyInit " ) ) ;
}
@ -2084,7 +2088,7 @@ namespace cryptoki {
bool verifyrecoverinit ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_VerifyRecoverInit
return check ( _session . _slot . _ library- > C_VerifyRecoverInit ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ) ,
return check ( _session . _slot . library ( ) - > C_VerifyRecoverInit ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ) ,
CRYPTOKI_FN_LOG ( " C_VerifyRecoverInit " ) ) ;
}
@ endcode */
@ -2095,7 +2099,7 @@ namespace cryptoki {
bool wrapkey ( ) {
CRYPTOLOG ( " log " ) ;
//! calls @c C_WrapKey
return check ( _session . _slot . _ library- > C_WrapKey ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ,
return check ( _session . _slot . library ( ) - > C_WrapKey ( _session . _session , CK_MECHANISM_PTR , CK_OBJECT_HANDLE ,
CK_OBJECT_HANDLE , CK_BYTE_PTR , CK_ULONG_PTR ) ,
CRYPTOKI_FN_LOG ( " C_WrapKey " ) ) ;
}