You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-29 22:28:02 +02:00
Rename CipherError to CryptoError.
This aligns with the general renaming from cipher to crypto.
This commit is contained in:
@@ -77,7 +77,7 @@ file-exists: 93
|
||||
# Memory allocation failed
|
||||
memory: 94
|
||||
|
||||
cipher: 95
|
||||
crypto: 95
|
||||
param-invalid: 96
|
||||
|
||||
# Unable to close a path
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
<release-item>
|
||||
<p>Add <code>cryptoError()</code> and update crypto code to use it.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Rename <code>CipherError</code> to <code>CryptoError</code>.</p>
|
||||
</release-item>
|
||||
</release-development-list>
|
||||
</release-core-list>
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ sub new
|
||||
confess &log(ERROR, $strArchiveInfoMissingMsg, ERROR_FILE_MISSING);
|
||||
}
|
||||
}
|
||||
elsif ($iResult == ERROR_CIPHER && $strResultMessage =~ "^unable to flush")
|
||||
elsif ($iResult == ERROR_CRYPTO && $strResultMessage =~ "^unable to flush")
|
||||
{
|
||||
confess &log(ERROR, "unable to parse '$strArchiveInfoFile'\nHINT: Is or was the repo encrypted?", $iResult);
|
||||
}
|
||||
@@ -416,7 +416,7 @@ sub reconstruct
|
||||
if (!storageRepo()->encryptionValid(storageRepo()->encrypted($strArchiveFilePath)))
|
||||
{
|
||||
confess &log(ERROR, "encryption incompatible for '$strArchiveFilePath'" .
|
||||
"\nHINT: Is or was the repo encrypted?", ERROR_CIPHER);
|
||||
"\nHINT: Is or was the repo encrypted?", ERROR_CRYPTO);
|
||||
}
|
||||
|
||||
# If the file is encrypted, then the passprase from the info file is required, else getEncryptionKeySub returns undefined
|
||||
|
||||
@@ -163,7 +163,7 @@ sub new
|
||||
confess &log(ERROR, "${strBackupClusterPath}/$strBackupInfoMissingMsg", ERROR_FILE_MISSING);
|
||||
}
|
||||
}
|
||||
elsif ($iResult == ERROR_CIPHER && $strResultMessage =~ "^unable to flush")
|
||||
elsif ($iResult == ERROR_CRYPTO && $strResultMessage =~ "^unable to flush")
|
||||
{
|
||||
confess &log(ERROR, "unable to parse '$strBackupInfoFile'\nHINT: Is or was the repo encrypted?", $iResult);
|
||||
}
|
||||
|
||||
@@ -157,8 +157,8 @@ use constant ERROR_FILE_EXISTS => 93;
|
||||
push @EXPORT, qw(ERROR_FILE_EXISTS);
|
||||
use constant ERROR_MEMORY => 94;
|
||||
push @EXPORT, qw(ERROR_MEMORY);
|
||||
use constant ERROR_CIPHER => 95;
|
||||
push @EXPORT, qw(ERROR_CIPHER);
|
||||
use constant ERROR_CRYPTO => 95;
|
||||
push @EXPORT, qw(ERROR_CRYPTO);
|
||||
use constant ERROR_PARAM_INVALID => 96;
|
||||
push @EXPORT, qw(ERROR_PARAM_INVALID);
|
||||
use constant ERROR_PATH_CLOSE => 97;
|
||||
|
||||
@@ -107,7 +107,7 @@ sub new
|
||||
|
||||
if (defined($self->{oStorage}->cipherPassUser()) && !defined($self->{strCipherPass}))
|
||||
{
|
||||
confess &log(ERROR, 'passphrase is required when storage is encrypted', ERROR_CIPHER);
|
||||
confess &log(ERROR, 'passphrase is required when storage is encrypted', ERROR_CRYPTO);
|
||||
}
|
||||
|
||||
# Set changed to false
|
||||
@@ -188,7 +188,7 @@ sub loadVersion
|
||||
else
|
||||
{
|
||||
confess &log(ERROR, "unable to parse '$self->{strFileName}" . ($bCopy ? INI_COPY_EXT : '') . "'" .
|
||||
"\nHINT: Is or was the repo encrypted?", ERROR_CIPHER);
|
||||
"\nHINT: Is or was the repo encrypted?", ERROR_CRYPTO);
|
||||
}
|
||||
|
||||
return defined($self->{oContent});
|
||||
|
||||
@@ -555,12 +555,12 @@ sub backupList
|
||||
{
|
||||
return;
|
||||
}
|
||||
elsif (exceptionCode($EVAL_ERROR) == ERROR_CIPHER)
|
||||
elsif (exceptionCode($EVAL_ERROR) == ERROR_CRYPTO)
|
||||
{
|
||||
# Confess the encryption error with additional hint
|
||||
confess &log(ERROR, exceptionMessage($EVAL_ERROR) .
|
||||
"\nHINT: use option --stanza if encryption settings are different for the stanza than the global settings",
|
||||
ERROR_CIPHER);
|
||||
ERROR_CRYPTO);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -600,7 +600,7 @@ sub infoObject
|
||||
else
|
||||
{
|
||||
# Confess unhandled exception
|
||||
if (($iResult != ERROR_FILE_MISSING) && ($iResult != ERROR_CIPHER))
|
||||
if (($iResult != ERROR_FILE_MISSING) && ($iResult != ERROR_CRYPTO))
|
||||
{
|
||||
confess &log(ERROR, $strResultMessage, $iResult);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ ERROR_DEFINE( 91, GroupMissingError, RuntimeError);
|
||||
ERROR_DEFINE( 92, PathExistsError, RuntimeError);
|
||||
ERROR_DEFINE( 93, FileExistsError, RuntimeError);
|
||||
ERROR_DEFINE( 94, MemoryError, RuntimeError);
|
||||
ERROR_DEFINE( 95, CipherError, RuntimeError);
|
||||
ERROR_DEFINE( 95, CryptoError, RuntimeError);
|
||||
ERROR_DEFINE( 96, ParamInvalidError, RuntimeError);
|
||||
ERROR_DEFINE( 97, PathCloseError, RuntimeError);
|
||||
ERROR_DEFINE( 98, FileInfoError, RuntimeError);
|
||||
@@ -160,7 +160,7 @@ static const ErrorType *errorTypeList[] =
|
||||
&PathExistsError,
|
||||
&FileExistsError,
|
||||
&MemoryError,
|
||||
&CipherError,
|
||||
&CryptoError,
|
||||
&ParamInvalidError,
|
||||
&PathCloseError,
|
||||
&FileInfoError,
|
||||
|
||||
@@ -78,7 +78,7 @@ ERROR_DECLARE(GroupMissingError);
|
||||
ERROR_DECLARE(PathExistsError);
|
||||
ERROR_DECLARE(FileExistsError);
|
||||
ERROR_DECLARE(MemoryError);
|
||||
ERROR_DECLARE(CipherError);
|
||||
ERROR_DECLARE(CryptoError);
|
||||
ERROR_DECLARE(ParamInvalidError);
|
||||
ERROR_DECLARE(PathCloseError);
|
||||
ERROR_DECLARE(FileInfoError);
|
||||
|
||||
@@ -187,7 +187,7 @@ cipherBlockProcess(CipherBlock *this, const unsigned char *source, size_t source
|
||||
// The first bytes of the file to decrypt should be equal to the magic. If not then this is not an
|
||||
// encrypted file, or at least not in a format we recognize.
|
||||
if (memcmp(this->header, CIPHER_BLOCK_MAGIC, CIPHER_BLOCK_MAGIC_SIZE) != 0)
|
||||
THROW(CipherError, "cipher header invalid");
|
||||
THROW(CryptoError, "cipher header invalid");
|
||||
}
|
||||
// Else copy what was provided into the header buffer and return 0
|
||||
else
|
||||
@@ -265,11 +265,11 @@ cipherBlockFlush(CipherBlock *this, unsigned char *destination)
|
||||
|
||||
// If no header was processed then error
|
||||
if (!this->saltDone)
|
||||
THROW(CipherError, "cipher header missing");
|
||||
THROW(CryptoError, "cipher header missing");
|
||||
|
||||
// Only flush remaining data if some data was processed
|
||||
if (!EVP_CipherFinal(this->cipherContext, destination, (int *)&destinationSize))
|
||||
THROW(CipherError, "unable to flush");
|
||||
THROW(CryptoError, "unable to flush");
|
||||
|
||||
// Return actual destination size
|
||||
FUNCTION_DEBUG_RESULT(SIZE, destinationSize);
|
||||
|
||||
@@ -29,7 +29,7 @@ cryptoError(bool error, const char *description)
|
||||
if (error)
|
||||
{
|
||||
const char *errorMessage = ERR_reason_error_string(ERR_get_error());
|
||||
THROW_FMT(CipherError, "%s: %s", description, errorMessage == NULL ? "no details available" : errorMessage);
|
||||
THROW_FMT(CryptoError, "%s: %s", description, errorMessage == NULL ? "no details available" : errorMessage);
|
||||
}
|
||||
|
||||
FUNCTION_TEST_RESULT_VOID();
|
||||
|
||||
@@ -1017,7 +1017,7 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"confess &log(ERROR, $strArchiveInfoMissingMsg, ERROR_FILE_MISSING);\n"
|
||||
"}\n"
|
||||
"}\n"
|
||||
"elsif ($iResult == ERROR_CIPHER && $strResultMessage =~ \"^unable to flush\")\n"
|
||||
"elsif ($iResult == ERROR_CRYPTO && $strResultMessage =~ \"^unable to flush\")\n"
|
||||
"{\n"
|
||||
"confess &log(ERROR, \"unable to parse '$strArchiveInfoFile'\\nHINT: Is or was the repo encrypted?\", $iResult);\n"
|
||||
"}\n"
|
||||
@@ -1263,7 +1263,7 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"if (!storageRepo()->encryptionValid(storageRepo()->encrypted($strArchiveFilePath)))\n"
|
||||
"{\n"
|
||||
"confess &log(ERROR, \"encryption incompatible for '$strArchiveFilePath'\" .\n"
|
||||
"\"\\nHINT: Is or was the repo encrypted?\", ERROR_CIPHER);\n"
|
||||
"\"\\nHINT: Is or was the repo encrypted?\", ERROR_CRYPTO);\n"
|
||||
"}\n"
|
||||
"\n\n"
|
||||
"my $oFileIo = storageRepo()->openRead(\n"
|
||||
@@ -3882,7 +3882,7 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"confess &log(ERROR, \"${strBackupClusterPath}/$strBackupInfoMissingMsg\", ERROR_FILE_MISSING);\n"
|
||||
"}\n"
|
||||
"}\n"
|
||||
"elsif ($iResult == ERROR_CIPHER && $strResultMessage =~ \"^unable to flush\")\n"
|
||||
"elsif ($iResult == ERROR_CRYPTO && $strResultMessage =~ \"^unable to flush\")\n"
|
||||
"{\n"
|
||||
"confess &log(ERROR, \"unable to parse '$strBackupInfoFile'\\nHINT: Is or was the repo encrypted?\", $iResult);\n"
|
||||
"}\n"
|
||||
@@ -5206,8 +5206,8 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"push @EXPORT, qw(ERROR_FILE_EXISTS);\n"
|
||||
"use constant ERROR_MEMORY => 94;\n"
|
||||
"push @EXPORT, qw(ERROR_MEMORY);\n"
|
||||
"use constant ERROR_CIPHER => 95;\n"
|
||||
"push @EXPORT, qw(ERROR_CIPHER);\n"
|
||||
"use constant ERROR_CRYPTO => 95;\n"
|
||||
"push @EXPORT, qw(ERROR_CRYPTO);\n"
|
||||
"use constant ERROR_PARAM_INVALID => 96;\n"
|
||||
"push @EXPORT, qw(ERROR_PARAM_INVALID);\n"
|
||||
"use constant ERROR_PATH_CLOSE => 97;\n"
|
||||
@@ -5726,7 +5726,7 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"\n"
|
||||
"if (defined($self->{oStorage}->cipherPassUser()) && !defined($self->{strCipherPass}))\n"
|
||||
"{\n"
|
||||
"confess &log(ERROR, 'passphrase is required when storage is encrypted', ERROR_CIPHER);\n"
|
||||
"confess &log(ERROR, 'passphrase is required when storage is encrypted', ERROR_CRYPTO);\n"
|
||||
"}\n"
|
||||
"\n\n"
|
||||
"$self->{bModified} = false;\n"
|
||||
@@ -5795,7 +5795,7 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"else\n"
|
||||
"{\n"
|
||||
"confess &log(ERROR, \"unable to parse '$self->{strFileName}\" . ($bCopy ? INI_COPY_EXT : '') . \"'\" .\n"
|
||||
"\"\\nHINT: Is or was the repo encrypted?\", ERROR_CIPHER);\n"
|
||||
"\"\\nHINT: Is or was the repo encrypted?\", ERROR_CRYPTO);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"return defined($self->{oContent});\n"
|
||||
@@ -10796,12 +10796,12 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"{\n"
|
||||
"return;\n"
|
||||
"}\n"
|
||||
"elsif (exceptionCode($EVAL_ERROR) == ERROR_CIPHER)\n"
|
||||
"elsif (exceptionCode($EVAL_ERROR) == ERROR_CRYPTO)\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"confess &log(ERROR, exceptionMessage($EVAL_ERROR) .\n"
|
||||
"\"\\nHINT: use option --stanza if encryption settings are different for the stanza than the global settings\",\n"
|
||||
"ERROR_CIPHER);\n"
|
||||
"ERROR_CRYPTO);\n"
|
||||
"}\n"
|
||||
"else\n"
|
||||
"{\n"
|
||||
@@ -17533,7 +17533,7 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"else\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"if (($iResult != ERROR_FILE_MISSING) && ($iResult != ERROR_CIPHER))\n"
|
||||
"if (($iResult != ERROR_FILE_MISSING) && ($iResult != ERROR_CRYPTO))\n"
|
||||
"{\n"
|
||||
"confess &log(ERROR, $strResultMessage, $iResult);\n"
|
||||
"}\n"
|
||||
|
||||
@@ -108,7 +108,7 @@ sub run
|
||||
# Prepend encryption Magic signature to simulate encryption
|
||||
executeTest('echo "' . CIPHER_MAGIC . '$(cat ' . $strArchiveFile . ')" > ' . $strArchiveFile);
|
||||
|
||||
$self->testException(sub {$oArchiveInfo->reconstruct(PG_VERSION_94, $self->dbSysId(PG_VERSION_94))}, ERROR_CIPHER,
|
||||
$self->testException(sub {$oArchiveInfo->reconstruct(PG_VERSION_94, $self->dbSysId(PG_VERSION_94))}, ERROR_CRYPTO,
|
||||
"encryption incompatible for '$strArchiveFile'" .
|
||||
"\nHINT: Is or was the repo encrypted?");
|
||||
|
||||
@@ -204,7 +204,7 @@ sub run
|
||||
# Prepend encryption Magic signature to simulate encryption
|
||||
executeTest('echo "' . CIPHER_MAGIC . '$(cat ' . $strFile . ')" > ' . $strFile);
|
||||
|
||||
$self->testException(sub {new pgBackRest::Archive::Info(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE))}, ERROR_CIPHER,
|
||||
$self->testException(sub {new pgBackRest::Archive::Info(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE))}, ERROR_CRYPTO,
|
||||
"unable to parse '$strFile'" .
|
||||
"\nHINT: Is or was the repo encrypted?");
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ sub run
|
||||
# Prepend encryption Magic signature to simulate encryption
|
||||
executeTest('echo "' . CIPHER_MAGIC . '$(cat ' . $strFile . ')" > ' . $strFile);
|
||||
|
||||
$self->testException(sub {new pgBackRest::Backup::Info(storageRepo()->pathGet(STORAGE_REPO_BACKUP))}, ERROR_CIPHER,
|
||||
$self->testException(sub {new pgBackRest::Backup::Info(storageRepo()->pathGet(STORAGE_REPO_BACKUP))}, ERROR_CRYPTO,
|
||||
"unable to parse '$strFile'" .
|
||||
"\nHINT: Is or was the repo encrypted?");
|
||||
|
||||
@@ -253,7 +253,7 @@ sub run
|
||||
$self->optionTestSet(CFGOPT_REPO_PATH, $self->testPath() . '/repo');
|
||||
$self->configTestLoad(CFGCMD_ARCHIVE_PUSH);
|
||||
|
||||
$self->testException(sub {new pgBackRest::Backup::Info(storageRepo()->pathGet(STORAGE_REPO_BACKUP))}, ERROR_CIPHER,
|
||||
$self->testException(sub {new pgBackRest::Backup::Info(storageRepo()->pathGet(STORAGE_REPO_BACKUP))}, ERROR_CRYPTO,
|
||||
"unable to parse '" . $oBackupInfo->{strFileName} . "'" .
|
||||
"\nHINT: Is or was the repo encrypted?");
|
||||
}
|
||||
|
||||
@@ -287,14 +287,14 @@ sub run
|
||||
# Prepend encryption Magic signature to copy (main invalid) to simulate encryption
|
||||
executeTest('echo "' . CIPHER_MAGIC . '$(cat ' . $strTestFileCopy . ')" > ' . $strTestFileCopy);
|
||||
|
||||
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile)}, ERROR_CIPHER,
|
||||
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile)}, ERROR_CRYPTO,
|
||||
"unable to parse '$strTestFileCopy'" .
|
||||
"\nHINT: Is or was the repo encrypted?");
|
||||
|
||||
# Prepend encryption Magic signature to main to simulate encryption
|
||||
executeTest('echo "' . CIPHER_MAGIC . '$(cat ' . $strTestFile . ')" > ' . $strTestFile);
|
||||
|
||||
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile)}, ERROR_CIPHER,
|
||||
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile)}, ERROR_CRYPTO,
|
||||
"unable to parse '$strTestFile'" .
|
||||
"\nHINT: Is or was the repo encrypted?");
|
||||
|
||||
@@ -319,7 +319,7 @@ sub run
|
||||
my $oStorage = new pgBackRest::Storage::Local($self->testPath(), new pgBackRest::Storage::Posix::Driver(),
|
||||
{strCipherType => CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC, strCipherPassUser => $strCipherPass});
|
||||
|
||||
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile, {oStorage => $oStorage})}, ERROR_CIPHER,
|
||||
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile, {oStorage => $oStorage})}, ERROR_CRYPTO,
|
||||
"passphrase is required when storage is encrypted");
|
||||
|
||||
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile, {bLoad => false, oStorage => $oStorage,
|
||||
|
||||
@@ -458,7 +458,7 @@ sub run
|
||||
$self->configTestLoad(CFGCMD_INFO);
|
||||
my $oInfo = new pgBackRest::Info();
|
||||
|
||||
$self->testException(sub {$oInfo->stanzaList()}, ERROR_CIPHER,
|
||||
$self->testException(sub {$oInfo->stanzaList()}, ERROR_CRYPTO,
|
||||
"unable to parse '" . $self->{strBackupPathEncrypt} . "/backup.info'" .
|
||||
"\nHINT: Is or was the repo encrypted?" .
|
||||
"\nHINT: use option --stanza if encryption settings are different for the stanza than the global settings");
|
||||
|
||||
@@ -336,7 +336,7 @@ sub run
|
||||
# Try to create a manifest without a passphrase in an encrypted storage
|
||||
$self->testException(sub {new pgBackRest::Manifest($strBackupManifestFile,
|
||||
{bLoad => false, strDbVersion => PG_VERSION_94, iDbCatalogVersion => $self->dbCatalogVersion(PG_VERSION_94)})},
|
||||
ERROR_CIPHER, 'passphrase is required when storage is encrypted');
|
||||
ERROR_CRYPTO, 'passphrase is required when storage is encrypted');
|
||||
|
||||
# Get the encryption passphrase and create the new manifest
|
||||
my $oBackupInfo = new pgBackRest::Backup::Info($self->{strBackupPath});
|
||||
@@ -525,7 +525,7 @@ sub run
|
||||
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x');
|
||||
$self->configTestLoad(CFGCMD_STANZA_UPGRADE);
|
||||
|
||||
$self->testException(sub {$oStanza->stanzaUpgrade()}, ERROR_CIPHER,
|
||||
$self->testException(sub {$oStanza->stanzaUpgrade()}, ERROR_CRYPTO,
|
||||
"unable to parse '" . $self->{strArchivePath} . "/archive.info'" .
|
||||
"\nHINT: Is or was the repo encrypted?");
|
||||
|
||||
@@ -548,7 +548,7 @@ sub run
|
||||
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'y');
|
||||
$self->configTestLoad(CFGCMD_STANZA_UPGRADE);
|
||||
|
||||
$self->testException(sub {$oStanza->stanzaUpgrade()}, ERROR_CIPHER,
|
||||
$self->testException(sub {$oStanza->stanzaUpgrade()}, ERROR_CRYPTO,
|
||||
"unable to parse '" . $self->{strArchivePath} . "/archive.info'" .
|
||||
"\nHINT: Is or was the repo encrypted?");
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ sub run
|
||||
{strMode => STORAGE_DECRYPT})},
|
||||
'[object]', 'new read empty attempt decrypt');
|
||||
|
||||
$self->testException(sub {$oEncryptFileIo->read(\$tBuffer, 16)}, ERROR_CIPHER, 'cipher header missing');
|
||||
$self->testException(sub {$oEncryptFileIo->read(\$tBuffer, 16)}, ERROR_CRYPTO, 'cipher header missing');
|
||||
$self->testResult(sub {$oEncryptFileIo->close()}, true, 'close');
|
||||
|
||||
# OpenSSL should error on the empty file
|
||||
|
||||
@@ -173,7 +173,7 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(
|
||||
cipherBlockProcess(
|
||||
blockDecrypt, (unsigned char *)"1234567890123456", 16, decryptBuffer), CipherError, "cipher header invalid");
|
||||
blockDecrypt, (unsigned char *)"1234567890123456", 16, decryptBuffer), CryptoError, "cipher header invalid");
|
||||
|
||||
cipherBlockFree(blockDecrypt);
|
||||
|
||||
@@ -188,7 +188,7 @@ testRun(void)
|
||||
cipherBlockProcess(
|
||||
blockDecrypt, (unsigned char *)"1234567890123456", 16, decryptBuffer), 0, "process 0 bytes");
|
||||
|
||||
TEST_ERROR(cipherBlockFlush(blockDecrypt, decryptBuffer), CipherError, "unable to flush");
|
||||
TEST_ERROR(cipherBlockFlush(blockDecrypt, decryptBuffer), CryptoError, "unable to flush");
|
||||
|
||||
cipherBlockFree(blockDecrypt);
|
||||
|
||||
@@ -197,7 +197,7 @@ testRun(void)
|
||||
blockDecrypt = cipherBlockNew(cipherModeDecrypt, TEST_CIPHER, (unsigned char *)TEST_PASS, TEST_PASS_SIZE, NULL);
|
||||
|
||||
TEST_RESULT_INT(cipherBlockProcess(blockDecrypt, encryptBuffer, 0, decryptBuffer), 0, "no header processed");
|
||||
TEST_ERROR(cipherBlockFlush(blockDecrypt, decryptBuffer), CipherError, "cipher header missing");
|
||||
TEST_ERROR(cipherBlockFlush(blockDecrypt, decryptBuffer), CryptoError, "cipher header missing");
|
||||
|
||||
cipherBlockFree(blockDecrypt);
|
||||
|
||||
@@ -208,7 +208,7 @@ testRun(void)
|
||||
TEST_RESULT_INT(
|
||||
cipherBlockProcess(
|
||||
blockDecrypt, (unsigned char *)(CIPHER_BLOCK_MAGIC "12345678"), 16, decryptBuffer), 0, "0 bytes processed");
|
||||
TEST_ERROR(cipherBlockFlush(blockDecrypt, decryptBuffer), CipherError, "unable to flush");
|
||||
TEST_ERROR(cipherBlockFlush(blockDecrypt, decryptBuffer), CryptoError, "unable to flush");
|
||||
|
||||
cipherBlockFree(blockDecrypt);
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ testRun(void)
|
||||
|
||||
EVP_MD_CTX *context = EVP_MD_CTX_create();
|
||||
TEST_ERROR(
|
||||
cryptoError(EVP_DigestInit_ex(context, NULL, NULL) != 1, "unable to initialize hash context"), CipherError,
|
||||
cryptoError(EVP_DigestInit_ex(context, NULL, NULL) != 1, "unable to initialize hash context"), CryptoError,
|
||||
"unable to initialize hash context: no digest set");
|
||||
EVP_MD_CTX_destroy(context);
|
||||
|
||||
TEST_ERROR(cryptoError(true, "no error"), CipherError, "no error: no details available");
|
||||
TEST_ERROR(cryptoError(true, "no error"), CryptoError, "no error: no details available");
|
||||
}
|
||||
|
||||
FUNCTION_HARNESS_RESULT_VOID();
|
||||
|
||||
Reference in New Issue
Block a user