X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=sha2.c;h=e88b47daa327a1fc934de5b70e34917ce8a468b3;hb=0d9c60c64a7628d79882fd8ceb8d3aafc3548688;hp=a7b2afe4f0e080c4fda5b5647e30ca7d3d840669;hpb=d2be5f99ad1de08b9e88eb5ddefd09e32032e07c;p=xonotic%2Fd0_blind_id.git diff --git a/sha2.c b/sha2.c index a7b2afe..e88b47d 100644 --- a/sha2.c +++ b/sha2.c @@ -1,36 +1,42 @@ /* - * FILE: sha2.c - * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ - * - * Copyright (c) 2000-2001, Aaron D. Gifford - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the names of contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $ + * include the license notice into the dynamic library to "reproduce the + * copyright notice" automatically, so the application developer does not have + * to care about this term */ +const char *d0_sha2_c_bsd_license_notice = "\n" +"/*\n" +" * FILE: sha2.c\n" +" * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/\n" +" * \n" +" * Copyright (c) 2000-2001, Aaron D. Gifford\n" +" * All rights reserved.\n" +" *\n" +" * Redistribution and use in source and binary forms, with or without\n" +" * modification, are permitted provided that the following conditions\n" +" * are met:\n" +" * 1. Redistributions of source code must retain the above copyright\n" +" * notice, this list of conditions and the following disclaimer.\n" +" * 2. Redistributions in binary form must reproduce the above copyright\n" +" * notice, this list of conditions and the following disclaimer in the\n" +" * documentation and/or other materials provided with the distribution.\n" +" * 3. Neither the name of the copyright holder nor the names of contributors\n" +" * may be used to endorse or promote products derived from this software\n" +" * without specific prior written permission.\n" +" * \n" +" * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND\n" +" * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +" * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE\n" +" * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +" * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +" * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +" * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +" * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +" * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +" * SUCH DAMAGE.\n" +" *\n" +" * $Original-Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $\n" +" */\n"; #include /* memcpy()/memset() or bcopy()/bzero() */ #include /* assert() */ @@ -1062,15 +1068,3 @@ char* SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_S SHA384_Update(&context, data, len); return SHA384_End(&context, digest); } - - - - - -void sha256(unsigned char *out, const unsigned char *in, int n) -{ - SHA256_CTX context; - SHA256_Init(&context); - SHA256_Update(&context, in, n); - return SHA256_Final(out, &context); -}