summaryrefslogtreecommitdiff
path: root/sys/dev/hil
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-02-15 23:50:03 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-02-15 23:50:03 +0000
commitaa7db19a5fe33c7abefcad2a834f1d6c63221ae2 (patch)
tree89ad90e1e8d93eccf233324c4bfd3278d6ce08e8 /sys/dev/hil
parentfceb24d4bbc1faaf0834b9c001f43fb4d98a9f44 (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...
Diffstat (limited to 'sys/dev/hil')
-rw-r--r--sys/dev/hil/files.hil6
-rw-r--r--sys/dev/hil/hilid.c89
2 files changed, 94 insertions, 1 deletions
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");
+}