Re: Fix acpi(4) GeneralSerialBus implementation

2018-05-18 Thread Mike Larkin
On Fri, May 18, 2018 at 08:53:41PM +0200, Mark Kettenis wrote:
> Turns out there is an alternate way to encode
> AttribBytes/AttribRawBytes (and AttribRawProcessBytes) that I didn't
> implement.  In fact our parsing of fields has always been wrong when
> this alternative encoding is present.  But for some reason we lucked
> out the parser didn't go fully off the rails.
> 
> Diff below fixes this issue and makes the battery status on my Asus
> Transformerr Book T100HA work.
> 
> ok?
> 

See below...

-ml

> 
> Index: dev/acpi/dsdt.c
> ===
> RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
> retrieving revision 1.238
> diff -u -p -r1.238 dsdt.c
> --- dev/acpi/dsdt.c   17 May 2018 20:21:15 -  1.238
> +++ dev/acpi/dsdt.c   18 May 2018 18:51:36 -
> @@ -2293,7 +2293,7 @@ aml_register_regionspace(struct aml_node
>  
>  void aml_rwgen(struct aml_value *, int, int, struct aml_value *, int, int);
>  void aml_rwgpio(struct aml_value *, int, int, struct aml_value *, int, int);
> -void aml_rwgsb(struct aml_value *, int, int, struct aml_value *, int, int);
> +void aml_rwgsb(struct aml_value *, int, int, int, struct aml_value *, int, 
> int);
>  void aml_rwindexfield(struct aml_value *, struct aml_value *val, int);
>  void aml_rwfield(struct aml_value *, int, int, struct aml_value *, int);
>  
> @@ -2518,8 +2518,8 @@ aml_rwgpio(struct aml_value *conn, int b
>  }
>  
>  void
> -aml_rwgsb(struct aml_value *conn, int bpos, int blen, struct aml_value *val,
> -int mode, int flag)
> +aml_rwgsb(struct aml_value *conn, int alen, int bpos, int blen,
> +struct aml_value *val, int mode, int flag)
>  {
>   union acpi_resource *crs = (union acpi_resource *)conn->v_buffer;
>   struct aml_node *node;
> @@ -2564,6 +2564,14 @@ aml_rwgsb(struct aml_value *conn, int bp
>   cmdlen = 1;
>   buflen = 2;
>   break;
> + case 0x0b:  /* AttribBytes */
> + cmdlen = 1;
> + buflen = alen;
> + break;
> + case 0x0e:  /* AttribRawBytes */
> + cmdlen = 1;
> + cmdlen = alen;

The previous two lines don't look right...

> + break;
>   default:
>   aml_die("unsupported access type 0x%x", flag);
>   break;
> @@ -2709,7 +2717,8 @@ aml_rwfield(struct aml_value *fld, int b
>   fld->v_field.flags);
>   break;
>   case ACPI_OPREG_GSB:
> - aml_rwgsb(ref2, fld->v_field.bitpos + bpos, blen,
> + aml_rwgsb(ref2, fld->v_field.ref3,
> + fld->v_field.bitpos + bpos, blen,
>   val, mode, fld->v_field.flags);
>   break;
>   default:
> @@ -2795,17 +2804,17 @@ aml_parsefieldlist(struct aml_scope *msc
>   bpos = 0;
>   while (mscope->pos < mscope->end) {
>   switch (*mscope->pos) {
> - case 0x00: /* reserved, length */
> + case 0x00: /* ReservedField */
>   mscope->pos++;
>   blen = aml_parselength(mscope);
>   break;
> - case 0x01: /* attrib */
> + case 0x01: /* AccessField */
>   mscope->pos++;
>   blen = 0;
>   flags = aml_get8(mscope->pos++);
>   flags |= aml_get8(mscope->pos++) << 8;
>   break;
> - case 0x02: /* connection */
> + case 0x02: /* ConnectionField */
>   mscope->pos++;
>   blen = 0;
>   conn = aml_parse(mscope, 'o', "Connection");
> @@ -2813,7 +2822,14 @@ aml_parsefieldlist(struct aml_scope *msc
>   aml_die("Could not parse connection");
>   conn->node = mscope->node;
>   break;
> - default: /* 4-byte name, length */
> + case 0x03: /* ExtendedAccessField */
> + mscope->pos++;
> + blen = 0;
> + flags = aml_get8(mscope->pos++);
> + flags |= aml_get8(mscope->pos++) << 8;
> + indexval = aml_get8(mscope->pos++);
> + break;
> + default: /* NamedField */
>   mscope->pos = aml_parsename(mscope->node, mscope->pos,
>   , 1);
>   blen = aml_parselength(mscope);
> 



libcrypto const: first round of mopping up

2018-05-18 Thread Theo Buehler
This is a potpourri of functions that still need conversion. I either
missed them in eaerlier batches or they didn't fit nicely with anything
else. It's the last piece of the big diff that sthen ran through his
bulk build.

Note that this diff needs my previous submission

"const for s2i_* and i2s_ conversion functions"

to compile.

Index: lib/libcrypto/asn1/a_strex.c
===
RCS file: /var/cvs/src/lib/libcrypto/asn1/a_strex.c,v
retrieving revision 1.27
diff -u -p -r1.27 a_strex.c
--- lib/libcrypto/asn1/a_strex.c18 May 2018 18:23:24 -  1.27
+++ lib/libcrypto/asn1/a_strex.c19 May 2018 04:02:36 -
@@ -624,7 +624,7 @@ ASN1_STRING_print_ex_fp(FILE *fp, const 
  */
 
 int
-ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
+ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in)
 {
ASN1_STRING stmp, *str = 
int mbflag, type, ret;
Index: lib/libcrypto/asn1/asn1.h
===
RCS file: /var/cvs/src/lib/libcrypto/asn1/asn1.h,v
retrieving revision 1.48
diff -u -p -r1.48 asn1.h
--- lib/libcrypto/asn1/asn1.h   1 May 2018 13:29:09 -   1.48
+++ lib/libcrypto/asn1/asn1.h   19 May 2018 04:02:36 -
@@ -1055,7 +1055,7 @@ int ASN1_item_i2d_fp(const ASN1_ITEM *it
 int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str,
 unsigned long flags);
 
-int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
+int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in);
 
 #ifndef OPENSSL_NO_BIO
 void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
Index: lib/libcrypto/ui/ui.h
===
RCS file: /var/cvs/src/lib/libcrypto/ui/ui.h,v
retrieving revision 1.9
diff -u -p -r1.9 ui.h
--- lib/libcrypto/ui/ui.h   10 Jul 2014 22:45:58 -  1.9
+++ lib/libcrypto/ui/ui.h   19 May 2018 04:02:36 -
@@ -304,7 +304,7 @@ enum UI_string_types {
 };
 
 /* Create and manipulate methods */
-UI_METHOD *UI_create_method(char *name);
+UI_METHOD *UI_create_method(const char *name);
 void UI_destroy_method(UI_METHOD *ui_method);
 int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui));
 int UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING 
*uis));
Index: lib/libcrypto/ui/ui_lib.c
===
RCS file: /var/cvs/src/lib/libcrypto/ui/ui_lib.c,v
retrieving revision 1.32
diff -u -p -r1.32 ui_lib.c
--- lib/libcrypto/ui/ui_lib.c   29 Jan 2017 17:49:23 -  1.32
+++ lib/libcrypto/ui/ui_lib.c   19 May 2018 04:02:36 -
@@ -582,7 +582,7 @@ UI_set_method(UI *ui, const UI_METHOD *m
 
 
 UI_METHOD *
-UI_create_method(char *name)
+UI_create_method(const char *name)
 {
UI_METHOD *ui_method = calloc(1, sizeof(UI_METHOD));
 
Index: lib/libcrypto/x509/x509.h
===
RCS file: /var/cvs/src/lib/libcrypto/x509/x509.h,v
retrieving revision 1.65
diff -u -p -r1.65 x509.h
--- lib/libcrypto/x509/x509.h   18 May 2018 19:28:27 -  1.65
+++ lib/libcrypto/x509/x509.h   19 May 2018 04:02:36 -
@@ -1107,8 +1107,8 @@ X509_NAME_ENTRY *X509_NAME_get_entry(con
 X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);
 intX509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne,
int loc, int set);
-int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
-   const unsigned char *bytes, int len, int loc, int set);
+int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj,
+int type, const unsigned char *bytes, int len, int loc, int set);
 int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
const unsigned char *bytes, int len, int loc, int set);
 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
@@ -1186,7 +1186,7 @@ int   X509_REVOKED_add1_ext_i2d(X509_REVO
 X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
int nid, int crit, ASN1_OCTET_STRING *data);
 X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
-   ASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data);
+const ASN1_OBJECT *obj, int crit, ASN1_OCTET_STRING *data);
 intX509_EXTENSION_set_object(X509_EXTENSION *ex,
const ASN1_OBJECT *obj);
 intX509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
