cryptlib  3.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
Classes | Macros
crypt.h File Reference
#include <stdlib.h>
#include <string.h>
#include "cryptlib.h"
#include "misc/os_spec.h"
#include "misc/analyse.h"
#include "misc/config.h"
#include "cryptkrn.h"
#include "misc/consts.h"
#include "misc/int_api.h"
#include "misc/debug.h"

Go to the source code of this file.

Classes

struct  QUERY_INFO
 
struct  DLP_PARAMS
 
struct  KEYAGREE_PARAMS
 

Macros

#define __STDC_WANT_LIB_EXT1__   1
 
#define mgetLong(memPtr)
 
#define mputLong(memPtr, data)
 
#define setDLPParams(dlpDataPtr, dataIn, dataInLen, dataOut, dataOutLen)
 
#define UNUSED_ARG(arg)   ( ( arg ) = ( arg ) )
 
#define min(a, b)   ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
 
#define max(a, b)   ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
 
#define bitsToBytes(bits)   ( ( ( bits ) + 7 ) >> 3 )
 
#define bytesToBits(bytes)   ( ( bytes ) << 3 )
 
#define MKDATA(x)   ( ( unsigned char * ) ( x ) )
 
#define roundUp(size, roundSize)   ( ( ( size ) + ( ( roundSize ) - 1 ) ) & ~( ( roundSize ) - 1 ) )
 
#define zeroise(memory, size)   memset( memory, 0, size )
 
#define isHandleRangeValid(handle)   ( ( handle ) > NO_SYSTEM_OBJECTS - 1 && ( handle ) < MAX_OBJECTS )
 
#define needsIV(mode)
 
#define isStreamCipher(algorithm)   ( ( algorithm ) == CRYPT_ALGO_RC4 )
 
#define isWeakCryptAlgo(algorithm)
 
#define isWeakHashAlgo(algorithm)   ( ( algorithm ) == CRYPT_ALGO_MD5 )
 
#define isWeakMacAlgo(algorithm)   ( ( algorithm ) == CRYPT_ALGO_HMAC_MD5 )
 
#define isConvAlgo(algorithm)
 
#define isPkcAlgo(algorithm)
 
#define isHashAlgo(algorithm)
 
#define isMacAlgo(algorithm)
 
#define isSpecialAlgo(algorithm)   ( ( algorithm ) == CRYPT_IALGO_GENERIC_SECRET )
 
#define isSigAlgo(algorithm)
 
#define isCryptAlgo(algorithm)   ( ( algorithm ) == CRYPT_ALGO_RSA || ( algorithm ) == CRYPT_ALGO_ELGAMAL )
 
#define isKeyxAlgo(algorithm)   ( ( algorithm ) == CRYPT_ALGO_DH || ( algorithm ) == CRYPT_ALGO_ECDH )
 
#define isDlpAlgo(algorithm)
 
#define isEccAlgo(algorithm)   ( ( algorithm ) == CRYPT_ALGO_ECDSA || ( algorithm ) == CRYPT_ALGO_ECDH )
 
#define isParameterisedConvAlgo(algorithm)   ( ( algorithm ) == CRYPT_ALGO_AES )
 
#define isParameterisedHashAlgo(algorithm)   ( ( algorithm ) == CRYPT_ALGO_SHA2 || ( algorithm ) == CRYPT_ALGO_SHAng )
 
#define isParameterisedMacAlgo(algorithm)
 
#define isDataError(status)
 
#define isShortPKCKey(keySize)
 
#define isShortECCKey(keySize)
 
#define rangeCheck(start, length, totalLength)
 
#define rangeCheckZ(start, length, totalLength)
 
#define isReadPtr(ptr, size)   ( ( ptr ) != NULL && ( size ) > 0 )
 
#define isWritePtr(ptr, size)   ( ( ptr ) != NULL && ( size ) > 0 )
 
#define isReadPtrConst(ptr, type)   ( ( ptr ) != NULL )
 
#define isWritePtrConst(ptr, type)   ( ( ptr ) != NULL )
 
#define byteToInt(x)   ( ( unsigned char ) ( x ) )
 
#define intToLong(x)   ( ( unsigned int ) ( x ) )
 
