1 /****************************************************************************
2 *																			*
3 *						 Internal Mechanism Header File						*
4 *						Copyright Peter Gutmann 1992-2008					*
5 *																			*
6 ****************************************************************************/
7 
8 #ifndef _MECH_INT_DEFINED
9 
10 #define _MECH_INT_DEFINED
11 
12 #ifndef _DEVMECH_DEFINED
13   #if defined( INC_ALL )
14 	#include "dev_mech.h"
15   #else
16 	#include "mechs/dev_mech.h"
17   #endif /* Compiler-specific includes */
18 #endif /* _DEVMECH_DEFINED */
19 
20 /* Prototypes for functions in mech_int.c */
21 
22 CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 3 ) ) \
23 int adjustPKCS1Data( OUT_BUFFER_FIXED( outDataMaxLen ) BYTE *outData,
24 					 IN_LENGTH_SHORT_MIN( CRYPT_MAX_PKCSIZE ) \
25 						const int outDataMaxLen,
26 					 IN_BUFFER( inLen ) const BYTE *inData,
27 					 IN_LENGTH_SHORT const int inLen,
28 					 IN_LENGTH_SHORT const int keySize );
29 CHECK_RETVAL STDC_NONNULL_ARG( ( 3 ) ) \
30 int getPkcAlgoParams( IN_HANDLE const CRYPT_CONTEXT pkcContext,
31 					  OUT_OPT_ALGO_Z CRYPT_ALGO_TYPE *pkcAlgo,
32 					  OUT_LENGTH_PKC_Z int *pkcKeySize );
33 CHECK_RETVAL STDC_NONNULL_ARG( ( 2 ) ) \
34 int getHashAlgoParams( IN_HANDLE const CRYPT_CONTEXT hashContext,
35 					   OUT_ALGO_Z CRYPT_ALGO_TYPE *hashAlgo,
36 					   OUT_OPT_LENGTH_HASH_Z int *hashSize );
37 
38 /* Prototypes for kernel-internal access functions.  This is a bit of an odd
39    place to have them but we need to have a prototype visible to both the
40    mechanism code where they're called and the kernel code */
41 
42 CHECK_RETVAL STDC_NONNULL_ARG( ( 2, 4 ) ) \
43 int extractKeyData( IN_HANDLE const CRYPT_CONTEXT iCryptContext,
44 					OUT_BUFFER_FIXED( keyDataLen ) void *keyData,
45 					IN_LENGTH_SHORT_MIN( MIN_KEYSIZE ) const int keyDataLen,
46 					IN_BUFFER( accessKeyLen ) const char *accessKey,
47 					IN_LENGTH_FIXED( 7 ) const int accessKeyLen );
48 #ifdef _STREAM_DEFINED
49 CHECK_RETVAL STDC_NONNULL_ARG( ( 1 ) ) \
50 int importPrivateKeyData( INOUT STREAM *stream,
51 						  IN_HANDLE const CRYPT_CONTEXT iCryptContext,
52 						  IN_ENUM( KEYFORMAT ) \
53 							const KEYFORMAT_TYPE formatType );
54 CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 4 ) ) \
55 int exportPrivateKeyData( INOUT STREAM *stream,
56 						  IN_HANDLE const CRYPT_CONTEXT iCryptContext,
57 						  IN_ENUM( KEYFORMAT ) \
58 							const KEYFORMAT_TYPE formatType,
59 						  IN_BUFFER( accessKeyLen ) const char *accessKey,
60 						  IN_LENGTH_FIXED( 11 ) const int accessKeyLen );
61 #endif /* _STREAM_DEFINED */
62 
63 #endif /* _MECH_INT_DEFINED */
64