Index: lib/libcrypto/x509/x509_v3.c
===
RCS file: /var/cvs/src/lib/libcrypto/x509/x509_v3.c,v
retrieving revision 1.16
diff -u -p -r1.16 x509_v3.c
--- lib/libcrypto/x509/x509_v3.c18 May 2018 16:55:58 -  1.16
+++ lib/libcrypto/x509/x509_v3.c19 May 2018 04:02:36 -
@@ -209,8 

const for s2i_* and i2s_ conversion functions

2018-05-18 Thread Theo Buehler
The last bit of my const spree can be nicely be cut into two pieces.
The first piece sprinkles some const over these conversion methods:

i2o_ECPublicKey(), i2s_ASN1_OCTET_STRING(), s2i_ASN1_OCTET_STRING(),
i2s_ASN1_INTEGER(), i2s_ASN1_ENUMERATED(), i2s_ASN1_ENUMERATED_TABLE().

Index: lib/libcrypto/ec/ec.h
===
RCS file: /var/cvs/src/lib/libcrypto/ec/ec.h,v
retrieving revision 1.12
diff -u -p -r1.12 ec.h
--- lib/libcrypto/ec/ec.h   4 Nov 2016 17:33:19 -   1.12
+++ lib/libcrypto/ec/ec.h   19 May 2018 04:01:44 -
@@ -911,7 +911,7 @@ EC_KEY *o2i_ECPublicKey(EC_KEY **key, co
  *   of bytes needed).
  *  \return 1 on success and 0 if an error occurred
  */
