remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2003 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2003-2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -221,7 +221,7 @@ BN_bn2hex(const BIGNUM *bn)
|
||||
int
|
||||
BN_cmp(const BIGNUM *bn1, const BIGNUM *bn2)
|
||||
{
|
||||
return der_heim_integer_cmp((const heim_integer *)bn1,
|
||||
return der_heim_integer_cmp((const heim_integer *)bn1,
|
||||
(const heim_integer *)bn2);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ BN_is_bit_set(const BIGNUM *bn, int bit)
|
||||
|
||||
if ((bit / 8) > hi->length || hi->length == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
return p[hi->length - 1 - (bit / 8)] & is_set[bit % 8];
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ BN_uadd(BIGNUM *res, const BIGNUM *a, const BIGNUM *b)
|
||||
const heim_integer *si = bi;
|
||||
bi = ai; ai = si;
|
||||
}
|
||||
|
||||
|
||||
ci.negative = 0;
|
||||
ci.length = ai->length + 1;
|
||||
ci.data = malloc(ci.length);
|
||||
@@ -416,7 +416,7 @@ BN_uadd(BIGNUM *res, const BIGNUM *a, const BIGNUM *b)
|
||||
memmove(cp, cp + 1, --ci.length);
|
||||
else
|
||||
*cp = carry;
|
||||
|
||||
|
||||
BN_clear(res);
|
||||
*((heim_integer *)res) = ci;
|
||||
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Algorithm Specification
|
||||
* Algorithm Specification
|
||||
* http://info.isl.ntt.co.jp/crypt/eng/camellia/specifications.html
|
||||
*/
|
||||
|
||||
@@ -942,7 +942,7 @@ static void camellia_setup256(const unsigned char *key, u32 *subkey)
|
||||
CamelliaSubkeyR(30) = CamelliaSubkeyL(30) ^ dw, CamelliaSubkeyL(30) = dw;
|
||||
dw = CamelliaSubkeyL(31) ^ CamelliaSubkeyR(31), dw = CAMELLIA_RL8(dw);
|
||||
CamelliaSubkeyR(31) = CamelliaSubkeyL(31) ^ dw,CamelliaSubkeyL(31) = dw;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1061,7 +1061,7 @@ static void camellia_encrypt128(const u32 *subkey, u32 *io)
|
||||
static void camellia_decrypt128(const u32 *subkey, u32 *io)
|
||||
{
|
||||
u32 il,ir,t0,t1; /* temporary valiables */
|
||||
|
||||
|
||||
/* pre whitening but absorb kw2*/
|
||||
io[0] ^= CamelliaSubkeyL(24);
|
||||
io[1] ^= CamelliaSubkeyR(24);
|
||||
@@ -1384,8 +1384,8 @@ static void camellia_decrypt256(const u32 *subkey, u32 *io)
|
||||
* API for compatibility
|
||||
*/
|
||||
|
||||
void Camellia_Ekeygen(const int keyBitLength,
|
||||
const unsigned char *rawKey,
|
||||
void Camellia_Ekeygen(const int keyBitLength,
|
||||
const unsigned char *rawKey,
|
||||
KEY_TABLE_TYPE keyTable)
|
||||
{
|
||||
switch(keyBitLength) {
|
||||
@@ -1404,9 +1404,9 @@ void Camellia_Ekeygen(const int keyBitLength,
|
||||
}
|
||||
|
||||
|
||||
void Camellia_EncryptBlock(const int keyBitLength,
|
||||
const unsigned char *plaintext,
|
||||
const KEY_TABLE_TYPE keyTable,
|
||||
void Camellia_EncryptBlock(const int keyBitLength,
|
||||
const unsigned char *plaintext,
|
||||
const KEY_TABLE_TYPE keyTable,
|
||||
unsigned char *ciphertext)
|
||||
{
|
||||
u32 tmp[4];
|
||||
@@ -1435,9 +1435,9 @@ void Camellia_EncryptBlock(const int keyBitLength,
|
||||
PUTU32(ciphertext + 12, tmp[3]);
|
||||
}
|
||||
|
||||
void Camellia_DecryptBlock(const int keyBitLength,
|
||||
const unsigned char *ciphertext,
|
||||
const KEY_TABLE_TYPE keyTable,
|
||||
void Camellia_DecryptBlock(const int keyBitLength,
|
||||
const unsigned char *ciphertext,
|
||||
const KEY_TABLE_TYPE keyTable,
|
||||
unsigned char *plaintext)
|
||||
{
|
||||
u32 tmp[4];
|
||||
|
@@ -44,17 +44,17 @@ typedef u32 KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN];
|
||||
|
||||
|
||||
void Camellia_Ekeygen(const int keyBitLength,
|
||||
const unsigned char *rawKey,
|
||||
const unsigned char *rawKey,
|
||||
KEY_TABLE_TYPE keyTable);
|
||||
|
||||
void Camellia_EncryptBlock(const int keyBitLength,
|
||||
const unsigned char *plaintext,
|
||||
const KEY_TABLE_TYPE keyTable,
|
||||
const unsigned char *plaintext,
|
||||
const KEY_TABLE_TYPE keyTable,
|
||||
unsigned char *cipherText);
|
||||
|
||||
void Camellia_DecryptBlock(const int keyBitLength,
|
||||
const unsigned char *cipherText,
|
||||
const KEY_TABLE_TYPE keyTable,
|
||||
void Camellia_DecryptBlock(const int keyBitLength,
|
||||
const unsigned char *cipherText,
|
||||
const KEY_TABLE_TYPE keyTable,
|
||||
unsigned char *plaintext);
|
||||
|
||||
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -47,7 +47,7 @@ RCSID("$Id: aes.c 20466 2007-04-20 08:29:05Z lha $");
|
||||
#include "camellia.h"
|
||||
|
||||
int
|
||||
CAMELLIA_set_key(const unsigned char *userkey,
|
||||
CAMELLIA_set_key(const unsigned char *userkey,
|
||||
const int bits, CAMELLIA_KEY *key)
|
||||
{
|
||||
key->bits = bits;
|
||||
@@ -56,7 +56,7 @@ CAMELLIA_set_key(const unsigned char *userkey,
|
||||
}
|
||||
|
||||
void
|
||||
CAMELLIA_encrypt(const unsigned char *in, unsigned char *out,
|
||||
CAMELLIA_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key)
|
||||
{
|
||||
Camellia_EncryptBlock(key->bits, in, key->key, out);
|
||||
@@ -64,7 +64,7 @@ CAMELLIA_encrypt(const unsigned char *in, unsigned char *out,
|
||||
}
|
||||
|
||||
void
|
||||
CAMELLIA_decrypt(const unsigned char *in, unsigned char *out,
|
||||
CAMELLIA_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key)
|
||||
{
|
||||
Camellia_DecryptBlock(key->bits, in, key->key, out);
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,181 +2,181 @@
|
||||
|
||||
/* pc1_c_3 bit pattern 5 13 21 */
|
||||
static int pc1_c_3[8] = {
|
||||
0x00000000, 0x00000010, 0x00001000, 0x00001010,
|
||||
0x00000000, 0x00000010, 0x00001000, 0x00001010,
|
||||
0x00100000, 0x00100010, 0x00101000, 0x00101010
|
||||
};
|
||||
/* pc1_c_4 bit pattern 1 9 17 25 */
|
||||
static int pc1_c_4[16] = {
|
||||
0x00000000, 0x00000001, 0x00000100, 0x00000101,
|
||||
0x00010000, 0x00010001, 0x00010100, 0x00010101,
|
||||
0x01000000, 0x01000001, 0x01000100, 0x01000101,
|
||||
0x00000000, 0x00000001, 0x00000100, 0x00000101,
|
||||
0x00010000, 0x00010001, 0x00010100, 0x00010101,
|
||||
0x01000000, 0x01000001, 0x01000100, 0x01000101,
|
||||
0x01010000, 0x01010001, 0x01010100, 0x01010101
|
||||
};
|
||||
/* pc1_d_3 bit pattern 49 41 33 */
|
||||
static int pc1_d_3[8] = {
|
||||
0x00000000, 0x01000000, 0x00010000, 0x01010000,
|
||||
0x00000000, 0x01000000, 0x00010000, 0x01010000,
|
||||
0x00000100, 0x01000100, 0x00010100, 0x01010100
|
||||
};
|
||||
/* pc1_d_4 bit pattern 57 53 45 37 */
|
||||
static int pc1_d_4[16] = {
|
||||
0x00000000, 0x00100000, 0x00001000, 0x00101000,
|
||||
0x00000010, 0x00100010, 0x00001010, 0x00101010,
|
||||
0x00000001, 0x00100001, 0x00001001, 0x00101001,
|
||||
0x00000000, 0x00100000, 0x00001000, 0x00101000,
|
||||
0x00000010, 0x00100010, 0x00001010, 0x00101010,
|
||||
0x00000001, 0x00100001, 0x00001001, 0x00101001,
|
||||
0x00000011, 0x00100011, 0x00001011, 0x00101011
|
||||
};
|
||||
/* pc2_c_1 bit pattern 5 24 7 16 6 10 */
|
||||
static int pc2_c_1[64] = {
|
||||
0x00000000, 0x00004000, 0x00040000, 0x00044000,
|
||||
0x00000100, 0x00004100, 0x00040100, 0x00044100,
|
||||
0x00020000, 0x00024000, 0x00060000, 0x00064000,
|
||||
0x00020100, 0x00024100, 0x00060100, 0x00064100,
|
||||
0x00000001, 0x00004001, 0x00040001, 0x00044001,
|
||||
0x00000101, 0x00004101, 0x00040101, 0x00044101,
|
||||
0x00020001, 0x00024001, 0x00060001, 0x00064001,
|
||||
0x00020101, 0x00024101, 0x00060101, 0x00064101,
|
||||
0x00080000, 0x00084000, 0x000c0000, 0x000c4000,
|
||||
0x00080100, 0x00084100, 0x000c0100, 0x000c4100,
|
||||
0x000a0000, 0x000a4000, 0x000e0000, 0x000e4000,
|
||||
0x000a0100, 0x000a4100, 0x000e0100, 0x000e4100,
|
||||
0x00080001, 0x00084001, 0x000c0001, 0x000c4001,
|
||||
0x00080101, 0x00084101, 0x000c0101, 0x000c4101,
|
||||
0x000a0001, 0x000a4001, 0x000e0001, 0x000e4001,
|
||||
0x00000000, 0x00004000, 0x00040000, 0x00044000,
|
||||
0x00000100, 0x00004100, 0x00040100, 0x00044100,
|
||||
0x00020000, 0x00024000, 0x00060000, 0x00064000,
|
||||
0x00020100, 0x00024100, 0x00060100, 0x00064100,
|
||||
0x00000001, 0x00004001, 0x00040001, 0x00044001,
|
||||
0x00000101, 0x00004101, 0x00040101, 0x00044101,
|
||||
0x00020001, 0x00024001, 0x00060001, 0x00064001,
|
||||
0x00020101, 0x00024101, 0x00060101, 0x00064101,
|
||||
0x00080000, 0x00084000, 0x000c0000, 0x000c4000,
|
||||
0x00080100, 0x00084100, 0x000c0100, 0x000c4100,
|
||||
0x000a0000, 0x000a4000, 0x000e0000, 0x000e4000,
|
||||
0x000a0100, 0x000a4100, 0x000e0100, 0x000e4100,
|
||||
0x00080001, 0x00084001, 0x000c0001, 0x000c4001,
|
||||
0x00080101, 0x00084101, 0x000c0101, 0x000c4101,
|
||||
0x000a0001, 0x000a4001, 0x000e0001, 0x000e4001,
|
||||
0x000a0101, 0x000a4101, 0x000e0101, 0x000e4101
|
||||
};
|
||||
/* pc2_c_2 bit pattern 20 18 12 3 15 23 */
|
||||
static int pc2_c_2[64] = {
|
||||
0x00000000, 0x00000002, 0x00000200, 0x00000202,
|
||||
0x00200000, 0x00200002, 0x00200200, 0x00200202,
|
||||
0x00001000, 0x00001002, 0x00001200, 0x00001202,
|
||||
0x00201000, 0x00201002, 0x00201200, 0x00201202,
|
||||
0x00000040, 0x00000042, 0x00000240, 0x00000242,
|
||||
0x00200040, 0x00200042, 0x00200240, 0x00200242,
|
||||
0x00001040, 0x00001042, 0x00001240, 0x00001242,
|
||||
0x00201040, 0x00201042, 0x00201240, 0x00201242,
|
||||
0x00000010, 0x00000012, 0x00000210, 0x00000212,
|
||||
0x00200010, 0x00200012, 0x00200210, 0x00200212,
|
||||
0x00001010, 0x00001012, 0x00001210, 0x00001212,
|
||||
0x00201010, 0x00201012, 0x00201210, 0x00201212,
|
||||
0x00000050, 0x00000052, 0x00000250, 0x00000252,
|
||||
0x00200050, 0x00200052, 0x00200250, 0x00200252,
|
||||
0x00001050, 0x00001052, 0x00001250, 0x00001252,
|
||||
0x00000000, 0x00000002, 0x00000200, 0x00000202,
|
||||
0x00200000, 0x00200002, 0x00200200, 0x00200202,
|
||||
0x00001000, 0x00001002, 0x00001200, 0x00001202,
|
||||
0x00201000, 0x00201002, 0x00201200, 0x00201202,
|
||||
0x00000040, 0x00000042, 0x00000240, 0x00000242,
|
||||
0x00200040, 0x00200042, 0x00200240, 0x00200242,
|
||||
0x00001040, 0x00001042, 0x00001240, 0x00001242,
|
||||
0x00201040, 0x00201042, 0x00201240, 0x00201242,
|
||||
0x00000010, 0x00000012, 0x00000210, 0x00000212,
|
||||
0x00200010, 0x00200012, 0x00200210, 0x00200212,
|
||||
0x00001010, 0x00001012, 0x00001210, 0x00001212,
|
||||
0x00201010, 0x00201012, 0x00201210, 0x00201212,
|
||||
0x00000050, 0x00000052, 0x00000250, 0x00000252,
|
||||
0x00200050, 0x00200052, 0x00200250, 0x00200252,
|
||||
0x00001050, 0x00001052, 0x00001250, 0x00001252,
|
||||
0x00201050, 0x00201052, 0x00201250, 0x00201252
|
||||
};
|
||||
/* pc2_c_3 bit pattern 1 9 19 2 14 22 */
|
||||
static int pc2_c_3[64] = {
|
||||
0x00000000, 0x00000004, 0x00000400, 0x00000404,
|
||||
0x00400000, 0x00400004, 0x00400400, 0x00400404,
|
||||
0x00000020, 0x00000024, 0x00000420, 0x00000424,
|
||||
0x00400020, 0x00400024, 0x00400420, 0x00400424,
|
||||
0x00008000, 0x00008004, 0x00008400, 0x00008404,
|
||||
0x00408000, 0x00408004, 0x00408400, 0x00408404,
|
||||
0x00008020, 0x00008024, 0x00008420, 0x00008424,
|
||||
0x00408020, 0x00408024, 0x00408420, 0x00408424,
|
||||
0x00800000, 0x00800004, 0x00800400, 0x00800404,
|
||||
0x00c00000, 0x00c00004, 0x00c00400, 0x00c00404,
|
||||
0x00800020, 0x00800024, 0x00800420, 0x00800424,
|
||||
0x00c00020, 0x00c00024, 0x00c00420, 0x00c00424,
|
||||
0x00808000, 0x00808004, 0x00808400, 0x00808404,
|
||||
0x00c08000, 0x00c08004, 0x00c08400, 0x00c08404,
|
||||
0x00808020, 0x00808024, 0x00808420, 0x00808424,
|
||||
0x00000000, 0x00000004, 0x00000400, 0x00000404,
|
||||
0x00400000, 0x00400004, 0x00400400, 0x00400404,
|
||||
0x00000020, 0x00000024, 0x00000420, 0x00000424,
|
||||
0x00400020, 0x00400024, 0x00400420, 0x00400424,
|
||||
0x00008000, 0x00008004, 0x00008400, 0x00008404,
|
||||
0x00408000, 0x00408004, 0x00408400, 0x00408404,
|
||||
0x00008020, 0x00008024, 0x00008420, 0x00008424,
|
||||
0x00408020, 0x00408024, 0x00408420, 0x00408424,
|
||||
0x00800000, 0x00800004, 0x00800400, 0x00800404,
|
||||
0x00c00000, 0x00c00004, 0x00c00400, 0x00c00404,
|
||||
0x00800020, 0x00800024, 0x00800420, 0x00800424,
|
||||
0x00c00020, 0x00c00024, 0x00c00420, 0x00c00424,
|
||||
0x00808000, 0x00808004, 0x00808400, 0x00808404,
|
||||
0x00c08000, 0x00c08004, 0x00c08400, 0x00c08404,
|
||||
0x00808020, 0x00808024, 0x00808420, 0x00808424,
|
||||
0x00c08020, 0x00c08024, 0x00c08420, 0x00c08424
|
||||
};
|
||||
/* pc2_c_4 bit pattern 11 13 4 17 21 8 */
|
||||
static int pc2_c_4[64] = {
|
||||
0x00000000, 0x00010000, 0x00000008, 0x00010008,
|
||||
0x00000080, 0x00010080, 0x00000088, 0x00010088,
|
||||
0x00100000, 0x00110000, 0x00100008, 0x00110008,
|
||||
0x00100080, 0x00110080, 0x00100088, 0x00110088,
|
||||
0x00000800, 0x00010800, 0x00000808, 0x00010808,
|
||||
0x00000880, 0x00010880, 0x00000888, 0x00010888,
|
||||
0x00100800, 0x00110800, 0x00100808, 0x00110808,
|
||||
0x00100880, 0x00110880, 0x00100888, 0x00110888,
|
||||
0x00002000, 0x00012000, 0x00002008, 0x00012008,
|
||||
0x00002080, 0x00012080, 0x00002088, 0x00012088,
|
||||
0x00102000, 0x00112000, 0x00102008, 0x00112008,
|
||||
0x00102080, 0x00112080, 0x00102088, 0x00112088,
|
||||
0x00002800, 0x00012800, 0x00002808, 0x00012808,
|
||||
0x00002880, 0x00012880, 0x00002888, 0x00012888,
|
||||
0x00102800, 0x00112800, 0x00102808, 0x00112808,
|
||||
0x00000000, 0x00010000, 0x00000008, 0x00010008,
|
||||
0x00000080, 0x00010080, 0x00000088, 0x00010088,
|
||||
0x00100000, 0x00110000, 0x00100008, 0x00110008,
|
||||
0x00100080, 0x00110080, 0x00100088, 0x00110088,
|
||||
0x00000800, 0x00010800, 0x00000808, 0x00010808,
|
||||
0x00000880, 0x00010880, 0x00000888, 0x00010888,
|
||||
0x00100800, 0x00110800, 0x00100808, 0x00110808,
|
||||
0x00100880, 0x00110880, 0x00100888, 0x00110888,
|
||||
0x00002000, 0x00012000, 0x00002008, 0x00012008,
|
||||
0x00002080, 0x00012080, 0x00002088, 0x00012088,
|
||||
0x00102000, 0x00112000, 0x00102008, 0x00112008,
|
||||
0x00102080, 0x00112080, 0x00102088, 0x00112088,
|
||||
0x00002800, 0x00012800, 0x00002808, 0x00012808,
|
||||
0x00002880, 0x00012880, 0x00002888, 0x00012888,
|
||||
0x00102800, 0x00112800, 0x00102808, 0x00112808,
|
||||
0x00102880, 0x00112880, 0x00102888, 0x00112888
|
||||
};
|
||||
/* pc2_d_1 bit pattern 51 35 31 52 39 45 */
|
||||
static int pc2_d_1[64] = {
|
||||
0x00000000, 0x00000080, 0x00002000, 0x00002080,
|
||||
0x00000001, 0x00000081, 0x00002001, 0x00002081,
|
||||
0x00200000, 0x00200080, 0x00202000, 0x00202080,
|
||||
0x00200001, 0x00200081, 0x00202001, 0x00202081,
|
||||
0x00020000, 0x00020080, 0x00022000, 0x00022080,
|
||||
0x00020001, 0x00020081, 0x00022001, 0x00022081,
|
||||
0x00220000, 0x00220080, 0x00222000, 0x00222080,
|
||||
0x00220001, 0x00220081, 0x00222001, 0x00222081,
|
||||
0x00000002, 0x00000082, 0x00002002, 0x00002082,
|
||||
0x00000003, 0x00000083, 0x00002003, 0x00002083,
|
||||
0x00200002, 0x00200082, 0x00202002, 0x00202082,
|
||||
0x00200003, 0x00200083, 0x00202003, 0x00202083,
|
||||
0x00020002, 0x00020082, 0x00022002, 0x00022082,
|
||||
0x00020003, 0x00020083, 0x00022003, 0x00022083,
|
||||
0x00220002, 0x00220082, 0x00222002, 0x00222082,
|
||||
0x00000000, 0x00000080, 0x00002000, 0x00002080,
|
||||
0x00000001, 0x00000081, 0x00002001, 0x00002081,
|
||||
0x00200000, 0x00200080, 0x00202000, 0x00202080,
|
||||
0x00200001, 0x00200081, 0x00202001, 0x00202081,
|
||||
0x00020000, 0x00020080, 0x00022000, 0x00022080,
|
||||
0x00020001, 0x00020081, 0x00022001, 0x00022081,
|
||||
0x00220000, 0x00220080, 0x00222000, 0x00222080,
|
||||
0x00220001, 0x00220081, 0x00222001, 0x00222081,
|
||||
0x00000002, 0x00000082, 0x00002002, 0x00002082,
|
||||
0x00000003, 0x00000083, 0x00002003, 0x00002083,
|
||||
0x00200002, 0x00200082, 0x00202002, 0x00202082,
|
||||
0x00200003, 0x00200083, 0x00202003, 0x00202083,
|
||||
0x00020002, 0x00020082, 0x00022002, 0x00022082,
|
||||
0x00020003, 0x00020083, 0x00022003, 0x00022083,
|
||||
0x00220002, 0x00220082, 0x00222002, 0x00222082,
|
||||
0x00220003, 0x00220083, 0x00222003, 0x00222083
|
||||
};
|
||||
/* pc2_d_2 bit pattern 50 32 43 36 29 48 */
|
||||
static int pc2_d_2[64] = {
|
||||
0x00000000, 0x00000010, 0x00800000, 0x00800010,
|
||||
0x00010000, 0x00010010, 0x00810000, 0x00810010,
|
||||
0x00000200, 0x00000210, 0x00800200, 0x00800210,
|
||||
0x00010200, 0x00010210, 0x00810200, 0x00810210,
|
||||
0x00100000, 0x00100010, 0x00900000, 0x00900010,
|
||||
0x00110000, 0x00110010, 0x00910000, 0x00910010,
|
||||
0x00100200, 0x00100210, 0x00900200, 0x00900210,
|
||||
0x00110200, 0x00110210, 0x00910200, 0x00910210,
|
||||
0x00000004, 0x00000014, 0x00800004, 0x00800014,
|
||||
0x00010004, 0x00010014, 0x00810004, 0x00810014,
|
||||
0x00000204, 0x00000214, 0x00800204, 0x00800214,
|
||||
0x00010204, 0x00010214, 0x00810204, 0x00810214,
|
||||
0x00100004, 0x00100014, 0x00900004, 0x00900014,
|
||||
0x00110004, 0x00110014, 0x00910004, 0x00910014,
|
||||
0x00100204, 0x00100214, 0x00900204, 0x00900214,
|
||||
0x00000000, 0x00000010, 0x00800000, 0x00800010,
|
||||
0x00010000, 0x00010010, 0x00810000, 0x00810010,
|
||||
0x00000200, 0x00000210, 0x00800200, 0x00800210,
|
||||
0x00010200, 0x00010210, 0x00810200, 0x00810210,
|
||||
0x00100000, 0x00100010, 0x00900000, 0x00900010,
|
||||
0x00110000, 0x00110010, 0x00910000, 0x00910010,
|
||||
0x00100200, 0x00100210, 0x00900200, 0x00900210,
|
||||
0x00110200, 0x00110210, 0x00910200, 0x00910210,
|
||||
0x00000004, 0x00000014, 0x00800004, 0x00800014,
|
||||
0x00010004, 0x00010014, 0x00810004, 0x00810014,
|
||||
0x00000204, 0x00000214, 0x00800204, 0x00800214,
|
||||
0x00010204, 0x00010214, 0x00810204, 0x00810214,
|
||||
0x00100004, 0x00100014, 0x00900004, 0x00900014,
|
||||
0x00110004, 0x00110014, 0x00910004, 0x00910014,
|
||||
0x00100204, 0x00100214, 0x00900204, 0x00900214,
|
||||
0x00110204, 0x00110214, 0x00910204, 0x00910214
|
||||
};
|
||||
/* pc2_d_3 bit pattern 41 38 47 33 40 42 */
|
||||
static int pc2_d_3[64] = {
|
||||
0x00000000, 0x00000400, 0x00001000, 0x00001400,
|
||||
0x00080000, 0x00080400, 0x00081000, 0x00081400,
|
||||
0x00000020, 0x00000420, 0x00001020, 0x00001420,
|
||||
0x00080020, 0x00080420, 0x00081020, 0x00081420,
|
||||
0x00004000, 0x00004400, 0x00005000, 0x00005400,
|
||||
0x00084000, 0x00084400, 0x00085000, 0x00085400,
|
||||
0x00004020, 0x00004420, 0x00005020, 0x00005420,
|
||||
0x00084020, 0x00084420, 0x00085020, 0x00085420,
|
||||
0x00000800, 0x00000c00, 0x00001800, 0x00001c00,
|
||||
0x00080800, 0x00080c00, 0x00081800, 0x00081c00,
|
||||
0x00000820, 0x00000c20, 0x00001820, 0x00001c20,
|
||||
0x00080820, 0x00080c20, 0x00081820, 0x00081c20,
|
||||
0x00004800, 0x00004c00, 0x00005800, 0x00005c00,
|
||||
0x00084800, 0x00084c00, 0x00085800, 0x00085c00,
|
||||
0x00004820, 0x00004c20, 0x00005820, 0x00005c20,
|
||||
0x00000000, 0x00000400, 0x00001000, 0x00001400,
|
||||
0x00080000, 0x00080400, 0x00081000, 0x00081400,
|
||||
0x00000020, 0x00000420, 0x00001020, 0x00001420,
|
||||
0x00080020, 0x00080420, 0x00081020, 0x00081420,
|
||||
0x00004000, 0x00004400, 0x00005000, 0x00005400,
|
||||
0x00084000, 0x00084400, 0x00085000, 0x00085400,
|
||||
0x00004020, 0x00004420, 0x00005020, 0x00005420,
|
||||
0x00084020, 0x00084420, 0x00085020, 0x00085420,
|
||||
0x00000800, 0x00000c00, 0x00001800, 0x00001c00,
|
||||
0x00080800, 0x00080c00, 0x00081800, 0x00081c00,
|
||||
0x00000820, 0x00000c20, 0x00001820, 0x00001c20,
|
||||
0x00080820, 0x00080c20, 0x00081820, 0x00081c20,
|
||||
0x00004800, 0x00004c00, 0x00005800, 0x00005c00,
|
||||
0x00084800, 0x00084c00, 0x00085800, 0x00085c00,
|
||||
0x00004820, 0x00004c20, 0x00005820, 0x00005c20,
|
||||
0x00084820, 0x00084c20, 0x00085820, 0x00085c20
|
||||
};
|
||||
/* pc2_d_4 bit pattern 49 37 30 46 34 44 */
|
||||
static int pc2_d_4[64] = {
|
||||
0x00000000, 0x00000100, 0x00040000, 0x00040100,
|
||||
0x00000040, 0x00000140, 0x00040040, 0x00040140,
|
||||
0x00400000, 0x00400100, 0x00440000, 0x00440100,
|
||||
0x00400040, 0x00400140, 0x00440040, 0x00440140,
|
||||
0x00008000, 0x00008100, 0x00048000, 0x00048100,
|
||||
0x00008040, 0x00008140, 0x00048040, 0x00048140,
|
||||
0x00408000, 0x00408100, 0x00448000, 0x00448100,
|
||||
0x00408040, 0x00408140, 0x00448040, 0x00448140,
|
||||
0x00000008, 0x00000108, 0x00040008, 0x00040108,
|
||||
0x00000048, 0x00000148, 0x00040048, 0x00040148,
|
||||
0x00400008, 0x00400108, 0x00440008, 0x00440108,
|
||||
0x00400048, 0x00400148, 0x00440048, 0x00440148,
|
||||
0x00008008, 0x00008108, 0x00048008, 0x00048108,
|
||||
0x00008048, 0x00008148, 0x00048048, 0x00048148,
|
||||
0x00408008, 0x00408108, 0x00448008, 0x00448108,
|
||||
0x00000000, 0x00000100, 0x00040000, 0x00040100,
|
||||
0x00000040, 0x00000140, 0x00040040, 0x00040140,
|
||||
0x00400000, 0x00400100, 0x00440000, 0x00440100,
|
||||
0x00400040, 0x00400140, 0x00440040, 0x00440140,
|
||||
0x00008000, 0x00008100, 0x00048000, 0x00048100,
|
||||
0x00008040, 0x00008140, 0x00048040, 0x00048140,
|
||||
0x00408000, 0x00408100, 0x00448000, 0x00448100,
|
||||
0x00408040, 0x00408140, 0x00448040, 0x00448140,
|
||||
0x00000008, 0x00000108, 0x00040008, 0x00040108,
|
||||
0x00000048, 0x00000148, 0x00040048, 0x00040148,
|
||||
0x00400008, 0x00400108, 0x00440008, 0x00440108,
|
||||
0x00400048, 0x00400148, 0x00440048, 0x00440148,
|
||||
0x00008008, 0x00008108, 0x00048008, 0x00048108,
|
||||
0x00008048, 0x00008148, 0x00048048, 0x00048148,
|
||||
0x00408008, 0x00408108, 0x00448008, 0x00448108,
|
||||
0x00408048, 0x00408148, 0x00448048, 0x00448148
|
||||
};
|
||||
static unsigned char odd_parity[256] = {
|
||||
static unsigned char odd_parity[256] = {
|
||||
1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14,
|
||||
16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31,
|
||||
32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47,
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -243,7 +243,7 @@ DES_set_key_unchecked(DES_cblock *key, DES_key_schedule *ks)
|
||||
| (pc1_c_4[(t2 >> (4 + 8 + 8 )) & 0xf] << 1)
|
||||
| (pc1_c_4[(t2 >> (4 + 8 + 8 + 8)) & 0xf] << 0);
|
||||
|
||||
|
||||
|
||||
d = (pc1_d_3[(t2 >> (1 )) & 0x7] << 3)
|
||||
| (pc1_d_3[(t2 >> (1 + 8 )) & 0x7] << 2)
|
||||
| (pc1_d_3[(t2 >> (1 + 8 + 8 )) & 0x7] << 1)
|
||||
@@ -549,7 +549,7 @@ DES_pcbc_encrypt(const void *in, void *out, long length,
|
||||
*/
|
||||
|
||||
static void
|
||||
_des3_encrypt(uint32_t u[2], DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||
_des3_encrypt(uint32_t u[2], DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3, int encp)
|
||||
{
|
||||
IP(u);
|
||||
@@ -613,7 +613,7 @@ DES_ecb3_encrypt(DES_cblock *input,
|
||||
|
||||
void
|
||||
DES_ede3_cbc_encrypt(const void *in, void *out,
|
||||
long length, DES_key_schedule *ks1,
|
||||
long length, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||
DES_cblock *iv, int encp)
|
||||
{
|
||||
@@ -691,7 +691,7 @@ DES_ede3_cbc_encrypt(const void *in, void *out,
|
||||
*/
|
||||
|
||||
void
|
||||
DES_cfb64_encrypt(const void *in, void *out,
|
||||
DES_cfb64_encrypt(const void *in, void *out,
|
||||
long length, DES_key_schedule *ks, DES_cblock *iv,
|
||||
int *num, int encp)
|
||||
{
|
||||
@@ -901,9 +901,9 @@ _DES_ipfp_test(void)
|
||||
store(u, k2);
|
||||
if (memcmp(k, k2, 8) != 0)
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
/* D3DES (V5.09) -
|
||||
/* D3DES (V5.09) -
|
||||
*
|
||||
* A portable, public domain, version of the Data Encryption Standard.
|
||||
*
|
||||
@@ -911,7 +911,7 @@ _DES_ipfp_test(void)
|
||||
* Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
|
||||
* code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
|
||||
* Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
|
||||
* for humouring me on.
|
||||
* for humouring me on.
|
||||
*
|
||||
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
|
||||
* (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -123,8 +123,8 @@ void DES_pcbc_encrypt(const void *, void *, long,
|
||||
DES_key_schedule *, DES_cblock *, int);
|
||||
void DES_cbc_encrypt(const void *, void *, long,
|
||||
DES_key_schedule *, DES_cblock *, int);
|
||||
void DES_ede3_cbc_encrypt(const void *, void *, long,
|
||||
DES_key_schedule *, DES_key_schedule *,
|
||||
void DES_ede3_cbc_encrypt(const void *, void *, long,
|
||||
DES_key_schedule *, DES_key_schedule *,
|
||||
DES_key_schedule *, DES_cblock *, int);
|
||||
void DES_cfb64_encrypt(const void *, void *, long,
|
||||
DES_key_schedule *, DES_cblock *, int *, int);
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -73,7 +73,7 @@ ecb_test(char key[8], char in[8], char out[8])
|
||||
static void
|
||||
ebc3_test(char key1[8], char key2[8], char key3[8], char in[8], char out[8])
|
||||
{
|
||||
unsigned char k1[8], k2[8], k3[8],
|
||||
unsigned char k1[8], k2[8], k3[8],
|
||||
indata[8], outdata[8], outdata2[8], ansdata[8];
|
||||
DES_key_schedule s1, s2, s3;
|
||||
|
||||
@@ -99,7 +99,7 @@ ebc3_test(char key1[8], char key2[8], char key3[8], char in[8], char out[8])
|
||||
static void
|
||||
cbc_test(char key1[8], char iv[8], char in[24], char out[24])
|
||||
{
|
||||
unsigned char k1[8],
|
||||
unsigned char k1[8],
|
||||
indata[24], outdata[24], outdata2[24], ansdata[24];
|
||||
DES_key_schedule s1;
|
||||
DES_cblock ivdata;
|
||||
@@ -121,7 +121,7 @@ cbc_test(char key1[8], char iv[8], char in[24], char out[24])
|
||||
static void
|
||||
cfb64_test(char key1[8], char iv[8], char in[23], char out[23])
|
||||
{
|
||||
unsigned char k1[8],
|
||||
unsigned char k1[8],
|
||||
indata[23], outdata[23], outdata2[23], ansdata[23];
|
||||
DES_key_schedule s1;
|
||||
DES_cblock ivdata;
|
||||
@@ -145,7 +145,7 @@ cfb64_test(char key1[8], char iv[8], char in[23], char out[23])
|
||||
}
|
||||
|
||||
static void
|
||||
cbc3_test(char key1[8], char key2[8], char key3[8],
|
||||
cbc3_test(char key1[8], char key2[8], char key3[8],
|
||||
char iv[8], char in[24], char out[24])
|
||||
{
|
||||
unsigned char k1[8], k2[8], k3[8],
|
||||
@@ -181,7 +181,7 @@ cbc3_test(char key1[8], char key2[8], char key3[8],
|
||||
static void
|
||||
pcbc_test(char key1[8], char iv[8], char in[24], char out[24])
|
||||
{
|
||||
unsigned char k1[8],
|
||||
unsigned char k1[8],
|
||||
indata[24], outdata[24], outdata2[24], ansdata[24];
|
||||
DES_key_schedule s1;
|
||||
DES_cblock ivdata;
|
||||
@@ -201,7 +201,7 @@ pcbc_test(char key1[8], char iv[8], char in[24], char out[24])
|
||||
}
|
||||
|
||||
static void
|
||||
cbc_cksum(char key1[8], char iv[8], char *in, size_t len,
|
||||
cbc_cksum(char key1[8], char iv[8], char *in, size_t len,
|
||||
uint32_t ret, char out[8])
|
||||
{
|
||||
unsigned char k1[8], indata[24], ansdata[8];
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -156,7 +156,7 @@ dh_generate_key(DH *dh)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
dh_compute_key(unsigned char *shared, const BIGNUM * pub, DH *dh)
|
||||
{
|
||||
mpz_t s, priv_key, p, peer_pub;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -72,7 +72,7 @@ DH_new(void)
|
||||
* Create a new DH object from the given engine, if the NULL is used,
|
||||
* the default engine is used. Free the DH object with DH_free().
|
||||
*
|
||||
* @param engine The engine to use to allocate the DH object.
|
||||
* @param engine The engine to use to allocate the DH object.
|
||||
*
|
||||
* @return a newly allocated DH object.
|
||||
*
|
||||
@@ -149,7 +149,7 @@ DH_free(DH *dh)
|
||||
|
||||
memset(dh, 0, sizeof(*dh));
|
||||
free(dh);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a reference to the DH object. The object should be free with
|
||||
@@ -159,7 +159,7 @@ DH_free(DH *dh)
|
||||
*
|
||||
* @return the updated reference count, can't safely be used except
|
||||
* for debug printing.
|
||||
*
|
||||
*
|
||||
* @ingroup hcrypto_dh
|
||||
*/
|
||||
|
||||
@@ -265,7 +265,7 @@ DH_check_pubkey(const DH *dh, const BIGNUM *pub_key, int *codes)
|
||||
|
||||
/**
|
||||
* Checks that the function performs are:
|
||||
* - pub_key is not negative
|
||||
* - pub_key is not negative
|
||||
*/
|
||||
|
||||
if (BN_is_negative(pub_key))
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -39,7 +39,7 @@ RCSID("$Id$");
|
||||
#include <Windows.h>
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain (HANDLE hInst,
|
||||
DllMain (HANDLE hInst,
|
||||
ULONG reason,
|
||||
LPVOID lpReserved)
|
||||
{
|
||||
|
@@ -1,38 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*! @mainpage Heimdal crypto library
|
||||
@@ -45,7 +45,7 @@
|
||||
*
|
||||
* hcrypto provies a OpenSSL compatible interface libcrypto interface
|
||||
* and is licensed under a 3 clause BSD license (GPL compatible).
|
||||
*
|
||||
*
|
||||
* The project web page: http://www.h5l.org/
|
||||
*
|
||||
* Sections of this manual:
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -209,7 +209,7 @@ add_engine(ENGINE *engine)
|
||||
return 1;
|
||||
engines = d;
|
||||
engines[num_engines++] = engine;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ ENGINE_load_builtin_engines(void)
|
||||
return;
|
||||
|
||||
ENGINE_set_id(engine, "builtin");
|
||||
ENGINE_set_name(engine,
|
||||
ENGINE_set_name(engine,
|
||||
"Heimdal crypto builtin engine version " PACKAGE_VERSION);
|
||||
ENGINE_set_RSA(engine, RSA_imath_method());
|
||||
ENGINE_set_DH(engine, DH_imath_method());
|
||||
@@ -269,7 +269,7 @@ ENGINE_by_dso(const char *path, const char *id)
|
||||
dlclose(handle);
|
||||
free(engine);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@@ -287,7 +287,7 @@ ENGINE_by_dso(const char *path, const char *id)
|
||||
dlclose(handle);
|
||||
free(engine);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ENGINE_up_ref(engine);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -212,7 +212,7 @@ _hc_EVP_hcrypto_aes_128_cts(void)
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
return &aes_128_cts;
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ _hc_EVP_hcrypto_aes_192_cts(void)
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
return &aes_192_cts;
|
||||
}
|
||||
|
||||
@@ -272,6 +272,6 @@ _hc_EVP_hcrypto_aes_256_cts(void)
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
return &aes_256_cts;
|
||||
}
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/* Windows crypto provider plugin, sample */
|
||||
@@ -104,7 +104,7 @@ import_key(int alg, const unsigned char *key, size_t keylen)
|
||||
BYTE key[1];
|
||||
} *key_blob;
|
||||
size_t bloblen = sizeof(*key_blob) - 1 + keylen;
|
||||
|
||||
|
||||
key_blob = malloc(bloblen);
|
||||
|
||||
key_blob->hdr.bType = PLAINTEXTKEYBLOB;
|
||||
@@ -133,7 +133,7 @@ crypto_des_ede3_cbc_init(EVP_CIPHER_CTX *ctx,
|
||||
DWORD paramData;
|
||||
|
||||
gk->hKey = import_key(CALG_3DES,
|
||||
key->key->keyvalue.data,
|
||||
key->key->keyvalue.data,
|
||||
key->key->keyvalue.len);
|
||||
|
||||
return 1;
|
||||
@@ -192,7 +192,7 @@ generic_hash_update (struct generic_hash *m, const void *p, size_t len)
|
||||
_ASSERT(bResult);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
generic_hash_final (void *res, struct generic_hash *m);
|
||||
{
|
||||
DWORD length;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2008 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -113,7 +113,7 @@ EVP_hcrypto_aes_128_cbc(void)
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
return &aes_128_cbc;
|
||||
}
|
||||
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -72,7 +72,7 @@ RCSID("$Id$");
|
||||
* example_evp_cipher.c .
|
||||
*
|
||||
* @example example_evp_cipher.c
|
||||
*
|
||||
*
|
||||
* This is an example how to use EVP_CipherInit_ex(),
|
||||
* EVP_CipherUpdate() and EVP_CipherFinal_ex().
|
||||
*/
|
||||
@@ -318,7 +318,7 @@ EVP_DigestFinal_ex(EVP_MD_CTX *ctx, void *hash, unsigned int *size)
|
||||
*/
|
||||
|
||||
int
|
||||
EVP_Digest(const void *data, size_t dsize, void *hash, unsigned int *hsize,
|
||||
EVP_Digest(const void *data, size_t dsize, void *hash, unsigned int *hsize,
|
||||
const EVP_MD *md, ENGINE *engine)
|
||||
{
|
||||
EVP_MD_CTX *ctx;
|
||||
@@ -832,7 +832,7 @@ EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, void *out, int *outlen,
|
||||
void *in, size_t inlen)
|
||||
{
|
||||
int ret, left, blocksize;
|
||||
|
||||
|
||||
*outlen = 0;
|
||||
|
||||
/**
|
||||
@@ -1549,7 +1549,7 @@ EVP_get_cipherbyname(const char *name)
|
||||
|
||||
int
|
||||
EVP_BytesToKey(const EVP_CIPHER *type,
|
||||
const EVP_MD *md,
|
||||
const EVP_MD *md,
|
||||
const void *salt,
|
||||
const void *data, size_t datalen,
|
||||
unsigned int count,
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2005 - 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -250,7 +250,7 @@ int HC_DEPRECATED EVP_MD_CTX_cleanup(EVP_MD_CTX *);
|
||||
int EVP_DigestInit_ex(EVP_MD_CTX *, const EVP_MD *, ENGINE *);
|
||||
int EVP_DigestUpdate(EVP_MD_CTX *,const void *, size_t);
|
||||
int EVP_DigestFinal_ex(EVP_MD_CTX *, void *, unsigned int *);
|
||||
int EVP_Digest(const void *, size_t, void *, unsigned int *,
|
||||
int EVP_Digest(const void *, size_t, void *, unsigned int *,
|
||||
const EVP_MD *, ENGINE *);
|
||||
/*
|
||||
*
|
||||
@@ -289,7 +289,7 @@ int EVP_Cipher(EVP_CIPHER_CTX *,void *,const void *,size_t);
|
||||
int PKCS5_PBKDF2_HMAC_SHA1(const void *, size_t, const void *, size_t,
|
||||
unsigned long, size_t, void *);
|
||||
|
||||
int EVP_BytesToKey(const EVP_CIPHER *, const EVP_MD *,
|
||||
int EVP_BytesToKey(const EVP_CIPHER *, const EVP_MD *,
|
||||
const void *, const void *, size_t,
|
||||
unsigned int, void *, void *);
|
||||
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2008 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -67,7 +67,7 @@ main(int argc, char **argv)
|
||||
FILE *in, *out;
|
||||
void *ibuf, *obuf;
|
||||
int ilen, olen;
|
||||
size_t block_size;
|
||||
size_t block_size;
|
||||
const EVP_CIPHER *c = EVP_aes_128_cbc();
|
||||
EVP_CIPHER_CTX ctx;
|
||||
int ret;
|
||||
@@ -97,14 +97,14 @@ main(int argc, char **argv)
|
||||
out = fopen(ofn, "w+");
|
||||
if (out == NULL)
|
||||
errx(1, "failed to open output file");
|
||||
|
||||
|
||||
/* Check that key and ivec are long enough */
|
||||
assert(EVP_CIPHER_key_length(c) <= sizeof(key));
|
||||
assert(EVP_CIPHER_iv_length(c) <= sizeof(ivec));
|
||||
|
||||
/*
|
||||
/*
|
||||
* Allocate buffer, the output buffer is at least
|
||||
* EVP_CIPHER_block_size() longer
|
||||
* EVP_CIPHER_block_size() longer
|
||||
*/
|
||||
ibuf = malloc(block_size);
|
||||
obuf = malloc(block_size + EVP_CIPHER_block_size(c));
|
||||
@@ -139,6 +139,6 @@ main(int argc, char **argv)
|
||||
/* write the last bytes out and close */
|
||||
fwrite(obuf, 1, olen, out);
|
||||
fclose(out);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 KTH nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -147,7 +147,7 @@ HMAC_Final(HMAC_CTX *ctx, void *md, unsigned int *len)
|
||||
void *
|
||||
HMAC(const EVP_MD *md,
|
||||
const void *key, size_t key_size,
|
||||
const void *data, size_t data_size,
|
||||
const void *data, size_t data_size,
|
||||
void *hash, unsigned int *hash_len)
|
||||
{
|
||||
HMAC_CTX ctx;
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -72,7 +72,7 @@ static const char *s_error_msg[] = {
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* Argument checking macros
|
||||
/* Argument checking macros
|
||||
Use CHECK() where a return value is required; NRCHECK() elsewhere */
|
||||
#define CHECK(TEST) assert(TEST)
|
||||
#define NRCHECK(TEST) assert(TEST)
|
||||
@@ -212,7 +212,7 @@ static int s_vcmp(mp_int a, mp_small v);
|
||||
|
||||
/* Unsigned magnitude addition; assumes dc is big enough.
|
||||
Carry out is returned (no memory allocated). */
|
||||
static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc,
|
||||
static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc,
|
||||
mp_size size_a, mp_size size_b);
|
||||
|
||||
/* Unsigned magnitude subtraction. Assumes dc is big enough. */
|
||||
@@ -243,7 +243,7 @@ static void s_dmul(mp_int a, mp_digit b);
|
||||
static void s_dbmul(mp_digit *da, mp_digit b, mp_digit *dc,
|
||||
mp_size size_a);
|
||||
|
||||
/* Single digit division. Replaces a with the quotient,
|
||||
/* Single digit division. Replaces a with the quotient,
|
||||
returns the remainder. */
|
||||
static mp_digit s_ddiv(mp_int a, mp_digit b);
|
||||
|
||||
@@ -253,7 +253,7 @@ static void s_qdiv(mp_int z, mp_size p2);
|
||||
/* Quick remainder by a power of 2, replaces z (no allocation) */
|
||||
static void s_qmod(mp_int z, mp_size p2);
|
||||
|
||||
/* Quick multiplication by a power of 2, replaces z.
|
||||
/* Quick multiplication by a power of 2, replaces z.
|
||||
Allocates if necessary; returns false in case this fails. */
|
||||
static int s_qmul(mp_int z, mp_size p2);
|
||||
|
||||
@@ -296,7 +296,7 @@ static int s_outlen(mp_int z, mp_size r);
|
||||
guaranteed to be no smaller than the actual number required. */
|
||||
static mp_size s_inlen(int len, mp_size r);
|
||||
|
||||
/* Convert a character to a digit value in radix r, or
|
||||
/* Convert a character to a digit value in radix r, or
|
||||
-1 if out of range */
|
||||
static int s_ch2val(char c, int r);
|
||||
|
||||
@@ -340,8 +340,8 @@ mp_result mp_int_init(mp_int z)
|
||||
mp_int mp_int_alloc(void)
|
||||
{
|
||||
mp_int out = malloc(sizeof(mpz_t));
|
||||
|
||||
if(out != NULL)
|
||||
|
||||
if(out != NULL)
|
||||
mp_int_init(out);
|
||||
|
||||
return out;
|
||||
@@ -357,11 +357,11 @@ mp_result mp_int_init_size(mp_int z, mp_size prec)
|
||||
|
||||
if(prec == 0)
|
||||
prec = default_precision;
|
||||
else if(prec == 1)
|
||||
else if(prec == 1)
|
||||
return mp_int_init(z);
|
||||
else
|
||||
else
|
||||
prec = (mp_size) ROUND_PREC(prec);
|
||||
|
||||
|
||||
if((MP_DIGITS(z) = s_alloc(prec)) == NULL)
|
||||
return MP_MEMORY;
|
||||
|
||||
@@ -369,7 +369,7 @@ mp_result mp_int_init_size(mp_int z, mp_size prec)
|
||||
MP_USED(z) = 1;
|
||||
MP_ALLOC(z) = prec;
|
||||
MP_SIGN(z) = MP_ZPOS;
|
||||
|
||||
|
||||
return MP_OK;
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ mp_result mp_int_neg(mp_int a, mp_int c)
|
||||
/* {{{ mp_int_add(a, b, c) */
|
||||
|
||||
mp_result mp_int_add(mp_int a, mp_int b, mp_int c)
|
||||
{
|
||||
{
|
||||
mp_size ua, ub, uc, max;
|
||||
|
||||
CHECK(a != NULL && b != NULL && c != NULL);
|
||||
@@ -579,7 +579,7 @@ mp_result mp_int_add(mp_int a, mp_int b, mp_int c)
|
||||
MP_USED(c) = uc;
|
||||
MP_SIGN(c) = MP_SIGN(a);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Different signs -- subtract magnitudes, preserve sign of greater */
|
||||
mp_int x, y;
|
||||
@@ -606,7 +606,7 @@ mp_result mp_int_add(mp_int a, mp_int b, mp_int c)
|
||||
s_usub(MP_DIGITS(x), MP_DIGITS(y), MP_DIGITS(c), MP_USED(x), MP_USED(y));
|
||||
MP_USED(c) = MP_USED(x);
|
||||
CLAMP(c);
|
||||
|
||||
|
||||
/* Give result the sign of the larger */
|
||||
MP_SIGN(c) = MP_SIGN(x);
|
||||
}
|
||||
@@ -662,7 +662,7 @@ mp_result mp_int_sub(mp_int a, mp_int b, mp_int c)
|
||||
MP_USED(c) = uc;
|
||||
MP_SIGN(c) = MP_SIGN(a);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Same signs -- subtract magnitudes */
|
||||
mp_int x, y;
|
||||
@@ -674,7 +674,7 @@ mp_result mp_int_sub(mp_int a, mp_int b, mp_int c)
|
||||
|
||||
if(cmp >= 0) {
|
||||
x = a; y = b; osign = MP_ZPOS;
|
||||
}
|
||||
}
|
||||
else {
|
||||
x = b; y = a; osign = MP_NEG;
|
||||
}
|
||||
@@ -711,7 +711,7 @@ mp_result mp_int_sub_value(mp_int a, mp_small value, mp_int c)
|
||||
/* {{{ mp_int_mul(a, b, c) */
|
||||
|
||||
mp_result mp_int_mul(mp_int a, mp_int b, mp_int c)
|
||||
{
|
||||
{
|
||||
mp_digit *out;
|
||||
mp_size osize, ua, ub, p = 0;
|
||||
mp_sign osign;
|
||||
@@ -723,7 +723,7 @@ mp_result mp_int_mul(mp_int a, mp_int b, mp_int c)
|
||||
mp_int_zero(c);
|
||||
return MP_OK;
|
||||
}
|
||||
|
||||
|
||||
/* Output is positive if inputs have same sign, otherwise negative */
|
||||
osign = (MP_SIGN(a) == MP_SIGN(b)) ? MP_ZPOS : MP_NEG;
|
||||
|
||||
@@ -739,11 +739,11 @@ mp_result mp_int_mul(mp_int a, mp_int b, mp_int c)
|
||||
|
||||
if((out = s_alloc(p)) == NULL)
|
||||
return MP_MEMORY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!s_pad(c, osize))
|
||||
return MP_MEMORY;
|
||||
|
||||
|
||||
out = MP_DIGITS(c);
|
||||
}
|
||||
ZERO(out, osize);
|
||||
@@ -764,7 +764,7 @@ mp_result mp_int_mul(mp_int a, mp_int b, mp_int c)
|
||||
MP_USED(c) = osize; /* might not be true, but we'll fix it ... */
|
||||
CLAMP(c); /* ... right here */
|
||||
MP_SIGN(c) = osign;
|
||||
|
||||
|
||||
return MP_OK;
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ mp_result mp_int_mul_pow2(mp_int a, mp_small p2, mp_int c)
|
||||
/* {{{ mp_int_sqr(a, c) */
|
||||
|
||||
mp_result mp_int_sqr(mp_int a, mp_int c)
|
||||
{
|
||||
{
|
||||
mp_digit *out;
|
||||
mp_size osize, p = 0;
|
||||
|
||||
@@ -819,9 +819,9 @@ mp_result mp_int_sqr(mp_int a, mp_int c)
|
||||
|
||||
if((out = s_alloc(p)) == NULL)
|
||||
return MP_MEMORY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!s_pad(c, osize))
|
||||
if(!s_pad(c, osize))
|
||||
return MP_MEMORY;
|
||||
|
||||
out = MP_DIGITS(c);
|
||||
@@ -843,7 +843,7 @@ mp_result mp_int_sqr(mp_int a, mp_int c)
|
||||
MP_USED(c) = osize; /* might not be true, but we'll fix it ... */
|
||||
CLAMP(c); /* ... right here */
|
||||
MP_SIGN(c) = MP_ZPOS;
|
||||
|
||||
|
||||
return MP_OK;
|
||||
}
|
||||
|
||||
@@ -860,7 +860,7 @@ mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r)
|
||||
mp_sign sa = MP_SIGN(a), sb = MP_SIGN(b);
|
||||
|
||||
CHECK(a != NULL && b != NULL && q != r);
|
||||
|
||||
|
||||
if(CMPZ(b) == 0)
|
||||
return MP_UNDEF;
|
||||
else if((cmp = s_ucmp(a, b)) < 0) {
|
||||
@@ -874,7 +874,7 @@ mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r)
|
||||
mp_int_zero(q);
|
||||
|
||||
return MP_OK;
|
||||
}
|
||||
}
|
||||
else if(cmp == 0) {
|
||||
/* If |a| = |b|, no division is required:
|
||||
q = 1 or -1, r = 0
|
||||
@@ -891,19 +891,19 @@ mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r)
|
||||
}
|
||||
|
||||
return MP_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/* When |a| > |b|, real division is required. We need someplace to
|
||||
store quotient and remainder, but q and r are allowed to be NULL
|
||||
or to overlap with the inputs.
|
||||
*/
|
||||
if((lg = s_isp2(b)) < 0) {
|
||||
if(q && b != q) {
|
||||
if(q && b != q) {
|
||||
if((res = mp_int_copy(a, q)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
else
|
||||
qout = q;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qout = TEMP(last);
|
||||
SETUP(mp_int_init_copy(TEMP(last), a), last);
|
||||
@@ -914,14 +914,14 @@ mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r)
|
||||
goto CLEANUP;
|
||||
else
|
||||
rout = r;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rout = TEMP(last);
|
||||
SETUP(mp_int_init_copy(TEMP(last), b), last);
|
||||
}
|
||||
|
||||
if((res = s_udiv(qout, rout)) != MP_OK) goto CLEANUP;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(q && (res = mp_int_copy(a, q)) != MP_OK) goto CLEANUP;
|
||||
if(r && (res = mp_int_copy(a, r)) != MP_OK) goto CLEANUP;
|
||||
@@ -931,7 +931,7 @@ mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r)
|
||||
}
|
||||
|
||||
/* Recompute signs for output */
|
||||
if(rout) {
|
||||
if(rout) {
|
||||
MP_SIGN(rout) = sa;
|
||||
if(CMPZ(rout) == 0)
|
||||
MP_SIGN(rout) = MP_ZPOS;
|
||||
@@ -965,7 +965,7 @@ mp_result mp_int_mod(mp_int a, mp_int m, mp_int c)
|
||||
if(m == c) {
|
||||
mp_int_init(&tmp);
|
||||
out = &tmp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
out = c;
|
||||
}
|
||||
@@ -1021,7 +1021,7 @@ mp_result mp_int_div_pow2(mp_int a, mp_small p2, mp_int q, mp_int r)
|
||||
|
||||
if(q != NULL && (res = mp_int_copy(a, q)) == MP_OK)
|
||||
s_qdiv(q, (mp_size) p2);
|
||||
|
||||
|
||||
if(res == MP_OK && r != NULL && (res = mp_int_copy(a, r)) == MP_OK)
|
||||
s_qmod(r, (mp_size) p2);
|
||||
|
||||
@@ -1037,7 +1037,7 @@ mp_result mp_int_expt(mp_int a, mp_small b, mp_int c)
|
||||
mpz_t t;
|
||||
mp_result res;
|
||||
unsigned int v = abs(b);
|
||||
|
||||
|
||||
CHECK(b >= 0 && c != NULL);
|
||||
|
||||
if((res = mp_int_init_copy(&t, a)) != MP_OK)
|
||||
@@ -1056,7 +1056,7 @@ mp_result mp_int_expt(mp_int a, mp_small b, mp_int c)
|
||||
if((res = mp_int_sqr(&t, &t)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
|
||||
CLEANUP:
|
||||
mp_int_clear(&t);
|
||||
return res;
|
||||
@@ -1071,7 +1071,7 @@ mp_result mp_int_expt_value(mp_small a, mp_small b, mp_int c)
|
||||
mpz_t t;
|
||||
mp_result res;
|
||||
unsigned int v = abs(b);
|
||||
|
||||
|
||||
CHECK(b >= 0 && c != NULL);
|
||||
|
||||
if((res = mp_int_init_value(&t, a)) != MP_OK)
|
||||
@@ -1090,7 +1090,7 @@ mp_result mp_int_expt_value(mp_small a, mp_small b, mp_int c)
|
||||
if((res = mp_int_sqr(&t, &t)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
|
||||
CLEANUP:
|
||||
mp_int_clear(&t);
|
||||
return res;
|
||||
@@ -1101,7 +1101,7 @@ mp_result mp_int_expt_value(mp_small a, mp_small b, mp_int c)
|
||||
/* {{{ mp_int_compare(a, b) */
|
||||
|
||||
int mp_int_compare(mp_int a, mp_int b)
|
||||
{
|
||||
{
|
||||
mp_sign sa;
|
||||
|
||||
CHECK(a != NULL && b != NULL);
|
||||
@@ -1112,12 +1112,12 @@ int mp_int_compare(mp_int a, mp_int b)
|
||||
|
||||
/* If they're both zero or positive, the normal comparison
|
||||
applies; if both negative, the sense is reversed. */
|
||||
if(sa == MP_ZPOS)
|
||||
if(sa == MP_ZPOS)
|
||||
return cmp;
|
||||
else
|
||||
return -cmp;
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(sa == MP_ZPOS)
|
||||
return 1;
|
||||
@@ -1131,7 +1131,7 @@ int mp_int_compare(mp_int a, mp_int b)
|
||||
/* {{{ mp_int_compare_unsigned(a, b) */
|
||||
|
||||
int mp_int_compare_unsigned(mp_int a, mp_int b)
|
||||
{
|
||||
{
|
||||
NRCHECK(a != NULL && b != NULL);
|
||||
|
||||
return s_ucmp(a, b);
|
||||
@@ -1142,14 +1142,14 @@ int mp_int_compare_unsigned(mp_int a, mp_int b)
|
||||
/* {{{ mp_int_compare_zero(z) */
|
||||
|
||||
int mp_int_compare_zero(mp_int z)
|
||||
{
|
||||
{
|
||||
NRCHECK(z != NULL);
|
||||
|
||||
if(MP_USED(z) == 1 && z->digits[0] == 0)
|
||||
return 0;
|
||||
else if(MP_SIGN(z) == MP_ZPOS)
|
||||
return 1;
|
||||
else
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1171,7 +1171,7 @@ int mp_int_compare_value(mp_int z, mp_small value)
|
||||
return cmp;
|
||||
else
|
||||
return -cmp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(value < 0)
|
||||
return 1;
|
||||
@@ -1185,7 +1185,7 @@ int mp_int_compare_value(mp_int z, mp_small value)
|
||||
/* {{{ mp_int_exptmod(a, b, m, c) */
|
||||
|
||||
mp_result mp_int_exptmod(mp_int a, mp_int b, mp_int m, mp_int c)
|
||||
{
|
||||
{
|
||||
mp_result res;
|
||||
mp_size um;
|
||||
mpz_t temp[3];
|
||||
@@ -1207,11 +1207,11 @@ mp_result mp_int_exptmod(mp_int a, mp_int b, mp_int m, mp_int c)
|
||||
if(c == b || c == m) {
|
||||
SETUP(mp_int_init_size(TEMP(2), 2 * um), last);
|
||||
s = TEMP(2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
s = c;
|
||||
}
|
||||
|
||||
|
||||
if((res = mp_int_mod(a, m, TEMP(0))) != MP_OK) goto CLEANUP;
|
||||
|
||||
if((res = s_brmu(TEMP(1), m)) != MP_OK) goto CLEANUP;
|
||||
@@ -1283,11 +1283,11 @@ mp_result mp_int_exptmod_known(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c
|
||||
if(c == b || c == m) {
|
||||
SETUP(mp_int_init_size(TEMP(1), 2 * um), last);
|
||||
s = TEMP(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
s = c;
|
||||
}
|
||||
|
||||
|
||||
if((res = mp_int_mod(a, m, TEMP(0))) != MP_OK) goto CLEANUP;
|
||||
|
||||
if((res = s_embar(TEMP(0), b, m, mu, s)) != MP_OK)
|
||||
@@ -1334,7 +1334,7 @@ mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c)
|
||||
for(last = 0; last < 2; ++last)
|
||||
mp_int_init(TEMP(last));
|
||||
|
||||
if((res = mp_int_egcd(a, m, TEMP(0), TEMP(1), NULL)) != MP_OK)
|
||||
if((res = mp_int_egcd(a, m, TEMP(0), TEMP(1), NULL)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
|
||||
if(mp_int_compare_value(TEMP(0), 1) != 0) {
|
||||
@@ -1369,7 +1369,7 @@ mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c)
|
||||
|
||||
/* Binary GCD algorithm due to Josef Stein, 1961 */
|
||||
mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c)
|
||||
{
|
||||
{
|
||||
int ca, cb, k = 0;
|
||||
mpz_t u, v, t;
|
||||
mp_result res;
|
||||
@@ -1380,9 +1380,9 @@ mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c)
|
||||
cb = CMPZ(b);
|
||||
if(ca == 0 && cb == 0)
|
||||
return MP_UNDEF;
|
||||
else if(ca == 0)
|
||||
else if(ca == 0)
|
||||
return mp_int_abs(b, c);
|
||||
else if(cb == 0)
|
||||
else if(cb == 0)
|
||||
return mp_int_abs(a, c);
|
||||
|
||||
mp_int_init(&t);
|
||||
@@ -1395,16 +1395,16 @@ mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c)
|
||||
|
||||
{ /* Divide out common factors of 2 from u and v */
|
||||
int div2_u = s_dp2k(&u), div2_v = s_dp2k(&v);
|
||||
|
||||
|
||||
k = MIN(div2_u, div2_v);
|
||||
s_qdiv(&u, (mp_size) k);
|
||||
s_qdiv(&v, (mp_size) k);
|
||||
}
|
||||
|
||||
|
||||
if(mp_int_is_odd(&u)) {
|
||||
if((res = mp_int_neg(&v, &t)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if((res = mp_int_copy(&u, &t)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
@@ -1416,7 +1416,7 @@ mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c)
|
||||
if(CMPZ(&t) > 0) {
|
||||
if((res = mp_int_copy(&t, &u)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if((res = mp_int_neg(&t, &v)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
@@ -1427,13 +1427,13 @@ mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c)
|
||||
|
||||
if(CMPZ(&t) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if((res = mp_int_abs(&u, c)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
if(!s_qmul(c, (mp_size) k))
|
||||
res = MP_MEMORY;
|
||||
|
||||
|
||||
CLEANUP:
|
||||
mp_int_clear(&v);
|
||||
V: mp_int_clear(&u);
|
||||
@@ -1450,14 +1450,14 @@ mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c)
|
||||
of the elementary matrix operations as we go, so we can get values
|
||||
x and y satisfying c = ax + by.
|
||||
*/
|
||||
mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c,
|
||||
mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c,
|
||||
mp_int x, mp_int y)
|
||||
{
|
||||
{
|
||||
int k, last = 0, ca, cb;
|
||||
mpz_t temp[8];
|
||||
mp_result res;
|
||||
|
||||
CHECK(a != NULL && b != NULL && c != NULL &&
|
||||
|
||||
CHECK(a != NULL && b != NULL && c != NULL &&
|
||||
(x != NULL || y != NULL));
|
||||
|
||||
ca = CMPZ(a);
|
||||
@@ -1467,7 +1467,7 @@ mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c,
|
||||
else if(ca == 0) {
|
||||
if((res = mp_int_abs(b, c)) != MP_OK) return res;
|
||||
mp_int_zero(x); (void) mp_int_set_value(y, 1); return MP_OK;
|
||||
}
|
||||
}
|
||||
else if(cb == 0) {
|
||||
if((res = mp_int_abs(a, c)) != MP_OK) return res;
|
||||
(void) mp_int_set_value(x, 1); mp_int_zero(y); return MP_OK;
|
||||
@@ -1475,7 +1475,7 @@ mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c,
|
||||
|
||||
/* Initialize temporaries:
|
||||
A:0, B:1, C:2, D:3, u:4, v:5, ou:6, ov:7 */
|
||||
for(last = 0; last < 4; ++last)
|
||||
for(last = 0; last < 4; ++last)
|
||||
mp_int_init(TEMP(last));
|
||||
TEMP(0)->digits[0] = 1;
|
||||
TEMP(3)->digits[0] = 1;
|
||||
@@ -1489,7 +1489,7 @@ mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c,
|
||||
|
||||
{ /* Divide out common factors of 2 from u and v */
|
||||
int div2_u = s_dp2k(TEMP(4)), div2_v = s_dp2k(TEMP(5));
|
||||
|
||||
|
||||
k = MIN(div2_u, div2_v);
|
||||
s_qdiv(TEMP(4), k);
|
||||
s_qdiv(TEMP(5), k);
|
||||
@@ -1501,25 +1501,25 @@ mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c,
|
||||
for(;;) {
|
||||
while(mp_int_is_even(TEMP(4))) {
|
||||
s_qdiv(TEMP(4), 1);
|
||||
|
||||
|
||||
if(mp_int_is_odd(TEMP(0)) || mp_int_is_odd(TEMP(1))) {
|
||||
if((res = mp_int_add(TEMP(0), TEMP(7), TEMP(0))) != MP_OK)
|
||||
if((res = mp_int_add(TEMP(0), TEMP(7), TEMP(0))) != MP_OK)
|
||||
goto CLEANUP;
|
||||
if((res = mp_int_sub(TEMP(1), TEMP(6), TEMP(1))) != MP_OK)
|
||||
if((res = mp_int_sub(TEMP(1), TEMP(6), TEMP(1))) != MP_OK)
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
s_qdiv(TEMP(0), 1);
|
||||
s_qdiv(TEMP(1), 1);
|
||||
}
|
||||
|
||||
|
||||
while(mp_int_is_even(TEMP(5))) {
|
||||
s_qdiv(TEMP(5), 1);
|
||||
|
||||
if(mp_int_is_odd(TEMP(2)) || mp_int_is_odd(TEMP(3))) {
|
||||
if((res = mp_int_add(TEMP(2), TEMP(7), TEMP(2))) != MP_OK)
|
||||
if((res = mp_int_add(TEMP(2), TEMP(7), TEMP(2))) != MP_OK)
|
||||
goto CLEANUP;
|
||||
if((res = mp_int_sub(TEMP(3), TEMP(6), TEMP(3))) != MP_OK)
|
||||
if((res = mp_int_sub(TEMP(3), TEMP(6), TEMP(3))) != MP_OK)
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
@@ -1531,7 +1531,7 @@ mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c,
|
||||
if((res = mp_int_sub(TEMP(4), TEMP(5), TEMP(4))) != MP_OK) goto CLEANUP;
|
||||
if((res = mp_int_sub(TEMP(0), TEMP(2), TEMP(0))) != MP_OK) goto CLEANUP;
|
||||
if((res = mp_int_sub(TEMP(1), TEMP(3), TEMP(1))) != MP_OK) goto CLEANUP;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if((res = mp_int_sub(TEMP(5), TEMP(4), TEMP(5))) != MP_OK) goto CLEANUP;
|
||||
if((res = mp_int_sub(TEMP(2), TEMP(0), TEMP(2))) != MP_OK) goto CLEANUP;
|
||||
@@ -1546,7 +1546,7 @@ mp_result mp_int_egcd(mp_int a, mp_int b, mp_int c,
|
||||
res = MP_MEMORY;
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
|
||||
res = mp_int_copy(TEMP(5), c);
|
||||
}
|
||||
|
||||
@@ -1572,8 +1572,8 @@ mp_result mp_int_lcm(mp_int a, mp_int b, mp_int c)
|
||||
|
||||
CHECK(a != NULL && b != NULL && c != NULL);
|
||||
|
||||
/* Since a * b = gcd(a, b) * lcm(a, b), we can compute
|
||||
lcm(a, b) = (a / gcd(a, b)) * b.
|
||||
/* Since a * b = gcd(a, b) * lcm(a, b), we can compute
|
||||
lcm(a, b) = (a / gcd(a, b)) * b.
|
||||
|
||||
This formulation insures everything works even if the input
|
||||
variables share space.
|
||||
@@ -1681,7 +1681,7 @@ mp_result mp_int_root(mp_int a, mp_small b, mp_int c)
|
||||
if((res = mp_int_copy(TEMP(4), TEMP(1))) != MP_OK)
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
|
||||
if((res = mp_int_copy(TEMP(1), c)) != MP_OK)
|
||||
goto CLEANUP;
|
||||
|
||||
@@ -1693,7 +1693,7 @@ mp_result mp_int_root(mp_int a, mp_small b, mp_int c)
|
||||
while(--last >= 0)
|
||||
mp_int_clear(TEMP(last));
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -1714,10 +1714,10 @@ mp_result mp_int_to_int(mp_int z, mp_small *out)
|
||||
if((sz == MP_ZPOS && mp_int_compare_value(z, MP_SMALL_MAX) > 0) ||
|
||||
mp_int_compare_value(z, MP_SMALL_MIN) < 0)
|
||||
return MP_RANGE;
|
||||
|
||||
|
||||
uz = MP_USED(z);
|
||||
dz = MP_DIGITS(z) + uz - 1;
|
||||
|
||||
|
||||
while(uz > 0) {
|
||||
uv <<= MP_DIGIT_BIT/2;
|
||||
uv = (uv << (MP_DIGIT_BIT/2)) | *dz--;
|
||||
@@ -1740,26 +1740,26 @@ mp_result mp_int_to_uint(mp_int z, mp_usmall *out)
|
||||
mp_size uz;
|
||||
mp_digit *dz;
|
||||
mp_sign sz;
|
||||
|
||||
|
||||
CHECK(z != NULL);
|
||||
|
||||
/* Make sure the value is representable as an int */
|
||||
sz = MP_SIGN(z);
|
||||
if(!(sz == MP_ZPOS && mp_int_compare_value(z, UINT_MAX) <= 0))
|
||||
return MP_RANGE;
|
||||
|
||||
|
||||
uz = MP_USED(z);
|
||||
dz = MP_DIGITS(z) + uz - 1;
|
||||
|
||||
|
||||
while(uz > 0) {
|
||||
uv <<= MP_DIGIT_BIT/2;
|
||||
uv = (uv << (MP_DIGIT_BIT/2)) | *dz--;
|
||||
--uz;
|
||||
}
|
||||
|
||||
|
||||
if(out)
|
||||
*out = uv;
|
||||
|
||||
|
||||
return MP_OK;
|
||||
}
|
||||
|
||||
@@ -1767,7 +1767,7 @@ mp_result mp_int_to_uint(mp_int z, mp_usmall *out)
|
||||
|
||||
/* {{{ mp_int_to_string(z, radix, str, limit) */
|
||||
|
||||
mp_result mp_int_to_string(mp_int z, mp_size radix,
|
||||
mp_result mp_int_to_string(mp_int z, mp_size radix,
|
||||
char *str, int limit)
|
||||
{
|
||||
mp_result res;
|
||||
@@ -1780,7 +1780,7 @@ mp_result mp_int_to_string(mp_int z, mp_size radix,
|
||||
|
||||
if(CMPZ(z) == 0) {
|
||||
*str++ = s_val2ch(0, 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mpz_t tmp;
|
||||
char *h, *t;
|
||||
@@ -1828,7 +1828,7 @@ mp_result mp_int_to_string(mp_int z, mp_size radix,
|
||||
/* {{{ mp_int_string_len(z, radix) */
|
||||
|
||||
mp_result mp_int_string_len(mp_int z, mp_size radix)
|
||||
{
|
||||
{
|
||||
int len;
|
||||
|
||||
CHECK(z != NULL);
|
||||
@@ -1861,7 +1861,7 @@ mp_result mp_int_read_string(mp_int z, mp_size radix, const char *str)
|
||||
/* {{{ mp_int_read_cstring(z, radix, *str, **end) */
|
||||
|
||||
mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char *str, char **end)
|
||||
{
|
||||
{
|
||||
int ch;
|
||||
|
||||
CHECK(z != NULL && str != NULL);
|
||||
@@ -1887,7 +1887,7 @@ mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char *str, char **e
|
||||
}
|
||||
|
||||
/* Skip leading zeroes */
|
||||
while((ch = s_ch2val(*str, radix)) == 0)
|
||||
while((ch = s_ch2val(*str, radix)) == 0)
|
||||
++str;
|
||||
|
||||
/* Make sure there is enough space for the value */
|
||||
@@ -1901,20 +1901,20 @@ mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char *str, char **e
|
||||
s_dadd(z, (mp_digit)ch);
|
||||
++str;
|
||||
}
|
||||
|
||||
|
||||
CLAMP(z);
|
||||
|
||||
/* Override sign for zero, even if negative specified. */
|
||||
if(CMPZ(z) == 0)
|
||||
MP_SIGN(z) = MP_ZPOS;
|
||||
|
||||
|
||||
if(end != NULL)
|
||||
*end = (char *)str;
|
||||
|
||||
/* Return a truncation error if the string has unprocessed
|
||||
characters remaining, so the caller can tell if the whole string
|
||||
was done */
|
||||
if(*str != '\0')
|
||||
if(*str != '\0')
|
||||
return MP_TRUNC;
|
||||
else
|
||||
return MP_OK;
|
||||
@@ -1959,7 +1959,7 @@ mp_result mp_int_to_binary(mp_int z, unsigned char *buf, int limit)
|
||||
int limpos = limit;
|
||||
|
||||
CHECK(z != NULL && buf != NULL);
|
||||
|
||||
|
||||
res = s_tobin(z, buf, &limpos, PAD_FOR_2C);
|
||||
|
||||
if(MP_SIGN(z) == MP_NEG)
|
||||
@@ -1993,7 +1993,7 @@ mp_result mp_int_read_binary(mp_int z, unsigned char *buf, int len)
|
||||
MP_SIGN(z) = MP_NEG;
|
||||
s_2comp(buf, len);
|
||||
}
|
||||
|
||||
|
||||
dz = MP_DIGITS(z);
|
||||
for(tmp = buf, i = len; i > 0; --i, ++tmp) {
|
||||
s_qmul(z, (mp_size) CHAR_BIT);
|
||||
@@ -2182,7 +2182,7 @@ static int s_pad(mp_int z, mp_size min)
|
||||
}
|
||||
else if((tmp = s_realloc(MP_DIGITS(z), MP_ALLOC(z), nsize)) == NULL)
|
||||
return 0;
|
||||
|
||||
|
||||
MP_DIGITS(z) = tmp;
|
||||
MP_ALLOC(z) = nsize;
|
||||
}
|
||||
@@ -2230,7 +2230,7 @@ static int s_vpack(mp_small v, mp_digit t[])
|
||||
{
|
||||
mp_usmall uv = (mp_usmall) ((v < 0) ? -v : v);
|
||||
int ndig = 0;
|
||||
|
||||
|
||||
if(uv == 0)
|
||||
t[ndig++] = 0;
|
||||
else {
|
||||
@@ -2251,12 +2251,12 @@ static int s_vpack(mp_small v, mp_digit t[])
|
||||
static int s_ucmp(mp_int a, mp_int b)
|
||||
{
|
||||
mp_size ua = MP_USED(a), ub = MP_USED(b);
|
||||
|
||||
|
||||
if(ua > ub)
|
||||
return 1;
|
||||
else if(ub > ua)
|
||||
else if(ub > ua)
|
||||
return -1;
|
||||
else
|
||||
else
|
||||
return s_cdig(MP_DIGITS(a), MP_DIGITS(b), ua);
|
||||
}
|
||||
|
||||
@@ -2284,7 +2284,7 @@ static int s_vcmp(mp_int a, mp_small v)
|
||||
|
||||
/* {{{ s_uadd(da, db, dc, size_a, size_b) */
|
||||
|
||||
static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc,
|
||||
static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc,
|
||||
mp_size size_a, mp_size size_b)
|
||||
{
|
||||
mp_size pos;
|
||||
@@ -2340,7 +2340,7 @@ static void s_usub(mp_digit *da, mp_digit *db, mp_digit *dc,
|
||||
/* Finish the subtraction for remaining upper digits of da */
|
||||
for(/* */; pos < size_a; ++pos, ++da, ++dc) {
|
||||
w = ((mp_word)MP_DIGIT_MAX + 1 + /* MP_RADIX */
|
||||
(mp_word)*da) - w;
|
||||
(mp_word)*da) - w;
|
||||
|
||||
*dc = LOWER_HALF(w);
|
||||
w = (UPPER_HALF(w) == 0);
|
||||
@@ -2374,13 +2374,13 @@ static int s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc,
|
||||
Karatsuba algorithm to compute the product; otherwise use the
|
||||
normal multiplication algorithm
|
||||
*/
|
||||
if(multiply_threshold &&
|
||||
size_a >= multiply_threshold &&
|
||||
if(multiply_threshold &&
|
||||
size_a >= multiply_threshold &&
|
||||
size_b > bot_size) {
|
||||
|
||||
mp_digit *t1, *t2, *t3, carry;
|
||||
|
||||
mp_digit *a_top = da + bot_size;
|
||||
mp_digit *a_top = da + bot_size;
|
||||
mp_digit *b_top = db + bot_size;
|
||||
|
||||
mp_size at_size = size_a - bot_size;
|
||||
@@ -2389,7 +2389,7 @@ static int s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc,
|
||||
|
||||
/* Do a single allocation for all three temporary buffers needed;
|
||||
each buffer must be big enough to hold the product of two
|
||||
bottom halves, and one buffer needs space for the completed
|
||||
bottom halves, and one buffer needs space for the completed
|
||||
product; twice the space is plenty.
|
||||
*/
|
||||
if((t1 = s_alloc(4 * buf_size)) == NULL) return 0;
|
||||
@@ -2423,15 +2423,15 @@ static int s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc,
|
||||
/* Assemble the output value */
|
||||
COPY(t1, dc, buf_size);
|
||||
carry = s_uadd(t3, dc + bot_size, dc + bot_size,
|
||||
buf_size + 1, buf_size);
|
||||
buf_size + 1, buf_size);
|
||||
assert(carry == 0);
|
||||
|
||||
|
||||
carry = s_uadd(t2, dc + 2*bot_size, dc + 2*bot_size,
|
||||
buf_size, buf_size);
|
||||
buf_size, buf_size);
|
||||
assert(carry == 0);
|
||||
|
||||
|
||||
s_free(t1); /* note t2 and t3 are just internal pointers to t1 */
|
||||
}
|
||||
}
|
||||
else {
|
||||
s_umul(da, db, dc, size_a, size_b);
|
||||
}
|
||||
@@ -2517,7 +2517,7 @@ static int s_ksqr(mp_digit *da, mp_digit *dc, mp_size size_a)
|
||||
|
||||
s_free(t1); /* note that t2 and t2 are internal pointers only */
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
s_usqr(da, dc, size_a);
|
||||
}
|
||||
@@ -2571,7 +2571,7 @@ static void s_usqr(mp_digit *da, mp_digit *dc, mp_size size_a)
|
||||
}
|
||||
|
||||
w = w + *dct;
|
||||
*dct = (mp_digit)w;
|
||||
*dct = (mp_digit)w;
|
||||
while((w = UPPER_HALF(w)) != 0) {
|
||||
++dct; w = w + *dct;
|
||||
*dct = LOWER_HALF(w);
|
||||
@@ -2660,18 +2660,18 @@ static mp_digit s_ddiv(mp_int a, mp_digit b)
|
||||
mp_word w = 0, qdigit;
|
||||
mp_size ua = MP_USED(a);
|
||||
mp_digit *da = MP_DIGITS(a) + ua - 1;
|
||||
|
||||
|
||||
for(/* */; ua > 0; --ua, --da) {
|
||||
w = (w << MP_DIGIT_BIT) | *da;
|
||||
|
||||
if(w >= b) {
|
||||
qdigit = w / b;
|
||||
w = w % b;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qdigit = 0;
|
||||
}
|
||||
|
||||
|
||||
*da = (mp_digit)qdigit;
|
||||
}
|
||||
|
||||
@@ -2699,7 +2699,7 @@ static void s_qdiv(mp_int z, mp_size p2)
|
||||
|
||||
to = MP_DIGITS(z); from = to + ndig;
|
||||
|
||||
for(mark = ndig; mark < uz; ++mark)
|
||||
for(mark = ndig; mark < uz; ++mark)
|
||||
*to++ = *from++;
|
||||
|
||||
MP_USED(z) = uz - ndig;
|
||||
@@ -2755,7 +2755,7 @@ static int s_qmul(mp_int z, mp_size p2)
|
||||
if(p2 == 0)
|
||||
return 1;
|
||||
|
||||
uz = MP_USED(z);
|
||||
uz = MP_USED(z);
|
||||
need = p2 / MP_DIGIT_BIT; rest = p2 % MP_DIGIT_BIT;
|
||||
|
||||
/* Figure out if we need an extra digit at the top end; this occurs
|
||||
@@ -2790,7 +2790,7 @@ static int s_qmul(mp_int z, mp_size p2)
|
||||
d = 0;
|
||||
for(i = need, from = MP_DIGITS(z) + need; i < uz; ++i, ++from) {
|
||||
mp_digit save = *from;
|
||||
|
||||
|
||||
*from = (*from << rest) | (d >> (MP_DIGIT_BIT - rest));
|
||||
d = save;
|
||||
}
|
||||
@@ -2835,7 +2835,7 @@ static int s_qsub(mp_int z, mp_size p2)
|
||||
*zp = LOWER_HALF(w);
|
||||
|
||||
assert(UPPER_HALF(w) != 0); /* no borrow out should be possible */
|
||||
|
||||
|
||||
MP_SIGN(z) = MP_ZPOS;
|
||||
CLAMP(z);
|
||||
|
||||
@@ -2858,7 +2858,7 @@ static int s_dp2k(mp_int z)
|
||||
k += MP_DIGIT_BIT;
|
||||
++dp;
|
||||
}
|
||||
|
||||
|
||||
d = *dp;
|
||||
while((d & 1) == 0) {
|
||||
d >>= 1;
|
||||
@@ -3011,7 +3011,7 @@ static int s_reduce(mp_int x, mp_int m, mp_int mu, mp_int q1, mp_int q2)
|
||||
static mp_result s_embar(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c)
|
||||
{
|
||||
mp_digit *db, *dbt, umu, d;
|
||||
mpz_t temp[3];
|
||||
mpz_t temp[3];
|
||||
mp_result res;
|
||||
int last = 0;
|
||||
|
||||
@@ -3063,7 +3063,7 @@ static mp_result s_embar(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c)
|
||||
}
|
||||
mp_int_copy(TEMP(0), c);
|
||||
}
|
||||
|
||||
|
||||
d >>= 1;
|
||||
if(!d) break;
|
||||
|
||||
@@ -3077,7 +3077,7 @@ static mp_result s_embar(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c)
|
||||
CLEANUP:
|
||||
while(--last >= 0)
|
||||
mp_int_clear(TEMP(last));
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3121,16 +3121,16 @@ static mp_result s_udiv(mp_int a, mp_int b)
|
||||
if(s_ucmp(b, &r) > 0) {
|
||||
r.digits -= 1;
|
||||
r.used += 1;
|
||||
|
||||
if(++skip > 1 && qpos > 0)
|
||||
|
||||
if(++skip > 1 && qpos > 0)
|
||||
q.digits[qpos++] = 0;
|
||||
|
||||
|
||||
CLAMP(&r);
|
||||
}
|
||||
else {
|
||||
mp_word pfx = r.digits[r.used - 1];
|
||||
mp_word qdigit;
|
||||
|
||||
|
||||
if(r.used > 1 && pfx <= btop) {
|
||||
pfx <<= MP_DIGIT_BIT / 2;
|
||||
pfx <<= MP_DIGIT_BIT / 2;
|
||||
@@ -3144,17 +3144,17 @@ static mp_result s_udiv(mp_int a, mp_int b)
|
||||
else
|
||||
qdigit = 1;
|
||||
}
|
||||
|
||||
|
||||
s_dbmul(MP_DIGITS(b), (mp_digit) qdigit, t.digits, ub);
|
||||
t.used = ub + 1; CLAMP(&t);
|
||||
while(s_ucmp(&t, &r) > 0) {
|
||||
--qdigit;
|
||||
(void) mp_int_sub(&t, b, &t); /* cannot fail */
|
||||
}
|
||||
|
||||
|
||||
s_usub(r.digits, t.digits, r.digits, r.used, t.used);
|
||||
CLAMP(&r);
|
||||
|
||||
|
||||
q.digits[qpos++] = (mp_digit) qdigit;
|
||||
ZERO(t.digits, t.used);
|
||||
skip = 0;
|
||||
@@ -3170,10 +3170,10 @@ static mp_result s_udiv(mp_int a, mp_int b)
|
||||
CLAMP(a);
|
||||
if(k != 0)
|
||||
s_qdiv(a, k);
|
||||
|
||||
|
||||
mp_int_copy(a, b); /* ok: 0 <= r < b */
|
||||
mp_int_copy(&q, a); /* ok: q <= a */
|
||||
|
||||
|
||||
mp_int_clear(&t);
|
||||
CLEANUP:
|
||||
mp_int_clear(&q);
|
||||
@@ -3340,7 +3340,7 @@ void s_print_buf(char *tag, mp_digit *buf, mp_size num)
|
||||
|
||||
fprintf(stderr, "%s: ", tag);
|
||||
|
||||
for(i = num - 1; i >= 0; --i)
|
||||
for(i = num - 1; i >= 0; --i)
|
||||
fprintf(stderr, "%0*X", (int)(MP_DIGIT_BIT / 4), buf[i]);
|
||||
|
||||
fputc('\n', stderr);
|
||||
|
@@ -99,7 +99,7 @@ extern const mp_result MP_MINERR;
|
||||
|
||||
/* Values with fewer than this many significant digits use the
|
||||
standard multiplication algorithm; otherwise, a recursive algorithm
|
||||
is used. Choose a value to suit your platform.
|
||||
is used. Choose a value to suit your platform.
|
||||
*/
|
||||
#define MP_MULT_THRESH 22
|
||||
|
||||
@@ -157,14 +157,14 @@ int mp_int_is_pow2(mp_int z);
|
||||
|
||||
mp_result mp_int_exptmod(mp_int a, mp_int b, mp_int m,
|
||||
mp_int c); /* c = a^b (mod m) */
|
||||
mp_result mp_int_exptmod_evalue(mp_int a, mp_small value,
|
||||
mp_result mp_int_exptmod_evalue(mp_int a, mp_small value,
|
||||
mp_int m, mp_int c); /* c = a^v (mod m) */
|
||||
mp_result mp_int_exptmod_bvalue(mp_small value, mp_int b,
|
||||
mp_int m, mp_int c); /* c = v^b (mod m) */
|
||||
mp_result mp_int_exptmod_known(mp_int a, mp_int b,
|
||||
mp_int m, mp_int mu,
|
||||
mp_int c); /* c = a^b (mod m) */
|
||||
mp_result mp_int_redux_const(mp_int m, mp_int c);
|
||||
mp_result mp_int_redux_const(mp_int m, mp_int c);
|
||||
|
||||
mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c); /* c = 1/a (mod m) */
|
||||
|
||||
@@ -184,16 +184,16 @@ mp_result mp_int_to_uint(mp_int z, mp_usmall *out);
|
||||
|
||||
/* Convert to nul-terminated string with the specified radix, writing at
|
||||
most limit characters including the nul terminator */
|
||||
mp_result mp_int_to_string(mp_int z, mp_size radix,
|
||||
mp_result mp_int_to_string(mp_int z, mp_size radix,
|
||||
char *str, int limit);
|
||||
|
||||
/* Return the number of characters required to represent
|
||||
/* Return the number of characters required to represent
|
||||
z in the given radix. May over-estimate. */
|
||||
mp_result mp_int_string_len(mp_int z, mp_size radix);
|
||||
|
||||
/* Read zero-terminated string into z */
|
||||
mp_result mp_int_read_string(mp_int z, mp_size radix, const char *str);
|
||||
mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char *str,
|
||||
mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char *str,
|
||||
char **end);
|
||||
|
||||
/* Return the number of significant bits in z */
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -149,8 +149,8 @@ struct test md2_tests[] = {
|
||||
};
|
||||
|
||||
struct test md4_tests[] = {
|
||||
{"",
|
||||
{0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, 0xb7, 0x3c, 0x59,
|
||||
{"",
|
||||
{0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, 0xb7, 0x3c, 0x59,
|
||||
0xd7, 0xe0, 0xc0, 0x89, 0xc0}},
|
||||
{"a",
|
||||
{0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46, 0x24, 0x5e, 0x05,
|
||||
@@ -167,17 +167,17 @@ struct test md4_tests[] = {
|
||||
{NULL, { 0x0 }}};
|
||||
|
||||
struct test md5_tests[] = {
|
||||
{"", {0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e}},
|
||||
{"a", {0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61}},
|
||||
{"abc", {0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72}},
|
||||
{"message digest", {0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0}},
|
||||
{"abcdefghijklmnopqrstuvwxyz", {0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b}},
|
||||
{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", {0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f}},
|
||||
{"12345678901234567890123456789012345678901234567890123456789012345678901234567890", {0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a}},
|
||||
{"", {0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e}},
|
||||
{"a", {0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61}},
|
||||
{"abc", {0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72}},
|
||||
{"message digest", {0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0}},
|
||||
{"abcdefghijklmnopqrstuvwxyz", {0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b}},
|
||||
{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", {0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f}},
|
||||
{"12345678901234567890123456789012345678901234567890123456789012345678901234567890", {0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a}},
|
||||
{NULL, { 0x0 }}};
|
||||
|
||||
struct test sha1_tests[] = {
|
||||
{ "abc",
|
||||
{ "abc",
|
||||
{0xA9, 0x99, 0x3E, 0x36, 0x47, 0x06, 0x81, 0x6A,
|
||||
0xBA, 0x3E, 0x25, 0x71, 0x78, 0x50, 0xC2, 0x6C,
|
||||
0x9C, 0xD0, 0xD8, 0x9D}},
|
||||
@@ -186,16 +186,16 @@ struct test sha1_tests[] = {
|
||||
0xBA, 0xAE, 0x4A, 0xA1, 0xF9, 0x51, 0x29, 0xE5,
|
||||
0xE5, 0x46, 0x70, 0xF1}},
|
||||
{ ONE_MILLION_A,
|
||||
{0x34, 0xaa, 0x97, 0x3c, 0xd4, 0xc4, 0xda, 0xa4,
|
||||
0xf6, 0x1e, 0xeb, 0x2b, 0xdb, 0xad, 0x27, 0x31,
|
||||
{0x34, 0xaa, 0x97, 0x3c, 0xd4, 0xc4, 0xda, 0xa4,
|
||||
0xf6, 0x1e, 0xeb, 0x2b, 0xdb, 0xad, 0x27, 0x31,
|
||||
0x65, 0x34, 0x01, 0x6f}},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
struct test sha256_tests[] = {
|
||||
{ "abc",
|
||||
{ 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
|
||||
0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
|
||||
{ "abc",
|
||||
{ 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
|
||||
0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
|
||||
0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
|
||||
0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad }},
|
||||
{ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
|
||||
@@ -213,12 +213,12 @@ struct test sha256_tests[] = {
|
||||
|
||||
#ifdef HAVE_SHA384
|
||||
struct test sha384_tests[] = {
|
||||
{ "abc",
|
||||
{ "abc",
|
||||
{ 0xcb,0x00,0x75,0x3f,0x45,0xa3,0x5e,0x8b,
|
||||
0xb5,0xa0,0x3d,0x69,0x9a,0xc6,0x50,0x07,
|
||||
0x27,0x2c,0x32,0xab,0x0e,0xde,0xd1,0x63,
|
||||
0x1a,0x8b,0x60,0x5a,0x43,0xff,0x5b,0xed,
|
||||
0x80,0x86,0x07,0x2b,0xa1,0xe7,0xcc,0x23,
|
||||
0x80,0x86,0x07,0x2b,0xa1,0xe7,0xcc,0x23,
|
||||
0x58,0xba,0xec,0xa1,0x34,0xc8,0x25,0xa7}},
|
||||
{ "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno"
|
||||
"ijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
|
||||
@@ -226,28 +226,28 @@ struct test sha384_tests[] = {
|
||||
0x3d,0x19,0x2f,0xc7,0x82,0xcd,0x1b,0x47,
|
||||
0x53,0x11,0x1b,0x17,0x3b,0x3b,0x05,0xd2,
|
||||
0x2f,0xa0,0x80,0x86,0xe3,0xb0,0xf7,0x12,
|
||||
0xfc,0xc7,0xc7,0x1a,0x55,0x7e,0x2d,0xb9,
|
||||
0xfc,0xc7,0xc7,0x1a,0x55,0x7e,0x2d,0xb9,
|
||||
0x66,0xc3,0xe9,0xfa,0x91,0x74,0x60,0x39}},
|
||||
{ ONE_MILLION_A,
|
||||
{ 0x9d,0x0e,0x18,0x09,0x71,0x64,0x74,0xcb,
|
||||
0x08,0x6e,0x83,0x4e,0x31,0x0a,0x4a,0x1c,
|
||||
0xed,0x14,0x9e,0x9c,0x00,0xf2,0x48,0x52,
|
||||
{ 0x9d,0x0e,0x18,0x09,0x71,0x64,0x74,0xcb,
|
||||
0x08,0x6e,0x83,0x4e,0x31,0x0a,0x4a,0x1c,
|
||||
0xed,0x14,0x9e,0x9c,0x00,0xf2,0x48,0x52,
|
||||
0x79,0x72,0xce,0xc5,0x70,0x4c,0x2a,0x5b,
|
||||
0x07,0xb8,0xb3,0xdc,0x38,0xec,0xc4,0xeb,
|
||||
0xae,0x97,0xdd,0xd8,0x7f,0x3d,0x89,0x85}},
|
||||
{NULL}
|
||||
{NULL}
|
||||
};
|
||||
#endif
|
||||
#ifdef HAVE_SHA512
|
||||
struct test sha512_tests[] = {
|
||||
{ "abc",
|
||||
{ "abc",
|
||||
{ 0xdd,0xaf,0x35,0xa1,0x93,0x61,0x7a,0xba,
|
||||
0xcc,0x41,0x73,0x49,0xae,0x20,0x41,0x31,
|
||||
0x12,0xe6,0xfa,0x4e,0x89,0xa9,0x7e,0xa2,
|
||||
0x0a,0x9e,0xee,0xe6,0x4b,0x55,0xd3,0x9a,
|
||||
0x21,0x92,0x99,0x2a,0x27,0x4f,0xc1,0xa8,
|
||||
0x36,0xba,0x3c,0x23,0xa3,0xfe,0xeb,0xbd,
|
||||
0x45,0x4d,0x44,0x23,0x64,0x3c,0xe8,0x0e,
|
||||
0x21,0x92,0x99,0x2a,0x27,0x4f,0xc1,0xa8,
|
||||
0x36,0xba,0x3c,0x23,0xa3,0xfe,0xeb,0xbd,
|
||||
0x45,0x4d,0x44,0x23,0x64,0x3c,0xe8,0x0e,
|
||||
0x2a,0x9a,0xc9,0x4f,0xa5,0x4c,0xa4,0x9f }},
|
||||
{ "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno"
|
||||
"ijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
|
||||
@@ -255,18 +255,18 @@ struct test sha512_tests[] = {
|
||||
0x8c,0xf4,0xf7,0x28,0x14,0xfc,0x14,0x3f,
|
||||
0x8f,0x77,0x79,0xc6,0xeb,0x9f,0x7f,0xa1,
|
||||
0x72,0x99,0xae,0xad,0xb6,0x88,0x90,0x18,
|
||||
0x50,0x1d,0x28,0x9e,0x49,0x00,0xf7,0xe4,
|
||||
0x33,0x1b,0x99,0xde,0xc4,0xb5,0x43,0x3a,
|
||||
0xc7,0xd3,0x29,0xee,0xb6,0xdd,0x26,0x54,
|
||||
0x50,0x1d,0x28,0x9e,0x49,0x00,0xf7,0xe4,
|
||||
0x33,0x1b,0x99,0xde,0xc4,0xb5,0x43,0x3a,
|
||||
0xc7,0xd3,0x29,0xee,0xb6,0xdd,0x26,0x54,
|
||||
0x5e,0x96,0xe5,0x5b,0x87,0x4b,0xe9,0x09 }},
|
||||
{ ONE_MILLION_A,
|
||||
{ 0xe7,0x18,0x48,0x3d,0x0c,0xe7,0x69,0x64,
|
||||
0x4e,0x2e,0x42,0xc7,0xbc,0x15,0xb4,0x63,
|
||||
0x8e,0x1f,0x98,0xb1,0x3b,0x20,0x44,0x28,
|
||||
0x4e,0x2e,0x42,0xc7,0xbc,0x15,0xb4,0x63,
|
||||
0x8e,0x1f,0x98,0xb1,0x3b,0x20,0x44,0x28,
|
||||
0x56,0x32,0xa8,0x03,0xaf,0xa9,0x73,0xeb,
|
||||
0xde,0x0f,0xf2,0x44,0x87,0x7e,0xa6,0x0a,
|
||||
0x4c,0xb0,0x43,0x2c,0xe5,0x77,0xc3,0x1b,
|
||||
0xeb,0x00,0x9c,0x5c,0x2c,0x49,0xaa,0x2e,
|
||||
0x4c,0xb0,0x43,0x2c,0xe5,0x77,0xc3,0x1b,
|
||||
0xeb,0x00,0x9c,0x5c,0x2c,0x49,0xaa,0x2e,
|
||||
0x4e,0xad,0xb2,0x17,0xad,0x8c,0xc0,0x9b }},
|
||||
{ NULL }
|
||||
};
|
||||
@@ -287,7 +287,7 @@ hash_test (struct hash_foo *hash, struct test *tests)
|
||||
|
||||
ectx = EVP_MD_CTX_create();
|
||||
EVP_DigestInit_ex(ectx, hash->evp(), NULL);
|
||||
|
||||
|
||||
(*hash->init)(ctx);
|
||||
if(strcmp(t->str, ONE_MILLION_A) == 0) {
|
||||
int i;
|
||||
@@ -345,7 +345,7 @@ hash_test (struct hash_foo *hash, struct test *tests)
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return
|
||||
return
|
||||
hash_test(&md2, md2_tests) +
|
||||
hash_test(&md4, md4_tests) +
|
||||
hash_test(&md5, md5_tests) +
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -54,7 +54,7 @@ pwd_dialog_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
case WM_COMMAND:
|
||||
switch(wParam)
|
||||
{
|
||||
case IDOK:
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -47,9 +47,9 @@ RCSID("$Id$");
|
||||
#include <roken.h>
|
||||
|
||||
int
|
||||
PKCS12_key_gen(const void *key, size_t keylen,
|
||||
PKCS12_key_gen(const void *key, size_t keylen,
|
||||
const void *salt, size_t saltlen,
|
||||
int id, int iteration, size_t outkeysize,
|
||||
int id, int iteration, size_t outkeysize,
|
||||
void *out, const EVP_MD *md)
|
||||
{
|
||||
unsigned char *v, *I, hash[EVP_MAX_MD_SIZE];
|
||||
@@ -82,7 +82,7 @@ PKCS12_key_gen(const void *key, size_t keylen,
|
||||
I[i] = ((unsigned char*)salt)[i % saltlen];
|
||||
size_I += vlen;
|
||||
}
|
||||
/*
|
||||
/*
|
||||
* There is a diffrence between the no password string and the
|
||||
* empty string, in the empty string the UTF16 NUL terminator is
|
||||
* included into the string.
|
||||
@@ -118,7 +118,7 @@ PKCS12_key_gen(const void *key, size_t keylen,
|
||||
outkeysize -= size;
|
||||
outp += size;
|
||||
|
||||
for (i = 0; i < vlen; i++)
|
||||
for (i = 0; i < vlen; i++)
|
||||
v[i] = hash[i % size];
|
||||
|
||||
bnB = BN_bin2bn(v, vlen, NULL);
|
||||
@@ -145,7 +145,7 @@ PKCS12_key_gen(const void *key, size_t keylen,
|
||||
BN_bn2bin(bnI, I + i + vlen - j);
|
||||
}
|
||||
BN_free(bnI);
|
||||
}
|
||||
}
|
||||
BN_free(bnB);
|
||||
BN_free(bnOne);
|
||||
size_I = vlen * 2;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -79,7 +79,7 @@ PKCS5_PBKDF2_HMAC_SHA1(const void * password, size_t password_len,
|
||||
int j;
|
||||
char *p;
|
||||
unsigned int hmacsize;
|
||||
|
||||
|
||||
md = EVP_sha1();
|
||||
checksumsize = EVP_MD_size(md);
|
||||
datalen = salt_len + 4;
|
||||
@@ -109,7 +109,7 @@ PKCS5_PBKDF2_HMAC_SHA1(const void * password, size_t password_len,
|
||||
data[datalen - 2] = (keypart >> 8) & 0xff;
|
||||
data[datalen - 1] = (keypart) & 0xff;
|
||||
|
||||
HMAC(md, password, password_len, data, datalen,
|
||||
HMAC(md, password, password_len, data, datalen,
|
||||
tmpcksum, &hmacsize);
|
||||
|
||||
memcpy(p, tmpcksum, len);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -63,7 +63,7 @@ connect_egd(const char *path)
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
int fd;
|
||||
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
|
||||
if (strlen(path) > sizeof(addr.sun_path))
|
||||
@@ -148,11 +148,11 @@ egd_seed(const void *indata, int size)
|
||||
break;
|
||||
indata = ((unsigned char *)indata) + len;
|
||||
size -= len;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
get_bytes(const char *path, unsigned char *outdata, int size)
|
||||
{
|
||||
size_t len;
|
||||
@@ -174,13 +174,13 @@ get_bytes(const char *path, unsigned char *outdata, int size)
|
||||
break;
|
||||
outdata += len;
|
||||
size -= len;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
egd_bytes(unsigned char *outdata, int size)
|
||||
{
|
||||
return get_bytes(NULL, outdata, size);
|
||||
|
@@ -474,7 +474,7 @@ fortuna_reseed(void)
|
||||
entropy_p = 1;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
/*
|
||||
* Only to get egd entropy if /dev/random or arc4rand failed since
|
||||
* it can be horribly slow to generate new bits.
|
||||
*/
|
||||
@@ -556,7 +556,7 @@ fortuna_seed(const void *indata, int size)
|
||||
have_entropy = 1;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
fortuna_bytes(unsigned char *outdata, int size)
|
||||
{
|
||||
if (!fortuna_init())
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 1996, 1997, 1999, 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -83,7 +83,7 @@ pacemaker(struct timeval *tv)
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
/* XXX ugly hack, should perhaps use function from roken */
|
||||
static RETSIGTYPE
|
||||
static RETSIGTYPE
|
||||
(*fake_signal(int sig, RETSIGTYPE (*f)(int)))(int)
|
||||
{
|
||||
struct sigaction sa, osa;
|
||||
@@ -107,7 +107,7 @@ timer_seed(const void *indata, int size)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
timer_bytes(unsigned char *outdata, int size)
|
||||
{
|
||||
#ifdef WIN32
|
||||
@@ -116,7 +116,7 @@ timer_bytes(unsigned char *outdata, int size)
|
||||
struct itimerval tv, otv;
|
||||
RETSIGTYPE (*osa)(int);
|
||||
int i, j;
|
||||
#ifndef HAVE_SETITIMER
|
||||
#ifndef HAVE_SETITIMER
|
||||
RETSIGTYPE (*ochld)(int);
|
||||
pid_t pid;
|
||||
#endif
|
||||
@@ -126,7 +126,7 @@ timer_bytes(unsigned char *outdata, int size)
|
||||
igdata = 0;
|
||||
|
||||
osa = signal(SIGALRM, sigALRM);
|
||||
|
||||
|
||||
/* Start timer */
|
||||
tv.it_value.tv_sec = 0;
|
||||
tv.it_value.tv_usec = 10 * 1000; /* 10 ms */
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -88,7 +88,7 @@ unix_seed(const void *indata, int size)
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
unix_bytes(unsigned char *outdata, int size)
|
||||
{
|
||||
ssize_t count;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -127,7 +127,7 @@ RAND_cleanup(void)
|
||||
* @param indata the input data.
|
||||
* @param size size of in data.
|
||||
* @param entropi entropi in data.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @ingroup hcrypto_rand
|
||||
*/
|
||||
@@ -347,7 +347,7 @@ RAND_file_name(char *filename, size_t size)
|
||||
pathp = 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
* Here we really want to call getpwuid(getuid()) but this will
|
||||
* cause recursive lookups if the nss library uses
|
||||
* gssapi/krb5/hcrypto to authenticate to the ldap servers.
|
||||
|
@@ -1,35 +1,35 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -47,37 +47,37 @@ RCSID("$Id$");
|
||||
*/
|
||||
|
||||
static unsigned int Sbox[256] = {
|
||||
0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed,
|
||||
0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,
|
||||
0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e,
|
||||
0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2,
|
||||
0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13,
|
||||
0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32,
|
||||
0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b,
|
||||
0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82,
|
||||
0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c,
|
||||
0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc,
|
||||
0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1,
|
||||
0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26,
|
||||
0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57,
|
||||
0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03,
|
||||
0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7,
|
||||
0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7,
|
||||
0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7,
|
||||
0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a,
|
||||
0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74,
|
||||
0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec,
|
||||
0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc,
|
||||
0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39,
|
||||
0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a,
|
||||
0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31,
|
||||
0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae,
|
||||
0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9,
|
||||
0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c,
|
||||
0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9,
|
||||
0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0,
|
||||
0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e,
|
||||
0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77,
|
||||
0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed,
|
||||
0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,
|
||||
0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e,
|
||||
0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2,
|
||||
0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13,
|
||||
0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32,
|
||||
0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b,
|
||||
0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82,
|
||||
0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c,
|
||||
0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc,
|
||||
0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1,
|
||||
0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26,
|
||||
0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57,
|
||||
0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03,
|
||||
0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7,
|
||||
0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7,
|
||||
0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7,
|
||||
0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a,
|
||||
0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74,
|
||||
0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec,
|
||||
0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc,
|
||||
0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39,
|
||||
0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a,
|
||||
0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31,
|
||||
0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae,
|
||||
0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9,
|
||||
0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c,
|
||||
0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9,
|
||||
0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0,
|
||||
0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e,
|
||||
0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77,
|
||||
0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad
|
||||
};
|
||||
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -34,7 +34,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* symbol renaming */
|
||||
#define RC2_set_key hc_RC2_set_key
|
||||
#define RC2_set_key hc_RC2_set_key
|
||||
#define RC2_encryptc hc_RC2_encryptc
|
||||
#define RC2_decryptc hc_RC2_decryptc
|
||||
#define RC2_cbc_encrypt hc_RC2_cbc_encrypt
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -64,7 +64,7 @@ struct {
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00",
|
||||
"\x21\x82\x9C\x78\xA9\xF9\xC0\x74"
|
||||
},
|
||||
{
|
||||
{
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00",
|
||||
16,
|
||||
@@ -103,12 +103,12 @@ struct {
|
||||
}
|
||||
};
|
||||
|
||||
const unsigned char cbc_key[16] =
|
||||
const unsigned char cbc_key[16] =
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
const char cbc_iv[8] =
|
||||
"\x01\x01\x01\x01\x01\x01\x01\x01";
|
||||
const unsigned char cbc_in_data[32] =
|
||||
const unsigned char cbc_in_data[32] =
|
||||
"\x20\x20\x20\x20\x20\x20\x20\x20"
|
||||
"\x20\x20\x20\x20\x20\x20\x20\x20"
|
||||
"\x20\x20\x20\x20\x20\x20\x20\x20"
|
||||
@@ -116,7 +116,7 @@ const unsigned char cbc_in_data[32] =
|
||||
|
||||
const char out_iv[8] = "\x00\x78\x1b\x6\xff\xb9\xfa\xe";
|
||||
|
||||
const char cbc_out_data[32] =
|
||||
const char cbc_out_data[32] =
|
||||
"\xb4\x3f\x89\x15\x69\x68\xda\x79"
|
||||
"\x29\xab\x5f\x78\xc5\xba\x15\x82"
|
||||
"\x80\x89\x57\x1b\xbe\x57\x2f\xdc"
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2004 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -55,7 +55,7 @@ static unsigned char cipher2[5] =
|
||||
{ 0xf1, 0x38, 0x29, 0xc9, 0xde };
|
||||
|
||||
static unsigned char plain3[] =
|
||||
{
|
||||
{
|
||||
0x52, 0x75, 0x69, 0x73, 0x6c, 0x69, 0x6e, 0x6e,
|
||||
0x75, 0x6e, 0x20, 0x6c, 0x61, 0x75, 0x6c, 0x75,
|
||||
0x20, 0x6b, 0x6f, 0x72, 0x76, 0x69, 0x73, 0x73,
|
||||
@@ -95,12 +95,12 @@ static unsigned char plain3[] =
|
||||
0x75, 0x6e, 0x20, 0x74, 0x65, 0x65, 0x6e, 0x2e,
|
||||
0x20, 0x2d, 0x20, 0x45, 0x69, 0x6e, 0x6f, 0x20,
|
||||
0x4c, 0x65, 0x69, 0x6e, 0x6f };
|
||||
|
||||
static unsigned char key3[16] =
|
||||
|
||||
static unsigned char key3[16] =
|
||||
{ 0x29, 0x04, 0x19, 0x72, 0xfb, 0x42, 0xba, 0x5f,
|
||||
0xc7, 0x12, 0x77, 0x12, 0xf1, 0x38, 0x29, 0xc9 };
|
||||
|
||||
const unsigned char cipher3[] =
|
||||
const unsigned char cipher3[] =
|
||||
{ 0x35, 0x81, 0x86, 0x99, 0x90, 0x01, 0xe6, 0xb5,
|
||||
0xda, 0xf0, 0x5e, 0xce, 0xeb, 0x7e, 0xee, 0x21,
|
||||
0xe0, 0x68, 0x9c, 0x1f, 0x00, 0xee, 0xa8, 0x1f,
|
||||
@@ -140,7 +140,7 @@ const unsigned char cipher3[] =
|
||||
0xe0, 0x98, 0x22, 0x65, 0xee, 0xf7, 0x01, 0x79,
|
||||
0xbc, 0x55, 0x3f, 0x33, 0x9e, 0xb1, 0xa4, 0xc1,
|
||||
0xaf, 0x5f, 0x6a, 0x54, 0x7f };
|
||||
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#define IDC_PASSWD_EDIT 1001
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995, 1996, 1997, 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -90,7 +90,7 @@ rsa_private_calculate(mpz_t in, mpz_t p, mpz_t q,
|
||||
{
|
||||
mpz_t vp, vq, u;
|
||||
mpz_init(vp); mpz_init(vq); mpz_init(u);
|
||||
|
||||
|
||||
/* vq = c ^ (d mod (q - 1)) mod q */
|
||||
/* vp = c ^ (d mod (p - 1)) mod p */
|
||||
mpz_fdiv_r(vp, m, p);
|
||||
@@ -107,11 +107,11 @@ rsa_private_calculate(mpz_t in, mpz_t p, mpz_t q,
|
||||
#endif
|
||||
mpz_mul(u, iqmp, u);
|
||||
mpz_fdiv_r(u, u, p);
|
||||
|
||||
|
||||
/* c ^ d mod n = vq + u q */
|
||||
mpz_mul(u, q, u);
|
||||
mpz_add(out, x, xq);
|
||||
|
||||
|
||||
mpz_clear(vp);
|
||||
mpz_clear(vq);
|
||||
mpz_clear(u);
|
||||
@@ -124,7 +124,7 @@ rsa_private_calculate(mpz_t in, mpz_t p, mpz_t q,
|
||||
*/
|
||||
|
||||
static int
|
||||
gmp_rsa_public_encrypt(int flen, const unsigned char* from,
|
||||
gmp_rsa_public_encrypt(int flen, const unsigned char* from,
|
||||
unsigned char* to, RSA* rsa, int padding)
|
||||
{
|
||||
unsigned char *p, *p0;
|
||||
@@ -193,7 +193,7 @@ gmp_rsa_public_encrypt(int flen, const unsigned char* from,
|
||||
}
|
||||
|
||||
static int
|
||||
gmp_rsa_public_decrypt(int flen, const unsigned char* from,
|
||||
gmp_rsa_public_decrypt(int flen, const unsigned char* from,
|
||||
unsigned char* to, RSA* rsa, int padding)
|
||||
{
|
||||
unsigned char *p;
|
||||
@@ -260,7 +260,7 @@ gmp_rsa_public_decrypt(int flen, const unsigned char* from,
|
||||
}
|
||||
|
||||
static int
|
||||
gmp_rsa_private_encrypt(int flen, const unsigned char* from,
|
||||
gmp_rsa_private_encrypt(int flen, const unsigned char* from,
|
||||
unsigned char* to, RSA* rsa, int padding)
|
||||
{
|
||||
unsigned char *p, *p0;
|
||||
@@ -335,7 +335,7 @@ gmp_rsa_private_encrypt(int flen, const unsigned char* from,
|
||||
assert(size >= ssize);
|
||||
size = ssize;
|
||||
}
|
||||
|
||||
|
||||
out:
|
||||
mpz_clear(e);
|
||||
mpz_clear(n);
|
||||
@@ -346,7 +346,7 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
gmp_rsa_private_decrypt(int flen, const unsigned char* from,
|
||||
gmp_rsa_private_decrypt(int flen, const unsigned char* from,
|
||||
unsigned char* to, RSA* rsa, int padding)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
@@ -545,7 +545,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
gmp_rsa_init(RSA *rsa)
|
||||
{
|
||||
return 1;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -121,14 +121,14 @@ rsa_private_calculate(mp_int in, mp_int p, mp_int q,
|
||||
{
|
||||
mpz_t vp, vq, u;
|
||||
mp_int_init(&vp); mp_int_init(&vq); mp_int_init(&u);
|
||||
|
||||
|
||||
/* vq = c ^ (d mod (q - 1)) mod q */
|
||||
/* vp = c ^ (d mod (p - 1)) mod p */
|
||||
mp_int_mod(in, p, &u);
|
||||
mp_int_exptmod(&u, dmp1, p, &vp);
|
||||
mp_int_mod(in, q, &u);
|
||||
mp_int_exptmod(&u, dmq1, q, &vq);
|
||||
|
||||
|
||||
/* C2 = 1/q mod p (iqmp) */
|
||||
/* u = (vp - vq)C2 mod p. */
|
||||
mp_int_sub(&vp, &vq, &u);
|
||||
@@ -136,11 +136,11 @@ rsa_private_calculate(mp_int in, mp_int p, mp_int q,
|
||||
mp_int_add(&u, p, &u);
|
||||
mp_int_mul(&u, iqmp, &u);
|
||||
mp_int_mod(&u, p, &u);
|
||||
|
||||
|
||||
/* c ^ d mod n = vq + u q */
|
||||
mp_int_mul(&u, q, &u);
|
||||
mp_int_add(&u, &vq, out);
|
||||
|
||||
|
||||
mp_int_clear(&vp);
|
||||
mp_int_clear(&vq);
|
||||
mp_int_clear(&u);
|
||||
@@ -153,7 +153,7 @@ rsa_private_calculate(mp_int in, mp_int p, mp_int q,
|
||||
*/
|
||||
|
||||
static int
|
||||
imath_rsa_public_encrypt(int flen, const unsigned char* from,
|
||||
imath_rsa_public_encrypt(int flen, const unsigned char* from,
|
||||
unsigned char* to, RSA* rsa, int padding)
|
||||
{
|
||||
unsigned char *p, *p0;
|
||||
@@ -222,7 +222,7 @@ imath_rsa_public_encrypt(int flen, const unsigned char* from,
|
||||
}
|
||||
|
||||
static int
|
||||
imath_rsa_public_decrypt(int flen, const unsigned char* from,
|
||||
imath_rsa_public_decrypt(int flen, const unsigned char* from,
|
||||
unsigned char* to, RSA* rsa, int padding)
|
||||
{
|
||||
unsigned char *p;
|
||||
@@ -294,7 +294,7 @@ imath_rsa_public_decrypt(int flen, const unsigned char* from,
|
||||
}
|
||||
|
||||
static int
|
||||
imath_rsa_private_encrypt(int flen, const unsigned char* from,
|
||||
imath_rsa_private_encrypt(int flen, const unsigned char* from,
|
||||
unsigned char* to, RSA* rsa, int padding)
|
||||
{
|
||||
unsigned char *p, *p0;
|
||||
@@ -381,7 +381,7 @@ imath_rsa_private_encrypt(int flen, const unsigned char* from,
|
||||
mp_int_to_unsigned(&out, to, size);
|
||||
size = ssize;
|
||||
}
|
||||
|
||||
|
||||
out:
|
||||
mp_int_clear(&e);
|
||||
mp_int_clear(&n);
|
||||
@@ -392,7 +392,7 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
imath_rsa_private_decrypt(int flen, const unsigned char* from,
|
||||
imath_rsa_private_decrypt(int flen, const unsigned char* from,
|
||||
unsigned char* to, RSA* rsa, int padding)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
@@ -505,7 +505,7 @@ random_num(mp_int num, size_t len)
|
||||
{
|
||||
unsigned char *p;
|
||||
mp_result res;
|
||||
|
||||
|
||||
len = (len + 7) / 8;
|
||||
p = malloc(len);
|
||||
if (p == NULL)
|
||||
@@ -624,7 +624,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
imath_rsa_init(RSA *rsa)
|
||||
{
|
||||
return 1;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2008 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -254,7 +254,7 @@ RSA_check_key(const RSA *key)
|
||||
void *buffer;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
/*
|
||||
* XXX I have no clue how to implement this w/o a bignum library.
|
||||
* Well, when we have a RSA key pair, we can try to encrypt/sign
|
||||
* and then decrypt/verify.
|
||||
@@ -267,8 +267,8 @@ RSA_check_key(const RSA *key)
|
||||
buffer = malloc(RSA_size(rsa));
|
||||
if (buffer == NULL)
|
||||
return 0;
|
||||
|
||||
ret = RSA_private_encrypt(sizeof(inbuf), inbuf, buffer,
|
||||
|
||||
ret = RSA_private_encrypt(sizeof(inbuf), inbuf, buffer,
|
||||
rsa, RSA_PKCS1_PADDING);
|
||||
if (ret == -1) {
|
||||
free(buffer);
|
||||
@@ -287,7 +287,7 @@ RSA_check_key(const RSA *key)
|
||||
return 1;
|
||||
}
|
||||
free(buffer);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -350,7 +350,7 @@ RSA_generate_key_ex(RSA *r, int bits, BIGNUM *e, BN_GENCB *cb)
|
||||
*
|
||||
*/
|
||||
|
||||
static int
|
||||
static int
|
||||
null_rsa_init(RSA *rsa)
|
||||
{
|
||||
return 1;
|
||||
@@ -444,7 +444,7 @@ d2i_RSAPrivateKey(RSA *rsa, const unsigned char **pp, size_t len)
|
||||
ret = decode_RSAPrivateKey(*pp, len, &data, &size);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
|
||||
*pp += size;
|
||||
|
||||
if (k == NULL) {
|
||||
@@ -466,7 +466,7 @@ d2i_RSAPrivateKey(RSA *rsa, const unsigned char **pp, size_t len)
|
||||
free_RSAPrivateKey(&data);
|
||||
|
||||
if (k->n == NULL || k->e == NULL || k->d == NULL || k->p == NULL ||
|
||||
k->q == NULL || k->dmp1 == NULL || k->dmq1 == NULL || k->iqmp == NULL)
|
||||
k->q == NULL || k->dmp1 == NULL || k->dmq1 == NULL || k->iqmp == NULL)
|
||||
{
|
||||
RSA_free(k);
|
||||
return NULL;
|
||||
@@ -554,12 +554,12 @@ i2d_RSAPublicKey(RSA *rsa, unsigned char **pp)
|
||||
return -1;
|
||||
if (len != size)
|
||||
abort();
|
||||
|
||||
|
||||
memcpy(*pp, p, size);
|
||||
free(p);
|
||||
|
||||
*pp += size;
|
||||
}
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -112,7 +112,7 @@ calc (SHA256_CTX *m, uint32_t *in)
|
||||
for (i = 0; i < 16; ++i)
|
||||
data[i] = in[i];
|
||||
for (i = 16; i < 64; ++i)
|
||||
data[i] = sigma1(data[i-2]) + data[i-7] +
|
||||
data[i] = sigma1(data[i-2]) + data[i-7] +
|
||||
sigma0(data[i-15]) + data[i - 16];
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
@@ -120,7 +120,7 @@ calc (SHA256_CTX *m, uint32_t *in)
|
||||
|
||||
T1 = HH + Sigma1(EE) + Ch(EE, FF, GG) + constant_256[i] + data[i];
|
||||
T2 = Sigma0(AA) + Maj(AA,BB,CC);
|
||||
|
||||
|
||||
HH = GG;
|
||||
GG = FF;
|
||||
FF = EE;
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -433,7 +433,7 @@ main(int argc, char **argv)
|
||||
|
||||
if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &idx))
|
||||
usage(1);
|
||||
|
||||
|
||||
if (help_flag)
|
||||
usage(0);
|
||||
|
||||
|
@@ -236,21 +236,21 @@ static struct getargs args[] = {
|
||||
struct prime {
|
||||
char *name;
|
||||
char *value;
|
||||
} primes[] = {
|
||||
{ "modp768", OAKLEY_PRIME_MODP768 },
|
||||
} primes[] = {
|
||||
{ "modp768", OAKLEY_PRIME_MODP768 },
|
||||
{ "modp1024", OAKLEY_PRIME_MODP1024 },
|
||||
{ "modp1536", OAKLEY_PRIME_MODP1536 },
|
||||
{ "modp2048", OAKLEY_PRIME_MODP2048 },
|
||||
{ "modp3072", OAKLEY_PRIME_MODP3072 },
|
||||
{ "modp4096", OAKLEY_PRIME_MODP4096 },
|
||||
{ "modp4096", OAKLEY_PRIME_MODP4096 },
|
||||
{ "modp6144", OAKLEY_PRIME_MODP6144 },
|
||||
{ "modp8192", OAKLEY_PRIME_MODP8192 },
|
||||
{ NULL, NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* exchange a string based "base" to a value.
|
||||
*
|
||||
*
|
||||
*/
|
||||
static char *
|
||||
str2val(const char *str, int base, size_t *len)
|
||||
@@ -343,7 +343,7 @@ static int check_prime(struct prime *pr)
|
||||
dh2 = DH_new();
|
||||
|
||||
/* 1. set shared parameter */
|
||||
set_prime(p, pr->value);
|
||||
set_prime(p, pr->value);
|
||||
set_generator(g);
|
||||
dh1->p = BN_dup(p);
|
||||
dh1->g = BN_dup(g);
|
||||
@@ -431,7 +431,7 @@ main(int argc, char **argv)
|
||||
|
||||
if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &idx))
|
||||
usage(1);
|
||||
|
||||
|
||||
if (help_flag)
|
||||
usage(0);
|
||||
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -64,7 +64,7 @@ struct {
|
||||
"1E0AB5EBAAC7985FE67A574447FAE58AE4CB95416278D4C239A789D4532FA8E6F82BA10BE411D8A0A06B9E1DECE704466B3523496A8A4165B97FBCFB9CE9C4FF2DEEE786BA046E8C270FA8A9055D2F6E42EDDB32C73CF7875551A56EB69C0F14A3745745845B81C347401B27D074C60C5177BA9C14BBB1C8C219B78E15126EF8",
|
||||
"68D84A8F92082F113542CFD990DEEFAD9C7EFA545268F8B3EBDF4CCBAF2865CF03EF60044EB4AF4154E6804CC2BDD673B801507446CEFC692DA577B6DC6E0272B7B081A1BEFDC2A4FAC83DB8845E3DA0D1B64DB33AA2164FEDB08A01E815336BD58F4E6DE6A265468E61C8C988B8AEC0D52DB714448DDC007E7C3382C07357DB",
|
||||
"393815D507A2EF80DE2D0F2A55AAB1C25B870ACA3FC97438B4336CBF979BF9A4F8DA1B61C667129F9123045E07E24976040EC5E2368DD4EF70690102D74E900B260D3826256FD473733A7569BF514652AB78C48C334FDCA26C44ABF322643AF15BFF693A37BB2C19CA9FE5F1537FCFE2B24CF74D4E57060D35ABF115B4B6CD21"
|
||||
},
|
||||
},
|
||||
{
|
||||
"7307D6C3CB874327A95F7A6A91C336CEAA086736525DF3F8EC49497CF444C68D264EB70CD6904FE56E240EEF34E6C5177911C478A7F250A0F54183BCBE64B42BAB5D019E73E2F17C095C211E4815E6BA5FDD72786AF987ABBC9109ECEEF439AF9E2141D5222CE7DC0152D8E9A6CCCE301D21A7D1D6ACB9B91B5E28379C91890D",
|
||||
"83FBD7BFFDF415BBB7E21D399CB2F36A61AFDBAFC542E428E444C66AA03617C0C55C639FE2428905B57035892AE1BD2C4060E807D9E003B0C204FFC8FDD69CC8ADE7A8E18DCBFFF64E3EF9DA2C117390374241466E48A020A1B2F575AE42C233F8BD357B8331CC203E0345DFC19C73E6F1F70B6C2786E681D73BF48B15FE9992",
|
||||
@@ -77,7 +77,7 @@ struct {
|
||||
"462C0707CF3366C2242A808CFDB79B77E8B3AF9D796583EB9CCD7BF4E8792AB0A818E49FFE53CA241F56988F825B366BF1E78481F8086A123259B9D83AC643E85845BF6B2C5412FFDDFAA8C9ED203CA4B3C1BFD777286099976472FA15B3CCC8418CF162F03C0C3E85D7EFC5CF5ACB9B2C039CCF3A1A9C6BB6B9C09C18D86CBD",
|
||||
"56DB382EDB8C2D95934D20261CE1A37090B0802D451E647DB1DA3B73CDB5A878EAD598A8817302449370F9D45E34F5C45F73D02BF4EB2B3712A8665F446F5D2B774039E5444AB74807859FA58DF9EBA4B12BA4545ACED827E4ED64CC71F937D64A1033BC43403F2490C1B715A74822B8D50A72A102213F0CF7A1B98B771B34C4"
|
||||
},
|
||||
{
|
||||
{
|
||||
"61B7321207F4A73646E43E99221F902D2F38095E84CE7346A1510FE71BA7B9B34DCB6609E4DDDA8C82426E82D1C23F1E761130ECE4638D77554A7618E1608625049328FCC1F8845CA9A88E847106B01BD31EF6500E3C7EE81A048924BEAA3EDF367E5F4575341206C7A76427571898294B07BD918D4C2642854CC89D439042E5",
|
||||
"29AA38E63E4DD7C651E25DEC7A5A53E48114F52813793D36A9DBDD4F7C06FC38406E330764E0B2AFD811C39D857EA5F904105360E06856DC0780C7D61C53165833F0AEA15CB54732DE113F44C8FCFB86F4A876DD42D7A55356D91C0173F2B012680FB54C13EF54B65DF4AEDE2E13419B1316435187CEF07D44DB3DF57C4703FD",
|
||||
"5ED5AFB04CBFEE43EF3D9B60A57080831563648A2380D98F1EA4A96CF153903A40A2E564DED87E7254DF3270568AB952BF6F400681DD6AD919C9B06AC0F45F0646BCF37B217191AA0B7B7BED226B61F48B46DEA2E5A09E41F316583823A38A60FFD79085F43F60D98871ECA1A0F667701425094E88885A81DE9DA6C293E95060",
|
||||
@@ -93,20 +93,20 @@ dh_test(DH *server, DH *client)
|
||||
|
||||
skey = emalloc(DH_size(server));
|
||||
ckey = emalloc(DH_size(client));
|
||||
|
||||
|
||||
ssize = DH_compute_key(skey, client->pub_key, server);
|
||||
if (ssize == -1)
|
||||
errx(1, "DH_compute_key failed for server");
|
||||
csize = DH_compute_key(ckey, server->pub_key, client);
|
||||
if (csize == -1)
|
||||
errx(1, "DH_compute_key failed for client");
|
||||
|
||||
|
||||
if (ssize != csize)
|
||||
errx(1, "DH_compute_key size mismatch");
|
||||
|
||||
|
||||
if (memcmp(skey, ckey, csize) != 0)
|
||||
errx(1, "DH_compute_key key mismatch");
|
||||
|
||||
|
||||
free(skey);
|
||||
free(ckey);
|
||||
}
|
||||
@@ -155,7 +155,7 @@ main(int argc, char **argv)
|
||||
|
||||
if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &idx))
|
||||
usage(1);
|
||||
|
||||
|
||||
if (help_flag)
|
||||
usage(0);
|
||||
|
||||
@@ -223,7 +223,7 @@ main(int argc, char **argv)
|
||||
|
||||
RSA_set_method(rsa, ENGINE_get_RSA(engine));
|
||||
|
||||
/*
|
||||
/*
|
||||
* try rsa signing
|
||||
*/
|
||||
|
||||
@@ -242,8 +242,8 @@ main(int argc, char **argv)
|
||||
if (memcmp(buf, "hejsan", 7) != 0)
|
||||
errx(1, "string not the same after decryption");
|
||||
|
||||
/*
|
||||
* try rsa encryption
|
||||
/*
|
||||
* try rsa encryption
|
||||
*/
|
||||
|
||||
memcpy(buf, "hejsan", 7);
|
||||
@@ -272,7 +272,7 @@ main(int argc, char **argv)
|
||||
int i;
|
||||
|
||||
/* RFC2412-MODP-group2 */
|
||||
const char *p =
|
||||
const char *p =
|
||||
"FFFFFFFF" "FFFFFFFF" "C90FDAA2" "2168C234" "C4C6628B" "80DC1CD1"
|
||||
"29024E08" "8A67CC74" "020BBEA6" "3B139B22" "514A0879" "8E3404DD"
|
||||
"EF9519B3" "CD3A431B" "302B0A6D" "F25F1437" "4FE1356D" "6D51C245"
|
||||
@@ -317,14 +317,14 @@ main(int argc, char **argv)
|
||||
BN_hex2bn(&client->p, p);
|
||||
BN_hex2bn(&server->g, g);
|
||||
BN_hex2bn(&client->g, g);
|
||||
|
||||
|
||||
BN_hex2bn(&client->priv_key, dhtests[i].cpriv);
|
||||
BN_hex2bn(&client->pub_key, dhtests[i].cpub);
|
||||
BN_hex2bn(&server->priv_key, dhtests[i].spriv);
|
||||
BN_hex2bn(&server->pub_key, dhtests[i].spub);
|
||||
|
||||
dh_test(server, client);
|
||||
|
||||
|
||||
DH_free(server);
|
||||
DH_free(client);
|
||||
}
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@@ -45,11 +45,11 @@ umr_exptmod(void)
|
||||
{
|
||||
mp_result res;
|
||||
mpz_t tmp, z;
|
||||
|
||||
|
||||
res = mp_int_init(&tmp);
|
||||
if (res != MP_OK)
|
||||
errx(1, "ini_init");
|
||||
|
||||
|
||||
res = mp_int_init(&z);
|
||||
if (res != MP_OK)
|
||||
errx(1, "ini_init");
|
||||
@@ -62,7 +62,7 @@ umr_exptmod(void)
|
||||
res = mp_int_exptmod_bvalue(3, &z, &z, &tmp);
|
||||
if (res != MP_OK)
|
||||
errx(1, "exptmod_bvalue");
|
||||
|
||||
|
||||
mp_int_clear(&tmp);
|
||||
mp_int_clear(&z);
|
||||
}
|
||||
@@ -72,17 +72,17 @@ abr_mp_int_mul(void)
|
||||
{
|
||||
mp_result res;
|
||||
mpz_t t1, in;
|
||||
|
||||
|
||||
res = mp_int_init(&t1);
|
||||
if (res != MP_OK)
|
||||
errx(1, "ini_init");
|
||||
|
||||
|
||||
res = mp_int_init(&in);
|
||||
if (res != MP_OK)
|
||||
errx(1, "ini_init");
|
||||
|
||||
res = mp_int_read_unsigned(&t1, (void*)
|
||||
"\x20\x12\xBB\x7C\xA7\x11\x2A\xF5\x4C\x17\xF5\x4B\x60\x6A\x02\x5C\xA8\x24\xBC\x9A\xDD\x94\x54\x99\xC9\x66\xCB\x45\x11\x5D\xA1\xD5\x69\x95\x0A\xE4\x23\x93\x24\x01\x55\x6F\xC6\xDC\xA1\x47\x54\xCC\x82\xCB\x07\xBD\x58\xCE\x31\x5E\x0E\x63\xEF\x9F\x04\xBB\xE2\xA0\xB5\x6B\x04\x58\x5E\xC6\x3D\xEE\x48\x57\x3A\x5C\x5E\xE3\xA7\xA9\xA3\x30\xE9\x76\x16\xCB\x70\xAF\x80\x01\xE1\xE0\xDD\xC0\x4F\x54\xA4\x76\xC4\x25\x30\x6A\x66\xC5\xCB\x47\xBE\x9F\xE9\x37\x72\xB5\x91\x3A\x0E\x24\xA6\xE6\xBB\x40\xB0\xDA\xE1\xAA\xB1\x0F\x1D\x9C\xD2\x63\x62\xD4\xFB\x2C\xD3\x46\xF1\x73\xB3\x48\xEF\x45\xC3\x00\xC9\xFA\x91\xB6\xB3\x58\x94\x25\x0C\xB4\xFA\x8B\x48\x70\xEF\x91\x04\x8C\x7C\xB6\x67\x82\x53\x42\xBD\xDB\x94\x7F\x77\x5A\xD5\x6D\x15\xB1\x6F\x44\x3A\x34\xE5\xCF\x99\x76\x11\xE5\x75\xBF\x19\xF4\x4A\x40\xAD\x2B\x72\xF1\x48\x3F\x2A\xE1\xFB\x9D\x8B\x43\x27\x6E\x99\x8F\x66\x99\xF5\x13\xE5\x16\x08\xAA\xBD\x99\x95\x30\xDB\x8D\xFA\x91\xAF\xD6\x2C\x28\x2C\xD2\xE9\xDE\x19\x7D\x2A\x99\x53\xD9\x6C\x07\x40\x99\x17\xE0\x22\xA0\x6F\x95\x65\xCC\x48\x4A\x8C\x56\x44\xBD",
|
||||
"\x20\x12\xBB\x7C\xA7\x11\x2A\xF5\x4C\x17\xF5\x4B\x60\x6A\x02\x5C\xA8\x24\xBC\x9A\xDD\x94\x54\x99\xC9\x66\xCB\x45\x11\x5D\xA1\xD5\x69\x95\x0A\xE4\x23\x93\x24\x01\x55\x6F\xC6\xDC\xA1\x47\x54\xCC\x82\xCB\x07\xBD\x58\xCE\x31\x5E\x0E\x63\xEF\x9F\x04\xBB\xE2\xA0\xB5\x6B\x04\x58\x5E\xC6\x3D\xEE\x48\x57\x3A\x5C\x5E\xE3\xA7\xA9\xA3\x30\xE9\x76\x16\xCB\x70\xAF\x80\x01\xE1\xE0\xDD\xC0\x4F\x54\xA4\x76\xC4\x25\x30\x6A\x66\xC5\xCB\x47\xBE\x9F\xE9\x37\x72\xB5\x91\x3A\x0E\x24\xA6\xE6\xBB\x40\xB0\xDA\xE1\xAA\xB1\x0F\x1D\x9C\xD2\x63\x62\xD4\xFB\x2C\xD3\x46\xF1\x73\xB3\x48\xEF\x45\xC3\x00\xC9\xFA\x91\xB6\xB3\x58\x94\x25\x0C\xB4\xFA\x8B\x48\x70\xEF\x91\x04\x8C\x7C\xB6\x67\x82\x53\x42\xBD\xDB\x94\x7F\x77\x5A\xD5\x6D\x15\xB1\x6F\x44\x3A\x34\xE5\xCF\x99\x76\x11\xE5\x75\xBF\x19\xF4\x4A\x40\xAD\x2B\x72\xF1\x48\x3F\x2A\xE1\xFB\x9D\x8B\x43\x27\x6E\x99\x8F\x66\x99\xF5\x13\xE5\x16\x08\xAA\xBD\x99\x95\x30\xDB\x8D\xFA\x91\xAF\xD6\x2C\x28\x2C\xD2\xE9\xDE\x19\x7D\x2A\x99\x53\xD9\x6C\x07\x40\x99\x17\xE0\x22\xA0\x6F\x95\x65\xCC\x48\x4A\x8C\x56\x44\xBD",
|
||||
258);
|
||||
if (res != MP_OK)
|
||||
errx(1, "int_read");
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -118,9 +118,9 @@ test_pkcs12_pbe(struct tests *t)
|
||||
if (t->password)
|
||||
pwlen = strlen(t->password);
|
||||
|
||||
if (!PKCS12_key_gen(t->password, pwlen,
|
||||
if (!PKCS12_key_gen(t->password, pwlen,
|
||||
t->salt, t->saltsize,
|
||||
t->id, t->iterations, t->keylen,
|
||||
t->id, t->iterations, t->keylen,
|
||||
key, t->md()))
|
||||
{
|
||||
printf("key_gen failed\n");
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -99,7 +99,7 @@ main(int argc, char **argv)
|
||||
|
||||
if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &idx))
|
||||
usage(1);
|
||||
|
||||
|
||||
if (help_flag)
|
||||
usage(0);
|
||||
|
||||
@@ -126,7 +126,7 @@ main(int argc, char **argv)
|
||||
else
|
||||
errx(1, "unknown method %s", rand_method);
|
||||
}
|
||||
|
||||
|
||||
if (RAND_file_name(path, sizeof(path)) == NULL)
|
||||
errx(1, "RAND_file_name failed");
|
||||
|
||||
@@ -158,7 +158,7 @@ main(int argc, char **argv)
|
||||
|
||||
res = ((double)abs(len - bits[bit] * 2)) / (double)len;
|
||||
if (res > 0.005)
|
||||
errx(1, "head%d vs tail%d > 0.5%%%% %lf == %d vs %d",
|
||||
errx(1, "head%d vs tail%d > 0.5%%%% %lf == %d vs %d",
|
||||
bit, bit, res, len, bits[bit]);
|
||||
|
||||
printf("head vs tails bit%d: %lf\n", bit, res);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -102,17 +102,17 @@ check_rsa(const unsigned char *in, size_t len, RSA *rsa, int padding)
|
||||
keylen = RSA_private_encrypt(len, in, res, rsa, padding);
|
||||
if (keylen <= 0)
|
||||
errx(1, "failed to private encrypt: %d %d", (int)len, (int)keylen);
|
||||
|
||||
|
||||
if (keylen > RSA_size(rsa))
|
||||
errx(1, "keylen > RSA_size(rsa)");
|
||||
|
||||
|
||||
keylen = RSA_public_decrypt(keylen, res, res2, rsa, padding);
|
||||
if (keylen <= 0)
|
||||
errx(1, "failed to public decrypt: %d", (int)keylen);
|
||||
|
||||
|
||||
if (keylen != len)
|
||||
errx(1, "output buffer not same length: %d", (int)keylen);
|
||||
|
||||
|
||||
if (memcmp(res2, in, len) != 0)
|
||||
errx(1, "string not the same after decryption");
|
||||
|
||||
@@ -121,17 +121,17 @@ check_rsa(const unsigned char *in, size_t len, RSA *rsa, int padding)
|
||||
keylen = RSA_public_encrypt(len, in, res, rsa, padding);
|
||||
if (keylen <= 0)
|
||||
errx(1, "failed to public encrypt: %d", (int)keylen);
|
||||
|
||||
|
||||
if (keylen > RSA_size(rsa))
|
||||
errx(1, "keylen > RSA_size(rsa)");
|
||||
|
||||
|
||||
keylen = RSA_private_decrypt(keylen, res, res2, rsa, padding);
|
||||
if (keylen <= 0)
|
||||
errx(1, "failed to private decrypt: %d", (int)keylen);
|
||||
|
||||
if (keylen != len)
|
||||
errx(1, "output buffer not same length: %d", (int)keylen);
|
||||
|
||||
|
||||
if (memcmp(res2, in, len) != 0)
|
||||
errx(1, "string not the same after decryption");
|
||||
|
||||
@@ -153,24 +153,24 @@ read_key(ENGINE *engine, const char *rsa_key)
|
||||
size_t size;
|
||||
RSA *rsa;
|
||||
FILE *f;
|
||||
|
||||
|
||||
f = fopen(rsa_key, "r");
|
||||
if (f == NULL)
|
||||
err(1, "could not open file %s", rsa_key);
|
||||
rk_cloexec_file(f);
|
||||
|
||||
|
||||
size = fread(buf, 1, sizeof(buf), f);
|
||||
fclose(f);
|
||||
if (size == 0)
|
||||
err(1, "failed to read file %s", rsa_key);
|
||||
if (size == sizeof(buf))
|
||||
err(1, "key too long in file %s!", rsa_key);
|
||||
|
||||
|
||||
p = buf;
|
||||
rsa = d2i_RSAPrivateKey(NULL, &p, size);
|
||||
if (rsa == NULL)
|
||||
err(1, "failed to parse key in file %s", rsa_key);
|
||||
|
||||
|
||||
RSA_set_method(rsa, ENGINE_get_RSA(engine));
|
||||
|
||||
if (!key_blinding)
|
||||
@@ -204,7 +204,7 @@ main(int argc, char **argv)
|
||||
|
||||
if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &idx))
|
||||
usage(1);
|
||||
|
||||
|
||||
if (help_flag)
|
||||
usage(0);
|
||||
|
||||
@@ -230,7 +230,7 @@ main(int argc, char **argv)
|
||||
|
||||
if (ENGINE_get_RSA(engine) == NULL)
|
||||
return 77;
|
||||
|
||||
|
||||
printf("rsa %s\n", ENGINE_get_RSA(engine)->name);
|
||||
|
||||
if (RAND_status() != 1)
|
||||
@@ -260,8 +260,8 @@ main(int argc, char **argv)
|
||||
gettimeofday(&tv2, NULL);
|
||||
timevalsub(&tv2, &tv1);
|
||||
|
||||
printf("time %lu.%06lu\n",
|
||||
(unsigned long)tv2.tv_sec,
|
||||
printf("time %lu.%06lu\n",
|
||||
(unsigned long)tv2.tv_sec,
|
||||
(unsigned long)tv2.tv_usec);
|
||||
|
||||
BN_free(e);
|
||||
@@ -289,8 +289,8 @@ main(int argc, char **argv)
|
||||
|
||||
timevalsub(&tv2, &tv1);
|
||||
|
||||
printf("time %lu.%06lu\n",
|
||||
(unsigned long)tv2.tv_sec,
|
||||
printf("time %lu.%06lu\n",
|
||||
(unsigned long)tv2.tv_sec,
|
||||
(unsigned long)tv2.tv_usec);
|
||||
|
||||
RSA_free(rsa);
|
||||
@@ -310,16 +310,16 @@ main(int argc, char **argv)
|
||||
*/
|
||||
{
|
||||
const unsigned char sha1[20] = {
|
||||
0x6d, 0x33, 0xf9, 0x40, 0x75, 0x5b, 0x4e, 0xc5, 0x90, 0x35,
|
||||
0x6d, 0x33, 0xf9, 0x40, 0x75, 0x5b, 0x4e, 0xc5, 0x90, 0x35,
|
||||
0x48, 0xab, 0x75, 0x02, 0x09, 0x76, 0x9a, 0xb4, 0x7d, 0x6b
|
||||
};
|
||||
|
||||
|
||||
check_rsa(sha1, sizeof(sha1), rsa, RSA_PKCS1_PADDING);
|
||||
}
|
||||
|
||||
for (i = 0; i < 128; i++) {
|
||||
unsigned char sha1[20];
|
||||
|
||||
|
||||
RAND_bytes(sha1, sizeof(sha1));
|
||||
check_rsa(sha1, sizeof(sha1), rsa, RSA_PKCS1_PADDING);
|
||||
}
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2000, 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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.
|
||||
* 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.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -58,7 +58,7 @@ intr(int sig)
|
||||
#endif
|
||||
|
||||
static int
|
||||
read_string(const char *preprompt, const char *prompt,
|
||||
read_string(const char *preprompt, const char *prompt,
|
||||
char *buf, size_t len, int echo)
|
||||
{
|
||||
struct sigaction sigs[NSIG];
|
||||
@@ -80,7 +80,7 @@ read_string(const char *preprompt, const char *prompt,
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
for(i = 1; i < sizeof(sigs) / sizeof(sigs[0]); i++)
|
||||
if (i != SIGALRM)
|
||||
if (i != SIGALRM)
|
||||
if (sigaction(i, &sa, &sigs[i]) == 0)
|
||||
oksigs[i] = 1;
|
||||
|
||||
@@ -88,7 +88,7 @@ read_string(const char *preprompt, const char *prompt,
|
||||
rk_cloexec_file(tty);
|
||||
else
|
||||
tty = stdin;
|
||||
|
||||
|
||||
fprintf(stderr, "%s%s", preprompt, prompt);
|
||||
fflush(stderr);
|
||||
|
||||
@@ -116,19 +116,19 @@ read_string(const char *preprompt, const char *prompt,
|
||||
if(of)
|
||||
p--;
|
||||
*p = 0;
|
||||
|
||||
|
||||
if(echo == 0){
|
||||
fprintf(stderr, "\n");
|
||||
tcsetattr(fileno(tty), TCSANOW, &t_old);
|
||||
}
|
||||
|
||||
|
||||
if(tty != stdin)
|
||||
fclose(tty);
|
||||
|
||||
for(i = 1; i < sizeof(sigs) / sizeof(sigs[0]); i++)
|
||||
if (oksigs[i])
|
||||
sigaction(i, &sigs[i], NULL);
|
||||
|
||||
|
||||
if(ret)
|
||||
return -3;
|
||||
if(intr_flag)
|
||||
|
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
Reference in New Issue
Block a user