8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libsasl / include / saslutil.h
blob9f2c642978dcca13fb74267f7c40650b47564335
1 /*
2 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 /*
7 * saslutil.h -- various utility functions in SASL library
8 */
10 #ifndef _SASL_SASLUTIL_H
11 #define _SASL_SASLUTIL_H
13 #pragma ident "%Z%%M% %I% %E% SMI"
15 #ifndef _SASL_SASL_H
16 #include <sasl/sasl.h>
17 #endif
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
24 * base64 decode
25 * in -- input data
26 * inlen -- length of input data
27 * out -- output data (may be same as in, must have enough space)
28 * outmax -- max size of output buffer
29 * result:
30 * outlen -- actual output length
32 * returns SASL_BADPROT on bad base64,
33 * SASL_BUFOVER if result won't fit
34 * SASL_OK on success
36 LIBSASL_API int sasl_decode64(const char *in, unsigned inlen,
37 char *out, unsigned outmax, unsigned *outlen);
40 * base64 encode
41 * in -- input data
42 * inlen -- input data length
43 * out -- output buffer (will be NUL terminated)
44 * outmax -- max size of output buffer
45 * result:
46 * outlen -- gets actual length of output buffer (optional)
48 * Returns SASL_OK on success, SASL_BUFOVER if result won't fit
50 LIBSASL_API int sasl_encode64(const char *in, unsigned inlen,
51 char *out, unsigned outmax, unsigned *outlen);
53 #if 0
55 * The following is not supported:
57 * make a challenge string (NUL terminated)
58 * buf -- buffer for result
59 * maxlen -- max length of result
60 * hostflag -- 0 = don't include hostname, 1 = include hostname
61 * returns final length or 0 if not enough space
63 LIBSASL_API int sasl_mkchal(sasl_conn_t *conn, char *buf,
64 unsigned maxlen, unsigned hostflag);
65 #endif
68 * verify a string is valid UTF-8
69 * if len == 0, strlen(str) will be used.
70 * returns SASL_BADPROT on error, SASL_OK on success
72 LIBSASL_API int sasl_utf8verify(const char *str, unsigned len);
74 #if 0
75 /* The following are not supported */
77 /* create random pool seeded with OS-based params */
78 LIBSASL_API int sasl_randcreate(sasl_rand_t **rpool);
80 /* free random pool from randcreate */
81 LIBSASL_API void sasl_randfree(sasl_rand_t **rpool);
83 /* seed random number generator */
84 LIBSASL_API void sasl_randseed(sasl_rand_t *rpool, const char *seed,
85 unsigned len);
87 /* generate random octets */
88 LIBSASL_API void sasl_rand(sasl_rand_t *rpool, char *buf, unsigned len);
90 /* churn data into random number generator */
91 LIBSASL_API void sasl_churn(sasl_rand_t *rpool, const char *data,
92 unsigned len);
93 #endif
96 * erase a security sensitive buffer or password.
97 * Implementation may use recovery-resistant erase logic.
99 LIBSASL_API void sasl_erasebuffer(char *pass, unsigned len);
101 #ifdef __cplusplus
103 #endif
105 #endif /* _SASL_SASLUTIL_H */