subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1603874 - in /subversion/branches/svn-auth-x509/subversion/libsvn_subr: x509.h x509parse.c
Date Thu, 19 Jun 2014 13:19:49 GMT
Author: stsp
Date: Thu Jun 19 13:19:48 2014
New Revision: 1603874

URL: http://svn.apache.org/r1603874
Log:
On the svn-auth-x590 branch, don't re-allocate and copy the source data
buffer while parsing certificates, and don't keep a copy of the raw data
in the parsed result.

* subversion/libsvn_subr/x509.h
  (x509_cert): Remove 'raw' buffer for raw cert data.
  (svn_x509_parse_cert): Remove 'const' from input buffer to avoid
   having to cast away const in the implementation.

* subversion/libsvn_subr/x509parse.c
  (svn_x509_parse_cert): Don't copy input buffer and don't rely on
   the raw cert data buffer for parsing.

Modified:
    subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h
    subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h?rev=1603874&r1=1603873&r2=1603874&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h Thu Jun 19 13:19:48 2014
@@ -140,7 +140,6 @@ typedef struct _x509_time {
 } x509_time;
 
 typedef struct _x509_cert {
-  x509_buf raw;
   x509_buf tbs;
 
   int version;
@@ -177,7 +176,7 @@ extern "C" {
   /* Parse x509 DER certificate data from BUF (with length BUFLEN),
    * returning a structured representation in *CERT, allocated in RESULT_POOL. */
   int svn_x509_parse_cert(x509_cert **cert,
-                          const unsigned char *buf,
+                          unsigned char *buf,
                           int buflen,
                           apr_pool_t *result_pool,
                           apr_pool_t *scratch_pool);

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c?rev=1603874&r1=1603873&r2=1603874&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c Thu Jun 19 13:19:48
2014
@@ -421,7 +421,7 @@ static int x509_get_uid(unsigned char **
  */
 int
 svn_x509_parse_cert(x509_cert **cert,
-                    const unsigned char *buf,
+                    unsigned char *buf,
                     int buflen,
                     apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool)
@@ -432,21 +432,8 @@ svn_x509_parse_cert(x509_cert **cert,
   x509_cert *crt;
 
   crt = apr_pcalloc(result_pool, sizeof(*crt));
-
-  /*
-   * Copy the raw DER data.
-   */
-  p = (unsigned char *)malloc(len = buflen);
-
-  if (p == NULL)
-    return (1);
-
-  memcpy(p, buf, buflen);
-
-  buflen = 0;
-
-  crt->raw.p = p;
-  crt->raw.len = len;
+  p = buf;
+  len = buflen;
   end = p + len;
 
   /*
@@ -589,7 +576,7 @@ svn_x509_parse_cert(x509_cert **cert,
       TROPICSSL_ERR_ASN1_LENGTH_MISMATCH);
   }
 
-  end = crt->raw.p + crt->raw.len;
+  end = buf + buflen;
 
   /*
    *      signatureAlgorithm       AlgorithmIdentifier,



Mime
View raw message