/*----------------------------------------------------------------------- * File: CSM_VECT.H * * Copyright (c) 1995-2000 Intel Corporation. All rights reserved. *----------------------------------------------------------------------- */ #ifndef __CSM_VECT_H__ #define __CSM_VECT_H__ #ifdef _DEBUG #define __CSM_VECTOR_MAGIC_NUMBER ( 0x12121977 ) #define ASSERT_VALID_CSM_VECTOR( _pvect_ ) \ assert( ( _pvect_ ) && ( (*(uint32*)(_pvect_)) == __CSM_VECTOR_MAGIC_NUMBER ) ) #else #define ASSERT_VALID_CSM_VECTOR( _pvect_ ) #endif typedef struct _csm_vector { #ifdef _DEBUG uint32 __MagicNumber; #endif CSSM_BOOL bInputVector; /* Is this vector being used as an * input or an output vector. */ CSSM_CSP_HANDLE CSPHandle; /* CSP handle used to allocate or * deallocate memory. */ CSSM_DATA *Buffers; /* New vector data. */ uint32 uNumBuffers; /* Number of new vector buffers */ CSSM_BOOL bAllocateBuffers; /* Whether or not the buffers are * pre-allocated. */ CSSM_DATA *Overflow; /* Overflow buffer for output vectors. * Common use will be for the RemData * parameter to single staged * Encrypt/DecryptData. */ CSSM_BOOL bAllocatedOverflow; /* Whether or not the CSP allocated * the overflow buffer. */ uint32 uIndex; /* Index into the buffer array for * inserting data. Unused for input * vectors. */ uint32 uOffset; /* Offset into the current buffer for * extracting or inserting data. If * the buffer is initialized as an * input buffer, then this is an index * into the composite buffer * constructed from the input buffers. */ CSSM_DATA TempBuffer; /* Used to track the temporary buffer * allocated to return a block built * from multiple buffers. */ } CSM_VECTOR; #define CSM_VECTOR_OVERFLOW_BUFFER ( (uint32)(~0) - 1 ) #define CSM_VECTOR_ATTEMPT_TO_OVERFILL ( (uint32)(~0) ) #define CSMR_NO_MORE_DATA ((CSSM_RETURN)( MAF_INTERNAL_ERROR_BASE + 1 )) #define CSMR_VALUE_RANGE ((CSSM_RETURN)( MAF_INTERNAL_ERROR_BASE + 2 )) CSSM_RETURN CSM_CreateVector( CSSM_CSP_HANDLE CSPHandle, CSM_VECTOR *pNewVector, CSSM_BOOL bInput, const CSSM_DATA *pNewBuffers, uint32 uNumNewBuffers, CSSM_DATA *pOverflow ); CSSM_RETURN CSM_DeleteVector( CSM_VECTOR *pDoomedVector, CSSM_BOOL bDeallocate ); CSSM_RETURN CSM_GetVectorLength( const CSM_VECTOR *pVector, uint32 *puLength ); CSSM_RETURN CSM_GetVectorIndex( const CSM_VECTOR *pVector, uint32 *puCurrentIndex ); CSSM_RETURN CSM_GetVectorSize( const CSM_VECTOR *pVector, uint32 *puSize ); CSSM_RETURN CSM_GuaranteeVectorSpace( CSM_VECTOR *pVector, uint32 uNeedSpace ); CSSM_RETURN CSM_AppendVectorData( CSM_VECTOR *pVector, const CSSM_DATA *pNewData ); CSSM_RETURN CSM_GetVectorBuffer( const CSM_VECTOR *pVector, uint32 BufferIndex, CSSM_DATA *pBuffer ); CSSM_RETURN CSM_GetBlockLengthVectorBuffer( CSM_VECTOR *pVector, uint32 uBlockSize, CSSM_DATA *pBuffer ); CSSM_RETURN CSM_PopulateVector( CSM_VECTOR *pVector, const CSSM_DATA *pNewData ); CSSM_RETURN CSM_FetchExtraVectorData( CSM_VECTOR *pVector, CSSM_DATA *pBuffer ); #endif /* ifndef __CSM_VECT_H__ */