Re: const for X509_CRL_* functions

2018-05-18 Thread Brent Cook
ok bcook@

On Fri, May 18, 2018 at 9:13 AM, Theo Buehler  wrote:

> On Fri, May 18, 2018 at 04:03:16PM +0200, Theo Buehler wrote:
> > Simple diff that adds const qualifiers to the X509_CRL *x and
> > ASN1_OBJECT *obj arguments of X509_CRL_get_ext_count(3),
> > X509_CRL_get_ext_by_NID(3), X509_CRL_get_ext_by_OBJ(3),
> > X509_CRL_get_ext_by_critical(3), X509_CRL_get_ext(3),
> > X509_CRL_get_ext_d2i(3).
>
> I forgot to mention two things. First, this continues my working through
> the big diff that was in sthen's bulk last week. Second, please don't
> request whitespace changes here. I've already wasted enough time on
> this.
>
> >
> > Index: lib/libcrypto/x509/x509.h
> > ===
> > RCS file: /var/cvs/src/lib/libcrypto/x509/x509.h,v
> > retrieving revision 1.49
> > diff -u -p -r1.49 x509.h
> > --- lib/libcrypto/x509/x509.h 13 May 2018 10:36:35 -  1.49
> > +++ lib/libcrypto/x509/x509.h 18 May 2018 13:54:54 -
> > @@ -1149,16 +1149,20 @@ void  *   X509_get_ext_d2i(X509 *x, int nid
> >  int  X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
> >   unsigned long
> flags);
> >
> > -int  X509_CRL_get_ext_count(X509_CRL *x);
> > -int  X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int
> lastpos);
> > -int  X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int
> lastpos);
> > -int  X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int
> lastpos);
> > -X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);
> > +int  X509_CRL_get_ext_count(const X509_CRL *x);
> > +int  X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid,
> > + int lastpos);
> > +int  X509_CRL_get_ext_by_OBJ(const X509_CRL *x,
> > + const ASN1_OBJECT *obj, int lastpos);
> > +int  X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit,
> > + int lastpos);
> > +X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);
> >  X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
> >  int  X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
> > -void *   X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int
> *idx);
> > -int  X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value,
> int crit,
> > - unsigned long
> flags);
> > +void *   X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit,
> > + int *idx);
> > +int  X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value,
> > + int crit, unsigned long flags);
> >
> >  int  X509_REVOKED_get_ext_count(X509_REVOKED *x);
> >  int  X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int
> lastpos);
> > Index: lib/libcrypto/x509/x509_ext.c
> > ===
> > RCS file: /var/cvs/src/lib/libcrypto/x509/x509_ext.c,v
> > retrieving revision 1.9
> > diff -u -p -r1.9 x509_ext.c
> > --- lib/libcrypto/x509/x509_ext.c 10 Feb 2015 08:33:10 -  1.9
> > +++ lib/libcrypto/x509/x509_ext.c 18 May 2018 13:54:54 -
> > @@ -66,31 +66,31 @@
> >  #include 
> >
> >  int
> > -X509_CRL_get_ext_count(X509_CRL *x)
> > +X509_CRL_get_ext_count(const X509_CRL *x)
> >  {
> >   return (X509v3_get_ext_count(x->crl->extensions));
> >  }
> >
> >  int
> > -X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos)
> > +X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos)
> >  {
> >   return (X509v3_get_ext_by_NID(x->crl->extensions, nid, lastpos));
> >  }
> >
> >  int
> > -X509_CRL_get_ext_by_OBJ(X509_CRL *x, ASN1_OBJECT *obj, int lastpos)
> > +X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, int
> lastpos)
> >  {
> >   return (X509v3_get_ext_by_OBJ(x->crl->extensions, obj, lastpos));
> >  }
> >
> >  int
> > -X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos)
> > +X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos)
> >  {
> >   return (X509v3_get_ext_by_critical(x->crl->extensions, crit,
> lastpos));
> >  }
> >
> >  X509_EXTENSION *
> > -X509_CRL_get_ext(X509_CRL *x, int loc)
> > +X509_CRL_get_ext(const X509_CRL *x, int loc)
> >  {
> >   return (X509v3_get_ext(x->crl->extensions, loc));
> >  }
> > @@ -102,7 +102,7 @@ X509_CRL_delete_ext(X509_CRL *x, int loc
> >  }
> >
> >  void *
> > -X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx)
> > +X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx)
> >  {
> >   return X509V3_get_d2i(x->crl->extensions, nid, crit, idx);
> >  }
> >
>