#define sizeToInt(x)   ( ( unsigned int ) ( x ) )
 
#define intToByte(x)   ( ( unsigned char ) ( x ) )
 
#define clearErrorInfo(objectInfoPtr)
 
#define setErrorInfo(objectInfoPtr, locus, type)
 

Macro Definition Documentation

#define __STDC_WANT_LIB_EXT1__   1

Definition at line 41 of file crypt.h.

#define bitsToBytes (   bits)    ( ( ( bits ) + 7 ) >> 3 )

Definition at line 496 of file crypt.h.

#define bytesToBits (   bytes)    ( ( bytes ) << 3 )

Definition at line 497 of file crypt.h.

#define byteToInt (   x)    ( ( unsigned char ) ( x ) )

Definition at line 782 of file crypt.h.

#define clearErrorInfo (   objectInfoPtr)
Value:
{ \
( objectInfoPtr )->errorLocus = CRYPT_ATTRIBUTE_NONE; \
( objectInfoPtr )->errorType = CRYPT_OK; \
}

Definition at line 790 of file crypt.h.

#define intToByte (   x)    ( ( unsigned char ) ( x ) )

Definition at line 786 of file crypt.h.

#define intToLong (   x)    ( ( unsigned int ) ( x ) )

Definition at line 783 of file crypt.h.

#define isConvAlgo (   algorithm)
Value:

Definition at line 570 of file crypt.h.

#define isCryptAlgo (   algorithm)    ( ( algorithm ) == CRYPT_ALGO_RSA || ( algorithm ) == CRYPT_ALGO_ELGAMAL )

Definition at line 597 of file crypt.h.

#define isDataError (   status)
Value:

Definition at line 629 of file crypt.h.

#define isDlpAlgo (   algorithm)
Value:

Definition at line 601 of file crypt.h.

#define isEccAlgo (   algorithm)    ( ( algorithm ) == CRYPT_ALGO_ECDSA || ( algorithm ) == CRYPT_ALGO_ECDH )

Definition at line 604 of file crypt.h.

#define isHandleRangeValid (   handle)    ( ( handle ) > NO_SYSTEM_OBJECTS - 1 && ( handle ) < MAX_OBJECTS )

Definition at line 535 of file crypt.h.

#define isHashAlgo (   algorithm)
Value:

Definition at line 576 of file crypt.h.

#define isKeyxAlgo (   algorithm)    ( ( algorithm ) == CRYPT_ALGO_DH || ( algorithm ) == CRYPT_ALGO_ECDH )

Definition at line 599 of file crypt.h.

#define isMacAlgo (   algorithm)
Value:

Definition at line 579 of file crypt.h.

#define isParameterisedConvAlgo (   algorithm)    ( ( algorithm ) == CRYPT_ALGO_AES )

Definition at line 610 of file crypt.h.

#define isParameterisedHashAlgo (   algorithm)    ( ( algorithm ) == CRYPT_ALGO_SHA2 || ( algorithm ) == CRYPT_ALGO_SHAng )

Definition at line 612 of file crypt.h.

#define isParameterisedMacAlgo (   algorithm)
Value:

Definition at line 614 of file crypt.h.

#define isPkcAlgo (   algorithm)
Value:

Definition at line 573 of file crypt.h.

#define isReadPtr (   ptr,
  size 
)    ( ( ptr ) != NULL && ( size ) > 0 )

Definition at line 768 of file crypt.h.

#define isReadPtrConst (   ptr,
  type 
)    ( ( ptr ) != NULL )

Definition at line 770 of file crypt.h.

#define isShortECCKey (   keySize)
Value:

Definition at line 646 of file crypt.h.

#define isShortPKCKey (   keySize)
Value:

Definition at line 643 of file crypt.h.

#define isSigAlgo (   algorithm)
Value:

Definition at line 594 of file crypt.h.

#define isSpecialAlgo (   algorithm)    ( ( algorithm ) == CRYPT_IALGO_GENERIC_SECRET )

Definition at line 582 of file crypt.h.

#define isStreamCipher (   algorithm)    ( ( algorithm ) == CRYPT_ALGO_RC4 )

Definition at line 549 of file crypt.h.

#define isWeakCryptAlgo (   algorithm)
Value:

