From 2c87962602b1a4c83be8407d370a03cbbd75142f Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Mon, 10 Apr 2006 18:49:46 +0000 Subject: [PATCH] safe(4) doesn't support explicitly provided keys. Return an error instead of encrypting/decrypting data with a wrong key. --- sys/dev/safe/safe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/safe/safe.c b/sys/dev/safe/safe.c index 9d012f172de9..6dde6ad4e082 100644 --- a/sys/dev/safe/safe.c +++ b/sys/dev/safe/safe.c @@ -904,6 +904,13 @@ safe_process(void *arg, struct cryptop *crp, int hint) } crd2 = crd1->crd_next; + if ((crd1->crd_flags & CRD_F_KEY_EXPLICIT) || + (crd2 != NULL && (crd2->crd_flags & CRD_F_KEY_EXPLICIT))) { + safestats.st_badflags++; + err = EINVAL; + goto errout; + } + cmd0 = SAFE_SA_CMD0_BASIC; /* basic group operation */ cmd1 = 0; if (crd2 == NULL) {