Re: const for X509_CRL_* functions

2018-05-18 Thread Theo Buehler
On Fri, May 18, 2018 at 04:03:16PM +0200, Theo Buehler wrote:
> Simple diff that adds const qualifiers to the X509_CRL *x and
> ASN1_OBJECT *obj arguments of X509_CRL_get_ext_count(3),
> X509_CRL_get_ext_by_NID(3), X509_CRL_get_ext_by_OBJ(3),
> X509_CRL_get_ext_by_critical(3), X509_CRL_get_ext(3),
> X509_CRL_get_ext_d2i(3).

I forgot to mention two things. First, this continues my working through
the big diff that was in sthen's bulk last week. Second, please don't
request whitespace changes here. I've already wasted enough time on
this.

> 
> Index: lib/libcrypto/x509/x509.h
> ===
> RCS file: /var/cvs/src/lib/libcrypto/x509/x509.h,v
> retrieving revision 1.49
> diff -u -p -r1.49 x509.h
> --- lib/libcrypto/x509/x509.h 13 May 2018 10:36:35 -  1.49
> +++ lib/libcrypto/x509/x509.h 18 May 2018 13:54:54 -
> @@ -1149,16 +1149,20 @@ void  *   X509_get_ext_d2i(X509 *x, int nid
>  int  X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
>   unsigned long flags);
>  
> -int  X509_CRL_get_ext_count(X509_CRL *x);
> -int  X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);
> -int  X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int 
> lastpos);
> -int  X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int 
> lastpos);
> -X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);
> +int  X509_CRL_get_ext_count(const X509_CRL *x);
> +int  X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid,
> + int lastpos);
> +int  X509_CRL_get_ext_by_OBJ(const X509_CRL *x,
> + const ASN1_OBJECT *obj, int lastpos);
> +int  X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit,
> + int lastpos);
> +X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);
>  X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
>  int  X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
> -void *   X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);
> -int  X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int 
> crit,
> - unsigned long flags);
> +void *   X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit,
> + int *idx);
> +int  X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value,
> + int crit, unsigned long flags);
>  
>  int  X509_REVOKED_get_ext_count(X509_REVOKED *x);
>  int  X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int 
> lastpos);
> Index: lib/libcrypto/x509/x509_ext.c
> ===
> RCS file: /var/cvs/src/lib/libcrypto/x509/x509_ext.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 x509_ext.c
> --- lib/libcrypto/x509/x509_ext.c 10 Feb 2015 08:33:10 -  1.9
> +++ lib/libcrypto/x509/x509_ext.c 18 May 2018 13:54:54 -
> @@ -66,31 +66,31 @@
>  #include 
>  
>  int
> -X509_CRL_get_ext_count(X509_CRL *x)
> +X509_CRL_get_ext_count(const X509_CRL *x)
>  {
>   return (X509v3_get_ext_count(x->crl->extensions));
>  }
>  
>  int
> -X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos)
> +X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos)
>  {
>   return (X509v3_get_ext_by_NID(x->crl->extensions, nid, lastpos));
>  }
>  
>  int
> -X509_CRL_get_ext_by_OBJ(X509_CRL *x, ASN1_OBJECT *obj, int lastpos)
> +X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, int 
> lastpos)
>  {
>   return (X509v3_get_ext_by_OBJ(x->crl->extensions, obj, lastpos));
>  }
>  
>  int
> -X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos)
> +X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos)
>  {
>   return (X509v3_get_ext_by_critical(x->crl->extensions, crit, lastpos));
>  }
>  
>  X509_EXTENSION *
> -X509_CRL_get_ext(X509_CRL *x, int loc)
> +X509_CRL_get_ext(const X509_CRL *x, int loc)
>  {
>   return (X509v3_get_ext(x->crl->extensions, loc));
>  }
> @@ -102,7 +102,7 @@ X509_CRL_delete_ext(X509_CRL *x, int loc
>  }
>  
>  void *
> -X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx)
> +X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx)
>  {
>   return X509V3_get_d2i(x->crl->extensions, nid, crit, idx);
>  }
> 



