summaryrefslogtreecommitdiff
path: root/crypt
diff options
context:
space:
mode:
Diffstat (limited to 'crypt')
-rw-r--r--crypt/crypt.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/crypt/crypt.h b/crypt/crypt.h
index 3cb18de14d..ebe8607452 100644
--- a/crypt/crypt.h
+++ b/crypt/crypt.h
@@ -28,13 +28,18 @@
__BEGIN_DECLS
-/* Encrypt at most 8 characters from KEY using salt to perturb DES. */
-extern char *crypt (const char *__key, const char *__salt)
+/* One-way hash PHRASE, returning a string suitable for storage in the
+ user database. SALT selects the one-way function to use, and
+ ensures that no two users' hashes are the same, even if they use
+ the same passphrase. The return value points to static storage
+ which will be overwritten by the next call to crypt. */
+extern char *crypt (const char *__phrase, const char *__salt)
__THROW __nonnull ((1, 2));
#ifdef __USE_GNU
-/* Reentrant version of 'crypt'. The additional argument
- points to a structure where the results are placed in. */
+
+/* This structure provides scratch and output buffers for 'crypt_r'.
+ Its contents should not be accessed directly. */
struct crypt_data
{
char keysched[16 * 8];
@@ -49,7 +54,13 @@ struct crypt_data
int direction, initialized;
};
-extern char *crypt_r (const char *__key, const char *__salt,
+/* Thread-safe version of 'crypt'.
+ DATA must point to a 'struct crypt_data' allocated by the caller.
+ Before the first call to 'crypt_r' with a new 'struct crypt_data',
+ that object must be initialized to all zeroes. The pointer
+ returned, if not NULL, will point within DATA. (It will still be
+ overwritten by the next call to 'crypt_r' with the same DATA.) */
+extern char *crypt_r (const char *__phrase, const char *__salt,
struct crypt_data * __restrict __data)
__THROW __nonnull ((1, 2, 3));
#endif