1
2 /*
3 ** Copyright 2000-2008 Double Precision, Inc. See COPYING for
4 ** distribution information.
5 */
6
7 #include "courier_auth_config.h"
8 #include "courierauthsasl.h"
9 #include "libhmac/hmac.h"
10 #include "authsaslclient.h"
11 #include <stdlib.h>
12 #include <stdio.h>
13 #include <ctype.h>
14 #include <string.h>
15 #include <errno.h>
16
17 extern int authsaslclient_cram(const struct authsaslclientinfo *,
18 const char *,
19 const struct hmac_hashinfo *);
20
authsaslclient_cramsha1(const struct authsaslclientinfo * info)21 int authsaslclient_cramsha1(const struct authsaslclientinfo *info)
22 {
23 const char *p=(*info->start_conv_func)("CRAM-SHA1", NULL, info->conv_func_arg);
24
25 if (!p) return (AUTHSASL_CANCELLED);
26 return ( authsaslclient_cram(info, p, &hmac_sha1));
27 }
28
authsaslclient_cramsha256(const struct authsaslclientinfo * info)29 int authsaslclient_cramsha256(const struct authsaslclientinfo *info)
30 {
31 const char *p=(*info->start_conv_func)("CRAM-SHA256", NULL,
32 info->conv_func_arg);
33
34 if (!p) return (AUTHSASL_CANCELLED);
35 return ( authsaslclient_cram(info, p, &hmac_sha256));
36 }
37