diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-11-11 16:23:56 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-11-11 16:23:56 +0000 |
commit | 898523d4c2632b7f6267c90a0b5c6a577876b75f (patch) | |
tree | 23cd3f075dc0f4f6075567583bd3ac1cbe4f6677 | |
parent | e339849bb49ddd9ea0cd94c1a16396a3c450758b (diff) | |
download | gnutls-898523d4c2632b7f6267c90a0b5c6a577876b75f.tar.gz |
Renamed several pkcs #7 related functions. That is to allow future extensions to the API.
-rw-r--r-- | includes/gnutls/x509.h | 25 | ||||
-rw-r--r-- | lib/gnutls_x509.c | 6 | ||||
-rw-r--r-- | lib/x509/compat.c | 4 | ||||
-rw-r--r-- | lib/x509/crl.c | 8 | ||||
-rw-r--r-- | lib/x509/pkcs7.c | 39 | ||||
-rw-r--r-- | lib/x509/pkcs7.h | 4 | ||||
-rw-r--r-- | lib/x509/x509.c | 6 | ||||
-rw-r--r-- | lib/x509/x509.h | 8 |
8 files changed, 51 insertions, 49 deletions
diff --git a/includes/gnutls/x509.h b/includes/gnutls/x509.h index 04865215f0..3b79682fcc 100644 --- a/includes/gnutls/x509.h +++ b/includes/gnutls/x509.h @@ -155,9 +155,11 @@ int gnutls_x509_crl_get_version(gnutls_x509_crl crl); time_t gnutls_x509_crl_get_this_update(gnutls_x509_crl crl); time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl crl); -int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl); -int gnutls_x509_crl_get_certificate(gnutls_x509_crl crl, int index, unsigned char* serial, +int gnutls_x509_crl_get_crt_count(gnutls_x509_crl crl); +int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl crl, int index, unsigned char* serial, size_t* serial_size, time_t* time); +#define gnutls_x509_crl_get_crt_count gnutls_x509_crl_get_certificate_count +#define gnutls_x509_crl_get_certificate gnutls_x509_crl_get_crt_serial int gnutls_x509_crl_check_issuer( gnutls_x509_crl crl, gnutls_x509_crt issuer); @@ -171,25 +173,26 @@ typedef struct gnutls_pkcs7_int* gnutls_pkcs7; int gnutls_pkcs7_init(gnutls_pkcs7 * pkcs7); void gnutls_pkcs7_deinit(gnutls_pkcs7 pkcs7); -int gnutls_pkcs7_get_certificate_count( gnutls_pkcs7 pkcs7); int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, gnutls_x509_crt_fmt format); int gnutls_pkcs7_export( gnutls_pkcs7 pkcs7, gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size); -int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7, int indx, +int gnutls_pkcs7_get_crt_count( gnutls_pkcs7 pkcs7); +int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7 pkcs7, int indx, unsigned char* certificate, size_t* certificate_size); -int gnutls_pkcs7_set_certificate(gnutls_pkcs7 pkcs7, const gnutls_datum* crt); -int gnutls_pkcs7_set_certificate2(gnutls_pkcs7 pkcs7, gnutls_x509_crt crt); -#define gnutls_pkcs7_set_crt gnutls_pkcs7_set_certificate2 -int gnutls_pkcs7_get_crl(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7 pkcs7, const gnutls_datum* crt); +int gnutls_pkcs7_set_crt(gnutls_pkcs7 pkcs7, gnutls_x509_crt crt); +int gnutls_pkcs7_delete_crt(gnutls_pkcs7 pkcs7, int indx); + +int gnutls_pkcs7_get_crl_raw(gnutls_pkcs7 pkcs7, int indx, unsigned char* crl, size_t* crl_size); int gnutls_pkcs7_get_crl_count(gnutls_pkcs7 pkcs7); -int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7, const gnutls_datum* crt); -int gnutls_pkcs7_set_crl2(gnutls_pkcs7 pkcs7, gnutls_x509_crl crl); -int gnutls_pkcs7_delete_crl(gnutls_pkcs7 pkcs7, int indx); +int gnutls_pkcs7_set_crl_raw(gnutls_pkcs7 pkcs7, const gnutls_datum* crt); +int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7, gnutls_x509_crl crl); +int gnutls_pkcs7_delete_crl(gnutls_pkcs7 pkcs7, int indx); /* X.509 Certificate verification functions. */ diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index 3481c63091..76848594a1 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -312,7 +312,7 @@ static int parse_pkcs7_cert_mem( gnutls_cert** cert_list, int* ncerts, const tmp.data = (opaque*)input_cert; tmp.size = input_cert_size; - ret = gnutls_pkcs7_get_certificate_count( pkcs7); + ret = gnutls_pkcs7_get_crt_count( pkcs7); if (ret < 0) { gnutls_assert(); @@ -324,7 +324,7 @@ static int parse_pkcs7_cert_mem( gnutls_cert** cert_list, int* ncerts, const j = count - 1; do { pcert_size = 0; - ret = gnutls_pkcs7_get_certificate( pkcs7, j, NULL, &pcert_size); + ret = gnutls_pkcs7_get_crt_raw( pkcs7, j, NULL, &pcert_size); if (ret!=GNUTLS_E_MEMORY_ERROR) { count--; continue; @@ -339,7 +339,7 @@ static int parse_pkcs7_cert_mem( gnutls_cert** cert_list, int* ncerts, const /* read the certificate */ - ret = gnutls_pkcs7_get_certificate( pkcs7, j, pcert, &pcert_size); + ret = gnutls_pkcs7_get_crt_raw( pkcs7, j, pcert, &pcert_size); j--; diff --git a/lib/x509/compat.c b/lib/x509/compat.c index 1ee676e693..81beabcf2b 100644 --- a/lib/x509/compat.c +++ b/lib/x509/compat.c @@ -743,7 +743,7 @@ int gnutls_x509_pkcs7_extract_certificate(const gnutls_datum * pkcs7_struct, int return result; } - result = gnutls_pkcs7_get_certificate( pkcs7, indx, certificate, certificate_size); + result = gnutls_pkcs7_get_crt_raw( pkcs7, indx, certificate, certificate_size); gnutls_pkcs7_deinit( pkcs7); @@ -775,7 +775,7 @@ int gnutls_x509_pkcs7_extract_certificate_count(const gnutls_datum * pkcs7_struc return result; } - result = gnutls_pkcs7_get_certificate_count( pkcs7); + result = gnutls_pkcs7_get_crt_count( pkcs7); gnutls_pkcs7_deinit( pkcs7); diff --git a/lib/x509/crl.c b/lib/x509/crl.c index 041350aafd..114ec997fb 100644 --- a/lib/x509/crl.c +++ b/lib/x509/crl.c @@ -321,7 +321,7 @@ time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl crl) } /** - * gnutls_x509_crl_get_certificate_count - This function returns the number of revoked certificates in a CRL + * gnutls_x509_crl_get_crt_count - This function returns the number of revoked certificates in a CRL * @crl: should contain a gnutls_x509_crl structure * * This function will return the number of revoked certificates in the @@ -330,7 +330,7 @@ time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl crl) * Returns a negative value on failure. * **/ -int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl) +int gnutls_x509_crl_get_crt_count(gnutls_x509_crl crl) { int count, result; @@ -354,7 +354,7 @@ int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl) } /** - * gnutls_x509_crl_get_certificate - This function returns the serial number of a revoked certificate + * gnutls_x509_crl_get_crt - This function returns the serial number of a revoked certificate * @crl: should contain a gnutls_x509_crl structure * @index: the index of the certificate to extract (starting from 0) * @serial: where the serial number will be copied @@ -367,7 +367,7 @@ int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl) * Returns a negative value on failure. * **/ -int gnutls_x509_crl_get_certificate(gnutls_x509_crl crl, int index, +int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl crl, int index, unsigned char *serial, size_t *serial_size, time_t * time) { diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c index 9eadfb22e0..79a7b66433 100644 --- a/lib/x509/pkcs7.c +++ b/lib/x509/pkcs7.c @@ -233,7 +233,7 @@ int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, } /** - * gnutls_pkcs7_get_certificate - This function returns a certificate in a PKCS7 certificate set + * gnutls_pkcs7_get_crt_raw - This function returns a certificate in a PKCS7 certificate set * @pkcs7_struct: should contain a gnutls_pkcs7 structure * @indx: contains the index of the certificate to extract * @certificate: the contents of the certificate will be copied there (may be null) @@ -247,7 +247,7 @@ int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, * will be returned. * **/ -int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7 pkcs7, int indx, unsigned char* certificate, size_t* certificate_size) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; @@ -330,7 +330,7 @@ int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7, } /** - * gnutls_pkcs7_get_certificate_count - This function returns the number of certificates in a PKCS7 certificate set + * gnutls_pkcs7_get_crt_count - This function returns the number of certificates in a PKCS7 certificate set * @pkcs7_struct: should contain a gnutls_pkcs7 structure * * This function will return the number of certifcates in the PKCS7 or @@ -339,7 +339,7 @@ int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7, * Returns a negative value on failure. * **/ -int gnutls_pkcs7_get_certificate_count(gnutls_pkcs7 pkcs7) +int gnutls_pkcs7_get_crt_count(gnutls_pkcs7 pkcs7) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result, count; @@ -470,7 +470,7 @@ static int create_empty_signed_data(ASN1_TYPE pkcs7, ASN1_TYPE * sdata) } /** - * gnutls_pkcs7_set_certificate - This function adds a certificate in a PKCS7 certificate set + * gnutls_pkcs7_set_crt_raw - This function adds a certificate in a PKCS7 certificate set * @pkcs7_struct: should contain a gnutls_pkcs7 structure * @crt: the DER encoded certificate to be added * @@ -478,7 +478,7 @@ static int create_empty_signed_data(ASN1_TYPE pkcs7, ASN1_TYPE * sdata) * Returns 0 on success. * **/ -int gnutls_pkcs7_set_certificate(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7 pkcs7, const gnutls_datum* crt) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; @@ -551,17 +551,17 @@ int gnutls_pkcs7_set_certificate(gnutls_pkcs7 pkcs7, } /** - * gnutls_pkcs7_set_certificate2 - This function adds a parsed certificate in a PKCS7 certificate set + * gnutls_pkcs7_set_crt - This function adds a parsed certificate in a PKCS7 certificate set * @pkcs7_struct: should contain a gnutls_pkcs7 structure * @crt: the certificate to be copied. * * This function will add a parsed certificate to the PKCS7 or RFC2630 certificate set. - * This is a wrapper function over gnutls_pkcs7_set_certificate() . + * This is a wrapper function over gnutls_pkcs7_set_crt_raw() . * * Returns 0 on success. * **/ -int gnutls_pkcs7_set_certificate2(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_set_crt(gnutls_pkcs7 pkcs7, gnutls_x509_crt crt) { int ret; @@ -576,7 +576,7 @@ int gnutls_pkcs7_set_certificate2(gnutls_pkcs7 pkcs7, return ret; } - ret = gnutls_pkcs7_set_certificate( pkcs7, &data); + ret = gnutls_pkcs7_set_crt_raw( pkcs7, &data); _gnutls_free_datum( &data); @@ -590,7 +590,7 @@ int gnutls_pkcs7_set_certificate2(gnutls_pkcs7 pkcs7, /** - * gnutls_pkcs7_delete_certificate - This function deletes a certificate from a PKCS7 certificate set + * gnutls_pkcs7_delete_crt - This function deletes a certificate from a PKCS7 certificate set * @pkcs7_struct: should contain a gnutls_pkcs7 structure * @indx: the index of the certificate to delete * @@ -598,7 +598,7 @@ int gnutls_pkcs7_set_certificate2(gnutls_pkcs7 pkcs7, * Index starts from 0. Returns 0 on success. * **/ -int gnutls_pkcs7_delete_certificate(gnutls_pkcs7 pkcs7, int indx) +int gnutls_pkcs7_delete_crt(gnutls_pkcs7 pkcs7, int indx) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result; @@ -651,7 +651,7 @@ int gnutls_pkcs7_delete_certificate(gnutls_pkcs7 pkcs7, int indx) */ /** - * gnutls_pkcs7_get_crl - This function returns a crl in a PKCS7 crl set + * gnutls_pkcs7_get_crl_raw - This function returns a crl in a PKCS7 crl set * @pkcs7_struct: should contain a gnutls_pkcs7 structure * @indx: contains the index of the crl to extract * @crl: the contents of the crl will be copied there (may be null) @@ -665,7 +665,7 @@ int gnutls_pkcs7_delete_certificate(gnutls_pkcs7 pkcs7, int indx) * will be returned. * **/ -int gnutls_pkcs7_get_crl(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_get_crl_raw(gnutls_pkcs7 pkcs7, int indx, unsigned char* crl, size_t* crl_size) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; @@ -768,7 +768,7 @@ int gnutls_pkcs7_get_crl_count(gnutls_pkcs7 pkcs7) } /** - * gnutls_pkcs7_set_crl - This function adds a crl in a PKCS7 crl set + * gnutls_pkcs7_set_crl_raw - This function adds a crl in a PKCS7 crl set * @pkcs7_struct: should contain a gnutls_pkcs7 structure * @crl: the DER encoded crl to be added * @@ -776,7 +776,7 @@ int gnutls_pkcs7_get_crl_count(gnutls_pkcs7 pkcs7) * Returns 0 on success. * **/ -int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_set_crl_raw(gnutls_pkcs7 pkcs7, const gnutls_datum* crl) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; @@ -842,7 +842,7 @@ int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7, } /** - * gnutls_pkcs7_set_crl2 - This function adds a parsed crl in a PKCS7 crl set + * gnutls_pkcs7_set_crl - This function adds a parsed crl in a PKCS7 crl set * @pkcs7_struct: should contain a gnutls_pkcs7 structure * @crl: the DER encoded crl to be added * @@ -850,8 +850,7 @@ int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7, * Returns 0 on success. * **/ -int gnutls_pkcs7_set_crl2(gnutls_pkcs7 pkcs7, - gnutls_x509_crl crl) +int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7, gnutls_x509_crl crl) { int ret; gnutls_datum data; @@ -865,7 +864,7 @@ int gnutls_pkcs7_set_crl2(gnutls_pkcs7 pkcs7, return ret; } - ret = gnutls_pkcs7_set_crl( pkcs7, &data); + ret = gnutls_pkcs7_set_crl_raw( pkcs7, &data); _gnutls_free_datum( &data); diff --git a/lib/x509/pkcs7.h b/lib/x509/pkcs7.h index dfabee49cd..d8fba1dd62 100644 --- a/lib/x509/pkcs7.h +++ b/lib/x509/pkcs7.h @@ -9,6 +9,6 @@ int gnutls_pkcs7_init(gnutls_pkcs7 * pkcs7); void gnutls_pkcs7_deinit(gnutls_pkcs7 pkcs7); int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, gnutls_x509_crt_fmt format); -int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7 pkcs7, int indx, unsigned char* certificate, size_t* certificate_size); -int gnutls_pkcs7_get_certificate_count(gnutls_pkcs7 pkcs7); +int gnutls_pkcs7_get_crt_count(gnutls_pkcs7 pkcs7); diff --git a/lib/x509/x509.c b/lib/x509/x509.c index 11802ed777..393544ceef 100644 --- a/lib/x509/x509.c +++ b/lib/x509/x509.c @@ -634,7 +634,7 @@ int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert, * @cert: should contain a gnutls_x509_crt structure * @critical: will be non zero if the extension is marked as critical * - * This function will return certificates CA status, by reading the + * This function will return certificates CA status, by reading the * basicConstraints X.509 extension. If the certificate is a CA a positive * value will be returned, or zero if the certificate does not have * CA flag set. @@ -1134,7 +1134,7 @@ int gnutls_x509_crt_check_revocation(gnutls_x509_crt cert, * certificate serial we have. */ - ncerts = gnutls_x509_crl_get_certificate_count(crl_list[j]); + ncerts = gnutls_x509_crl_get_crt_count(crl_list[j]); if (ncerts < 0) { gnutls_assert(); return ncerts; @@ -1143,7 +1143,7 @@ int gnutls_x509_crt_check_revocation(gnutls_x509_crt cert, for (i = 0; i < ncerts; i++) { serial_size = sizeof(serial); ret = - gnutls_x509_crl_get_certificate(crl_list[j], i, serial, + gnutls_x509_crl_get_crt_serial(crl_list[j], i, serial, &serial_size, NULL); diff --git a/lib/x509/x509.h b/lib/x509/x509.h index 9ad73df8c4..93b068278f 100644 --- a/lib/x509/x509.h +++ b/lib/x509/x509.h @@ -84,10 +84,10 @@ int gnutls_x509_crt_check_revocation(gnutls_x509_crt cert, gnutls_x509_crl * crl int _gnutls_x509_crl_cpy(gnutls_x509_crl dest, gnutls_x509_crl src); int _gnutls_x509_crl_get_raw_issuer_dn( gnutls_x509_crl crl, gnutls_datum* dn); -int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl); -int gnutls_x509_crl_get_certificate(gnutls_x509_crl crl, int index, - unsigned char *serial, - size_t *serial_size, time_t * time); +int gnutls_x509_crl_get_crt_count(gnutls_x509_crl crl); +int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl crl, int index, + unsigned char *serial, + size_t *serial_size, time_t * time); void gnutls_x509_crl_deinit(gnutls_x509_crl crl); int gnutls_x509_crl_init(gnutls_x509_crl * crl); |