From: Nikos Mavrogiannopoulos Date: Tue, 5 Jun 2012 13:02:01 +0000 (+0200) Subject: Re-use GNUTLS_E_DECRYPTION_FAILED for encrypted structures. X-Git-Tag: gnutls_3_0_21~71 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56b91f274a3e720d1470bb576dc851a98a3dccb8;p=thirdparty%2Fgnutls.git Re-use GNUTLS_E_DECRYPTION_FAILED for encrypted structures. --- diff --git a/NEWS b/NEWS index 959a5ec70c..fbcee70d1f 100644 --- a/NEWS +++ b/NEWS @@ -28,15 +28,15 @@ the whole certificate chain (if any) to the credentials structure, instead of only the end-user certificate. ** libgnutls: Key import functions such as gnutls_pkcs12_simple_parse() -and gnutls_x509_privkey_import_pkcs8(), return GNUTLS_E_ENCRYPTED_STRUCTURE -if the input structure is encrypted but no password was provided. +and gnutls_x509_privkey_import_pkcs8(), return consistently +GNUTLS_E_DECRYPTION_FAILED if the input structure is encrypted but no +password was provided. ** libgnutlsxx: Added session::set_transport_vec_push_function. Patch by Alexandre Bique. ** API and ABI modifications: GNUTLS_CERT_SIGNATURE_FAILURE: Added -GNUTLS_E_ENCRYPTED_STRUCTURE: Added gnutls_pubkey_verify_hash2: Added gnutls_pkcs12_simple_parse: Added gnutls_certificate_set_x509_system_trust: Added diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index 6ac73a3490..c70b3bfdbe 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -111,7 +111,6 @@ static const gnutls_error_entry error_algorithms[] = { GNUTLS_E_MPI_PRINT_FAILED, 1), ERROR_ENTRY (N_("Decryption has failed."), GNUTLS_E_DECRYPTION_FAILED, 1), ERROR_ENTRY (N_("Encryption has failed."), GNUTLS_E_ENCRYPTION_FAILED, 1), - ERROR_ENTRY (N_("The provided structure is encrypted."), GNUTLS_E_ENCRYPTED_STRUCTURE, 1), ERROR_ENTRY (N_("Public key decryption has failed."), GNUTLS_E_PK_DECRYPTION_FAILED, 1), ERROR_ENTRY (N_("Public key encryption has failed."), diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index 39e767c8ab..1a58a53ad3 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -1898,7 +1898,6 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session); #define GNUTLS_E_NO_PRIORITIES_WERE_SET -326 #define GNUTLS_E_X509_UNSUPPORTED_EXTENSION -327 #define GNUTLS_E_SESSION_EOF -328 -#define GNUTLS_E_ENCRYPTED_STRUCTURE -329 #define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250 diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c index 452d6a5cb7..78e4075097 100644 --- a/lib/x509/pkcs12.c +++ b/lib/x509/pkcs12.c @@ -1367,7 +1367,7 @@ cleanup: * all. * * If the provided structure has encrypted fields but no password - * is provided then this function returns %GNUTLS_E_ENCRYPTED_STRUCTURE. + * is provided then this function returns %GNUTLS_E_DECRYPTION_FAILED. * * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a * negative error value. @@ -1432,7 +1432,7 @@ gnutls_pkcs12_simple_parse (gnutls_pkcs12_t p12, { if (password == NULL) { - ret = gnutls_assert_val(GNUTLS_E_ENCRYPTED_STRUCTURE); + ret = gnutls_assert_val(GNUTLS_E_DECRYPTION_FAILED); goto done; } @@ -1475,7 +1475,7 @@ gnutls_pkcs12_simple_parse (gnutls_pkcs12_t p12, case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: if (password == NULL) { - ret = gnutls_assert_val(GNUTLS_E_ENCRYPTED_STRUCTURE); + ret = gnutls_assert_val(GNUTLS_E_DECRYPTION_FAILED); goto done; } diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c index e921c70e63..f83582af11 100644 --- a/lib/x509/privkey_pkcs8.c +++ b/lib/x509/privkey_pkcs8.c @@ -1186,7 +1186,7 @@ error: * the encryption status cannot be auto-detected. * * If the %GNUTLS_PKCS_PLAIN flag is specified and the supplied data - * are encrypted then %GNUTLS_E_ENCRYPTED_STRUCTURE is returned. + * are encrypted then %GNUTLS_E_DECRYPTION_FAILED is returned. * * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a * negative error value. @@ -1252,7 +1252,7 @@ gnutls_x509_privkey_import_pkcs8 (gnutls_x509_privkey_t key, if (result < 0) { /* check if it is encrypted */ if (decode_pkcs8_key(&_data, "", key, 0) == 0) - result = GNUTLS_E_ENCRYPTED_STRUCTURE; + result = GNUTLS_E_DECRYPTION_FAILED; } } else