const for X509_CRL_* functions

2018-05-18 Thread Theo Buehler
Simple diff that adds const qualifiers to the X509_CRL *x and
ASN1_OBJECT *obj arguments of X509_CRL_get_ext_count(3),
X509_CRL_get_ext_by_NID(3), X509_CRL_get_ext_by_OBJ(3),
X509_CRL_get_ext_by_critical(3), X509_CRL_get_ext(3),
X509_CRL_get_ext_d2i(3).

Index: lib/libcrypto/x509/x509.h
===
RCS file: /var/cvs/src/lib/libcrypto/x509/x509.h,v
retrieving revision 1.49
diff -u -p -r1.49 x509.h
--- lib/libcrypto/x509/x509.h   13 May 2018 10:36:35 -  1.49
+++ lib/libcrypto/x509/x509.h   18 May 2018 13:54:54 -
@@ -1149,16 +1149,20 @@ void*   X509_get_ext_d2i(X509 *x, int nid
 intX509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
unsigned long flags);
 
-intX509_CRL_get_ext_count(X509_CRL *x);
-intX509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);
-intX509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int 
lastpos);
-intX509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int 
lastpos);
-X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);
+intX509_CRL_get_ext_count(const X509_CRL *x);
+intX509_CRL_get_ext_by_NID(const X509_CRL *x, int nid,
+   int lastpos);
+intX509_CRL_get_ext_by_OBJ(const X509_CRL *x,
+   const ASN1_OBJECT *obj, int lastpos);
+intX509_CRL_get_ext_by_critical(const X509_CRL *x, int crit,
+   int lastpos);
+X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);
 X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
 intX509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
-void   *   X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);
-intX509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int 
crit,
-   unsigned long flags);
+void   *   X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit,
+   int *idx);
+intX509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value,
+   int crit, unsigned long flags);
 
 intX509_REVOKED_get_ext_count(X509_REVOKED *x);
 intX509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int 
lastpos);
Index: lib/libcrypto/x509/x509_ext.c
===
RCS file: /var/cvs/src/lib/libcrypto/x509/x509_ext.c,v
retrieving revision 1.9
diff -u -p -r1.9 x509_ext.c
--- lib/libcrypto/x509/x509_ext.c   10 Feb 2015 08:33:10 -  1.9
+++ lib/libcrypto/x509/x509_ext.c   18 May 2018 13:54:54 -
@@ -66,31 +66,31 @@
 #include 
 
 int
-X509_CRL_get_ext_count(X509_CRL *x)
+X509_CRL_get_ext_count(const X509_CRL *x)
 {
return (X509v3_get_ext_count(x->crl->extensions));
 }
 
 int
-X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos)
+X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos)
 {
return (X509v3_get_ext_by_NID(x->crl->extensions, nid, lastpos));
 }
 
 int
-X509_CRL_get_ext_by_OBJ(X509_CRL *x, ASN1_OBJECT *obj, int lastpos)
+X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, int lastpos)
 {
return (X509v3_get_ext_by_OBJ(x->crl->extensions, obj, lastpos));
 }
 
 int
-X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos)
+X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos)
 {
return (X509v3_get_ext_by_critical(x->crl->extensions, crit, lastpos));
 }
 
 X509_EXTENSION *
-X509_CRL_get_ext(X509_CRL *x, int loc)
+X509_CRL_get_ext(const X509_CRL *x, int loc)
 {
return (X509v3_get_ext(x->crl->extensions, loc));
 }
@@ -102,7 +102,7 @@ X509_CRL_delete_ext(X509_CRL *x, int loc
 }
 
 void *
-X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx)
+X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx)
 {
return X509V3_get_d2i(x->crl->extensions, nid, crit, idx);
 }