/*-------------------------------------------------------------------------
*
- * crypt.h--
- * Interface to hba.c
+ * crypt.h
+ * Interface to libpq/crypt.c
*
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: crypt.h,v 1.22 2002/09/04 20:31:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PG_CRYPT_H
#define PG_CRYPT_H
-#include <libpq/libpq-be.h>
+#include "libpq/libpq-be.h"
-#define CRYPT_PWD_FILE "pg_pwd"
-#define CRYPT_PWD_FILE_SEPCHAR "'\\t'"
-#define CRYPT_PWD_FILE_SEPSTR "\t"
-#define CRYPT_PWD_RELOAD_SUFX ".reload"
+/* Also defined in interfaces/odbc/md5.h */
+#define MD5_PASSWD_LEN 35
-extern char **pwd_cache;
-extern int pwd_cache_count;
+#define isMD5(passwd) (strncmp((passwd),"md5",3) == 0 && \
+ strlen(passwd) == MD5_PASSWD_LEN)
-extern char *crypt_getpwdfilename(void);
-extern char *crypt_getpwdreloadfilename(void);
-#if 0
-extern MsgType crypt_salt(const char *user);
+extern int md5_crypt_verify(const Port *port, const char *user,
+ const char *pgpass);
+extern bool md5_hash(const void *buff, size_t len, char *hexsum);
+extern bool CheckMD5Pwd(char *passwd, char *storedpwd, char *seed);
-#endif
-extern int crypt_verify(Port *port, const char *user, const char *pgpass);
+/* Also defined in interfaces/odbc/md5.h */
+extern bool EncryptMD5(const char *passwd, const char *salt,
+ size_t salt_len, char *buf);
#endif