summaryrefslogtreecommitdiff
path: root/lib/libc/crypt/crypt.c
blob: 40d5503544fcdff51faa8b433ee7f12ddbd10347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*	$OpenBSD: crypt.c,v 1.31 2015/09/12 14:56:50 guenther Exp $	*/

#include <errno.h>
#include <pwd.h>
#include <unistd.h>

char *
crypt(const char *key, const char *setting)
{
	if (setting[0] == '$') {
		switch (setting[1]) {
		case '2':
			return bcrypt(key, setting);
		default:
			errno = EINVAL;
			return (NULL);
		}
	}
	errno = EINVAL;
	return (NULL);
}
DEF_WEAK(crypt);