]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Several GNUTLS_E_UNIMPLEMENTED_FEATURE errors were replaced with meaningful error...
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 25 Mar 2003 18:01:47 +0000 (18:01 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 25 Mar 2003 18:01:47 +0000 (18:01 +0000)
14 files changed:
lib/auth_cert.c
lib/ext_server_name.c
lib/gnutls_errors.c
lib/gnutls_errors_int.h
lib/gnutls_session_pack.c
lib/gnutls_sig.c
lib/x509/crl.c
lib/x509/crq.c
lib/x509/mpi.c
lib/x509/privkey.c
lib/x509/privkey_pkcs8.c
lib/x509/sign.c
lib/x509/verify.c
lib/x509/x509.c

index 7fb8799933f3ee9d3c4d39cfe6e3f83134548d38..9cc75efc928969f7b0133f2e73d8a8b9e5863958 100644 (file)
@@ -819,7 +819,7 @@ int _gnutls_proc_openpgp_server_certificate(gnutls_session session,
 
                if (len != 20) {
                        gnutls_assert();
-                       return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+                       return GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED;
                }
 
                DECR_LEN(dsize, 20);
@@ -863,7 +863,7 @@ int _gnutls_proc_openpgp_server_certificate(gnutls_session session,
 
        } else {
                gnutls_assert();
-               return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+               return GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE;
        }
 
        /* ok we now have the peer's key in tmp datum
index 4855f868c1badca1ec0ded6744ab496c2ac490f3..8add6850af38b781ec8a1c47e7ffe9d3ccdacd00 100644 (file)
@@ -175,7 +175,7 @@ int _gnutls_server_name_send_params(gnutls_session session, opaque * data,
            break;
         default:
            gnutls_assert();
-           return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+           return GNUTLS_E_INTERNAL_ERROR;
         }
       }
    }
index a52c2de62700d02a5ce088d7eb6a9f5a35be8185..b871f851e83d3e7c5fe85b51eee49c4f9a079423 100644 (file)
@@ -130,6 +130,10 @@ static gnutls_error_entry error_algorithms[] = {
 
         ERROR_ENTRY("The SRP username supplied by the peer is illegal.", GNUTLS_E_ILLEGAL_SRP_USERNAME, 1),
         ERROR_ENTRY("The peer advertized SRP but did not supply any SRP username.", GNUTLS_E_EMPTY_SRP_USERNAME, 1),
+
+        ERROR_ENTRY("The OpenPGP fingerprint is not supported.", GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED, 1),
+        ERROR_ENTRY("The certificate has unsupported attributes.", GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE, 1),
+        ERROR_ENTRY("The hash algorithm is unknown.", GNUTLS_E_UNKNOWN_HASH_ALGORITHM, 1),
        {0, 0, 0, 0}
 };
 
index f87b4de61d4d776ba61068a9dc3e9f6fd7e3d617..30aa175b9c2b664e2a7daed9b4a113e94775e72d 100644 (file)
@@ -40,8 +40,6 @@
 #define GNUTLS_E_GOT_APPLICATION_DATA -38
 #define GNUTLS_E_RECORD_LIMIT_REACHED -39
 #define GNUTLS_E_ENCRYPTION_FAILED -40
-#define GNUTLS_E_CERTIFICATE_ERROR -43
-#define GNUTLS_E_X509_CERTIFICATE_ERROR GNUTLS_E_CERTIFICATE_ERROR
 
 #define GNUTLS_E_PK_ENCRYPTION_FAILED -44
 #define GNUTLS_E_PK_DECRYPTION_FAILED -45
 #define GNUTLS_E_PKCS1_WRONG_PAD -57
 #define GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION -58
 #define GNUTLS_E_INTERNAL_ERROR -59
-#define GNUTLS_E_CERTIFICATE_KEY_MISMATCH -60
-#define GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE -61 /* GNUTLS_A_UNSUPPORTED_CERTIFICATE */
-#define GNUTLS_E_X509_UNKNOWN_SAN -62
 #define GNUTLS_E_DH_PRIME_UNACCEPTABLE -63
 #define GNUTLS_E_FILE_ERROR -64
-#define GNUTLS_E_ASN1_ELEMENT_NOT_FOUND -67
-#define GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND -68
-#define GNUTLS_E_ASN1_DER_ERROR -69
-#define GNUTLS_E_ASN1_VALUE_NOT_FOUND -70
-#define GNUTLS_E_ASN1_GENERIC_ERROR -71
-#define GNUTLS_E_ASN1_VALUE_NOT_VALID -72
-#define GNUTLS_E_ASN1_TAG_ERROR -73
-#define GNUTLS_E_ASN1_TAG_IMPLICIT -74
-#define GNUTLS_E_ASN1_TYPE_ANY_ERROR -75
-#define GNUTLS_E_ASN1_SYNTAX_ERROR -76
-#define GNUTLS_E_ASN1_DER_OVERFLOW -77
 #define GNUTLS_E_TOO_MANY_EMPTY_PACKETS -78
-#define GNUTLS_E_OPENPGP_UID_REVOKED -79
 #define GNUTLS_E_UNKNOWN_PK_ALGORITHM -80
-#define GNUTLS_E_OPENPGP_TRUSTDB_VERSION_UNSUPPORTED -81
+
 
 /* returned if libextra functionality was requested but
  * gnutls_global_init_extra() was not called.
 #define GNUTLS_E_EMPTY_SRP_USERNAME -92
 #define GNUTLS_E_NO_TEMPORARY_DH_PARAMS -93
 
+/* For certificate and key stuff
+ */
+#define GNUTLS_E_ASN1_ELEMENT_NOT_FOUND -67
+#define GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND -68
+#define GNUTLS_E_ASN1_DER_ERROR -69
+#define GNUTLS_E_ASN1_VALUE_NOT_FOUND -70
+#define GNUTLS_E_ASN1_GENERIC_ERROR -71
+#define GNUTLS_E_ASN1_VALUE_NOT_VALID -72
+#define GNUTLS_E_ASN1_TAG_ERROR -73
+#define GNUTLS_E_ASN1_TAG_IMPLICIT -74
+#define GNUTLS_E_ASN1_TYPE_ANY_ERROR -75
+#define GNUTLS_E_ASN1_SYNTAX_ERROR -76
+#define GNUTLS_E_ASN1_DER_OVERFLOW -77
+#define GNUTLS_E_OPENPGP_TRUSTDB_VERSION_UNSUPPORTED -81
+#define GNUTLS_E_OPENPGP_UID_REVOKED -79
+#define GNUTLS_E_CERTIFICATE_ERROR -43
+#define GNUTLS_E_X509_CERTIFICATE_ERROR GNUTLS_E_CERTIFICATE_ERROR
+#define GNUTLS_E_CERTIFICATE_KEY_MISMATCH -60
+#define GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE -61 /* GNUTLS_A_UNSUPPORTED_CERTIFICATE */
+#define GNUTLS_E_X509_UNKNOWN_SAN -62
+#define GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED -94
+#define GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE -95
+#define GNUTLS_E_UNKNOWN_HASH_ALGORITHM -96
+
 #define GNUTLS_E_UNIMPLEMENTED_FEATURE -250
 
 /* _INT_ internal errors. Not exported */
index 0e0a1706324819b56765933a1d3e4ed699b40f69..17cb8946dc77db3deb5ec80649bf6a4655b2eb65 100644 (file)
@@ -52,7 +52,7 @@ int _gnutls_session_pack(gnutls_session session, gnutls_datum * packed_session)
 
        if (packed_session==NULL) {
                gnutls_assert();
-               return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+               return GNUTLS_E_INTERNAL_ERROR;
        }
 
 
@@ -127,7 +127,7 @@ int _gnutls_session_pack(gnutls_session session, gnutls_datum * packed_session)
                }
                break;
        default:
-               return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+               return GNUTLS_E_INTERNAL_ERROR;
 
        }
 
