src/plugins/fcrypt/testmod_fcrypt.c
/**
 * @brief read in the content stored in file and compare it to the test vector.
 * @retval 1 if the file content is equal to the test vector.
 * @retval -1 if the file content is not equal to the test vector or an error occurred.
 */
@brief read in the content stored in file and compare it to the test vector.
@retval 1 if the file content is equal to the test vector.
@retval -1 if the file content is not equal to the test vector or an error occurred.
@brief read in the content stored in file and compare it to the test vector . @retval 1 if the file content is equal to the test vector . @retval - 1 if the file content is not equal to the test vector or an error occurred .
static int isTestFileCorrect (const char * file)
{
	int returnValue = -1;
	kdb_octet_t readBuffer[2 * sizeof (testContent)] = { 0 };
	size_t readCount = 0;
	FILE * f = fopen (file, "rb");
	succeed_if (f, "can not read from temporary file");
	if (!f) return -1;
	readCount = fread (readBuffer, 1, sizeof (readBuffer), f);
	succeed_if (readCount > 0, "temporary file is empty.");
	if (readCount == sizeof (testContent))
	{
		if (memcmp (readBuffer, testContent, sizeof (testContent)) == 0)
		{
			returnValue = 1;
		}
	}
	fclose (f);
	return returnValue;
}
static int isTestFileCorrect ( const char * file ) { int returnValue = -1 ; kdb_octet_t readBuffer [ 2 * sizeof ( testContent ) ] = { 0 } ; size_t readCount = 0 ; FILE * f = fopen ( file , " " ) ; succeed_if ( f , " " ) ; if ( ! f ) return -1 ; readCount = fread ( readBuffer , 1 , sizeof ( readBuffer ) , f ) ; succeed_if ( readCount > 0 , " " ) ; if ( readCount == sizeof ( testContent ) ) { if ( memcmp ( readBuffer , testContent , sizeof ( testContent ) ) == 0 ) { returnValue = 1 ; } } fclose ( f ) ; return returnValue ; }
@brief read in the content stored in file and compare it to the test vector.
@brief read in the content stored in file and compare it to the test vector .