gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, ocsp, updated. gnutls_3_0_8-44-g47b17a5


From: Simon Josefsson
Subject: [SCM] GNU gnutls branch, ocsp, updated. gnutls_3_0_8-44-g47b17a5
Date: Wed, 14 Dec 2011 13:46:50 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=47b17a55acdec0c5bdd17e0e0e1e577118481f8e

The branch, ocsp has been updated
       via  47b17a55acdec0c5bdd17e0e0e1e577118481f8e (commit)
       via  00ca413639c64ffc4c322883d6df81215ce49160 (commit)
      from  92f9fd4c399bb896680950a0930acbbb94b7dc85 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 47b17a55acdec0c5bdd17e0e0e1e577118481f8e
Author: Simon Josefsson <address@hidden>
Date:   Wed Dec 14 14:40:17 2011 +0100

    Rename functions.  Suggested by Nikos.

commit 00ca413639c64ffc4c322883d6df81215ce49160
Author: Simon Josefsson <address@hidden>
Date:   Wed Dec 14 14:38:36 2011 +0100

    Use _gnutls_buffer_to_datum.  Suggested by Nikos.

-----------------------------------------------------------------------

Summary of changes:
 doc/cha-cert-auth2.texi    |    2 +-
 lib/includes/gnutls/ocsp.h |   50 ++++++++++++++++----------------
 lib/libgnutls.map          |   10 +++---
 lib/x509/ocsp.c            |   68 ++++++++++++++++++++++----------------------
 lib/x509/ocsp_output.c     |   46 ++++++++++++++++++-----------
 5 files changed, 94 insertions(+), 82 deletions(-)

diff --git a/doc/cha-cert-auth2.texi b/doc/cha-cert-auth2.texi
index dd1f2ce..5e22b02 100644
--- a/doc/cha-cert-auth2.texi
+++ b/doc/cha-cert-auth2.texi
@@ -194,7 +194,7 @@ certificate (and its issuer) in a @code{gnutls_x509_crt_t} 
type.
 There is also a function to extract this information from an OCSP
 request.
 
address@hidden,gnutls_ocsp_req_add_cert,gnutls_ocsp_req_get_certid}
address@hidden,gnutls_ocsp_req_add_cert,gnutls_ocsp_req_get_cert_id}
 
 Each OCSP request may contain a number of extensions.  Extensions are
 identified by an Object Identifier (OID) and an opaque data buffer
diff --git a/lib/includes/gnutls/ocsp.h b/lib/includes/gnutls/ocsp.h
index af37303..ab98743 100644
--- a/lib/includes/gnutls/ocsp.h
+++ b/lib/includes/gnutls/ocsp.h
@@ -140,17 +140,17 @@ extern "C"
 
   int gnutls_ocsp_req_get_version (gnutls_ocsp_req_t req);
 
-  int gnutls_ocsp_req_get_certid (gnutls_ocsp_req_t req,
-                                 unsigned indx,
-                                 gnutls_digest_algorithm_t *digest,
-                                 gnutls_datum_t *issuer_name_hash,
-                                 gnutls_datum_t *issuer_key_hash,
-                                 gnutls_datum_t *serial_number);
-  int gnutls_ocsp_req_add_certid (gnutls_ocsp_req_t req,
-                                 gnutls_digest_algorithm_t digest,
-                                 const gnutls_datum_t *issuer_name_hash,
-                                 const gnutls_datum_t *issuer_key_hash,
-                                 const gnutls_datum_t *serial_number);
+  int gnutls_ocsp_req_get_cert_id (gnutls_ocsp_req_t req,
+                                  unsigned indx,
+                                  gnutls_digest_algorithm_t *digest,
+                                  gnutls_datum_t *issuer_name_hash,
+                                  gnutls_datum_t *issuer_key_hash,
+                                  gnutls_datum_t *serial_number);
+  int gnutls_ocsp_req_add_cert_id (gnutls_ocsp_req_t req,
+                                  gnutls_digest_algorithm_t digest,
+                                  const gnutls_datum_t *issuer_name_hash,
+                                  const gnutls_datum_t *issuer_key_hash,
+                                  const gnutls_datum_t *serial_number);
   int gnutls_ocsp_req_add_cert (gnutls_ocsp_req_t req,
                                gnutls_digest_algorithm_t digest,
                                gnutls_x509_crt_t issuer,
@@ -194,20 +194,20 @@ extern "C"
                                     gnutls_datum_t *response);
 
   int gnutls_ocsp_resp_get_version (gnutls_ocsp_resp_t resp);
