Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:14

0001 /* LINTLIBRARY */
0002 /*
0003  * Copyright (c) 1999
0004  *      Mark Murray.  All rights reserved.
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  * 1. Redistributions of source code must retain the above copyright
0010  *    notice, this list of conditions and the following disclaimer.
0011  * 2. Redistributions in binary form must reproduce the above copyright
0012  *    notice, this list of conditions and the following disclaimer in the
0013  *    documentation and/or other materials provided with the distribution.
0014  *
0015  * THIS SOFTWARE IS PROVIDED BY MARK MURRAY AND CONTRIBUTORS ``AS IS'' AND
0016  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0017  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0018  * ARE DISCLAIMED.  IN NO EVENT SHALL MARK MURRAY OR CONTRIBUTORS BE LIABLE
0019  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0020  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0021  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0022  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0023  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0024  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0025  * SUCH DAMAGE.
0026  *
0027  * $FreeBSD$
0028  *
0029  */
0030 
0031 #ifndef _CRYPT_H
0032 #define _CRYPT_H
0033 
0034 #include <sys/types.h>
0035 #include <sys/queue.h>
0036 
0037 __BEGIN_DECLS
0038 
0039 struct crypt_data {
0040     char buffer[256];
0041 };
0042 
0043 struct crypt_format {
0044     SLIST_ENTRY(crypt_format) link;
0045     char *(*func)(const char *, const char *, struct crypt_data *);
0046     const char *magic;
0047 };
0048 
0049 #define CRYPT_FORMAT_INITIALIZER(func, magic) { { NULL }, (func), (magic) }
0050 
0051 extern struct crypt_format crypt_md5_format;
0052 
0053 extern struct crypt_format crypt_sha256_format;
0054 
0055 extern struct crypt_format crypt_sha512_format;
0056 
0057 void crypt_add_format(struct crypt_format *);
0058 
0059 char *crypt_r(const char *, const char *, struct crypt_data *);
0060 
0061 char *crypt_md5_r(const char *, const char *, struct crypt_data *);
0062 
0063 char *crypt_sha256_r(const char *, const char *, struct crypt_data *);
0064 
0065 char *crypt_sha512_r(const char *, const char *, struct crypt_data *);
0066 
0067 void _crypt_to64(char *s, u_long v, int n);
0068 
0069 #define b64_from_24bit _crypt_b64_from_24bit
0070 void _crypt_b64_from_24bit(uint8_t, uint8_t, uint8_t, int, int *, char **);
0071 
0072 __END_DECLS
0073 
0074 #endif /* _CRYPT_H */