-int i2o_ECPublicKey(EC_KEY *key, unsigned char **out);
+int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out);
 
 #ifndef OPENSSL_NO_BIO
 /** Prints out the ec parameters on human readable form.
Index: lib/libcrypto/ec/ec_asn1.c
===
RCS file: /var/cvs/src/lib/libcrypto/ec/ec_asn1.c,v
retrieving revision 1.26
diff -u -p -r1.26 ec_asn1.c
--- lib/libcrypto/ec/ec_asn1.c  23 Apr 2018 09:37:50 -  1.26
+++ lib/libcrypto/ec/ec_asn1.c  19 May 2018 04:01:44 -
@@ -1586,7 +1586,7 @@ o2i_ECPublicKey(EC_KEY ** a, const unsig
 }
 
 int 
-i2o_ECPublicKey(EC_KEY * a, unsigned char **out)
+i2o_ECPublicKey(const EC_KEY * a, unsigned char **out)
 {
size_t buf_len = 0;
int new_buffer = 0;
Index: lib/libcrypto/x509v3/v3_enum.c
===
RCS file: /var/cvs/src/lib/libcrypto/x509v3/v3_enum.c,v
retrieving revision 1.12
diff -u -p -r1.12 v3_enum.c
--- lib/libcrypto/x509v3/v3_enum.c  30 Dec 2016 15:54:49 -  1.12
+++ lib/libcrypto/x509v3/v3_enum.c  19 May 2018 04:01:44 -
@@ -93,7 +93,7 @@ const X509V3_EXT_METHOD v3_crl_reason = 
 };
 
 char *
-i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, ASN1_ENUMERATED *e)
+i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *e)
 {
ENUMERATED_NAMES *enam;
long strval;
Index: lib/libcrypto/x509v3/v3_info.c
===
RCS file: /var/cvs/src/lib/libcrypto/x509v3/v3_info.c,v
retrieving revision 1.25
diff -u -p -r1.25 v3_info.c
--- lib/libcrypto/x509v3/v3_info.c  29 Jan 2017 17:49:23 -  1.25
+++ lib/libcrypto/x509v3/v3_info.c  19 May 2018 04:01:44 -
@@ -293,7 +293,7 @@ err:
 }
 
 int
-i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION* a)
+i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION* a)
 {
i2a_ASN1_OBJECT(bp, a->method);
return 2;
Index: lib/libcrypto/x509v3/v3_skey.c
===
RCS file: /var/cvs/src/lib/libcrypto/x509v3/v3_skey.c,v
retrieving revision 1.15
diff -u -p -r1.15 v3_skey.c
--- lib/libcrypto/x509v3/v3_skey.c  29 Jan 2017 17:49:23 -  1.15
+++ lib/libcrypto/x509v3/v3_skey.c  19 May 2018 04:01:44 -
@@ -83,13 +83,14 @@ const X509V3_EXT_METHOD v3_skey_id = {
 };
 
 char *
-i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *oct)
+i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, const ASN1_OCTET_STRING *oct)
 {
return hex_to_string(oct->data, oct->length);
 }
 
 ASN1_OCTET_STRING *
-s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str)
+s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
+const char *str)
 {
ASN1_OCTET_STRING *oct;
long length;
Index: lib/libcrypto/x509v3/v3_utl.c
===
RCS file: /var/cvs/src/lib/libcrypto/x509v3/v3_utl.c,v
retrieving revision 1.29
diff -u -p -r1.29 v3_utl.c
--- lib/libcrypto/x509v3/v3_utl.c   18 May 2018 19:34:37 -  1.29
+++ lib/libcrypto/x509v3/v3_utl.c   19 May 2018 04:01:44 -
@@ -150,7 +150,7 @@ X509V3_add_value_bool_nf(const char *nam
 
 
 char *
-i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *method, ASN1_ENUMERATED *a)
+i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *a)
 {
BIGNUM *bntmp = NULL;
char *strtmp = NULL;
@@ -165,7 +165,7 @@ i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *m
 }
 
 char *
-i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, ASN1_INTEGER *a)
+i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a)
 {
BIGNUM *bntmp = NULL;
char *strtmp = NULL;
Index: lib/libcrypto/x509v3/x509v3.h
===
RCS file: /var/cvs/src/lib/libcrypto/x509v3/x509v3.h,v
retrieving revision 1.27
diff -u -p -r1.27 x509v3.h
--- lib/libcrypto/x509v3/x509v3.h   18 May 2018 19:34:37 -  1.27
+++ lib/libcrypto/x509v3/x509v3.h   19 May 2018 04:01:44 -
@@ -595,15 +595,17 @@ int GENERAL_NAME_set0_othername(GENERAL_
 int 

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);
> >  }
> >
>


Fix acpi(4) GeneralSerialBus implementation

2018-05-18 Thread Mark Kettenis
Turns out there is an alternate way to encode
AttribBytes/AttribRawBytes (and AttribRawProcessBytes) that I didn't
implement.  In fact our parsing of fields has always been wrong when
this alternative encoding is present.  But for some reason we lucked
out the parser didn't go fully off the rails.

Diff below fixes this issue and makes the battery status on my Asus
Transformerr Book T100HA work.

ok?


Index: dev/acpi/dsdt.c
===
RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v
retrieving revision 1.238
diff -u -p -r1.238 dsdt.c
--- dev/acpi/dsdt.c 17 May 2018 20:21:15 -  1.238
+++ dev/acpi/dsdt.c 18 May 2018 18:51:36 -
@@ -2293,7 +2293,7 @@ aml_register_regionspace(struct aml_node
 
 void aml_rwgen(struct aml_value *, int, int, struct aml_value *, int, int);
 void aml_rwgpio(struct aml_value *, int, int, struct aml_value *, int, int);
-void aml_rwgsb(struct aml_value *, int, int, struct aml_value *, int, int);
+void aml_rwgsb(struct aml_value *, int, int, int, struct aml_value *, int, 
int);
 void aml_rwindexfield(struct aml_value *, struct aml_value *val, int);
 void aml_rwfield(struct aml_value *, int, int, struct aml_value *, int);
 
@@ -2518,8 +2518,8 @@ aml_rwgpio(struct aml_value *conn, int b
 }
 
 void
-aml_rwgsb(struct aml_value *conn, int bpos, int blen, struct aml_value *val,
-int mode, int flag)
+aml_rwgsb(struct aml_value *conn, int alen, int bpos, int blen,
+struct aml_value *val, int mode, int flag)
 {
union acpi_resource *crs = (union acpi_resource *)conn->v_buffer;
struct aml_node *node;
@@ -2564,6 +2564,14 @@ aml_rwgsb(struct aml_value *conn, int bp
cmdlen = 1;
buflen = 2;
break;
+   case 0x0b:  /* AttribBytes */
+   cmdlen = 1;
+   buflen = alen;
+   break;
+   case 0x0e:  /* AttribRawBytes */
+   cmdlen = 1;
+   cmdlen = alen;
+   break;
default:
aml_die("unsupported access type 0x%x", flag);
break;
@@ -2709,7 +2717,8 @@ aml_rwfield(struct aml_value *fld, int b
fld->v_field.flags);
break;
case ACPI_OPREG_GSB:
-   aml_rwgsb(ref2, fld->v_field.bitpos + bpos, blen,
+   aml_rwgsb(ref2, fld->v_field.ref3,
+   fld->v_field.bitpos + bpos, blen,
val, mode, fld->v_field.flags);
break;
default:
@@ -2795,17 +2804,17 @@ aml_parsefieldlist(struct aml_scope *msc
bpos = 0;
while (mscope->pos < mscope->end) {
switch (*mscope->pos) {
-   case 0x00: /* reserved, length */
+   case 0x00: /* ReservedField */
mscope->pos++;
blen = aml_parselength(mscope);
break;
-   case 0x01: /* attrib */
+   case 0x01: /* AccessField */
mscope->pos++;
blen = 0;
flags = aml_get8(mscope->pos++);
flags |= aml_get8(mscope->pos++) << 8;
break;
-   case 0x02: /* connection */
+   case 0x02: /* ConnectionField */
mscope->pos++;
blen = 0;
conn = aml_parse(mscope, 'o', "Connection");
@@ -2813,7 +2822,14 @@ aml_parsefieldlist(struct aml_scope *msc
aml_die("Could not parse connection");
conn->node = mscope->node;
break;
-   default: /* 4-byte name, length */
+   case 0x03: /* ExtendedAccessField */
+   mscope->pos++;
+   blen = 0;
+   flags = aml_get8(mscope->pos++);
+   flags |= aml_get8(mscope->pos++) << 8;
+   indexval = aml_get8(mscope->pos++);
+   break;
+   default: /* NamedField */
mscope->pos = aml_parsename(mscope->node, mscope->pos,
, 1);
blen = aml_parselength(mscope);



Yet more const for x509.

2018-05-18 Thread Theo Buehler
If I'm not totally confused, this is the penultimate big batch I have
lined up.

In this diff there are two things I'd like to mention:

* a2i_GENERAL_NAME() grew const for its 'char *value' argument. The
  function contains this piece of code:

if (!ASN1_STRING_set(gen->d.ia5, (unsigned char*)value,
strlen(value))) {

  which casts const away again. OpenSSL kept the cast. However:

int
ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
{
const char *data = _data;

  so I simply removed the (unsigned char *) cast.

* X509V3_get_string() and X509V3_get_section() contained redundant
  checks which disturbed me. I left the removal in the diff, but I
  could understand if people would prefer to keep them.

Index: lib/libcrypto/x509/x509.h
===
RCS file: /cvs/src/lib/libcrypto/x509/x509.h,v
retrieving revision 1.50
diff -u -p -r1.50 x509.h
--- lib/libcrypto/x509/x509.h   18 May 2018 14:19:46 -  1.50
+++ lib/libcrypto/x509/x509.h   18 May 2018 15:56:44 -
@@ -1049,7 +1049,7 @@ int X509_REVOKED_set_serialNumber(X509_R
 
 intX509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey);
 
-intX509_check_private_key(X509 *x509,EVP_PKEY *pkey);
+intX509_check_private_key(const X509 *x509, const EVP_PKEY *pkey);
 
 intX509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
 unsigned long  X509_issuer_and_serial_hash(X509 *a);
@@ -1138,14 +1138,15 @@ X509_EXTENSION *X509v3_delete_ext(STACK_
 STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,
 X509_EXTENSION *ex, int loc);
 
-intX509_get_ext_count(X509 *x);
-intX509_get_ext_by_NID(X509 *x, int nid, int lastpos);
-intX509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos);
-intX509_get_ext_by_critical(X509 *x, int crit, int lastpos);
-X509_EXTENSION *X509_get_ext(X509 *x, int loc);
+intX509_get_ext_count(const X509 *x);
+intX509_get_ext_by_NID(const X509 *x, int nid, int lastpos);
+intX509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj,
+   int lastpos);
+intX509_get_ext_by_critical(const X509 *x, int crit, int lastpos);
+X509_EXTENSION *X509_get_ext(const X509 *x, int loc);
 X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
 intX509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
-void   *   X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
+void   *   X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx);
 intX509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
unsigned long flags);
 
@@ -1217,7 +1218,7 @@ int X509_ATTRIBUTE_set1_object(X509_ATTR
 int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void 
*data, int len);
 void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx,
int atrtype, void *data);
-int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);
+int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr);
 ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
 ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
 
