summaryrefslogtreecommitdiff
path: root/support/passwd_common.h
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2012-10-07 09:06:10 +0000
committerStefan Fritsch <sf@apache.org>2012-10-07 09:06:10 +0000
commitc2eb43db553701ec12e693d13bca8c7bca113061 (patch)
treeac64181b7412122b2d499d745c0d872d40764019 /support/passwd_common.h
parent65d07ff463e94a8689a8a93bbe7706ba3734c503 (diff)
downloadhttpd-c2eb43db553701ec12e693d13bca8c7bca113061.tar.gz
add support for bcrypt
PR: 49288 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1395255 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support/passwd_common.h')
-rw-r--r--support/passwd_common.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/support/passwd_common.h b/support/passwd_common.h
index 79341dda6f..6fc5b712cd 100644
--- a/support/passwd_common.h
+++ b/support/passwd_common.h
@@ -21,6 +21,9 @@
#include "apr_file_io.h"
#include "apr_general.h"
#include "apr_version.h"
+#if !APR_VERSION_AT_LEAST(2,0,0)
+#include "apu_version.h"
+#endif
#define MAX_STRING_LEN 256
@@ -28,6 +31,9 @@
#define ALG_CRYPT 1
#define ALG_APMD5 2
#define ALG_APSHA 3
+#define ALG_BCRYPT 4
+
+#define BCRYPT_DEFAULT_COST 5
#define ERR_FILEPERM 1
#define ERR_SYNTAX 2
@@ -50,6 +56,13 @@
#define PLAIN_ALGO_SUPPORTED 0
#endif
+#if APR_VERSION_AT_LEAST(2,0,0) || \
+ (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 5)
+#define BCRYPT_ALGO_SUPPORTED 1
+#else
+#define BCRYPT_ALGO_SUPPORTED 0
+#endif
+
/*
* Must be initialized with apr_file_open_stderr() before using any of the
* below functions.
@@ -63,6 +76,7 @@ struct passwd_ctx {
apr_size_t out_len;
char *passwd;
int alg;
+ int cost;
enum {
PW_PROMPT = 0,
PW_ARG