pgcrypto: remove questionmark from error message

The PXE_CIPHER_INIT error is used to report initialization errors, so
appending a questionmark to the error isn't entirely accurate (using a
space before the questionmark doubly so).

Discussion: https://postgr.es/m/C89D932C-501E-4473-9750-638CFCD9095E@yesql.se
This commit is contained in:
Daniel Gustafsson 2022-05-06 14:41:36 +02:00
parent 0250a167a0
commit ee97d46cdb
4 changed files with 35 additions and 35 deletions

View File

@ -3,25 +3,25 @@
--
-- some standard Blowfish testvalues
SELECT encrypt('\x0000000000000000', '\x0000000000000000', 'bf-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
SELECT encrypt('\xffffffffffffffff', '\xffffffffffffffff', 'bf-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
SELECT encrypt('\x1000000000000001', '\x3000000000000000', 'bf-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
SELECT encrypt('\x1111111111111111', '\x1111111111111111', 'bf-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
SELECT encrypt('\x0123456789abcdef', '\xfedcba9876543210', 'bf-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
SELECT encrypt('\x01a1d6d039776742', '\xfedcba9876543210', 'bf-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
SELECT encrypt('\xffffffffffffffff', '\x0000000000000000', 'bf-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- setkey
SELECT encrypt('\xfedcba9876543210', '\xf0e1d2c3b4a5968778695a4b3c2d1e0f', 'bf-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- with padding
SELECT encrypt('\x01234567890123456789', '\x33443344334433443344334433443344', 'bf-ecb');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- cbc
-- 28 bytes key
SELECT encrypt('\x6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5',
@ -40,23 +40,23 @@ SELECT encrypt('\xfedcba9876543210',
ERROR: encrypt error: Key was too big
-- empty data
select encrypt('', 'foo', 'bf');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- 10 bytes key
select encrypt('foo', '0123456789', 'bf');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- 22 bytes key
select encrypt('foo', '0123456789012345678901', 'bf');
ERROR: encrypt error: Key was too big
-- decrypt
select encode(decrypt(encrypt('foo', '0123456', 'bf'), '0123456', 'bf'), 'escape');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- iv
select encrypt_iv('foo', '0123456', 'abcd', 'bf');
ERROR: encrypt_iv error: Cipher cannot be initialized ?
ERROR: encrypt_iv error: Cipher cannot be initialized
select encode(decrypt_iv('\x95c7e89322525d59', '0123456', 'abcd', 'bf'), 'escape');
ERROR: decrypt_iv error: Cipher cannot be initialized ?
ERROR: decrypt_iv error: Cipher cannot be initialized
-- long message
select encrypt('Lets try a longer message.', '0123456789', 'bf');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
select encode(decrypt(encrypt('Lets try a longer message.', '0123456789', 'bf'), '0123456789', 'bf'), 'escape');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized

View File

@ -4,30 +4,30 @@
-- test vectors from RFC2144
-- 128 bit key
SELECT encrypt('\x0123456789ABCDEF', '\x0123456712345678234567893456789A', 'cast5-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- 80 bit key
SELECT encrypt('\x0123456789ABCDEF', '\x01234567123456782345', 'cast5-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- 40 bit key
SELECT encrypt('\x0123456789ABCDEF', '\x0123456712', 'cast5-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- cbc
-- empty data
select encrypt('', 'foo', 'cast5');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- 10 bytes key
select encrypt('foo', '0123456789', 'cast5');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- decrypt
select encode(decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5'), 'escape');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- iv
select encrypt_iv('foo', '0123456', 'abcd', 'cast5');
ERROR: encrypt_iv error: Cipher cannot be initialized ?
ERROR: encrypt_iv error: Cipher cannot be initialized
select encode(decrypt_iv('\x384a970695ce016a', '0123456', 'abcd', 'cast5'), 'escape');
ERROR: decrypt_iv error: Cipher cannot be initialized ?
ERROR: decrypt_iv error: Cipher cannot be initialized
-- long message
select encrypt('Lets try a longer message.', '0123456789', 'cast5');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
select encode(decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5'), 'escape');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized

View File

@ -4,23 +4,23 @@
-- no official test vectors atm
-- from blowfish.sql
SELECT encrypt('\x0123456789abcdef', '\xfedcba9876543210', 'des-ecb/pad:none');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- empty data
select encrypt('', 'foo', 'des');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- 8 bytes key
select encrypt('foo', '01234589', 'des');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- decrypt
select encode(decrypt(encrypt('foo', '0123456', 'des'), '0123456', 'des'), 'escape');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
-- iv
select encrypt_iv('foo', '0123456', 'abcd', 'des');
ERROR: encrypt_iv error: Cipher cannot be initialized ?
ERROR: encrypt_iv error: Cipher cannot be initialized
select encode(decrypt_iv('\x50735067b073bb93', '0123456', 'abcd', 'des'), 'escape');
ERROR: decrypt_iv error: Cipher cannot be initialized ?
ERROR: decrypt_iv error: Cipher cannot be initialized
-- long message
select encrypt('Lets try a longer message.', '01234567', 'des');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized
select encode(decrypt(encrypt('Lets try a longer message.', '01234567', 'des'), '01234567', 'des'), 'escape');
ERROR: encrypt error: Cipher cannot be initialized ?
ERROR: encrypt error: Cipher cannot be initialized

View File

@ -46,7 +46,7 @@ static const struct error_desc px_err_list[] = {
{PXE_BAD_OPTION, "Unknown option"},
{PXE_BAD_FORMAT, "Badly formatted type"},
{PXE_KEY_TOO_BIG, "Key was too big"},
{PXE_CIPHER_INIT, "Cipher cannot be initialized ?"},
{PXE_CIPHER_INIT, "Cipher cannot be initialized"},
{PXE_HASH_UNUSABLE_FOR_HMAC, "This hash algorithm is unusable for HMAC"},
{PXE_BUG, "pgcrypto bug"},
{PXE_ARGUMENT_ERROR, "Illegal argument to function"},