chiark / gitweb /
Knock address specifications into order.
[disorder] / lib / authhash.c
index 360d7ef9e7e6781886df728ec88f6ddc74049179..b97204d9364a76aee5479419c4c8374d17045ce5 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
+/** @file lib/authhash.c @brief The authorization hash */
 
 #include <config.h>
 #include "types.h"
 
 #include <stddef.h>
 #include <gcrypt.h>
+#include <assert.h>
 
 #include "hex.h"
 #include "log.h"
 #include "authhash.h"
 
 #ifndef AUTHHASH
+/** @brief Which hash function to use */
 # define AUTHHASH GCRY_MD_SHA1
 #endif
 
+/** @brief Perform the authorization hash function
+ * @param challenge Pointer to challange
+ * @param nchallenge Size of challenge
+ * @param password Password
+ *
+ * Computes H(challenge|password) and returns it as a newly allocated hex
+ * string.  Currently the hash function is SHA-1, but this may be changed in
+ * future versions; see @ref AUTHHASH.
+ */
 const char *authhash(const void *challenge, size_t nchallenge,
                     const char *password) {
   gcrypt_hash_handle h;
   const char *res;
-  
+
+  assert(challenge != 0);
+  assert(password != 0);
 #if HAVE_GCRY_ERROR_T
   {
     gcry_error_t e;
@@ -63,4 +77,3 @@ comment-column:40
 fill-column:79
 End:
 */
-/* arch-tag:fbc5c3876475fbeca3f7813dff16352d */