From: tedu Date: Tue, 14 Jan 2014 21:34:30 +0000 (+0000) Subject: most common pbkdf failure is no password, so check that first. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0e5a52c1e344d298e1c1abd9ff81eb349c22fa63;p=openbsd most common pbkdf failure is no password, so check that first. prompted by fritjof --- diff --git a/usr.bin/signify/signify.c b/usr.bin/signify/signify.c index a4e5bc2c9e9..9bc6bacedc9 100644 --- a/usr.bin/signify/signify.c +++ b/usr.bin/signify/signify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signify.c,v 1.36 2014/01/14 21:33:10 tedu Exp $ */ +/* $OpenBSD: signify.c,v 1.37 2014/01/14 21:34:30 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst * @@ -251,6 +251,8 @@ kdf(uint8_t *salt, size_t saltlen, int rounds, uint8_t *key, size_t keylen) if (!readpassphrase("passphrase: ", pass, sizeof(pass), 0)) errx(1, "readpassphrase"); + if (strlen(pass) == 0) + errx(1, "please provide a password"); if (bcrypt_pbkdf(pass, strlen(pass), salt, saltlen, key, keylen, rounds) == -1) errx(1, "bcrypt pbkdf");