Go to the documentation of this file.
8 #ifndef _ANALYSE_DEFINED
10 #define _ANALYSE_DEFINED
15 #define MAX_ERROR CRYPT_ENVELOPE_RESOURCE
23 #if defined( _MSC_VER ) && defined( _PREFAST_ )
31 #ifdef __SPECSTRINGS_STRICT_LEVEL
32 #undef __SPECSTRINGS_STRICT_LEVEL
34 #define __SPECSTRINGS_STRICT_LEVEL 3
54 #include <specstrings.h>
85 #define CHECK_RETVAL _Check_return_ \
86 _Success_( result == CRYPT_OK )
87 #define CHECK_RETVAL_BOOL _Check_return_ \
88 _Success_( result == TRUE )
89 #define CHECK_RETVAL_ENUM( name ) \
91 _Success_( result >= name##_NONE && result < name##_LAST )
92 #define CHECK_RETVAL_LENGTH _Check_return_ \
93 _Success_( result >= 0 && result <= MAX_INTLENGTH - 1 )
94 #define CHECK_RETVAL_PTR _Check_return_ \
95 _Success_( result != NULL )
96 #define CHECK_RETVAL_RANGE( low, high ) \
98 _Success_( result >= ( low ) && result <= ( high ) )
99 #define CHECK_RETVAL_SPECIAL _Check_return_ \
100 _Success_( result == CRYPT_OK || result == OK_SPECIAL )
101 #define CHECK_RETVAL_STRINGOP( length ) \
103 _Success_( result >= 0 )
105 #define CHECK_RETVAL_FNPTR
106 #define CHECK_RETVAL_BOOL_FNPTR
107 #define CHECK_RETVAL_LENGTH_FNPTR
108 #define CHECK_RETVAL_PTR_FNPTR
109 #define CHECK_RETVAL_SPECIAL_FNPTR
111 #define RETVAL _Success_( result == CRYPT_OK )
112 #define RETVAL_BOOL _Success_( result == TRUE )
113 #define RETVAL_RANGE( low, high ) _Success_( result >= ( low ) && result <= ( high ) )
114 #define RETVAL_SPECIAL _Success_( result == CRYPT_OK || result == OK_SPECIAL )
120 #define CHECK_RETVAL __checkReturn \
121 __success( result == CRYPT_OK ) \
122 __range( MAX_ERROR, CRYPT_OK )
123 #define CHECK_RETVAL_BOOL __checkReturn \
124 __success( result == TRUE ) \
125 __range( FALSE, TRUE )
126 #define CHECK_RETVAL_ENUM( name ) \
128 __success( result >= name##_NONE && result < name##_LAST ) \
129 __range( name##_NONE, name##_LAST - 1 )
130 #define CHECK_RETVAL_LENGTH __checkReturn \
131 __success( result >= 0 && result <= MAX_INTLENGTH - 1 ) \
132 __range( MAX_ERROR, MAX_INTLENGTH - 1 )
133 #define CHECK_RETVAL_PTR __checkReturn \
134 __success( result != NULL )
135 #define CHECK_RETVAL_RANGE( low, high ) \
137 __success( result >= ( low ) && result <= ( high ) ) \
138 __range( MAX_ERROR, ( high ) )
139 #define CHECK_RETVAL_SPECIAL __checkReturn \
140 __success( result == CRYPT_OK || result == OK_SPECIAL ) \
141 __range( MAX_ERROR, CRYPT_OK )
142 #define CHECK_RETVAL_STRINGOP( length ) \
144 __success( result >= 0 ) \
145 __range( MAX_ERROR, length )
147 #define CHECK_RETVAL_FNPTR __checkReturn \
148 __success( result == CRYPT_OK ) \
149 __range( MAX_ERROR, CRYPT_OK )
150 #define CHECK_RETVAL_BOOL_FNPTR __checkReturn \
151 __success( result == TRUE ) \
152 __range( FALSE, TRUE )
153 #define CHECK_RETVAL_LENGTH_FNPTR __checkReturn \
154 __success( result >= 0 && result <= MAX_INTLENGTH - 1 ) \
155 __range( MAX_ERROR, MAX_INTLENGTH - 1 )
156 #define CHECK_RETVAL_PTR_FNPTR __checkReturn \
157 __success( result != NULL )
158 #define CHECK_RETVAL_SPECIAL_FNPTR __checkReturn \
159 __success( result == CRYPT_OK || result == OK_SPECIAL ) \
160 __range( MAX_ERROR, CRYPT_OK )
162 #define RETVAL __success( result == CRYPT_OK ) \
163 __range( MAX_ERROR, CRYPT_OK )
164 #define RETVAL_BOOL __success( result == TRUE ) \
165 __range( FALSE, TRUE )
166 #define RETVAL_RANGE( low, high ) __success( result >= ( low ) && result <= ( high ) ) \
167 __range( MAX_ERROR, ( high ) )
168 #define RETVAL_SPECIAL __success( result == CRYPT_OK || result == OK_SPECIAL ) \
169 __range( MAX_ERROR, CRYPT_OK )
171 #define RETVAL_FNPTR __success( result == CRYPT_OK ) \
172 __range( MAX_ERROR, CRYPT_OK )
183 #define CHECK_RETVAL_ERROR _Check_return_ \
184 _Success_( result < CRYPT_OK - 1 )
188 #define CHECK_RETVAL_ERROR __checkReturn \
189 __success( result < CRYPT_OK - 1 ) \
190 __range( MAX_ERROR, CRYPT_OK - 1 )
207 #if VC_GE_2008( _MSC_VER )
209 #define IN_INT _In_ _In_range_( 1, MAX_INTLENGTH - 1 )
210 #define IN_INT_OPT _In_ _In_range_( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
211 #define IN_INT_Z _In_ _In_range_( 0, MAX_INTLENGTH - 1 )
212 #define IN_INT_SHORT _In_ _In_range_( 1, MAX_INTLENGTH_SHORT - 1 )
213 #define IN_INT_SHORT_Z _In_ _In_range_( 0, MAX_INTLENGTH_SHORT - 1 )
215 #define OUT_INT _Out_ _Out_range_( 1, MAX_INTLENGTH - 1 )
216 #define OUT_INT_Z _Out_ _Out_range_( 0, MAX_INTLENGTH - 1 )
217 #define OUT_INT_SHORT_Z _Out_ _Out_range_( 0, MAX_INTLENGTH_SHORT - 1 )
218 #define OUT_OPT_INT_Z _Out_opt_ _Out_range_( 0, MAX_INTLENGTH - 1 )
222 #define IN_INT __in __in_range( 1, MAX_INTLENGTH - 1 )
223 #define IN_INT_OPT __in __in_range( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
224 #define IN_INT_Z __in __in_range( 0, MAX_INTLENGTH - 1 )
225 #define IN_INT_SHORT __in __in_range( 1, MAX_INTLENGTH_SHORT - 1 )
226 #define IN_INT_SHORT_Z __in __in_range( 0, MAX_INTLENGTH_SHORT - 1 )
228 #define OUT_INT __out __out_range( 1, MAX_INTLENGTH - 1 )
229 #define OUT_INT_Z __out __out_range( 0, MAX_INTLENGTH - 1 )
230 #define OUT_INT_SHORT_Z __out __out_range( 0, MAX_INTLENGTH_SHORT - 1 )
231 #define OUT_OPT_INT_Z __out_opt __out_range( 0, MAX_INTLENGTH - 1 )
256 #if VC_GE_2008( _MSC_VER )
258 #define IN_ALGO _In_ _In_range_( CRYPT_ALGO_NONE + 1, CRYPT_ALGO_LAST - 1 )
259 #define IN_ALGO_OPT _In_ _In_range_( CRYPT_ALGO_NONE, CRYPT_ALGO_LAST - 1 )
260 #define IN_ATTRIBUTE _In_ _In_range_( CRYPT_ATTRIBUTE_NONE + 1, CRYPT_IATTRIBUTE_LAST - 1 )
261 #define IN_ATTRIBUTE_OPT _In_ _In_range_( CRYPT_ATTRIBUTE_NONE, CRYPT_IATTRIBUTE_LAST - 1 )
262 #define IN_BYTE _In_ _In_range_( 0, 0xFF )
263 #define IN_CHAR _In_ _In_range_( 0, 0x7F )
264 #define IN_ERROR _In_ _In_range_( MAX_ERROR, -1 )
265 #define IN_HANDLE _In_ _In_range_( SYSTEM_OBJECT_HANDLE, MAX_OBJECTS - 1 )
266 #define IN_HANDLE_OPT _In_ _In_range_( CRYPT_UNUSED, MAX_OBJECTS - 1 )
267 #define IN_KEYID _In_ _In_range_( CRYPT_KEYID_NONE + 1, CRYPT_KEYID_LAST - 1 )
268 #define IN_KEYID_OPT _In_ _In_range_( CRYPT_KEYID_NONE, CRYPT_KEYID_LAST - 1 )
269 #define IN_MESSAGE _In_ _In_range_( MESSAGE_NONE + 1, IMESSAGE_LAST - 1 )
270 #define IN_MODE _In_ _In_range_( CRYPT_MODE_NONE + 1, CRYPT_MODE_LAST - 1 )
271 #define IN_MODE_OPT _In_ _In_range_( CRYPT_MODE_NONE, CRYPT_MODE_LAST - 1 )
272 #define IN_PORT _In_ _In_range_( 22, 65535L )
273 #define IN_PORT_OPT _In_ _In_range_( CRYPT_UNUSED, 65535L )
274 #define IN_RANGE( min, max ) _In_ _In_range_( ( min ), ( max ) )
275 #define IN_RANGE_FIXED( value ) _In_ _In_range_( ( value ), ( value ) )
276 #define IN_STATUS _In_ _In_range_( MAX_ERROR, CRYPT_OK )
278 #define INOUT_HANDLE _Inout_ \
279 _In_range_( SYSTEM_OBJECT_HANDLE, MAX_OBJECTS - 1 ) \
280 _Out_range_( SYSTEM_OBJECT_HANDLE, MAX_OBJECTS - 1 )
281 #define INOUT_RANGE( min, max ) _Inout_ \
282 _In_range_( ( min ), ( max ) ) \
283 _Out_range_( ( min ), ( max ) )
285 #define OUT_ALGO_Z _Out_ _Out_range_( CRYPT_ALGO_NONE, CRYPT_ALGO_LAST - 1 )
286 #define OUT_OPT_ALGO_Z _Out_opt_ _Out_range_( CRYPT_ALGO_NONE, CRYPT_ALGO_LAST - 1 )
287 #define OUT_ATTRIBUTE_Z _Out_ _Out_range_( CRYPT_ATTRIBUTE_NONE, CRYPT_IATTRIBUTE_LAST - 1 )
288 #define OUT_OPT_ATTRIBUTE_Z _Out_opt_ _Out_range_( CRYPT_ATTRIBUTE_NONE, CRYPT_IATTRIBUTE_LAST - 1 )
289 #define OUT_BOOL _Out_ _Out_range_( FALSE, TRUE )
290 #define OUT_OPT_BOOL _Out_opt_ _Out_range_( FALSE, TRUE )
291 #define OUT_OPT_BYTE _Out_opt_ _Out_range_( 0, 0xFF )
292 #define OUT_ERROR _Out_ _Out_range_( MAX_ERROR, -1 )
293 #define OUT_HANDLE_OPT _Out_ _Out_range_( CRYPT_ERROR, MAX_OBJECTS - 1 )
294 #define OUT_OPT_HANDLE_OPT _Out_opt_ _Out_range_( SYSTEM_OBJECT_HANDLE, MAX_OBJECTS - 1 )
295 #define OUT_PORT_Z _Out_ _Out_range_( 0, 65535L )
296 #define OUT_RANGE( min, max ) _Out_ _Out_range_( ( min ), ( max ) )
297 #define OUT_OPT_RANGE( min, max ) _Out_opt_ _Out_range_( ( min ), ( max ) )
298 #define OUT_STATUS _Out_ _Out_range_( MAX_ERROR, CRYPT_OK )
302 #define IN_ALGO __in __in_range( CRYPT_ALGO_NONE + 1, CRYPT_ALGO_LAST - 1 )
303 #define IN_ALGO_OPT __in __in_range( CRYPT_ALGO_NONE, CRYPT_ALGO_LAST - 1 )
304 #define IN_ATTRIBUTE __in __in_range( CRYPT_ATTRIBUTE_NONE + 1, CRYPT_IATTRIBUTE_LAST - 1 )
305 #define IN_ATTRIBUTE_OPT __in __in_range( CRYPT_ATTRIBUTE_NONE, CRYPT_IATTRIBUTE_LAST - 1 )
306 #define IN_BYTE __in __in_range( 0, 0xFF )
307 #define IN_CHAR __in __in_range( 0, 0x7F )
308 #define IN_ERROR __in __in_range( MAX_ERROR, -1 )
309 #define IN_HANDLE __in __in_range( SYSTEM_OBJECT_HANDLE, MAX_OBJECTS - 1 )
310 #define IN_HANDLE_OPT __in __in_range( CRYPT_UNUSED, MAX_OBJECTS - 1 )
311 #define IN_KEYID __in __in_range( CRYPT_KEYID_NONE + 1, CRYPT_KEYID_LAST - 1 )
312 #define IN_KEYID_OPT __in __in_range( CRYPT_KEYID_NONE, CRYPT_KEYID_LAST - 1 )
313 #define IN_MESSAGE __in __in_range( MESSAGE_NONE + 1, IMESSAGE_LAST - 1 )
314 #define IN_MODE __in __in_range( CRYPT_MODE_NONE + 1, CRYPT_MODE_LAST - 1 )
315 #define IN_MODE_OPT __in __in_range( CRYPT_MODE_NONE, CRYPT_MODE_LAST - 1 )
316 #define IN_PORT __in __in_range( 22, 65535L )
317 #define IN_PORT_OPT __in __in_range( CRYPT_UNUSED, 65535L )
318 #define IN_RANGE( min, max ) __in __in_range( ( min ), ( max ) )
319 #define IN_RANGE_FIXED( value ) __in __in_range( ( value ), ( value ) )
320 #define IN_STATUS __in __in_range( MAX_ERROR, CRYPT_OK )
322 #define INOUT_HANDLE __inout \
323 __in_range( SYSTEM_OBJECT_HANDLE, MAX_OBJECTS - 1 ) \
324 __out_range( SYSTEM_OBJECT_HANDLE, MAX_OBJECTS - 1 )
325 #define INOUT_RANGE( min, max ) __inout \
326 __in_range( ( min ), ( max ) ) \
327 __out_range( ( min ), ( max ) )
329 #define OUT_ALGO_Z __out __out_range( CRYPT_ALGO_NONE, CRYPT_ALGO_LAST - 1 )
330 #define OUT_OPT_ALGO_Z __out_opt __out_range( CRYPT_ALGO_NONE, CRYPT_ALGO_LAST - 1 )
331 #define OUT_ATTRIBUTE_Z __out __out_range( CRYPT_ATTRIBUTE_NONE, CRYPT_IATTRIBUTE_LAST - 1 )
332 #define OUT_OPT_ATTRIBUTE_Z __out_opt __out_range( CRYPT_ATTRIBUTE_NONE, CRYPT_IATTRIBUTE_LAST - 1 )
333 #define OUT_BOOL __out __out_range( FALSE, TRUE )
334 #define OUT_OPT_BOOL __out_opt __out_range( FALSE, TRUE )
335 #define OUT_OPT_BYTE __out_opt __out_range( 0, 0xFF )
336 #define OUT_ERROR __out __out_range( MAX_ERROR, -1 )
337 #define OUT_HANDLE_OPT __out __out_range( CRYPT_ERROR, MAX_OBJECTS - 1 )
338 #define OUT_OPT_HANDLE_OPT __out_opt __out_range( SYSTEM_OBJECT_HANDLE, MAX_OBJECTS - 1 )
339 #define OUT_PORT_Z __out __out_range( 0, 65535L )
340 #define OUT_RANGE( min, max ) __out __out_range( ( min ), ( max ) )
341 #define OUT_OPT_RANGE( min, max ) __out_opt __out_range( ( min ), ( max ) )
342 #define OUT_STATUS __out __out_range( MAX_ERROR, CRYPT_OK )
365 #if VC_GE_2008( _MSC_VER )
367 #define IN_LENGTH _In_ _In_range_( 1, MAX_INTLENGTH - 1 )
368 #define IN_LENGTH_OPT _In_ _In_range_( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
369 #define IN_LENGTH_FIXED( size ) _In_ _In_range_( ( size ), ( size ) )
370 #define IN_LENGTH_MIN( min ) _In_ _In_range_( ( min ), MAX_INTLENGTH - 1 )
371 #define IN_LENGTH_Z _In_ _In_range_( 0, MAX_INTLENGTH - 1 )
373 #define IN_LENGTH_SHORT _In_ _In_range_( 1, MAX_INTLENGTH_SHORT - 1 )
374 #define IN_LENGTH_SHORT_OPT _In_ _In_range_( CRYPT_UNUSED, MAX_INTLENGTH_SHORT - 1 )
377 #define IN_LENGTH_SHORT_MIN( min ) _In_ _In_range_( ( min ) , MAX_INTLENGTH_SHORT - 1 )
378 #define IN_LENGTH_SHORT_Z _In_ _In_range_( 0, MAX_INTLENGTH_SHORT - 1 )
380 #define INOUT_LENGTH_Z _Inout_ \
381 _In_range_( 0, MAX_INTLENGTH - 1 ) \
382 _Out_range_( 0, MAX_INTLENGTH - 1 )
383 #define INOUT_LENGTH_SHORT_Z _Inout_ \
384 _In_range_( 0, MAX_INTLENGTH_SHORT - 1 ) \
385 _Out_range_( 0, MAX_INTLENGTH_SHORT - 1 )
387 #define OUT_LENGTH _Out_ _Out_range_( 1, MAX_INTLENGTH - 1 )
388 #define OUT_LENGTH_MIN( min ) _Out_ _Out_range_( ( min ), MAX_INTLENGTH - 1 )
389 #define OUT_OPT_LENGTH_MIN( min ) _Out_opt_ _Out_range_( ( min ), MAX_INTLENGTH - 1 )
390 #define OUT_LENGTH_Z _Out_ _Out_range_( 0, MAX_INTLENGTH - 1 )
391 #define OUT_OPT_LENGTH_Z _Out_opt_ _Out_range_( 0, MAX_INTLENGTH - 1 )
393 #define OUT_LENGTH_SHORT _Out_ _Out_range_( 1, MAX_INTLENGTH_SHORT - 1 )
394 #define OUT_LENGTH_SHORT_Z _Out_ _Out_range_( 0, MAX_INTLENGTH_SHORT - 1 )
395 #define OUT_OPT_LENGTH_SHORT_Z _Out_opt_ _Out_range_( 0, MAX_INTLENGTH_SHORT - 1 )
399 #define IN_LENGTH __in __in_range( 1, MAX_INTLENGTH - 1 )
400 #define IN_LENGTH_OPT __in __in_range( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
401 #define IN_LENGTH_FIXED( size ) __in __in_range( ( size ), ( size ) )
402 #define IN_LENGTH_MIN( min ) __in __in_range( ( min ), MAX_INTLENGTH - 1 )
403 #define IN_LENGTH_Z __in __in_range( 0, MAX_INTLENGTH - 1 )
405 #define IN_LENGTH_SHORT __in __in_range( 1, MAX_INTLENGTH_SHORT - 1 )
406 #define IN_LENGTH_SHORT_OPT __in __in_range( CRYPT_UNUSED, MAX_INTLENGTH_SHORT - 1 )
409 #define IN_LENGTH_SHORT_MIN( min ) __in __in_range( ( min ) , MAX_INTLENGTH_SHORT - 1 )
410 #define IN_LENGTH_SHORT_Z __in __in_range( 0, MAX_INTLENGTH_SHORT - 1 )
412 #define INOUT_LENGTH_Z __inout \
413 __in_range( 0, MAX_INTLENGTH - 1 ) \
414 __out_range( 0, MAX_INTLENGTH - 1 )
415 #define INOUT_LENGTH_SHORT_Z __inout \
416 __in_range( 0, MAX_INTLENGTH_SHORT - 1 ) \
417 __out_range( 0, MAX_INTLENGTH_SHORT - 1 )
419 #define OUT_LENGTH __out __out_range( 1, MAX_INTLENGTH - 1 )
420 #define OUT_LENGTH_MIN( min ) __out __out_range( ( min ), MAX_INTLENGTH - 1 )
421 #define OUT_OPT_LENGTH_MIN( min ) __out_opt __out_range( ( min ), MAX_INTLENGTH - 1 )
422 #define OUT_LENGTH_Z __out __out_range( 0, MAX_INTLENGTH - 1 )
423 #define OUT_OPT_LENGTH_Z __out_opt __out_range( 0, MAX_INTLENGTH - 1 )
425 #define OUT_LENGTH_SHORT __out __out_range( 1, MAX_INTLENGTH_SHORT - 1 )
426 #define OUT_LENGTH_SHORT_Z __out __out_range( 0, MAX_INTLENGTH_SHORT - 1 )
427 #define OUT_OPT_LENGTH_SHORT_Z __out_opt __out_range( 0, MAX_INTLENGTH_SHORT - 1 )
460 #if VC_GE_2008( _MSC_VER )
462 #define IN_LENGTH_ATTRIBUTE _In_ _In_range_( 1, MAX_ATTRIBUTE_SIZE )
463 #define IN_LENGTH_DNS _In_ _In_range_( 1, MAX_DNS_SIZE )
464 #define IN_LENGTH_DNS_Z _In_ _In_range_( 0, MAX_DNS_SIZE )
465 #define IN_LENGTH_ERRORMESSAGE _In_ _In_range_( 1, MAX_ERRORMESSAGE_SIZE )
466 #define IN_LENGTH_HASH _In_ _In_range_( 16, CRYPT_MAX_HASHSIZE )
467 #define IN_LENGTH_INDEF _In_ _In_range_( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
468 #define IN_LENGTH_IV _In_ _In_range_( 1, CRYPT_MAX_IVSIZE )
469 #define IN_LENGTH_IV_Z _In_ _In_range_( 0, CRYPT_MAX_IVSIZE )
470 #define IN_LENGTH_KEY _In_ _In_range_( MIN_KEYSIZE, CRYPT_MAX_KEYSIZE )
471 #define IN_LENGTH_KEYID _In_ _In_range_( MIN_NAME_LENGTH, MAX_ATTRIBUTE_SIZE )
472 #define IN_LENGTH_KEYID_Z _In_ _In_range_( 0, MAX_ATTRIBUTE_SIZE )
473 #define IN_LENGTH_NAME _In_ _In_range_( MIN_NAME_LENGTH, MAX_ATTRIBUTE_SIZE )
474 #define IN_LENGTH_NAME_Z _In_ _In_range_( 0, MAX_ATTRIBUTE_SIZE )
475 #define IN_LENGTH_OID _In_ _In_range_( 7, MAX_OID_SIZE )
476 #define IN_LENGTH_PKC _In_ _In_range_( 1, CRYPT_MAX_PKCSIZE )
477 #define IN_LENGTH_PKC_Z _In_ _In_range_( 0, CRYPT_MAX_PKCSIZE )
479 #define OUT_LENGTH_DNS_Z _Out_ _Out_range_( 0, MAX_DNS_SIZE )
480 #define OUT_OPT_LENGTH_HASH_Z _Out_opt_ _Out_range_( 0, CRYPT_MAX_HASHSIZE )
481 #define OUT_LENGTH_PKC_Z _Out_ _Out_range_( 0, CRYPT_MAX_PKCSIZE )
482 #define OUT_LENGTH_INDEF _Out_ _Out_range_( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
483 #define OUT_OPT_LENGTH_INDEF _Out_opt_ _Out_range_( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
487 #define IN_LENGTH_ATTRIBUTE __in __in_range( 1, MAX_ATTRIBUTE_SIZE )
488 #define IN_LENGTH_DNS __in __in_range( 1, MAX_DNS_SIZE )
489 #define IN_LENGTH_DNS_Z __in __in_range( 0, MAX_DNS_SIZE )
490 #define IN_LENGTH_ERRORMESSAGE __in __in_range( 1, MAX_ERRORMESSAGE_SIZE )
491 #define IN_LENGTH_HASH __in __in_range( 16, CRYPT_MAX_HASHSIZE )
492 #define IN_LENGTH_INDEF __in __in_range( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
493 #define IN_LENGTH_IV __in __in_range( 1, CRYPT_MAX_IVSIZE )
494 #define IN_LENGTH_IV_Z __in __in_range( 0, CRYPT_MAX_IVSIZE )
495 #define IN_LENGTH_KEY __in __in_range( MIN_KEYSIZE, CRYPT_MAX_KEYSIZE )
496 #define IN_LENGTH_KEYID __in __in_range( MIN_NAME_LENGTH, MAX_ATTRIBUTE_SIZE )
497 #define IN_LENGTH_KEYID_Z __in __in_range( 0, MAX_ATTRIBUTE_SIZE )
498 #define IN_LENGTH_NAME __in __in_range( MIN_NAME_LENGTH, MAX_ATTRIBUTE_SIZE )
499 #define IN_LENGTH_NAME_Z __in __in_range( 0, MAX_ATTRIBUTE_SIZE )
500 #define IN_LENGTH_OID __in __in_range( 7, MAX_OID_SIZE )
501 #define IN_LENGTH_PKC __in __in_range( 1, CRYPT_MAX_PKCSIZE )
502 #define IN_LENGTH_PKC_Z __in __in_range( 0, CRYPT_MAX_PKCSIZE )
504 #define OUT_LENGTH_DNS_Z __out __out_range( 0, MAX_DNS_SIZE )
505 #define OUT_OPT_LENGTH_HASH_Z __out_opt __out_range( 0, CRYPT_MAX_HASHSIZE )
506 #define OUT_LENGTH_PKC_Z __out __out_range( 0, CRYPT_MAX_PKCSIZE )
507 #define OUT_LENGTH_INDEF __out __out_range( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
508 #define OUT_OPT_LENGTH_INDEF __out_opt __out_range( CRYPT_UNUSED, MAX_INTLENGTH - 1 )
525 #if VC_GE_2008( _MSC_VER )
527 #define IN_TAG _In_ _In_range_( DEFAULT_TAG, MAX_TAG_VALUE - 1 )
528 #define IN_TAG_EXT _In_ _In_range_( ANY_TAG, MAX_TAG_VALUE - 1 )
529 #define IN_TAG_ENCODED _In_ _In_range_( NO_TAG, MAX_TAG )
530 #define IN_TAG_ENCODED_EXT _In_ _In_range_( ANY_TAG, MAX_TAG )
532 #define OUT_TAG_Z _Out_ _Out_range_( 0, MAX_TAG_VALUE - 1 )
533 #define OUT_TAG_ENCODED_Z _Out_ _Out_range_( 0, MAX_TAG )
537 #define IN_TAG __in __in_range( DEFAULT_TAG, MAX_TAG_VALUE - 1 )
538 #define IN_TAG_EXT __in __in_range( ANY_TAG, MAX_TAG_VALUE - 1 )
539 #define IN_TAG_ENCODED __in __in_range( NO_TAG, MAX_TAG )
540 #define IN_TAG_ENCODED_EXT __in __in_range( ANY_TAG, MAX_TAG )
542 #define OUT_TAG_Z __out __out_range( 0, MAX_TAG_VALUE - 1 )
543 #define OUT_TAG_ENCODED_Z __out __out_range( 0, MAX_TAG )
557 #if VC_GE_2008( _MSC_VER )
559 #define IN_ENUM( name ) _In_ _In_range_( name##_NONE + 1, name##_LAST - 1 )
560 #define IN_ENUM_OPT( name ) _In_ _In_range_( name##_NONE, name##_LAST - 1 )
562 #define INOUT_ENUM( name ) _Inout_ \
563 _In_range_( name##_NONE + 1, name##_LAST - 1 ) \
564 _Out_range_( name##_NONE + 1, name##_LAST - 1 )
566 #define OUT_ENUM( name ) _Out_ _Out_range_( name##_NONE + 1, name##_LAST - 1 )
567 #define OUT_ENUM_OPT( name ) _Out_ _Out_range_( name##_NONE, name##_LAST - 1 )
571 #define IN_ENUM( name ) __in __in_range( name##_NONE + 1, name##_LAST - 1 )
572 #define IN_ENUM_OPT( name ) __in __in_range( name##_NONE, name##_LAST - 1 )
574 #define INOUT_ENUM( name ) __inout \
575 __in_range( name##_NONE + 1, name##_LAST - 1 ) \
576 __out_range( name##_NONE + 1, name##_LAST - 1 )
578 #define OUT_ENUM( name ) __out __out_range( name##_NONE + 1, name##_LAST - 1 )
579 #define OUT_ENUM_OPT( name ) __out __out_range( name##_NONE, name##_LAST - 1 )
587 #if VC_GE_2008( _MSC_VER )
589 #define IN_FLAGS( name ) _In_ _In_range_( 1, flags##_FLAG_MAX )
590 #define IN_FLAGS_Z( name ) _In_ _In_range_( flags##_FLAG_NONE, flags##_FLAG_MAX )
592 #define INOUT_FLAGS( name ) _Inout_ _Inout_range_( flags##_FLAG_NONE, flags##_FLAG_MAX )
594 #define OUT_FLAGS_Z( name ) _Out_ _Out_range_( flags##_FLAG_NONE, flags##_FLAG_MAX )
598 #define IN_FLAGS( name ) __in __in_range( 1, flags##_FLAG_MAX )
599 #define IN_FLAGS_Z( name ) __in __in_range( flags##_FLAG_NONE, flags##_FLAG_MAX )
601 #define INOUT_FLAGS( name ) __inout __inout_range( flags##_FLAG_NONE, flags##_FLAG_MAX )
603 #define OUT_FLAGS_Z( name ) __out __out_range( flags##_FLAG_NONE, flags##_FLAG_MAX )
620 #if VC_GE_2008( _MSC_VER )
625 #define _Inout_bytecap_post_bytecount_(cap,count) _Pre_valid_bytecap_(cap) \
626 _Post_bytecount_(count)
627 #define _Inout_bytecap_post_bytecount_c_(cap,count) _Pre_valid_bytecap_(cap) \
628 _Post_bytecount_c_(count)
630 #define _Out_bytecapcount_c_(count) _Pre_bytecap_c_(count) _Pre_invalid_ \
631 _Post_bytecount_c_(count)
632 #define _Out_bytecap_post_bytecount_c_(cap,count) _Pre_bytecap_(cap) _Pre_invalid_ \
633 _Post_bytecount_c_(count)
634 #define _Out_opt_bytecap_post_bytecount_c_(cap,count) _Pre_opt_bytecap_(cap) _Pre_invalid_ \
635 _Post_bytecount_c_(count)
637 #define IN_BUFFER( count ) _In_bytecount_( count )
638 #define IN_BUFFER_C( count ) _In_bytecount_c_( count )
639 #define IN_BUFFER_OPT( count ) _In_opt_bytecount_( count )
640 #define IN_BUFFER_OPT_C( count ) _In_opt_bytecount_c_( count )
642 #define INOUT_BUFFER( max, count ) _Inout_bytecap_post_bytecount_( max, count )
643 #define INOUT_BUFFER_C( max, count ) _Inout_bytecap_post_bytecount_c_( max, count )
644 #define INOUT_BUFFER_FIXED( count ) _Inout_bytecount_( count )
645 #define INOUT_BUFFER_OPT( max, count ) _Inout_opt_bytecap_( max, count )
647 #define OUT_BUFFER( max, count ) _Out_bytecap_post_bytecount_( max, count )
648 #define OUT_BUFFER_C( max, count ) _Out_bytecap_post_bytecount_c_( max, count )
649 #define OUT_BUFFER_OPT( max, count ) _Out_opt_bytecap_post_bytecount_( max, count )
650 #define OUT_BUFFER_OPT_C( max, count ) _Out_opt_bytecap_post_bytecount_c_( max, count )
651 #define OUT_BUFFER_FIXED( count ) _Out_bytecapcount_( count )
652 #define OUT_BUFFER_FIXED_C( count ) _Out_bytecapcount_c_( count )
653 #define OUT_BUFFER_OPT_FIXED( count ) _Out_opt_bytecapcount_( count )
657 #define IN_BUFFER( count ) __in_bcount( count )
658 #define IN_BUFFER_C( count ) __in_bcount( count )
659 #define IN_BUFFER_OPT( count ) __in_bcount_opt( count )
660 #define IN_BUFFER_OPT_C( count ) __in_bcount_opt( count )
662 #define INOUT_BUFFER( max, count ) __inout_bcount( max, count )
663 #define INOUT_BUFFER_C( max, count ) __inout_bcount( max, count )
664 #define INOUT_BUFFER_FIXED( count ) __inout_bcount_full( count )
665 #define INOUT_BUFFER_OPT( max, count ) __inout_bcount_opt( max, count )
667 #define OUT_BUFFER( max, count ) __out_bcount_part( max, count )
668 #define OUT_BUFFER_C( max, count ) __out_bcount_part( max, count )
669 #define OUT_BUFFER_OPT( max, count ) __out_bcount_part_opt( max, count )
670 #define OUT_BUFFER_OPT_C( max, count ) __out_bcount_part_opt( max, count )
671 #define OUT_BUFFER_FIXED( count ) __out_bcount_full( count )
672 #define OUT_BUFFER_FIXED_C( count ) __out_bcount_full( count )
673 #define OUT_BUFFER_OPT_FIXED( count ) __out_bcount_full_opt( count )
681 #if VC_GE_2008( _MSC_VER )
683 #define IN_ARRAY( count ) _In_count_( count )
684 #define IN_ARRAY_C( count ) _In_count_c_( count )
685 #define IN_ARRAY_OPT( count ) _In_opt_count_( count )
686 #define IN_ARRAY_OPT_C( count ) _In_opt_count_c_( count )
688 #define INOUT_ARRAY( count ) _Inout_cap_( count )
689 #define INOUT_ARRAY_C( count ) _Inout_cap_c_( count )
691 #define OUT_ARRAY( count ) _Out_cap_( count )
692 #define OUT_ARRAY_C( count ) _Out_cap_c_( count )
693 #define OUT_ARRAY_OPT( count ) _Out_opt_cap_( count )
694 #define OUT_ARRAY_OPT_C( count ) _Out_opt_cap_c_( count )
698 #define IN_ARRAY( count ) __in_ecount( count )
699 #define IN_ARRAY_C( count ) __in_ecount( count )
700 #define IN_ARRAY_OPT( count ) __in_ecount_opt( count )
701 #define IN_ARRAY_OPT_C( count ) __in_ecount_opt( count )
703 #define INOUT_ARRAY( count ) __inout_ecount( count )
704 #define INOUT_ARRAY_C( count ) __inout_ecount( count )
706 #define OUT_ARRAY( count ) __out_ecount( count )
707 #define OUT_ARRAY_C( count ) __out_ecount( count )
708 #define OUT_ARRAY_OPT( count ) __out_ecount_opt( count )
709 #define OUT_ARRAY_OPT_C( count ) __out_ecount_opt( count )
727 #if VC_GE_2008( _MSC_VER )
729 #define ARRAY( max, count )
730 #define ARRAY_FIXED( max )
731 #define BUFFER( max, count )
732 #define BUFFER_OPT( max, count )
733 #define BUFFER_FIXED( max )
734 #define BUFFER_OPT_FIXED( max )
735 #define BUFFER_UNSPECIFIED( max )
739 #define ARRAY( max, count ) __field_ecount_part( ( max ), ( count ) )
740 #define ARRAY_FIXED( max ) __field_ecount_full( max )
741 #define BUFFER( max, count ) __field_bcount_part( ( max ), ( count ) )
742 #define BUFFER_OPT( max, count ) __field_bcount_part_opt( ( max ), ( count ) )
743 #define BUFFER_FIXED( max ) __field_bcount_full( max )
744 #define BUFFER_OPT_FIXED( max ) __field_bcount_full_opt( max )
745 #define BUFFER_UNSPECIFIED( max ) __field_bcount( max )
766 #if VC_GE_2008( _MSC_VER )
769 #define OUT_BUFFER_ALLOC( length ) _Out_capcount_( length )
770 #define OUT_BUFFER_ALLOC_OPT( length ) _Out_opt_capcount_( length )
772 #define OUT_BUFFER_ALLOC( length ) _Deref_out_
773 #define OUT_BUFFER_ALLOC_OPT( length ) _Deref_out_opt_
778 #define OUT_BUFFER_ALLOC( length ) __deref_out_bcount_full( length )
779 #define OUT_BUFFER_ALLOC_OPT( length ) __deref_out_bcount_full_opt( length )
789 #if VC_GE_2008( _MSC_VER )
797 #define IN_OPT _In_opt_
798 #define INOUT _Inout_
799 #define INOUT_OPT _Inout_opt_
801 #define OUT_OPT _Out_opt_
806 #define IN_OPT __in_opt
807 #define INOUT __inout
808 #define INOUT_OPT __inout_opt
810 #define OUT_OPT __out_opt
816 #if VC_GE_2008( _MSC_VER )
818 #define INOUT_PTR _Deref_inout_bound_
821 #define OUT_PTR _Deref_out_
822 #define OUT_OPT_PTR _Deref_out_opt_
823 #define OUT_OPT_PTR_OPT _Deref_opt_out_opt_
827 #define INOUT_PTR __deref_inout
828 #define OUT_PTR __deref_out
829 #define OUT_OPT_PTR __deref_out_opt
830 #define OUT_OPT_PTR_OPT __deref_opt_out_opt
842 #if VC_GE_2008( _MSC_VER )
844 #define ANALYSER_HINT( expr ) __analysis_assume( expr )
847 #define CALLBACK_FUNCTION
848 #define FORMAT_STRING _Printf_format_string_
849 #define IN_STRING _In_z_
850 #define IN_STRING_OPT _In_opt_z_
851 #define TYPECAST( type )
855 #define ANALYSER_HINT( expr ) __analysis_assume( expr )
856 #define CALLBACK_FUNCTION __callback
857 #define FORMAT_STRING __format_string
858 #define IN_STRING __in_z
859 #define IN_STRING_OPT __in_z_opt
860 #define TYPECAST( type ) __typefix( type )
868 #if defined( _MSC_VER ) && !VC_16BIT( _MSC_VER )
870 #define STDC_NONNULL_ARG( argIndex )
871 #define STDC_PRINTF_FN( formatIndex, argIndex )
872 #define STDC_PURE __declspec( noalias )
873 #if defined( _MSC_VER ) && defined( _PREFAST_ )
880 #define STDC_UNUSED __reserved
894 #if defined( __GNUC__ ) && ( __GNUC__ >= 4 )
929 #define STDC_NONNULL_ARG( argIndex ) \
930 __attribute__(( nonnull argIndex ))
931 #define STDC_PRINTF_FN( formatIndex, argIndex ) \
932 __attribute__(( format( printf, formatIndex, argIndex ) ))
933 #define STDC_PURE __attribute__(( pure ))
934 #define STDC_UNUSED __attribute__(( unused ))
941 #define CHECK_RETVAL \
942 __attribute__(( warn_unused_result ))
943 #define CHECK_RETVAL_BOOL CHECK_RETVAL
944 #define CHECK_RETVAL_ENUM( name ) CHECK_RETVAL
945 #define CHECK_RETVAL_LENGTH CHECK_RETVAL
946 #define CHECK_RETVAL_PTR CHECK_RETVAL
947 #define CHECK_RETVAL_RANGE( low, high ) CHECK_RETVAL
948 #define CHECK_RETVAL_SPECIAL CHECK_RETVAL
949 #define CHECK_RETVAL_STRINGOP( length ) CHECK_RETVAL
951 #define CHECK_RETVAL_FNPTR CHECK_RETVAL
952 #define CHECK_RETVAL_BOOL_FNPTR CHECK_RETVAL
953 #define CHECK_RETVAL_LENGTH_FNPTR CHECK_RETVAL
954 #define CHECK_RETVAL_PTR_FNPTR CHECK_RETVAL
955 #define CHECK_RETVAL_SPECIAL_FNPTR CHECK_RETVAL
957 #define CHECK_RETVAL_ERROR CHECK_RETVAL
965 #if !( defined( USE_GCC_ATTRIBUTES ) || defined( __clang_analyzer__ ) )
966 #undef STDC_NONNULL_ARG
967 #define STDC_NONNULL_ARG( argIndex )
976 #ifdef __clang_analyzer__
984 void *_checked_malloc(
size_t size );
986 void _checked_free(
void *ptr );
988 #define malloc( x ) _checked_malloc( x )
989 #define free( x ) _checked_free( x )
992 int _checked_memcmp(
const void *ptr1,
const void *ptr2,
size_t num );
994 void *_checked_memcpy(
void *
dest,
const void *src,
size_t num );
996 void *_checked_memmove(
void *
dest,
const void *src,
size_t num );
998 void *_checked_memset(
void *ptr,
int value,
size_t num );
1000 #define memcmp( x, y, z ) _checked_memcmp( x, y, z )
1001 #define memcpy( x, y, z ) _checked_memcpy( x, y, z )
1002 #define memmove( x, y, z ) _checked_memmove( x, y, z )
1003 #define memset( x, y, z ) _checked_memset( x, y, z )
1008 #define ANALYSER_HINT( expr ) ENSURES( expr )
1018 #ifdef USE_GCC_ATTRIBUTES
1020 #define bos( x ) __builtin_object_size( x, 0 )
1023 #define memcpy( dest, src, count ) \
1024 __builtin___memcpy_chk( dest, src, count, bos( dest ) )
1026 #define memmove( dest, src, count ) \
1027 __builtin___memmove_chk( dest, src, count, bos( dest ) )
1029 #define memset( ptr, value, count ) \
1030 __builtin___memset_chk( ptr, value, count, bos( ptr ) )
1032 #define strcpy( dest, src ) \
1033 __builtin___strcpy_chk( dest, src, bos( dest ) )
1035 #define strncpy( dest, src, size ) \
1036 __builtin___strncpy_chk( dest, src, size, bos( dest ) )
1038 #define strcat( dest, src ) \
1039 __builtin___strcat_chk( dest, src, bos( dest ) )
1051 #ifndef CHECK_RETVAL
1053 #define CHECK_RETVAL
1054 #define CHECK_RETVAL_BOOL
1055 #define CHECK_RETVAL_ENUM( name )
1056 #define CHECK_RETVAL_LENGTH
1057 #define CHECK_RETVAL_PTR
1058 #define CHECK_RETVAL_RANGE( low, high )
1059 #define CHECK_RETVAL_SPECIAL
1060 #define CHECK_RETVAL_STRINGOP( length )
1062 #define CHECK_RETVAL_FNPTR
1063 #define CHECK_RETVAL_BOOL_FNPTR
1064 #define CHECK_RETVAL_LENGTH_FNPTR
1065 #define CHECK_RETVAL_PTR_FNPTR
1066 #define CHECK_RETVAL_SPECIAL_FNPTR
1068 #define CHECK_RETVAL_ERROR
1076 #define RETVAL_RANGE( low, high )
1078 #define RETVAL_FNPTR
1083 #define IN_INT_SHORT
1084 #define IN_INT_SHORT_Z
1086 #define OUT_INT_SHORT_Z
1087 #define OUT_OPT_INT_Z
1091 #define IN_ATTRIBUTE
1092 #define IN_ATTRIBUTE_OPT
1097 #define IN_HANDLE_OPT
1099 #define IN_KEYID_OPT
1105 #define IN_RANGE( min, max )
1106 #define IN_RANGE_FIXED( value )
1108 #define INOUT_HANDLE
1109 #define INOUT_RANGE( min, max )
1111 #define OUT_OPT_ALGO_Z
1112 #define OUT_ATTRIBUTE_Z
1113 #define OUT_OPT_ATTRIBUTE_Z
1115 #define OUT_OPT_BOOL
1116 #define OUT_OPT_BYTE
1118 #define OUT_HANDLE_OPT
1119 #define OUT_OPT_HANDLE_OPT
1121 #define OUT_RANGE( min, max )
1122 #define OUT_OPT_RANGE( min, max )
1126 #define IN_LENGTH_OPT
1127 #define IN_LENGTH_FIXED( size )
1128 #define IN_LENGTH_MIN( min )
1130 #define IN_LENGTH_SHORT
1131 #define IN_LENGTH_SHORT_MIN( min )
1132 #define IN_LENGTH_SHORT_OPT
1133 #define IN_LENGTH_SHORT_Z
1134 #define INOUT_LENGTH_Z
1135 #define INOUT_LENGTH_SHORT_Z
1137 #define OUT_LENGTH_Z
1138 #define OUT_OPT_LENGTH_Z
1139 #define OUT_LENGTH_SHORT
1140 #define OUT_OPT_LENGTH_SHORT_Z
1141 #define OUT_LENGTH_SHORT_Z
1143 #define IN_LENGTH_ATTRIBUTE
1144 #define IN_LENGTH_DNS
1145 #define IN_LENGTH_DNS_Z
1146 #define IN_LENGTH_ERRORMESSAGE
1147 #define IN_LENGTH_HASH
1148 #define IN_LENGTH_INDEF
1149 #define IN_LENGTH_IV
1150 #define IN_LENGTH_IV_Z
1151 #define IN_LENGTH_KEY
1152 #define IN_LENGTH_KEYID
1153 #define IN_LENGTH_KEYID_Z
1154 #define IN_LENGTH_NAME
1155 #define IN_LENGTH_NAME_Z
1156 #define IN_LENGTH_OID
1157 #define IN_LENGTH_PKC
1158 #define IN_LENGTH_PKC_Z
1159 #define OUT_LENGTH_DNS_Z
1160 #define OUT_OPT_LENGTH_HASH_Z
1161 #define OUT_LENGTH_PKC_Z
1162 #define OUT_LENGTH_INDEF
1163 #define OUT_OPT_LENGTH_INDEF
1167 #define IN_TAG_ENCODED
1168 #define IN_TAG_ENCODED_EXT
1170 #define OUT_TAG_ENCODED_Z
1172 #define IN_ENUM( name )
1173 #define IN_ENUM_OPT( name )
1174 #define INOUT_ENUM( name )
1175 #define OUT_ENUM( name )
1176 #define OUT_ENUM_OPT( name )
1178 #define IN_FLAGS( name )
1179 #define IN_FLAGS_Z( name )
1180 #define OUT_FLAGS_Z( name )
1182 #define IN_BUFFER( size )
1183 #define IN_BUFFER_C( size )
1184 #define IN_BUFFER_OPT( size )
1185 #define IN_BUFFER_OPT_C( count )
1186 #define INOUT_BUFFER( max, size )
1187 #define INOUT_BUFFER_C( max, size )
1188 #define INOUT_BUFFER_FIXED( size )
1189 #define INOUT_BUFFER_OPT( max, count )
1190 #define OUT_BUFFER( max, size )
1191 #define OUT_BUFFER_C( max, size )
1192 #define OUT_BUFFER_FIXED( max )
1193 #define OUT_BUFFER_FIXED_C( count )
1194 #define OUT_BUFFER_OPT( max, size )
1195 #define OUT_BUFFER_OPT_C( max, size )
1196 #define OUT_BUFFER_OPT_FIXED( max )
1198 #define IN_ARRAY( count )
1199 #define IN_ARRAY_C( count )
1200 #define IN_ARRAY_OPT( count )
1201 #define IN_ARRAY_OPT_C( count )
1202 #define INOUT_ARRAY( count )
1203 #define INOUT_ARRAY_C( count )
1204 #define OUT_ARRAY( count )
1205 #define OUT_ARRAY_C( count )
1206 #define OUT_ARRAY_OPT( count )
1207 #define OUT_ARRAY_OPT_C( count )
1209 #define ARRAY( max, count )
1210 #define ARRAY_FIXED( max )
1211 #define BUFFER( max, count )
1212 #define BUFFER_OPT( max, count )
1213 #define BUFFER_FIXED( max )
1214 #define BUFFER_OPT_FIXED( max )
1215 #define BUFFER_UNSPECIFIED( max )
1217 #define OUT_BUFFER_ALLOC( length )
1218 #define OUT_BUFFER_ALLOC_OPT( length )
1230 #define OUT_OPT_PTR_OPT
1232 #ifndef ANALYSER_HINT
1233 #define ANALYSER_HINT( expr )
1235 #if defined( __WINCE__ )
1238 #undef CALLBACK_FUNCTION
1240 #define CALLBACK_FUNCTION
1241 #define FORMAT_STRING
1243 #define IN_STRING_OPT
1244 #define TYPECAST( ctype )
1248 #ifndef STDC_NONNULL_ARG
1250 #define STDC_NONNULL_ARG( argIndex )
1251 #define STDC_PRINTF_FN( formatIndex, argIndex )