diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-02-15 23:50:03 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-02-15 23:50:03 +0000 |
commit | aa7db19a5fe33c7abefcad2a834f1d6c63221ae2 (patch) | |
tree | 89ad90e1e8d93eccf233324c4bfd3278d6ce08e8 | |
parent | fceb24d4bbc1faaf0834b9c001f43fb4d98a9f44 (diff) |
A simple and crude driver to play with the hil so-called ``ID module''
devices.
The ID module only purpose is to provide a small, unique, bitstring, which
was used for some copy-protection or licensing scheme under HP-UX.
Right now this driver is useless, as it provides no way to communicate
this information to userland, and only displays it while attaching, as such:
hilid0 at hil0 code 2: ID module
hilid0: security code 10 04 b4 41 ac 77 14 0f 41 00 00 00 00 00 00 00
hilid1 at hil0 code 3: ID module
hilid1: security code 10 04 b4 41 e3 b8 13 0f 41 00 00 00 00 00 00 00
Too bad it's not even good enough to feed the kernel random generator...
-rw-r--r-- | sys/arch/hppa/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/dev/hil/files.hil | 6 | ||||
-rw-r--r-- | sys/dev/hil/hilid.c | 89 |
3 files changed, 96 insertions, 3 deletions
diff --git a/sys/arch/hppa/conf/GENERIC b/sys/arch/hppa/conf/GENERIC index e1989b49cab..904608457a8 100644 --- a/sys/arch/hppa/conf/GENERIC +++ b/sys/arch/hppa/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.25 2003/02/15 23:45:50 miod Exp $ +# $OpenBSD: GENERIC,v 1.26 2003/02/15 23:50:00 miod Exp $ # # Diskless kernel config # @@ -71,7 +71,7 @@ option EISAVERBOSE hil* at gsc? irq 1 # Human Interface Loop, kbd and mouse hilkbd* at hil? code ? # keyboard, knob and buttons hilms* at hil? code ? # mouse and tablets -#hilid* at hil? code ? # ID module +hilid* at hil? code ? # ID module #medusa* at gsc? irq 4 # FDDI diff --git a/sys/dev/hil/files.hil b/sys/dev/hil/files.hil index 36a48c9e8b2..7730e3b69d9 100644 --- a/sys/dev/hil/files.hil +++ b/sys/dev/hil/files.hil @@ -1,4 +1,4 @@ -# $OpenBSD: files.hil,v 1.3 2003/02/15 23:45:52 miod Exp $ +# $OpenBSD: files.hil,v 1.4 2003/02/15 23:50:02 miod Exp $ # # Configuration file for machine-independent HIL code. # @@ -14,3 +14,7 @@ file dev/hil/hilkbdmap.c hilkbd device hilms: wsmousedev attach hilms at hil file dev/hil/hilms.c hilms needs-flag + +device hilid +attach hilid at hil +file dev/hil/hilid.c hilid diff --git a/sys/dev/hil/hilid.c b/sys/dev/hil/hilid.c new file mode 100644 index 00000000000..6fba67b1831 --- /dev/null +++ b/sys/dev/hil/hilid.c @@ -0,0 +1,89 @@ +/* $OpenBSD: hilid.c,v 1.1 2003/02/15 23:50:02 miod Exp $ */ +/* + * Copyright (c) 2003, Miodrag Vallat. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> +#include <sys/ioctl.h> + +#include <machine/autoconf.h> +#include <machine/bus.h> +#include <machine/cpu.h> + +#include <dev/hil/hilreg.h> +#include <dev/hil/hilvar.h> +#include <dev/hil/hildevs.h> + +struct hilid_softc { + struct device sc_dev; + + u_int8_t sc_id[16]; +}; + +int hilidprobe(struct device *, void *, void *); +void hilidattach(struct device *, struct device *, void *); + +struct cfdriver hilid_cd = { + NULL, "hilid", DV_DULL +}; + +struct cfattach hilid_ca = { + sizeof(struct hilid_softc), hilidprobe, hilidattach +}; + +int +hilidprobe(struct device *parent, void *match, void *aux) +{ + struct hil_attach_args *ha = aux; + + if (ha->ha_type != HIL_DEVICE_IDMODULE) + return (0); + + return (1); +} + +void +hilidattach(struct device *parent, struct device *self, void *aux) +{ + struct hilid_softc *sc = (void *)self; + struct hil_attach_args *ha = aux; + u_int i, len; + + printf("\n"); + + bzero(sc->sc_id, sizeof(sc->sc_id)); + len = sizeof(sc->sc_id); + send_hildev_cmd((struct hil_softc *)parent, ha->ha_code, + HIL_SECURITY, sc->sc_id, &len); + + printf("%s: security code", sc->sc_dev.dv_xname); + for (i = 0; i < sizeof(sc->sc_id); i++) + printf(" %02.2x", sc->sc_id[i]); + + printf("\n"); +} |