16557Sfr41279 /*
26557Sfr41279 * CDDL HEADER START
36557Sfr41279 *
46557Sfr41279 * The contents of this file are subject to the terms of the
56557Sfr41279 * Common Development and Distribution License (the "License").
66557Sfr41279 * You may not use this file except in compliance with the License.
76557Sfr41279 *
86557Sfr41279 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96557Sfr41279 * or http://www.opensolaris.org/os/licensing.
106557Sfr41279 * See the License for the specific language governing permissions
116557Sfr41279 * and limitations under the License.
126557Sfr41279 *
136557Sfr41279 * When distributing Covered Code, include this CDDL HEADER in each
146557Sfr41279 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156557Sfr41279 * If applicable, add the following below this CDDL HEADER, with the
166557Sfr41279 * fields enclosed by brackets "[]" replaced with your own identifying
176557Sfr41279 * information: Portions Copyright [yyyy] [name of copyright owner]
186557Sfr41279 *
196557Sfr41279 * CDDL HEADER END
206557Sfr41279 */
216557Sfr41279 /*
22*12929SMisaki.Miyashita@Oracle.COM * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
236557Sfr41279 */
246557Sfr41279
256557Sfr41279
266557Sfr41279 #include <sys/types.h>
276557Sfr41279 #include <sys/systm.h>
286557Sfr41279 #include <sys/modctl.h>
296557Sfr41279 #include <sys/cmn_err.h>
306557Sfr41279 #include <sys/ddi.h>
31*12929SMisaki.Miyashita@Oracle.COM #include <fips/fips_checksum.h>
326557Sfr41279
336557Sfr41279 extern struct mod_ops mod_cryptoops;
346557Sfr41279
356557Sfr41279 /*
366557Sfr41279 * Module linkage information for the kernel.
376557Sfr41279 */
386557Sfr41279 static struct modlmisc modlmisc = {
396557Sfr41279 &mod_miscops, "bignum utility module"
406557Sfr41279 };
416557Sfr41279
426557Sfr41279 static struct modlinkage modlinkage = {
436557Sfr41279 MODREV_1, (void *)&modlmisc, NULL
446557Sfr41279 };
456557Sfr41279
466557Sfr41279
476557Sfr41279 int
_init(void)486557Sfr41279 _init(void)
496557Sfr41279 {
506557Sfr41279 return (mod_install(&modlinkage));
516557Sfr41279 }
526557Sfr41279
536557Sfr41279 int
_fini(void)546557Sfr41279 _fini(void)
556557Sfr41279 {
566557Sfr41279 return (mod_remove(&modlinkage));
576557Sfr41279 }
586557Sfr41279
596557Sfr41279 int
_info(struct modinfo * modinfop)606557Sfr41279 _info(struct modinfo *modinfop)
616557Sfr41279 {
626557Sfr41279 return (mod_info(&modlinkage, modinfop));
636557Sfr41279 }
64*12929SMisaki.Miyashita@Oracle.COM
65*12929SMisaki.Miyashita@Oracle.COM int
bignum_fips_check()66*12929SMisaki.Miyashita@Oracle.COM bignum_fips_check()
67*12929SMisaki.Miyashita@Oracle.COM {
68*12929SMisaki.Miyashita@Oracle.COM if (fips_check_module("misc/bignum", (void *)_init) != 0) {
69*12929SMisaki.Miyashita@Oracle.COM cmn_err(CE_WARN, "bignum: FIPS-140 Software Integrity Test "
70*12929SMisaki.Miyashita@Oracle.COM "failed");
71*12929SMisaki.Miyashita@Oracle.COM return (EINVAL);
72*12929SMisaki.Miyashita@Oracle.COM }
73*12929SMisaki.Miyashita@Oracle.COM return (0);
74*12929SMisaki.Miyashita@Oracle.COM }
75