summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-11-03 16:47:56 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-11-03 16:47:56 +0000
commit8bd7389948091449a97bb944ebe9bae2c46ef4e6 (patch)
tree663337d373e0a6b4db8d57d64b8adb3b96026187 /usr.bin
parent9b27aaab87e70fca9ddfe2c249a02a7c28650028 (diff)
hoist blowfish up and use bcrypt_newhash directly
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/encrypt/encrypt.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/encrypt/encrypt.c b/usr.bin/encrypt/encrypt.c
index eaf26c7e1b2..800d190166e 100644
--- a/usr.bin/encrypt/encrypt.c
+++ b/usr.bin/encrypt/encrypt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: encrypt.c,v 1.32 2014/09/03 08:26:00 jmc Exp $ */
+/* $OpenBSD: encrypt.c,v 1.33 2014/11/03 16:47:55 tedu Exp $ */
/*
* Copyright (c) 1996, Jason Downs. All rights reserved.
@@ -105,6 +105,14 @@ print_passwd(char *string, int operation, void *extra)
int pwd_gensalt(char *, int, login_cap_t *, char);
void to64(char *, u_int32_t, int n);
+ if (operation == DO_BLF) {
+ if (bcrypt_newhash(string, *(int *)extra, buffer,
+ sizeof(buffer)) != 0)
+ errx(1, "bcrypt newhash failed");
+ fputs(buffer, stdout);
+ return;
+ }
+
switch(operation) {
case DO_MAKEKEY:
/*
@@ -118,11 +126,6 @@ print_passwd(char *string, int operation, void *extra)
salt = msalt;
break;
- case DO_BLF:
- strlcpy(buffer, bcrypt_gensalt(*(int *)extra), _PASSWORD_LEN);
- salt = buffer;
- break;
-
case DO_DES:
salt = extra;
break;