Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/crypto New sysctl subtree kern.crypto.



details:   https://anonhg.NetBSD.org/src/rev/114bdc1abb81
branches:  trunk
changeset: 974301:114bdc1abb81
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Jul 27 20:45:15 2020 +0000

description:
New sysctl subtree kern.crypto.

kern.crypto.aes.selected (formerly hw.aes_impl)
kern.crypto.chacha.selected (formerly hw.chacha_impl)

XXX Should maybe deduplicate creation of kern.crypto.

diffstat:

 sys/crypto/aes/aes_impl.c       |  26 ++++++++++++++++++--------
 sys/crypto/chacha/chacha_impl.c |  24 +++++++++++++++++-------
 2 files changed, 35 insertions(+), 15 deletions(-)

diffs (105 lines):

diff -r 0f1302916e63 -r 114bdc1abb81 sys/crypto/aes/aes_impl.c
--- a/sys/crypto/aes/aes_impl.c Mon Jul 27 20:44:30 2020 +0000
+++ b/sys/crypto/aes/aes_impl.c Mon Jul 27 20:45:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aes_impl.c,v 1.8 2020/07/25 22:42:03 riastradh Exp $   */
+/*     $NetBSD: aes_impl.c,v 1.9 2020/07/27 20:45:15 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: aes_impl.c,v 1.8 2020/07/25 22:42:03 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_impl.c,v 1.9 2020/07/27 20:45:15 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/kernel.h>
@@ -48,7 +48,7 @@
 static const struct aes_impl   *aes_impl       __read_mostly;
 
 static int
-sysctl_hw_aes_impl(SYSCTLFN_ARGS)
+sysctl_kern_crypto_aes_selected(SYSCTLFN_ARGS)
 {
        struct sysctlnode node;
 
@@ -61,14 +61,24 @@
        return sysctl_lookup(SYSCTLFN_CALL(&node));
 }
 
-SYSCTL_SETUP(sysctl_hw_aes_setup, "sysctl hw.aes_impl setup")
+SYSCTL_SETUP(sysctl_kern_crypto_aes_setup, "sysctl kern.crypto.aes setup")
 {
+       const struct sysctlnode *cnode;
+       const struct sysctlnode *aes_node;
 
-       sysctl_createv(clog, 0, NULL, NULL,
-           CTLFLAG_PERMANENT|CTLFLAG_READONLY, CTLTYPE_STRING, "aes_impl",
+       sysctl_createv(clog, 0, NULL, &cnode, 0, CTLTYPE_NODE, "crypto",
+           SYSCTL_DESCR("Kernel cryptography"),
+           NULL, 0, NULL, 0,
+           CTL_KERN, CTL_CREATE, CTL_EOL);
+       sysctl_createv(clog, 0, &cnode, &aes_node, 0, CTLTYPE_NODE, "aes",
+           SYSCTL_DESCR("AES -- Advanced Encryption Standard"),
+           NULL, 0, NULL, 0,
+           CTL_CREATE, CTL_EOL);
+       sysctl_createv(clog, 0, &aes_node, NULL,
+           CTLFLAG_PERMANENT|CTLFLAG_READONLY, CTLTYPE_STRING, "selected",
            SYSCTL_DESCR("Selected AES implementation"),
-           sysctl_hw_aes_impl, 0, NULL, 0,
-           CTL_HW, CTL_CREATE, CTL_EOL);
+           sysctl_kern_crypto_aes_selected, 0, NULL, 0,
+           CTL_CREATE, CTL_EOL);
 }
 
 /*
diff -r 0f1302916e63 -r 114bdc1abb81 sys/crypto/chacha/chacha_impl.c
--- a/sys/crypto/chacha/chacha_impl.c   Mon Jul 27 20:44:30 2020 +0000
+++ b/sys/crypto/chacha/chacha_impl.c   Mon Jul 27 20:45:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chacha_impl.c,v 1.1 2020/07/25 22:46:34 riastradh Exp $        */
+/*     $NetBSD: chacha_impl.c,v 1.2 2020/07/27 20:45:15 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
 static const struct chacha_impl        *chacha_impl    __read_mostly;
 
 static int
-sysctl_hw_chacha_impl(SYSCTLFN_ARGS)
+sysctl_kern_crypto_chacha_selected(SYSCTLFN_ARGS)
 {
        struct sysctlnode node;
 
@@ -55,14 +55,24 @@
        return sysctl_lookup(SYSCTLFN_CALL(&node));
 }
 
-SYSCTL_SETUP(sysctl_hw_chacha_setup, "sysctl hw.chacha_impl setup")
+SYSCTL_SETUP(sysctl_kern_crypto_chacha_setup, "sysctl kern.crypto.chacha setup")
 {
+       const struct sysctlnode *cnode;
+       const struct sysctlnode *chacha_node;
 
-       sysctl_createv(clog, 0, NULL, NULL,
-           CTLFLAG_PERMANENT|CTLFLAG_READONLY, CTLTYPE_STRING, "chacha_impl",
+       sysctl_createv(clog, 0, NULL, &cnode, 0, CTLTYPE_NODE, "crypto",
+           SYSCTL_DESCR("Kernel cryptography"),
+           NULL, 0, NULL, 0,
+           CTL_KERN, CTL_CREATE, CTL_EOL);
+       sysctl_createv(clog, 0, &cnode, &chacha_node, 0, CTLTYPE_NODE, "chacha",
+           SYSCTL_DESCR("ChaCha"),
+           NULL, 0, NULL, 0,
+           CTL_CREATE, CTL_EOL);
+       sysctl_createv(clog, 0, &chacha_node, NULL,
+           CTLFLAG_PERMANENT|CTLFLAG_READONLY, CTLTYPE_STRING, "selected",
            SYSCTL_DESCR("Selected ChaCha implementation"),
-           sysctl_hw_chacha_impl, 0, NULL, 0,
-           CTL_HW, CTL_CREATE, CTL_EOL);
+           sysctl_kern_crypto_chacha_selected, 0, NULL, 0,
+           CTL_CREATE, CTL_EOL);
 }
 
 static int



Home | Main Index | Thread Index | Old Index