Index: lib/libcrypto/x509/x509_att.c
===
RCS file: /cvs/src/lib/libcrypto/x509/x509_att.c,v
retrieving revision 1.16
diff -u -p -r1.16 x509_att.c
--- lib/libcrypto/x509/x509_att.c   13 May 2018 06:48:00 -  1.16
+++ lib/libcrypto/x509/x509_att.c   18 May 2018 15:56:44 -
@@ -353,7 +353,7 @@ err:
 }
 
 int
-X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr)
+X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr)
 {
if (!attr->single)
return sk_ASN1_TYPE_num(attr->value.set);
Index: lib/libcrypto/x509/x509_cmp.c
===
RCS file: /cvs/src/lib/libcrypto/x509/x509_cmp.c,v
retrieving revision 1.32
diff -u -p -r1.32 x509_cmp.c
--- lib/libcrypto/x509/x509_cmp.c   13 May 2018 10:36:35 -  1.32
+++ lib/libcrypto/x509/x509_cmp.c   18 May 2018 15:56:44 -
@@ -343,12 +343,12 @@ X509_get0_pubkey_bitstr(const X509 *x)
 }
 
 int
-X509_check_private_key(X509 *x, EVP_PKEY *k)
+X509_check_private_key(const X509 *x, const EVP_PKEY *k)
 {
EVP_PKEY *xk;
int ret;
 
-   xk = X509_get_pubkey(x);
+   xk = X509_get0_pubkey(x);
 
if (xk)
ret = EVP_PKEY_cmp(xk, k);
Index: lib/libcrypto/x509/x509_ext.c
===
RCS file: /cvs/src/lib/libcrypto/x509/x509_ext.c,v
retrieving revision 1.10
diff -u -p -r1.10 x509_ext.c
--- lib/libcrypto/x509/x509_ext.c   18 May 2018 14:19:46 -  1.10
+++ lib/libcrypto/x509/x509_ext.c   18 May 2018 

x509 const continued

2018-05-18 Thread Theo Buehler
Most of these are trivial getters. Only X509_TRUST_add(3),
X509_PURPOSE_get_by_sname(3) and X509_PURPOSE_add(3) require a bit more
work.

Again part of sthen's bulk.

Index: lib/libcrypto/x509/x509.h
===
RCS file: /cvs/src/lib/libcrypto/x509/x509.h,v
retrieving revision 1.50
diff -u -p -r1.50 x509.h
--- lib/libcrypto/x509/x509.h   18 May 2018 14:19:46 -  1.50
+++ lib/libcrypto/x509/x509.h   18 May 2018 15:02:53 -
@@ -1164,16 +1164,21 @@ void*   X509_CRL_get_ext_d2i(const X509_C
 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);
-intX509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT 
*obj,int lastpos);
-intX509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int 
lastpos);
-X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc);
+intX509_REVOKED_get_ext_count(const X509_REVOKED *x);
+intX509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid,
+   int lastpos);
+intX509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x,
+   const ASN1_OBJECT *obj, int lastpos);
+intX509_REVOKED_get_ext_by_critical(const X509_REVOKED *x,
+   int crit, int lastpos);
+X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc);
 X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);
-intX509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int 
loc);
-void   *   X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, 
int *idx);
-intX509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void 
*value, int crit,
-   unsigned long flags);
+intX509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex,
+   int loc);
+void   *   X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid,
+   int *crit, int *idx);
+intX509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value,
+   int crit, unsigned long flags);
 
 X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
int nid, int crit, ASN1_OCTET_STRING *data);
@@ -1310,11 +1315,11 @@ int X509_TRUST_get_count(void);
 X509_TRUST * X509_TRUST_get0(int idx);
 int X509_TRUST_get_by_id(int id);
 int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),
