Deleted Added
full compact
g_eli_ctl.c (214118) g_eli_ctl.c (214225)
1/*-
2 * Copyright (c) 2005-2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2005-2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/geom/eli/g_eli_ctl.c 214118 2010-10-20 20:50:55Z pjd $");
28__FBSDID("$FreeBSD: head/sys/geom/eli/g_eli_ctl.c 214225 2010-10-22 22:13:11Z pjd $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/module.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
36#include <sys/bio.h>

--- 840 unchanged lines hidden (view full) ---

877 pp->name, error);
878 return;
879 }
880 G_ELI_DEBUG(1, "Using Master Key %u for %s.", nkey, pp->name);
881
882 mtx_lock(&sc->sc_queue_mtx);
883 /* Restore sc_mkey, sc_ekeys, sc_akey and sc_ivkey. */
884 g_eli_mkey_propagate(sc, mkey);
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/module.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
36#include <sys/bio.h>

--- 840 unchanged lines hidden (view full) ---

877 pp->name, error);
878 return;
879 }
880 G_ELI_DEBUG(1, "Using Master Key %u for %s.", nkey, pp->name);
881
882 mtx_lock(&sc->sc_queue_mtx);
883 /* Restore sc_mkey, sc_ekeys, sc_akey and sc_ivkey. */
884 g_eli_mkey_propagate(sc, mkey);
885 bzero(mkey, sizeof(mkey));
886 bzero(&md, sizeof(md));
887 /* Restore sc_akeyctx. */
888 if (sc->sc_flags & G_ELI_FLAG_AUTH) {
889 SHA256_Init(&sc->sc_akeyctx);
890 SHA256_Update(&sc->sc_akeyctx, sc->sc_akey,
891 sizeof(sc->sc_akey));
892 }
893 /* Restore sc_ivctx. */
894 switch (sc->sc_ealgo) {
895 case CRYPTO_AES_XTS:
896 break;
897 default:
898 SHA256_Init(&sc->sc_ivctx);
899 SHA256_Update(&sc->sc_ivctx, sc->sc_ivkey,
900 sizeof(sc->sc_ivkey));
901 break;
902 }
903 sc->sc_flags &= ~G_ELI_FLAG_SUSPEND;
904 mtx_unlock(&sc->sc_queue_mtx);
885 sc->sc_flags &= ~G_ELI_FLAG_SUSPEND;
886 mtx_unlock(&sc->sc_queue_mtx);
887 bzero(mkey, sizeof(mkey));
888 bzero(&md, sizeof(md));
905 G_ELI_DEBUG(1, "Resumed %s.", pp->name);
906 wakeup(sc);
907}
908
909static int
910g_eli_kill_one(struct g_eli_softc *sc)
911{
912 struct g_provider *pp;

--- 145 unchanged lines hidden ---
889 G_ELI_DEBUG(1, "Resumed %s.", pp->name);
890 wakeup(sc);
891}
892
893static int
894g_eli_kill_one(struct g_eli_softc *sc)
895{
896 struct g_provider *pp;

--- 145 unchanged lines hidden ---