28 #if defined( __WIN32__ ) && !defined( NDEBUG )
40 static const FAR_BSS char *irStrings[] = \
41 {
"cmpi1_ir",
"cmpi2_ip",
"cmpi3_conf",
"cmpi4_confack" };
42 static const FAR_BSS char *crStrings[] = \
43 {
"cmpc1_cr",
"cmpc2_cp",
"cmpc3_conf",
"cmpc4_confack" };
44 static const FAR_BSS char *kurStrings[] = \
45 {
"cmpk1_kur",
"cmpk2_kup",
"cmpk3_conf",
"cmpk4_confack" };
46 static const FAR_BSS char *rrStrings[] = \
47 {
"cmpr1_rr",
"cmpr2_rp" };
48 static const FAR_BSS char *gmStrings[] = \
49 {
"cmpg1_gr",
"cmpg2_gp" };
50 static const FAR_BSS char *errorStrings[] = \
52 static const FAR_BSS char *unkStrings[] = \
53 {
"cmp_unknown1",
"cmp_unknown2",
"cmp_unknown3",
"cmp_unknown4" };
54 const char **fnStringPtr = ( type ==
CTAG_PB_IR ) ? irStrings : \
64 #ifndef DUMP_SERVER_MESSAGES
73 #ifdef DUMP_SERVER_MESSAGES
77 const int pathLength = strlen( fileName );
80 setMessageData( &msgData, fileName + pathLength, 1024 - pathLength );
83 for( i = 0; i < msgData.
length; i++ )
85 const int ch =
byteToInt( fileName[ pathLength + i ] );
87 if( ch ==
' ' || ch ==
'\'' || ch ==
'"' || ch ==
'?' || \
88 ch ==
'*' || ch ==
'[' || ch ==
']' || ch ==
'`' || \
89 ch ==
',' || ch < ' ' || ch >
'z' )
90 fileName[ pathLength + i ] =
'_';
95 strlcat_s( fileName, 1024, fnStringPtr[ phase - 1 ] );
98 #ifdef __STDC_LIB_EXT1__
99 if( fopen_s( &filePtr, fileName,
"wb" ) != 0 )
102 filePtr = fopen( fileName,
"wb" );
104 if( filePtr != NULL )
106 fwrite( sessionInfoPtr->receiveBuffer, 1,
115 static const MAP_TABLE reqRespMapTbl[] = {
137 status = mapValue( reqType, &value, reqRespMapTbl,
152 protocolInfo->iMacContext = protocolInfo->authContext =
CRYPT_ERROR;
154 protocolInfo->isCryptlib =
TRUE;
156 protocolInfo->isServer =
TRUE;
170 assert( ( userID == NULL && userIDlength == 0 ) || \
174 userIDlength == 0 ) || \
175 ( ( flags & CMP_INIT_FLAG_USERID ) && userID != NULL && \
185 &msgData, CRYPT_IATTRIBUTE_RANDOM_NONCE );
191 if( flags & CMP_INIT_FLAG_USERID )
194 memcpy( protocolInfo->userID, userID, userIDlength );
197 protocolInfo->isServer ?
"SVR" :
"CLI" ));
199 protocolInfo->userID, protocolInfo->userIDsize );
205 &msgData, CRYPT_IATTRIBUTE_RANDOM_NONCE );
210 protocolInfo->isServer ?
"SVR" :
"CLI" ));
212 protocolInfo->transID, protocolInfo->transIDsize );
224 CRYPT_IATTRIBUTE_RANDOM_NONCE );
229 CMP_PW_ITERATIONS_OTHER;
242 protocolInfo->iMacContext = createInfo.
cryptHandle;
243 protocolInfo->useMACsend = protocolInfo->useMACreceive =
TRUE;
282 CMP_INFO *cmpInfo = sessionInfoPtr->sessionCMP;
292 sNetDisconnect( &sessionInfoPtr->stream );
307 CMP_INFO *cmpInfo = sessionInfoPtr->sessionCMP;
335 *cmpResponsePtr = sessionInfoPtr->iCertResponse;
345 CMP_INFO *cmpInfo = sessionInfoPtr->sessionCMP;
349 assert(
isReadPtr( data,
sizeof(
int ) ) );
372 ( sessionInfoPtr->iCertRequest !=
CRYPT_ERROR ) ? \
383 const int cmpReqType = *( (
int * ) data );
431 sessionInfoPtr->clientReqAttrFlags = \
432 SESSION_NEEDS_USERID | \
433 SESSION_NEEDS_PASSWORD;
439 sessionInfoPtr->clientReqAttrFlags = \
440 SESSION_NEEDS_PRIVATEKEY | \
441 SESSION_NEEDS_PRIVKEYSIGN | \
442 SESSION_NEEDS_PRIVKEYCERT | \
443 SESSION_NEEDS_KEYORPASSWORD;
447 sessionInfoPtr->clientReqAttrFlags = \
448 SESSION_NEEDS_PRIVATEKEY | \
449 SESSION_NEEDS_PRIVKEYSIGN | \
450 SESSION_NEEDS_PRIVKEYCERT;
471 sessionInfoPtr->privKeyset = privKeyset;
532 &msgData, CRYPT_IATTRIBUTE_SUBJECT );
575 CRYPT_ICERTFORMAT_DATA );
583 sessionInfoPtr->iAuthInContext = cryptCert;
585 sessionInfoPtr->iCertRequest = cryptCert;
599 #ifdef USE_CMP_TRANSPORT
616 SESSION_NEEDS_PRIVKEYCERT | \
617 SESSION_NEEDS_PRIVKEYCACERT | \
618 SESSION_NEEDS_KEYSET | \
619 SESSION_NEEDS_CERTSTORE,
624 #ifdef USE_CMP_TRANSPORT
634 initCMPserverProcessing( sessionInfoPtr );
636 initCMPclientProcessing( sessionInfoPtr );
637 sessionInfoPtr->shutdownFunction = shutdownFunction;
638 sessionInfoPtr->getAttributeFunction = getAttributeFunction;
639 sessionInfoPtr->setAttributeFunction = setAttributeFunction;
642 sessionInfoPtr->sessionCMP->userInfo =
CRYPT_ERROR;
643 sessionInfoPtr->sessionCMP->savedMacContext =
CRYPT_ERROR;