-   char *name, int arg1, void *arg2);
+const char *name, int arg1, void *arg2);
 void X509_TRUST_cleanup(void);
-int X509_TRUST_get_flags(X509_TRUST *xp);
-char *X509_TRUST_get0_name(X509_TRUST *xp);
-int X509_TRUST_get_trust(X509_TRUST *xp);
+int X509_TRUST_get_flags(const X509_TRUST *xp);
+char *X509_TRUST_get0_name(const X509_TRUST *xp);
+int X509_TRUST_get_trust(const X509_TRUST *xp);
 
 int X509_up_ref(X509 *x);
 STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain);
Index: lib/libcrypto/x509/x509_ext.c
===
RCS file: /cvs/src/lib/libcrypto/x509/x509_ext.c,v
retrieving revision 1.10
diff -u -p -r1.10 x509_ext.c
--- lib/libcrypto/x509/x509_ext.c   18 May 2018 14:19:46 -  1.10
+++ lib/libcrypto/x509/x509_ext.c   18 May 2018 15:02:53 -
@@ -177,31 +177,32 @@ X509_add1_ext_i2d(X509 *x, int nid, void
 }
 
 int
-X509_REVOKED_get_ext_count(X509_REVOKED *x)
+X509_REVOKED_get_ext_count(const X509_REVOKED *x)
 {
return (X509v3_get_ext_count(x->extensions));
 }
 
 int
-X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos)
+X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos)
 {
return (X509v3_get_ext_by_NID(x->extensions, nid, lastpos));
 }
 
 int
-X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x, ASN1_OBJECT *obj, int lastpos)
+X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj,
+int lastpos)
 {
return (X509v3_get_ext_by_OBJ(x->extensions, obj, lastpos));
 }
 
 int
-X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos)
+X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, int lastpos)
 {
return (X509v3_get_ext_by_critical(x->extensions, crit, lastpos));
 }
 
 X509_EXTENSION *
-X509_REVOKED_get_ext(X509_REVOKED *x, int loc)
+X509_REVOKED_get_ext(const X509_REVOKED *x, int loc)
 {
return (X509v3_get_ext(x->extensions, loc));
 }
@@ -219,7 +220,7 @@ X509_REVOKED_add_ext(X509_REVOKED *x, X5
 }
 
 void *
-X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx)
+X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, int *idx)
 {
return X509V3_get_d2i(x->extensions, nid, crit, idx);
 }
Index: 

more const qualifiers for x509

2018-05-18 Thread Theo Buehler
Here is a larger diff. More of the same. The only noteworthy thing
here is that OpenSSL can't easily change their ASN1-generated version
of X509_NAME_ENTRY_dup(3) into a const function, so we need to cast
const away in X509_NAME_add_entry(3).

Again part of sthen's bulk.

Index: lib/libcrypto/asn1/a_strex.c
===
RCS file: /cvs/src/lib/libcrypto/asn1/a_strex.c,v
retrieving revision 1.26
diff -u -p -r1.26 a_strex.c
--- lib/libcrypto/asn1/a_strex.c25 Apr 2018 11:48:21 -  1.26
+++ lib/libcrypto/asn1/a_strex.c18 May 2018 14:45:45 -
@@ -440,7 +440,7 @@ do_indent(char_io *io_ch, void *arg, int
 #define FN_WIDTH_SN10
 
 static int
-do_name_ex(char_io *io_ch, void *arg, X509_NAME *n, int indent,
+do_name_ex(char_io *io_ch, void *arg, const X509_NAME *n, int indent,
 unsigned long flags)
 {
int i, prev = -1, orflags, cnt;
@@ -582,7 +582,8 @@ do_name_ex(char_io *io_ch, void *arg, X5
 /* Wrappers round the main functions */
 
 int
-X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags)
+X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent,
+unsigned long flags)
 {
if (flags == XN_FLAG_COMPAT)
return X509_NAME_print(out, nm, indent);
@@ -590,7 +591,8 @@ X509_NAME_print_ex(BIO *out, X509_NAME *
 }
 
 int
-X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags)
+X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent,
+unsigned long flags)
 {
if (flags == XN_FLAG_COMPAT) {
BIO *btmp;
Index: lib/libcrypto/asn1/t_x509.c
===
RCS file: /cvs/src/lib/libcrypto/asn1/t_x509.c,v
retrieving revision 1.30
diff -u -p -r1.30 t_x509.c
--- lib/libcrypto/asn1/t_x509.c 1 May 2018 19:01:27 -   1.30
+++ lib/libcrypto/asn1/t_x509.c 18 May 2018 14:45:45 -
@@ -490,7 +490,7 @@ err:
 }
 
 int
-X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
+X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
 {
char *s, *c, *b;
int ret = 0, l, i;
Index: lib/libcrypto/x509/x509.h
===
RCS file: /cvs/src/lib/libcrypto/x509/x509.h,v
retrieving revision 1.50
diff -u -p -r1.50 x509.h
--- lib/libcrypto/x509/x509.h   18 May 2018 14:19:46 -  1.50
+++ lib/libcrypto/x509/x509.h   18 May 2018 14:45:46 -
@@ -965,7 +965,7 @@ extern const ASN1_ITEM NETSCAPE_CERT_SEQ
 #ifndef OPENSSL_NO_EVP
 X509_INFO *X509_INFO_new(void);
 void   X509_INFO_free(X509_INFO *a);
-char * X509_NAME_oneline(X509_NAME *a,char *buf,int size);
+char * X509_NAME_oneline(const X509_NAME *a, char *buf, int size);
 
 int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data,
unsigned char *md,unsigned int *len);
@@ -1076,11 +1076,13 @@ int X509_print_ex_fp(FILE *bp,X509 *x, 
 intX509_print_fp(FILE *bp,X509 *x);
 intX509_CRL_print_fp(FILE *bp,X509_CRL *x);
 intX509_REQ_print_fp(FILE *bp,X509_REQ *req);
-int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long 
flags);
+intX509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent,
+   unsigned long flags);
 
 #ifndef OPENSSL_NO_BIO
-intX509_NAME_print(BIO *bp, X509_NAME *name, int obase);
-int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long 
flags);
+intX509_NAME_print(BIO *bp, const X509_NAME *name, int obase);
+intX509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent,
+   unsigned long flags);
 intX509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned 
long cflag);
 intX509_print(BIO *bp,X509 *x);
 intX509_ocspid_print(BIO *bp,X509 *x);
