60 assert( signedObject == NULL || \
61 isWritePtr( signedObject, signedObjectMaxLength ) );
62 assert(
isWritePtr( signedObjectLength,
sizeof(
int ) ) );
63 assert(
isReadPtr(
object, objectLength ) && \
66 assert( formatInfo == NULL || \
69 REQUIRES( ( signedObject == NULL && signedObjectMaxLength == 0 ) || \
70 ( signedObject != NULL && \
77 ( ( formatInfo->tag >= 0 && \
79 ( formatInfo->extraLength >= 0 && \
83 if( signedObject != NULL )
84 memset( signedObject, 0,
min( 16, signedObjectMaxLength ) );
85 *signedObjectLength = 0;
104 &signatureLength, iSignContext,
110 if( formatInfo == NULL )
116 if( formatInfo->isExplicit )
118 totalSigLength = ( int ) \
120 sizeofObject( signatureLength + \
121 formatInfo->extraLength ) );
125 totalSigLength = ( int ) \
126 sizeofObject( signatureLength + formatInfo->extraLength );
134 if( signedObject != NULL && \
135 sizeofObject( objectLength + totalSigLength ) > signedObjectMaxLength )
140 sMemOpenOpt( &stream, signedObject, signedObjectMaxLength );
141 writeSequence( &stream, objectLength + totalSigLength );
142 swrite( &stream,
object, objectLength );
147 if( formatInfo != NULL )
149 if( formatInfo->isExplicit )
151 writeConstructed( &stream,
152 sizeofObject( signatureLength + \
153 formatInfo->extraLength ),
155 writeSequence( &stream,
156 signatureLength + formatInfo->extraLength );
160 writeConstructed( &stream,
161 signatureLength + formatInfo->extraLength,
167 status = swrite( &stream, dataSignature, signatureLength );
169 *signedObjectLength = stell( &stream );
170 sMemDisconnect( &stream );
174 assert( ( formatInfo != NULL && formatInfo->extraLength > 0 ) || \
176 *signedObjectLength ) ) );
181 int checkX509signature(
IN_BUFFER( signedObjectLength )
const void *signedObject,
194 assert(
isReadPtr( signedObject, signedObjectLength ) );
195 assert( formatInfo == NULL || \
201 ( ( formatInfo->tag >= 0 && \
203 ( formatInfo->extraLength >= 0 && \
215 sMemConnect( &stream, signedObject, signedObjectLength );
216 readLongSequence( &stream, NULL );
217 status = getLongStreamObjectLength( &stream, &length );
219 status = sMemGetDataBlock( &stream, &objectPtr, length );
221 status = sSkip( &stream, length );
224 sMemDisconnect( &stream );
229 if( formatInfo != NULL )
231 if( formatInfo->isExplicit )
233 readConstructed( &stream, NULL, formatInfo->tag );
234 status = readSequence( &stream, NULL );
237 status = readConstructed( &stream, NULL, formatInfo->tag );
240 sMemDisconnect( &stream );
246 status = sMemGetDataBlockRemaining( &stream, &sigPtr, &sigLength );
249 sMemDisconnect( &stream );
252 status = readAlgoIDex( &stream, &signAlgo, &hashAlgo, &hashParam,
254 sMemDisconnect( &stream );
261 if( sigCheckAlgo != signAlgo )
292 status = checkSignature( sigPtr, sigLength, iSigCheckContext,
324 assert(
isWritePtr( signature, sigMaxLength ) );
325 assert(
isWritePtr( signatureLength,
sizeof(
int ) ) );
332 return( createSignature( signature, sigMaxLength, signatureLength,
343 assert(
isReadPtr( signature, signatureLength ) );
349 return( checkSignature( signature, signatureLength, iSigCheckContext,