1 /* saslutil.h -- various utility functions in SASL library
17 * inlen -- length of input data
18 * out -- output data (may be same as in, must have enough space)
19 * outmax -- max size of output buffer
21 * outlen -- actual output length
23 * returns SASL_BADPROT on bad base64,
24 * SASL_BUFOVER if result won't fit
27 LIBSASL_API int sasl_decode64(const char *in, unsigned inlen,
28 char *out, unsigned outmax, unsigned *outlen);
32 * inlen -- input data length
33 * out -- output buffer (will be NUL terminated)
34 * outmax -- max size of output buffer
36 * outlen -- gets actual length of output buffer (optional)
38 * Returns SASL_OK on success, SASL_BUFOVER if result won't fit
40 LIBSASL_API int sasl_encode64(const char *in, unsigned inlen,
41 char *out, unsigned outmax, unsigned *outlen);
43 /* make a challenge string (NUL terminated)
44 * buf -- buffer for result
45 * maxlen -- max length of result
46 * hostflag -- 0 = don't include hostname, 1 = include hostname
47 * returns final length or 0 if not enough space
49 LIBSASL_API int sasl_mkchal(sasl_conn_t *conn, char *buf,
50 unsigned maxlen, unsigned hostflag);
52 /* verify a string is valid UTF-8
53 * if len == 0, strlen(str) will be used.
54 * returns SASL_BADPROT on error, SASL_OK on success
56 LIBSASL_API int sasl_utf8verify(const char *str, unsigned len);
58 /* create random pool seeded with OS-based params */
59 LIBSASL_API int sasl_randcreate(sasl_rand_t **rpool);
61 /* free random pool from randcreate */
62 LIBSASL_API void sasl_randfree(sasl_rand_t **rpool);
64 /* seed random number generator */
65 LIBSASL_API void sasl_randseed(sasl_rand_t *rpool, const char *seed,
68 /* generate random octets */
69 LIBSASL_API void sasl_rand(sasl_rand_t *rpool, char *buf, unsigned len);
71 /* churn data into random number generator */
72 LIBSASL_API void sasl_churn(sasl_rand_t *rpool, const char *data,
75 /* erase a security sensitive buffer or password.
76 * Implementation may use recovery-resistant erase logic.
78 LIBSASL_API void sasl_erasebuffer(char *pass, unsigned len);
81 /* Just in case a different DLL defines this as well */
82 #if defined(NEED_GETOPT)
83 LIBSASL_API int getopt(int argc, char **argv, char *optstring);
85 LIBSASL_API char * getpass(const char *prompt);
92 #endif /* SASLUTIL_H */