summaryrefslogtreecommitdiffstats
path: root/ncr.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-06-17 10:59:12 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-06-17 20:49:05 +0200
commit094ae51f5909d71c18ed87f25aa493b8d22d0247 (patch)
tree70be3cbf8566e2d6895bfedb5a952463a2e79eb3 /ncr.c
parent71b9a53ef1f813c66ffd0fd83289c50f61a5f28a (diff)
downloadcryptodev-linux-094ae51f5909d71c18ed87f25aa493b8d22d0247.tar.gz
cryptodev-linux-094ae51f5909d71c18ed87f25aa493b8d22d0247.tar.xz
cryptodev-linux-094ae51f5909d71c18ed87f25aa493b8d22d0247.zip
Be more strict when loading master key.
Diffstat (limited to 'ncr.c')
-rw-r--r--ncr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ncr.c b/ncr.c
index c7f5494..352e0ed 100644
--- a/ncr.c
+++ b/ncr.c
@@ -91,10 +91,17 @@ struct ncr_master_key_st st;
return -EINVAL;
}
+ if (st.key_size != 16 && st.key_size != 24 && st.key_size != 32) {
+ dprintk(0, KERN_DEBUG, "Master key size must be 16,24 or 32.\n");
+ return -EINVAL;
+ }
+
if (master_key.type != NCR_KEY_TYPE_INVALID) {
dprintk(0, KERN_DEBUG, "Master key was previously initialized.\n");
}
+ dprintk(0, KERN_INFO, "Intializing master key.\n");
+
master_key.type = NCR_KEY_TYPE_SECRET;
memcpy(master_key.key.secret.data, st.key, st.key_size);