crypt.h 1.12 KB
Newer Older
1 2
/*-------------------------------------------------------------------------
 *
3
 * crypt.h
4
 *	  Interface to libpq/crypt.c
5
 *
6 7
 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
8
 *
9
 * $Id: crypt.h,v 1.19 2001/11/12 01:52:46 momjian Exp $
10
 *
11 12 13 14 15
 *-------------------------------------------------------------------------
 */
#ifndef PG_CRYPT_H
#define PG_CRYPT_H

16
#include "libpq/libpq-be.h"
17

18
#define CRYPT_PWD_FILE_SEPSTR	"\t"
19

20
/* Also defined in interfaces/odbc/md5.h */
21 22 23 24
#define MD5_PASSWD_LEN	35

#define isMD5(passwd)	(strncmp((passwd),"md5",3) == 0 && \
						 strlen(passwd) == MD5_PASSWD_LEN)
25 26


27 28
extern char *crypt_getpwdfilename(void);
extern void load_password_cache(void);
29

30 31
extern int md5_crypt_verify(const Port *port, const char *user,
				 const char *pgpass);
32 33
extern bool md5_hash(const void *buff, size_t len, char *hexsum);
extern bool CheckMD5Pwd(char *passwd, char *storedpwd, char *seed);
34
/* Also defined in interfaces/odbc/md5.h */
35 36
extern bool EncryptMD5(const char *passwd, const char *salt,
		   size_t salt_len, char *buf);
37

38
#endif