30 int algoInfoSize, hashInfoSize;
36 hashInfoSize = sizeofObject( hashSize );
40 return( sizeofObject( algoInfoSize + hashInfoSize ) );
58 (
int ) sizeofObject( hashSize ) );
59 status = writeAlgoID( stream, hashAlgo );
61 status = writeOctetString( stream, hash, hashSize,
DEFAULT_TAG );
77 assert(
isWritePtr( hashSize,
sizeof(
int ) ) );
79 REQUIRES_S( hashMaxLen >= 16 && hashMaxLen <= 8192 );
82 memset( hash, 0,
min( 16, hashMaxLen ) );
86 readSequence( stream, NULL );
107 IN_RANGE( 1, 50 )
const int noOidInfoEntries,
119 assert( dataSize == NULL ||
isWritePtr( dataSize,
sizeof(
long ) ) );
121 REQUIRES_S( noOidInfoEntries > 0 && noOidInfoEntries <= 50 );
125 ( dataSize == NULL ) ) );
127 ( oidInfo[ 0 ].extraInfo != NULL ) ) );
131 if( dataSize != NULL )
137 status = readLongSequence( stream, &length );
143 savedLengthDataStart = stell( stream );
145 status = readOIDEx( stream, oidInfo, noOidInfoEntries, &oidInfoPtr );
175 status = checkEOC( stream );
190 status = readLongConstructed( stream, &length, 0 );
196 savedLengthDataStart = stell( stream );
198 if( flags & READCMS_FLAG_WRAPPERONLY )
205 if( dataSize != NULL )
209 tag = peekTag( stream );
240 return( sSetError( stream, status ) );
241 status = readLongGenericHole( stream, &length, tag );
262 length = savedLength - ( stell( stream ) - savedLengthDataStart );
268 if( !isData && oidInfoPtr->
extraInfo != NULL )
271 const long startPos = stell( stream );
283 length -= stell( stream ) -
startPos;
286 if( dataSize != NULL )
298 BOOLEAN isOctetString = ( isInnerHeader || \
299 ( contentOIDlength == 11 && \
304 assert(
isReadPtr( contentOID, contentOIDlength ) && \
305 contentOIDlength ==
sizeofOID( contentOID ) );
330 if( isInnerHeader && contentOIDlength == 12 && \
332 isOctetString =
FALSE;
339 writeSequence( stream, contentOIDlength + ( ( dataSize > 0 ) ? \
340 (
int ) sizeofObject( sizeofObject( dataSize ) ) : 0 ) );
341 status = swrite( stream, contentOID, contentOIDlength );
344 writeConstructed( stream, sizeofObject( dataSize ), 0 );
346 return( writeOctetStringHole( stream, dataSize,
DEFAULT_TAG ) );
347 return( writeSequence( stream, dataSize ) );
352 swrite( stream, contentOID, contentOIDlength );
362 int sizeofCMSencrHeader(
IN_BUFFER( contentOIDlength )
const BYTE *contentOID,
370 assert(
isReadPtr( contentOID, contentOIDlength ) && \
371 contentOIDlength ==
sizeofOID( contentOID ) );
381 sMemNullOpen( &nullStream );
382 status = writeCryptContextAlgoID( &nullStream, iCryptContext );
384 cryptInfoSize = stell( &nullStream );
385 sMemClose( &nullStream );
395 ( sizeofObject( contentOIDlength + \
397 sizeofObject( dataSize ) ) - dataSize ) );
399 return( 2 + contentOIDlength + cryptInfoSize + 2 );
405 IN_RANGE( 1, 50 )
const int noOidInfoEntries,
410 QUERY_INFO localQueryInfo, *queryInfoPtr = ( queryInfo == NULL ) ? \
411 &localQueryInfo : queryInfo;
417 assert( iCryptContext == NULL || \
419 assert( queryInfo == NULL || \
422 REQUIRES_S( noOidInfoEntries > 0 && noOidInfoEntries <= 50 );
428 if( iCryptContext != NULL )
430 memset( queryInfoPtr, 0,
sizeof(
QUERY_INFO ) );
436 readLongSequence( stream, NULL );
437 status = readOID( stream, oidInfo, noOidInfoEntries, &selectionID );
440 status = readContextAlgoID( stream, iCryptContext, queryInfoPtr,
455 tag = peekTag( stream );
458 status = readLongGenericHole( stream, &length, tag );
479 if( iCryptContext != NULL )
485 return( selectionID );
499 assert(
isReadPtr( contentOID, contentOIDlength ) && \
500 contentOIDlength ==
sizeofOID( contentOID ) );
510 sMemNullOpen( &nullStream );
511 status = writeCryptContextAlgoID( &nullStream, iCryptContext );
513 cryptInfoSize = stell( &nullStream );
514 sMemClose( &nullStream );
521 writeSequence( stream, contentOIDlength + cryptInfoSize + \
522 (
int ) sizeofObject( dataSize ) );
523 swrite( stream, contentOID, contentOIDlength );
524 status = writeCryptContextAlgoID( stream, iCryptContext );
527 return( writeOctetStringHole( stream, dataSize, 0 ) );
532 swrite( stream, contentOID, contentOIDlength );
533 status = writeCryptContextAlgoID( stream, iCryptContext );