FreeBSD/sys/mips/rmi/dev/sec/rmisec.c
/*
 * Attach an interface that successfully probed.
 */
Attach an interface that successfully probed.
Attach an interface that successfully probed .
static int
xlr_sec_attach(device_t dev)
{
	struct xlr_sec_softc *sc = device_get_softc(dev);
	sc->sc_dev = dev;
	mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "rmi crypto driver",
	    MTX_DEF);
	sc->sc_cid = crypto_get_driverid(dev, CRYPTOCAP_F_HARDWARE);
	if (sc->sc_cid < 0) {
		printf("xlr_sec - error : could not get the driver id\n");
		goto error_exit;
	}
	if (crypto_register(sc->sc_cid, CRYPTO_DES_CBC, 0, 0) != 0)
		printf("register failed for CRYPTO_DES_CBC\n");
	if (crypto_register(sc->sc_cid, CRYPTO_3DES_CBC, 0, 0) != 0)
		printf("register failed for CRYPTO_3DES_CBC\n");
	if (crypto_register(sc->sc_cid, CRYPTO_AES_CBC, 0, 0) != 0)
		printf("register failed for CRYPTO_AES_CBC\n");
	if (crypto_register(sc->sc_cid, CRYPTO_ARC4, 0, 0) != 0)
		printf("register failed for CRYPTO_ARC4\n");
	if (crypto_register(sc->sc_cid, CRYPTO_MD5, 0, 0) != 0)
		printf("register failed for CRYPTO_MD5\n");
	if (crypto_register(sc->sc_cid, CRYPTO_SHA1, 0, 0) != 0)
		printf("register failed for CRYPTO_SHA1\n");
	if (crypto_register(sc->sc_cid, CRYPTO_MD5_HMAC, 0, 0) != 0)
		printf("register failed for CRYPTO_MD5_HMAC\n");
	if (crypto_register(sc->sc_cid, CRYPTO_SHA1_HMAC, 0, 0) != 0)
		printf("register failed for CRYPTO_SHA1_HMAC\n");
	xlr_sec_init(sc);
	device_printf(dev, "Initialization complete!\n");
	return (0);
error_exit:
	return (ENXIO);
}
static int xlr_sec_attach ( device_t dev ) { struct xlr_sec_softc * sc = device_get_softc ( dev ) ; sc -> sc_dev = dev ; mtx_init ( & sc -> sc_mtx , device_get_nameunit ( dev ) , " " , MTX_DEF ) ; sc -> sc_cid = crypto_get_driverid ( dev , CRYPTOCAP_F_HARDWARE ) ; if ( sc -> sc_cid < 0 ) { printf ( " \n " ) ; goto error_exit ; } if ( crypto_register ( sc -> sc_cid , CRYPTO_DES_CBC , 0 , 0 ) != 0 ) printf ( " \n " ) ; if ( crypto_register ( sc -> sc_cid , CRYPTO_3DES_CBC , 0 , 0 ) != 0 ) printf ( " \n " ) ; if ( crypto_register ( sc -> sc_cid , CRYPTO_AES_CBC , 0 , 0 ) != 0 ) printf ( " \n " ) ; if ( crypto_register ( sc -> sc_cid , CRYPTO_ARC4 , 0 , 0 ) != 0 ) printf ( " \n " ) ; if ( crypto_register ( sc -> sc_cid , CRYPTO_MD5 , 0 , 0 ) != 0 ) printf ( " \n " ) ; if ( crypto_register ( sc -> sc_cid , CRYPTO_SHA1 , 0 , 0 ) != 0 ) printf ( " \n " ) ; if ( crypto_register ( sc -> sc_cid , CRYPTO_MD5_HMAC , 0 , 0 ) != 0 ) printf ( " \n " ) ; if ( crypto_register ( sc -> sc_cid , CRYPTO_SHA1_HMAC , 0 , 0 ) != 0 ) printf ( " \n " ) ; xlr_sec_init ( sc ) ; device_printf ( dev , " \n " ) ; return ( 0 ) ; error_exit : return ( ENXIO ) ; }
Attach an interface that successfully probed.
Attach an interface that successfully probed .