-  int gnutls_ocsp_resp_get_responderid_dn (gnutls_ocsp_resp_t resp,
-                                          gnutls_datum_t *dn);
-  time_t gnutls_ocsp_resp_get_produceat (gnutls_ocsp_resp_t resp);
-  int gnutls_ocsp_resp_get_singleresponse (gnutls_ocsp_resp_t resp,
-                                          unsigned indx,
-                                          gnutls_digest_algorithm_t *digest,
-                                          gnutls_datum_t *issuer_name_hash,
-                                          gnutls_datum_t *issuer_key_hash,
-                                          gnutls_datum_t *serial_number,
-                                          int *cert_status,
-                                          time_t *this_update,
-                                          time_t *next_update,
-                                          time_t *revocation_time,
-                                          int *revocation_reason);
+  int gnutls_ocsp_resp_get_responder (gnutls_ocsp_resp_t resp,
+                                     gnutls_datum_t *dn);
+  time_t gnutls_ocsp_resp_get_produced (gnutls_ocsp_resp_t resp);
+  int gnutls_ocsp_resp_get_single (gnutls_ocsp_resp_t resp,
+                                  unsigned indx,
+                                  gnutls_digest_algorithm_t *digest,
+                                  gnutls_datum_t *issuer_name_hash,
+                                  gnutls_datum_t *issuer_key_hash,
+                                  gnutls_datum_t *serial_number,
+                                  int *cert_status,
+                                  time_t *this_update,
+                                  time_t *next_update,
+                                  time_t *revocation_time,
+                                  int *revocation_reason);
   int gnutls_ocsp_resp_get_extension (gnutls_ocsp_resp_t resp,
                                      unsigned indx,
                                      gnutls_datum_t *oid,
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 3055f49..aaf2dea 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -718,10 +718,10 @@ GNUTLS_3_0_0 {
        gnutls_pubkey_import_ecc_raw2;
        gnutls_record_get_discarded;
        gnutls_x509_crt_get_authority_info_access;
-       gnutls_ocsp_req_add_certid;
+       gnutls_ocsp_req_add_cert_id;
        gnutls_ocsp_req_deinit;
        gnutls_ocsp_req_export;
-       gnutls_ocsp_req_get_certid;
+       gnutls_ocsp_req_get_cert_id;
        gnutls_ocsp_req_add_cert;
        gnutls_ocsp_req_get_nonce;
        gnutls_ocsp_req_get_extension;
@@ -734,12 +734,12 @@ GNUTLS_3_0_0 {
        gnutls_ocsp_resp_export;
        gnutls_ocsp_resp_get_certs;
        gnutls_ocsp_resp_get_extension;
-       gnutls_ocsp_resp_get_produceat;
-       gnutls_ocsp_resp_get_responderid_dn;
+       gnutls_ocsp_resp_get_produced;
+       gnutls_ocsp_resp_get_responder;
        gnutls_ocsp_resp_get_response;
        gnutls_ocsp_resp_get_signature;
        gnutls_ocsp_resp_get_signature_algorithm;
-       gnutls_ocsp_resp_get_singleresponse;
+       gnutls_ocsp_resp_get_single;
        gnutls_ocsp_resp_get_status;
        gnutls_ocsp_resp_get_version;
        gnutls_ocsp_resp_import;
diff --git a/lib/x509/ocsp.c b/lib/x509/ocsp.c
index d1cee34..ac44e7d 100644
--- a/lib/x509/ocsp.c
+++ b/lib/x509/ocsp.c
@@ -433,7 +433,7 @@ gnutls_ocsp_req_get_version (gnutls_ocsp_req_t req)
 }
 
 /**
- * gnutls_ocsp_req_get_certid:
+ * gnutls_ocsp_req_get_cert_id:
  * @req: should contain a #gnutls_ocsp_req_t structure
  * @indx: Specifies which extension OID to get. Use (0) to get the first one.
  * @digest: output variable with #gnutls_digest_algorithm_t hash algorithm
@@ -455,16 +455,16 @@ gnutls_ocsp_req_get_version (gnutls_ocsp_req_t req)
  *
  * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
  *   negative error code is returned.  If you have reached the last
- *   certid available %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be
+ *   CertID available %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be
  *   returned.
  **/
 int
-gnutls_ocsp_req_get_certid (gnutls_ocsp_req_t req,
-                           unsigned indx,
-                           gnutls_digest_algorithm_t *digest,
-                           gnutls_datum_t *issuer_name_hash,
-                           gnutls_datum_t *issuer_key_hash,
-                           gnutls_datum_t *serial_number)
+gnutls_ocsp_req_get_cert_id (gnutls_ocsp_req_t req,
+                            unsigned indx,
+                            gnutls_digest_algorithm_t *digest,
+                            gnutls_datum_t *issuer_name_hash,
+                            gnutls_datum_t *issuer_key_hash,
+                            gnutls_datum_t *serial_number)
 {
   gnutls_datum_t sa;
   char name[ASN1_MAX_NAME_SIZE];
@@ -539,7 +539,7 @@ gnutls_ocsp_req_get_certid (gnutls_ocsp_req_t req,
 }
 
 /**
- * gnutls_ocsp_req_add_certid:
+ * gnutls_ocsp_req_add_cert_id:
  * @req: should contain a #gnutls_ocsp_req_t structure
  * @digest: hash algorithm, a #gnutls_digest_algorithm_t value
  * @issuer_name_hash: hash of issuer's DN
@@ -565,11 +565,11 @@ gnutls_ocsp_req_get_certid (gnutls_ocsp_req_t req,
  *   negative error code is returned.
  **/
 int
-gnutls_ocsp_req_add_certid (gnutls_ocsp_req_t req,
-                           gnutls_digest_algorithm_t digest,
-                           const gnutls_datum_t *issuer_name_hash,
-                           const gnutls_datum_t *issuer_key_hash,
-                           const gnutls_datum_t *serial_number)
+gnutls_ocsp_req_add_cert_id (gnutls_ocsp_req_t req,
+                            gnutls_digest_algorithm_t digest,
+                            const gnutls_datum_t *issuer_name_hash,
+                            const gnutls_datum_t *issuer_key_hash,
+                            const gnutls_datum_t *serial_number)
 {
   int result;
   const char *oid;
@@ -729,7 +729,7 @@ gnutls_ocsp_req_add_cert (gnutls_ocsp_req_t req,
       return ret;
     }
 
-  ret = gnutls_ocsp_req_add_certid (req, digest, &inh, &ikh, &sn);
+  ret = gnutls_ocsp_req_add_cert_id (req, digest, &inh, &ikh, &sn);
   gnutls_free (sn.data);
   if (ret != GNUTLS_E_SUCCESS)
     {
@@ -1136,7 +1136,7 @@ gnutls_ocsp_resp_get_version (gnutls_ocsp_resp_t resp)
 }
 
 /**
- * gnutls_ocsp_resp_get_dn:
+ * gnutls_ocsp_resp_get_responder:
  * @resp: should contain a #gnutls_ocsp_resp_t structure
  * @dn: newly allocated buffer with name
  *
@@ -1152,8 +1152,8 @@ gnutls_ocsp_resp_get_version (gnutls_ocsp_resp_t resp)
  *   negative error code is returned.
  **/
 int
-gnutls_ocsp_resp_get_responderid_dn (gnutls_ocsp_resp_t resp,
-                                    gnutls_datum_t *dn)
+gnutls_ocsp_resp_get_responder (gnutls_ocsp_resp_t resp,
+                               gnutls_datum_t *dn)
 {
   int ret;
   size_t l = 0;
@@ -1195,7 +1195,7 @@ gnutls_ocsp_resp_get_responderid_dn (gnutls_ocsp_resp_t 
resp,
 }
 
 /**
- * gnutls_ocsp_resp_get_producedat:
+ * gnutls_ocsp_resp_get_produced:
  * @resp: should contain a #gnutls_ocsp_resp_t structure
  *
  * This function will return the time when the OCSP response was
@@ -1204,7 +1204,7 @@ gnutls_ocsp_resp_get_responderid_dn (gnutls_ocsp_resp_t 
resp,
  * Returns: signing time, or (time_t)-1 on error.
  **/
 time_t
-gnutls_ocsp_resp_get_produceat (gnutls_ocsp_resp_t resp)
+gnutls_ocsp_resp_get_produced (gnutls_ocsp_resp_t resp)
 {
   char ttime[MAX_TIME];
   int len, ret;
@@ -1231,7 +1231,7 @@ gnutls_ocsp_resp_get_produceat (gnutls_ocsp_resp_t resp)
 }
 
 /**
- * gnutls_ocsp_resp_get_singleresponse:
+ * gnutls_ocsp_resp_get_single:
  * @resp: should contain a #gnutls_ocsp_resp_t structure
  * @indx: Specifies which extension OID to get. Use (0) to get the first one.
  * @digest: output variable with #gnutls_digest_algorithm_t hash algorithm
@@ -1261,21 +1261,21 @@ gnutls_ocsp_resp_get_produceat (gnutls_ocsp_resp_t resp)
  *
  * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
  *   negative error code is returned.  If you have reached the last
- *   certid available %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be
+ *   CertID available %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be
  *   returned.
  **/
 int
-gnutls_ocsp_resp_get_singleresponse (gnutls_ocsp_resp_t resp,
-                                    unsigned indx,
-                                    gnutls_digest_algorithm_t *digest,
-                                    gnutls_datum_t *issuer_name_hash,
-                                    gnutls_datum_t *issuer_key_hash,
-                                    gnutls_datum_t *serial_number,
-                                    int *cert_status,
-                                    time_t *this_update,
-                                    time_t *next_update,
-                                    time_t *revocation_time,
-                                    int *revocation_reason)
+gnutls_ocsp_resp_get_single (gnutls_ocsp_resp_t resp,
+                            unsigned indx,
+                            gnutls_digest_algorithm_t *digest,
+                            gnutls_datum_t *issuer_name_hash,
+                            gnutls_datum_t *issuer_key_hash,
+                            gnutls_datum_t *serial_number,
+                            int *cert_status,
+                            time_t *this_update,
+                            time_t *next_update,
+                            time_t *revocation_time,
+                            int *revocation_reason)
 {
   gnutls_datum_t sa;
   char name[ASN1_MAX_NAME_SIZE];
@@ -1776,7 +1776,7 @@ find_signercert (gnutls_ocsp_resp_t resp)
   gnutls_datum_t riddn;
   gnutls_x509_crt_t signercert = NULL;
 
-  rc = gnutls_ocsp_resp_get_responderid_dn (resp, &riddn);
+  rc = gnutls_ocsp_resp_get_responder (resp, &riddn);
   if (rc != GNUTLS_E_SUCCESS)
     {
       gnutls_assert ();
diff --git a/lib/x509/ocsp_output.c b/lib/x509/ocsp_output.c
index a07f1cb..137f734 100644
--- a/lib/x509/ocsp_output.c
+++ b/lib/x509/ocsp_output.c
@@ -62,13 +62,13 @@ print_req (gnutls_buffer_st * str, gnutls_ocsp_req_t req)
       gnutls_digest_algorithm_t digest;
       gnutls_datum_t in, ik, sn;
 
-      ret = gnutls_ocsp_req_get_certid (req, indx, &digest, &in, &ik, &sn);
+      ret = gnutls_ocsp_req_get_cert_id (req, indx, &digest, &in, &ik, &sn);
       if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
        break;
       addf (str, "\t\tCertificate ID:\n");
       if (ret != GNUTLS_E_SUCCESS)
        {
-         addf (str, "error: get_certid: %s\n",
+         addf (str, "error: get_cert_id: %s\n",
                gnutls_strerror (ret));
          continue;
        }
@@ -174,6 +174,7 @@ gnutls_ocsp_req_print (gnutls_ocsp_req_t req,
                        gnutls_datum_t * out)
 {
   gnutls_buffer_st str;
+  int rc;
 
   if (format != GNUTLS_OCSP_PRINT_FULL)
     {
@@ -188,8 +189,13 @@ gnutls_ocsp_req_print (gnutls_ocsp_req_t req,
   print_req (&str, req);
 
   _gnutls_buffer_append_data (&str, "\0", 1);
-  out->data = str.data;
-  out->size = strlen (str.data);
+
+  rc = _gnutls_buffer_to_datum (&str, out);
+  if (rc != GNUTLS_E_SUCCESS)
+    {
+      gnutls_assert ();
+      return rc;
+    }
 
   return GNUTLS_E_SUCCESS;
 }
@@ -282,7 +288,7 @@ print_resp (gnutls_buffer_st * str, gnutls_ocsp_resp_t resp)
 
     /* XXX byKey */
 
-    ret = gnutls_ocsp_resp_get_responderid_dn (resp, &dn);
+    ret = gnutls_ocsp_resp_get_responder (resp, &dn);
     if (ret < 0)
       addf (str, "error: get_dn: %s\n", gnutls_strerror (ret));
     else
@@ -296,10 +302,10 @@ print_resp (gnutls_buffer_st * str, gnutls_ocsp_resp_t 
resp)
     char s[42];
     size_t max = sizeof (s);
     struct tm t;
-    time_t tim = gnutls_ocsp_resp_get_produceat (resp);
+    time_t tim = gnutls_ocsp_resp_get_produced (resp);
 
     if (tim == (time_t) -1)
-      addf (str, "error: ocsp_resp_get_produceat\n");
+      addf (str, "error: ocsp_resp_get_produced\n");
     else if (gmtime_r (&tim, &t) == NULL)
       addf (str, "error: gmtime_r (%ld)\n", (unsigned long) tim);
     else if (strftime (s, max, "%a %b %d %H:%M:%S UTC %Y", &t) == 0)
@@ -319,14 +325,14 @@ print_resp (gnutls_buffer_st * str, gnutls_ocsp_resp_t 
resp)
       time_t revocation_time;
       int revocation_reason;
 
-      ret = gnutls_ocsp_resp_get_singleresponse (resp,
-                                                indx,
-                                                &digest, &in, &ik, &sn,
-                                                &cert_status,
-                                                &this_update,
-                                                &next_update,
-                                                &revocation_time,
-                                                &revocation_reason);
+      ret = gnutls_ocsp_resp_get_single (resp,
+                                        indx,
+                                        &digest, &in, &ik, &sn,
+                                        &cert_status,
+                                        &this_update,
+                                        &next_update,
+                                        &revocation_time,
+                                        &revocation_reason);
       if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
        break;
       addf (str, "\t\tCertificate ID:\n");
@@ -596,6 +602,7 @@ gnutls_ocsp_resp_print (gnutls_ocsp_resp_t resp,
                        gnutls_datum_t * out)
 {
   gnutls_buffer_st str;
+  int rc;
 
   if (format != GNUTLS_OCSP_PRINT_FULL)
     {
@@ -610,8 +617,13 @@ gnutls_ocsp_resp_print (gnutls_ocsp_resp_t resp,
   print_resp (&str, resp);
 
   _gnutls_buffer_append_data (&str, "\0", 1);
-  out->data = str.data;
-  out->size = strlen (str.data);
+
+  rc = _gnutls_buffer_to_datum (&str, out);
+  if (rc != GNUTLS_E_SUCCESS)
+    {
+      gnutls_assert ();
+      return rc;
+    }
 
   return GNUTLS_E_SUCCESS;
 }


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]