Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:15:32

0001 /* saslutil.h -- various utility functions in SASL library
0002  */
0003 
0004 #ifndef SASLUTIL_H
0005 #define SASLUTIL_H 1
0006 
0007 #ifndef SASL_H
0008 #include "sasl.h"
0009 #endif
0010 
0011 #ifdef __cplusplus
0012 extern "C" {
0013 #endif
0014 
0015 /* base64 decode
0016  *  in     -- input data
0017  *  inlen  -- length of input data
0018  *  out    -- output data (may be same as in, must have enough space)
0019  *  outmax  -- max size of output buffer
0020  * result:
0021  *  outlen -- actual output length
0022  *
0023  * returns SASL_BADPROT on bad base64,
0024  *  SASL_BUFOVER if result won't fit
0025  *  SASL_OK on success
0026  */
0027 LIBSASL_API int sasl_decode64(const char *in, unsigned inlen,
0028                   char *out, unsigned outmax, unsigned *outlen);
0029 
0030 /* base64 encode
0031  *  in      -- input data
0032  *  inlen   -- input data length
0033  *  out     -- output buffer (will be NUL terminated)
0034  *  outmax  -- max size of output buffer
0035  * result:
0036  *  outlen  -- gets actual length of output buffer (optional)
0037  * 
0038  * Returns SASL_OK on success, SASL_BUFOVER if result won't fit
0039  */
0040 LIBSASL_API int sasl_encode64(const char *in, unsigned inlen,
0041                   char *out, unsigned outmax, unsigned *outlen);
0042 
0043 /* make a challenge string (NUL terminated)
0044  *  buf      -- buffer for result
0045  *  maxlen   -- max length of result
0046  *  hostflag -- 0 = don't include hostname, 1 = include hostname
0047  * returns final length or 0 if not enough space
0048  */
0049 LIBSASL_API int sasl_mkchal(sasl_conn_t *conn, char *buf, 
0050                 unsigned maxlen, unsigned hostflag);
0051 
0052 /* verify a string is valid UTF-8
0053  * if len == 0, strlen(str) will be used.
0054  * returns SASL_BADPROT on error, SASL_OK on success
0055  */
0056 LIBSASL_API int sasl_utf8verify(const char *str, unsigned len);
0057 
0058 /* create random pool seeded with OS-based params */
0059 LIBSASL_API int sasl_randcreate(sasl_rand_t **rpool);
0060 
0061 /* free random pool from randcreate */
0062 LIBSASL_API void sasl_randfree(sasl_rand_t **rpool);
0063 
0064 /* seed random number generator */
0065 LIBSASL_API void sasl_randseed(sasl_rand_t *rpool, const char *seed,
0066                    unsigned len);
0067 
0068 /* generate random octets */
0069 LIBSASL_API void sasl_rand(sasl_rand_t *rpool, char *buf, unsigned len);
0070 
0071 /* churn data into random number generator */
0072 LIBSASL_API void sasl_churn(sasl_rand_t *rpool, const char *data,
0073                 unsigned len);
0074 
0075 /* erase a security sensitive buffer or password.
0076  *   Implementation may use recovery-resistant erase logic.  
0077  */
0078 LIBSASL_API void sasl_erasebuffer(char *pass, unsigned len);
0079 
0080 /* Lowercase string in place */
0081 LIBSASL_API char *sasl_strlower (char *val);
0082 
0083 LIBSASL_API int sasl_config_init(const char *filename);
0084 
0085 LIBSASL_API void sasl_config_done(void);
0086 
0087 #ifdef WIN32
0088 /* Just in case a different DLL defines this as well */
0089 #if defined(NEED_GETOPT)
0090 LIBSASL_API int getopt(int argc, char **argv, char *optstring);
0091 #endif
0092 LIBSASL_API char * getpass(const char *prompt);
0093 #endif /* WIN32 */
0094 
0095 #ifdef __cplusplus
0096 }
0097 #endif
0098 
0099 #endif /* SASLUTIL_H */