1 /* 2 * Copyright (c) 2016-2017 Nikola Kolev 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above 12 * copyright notice, this list of conditions and the following 13 * disclaimer in the documentation and/or other materials provided 14 * with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 26 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 * 29 */ 30 31 #ifndef COMPAT_H 32 #define COMPAT_H 33 34 #include <sys/types.h> 35 36 void 37 *reallocarray(void *, size_t, size_t); 38 void 39 *recallocarray(void *, size_t, size_t, size_t); 40 void 41 explicit_bzero(void *buf, size_t len); 42 int 43 bcrypt_checkpass(const char *pass, const char *goodhash); 44 int 45 bcrypt_newhash(const char *pass, int log_rounds, char *hash, size_t hashlen); 46 int 47 _bcrypt_autorounds(void); 48 int 49 crypt_checkpass(const char *pass, const char *goodhash); 50 int 51 crypt_newhash(const char *pass, const char *pref, char *hash, size_t hashlen); 52 char * 53 bcrypt(const char *pass, const char *salt); 54 int 55 stravis(char **outp, const char *src, int flag); 56 int 57 timingsafe_bcmp(const void *b1, const void *b2, size_t n); 58 int 59 timingsafe_memcmp(const void *b1, const void *b2, size_t len); 60 char * 61 bcrypt_gensalt(u_int8_t log_rounds); 62 void 63 freezero(void *ptr, size_t sz); 64 65 #endif 66