28 #if defined( CONFIG_CONSERVE_MEMORY )
29 #define SESSIONCACHE_SIZE 8
31 #define SESSIONCACHE_SIZE 64
68 sessionInfoPtr->shutdownFunction( sessionInfoPtr );
72 if( sessionInfoPtr->sendBuffer != NULL )
74 zeroise( sessionInfoPtr->sendBuffer,
76 clFree(
"sessionMessageFunction", sessionInfoPtr->sendBuffer );
78 if( sessionInfoPtr->receiveBuffer != NULL )
80 zeroise( sessionInfoPtr->receiveBuffer,
82 clFree(
"sessionMessageFunction", sessionInfoPtr->receiveBuffer );
137 ( ( messageValue >= CRYPT_SESSINFO_FIRST_SPECIFIC && \
138 messageValue <= CRYPT_SESSINFO_LAST_SPECIFIC ) || \
139 messageValue == CRYPT_IATTRIBUTE_ENC_TIMESTAMP ) )
144 REQUIRES( sessionInfoPtr->setAttributeFunction != NULL );
146 status = sessionInfoPtr->setAttributeFunction( sessionInfoPtr,
147 messageDataPtr, messageValue );
159 REQUIRES( sessionInfoPtr->getAttributeFunction != NULL );
161 status = sessionInfoPtr->getAttributeFunction( sessionInfoPtr,
162 messageDataPtr, messageValue );
174 return( getSessionAttribute( sessionInfoPtr,
175 (
int * ) messageDataPtr,
178 return( getSessionAttributeS( sessionInfoPtr,
186 if( messageValue == CRYPT_IATTRIBUTE_INITIALISED )
189 return( setSessionAttribute( sessionInfoPtr,
190 *( (
int * ) messageDataPtr ),
197 return( setSessionAttributeS( sessionInfoPtr, msgData->data,
198 msgData->
length, messageValue ) );
201 return( deleteSessionAttribute( sessionInfoPtr, messageValue ) );
230 CRYPT_IATTRIBUTE_INITIALISED );
235 ENSURES( sessionInfoPtr->sendBuffer != NULL );
255 status = putSessionData( sessionInfoPtr, msgData->data, length,
277 ENSURES( sessionInfoPtr->receiveBuffer != NULL );
285 status = getSessionData( sessionInfoPtr, msgData->data, length,
310 static const MAP_TABLE subtypeMapTbl[] = {
328 static const MAP_TABLE basetypeMapTbl[] = {
359 *sessionInfoPtrPtr = NULL;
363 status = mapValue( sessionType, &value, subtypeMapTbl,
367 status = mapValue( sessionType, &value, basetypeMapTbl,
370 sessionBaseType =
value;
373 switch( sessionBaseType )
406 status = krnlCreateObject( iCryptSession, (
void ** ) &sessionInfoPtr,
417 sessionInfoPtr->
type = sessionBaseType;
418 if( storageSize > 0 )
420 switch( sessionBaseType )
423 sessionInfoPtr->sessionSSH = \
424 (
SSH_INFO * ) sessionInfoPtr->storage;
428 sessionInfoPtr->sessionSSL = \
429 (
SSL_INFO * ) sessionInfoPtr->storage;
433 sessionInfoPtr->sessionTSP = \
434 (
TSP_INFO * ) sessionInfoPtr->storage;
438 sessionInfoPtr->sessionCMP = \
439 (
CMP_INFO * ) sessionInfoPtr->storage;
443 sessionInfoPtr->sessionSCEP = \
451 sessionInfoPtr->storageSize = storageSize;
455 if( ( sessionType != sessionBaseType ) || \
481 switch( sessionBaseType )
525 sessionInfoPtr->sessionSSL->scoreboardInfoPtr = &scoreboardInfo;
530 protocolInfoPtr->
bufSize == 0 && \
540 protocolInfoPtr->
port == 80 ) || \
541 ( protocolInfoPtr->
port != 80 ) );
542 ENSURES( protocolInfoPtr->
port > 21 && protocolInfoPtr->
port <= 65534L );
546 sessionInfoPtr->
flags |= protocolInfoPtr->
flags;
558 protocolInfoPtr->bufSize;
560 protocolInfoPtr->sendBufStartOfs;
565 status = initSessionIO( sessionInfoPtr );
570 ENSURES( sessionInfoPtr->connectFunction != NULL );
571 ENSURES( sessionInfoPtr->transactFunction != NULL );
573 sessionInfoPtr->readHeaderFunction == NULL && \
574 sessionInfoPtr->processBodyFunction == NULL && \
575 sessionInfoPtr->preparePacketFunction == NULL ) || \
577 sessionInfoPtr->readHeaderFunction != NULL && \
578 sessionInfoPtr->processBodyFunction != NULL && \
579 sessionInfoPtr->preparePacketFunction != NULL ) );
595 REQUIRES( auxDataPtr == NULL && auxValue == 0 );
600 initStatus = openSession( &iCryptSession, createInfo->cryptOwner,
601 createInfo->arg1, &sessionInfoPtr );
605 if( sessionInfoPtr == NULL )
606 return( initStatus );
619 createInfo->cryptHandle = iCryptSession;
630 static int initLevel = 0;
662 DEBUG_DIAG((
"Exiting due to kernel shutdown" ));