File: authsaslclientcramsha1.c

package info (click to toggle)
courier-authlib 0.72.6-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 17,844 kB
  • sloc: ansic: 25,772; cpp: 12,475; sh: 5,588; makefile: 938; perl: 761
file content (36 lines) | stat: -rw-r--r-- 938 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

/*
** Copyright 2000-2008 Double Precision, Inc.  See COPYING for
** distribution information.
*/

#include	"courier_auth_config.h"
#include	"courierauthsasl.h"
#include	"libhmac/hmac.h"
#include	"authsaslclient.h"
#include	<stdlib.h>
#include	<stdio.h>
#include	<ctype.h>
#include	<string.h>
#include	<errno.h>

extern int authsaslclient_cram(const struct authsaslclientinfo *,
				const char *,
				const struct hmac_hashinfo *);

int authsaslclient_cramsha1(const struct authsaslclientinfo *info)
{
const char *p=(*info->start_conv_func)("CRAM-SHA1", NULL, info->conv_func_arg);

	if (!p) return (AUTHSASL_CANCELLED);
	return ( authsaslclient_cram(info, p, &hmac_sha1));
}

int authsaslclient_cramsha256(const struct authsaslclientinfo *info)
{
const char *p=(*info->start_conv_func)("CRAM-SHA256", NULL,
				       info->conv_func_arg);

	if (!p) return (AUTHSASL_CANCELLED);
	return ( authsaslclient_cram(info, p, &hmac_sha256));
}