summaryrefslogtreecommitdiff
path: root/src/lib/libc/crypt/bcrypt.c
diff options
context:
space:
mode:
authorguenther <>2015-09-13 15:33:48 +0000
committerguenther <>2015-09-13 15:33:48 +0000
commit529bd5d820f710a2d7db3cb00f91040cc7ace408 (patch)
treec414ecd25a90803da35ff2d69474317e840c62cd /src/lib/libc/crypt/bcrypt.c
parent5702f6374f537ac042891a95ce7bc5c3e24eb640 (diff)
downloadopenbsd-529bd5d820f710a2d7db3cb00f91040cc7ace408.tar.gz
openbsd-529bd5d820f710a2d7db3cb00f91040cc7ace408.tar.bz2
openbsd-529bd5d820f710a2d7db3cb00f91040cc7ace408.zip
Wrap <pwd.h> so that calls go direct and the symbols are all weak.
Hide bcrypt_autorounds(), prefixing with an underbar for static builds.
Diffstat (limited to 'src/lib/libc/crypt/bcrypt.c')
-rw-r--r--src/lib/libc/crypt/bcrypt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/libc/crypt/bcrypt.c b/src/lib/libc/crypt/bcrypt.c
index 0e6b00f12d..a8c1b9e7c8 100644
--- a/src/lib/libc/crypt/bcrypt.c
+++ b/src/lib/libc/crypt/bcrypt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bcrypt.c,v 1.54 2015/09/13 12:42:39 millert Exp $ */ 1/* $OpenBSD: bcrypt.c,v 1.55 2015/09/13 15:33:48 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> 4 * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
@@ -215,6 +215,7 @@ bcrypt_newhash(const char *pass, int log_rounds, char *hash, size_t hashlen)
215 explicit_bzero(salt, sizeof(salt)); 215 explicit_bzero(salt, sizeof(salt));
216 return 0; 216 return 0;
217} 217}
218DEF_WEAK(bcrypt_newhash);
218 219
219int 220int
220bcrypt_checkpass(const char *pass, const char *goodhash) 221bcrypt_checkpass(const char *pass, const char *goodhash)
@@ -232,13 +233,14 @@ bcrypt_checkpass(const char *pass, const char *goodhash)
232 explicit_bzero(hash, sizeof(hash)); 233 explicit_bzero(hash, sizeof(hash));
233 return 0; 234 return 0;
234} 235}
236DEF_WEAK(bcrypt_checkpass);
235 237
236/* 238/*
237 * Measure this system's performance by measuring the time for 8 rounds. 239 * Measure this system's performance by measuring the time for 8 rounds.
238 * We are aiming for something that takes around 0.1s, but not too much over. 240 * We are aiming for something that takes around 0.1s, but not too much over.
239 */ 241 */
240int 242int
241bcrypt_autorounds(void) 243_bcrypt_autorounds(void)
242{ 244{
243 struct timespec before, after; 245 struct timespec before, after;
244 int r = 8; 246 int r = 8;
@@ -391,3 +393,4 @@ bcrypt(const char *pass, const char *salt)
391 393
392 return gencrypted; 394 return gencrypted;
393} 395}
396DEF_WEAK(bcrypt);