@@ -183,7 +183,7 @@ int _gnutls_session_unpack(gnutls_session session,
 
        if (packed_session==NULL || packed_session->size == 0) {
                gnutls_assert();
-               return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+               return GNUTLS_E_INTERNAL_ERROR;
        }
 
        if (session->key->auth_info != NULL) {
@@ -287,7 +287,7 @@ int _gnutls_session_unpack(gnutls_session session,
                break;
        default:
                gnutls_assert();
-               return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+               return GNUTLS_E_INTERNAL_ERROR;
 
        }
 
index f13ca6372aeb161d4b360f040050ffea9fc13fca..277db2aaccdea555c79321cda8efe32bdfbd8f0c 100644 (file)
@@ -199,7 +199,7 @@ int ret;
                        break;
                default:
                        gnutls_assert();
-                       return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+                       return GNUTLS_E_INTERNAL_ERROR;
                        break;
        }
 
@@ -260,7 +260,7 @@ int _gnutls_pkcs1_rsa_verify_sig( gnutls_cert *cert, const gnutls_datum *hash_co
 
                default:
                        gnutls_assert();
-                       return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+                       return GNUTLS_E_INTERNAL_ERROR;
        }
        
 
index 56d9fe22385cd951858ac8e3c4d8927f17ec18e8..d89acacb2e133a84c7273fa166a9c0b516038690 100644 (file)
@@ -165,7 +165,7 @@ int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data,
 
                if (len % 8 != 0) {
                        gnutls_assert();
-                       result = GNUTLS_E_UNIMPLEMENTED_FEATURE;
+                       result = GNUTLS_E_CERTIFICATE_ERROR;
                        goto cleanup;
                }
 
index 528d3e733add17392b9eb13db452f3dff92fcbae..c0c7e7d377653d2a200b76e91247e23ddce3cb67 100644 (file)
@@ -204,7 +204,7 @@ int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char* oid,
 /* Parses an Attribute list in the asn1_struct, and searches for the
  * given OID. The index indicates the attribute value to be returned.
  *
- * Only printable data are returned, or GNUTLS_E_UNIMPLEMENTED_FEATURE.
+ * Only printable data are returned, or GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE.
  *
  * asn1_attr_name must be a string in the form "certificationRequestInfo.attributes"
  *
@@ -326,7 +326,7 @@ static int parse_attribute(ASN1_TYPE asn1_struct,
                                        return 0;
                                } else {
                                        gnutls_assert();
-                                       return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+                                       return GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE;
                                }
                        }
 
@@ -417,7 +417,7 @@ uint8 null = version;
   * @key: holds a private key
   *
   * This function will set the public parameters from the given private key to the
-  * request.
+  * request. Only RSA keys are currently supported.
   *
   * On success zero is returned.
   *
@@ -436,7 +436,7 @@ int der_size, result;
        pk = _gnutls_x509_pk2oid( key->pk_algorithm);
        if (pk == NULL) {
                gnutls_assert();
-               return GNUTLS_E_INVALID_REQUEST;
+               return GNUTLS_E_UNKNOWN_PK_ALGORITHM;
        }
 
        /* write the RSA OID
index abd5a27b61ad7752d89bad3d184076e6e441a5b2..379371295612f2197a50baff664d296742986002 100644 (file)
@@ -350,7 +350,7 @@ int len, result;
                *ret = _gnutls_read_uint32(tmpstr);
        else {
                gnutls_assert();
-               return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+               return GNUTLS_E_INTERNAL_ERROR;
        }
 
        return 0;
index 4dc64b4ae884cbb903009d9e4f21ea45f848a129..fd5d54a3d4eeda8fd0319f8531edc7f7c3ec9105 100644 (file)
@@ -808,7 +808,8 @@ static int _encode_rsa( ASN1_TYPE* c2, MPI* params)
   * @flags: unused for now. Must be 0.
   *
   * This function will generate a random private key. Note that
-  * this function must be called on an empty private key.
+  * this function must be called on an empty private key. Currently only RSA
+  * keys can be generated.
   *
   * Returns 0 on success or a negative value on error.
   *
index c4f2e127b665e8b5dd5c43addb2b9fe5b8dbaca2..0ea0d4e65a3cc39767ba22bb7187c84c6d72f7ff 100644 (file)
@@ -291,6 +291,7 @@ static ASN1_TYPE encode_to_pkcs8_key( const gnutls_datum *raw_key,
   * @output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
   *
   * This function will export the private key to a PKCS8 structure.
+  * Currently only RSA keys can be exported.
   *
   * If the buffer provided is not long enough to hold the output, then
   * GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
@@ -564,6 +565,7 @@ static ASN1_TYPE decode_private_key_info( const gnutls_datum* der, gnutls_x509_p
   *
   * This function will convert the given DER or PEM encoded PKCS8 2.0 encrypted key
   * to the native gnutls_x509_privkey format. The output will be stored in 'key'.
+  * Currently only RSA keys can be imported.
   *
   * If the Certificate is PEM encoded it should have a header of "ENCRYPTED PRIVATE KEY",
   * or "PRIVATE KEY". You only need to specify the flags if the key is DER encoded.
index 2c878b88b1672bb6367e41ac4828d59dc5f6d97d..5ce6918645bdde0c106b46a022cca093208c02ce 100644 (file)
@@ -52,7 +52,7 @@ const char* algo;
        algo = _gnutls_x509_mac2oid( hash);
        if (algo == NULL) {
                gnutls_assert();
-               return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+               return GNUTLS_E_UNKNOWN_PK_ALGORITHM;
        }
 
        if ((result=asn1_create_element( _gnutls_get_gnutls_asn(), 
index 60d28ea0e2614442769cbb5cbc7fdbaaffd929a2..071def4f866d620fb6f85ad7b593ef7c26477f6b 100644 (file)
@@ -397,7 +397,7 @@ int len;
 
                gnutls_assert();
                asn1_delete_structure(&dinfo);
-               return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+               return GNUTLS_E_UNKNOWN_HASH_ALGORITHM;
        }
        
        result =
index 0df385b2cdbd61a435e1ce482811217e4e28ee85..7a8dcf39101e49d45b2d5ee284e8cbde396268be 100644 (file)
@@ -224,7 +224,7 @@ int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data,
                
                if (len % 8 != 0) {
                        gnutls_assert();
-                       result = GNUTLS_E_UNIMPLEMENTED_FEATURE;
+                       result = GNUTLS_E_CERTIFICATE_ERROR;
                        goto cleanup;
                }