@@ -1090,40 +1092,40 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ
 intX509_REQ_print(BIO *bp,X509_REQ *req);
 #endif
 
-intX509_NAME_entry_count(X509_NAME *name);
+intX509_NAME_entry_count(const X509_NAME *name);
 intX509_NAME_get_text_by_NID(X509_NAME *name, int nid,
char *buf,int len);
-intX509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
-   char *buf,int len);
+intX509_NAME_get_text_by_OBJ(X509_NAME *name,
+   const ASN1_OBJECT *obj, char *buf,int len);
 
 /* NOTE: you should be passsing -1, not 0 as lastpos.  The functions that use
  * lastpos, search after that position on. */
 intX509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos);
-intX509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj,
-   int lastpos);
-X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);
+intX509_NAME_get_index_by_OBJ(X509_NAME *name,
+  

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);
 }



Re: Allow disks to be specifid by duid in install.sub

2018-05-18 Thread Theo Buehler
On Thu, May 17, 2018 at 06:42:15PM -0600, Aaron Bieber wrote:
> On Thu, May 17, 2018 at 06:37:56PM -0600, Aaron Bieber wrote:
> > On Fri, Mar 02, 2018 at 07:32:04AM -0700, Aaron Bieber wrote:
> > > Hi,
> > > 
> > > Currently disks can only be entered in the [sw]d[0-9][0-9] format at the
> > > "Which disk is the root disk?" prompt. This is great for humans, but
> > > things get tricky when doing an autoinstall upgrade on systems where
> > > connected disks change frequently.
> > > 
> > > This diff lets you put the DUID in the response file.
> > > 
> > > If anyone has a better way to determine the disk from the duid, I am all
> > > ears :D
> > > 
> > > Cheers,
> > > Aaron
> > > 
> > 
> > Thanks to tb@, kn@, Philipp Buehler and phy1729 on #metabug! I tested a
> > bsd.rd with an auto-upgrade response file. Once with a duid and once
> > with a disk name. Both worked.
> > 
> > I have an OK from tb@ unless anyone objects.
> > 
> > The diff has been distilled down to this:
> > 
> 
> Paste fail, here is the latest diff:

Sleeping over it once more, I must say I'm still not terribly fond of
this hack and would like to retract my ok for these two reasons:

* we clobber 'resp' which may then leave a confusing error message.
  It's only in the $AUTO case, but still.

* In the is_duid case we walk the hw.disknames output twice even though
  we know that we already have a good device. This is a bit stupid.

I do think this is going in the right direction, but I'd really like to
see these two points resolved before it goes in. It's probably not too
difficult, but I've got too many things on my hand, so I won't be able
to do it myself anytime soon.