Definition at line 560 of file crypt.h.

#define isWeakHashAlgo (   algorithm)    ( ( algorithm ) == CRYPT_ALGO_MD5 )

Definition at line 563 of file crypt.h.

#define isWeakMacAlgo (   algorithm)    ( ( algorithm ) == CRYPT_ALGO_HMAC_MD5 )

Definition at line 564 of file crypt.h.

#define isWritePtr (   ptr,
  size 
)    ( ( ptr ) != NULL && ( size ) > 0 )

Definition at line 769 of file crypt.h.

#define isWritePtrConst (   ptr,
  type 
)    ( ( ptr ) != NULL )

Definition at line 772 of file crypt.h.

#define max (   a,
 
)    ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )

Definition at line 489 of file crypt.h.

#define mgetLong (   memPtr)
Value:
( ( ( unsigned long ) memPtr[ 0 ] << 24 ) | \
( ( unsigned long ) memPtr[ 1 ] << 16 ) | \
( ( unsigned long ) memPtr[ 2 ] << 8 ) | \
( unsigned long ) memPtr[ 3 ] ); \
memPtr += 4

Definition at line 325 of file crypt.h.

#define min (   a,
 
)    ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )

Definition at line 488 of file crypt.h.

#define MKDATA (   x)    ( ( unsigned char * ) ( x ) )

Definition at line 504 of file crypt.h.

#define mputLong (   memPtr,
  data 
)
Value:
memPtr[ 0 ] = ( BYTE ) ( ( ( data ) >> 24 ) & 0xFF ); \
memPtr[ 1 ] = ( BYTE ) ( ( ( data ) >> 16 ) & 0xFF ); \
memPtr[ 2 ] = ( BYTE ) ( ( ( data ) >> 8 ) & 0xFF ); \
memPtr[ 3 ] = ( BYTE ) ( ( data ) & 0xFF ); \
memPtr += 4

Definition at line 332 of file crypt.h.

#define needsIV (   mode)
Value:
( ( mode ) == CRYPT_MODE_CBC || \
( mode ) == CRYPT_MODE_CFB || \
( mode ) == CRYPT_MODE_OFB || \

Definition at line 540 of file crypt.h.

#define rangeCheck (   start,
  length,
  totalLength 
)
Value:
( ( start ) <= 0 || ( length ) < 1 || \
( start ) + ( length ) > ( totalLength ) ) ? FALSE : TRUE

Definition at line 658 of file crypt.h.

#define rangeCheckZ (   start,
  length,
  totalLength 
)
Value:
( ( start ) < 0 || ( length ) < 1 || \
( start ) + ( length ) > ( totalLength ) ) ? FALSE : TRUE

Definition at line 661 of file crypt.h.

#define roundUp (   size,
  roundSize 
)    ( ( ( size ) + ( ( roundSize ) - 1 ) ) & ~( ( roundSize ) - 1 ) )

Definition at line 509 of file crypt.h.

#define setDLPParams (   dlpDataPtr,
  dataIn,
  dataInLen,
  dataOut,
  dataOutLen 
)
Value:
{ \
memset( ( dlpDataPtr ), 0, sizeof( DLP_PARAMS ) ); \
( dlpDataPtr )->formatType = CRYPT_FORMAT_CRYPTLIB; \
( dlpDataPtr )->inParam1 = ( dataIn ); \
( dlpDataPtr )->inLen1 = ( dataInLen ); \
( dlpDataPtr )->outParam = ( dataOut ); \
( dlpDataPtr )->outLen = ( dataOutLen ); \
}

Definition at line 434 of file crypt.h.

#define setErrorInfo (   objectInfoPtr,
  locus,
  type 
)
Value:
{ \
( objectInfoPtr )->errorLocus = locus; \
( objectInfoPtr )->errorType = type; \
}

Definition at line 796 of file crypt.h.

#define sizeToInt (   x)    ( ( unsigned int ) ( x ) )

Definition at line 785 of file crypt.h.

#define UNUSED_ARG (   arg)    ( ( arg ) = ( arg ) )

Definition at line 477 of file crypt.h.

#define zeroise (   memory,
  size 
)    memset( memory, 0, size )

Definition at line 526 of file crypt.h.