diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-12 12:57:11 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-12 12:59:56 +0200 |
commit | 4f7b10f59b97b45d42577c4d6d33958d9565aef7 (patch) | |
tree | 0f78a952c73985d7e2d852f90f7319a52db785de /userspace/setkey.c | |
parent | 8d2faf007636a936a5346426f6fe5c251a1255bb (diff) | |
download | cryptodev-linux-4f7b10f59b97b45d42577c4d6d33958d9565aef7.tar.gz cryptodev-linux-4f7b10f59b97b45d42577c4d6d33958d9565aef7.tar.xz cryptodev-linux-4f7b10f59b97b45d42577c4d6d33958d9565aef7.zip |
Initial additions to have PK encryption/decryption. Separated operations
on keys to read/write to prevent overwriting a key while using it. Several
other cleanups.
Diffstat (limited to 'userspace/setkey.c')
-rw-r--r-- | userspace/setkey.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/userspace/setkey.c b/userspace/setkey.c index 535773d..d0a2b62 100644 --- a/userspace/setkey.c +++ b/userspace/setkey.c @@ -47,6 +47,11 @@ int main(int argc, char** argv) memset(&key, 0, sizeof(key)); fp = fopen(argv[1], "r"); + if (fp == NULL) { + fprintf(stderr, "Cannot read %s\n", argv[1]); + exit(1); + } + size = fread(key.key, 1, sizeof(key.key), fp); if (size < 16) { fprintf(stderr, "Illegal key!\n"); |