> Index: distrib/miniroot/install.sub
> ===
> RCS file: /var/cvs/src/distrib/miniroot/install.sub,v
> retrieving revision 1.1067
> diff -u -p -r1.1067 install.sub
> --- distrib/miniroot/install.sub  7 May 2018 10:44:01 -   1.1067
> +++ distrib/miniroot/install.sub  18 May 2018 00:16:34 -
> @@ -336,6 +336,12 @@ get_ifs() {
>   done
>  }
>  
> +# checks whether $1 is a valid duid
> +is_duid() {
> + ((${#1} == 16)) && [[ $1 == +([0-9a-f]) ]] && return 0
> + return 1
> +}
> +
>  # Return the device name of the disk device $1, which may be a disklabel UID.
>  get_dkdev_name() {
>   local _dev=${1#/dev/} _d
> @@ -2231,7 +2237,8 @@ get_rootinfo() {
>   case $resp in
>   "?")diskinfo $(get_dkdevs);;
>   '') ;;
> - *)  if isin "$resp" $(get_dkdevs); then
> + *)  $AUTO && is_duid "$resp" && resp=$(get_dkdev_name $resp)
> + if isin "$resp" $(get_dkdevs); then
>   [[ $MODE == install ]] && break
>   is_rootdisk "$resp" && break
>   echo "$resp is not a valid root disk."
> 
> -- 
> PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE
> 



Re: ldapd: add bsd.schema?

2018-05-18 Thread Reyk Floeter
On Fri, May 18, 2018 at 10:42:43AM +0200, Reyk Floeter wrote:
> So, OK?
> 

As sthen@ pointed out, I had shadowPassword in both MUST and MAY.
(The reason is that I intended to move it from MUST to MAY, but forgot
to remove the MUST).  userPassword in nis.schema is also MAY, so it
must not be MUST but it must be MAY.  A user also may not have a cn so
remove it from MUST as well.

s/MUST/MAY/ I get an OK?

Index: etc/examples/ldapd.conf
===
RCS file: /cvs/src/etc/examples/ldapd.conf,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 ldapd.conf
--- etc/examples/ldapd.conf 11 Jul 2014 21:20:10 -  1.1
+++ etc/examples/ldapd.conf 18 May 2018 10:09:45 -
@@ -3,6 +3,7 @@
 schema "/etc/ldap/core.schema"
 schema "/etc/ldap/inetorgperson.schema"
 schema "/etc/ldap/nis.schema"
+schema "/etc/ldap/bsd.schema"
 
 listen on lo0
 listen on "/var/run/ldapi"
Index: usr.sbin/ldapd/Makefile
===
RCS file: /cvs/src/usr.sbin/ldapd/Makefile,v
retrieving revision 1.15
diff -u -p -u -p -r1.15 Makefile
--- usr.sbin/ldapd/Makefile 20 Jan 2017 11:55:08 -  1.15
+++ usr.sbin/ldapd/Makefile 18 May 2018 10:09:45 -
@@ -17,7 +17,8 @@ CFLAGS+=  -Wshadow -Wpointer-arith -Wcast
 CFLAGS+=   -Wsign-compare
 CLEANFILES+=   y.tab.h parse.c
 
-SCHEMA_FILES=  core.schema \
+SCHEMA_FILES=  bsd.schema \
+   core.schema \
inetorgperson.schema \
nis.schema
 
Index: usr.sbin/ldapd/schema/bsd.schema
===
RCS file: usr.sbin/ldapd/schema/bsd.schema
diff -N usr.sbin/ldapd/schema/bsd.schema
--- /dev/null   1 Jan 1970 00:00:00 -
+++ usr.sbin/ldapd/schema/bsd.schema18 May 2018 10:09:45 -
@@ -0,0 +1,17 @@
+attributetype ( 1.3.6.1.4.1.30155.115.2 NAME 'shadowPassword'
+   DESC 'POSIX hashed password'
+   EQUALITY caseExactIA5Match
+   SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+attributetype ( 1.3.6.1.4.1.30155.115.3 NAME 'sshPublicKey'
+   DESC 'SSH public key'
+   EQUALITY caseExactIA5Match
+   SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
+objectclass ( 1.3.6.1.4.1.30155.115.1 NAME 'bsdAccount'
+   SUP top
+   AUXILIARY
+   DESC 'Abstraction of an account with OpenBSD attributes'
+   MUST ( uid )
+   MAY ( shadowPassword $ shadowExpire $ modifyTimestamp $ userClass $
+   sshPublicKey ))



Re: diff: add if group table to snmpd

2018-05-18 Thread Jan Klemkow
On Mon, May 14, 2018 at 09:21:13PM +0200, Jan Klemkow wrote:
> On Mon, May 14, 2018 at 06:53:20PM +0100, Stuart Henderson wrote:
> > On 2018/05/14 17:59, Jan Klemkow wrote:
> > > The following diff adds an interface group table to the OpenBSD MIBs and
> > > the OpenSNMPd.  The new snmp table helps to keep track of the demote
> > > values of more complex carp setups.  To iterate directly through all
> > > interface groups, the diff has to extent ioctl interface by a new
> > > command SIOCGIFGLIST.
> > > 
> > > This new interface could also be used to extent ifconfig(8), in a later
> > > diff, to list all interface groups with there demote counter.
> > > 
> > > I tested this diff with snmpctl(8) from base and snmpwalk from
> > > net/net-snmp under current amd64.
> 
> > This seems a reasonable thing to report on and I didn't spot any code
> > problems yet, one thing with the MIB file though:
> 
> > > Index: share/snmp/OPENBSD-CARP-MIB.txt
> > > ===
> > > RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v
> > > retrieving revision 1.3
> > > diff -u -p -r1.3 OPENBSD-CARP-MIB.txt
> > > --- share/snmp/OPENBSD-CARP-MIB.txt   28 Sep 2012 09:21:48 -  
> > > 1.3
> > > +++ share/snmp/OPENBSD-CARP-MIB.txt   14 May 2018 14:53:02 -
> > > @@ -41,7 +41,7 @@ carpMIBObjects MODULE-IDENTITY
> > >   "
> > >  DESCRIPTION  "The MIB module for gathering information about
> > >Common Address Redundancy Protocol (CARP) interfaces."
> > > -REVISION "20120131Z"
> > > +REVISION "20180514Z"
> > >  DESCRIPTION  "Add the OPENBSD-CARP-MIB to snmpd."
> > >  ::= { openBSD 6 }
> > 
> > This section is meant to be a sort of changelog; please add a new
> > REVISION/DESCRIPTION rather than changing the existing one. (Also check
> > that smilint is happy).
> 
> Thanks for the hint.  I fixed the changelog and some other issues
> pointed by smilint.

This is the merged version of the diff:

Thanks,
Jan

Index: share/snmp/OPENBSD-CARP-MIB.txt
===
RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v
retrieving revision 1.3
diff -u -p -r1.3 OPENBSD-CARP-MIB.txt
--- share/snmp/OPENBSD-CARP-MIB.txt 28 Sep 2012 09:21:48 -  1.3
+++ share/snmp/OPENBSD-CARP-MIB.txt 14 May 2018 18:58:59 -
@@ -32,7 +32,7 @@ IMPORTS
FROM SNMPv2-CONF;
 
 carpMIBObjects MODULE-IDENTITY
-LAST-UPDATED "20120131Z"
+LAST-UPDATED "20180514Z"
 ORGANIZATION "OpenBSD"
 CONTACT-INFO "
   Author: Joel Knight
@@ -41,6 +41,8 @@ carpMIBObjects MODULE-IDENTITY
  "
 DESCRIPTION  "The MIB module for gathering information about
 Common Address Redundancy Protocol (CARP) interfaces."
+REVISION "20180514Z"
+DESCRIPTION  "Add the carpGroupTable to OPENBSD-CARP-MIB."
 REVISION "20120131Z"
 DESCRIPTION  "Add the OPENBSD-CARP-MIB to snmpd."
 ::= { openBSD 6 }
@@ -174,6 +176,58 @@ carpIfState OBJECT-TYPE
DESCRIPTION
"Indicates the operational state of the CARP interface."
::= { carpIfEntry 7 }
+
+
+-- carpGroup
+
+carpGroupTable OBJECT-TYPE
+   SYNTAX  SEQUENCE OF CarpGroupEntry
+   MAX-ACCESS  not-accessible
+   STATUS  current
+   DESCRIPTION
+   "A list of interface groups."
+   ::= { carpMIBObjects 4 }
+
+carpGroupEntry OBJECT-TYPE
+   SYNTAX  CarpGroupEntry
+   MAX-ACCESS  not-accessible
+   STATUS  current
+   DESCRIPTION
+   "An entry containing management information applicable to a
+   particular interface group."
+   INDEX   { carpGroupIndex }
+   ::= { carpGroupTable 1 }
+
+CarpGroupEntry ::=
+   SEQUENCE {
+   carpGroupIndex  Integer32,
+   carpGroupName   OCTET STRING,
+   carpGroupDemote Integer32
+   }
+
+carpGroupIndex OBJECT-TYPE
+   SYNTAX  Integer32 (1..2147483647)
+   MAX-ACCESS  not-accessible
+   STATUS  current
+   DESCRIPTION
+   "The demote value of the interface group."
+   ::= { carpGroupEntry 1 }
+
+carpGroupName OBJECT-TYPE
+   SYNTAX  OCTET STRING
+   MAX-ACCESS  read-only
+   STATUS  current
+   DESCRIPTION
+   "The name of the interface group."
+   ::= { carpGroupEntry 2 }
+
+carpGroupDemote OBJECT-TYPE
+   SYNTAX  Integer32 (1..2147483647)
+   MAX-ACCESS  read-only
+   STATUS  current
+   DESCRIPTION
+   "The demote value of the interface group."
+   ::= { carpGroupEntry 3 }
 
 
 -- carpStats
Index: sys/net/if.c
===
RCS file: /cvs//src/sys/net/if.c,v
retrieving revision 1.552
diff -u -p -r1.552 if.c
--- sys/net/if.c17 May 2018 11:04:14 -  

Re: ldapd: add bsd.schema?

2018-05-18 Thread Reyk Floeter
So, OK?

On Tue, May 15, 2018 at 02:24:19PM +0200, Reyk Floeter wrote:
> Hi,
> 
> could we add an LDAP schema file that makes it easier to use sshd's
> "AuthorizedKeysCommand"?
> 
> While most howtos out there agree on the attribute name
> "sshPublicKey", there is no common LDAP schema that implements it.
> Some people patch nis.schema (which seems a bad idea), others add
> their own schema files.
> 
> What about adding our own schema (using OpenBSD's allocated
> 1.3.6.1.4.1.30155 PEN) that includes the required "sshPublicKey"
> attribute?  It can be used to extend existing LDAP users with the
> additional bsdAccount objectClass.
> 
> The "shadowPassword" attribute is useful for ypldap(8) + ldapd(8)
> without login_ldap (for example, userPassword: {BSDAUTH}reyk,
> shadowPassword: $2b$10$...).
> 
> Comments?
> 
> Reyk
> 
> Index: etc/examples/ldapd.conf
> ===
> RCS file: /cvs/src/etc/examples/ldapd.conf,v
> retrieving revision 1.1
> diff -u -p -u -p -r1.1 ldapd.conf
> --- etc/examples/ldapd.conf   11 Jul 2014 21:20:10 -  1.1
> +++ etc/examples/ldapd.conf   15 May 2018 12:09:57 -
> @@ -3,6 +3,7 @@
>  schema "/etc/ldap/core.schema"
>  schema "/etc/ldap/inetorgperson.schema"
>  schema "/etc/ldap/nis.schema"
> +schema "/etc/ldap/bsd.schema"
>  
>  listen on lo0
>  listen on "/var/run/ldapi"
> Index: usr.sbin/ldapd/Makefile
> ===
> RCS file: /cvs/src/usr.sbin/ldapd/Makefile,v
> retrieving revision 1.15
> diff -u -p -u -p -r1.15 Makefile
> --- usr.sbin/ldapd/Makefile   20 Jan 2017 11:55:08 -  1.15
> +++ usr.sbin/ldapd/Makefile   15 May 2018 12:09:57 -
> @@ -17,7 +17,8 @@ CFLAGS+=-Wshadow -Wpointer-arith -Wcast
>  CFLAGS+= -Wsign-compare
>  CLEANFILES+= y.tab.h parse.c
>  
> -SCHEMA_FILES=core.schema \
> +SCHEMA_FILES=bsd.schema \
> + core.schema \
>   inetorgperson.schema \
>   nis.schema
>  
> Index: usr.sbin/ldapd/schema/bsd.schema
> ===
> RCS file: usr.sbin/ldapd/schema/bsd.schema
> diff -N usr.sbin/ldapd/schema/bsd.schema
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ usr.sbin/ldapd/schema/bsd.schema  15 May 2018 12:09:57 -
> @@ -0,0 +1,17 @@
> +attributetype ( 1.3.6.1.4.1.30155.115.2 NAME 'shadowPassword'
> + DESC 'POSIX hashed password'
> + EQUALITY caseExactIA5Match
> + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
> +
> +attributetype ( 1.3.6.1.4.1.30155.115.3 NAME 'sshPublicKey'
> + DESC 'SSH public key'
> + EQUALITY caseExactIA5Match
> + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
> +
> +objectclass ( 1.3.6.1.4.1.30155.115.1 NAME 'bsdAccount'
> + SUP top
> + AUXILIARY
> + DESC 'Abstraction of an account with OpenBSD attributes'
> + MUST ( cn $ uid $ shadowPassword )
> + MAY ( shadowPassword $ shadowExpire $ modifyTimestamp $ userClass $
> + sshPublicKey ))

-- 



errors in usage.c - libusbhid

2018-05-18 Thread David Bern
Hello!

Have been using libusbhid and discovered a couple of discrepancies in
the man-page (libusbhid.3) and the source of usage.c

Some are just factual misses, but I also got (what I think is) 2 errors.
I will try to explain them;

1. (This is the I think is an error but not sure). The man-page tells me
that hid_usage_in_page and hid_parse_usage_in_page are each
others inverse.
If I haven't misunderstood the practical meaning of inverse in this
case then this should be true:
x == hid_parse_usage_in_page(hid_usage_in_page(x)).

My observation:
The main reason to why this isnt true, is that hid_usage_in_page()
returns the data of pages[k].page_contents[j].name
while hid_parse_usage_in_page() expects the data to
contain "%s:%s", pages[k].name, pages[k].page_contents[j].name

The reason I ask instead of just posting working code is this:
Am I misunderstanding the manual? In that case, the solution I want
to send in is a change in that sentence
Or Is the manual correct and the behavior of hid_usage_in_page() wrong,
is this something I can correct without breaking other systems?


2. The second error I found is located in hid_parse_usage_in_page().
It is unable to parse values found in page Button.

My observation:
usage.c is using a standard table named usb_hid_pages. In that table
we got a page called Buttons.
the usages in that page is shortened to "*  Button %d".
I believe this is the cause of why hid_parse_usage_in_page() is getting
the pagesize "wrong" and therefor unable to parse any button in the
button page. I guess this is the case with other similar cases as well.

my conclusion is that it would be possible to handle similar cases in a
similar way as it is handled in hid_usage_in_page().


As this is my first "issue" I would love to get as much feedback as
possible so I can work on delivering a desirable and usable patch in
my first try.

As to the "factual" misses in the man-page, I found two prototype
declarations that differs from the header file. Intend to send a
man-page diff on the ones that I have bumped into.

/David Bern


Re: mfii(4): add bio(4) support

2018-05-18 Thread Naoki Fukaumi
Hi,

From: Jonathan Matthew 
Subject: Re: mfii(4): add bio(4) support
Date: Fri, 18 May 2018 15:30:31 +1000

> On 15/05/18 14:13, Naoki Fukaumi wrote:
>> Hi Jonathan Matthew,
>> here is updated patch. could you review it?
> 
> I've just committed a series of changes based on your patch.
> dlg and I decided that it'd be better if mfii_mgmt() took scsi flags
> rather than MFII_DATA_IN/OUT, so I reworked all the callers to suit.
> 
> Thanks for all your work on this.

Thank you very much!

I will submit following fixes for mfi(4) too. if you can, please
review them :)

>> * make "bioctl -R" work after hot swapping

>> * don't return on error while updating sensors

>> * fix RAID level of spanned logical disk

>> * report cachecade disk in ioctl/sensor

--
FUKAUMI Naoki