beecrypt-4.2.1/0000777000175000001440000000000011226307270010334 500000000000000beecrypt-4.2.1/aes.c0000644000175000001440000002620111216516467011176 00000000000000/* * Copyright (c) 2002, 2003, 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file aes.c * \brief AES block cipher, as specified by NIST FIPS 197. * * The table lookup method was inspired by Brian Gladman's AES implementation, * which is much more readable than the standard code. * * \author Bob Deblier * \ingroup BC_aes_m BC_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #ifdef OPTIMIZE_MMX # include #endif #include "beecrypt/aes.h" #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN) # if (BYTE_ORDER != BIG_ENDIAN) && (BYTE_ORDER != LITTLE_ENDIAN) # error unsupported endian-ness. # endif #endif #if WORDS_BIGENDIAN # include "beecrypt/aes_be.h" #else # include "beecrypt/aes_le.h" #endif #ifdef ASM_AESENCRYPTECB extern int aesEncryptECB(aesParam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_AESDECRYPTECB extern int aesDecryptECB(aesParam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_AESENCRYPTCBC extern int aesEncryptCBC(aesParam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_AESDECRYPTCBC extern int aesDecryptCBC(aesParam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_AESENCRYPTCTR extern int aesEncryptCTR(aesParam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_AESDECRYPTCTR extern int aesDecryptCTR(aesParam*, uint32_t*, const uint32_t*, unsigned int); #endif const blockCipher aes = { .name = "AES", .paramsize = sizeof(aesParam), .blocksize = 16, .keybitsmin = 128, .keybitsmax = 256, .keybitsinc = 64, .setup = (blockCipherSetup) aesSetup, .setiv = (blockCipherSetIV) aesSetIV, .setctr = (blockCipherSetCTR) aesSetCTR, .getfb = (blockCipherFeedback) aesFeedback, .raw = { .encrypt = (blockCipherRawcrypt) aesEncrypt, .decrypt = (blockCipherRawcrypt) aesDecrypt }, .ecb = { #ifdef ASM_AESENCRYPTECB .encrypt = (blockCipherModcrypt) aesEncryptECB, #else .encrypt = (blockCipherModcrypt) 0, #endif #ifdef ASM_AESDECRYPTECB .decrypt = (blockCipherModcrypt) aesDecryptECB, #else .decrypt = (blockCipherModcrypt) 0, #endif }, .cbc = { #ifdef ASM_AESENCRYPTCBC .encrypt = (blockCipherModcrypt) aesEncryptCBC, #else .encrypt = (blockCipherModcrypt) 0, #endif #ifdef ASM_AESDECRYPTCBC .decrypt = (blockCipherModcrypt) aesDecryptCBC, #else .decrypt = (blockCipherModcrypt) 0 #endif }, .ctr = { #ifdef ASM_AESENCRYPTCTR .encrypt = (blockCipherModcrypt) aesEncryptCTR, #else .encrypt = (blockCipherModcrypt) 0, #endif #ifdef ASM_AESDECRYPTCTR .decrypt = (blockCipherModcrypt) aesDecryptCTR, #else .decrypt = (blockCipherModcrypt) 0 #endif } }; int aesSetup(aesParam* ap, const byte* key, size_t keybits, cipherOperation op) { if ((op != ENCRYPT) && (op != DECRYPT)) return -1; if (((keybits & 63) == 0) && (keybits >= 128) && (keybits <= 256)) { register uint32_t* rk, t, i, j; /* clear fdback/iv */ ap->fdback[0] = 0; ap->fdback[1] = 0; ap->fdback[2] = 0; ap->fdback[3] = 0; ap->nr = 6 + (keybits >> 5); rk = ap->k; memcpy(rk, key, keybits >> 3); i = 0; if (keybits == 128) { while (1) { t = rk[3]; #if WORDS_BIGENDIAN t = (_ae4[(t >> 16) & 0xff] & 0xff000000) ^ (_ae4[(t >> 8) & 0xff] & 0x00ff0000) ^ (_ae4[(t ) & 0xff] & 0x0000ff00) ^ (_ae4[(t >> 24) ] & 0x000000ff) ^ _arc[i]; #else t = (_ae4[(t >> 8) & 0xff] & 0x000000ff) ^ (_ae4[(t >> 16) & 0xff] & 0x0000ff00) ^ (_ae4[(t >> 24) ] & 0x00ff0000) ^ (_ae4[(t ) & 0xff] & 0xff000000) ^ _arc[i]; #endif rk[4] = (t ^= rk[0]); rk[5] = (t ^= rk[1]); rk[6] = (t ^= rk[2]); rk[7] = (t ^= rk[3]); if (++i == 10) break; rk += 4; } } else if (keybits == 192) { while (1) { t = rk[5]; #if WORDS_BIGENDIAN t = (_ae4[(t >> 16) & 0xff] & 0xff000000) ^ (_ae4[(t >> 8) & 0xff] & 0x00ff0000) ^ (_ae4[(t ) & 0xff] & 0x0000ff00) ^ (_ae4[(t >> 24) ] & 0x000000ff) ^ _arc[i]; #else t = (_ae4[(t >> 8) & 0xff] & 0x000000ff) ^ (_ae4[(t >> 16) & 0xff] & 0x0000ff00) ^ (_ae4[(t >> 24) ] & 0x00ff0000) ^ (_ae4[(t ) & 0xff] & 0xff000000) ^ _arc[i]; #endif rk[6] = (t ^= rk[0]); rk[7] = (t ^= rk[1]); rk[8] = (t ^= rk[2]); rk[9] = (t ^= rk[3]); if (++i == 8) break; rk[10] = (t ^= rk[4]); rk[11] = (t ^= rk[5]); rk += 6; } } else if (keybits == 256) { while (1) { t = rk[7]; #if WORDS_BIGENDIAN t = (_ae4[(t >> 16) & 0xff] & 0xff000000) ^ (_ae4[(t >> 8) & 0xff] & 0x00ff0000) ^ (_ae4[(t ) & 0xff] & 0x0000ff00) ^ (_ae4[(t >> 24) ] & 0x000000ff) ^ _arc[i]; #else t = (_ae4[(t >> 8) & 0xff] & 0x000000ff) ^ (_ae4[(t >> 16) & 0xff] & 0x0000ff00) ^ (_ae4[(t >> 24) ] & 0x00ff0000) ^ (_ae4[(t ) & 0xff] & 0xff000000) ^ _arc[i]; #endif rk[8] = (t ^= rk[0]); rk[9] = (t ^= rk[1]); rk[10] = (t ^= rk[2]); rk[11] = (t ^= rk[3]); if (++i == 7) break; #if WORDS_BIGENDIAN t = (_ae4[(t >> 24) ] & 0xff000000) ^ (_ae4[(t >> 16) & 0xff] & 0x00ff0000) ^ (_ae4[(t >> 8) & 0xff] & 0x0000ff00) ^ (_ae4[(t ) & 0xff] & 0x000000ff); #else t = (_ae4[(t ) & 0xff] & 0x000000ff) ^ (_ae4[(t >> 8) & 0xff] & 0x0000ff00) ^ (_ae4[(t >> 16) & 0xff] & 0x00ff0000) ^ (_ae4[(t >> 24) ] & 0xff000000); #endif rk[12] = (t ^= rk[4]); rk[13] = (t ^= rk[5]); rk[14] = (t ^= rk[6]); rk[15] = (t ^= rk[7]); rk += 8; } } if (op == DECRYPT) { rk = ap->k; for (i = 0, j = (ap->nr << 2); i < j; i += 4, j -= 4) { t = rk[i ]; rk[i ] = rk[j ]; rk[j ] = t; t = rk[i+1]; rk[i+1] = rk[j+1]; rk[j+1] = t; t = rk[i+2]; rk[i+2] = rk[j+2]; rk[j+2] = t; t = rk[i+3]; rk[i+3] = rk[j+3]; rk[j+3] = t; } for (i = 1; i < ap->nr; i++) { rk += 4; #if WORDS_BIGENDIAN rk[0] = _ad0[_ae4[(rk[0] >> 24) ] & 0xff] ^ _ad1[_ae4[(rk[0] >> 16) & 0xff] & 0xff] ^ _ad2[_ae4[(rk[0] >> 8) & 0xff] & 0xff] ^ _ad3[_ae4[(rk[0] ) & 0xff] & 0xff]; rk[1] = _ad0[_ae4[(rk[1] >> 24) ] & 0xff] ^ _ad1[_ae4[(rk[1] >> 16) & 0xff] & 0xff] ^ _ad2[_ae4[(rk[1] >> 8) & 0xff] & 0xff] ^ _ad3[_ae4[(rk[1] ) & 0xff] & 0xff]; rk[2] = _ad0[_ae4[(rk[2] >> 24) ] & 0xff] ^ _ad1[_ae4[(rk[2] >> 16) & 0xff] & 0xff] ^ _ad2[_ae4[(rk[2] >> 8) & 0xff] & 0xff] ^ _ad3[_ae4[(rk[2] ) & 0xff] & 0xff]; rk[3] = _ad0[_ae4[(rk[3] >> 24) ] & 0xff] ^ _ad1[_ae4[(rk[3] >> 16) & 0xff] & 0xff] ^ _ad2[_ae4[(rk[3] >> 8) & 0xff] & 0xff] ^ _ad3[_ae4[(rk[3] ) & 0xff] & 0xff]; #else rk[0] = _ad0[_ae4[(rk[0] ) & 0xff] & 0xff] ^ _ad1[_ae4[(rk[0] >> 8) & 0xff] & 0xff] ^ _ad2[_ae4[(rk[0] >> 16) & 0xff] & 0xff] ^ _ad3[_ae4[(rk[0] >> 24) ] & 0xff]; rk[1] = _ad0[_ae4[(rk[1] ) & 0xff] & 0xff] ^ _ad1[_ae4[(rk[1] >> 8) & 0xff] & 0xff] ^ _ad2[_ae4[(rk[1] >> 16) & 0xff] & 0xff] ^ _ad3[_ae4[(rk[1] >> 24) ] & 0xff]; rk[2] = _ad0[_ae4[(rk[2] ) & 0xff] & 0xff] ^ _ad1[_ae4[(rk[2] >> 8) & 0xff] & 0xff] ^ _ad2[_ae4[(rk[2] >> 16) & 0xff] & 0xff] ^ _ad3[_ae4[(rk[2] >> 24) ] & 0xff]; rk[3] = _ad0[_ae4[(rk[3] ) & 0xff] & 0xff] ^ _ad1[_ae4[(rk[3] >> 8) & 0xff] & 0xff] ^ _ad2[_ae4[(rk[3] >> 16) & 0xff] & 0xff] ^ _ad3[_ae4[(rk[3] >> 24) ] & 0xff]; #endif } } return 0; } return -1; } #ifndef ASM_AESSETIV int aesSetIV(aesParam* ap, const byte* iv) { if (iv) memcpy(ap->fdback, iv, 16); else memset(ap->fdback, 0, 16); return 0; } #endif #ifndef ASM_AESSETCTR int aesSetCTR(aesParam* ap, const byte* nivz, size_t counter) { unsigned int blockwords = MP_BYTES_TO_WORDS(16); if (nivz) { mpw tmp[MP_BYTES_TO_WORDS(16)]; os2ip((mpw*) ap->fdback, blockwords, nivz, 16); mpsetws(blockwords, tmp, counter); mpadd(blockwords, (mpw*) ap->fdback, tmp); } else mpsetws(blockwords, (mpw*) ap->fdback, counter); return 0; } #endif #ifndef ASM_AESENCRYPT int aesEncrypt(aesParam* ap, uint32_t* dst, const uint32_t* src) { #if defined (OPTIMIZE_MMX) && (defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)) register __m64 s0, s1, s2, s3; register __m64 t0, t1, t2, t3; register uint32_t i0, i1, i2, i3; #else register uint32_t s0, s1, s2, s3; register uint32_t t0, t1, t2, t3; #endif register uint32_t* rk = ap->k; #if defined (OPTIMIZE_MMX) && (defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)) s0 = _mm_cvtsi32_si64(src[0] ^ rk[0]); s1 = _mm_cvtsi32_si64(src[1] ^ rk[1]); s2 = _mm_cvtsi32_si64(src[2] ^ rk[2]); s3 = _mm_cvtsi32_si64(src[3] ^ rk[3]); #else s0 = src[0] ^ rk[0]; s1 = src[1] ^ rk[1]; s2 = src[2] ^ rk[2]; s3 = src[3] ^ rk[3]; #endif etfs(4); /* round 1 */ esft(8); /* round 2 */ etfs(12); /* round 3 */ esft(16); /* round 4 */ etfs(20); /* round 5 */ esft(24); /* round 6 */ etfs(28); /* round 7 */ esft(32); /* round 8 */ etfs(36); /* round 9 */ if (ap->nr > 10) { esft(40); /* round 10 */ etfs(44); /* round 11 */ if (ap->nr > 12) { esft(48); /* round 12 */ etfs(52); /* round 13 */ } } rk += (ap->nr << 2); elr(); /* last round */ #if defined(OPTIMIZE_MMX) && (defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)) dst[0] = _mm_cvtsi64_si32(s0); dst[1] = _mm_cvtsi64_si32(s1); dst[2] = _mm_cvtsi64_si32(s2); dst[3] = _mm_cvtsi64_si32(s3); #else dst[0] = s0; dst[1] = s1; dst[2] = s2; dst[3] = s3; #endif return 0; } #endif #ifndef ASM_AESDECRYPT int aesDecrypt(aesParam* ap, uint32_t* dst, const uint32_t* src) { register uint32_t s0, s1, s2, s3; register uint32_t t0, t1, t2, t3; register uint32_t* rk = ap->k; s0 = src[0] ^ rk[0]; s1 = src[1] ^ rk[1]; s2 = src[2] ^ rk[2]; s3 = src[3] ^ rk[3]; dtfs(4); /* round 1 */ dsft(8); /* round 2 */ dtfs(12); /* round 3 */ dsft(16); /* round 4 */ dtfs(20); /* round 5 */ dsft(24); /* round 6 */ dtfs(28); /* round 7 */ dsft(32); /* round 8 */ dtfs(36); /* round 9 */ if (ap->nr > 10) { dsft(40); /* round 10 */ dtfs(44); /* round 11 */ if (ap->nr > 12) { dsft(48); /* round 12 */ dtfs(52); /* round 13 */ } } rk += (ap->nr << 2); dlr(); /* last round */ dst[0] = s0; dst[1] = s1; dst[2] = s2; dst[3] = s3; return 0; } #endif uint32_t* aesFeedback(aesParam* ap) { return ap->fdback; } beecrypt-4.2.1/sha1.c0000644000175000001440000002016711216402155011253 00000000000000/* * Copyright (c) 1997, 1998, 1999, 2000, 2001 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha1.c * \brief SHA-1 hash function, as specified by NIST FIPS 180-1. * \author Bob Deblier * \ingroup HASH_m HASH_sha1_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha1.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_sha1_m * \{ */ static const uint32_t k[4] = { 0x5a827999U, 0x6ed9eba1U, 0x8f1bbcdcU, 0xca62c1d6U }; static const uint32_t hinit[5] = { 0x67452301U, 0xefcdab89U, 0x98badcfeU, 0x10325476U, 0xc3d2e1f0U }; const hashFunction sha1 = { .name = "SHA-1", .paramsize = sizeof(sha1Param), .blocksize = 64, .digestsize = 20, .reset = (hashFunctionReset) sha1Reset, .update = (hashFunctionUpdate) sha1Update, .digest = (hashFunctionDigest) sha1Digest }; int sha1Reset(register sha1Param* p) { memcpy(p->h, hinit, 5 * sizeof(uint32_t)); memset(p->data, 0, 80 * sizeof(uint32_t)); #if (MP_WBITS == 64) mpzero(1, p->length); #elif (MP_WBITS == 32) mpzero(2, p->length); #else # error #endif p->offset = 0; return 0; } #define SUBROUND1(a, b, c, d, e, w, k) \ e = ROTL32(a, 5) + ((b&(c^d))^d) + e + w + k; \ b = ROTR32(b, 2) #define SUBROUND2(a, b, c, d, e, w, k) \ e = ROTL32(a, 5) + (b^c^d) + e + w + k; \ b = ROTR32(b, 2) #define SUBROUND3(a, b, c, d, e, w, k) \ e = ROTL32(a, 5) + (((b|c)&d)|(b&c)) + e + w + k; \ b = ROTR32(b, 2) #define SUBROUND4(a, b, c, d, e, w, k) \ e = ROTL32(a, 5) + (b^c^d) + e + w + k; \ b = ROTR32(b, 2) #ifndef ASM_SHA1PROCESS void sha1Process(sha1Param* sp) { register uint32_t a, b, c, d, e; register uint32_t *w; register byte t; #if WORDS_BIGENDIAN w = sp->data + 16; #else w = sp->data; t = 16; while (t--) { register uint32_t temp = swapu32(*w); *(w++) = temp; } #endif t = 64; while (t--) { register uint32_t temp = w[-3] ^ w[-8] ^ w[-14] ^ w[-16]; *(w++) = ROTL32(temp, 1); } w = sp->data; a = sp->h[0]; b = sp->h[1]; c = sp->h[2]; d = sp->h[3]; e = sp->h[4]; SUBROUND1(a,b,c,d,e,w[ 0],k[0]); SUBROUND1(e,a,b,c,d,w[ 1],k[0]); SUBROUND1(d,e,a,b,c,w[ 2],k[0]); SUBROUND1(c,d,e,a,b,w[ 3],k[0]); SUBROUND1(b,c,d,e,a,w[ 4],k[0]); SUBROUND1(a,b,c,d,e,w[ 5],k[0]); SUBROUND1(e,a,b,c,d,w[ 6],k[0]); SUBROUND1(d,e,a,b,c,w[ 7],k[0]); SUBROUND1(c,d,e,a,b,w[ 8],k[0]); SUBROUND1(b,c,d,e,a,w[ 9],k[0]); SUBROUND1(a,b,c,d,e,w[10],k[0]); SUBROUND1(e,a,b,c,d,w[11],k[0]); SUBROUND1(d,e,a,b,c,w[12],k[0]); SUBROUND1(c,d,e,a,b,w[13],k[0]); SUBROUND1(b,c,d,e,a,w[14],k[0]); SUBROUND1(a,b,c,d,e,w[15],k[0]); SUBROUND1(e,a,b,c,d,w[16],k[0]); SUBROUND1(d,e,a,b,c,w[17],k[0]); SUBROUND1(c,d,e,a,b,w[18],k[0]); SUBROUND1(b,c,d,e,a,w[19],k[0]); SUBROUND2(a,b,c,d,e,w[20],k[1]); SUBROUND2(e,a,b,c,d,w[21],k[1]); SUBROUND2(d,e,a,b,c,w[22],k[1]); SUBROUND2(c,d,e,a,b,w[23],k[1]); SUBROUND2(b,c,d,e,a,w[24],k[1]); SUBROUND2(a,b,c,d,e,w[25],k[1]); SUBROUND2(e,a,b,c,d,w[26],k[1]); SUBROUND2(d,e,a,b,c,w[27],k[1]); SUBROUND2(c,d,e,a,b,w[28],k[1]); SUBROUND2(b,c,d,e,a,w[29],k[1]); SUBROUND2(a,b,c,d,e,w[30],k[1]); SUBROUND2(e,a,b,c,d,w[31],k[1]); SUBROUND2(d,e,a,b,c,w[32],k[1]); SUBROUND2(c,d,e,a,b,w[33],k[1]); SUBROUND2(b,c,d,e,a,w[34],k[1]); SUBROUND2(a,b,c,d,e,w[35],k[1]); SUBROUND2(e,a,b,c,d,w[36],k[1]); SUBROUND2(d,e,a,b,c,w[37],k[1]); SUBROUND2(c,d,e,a,b,w[38],k[1]); SUBROUND2(b,c,d,e,a,w[39],k[1]); SUBROUND3(a,b,c,d,e,w[40],k[2]); SUBROUND3(e,a,b,c,d,w[41],k[2]); SUBROUND3(d,e,a,b,c,w[42],k[2]); SUBROUND3(c,d,e,a,b,w[43],k[2]); SUBROUND3(b,c,d,e,a,w[44],k[2]); SUBROUND3(a,b,c,d,e,w[45],k[2]); SUBROUND3(e,a,b,c,d,w[46],k[2]); SUBROUND3(d,e,a,b,c,w[47],k[2]); SUBROUND3(c,d,e,a,b,w[48],k[2]); SUBROUND3(b,c,d,e,a,w[49],k[2]); SUBROUND3(a,b,c,d,e,w[50],k[2]); SUBROUND3(e,a,b,c,d,w[51],k[2]); SUBROUND3(d,e,a,b,c,w[52],k[2]); SUBROUND3(c,d,e,a,b,w[53],k[2]); SUBROUND3(b,c,d,e,a,w[54],k[2]); SUBROUND3(a,b,c,d,e,w[55],k[2]); SUBROUND3(e,a,b,c,d,w[56],k[2]); SUBROUND3(d,e,a,b,c,w[57],k[2]); SUBROUND3(c,d,e,a,b,w[58],k[2]); SUBROUND3(b,c,d,e,a,w[59],k[2]); SUBROUND4(a,b,c,d,e,w[60],k[3]); SUBROUND4(e,a,b,c,d,w[61],k[3]); SUBROUND4(d,e,a,b,c,w[62],k[3]); SUBROUND4(c,d,e,a,b,w[63],k[3]); SUBROUND4(b,c,d,e,a,w[64],k[3]); SUBROUND4(a,b,c,d,e,w[65],k[3]); SUBROUND4(e,a,b,c,d,w[66],k[3]); SUBROUND4(d,e,a,b,c,w[67],k[3]); SUBROUND4(c,d,e,a,b,w[68],k[3]); SUBROUND4(b,c,d,e,a,w[69],k[3]); SUBROUND4(a,b,c,d,e,w[70],k[3]); SUBROUND4(e,a,b,c,d,w[71],k[3]); SUBROUND4(d,e,a,b,c,w[72],k[3]); SUBROUND4(c,d,e,a,b,w[73],k[3]); SUBROUND4(b,c,d,e,a,w[74],k[3]); SUBROUND4(a,b,c,d,e,w[75],k[3]); SUBROUND4(e,a,b,c,d,w[76],k[3]); SUBROUND4(d,e,a,b,c,w[77],k[3]); SUBROUND4(c,d,e,a,b,w[78],k[3]); SUBROUND4(b,c,d,e,a,w[79],k[3]); sp->h[0] += a; sp->h[1] += b; sp->h[2] += c; sp->h[3] += d; sp->h[4] += e; } #endif int sha1Update(sha1Param* sp, const byte* data, size_t size) { register uint32_t proclength; #if (MP_WBITS == 64) mpw add[1]; mpsetw(1, add, size); mplshift(1, add, 3); (void) mpadd(1, sp->length, add); #elif (MP_WBITS == 32) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); (void) mpadd(2, sp->length, add); #else # error #endif while (size > 0) { proclength = ((sp->offset + size) > 64U) ? (64U - sp->offset) : size; memcpy(((byte *) sp->data) + sp->offset, data, proclength); size -= proclength; data += proclength; sp->offset += proclength; if (sp->offset == 64U) { sha1Process(sp); sp->offset = 0; } } return 0; } static void sha1Finish(sha1Param* sp) { register byte *ptr = ((byte *) sp->data) + sp->offset++; *(ptr++) = 0x80; if (sp->offset > 56) { while (sp->offset++ < 64) *(ptr++) = 0; sha1Process(sp); sp->offset = 0; } ptr = ((byte*) sp->data) + sp->offset; while (sp->offset++ < 56) *(ptr++) = 0; #if WORDS_BIGENDIAN memcpy(ptr, sp->length, 8); #else # if (MP_WBITS == 64) ptr[0] = (byte)(sp->length[0] >> 56); ptr[1] = (byte)(sp->length[0] >> 48); ptr[2] = (byte)(sp->length[0] >> 40); ptr[3] = (byte)(sp->length[0] >> 32); ptr[4] = (byte)(sp->length[0] >> 24); ptr[5] = (byte)(sp->length[0] >> 16); ptr[6] = (byte)(sp->length[0] >> 8); ptr[7] = (byte)(sp->length[0] ); #elif (MP_WBITS == 32) ptr[0] = (byte)(sp->length[0] >> 24); ptr[1] = (byte)(sp->length[0] >> 16); ptr[2] = (byte)(sp->length[0] >> 8); ptr[3] = (byte)(sp->length[0] ); ptr[4] = (byte)(sp->length[1] >> 24); ptr[5] = (byte)(sp->length[1] >> 16); ptr[6] = (byte)(sp->length[1] >> 8); ptr[7] = (byte)(sp->length[1] ); # else # error # endif #endif sha1Process(sp); sp->offset = 0; } int sha1Digest(sha1Param* sp, byte* data) { sha1Finish(sp); #if WORDS_BIGENDIAN memcpy(data, sp->h, 20); #else /* encode 5 integers big-endian style */ data[ 0] = (byte)(sp->h[0] >> 24); data[ 1] = (byte)(sp->h[0] >> 16); data[ 2] = (byte)(sp->h[0] >> 8); data[ 3] = (byte)(sp->h[0] >> 0); data[ 4] = (byte)(sp->h[1] >> 24); data[ 5] = (byte)(sp->h[1] >> 16); data[ 6] = (byte)(sp->h[1] >> 8); data[ 7] = (byte)(sp->h[1] >> 0); data[ 8] = (byte)(sp->h[2] >> 24); data[ 9] = (byte)(sp->h[2] >> 16); data[10] = (byte)(sp->h[2] >> 8); data[11] = (byte)(sp->h[2] >> 0); data[12] = (byte)(sp->h[3] >> 24); data[13] = (byte)(sp->h[3] >> 16); data[14] = (byte)(sp->h[3] >> 8); data[15] = (byte)(sp->h[3] >> 0); data[16] = (byte)(sp->h[4] >> 24); data[17] = (byte)(sp->h[4] >> 16); data[18] = (byte)(sp->h[4] >> 8); data[19] = (byte)(sp->h[4] >> 0); #endif sha1Reset(sp); return 0; } /*!\} */ beecrypt-4.2.1/INSTALL0000664000175000001440000001765610063036000011306 00000000000000Basic Installation ================== The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. If you're building GNU make on a system which does not already have a `make', you can use the build.sh shell script to compile. Run `sh ./build.sh'. This should compile the program in the current directory. Then you will have a Make program that you can use for `make install', or whatever else. 3. Optionally, type `./make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. beecrypt-4.2.1/ripemd160.c0000644000175000001440000003321411216403105012117 00000000000000/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file ripemd160.c * \brief RIPEMD-160 hash function. * \author Jeff Johnson * \author Bob Deblier * \ingroup HASH_m HASH_ripemd160_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/ripemd160.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_ripemd160_m * \{ */ /*@unchecked@*/ /*@observer@*/ static uint32_t ripemd160hinit[5] = { 0x67452301U, 0xefcdab89U, 0x98badcfeU, 0x10325476U, 0xc3d2e1f0U }; /*@-sizeoftype@*/ /*@unchecked@*/ /*@observer@*/ const hashFunction ripemd160 = { .name = "RIPEMD-160", .paramsize = sizeof(ripemd160Param), .blocksize = 64, .digestsize = 20, .reset = (hashFunctionReset) ripemd160Reset, .update = (hashFunctionUpdate) ripemd160Update, .digest = (hashFunctionDigest) ripemd160Digest }; /*@=sizeoftype@*/ int ripemd160Reset(register ripemd160Param* mp) { /*@-sizeoftype@*/ memcpy(mp->h, ripemd160hinit, 5 * sizeof(uint32_t)); memset(mp->data, 0, 16 * sizeof(uint32_t)); /*@=sizeoftype@*/ #if (MP_WBITS == 64) mpzero(1, mp->length); #elif (MP_WBITS == 32) mpzero(2, mp->length); #else # error #endif mp->offset = 0; return 0; } #define LSR1(a, b, c, d, e, x, s) \ a = ROTL32((b^c^d) + a + x, s) + e;\ c = ROTL32(c, 10); #define LSR2(a, b, c, d, e, x, s) \ a = ROTL32(((b&c)|(~b&d)) + a + x + 0x5a827999U, s) + e;\ c = ROTL32(c, 10); #define LSR3(a, b, c, d, e, x, s) \ a = ROTL32(((b|~c)^d) + a + x + 0x6ed9eba1U, s) + e; \ c = ROTL32(c, 10); #define LSR4(a, b, c, d, e, x, s) \ a = ROTL32(((b&d)|(c&~d)) + a + x + 0x8f1bbcdcU, s) + e; \ c = ROTL32(c, 10); #define LSR5(a, b, c, d, e, x, s) \ a = ROTL32((b^(c|~d)) + a + x + 0xa953fd4eU, s) + e; \ c = ROTL32(c, 10); #define RSR5(a, b, c, d, e, x, s) \ a = ROTL32((b^c^d) + a + x, s) + e;\ c = ROTL32(c, 10); #define RSR4(a, b, c, d, e, x, s) \ a = ROTL32(((b&c)|(~b&d)) + a + x + 0x7a6d76e9U, s) + e;\ c = ROTL32(c, 10); #define RSR3(a, b, c, d, e, x, s) \ a = ROTL32(((b|~c)^d) + a + x + 0x6d703ef3U, s) + e; \ c = ROTL32(c, 10); #define RSR2(a, b, c, d, e, x, s) \ a = ROTL32(((b&d)|(c&~d)) + a + x + 0x5c4dd124U, s) + e; \ c = ROTL32(c, 10); #define RSR1(a, b, c, d, e, x, s) \ a = ROTL32((b^(c|~d)) + a + x + 0x50a28be6U, s) + e; \ c = ROTL32(c, 10); #ifndef ASM_RIPEMD160PROCESS void ripemd160Process(ripemd160Param* mp) { register uint32_t la, lb, lc, ld, le; register uint32_t ra, rb, rc, rd, re; register uint32_t* x; #ifdef WORDS_BIGENDIAN register byte t; #endif x = mp->data; #ifdef WORDS_BIGENDIAN t = 16; while (t--) { register uint32_t temp = swapu32(*x); *(x++) = temp; } x = mp->data; #endif la = mp->h[0]; lb = mp->h[1]; lc = mp->h[2]; ld = mp->h[3]; le = mp->h[4]; ra = mp->h[0]; rb = mp->h[1]; rc = mp->h[2]; rd = mp->h[3]; re = mp->h[4]; /* In theory OpenMP would allows us to do the 'left' and 'right' sections in parallel, * but in practice the overhead make the code much slower */ /* left round 1 */ LSR1(la, lb, lc, ld, le, x[ 0], 11); LSR1(le, la, lb, lc, ld, x[ 1], 14); LSR1(ld, le, la, lb, lc, x[ 2], 15); LSR1(lc, ld, le, la, lb, x[ 3], 12); LSR1(lb, lc, ld, le, la, x[ 4], 5); LSR1(la, lb, lc, ld, le, x[ 5], 8); LSR1(le, la, lb, lc, ld, x[ 6], 7); LSR1(ld, le, la, lb, lc, x[ 7], 9); LSR1(lc, ld, le, la, lb, x[ 8], 11); LSR1(lb, lc, ld, le, la, x[ 9], 13); LSR1(la, lb, lc, ld, le, x[10], 14); LSR1(le, la, lb, lc, ld, x[11], 15); LSR1(ld, le, la, lb, lc, x[12], 6); LSR1(lc, ld, le, la, lb, x[13], 7); LSR1(lb, lc, ld, le, la, x[14], 9); LSR1(la, lb, lc, ld, le, x[15], 8); /* left round 2 */ LSR2(le, la, lb, lc, ld, x[ 7], 7); LSR2(ld, le, la, lb, lc, x[ 4], 6); LSR2(lc, ld, le, la, lb, x[13], 8); LSR2(lb, lc, ld, le, la, x[ 1], 13); LSR2(la, lb, lc, ld, le, x[10], 11); LSR2(le, la, lb, lc, ld, x[ 6], 9); LSR2(ld, le, la, lb, lc, x[15], 7); LSR2(lc, ld, le, la, lb, x[ 3], 15); LSR2(lb, lc, ld, le, la, x[12], 7); LSR2(la, lb, lc, ld, le, x[ 0], 12); LSR2(le, la, lb, lc, ld, x[ 9], 15); LSR2(ld, le, la, lb, lc, x[ 5], 9); LSR2(lc, ld, le, la, lb, x[ 2], 11); LSR2(lb, lc, ld, le, la, x[14], 7); LSR2(la, lb, lc, ld, le, x[11], 13); LSR2(le, la, lb, lc, ld, x[ 8], 12); /* left round 3 */ LSR3(ld, le, la, lb, lc, x[ 3], 11); LSR3(lc, ld, le, la, lb, x[10], 13); LSR3(lb, lc, ld, le, la, x[14], 6); LSR3(la, lb, lc, ld, le, x[ 4], 7); LSR3(le, la, lb, lc, ld, x[ 9], 14); LSR3(ld, le, la, lb, lc, x[15], 9); LSR3(lc, ld, le, la, lb, x[ 8], 13); LSR3(lb, lc, ld, le, la, x[ 1], 15); LSR3(la, lb, lc, ld, le, x[ 2], 14); LSR3(le, la, lb, lc, ld, x[ 7], 8); LSR3(ld, le, la, lb, lc, x[ 0], 13); LSR3(lc, ld, le, la, lb, x[ 6], 6); LSR3(lb, lc, ld, le, la, x[13], 5); LSR3(la, lb, lc, ld, le, x[11], 12); LSR3(le, la, lb, lc, ld, x[ 5], 7); LSR3(ld, le, la, lb, lc, x[12], 5); /* left round 4 */ LSR4(lc, ld, le, la, lb, x[ 1], 11); LSR4(lb, lc, ld, le, la, x[ 9], 12); LSR4(la, lb, lc, ld, le, x[11], 14); LSR4(le, la, lb, lc, ld, x[10], 15); LSR4(ld, le, la, lb, lc, x[ 0], 14); LSR4(lc, ld, le, la, lb, x[ 8], 15); LSR4(lb, lc, ld, le, la, x[12], 9); LSR4(la, lb, lc, ld, le, x[ 4], 8); LSR4(le, la, lb, lc, ld, x[13], 9); LSR4(ld, le, la, lb, lc, x[ 3], 14); LSR4(lc, ld, le, la, lb, x[ 7], 5); LSR4(lb, lc, ld, le, la, x[15], 6); LSR4(la, lb, lc, ld, le, x[14], 8); LSR4(le, la, lb, lc, ld, x[ 5], 6); LSR4(ld, le, la, lb, lc, x[ 6], 5); LSR4(lc, ld, le, la, lb, x[ 2], 12); /* left round 5 */ LSR5(lb, lc, ld, le, la, x[ 4], 9); LSR5(la, lb, lc, ld, le, x[ 0], 15); LSR5(le, la, lb, lc, ld, x[ 5], 5); LSR5(ld, le, la, lb, lc, x[ 9], 11); LSR5(lc, ld, le, la, lb, x[ 7], 6); LSR5(lb, lc, ld, le, la, x[12], 8); LSR5(la, lb, lc, ld, le, x[ 2], 13); LSR5(le, la, lb, lc, ld, x[10], 12); LSR5(ld, le, la, lb, lc, x[14], 5); LSR5(lc, ld, le, la, lb, x[ 1], 12); LSR5(lb, lc, ld, le, la, x[ 3], 13); LSR5(la, lb, lc, ld, le, x[ 8], 14); LSR5(le, la, lb, lc, ld, x[11], 11); LSR5(ld, le, la, lb, lc, x[ 6], 8); LSR5(lc, ld, le, la, lb, x[15], 5); LSR5(lb, lc, ld, le, la, x[13], 6); /* right round 1 */ RSR1(ra, rb, rc, rd, re, x[ 5], 8); RSR1(re, ra, rb, rc, rd, x[14], 9); RSR1(rd, re, ra, rb, rc, x[ 7], 9); RSR1(rc, rd, re, ra, rb, x[ 0], 11); RSR1(rb, rc, rd, re, ra, x[ 9], 13); RSR1(ra, rb, rc, rd, re, x[ 2], 15); RSR1(re, ra, rb, rc, rd, x[11], 15); RSR1(rd, re, ra, rb, rc, x[ 4], 5); RSR1(rc, rd, re, ra, rb, x[13], 7); RSR1(rb, rc, rd, re, ra, x[ 6], 7); RSR1(ra, rb, rc, rd, re, x[15], 8); RSR1(re, ra, rb, rc, rd, x[ 8], 11); RSR1(rd, re, ra, rb, rc, x[ 1], 14); RSR1(rc, rd, re, ra, rb, x[10], 14); RSR1(rb, rc, rd, re, ra, x[ 3], 12); RSR1(ra, rb, rc, rd, re, x[12], 6); /* right round 2 */ RSR2(re, ra, rb, rc, rd, x[ 6], 9); RSR2(rd, re, ra, rb, rc, x[11], 13); RSR2(rc, rd, re, ra, rb, x[ 3], 15); RSR2(rb, rc, rd, re, ra, x[ 7], 7); RSR2(ra, rb, rc, rd, re, x[ 0], 12); RSR2(re, ra, rb, rc, rd, x[13], 8); RSR2(rd, re, ra, rb, rc, x[ 5], 9); RSR2(rc, rd, re, ra, rb, x[10], 11); RSR2(rb, rc, rd, re, ra, x[14], 7); RSR2(ra, rb, rc, rd, re, x[15], 7); RSR2(re, ra, rb, rc, rd, x[ 8], 12); RSR2(rd, re, ra, rb, rc, x[12], 7); RSR2(rc, rd, re, ra, rb, x[ 4], 6); RSR2(rb, rc, rd, re, ra, x[ 9], 15); RSR2(ra, rb, rc, rd, re, x[ 1], 13); RSR2(re, ra, rb, rc, rd, x[ 2], 11); /* right round 3 */ RSR3(rd, re, ra, rb, rc, x[15], 9); RSR3(rc, rd, re, ra, rb, x[ 5], 7); RSR3(rb, rc, rd, re, ra, x[ 1], 15); RSR3(ra, rb, rc, rd, re, x[ 3], 11); RSR3(re, ra, rb, rc, rd, x[ 7], 8); RSR3(rd, re, ra, rb, rc, x[14], 6); RSR3(rc, rd, re, ra, rb, x[ 6], 6); RSR3(rb, rc, rd, re, ra, x[ 9], 14); RSR3(ra, rb, rc, rd, re, x[11], 12); RSR3(re, ra, rb, rc, rd, x[ 8], 13); RSR3(rd, re, ra, rb, rc, x[12], 5); RSR3(rc, rd, re, ra, rb, x[ 2], 14); RSR3(rb, rc, rd, re, ra, x[10], 13); RSR3(ra, rb, rc, rd, re, x[ 0], 13); RSR3(re, ra, rb, rc, rd, x[ 4], 7); RSR3(rd, re, ra, rb, rc, x[13], 5); /* right round 4 */ RSR4(rc, rd, re, ra, rb, x[ 8], 15); RSR4(rb, rc, rd, re, ra, x[ 6], 5); RSR4(ra, rb, rc, rd, re, x[ 4], 8); RSR4(re, ra, rb, rc, rd, x[ 1], 11); RSR4(rd, re, ra, rb, rc, x[ 3], 14); RSR4(rc, rd, re, ra, rb, x[11], 14); RSR4(rb, rc, rd, re, ra, x[15], 6); RSR4(ra, rb, rc, rd, re, x[ 0], 14); RSR4(re, ra, rb, rc, rd, x[ 5], 6); RSR4(rd, re, ra, rb, rc, x[12], 9); RSR4(rc, rd, re, ra, rb, x[ 2], 12); RSR4(rb, rc, rd, re, ra, x[13], 9); RSR4(ra, rb, rc, rd, re, x[ 9], 12); RSR4(re, ra, rb, rc, rd, x[ 7], 5); RSR4(rd, re, ra, rb, rc, x[10], 15); RSR4(rc, rd, re, ra, rb, x[14], 8); /* right round 5 */ RSR5(rb, rc, rd, re, ra, x[12] , 8); RSR5(ra, rb, rc, rd, re, x[15] , 5); RSR5(re, ra, rb, rc, rd, x[10] , 12); RSR5(rd, re, ra, rb, rc, x[ 4] , 9); RSR5(rc, rd, re, ra, rb, x[ 1] , 12); RSR5(rb, rc, rd, re, ra, x[ 5] , 5); RSR5(ra, rb, rc, rd, re, x[ 8] , 14); RSR5(re, ra, rb, rc, rd, x[ 7] , 6); RSR5(rd, re, ra, rb, rc, x[ 6] , 8); RSR5(rc, rd, re, ra, rb, x[ 2] , 13); RSR5(rb, rc, rd, re, ra, x[13] , 6); RSR5(ra, rb, rc, rd, re, x[14] , 5); RSR5(re, ra, rb, rc, rd, x[ 0] , 15); RSR5(rd, re, ra, rb, rc, x[ 3] , 13); RSR5(rc, rd, re, ra, rb, x[ 9] , 11); RSR5(rb, rc, rd, re, ra, x[11] , 11); /* combine results */ rd += lc + mp->h[1]; mp->h[1] = mp->h[2] + ld + re; mp->h[2] = mp->h[3] + le + ra; mp->h[3] = mp->h[4] + la + rb; mp->h[4] = mp->h[0] + lb + rc; mp->h[0] = rd; } #endif int ripemd160Update(ripemd160Param* mp, const byte* data, size_t size) { register uint32_t proclength; #if (MP_WBITS == 64) mpw add[1]; mpsetw(1, add, size); mplshift(1, add, 3); mpadd(1, mp->length, add); #elif (MP_WBITS == 32) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); (void) mpadd(2, mp->length, add); #else # error #endif while (size > 0) { proclength = ((mp->offset + size) > 64U) ? (64U - mp->offset) : size; /*@-mayaliasunique@*/ memcpy(((byte *) mp->data) + mp->offset, data, proclength); /*@=mayaliasunique@*/ size -= proclength; data += proclength; mp->offset += proclength; if (mp->offset == 64U) { ripemd160Process(mp); mp->offset = 0; } } return 0; } static void ripemd160Finish(ripemd160Param* mp) /*@modifies mp @*/ { register byte *ptr = ((byte *) mp->data) + mp->offset++; *(ptr++) = 0x80; if (mp->offset > 56) { while (mp->offset++ < 64) *(ptr++) = 0; ripemd160Process(mp); mp->offset = 0; } ptr = ((byte *) mp->data) + mp->offset; while (mp->offset++ < 56) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[0] = (byte)(mp->length[0] ); ptr[1] = (byte)(mp->length[0] >> 8); ptr[2] = (byte)(mp->length[0] >> 16); ptr[3] = (byte)(mp->length[0] >> 24); ptr[4] = (byte)(mp->length[0] >> 32); ptr[5] = (byte)(mp->length[0] >> 40); ptr[6] = (byte)(mp->length[0] >> 48); ptr[7] = (byte)(mp->length[0] >> 56); #elif (MP_WBITS == 32) ptr[0] = (byte)(mp->length[1] ); ptr[1] = (byte)(mp->length[1] >> 8); ptr[2] = (byte)(mp->length[1] >> 16); ptr[3] = (byte)(mp->length[1] >> 24); ptr[4] = (byte)(mp->length[0] ); ptr[5] = (byte)(mp->length[0] >> 8); ptr[6] = (byte)(mp->length[0] >> 16); ptr[7] = (byte)(mp->length[0] >> 24); #else # error #endif ripemd160Process(mp); mp->offset = 0; } /*@-protoparammatch@*/ int ripemd160Digest(ripemd160Param* mp, byte* data) { ripemd160Finish(mp); /* encode 5 integers little-endian style */ data[ 0] = (byte)(mp->h[0] ); data[ 1] = (byte)(mp->h[0] >> 8); data[ 2] = (byte)(mp->h[0] >> 16); data[ 3] = (byte)(mp->h[0] >> 24); data[ 4] = (byte)(mp->h[1] ); data[ 5] = (byte)(mp->h[1] >> 8); data[ 6] = (byte)(mp->h[1] >> 16); data[ 7] = (byte)(mp->h[1] >> 24); data[ 8] = (byte)(mp->h[2] ); data[ 9] = (byte)(mp->h[2] >> 8); data[10] = (byte)(mp->h[2] >> 16); data[11] = (byte)(mp->h[2] >> 24); data[12] = (byte)(mp->h[3] ); data[13] = (byte)(mp->h[3] >> 8); data[14] = (byte)(mp->h[3] >> 16); data[15] = (byte)(mp->h[3] >> 24); data[16] = (byte)(mp->h[4] ); data[17] = (byte)(mp->h[4] >> 8); data[18] = (byte)(mp->h[4] >> 16); data[19] = (byte)(mp->h[4] >> 24); (void) ripemd160Reset(mp); return 0; } /*@=protoparammatch@*/ /*!\} */ beecrypt-4.2.1/rsa.c0000644000175000001440000001004011216147021011167 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file rsa.c * \brief RSA algorithm. * \author Bob Deblier * \ingroup IF_m IF_rsa_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/rsa.h" int rsapub(const mpbarrett* n, const mpnumber* e, const mpnumber* m, mpnumber* c) { register size_t size = n->size; register mpw* temp; if (mpgex(m->size, m->data, n->size, n->modl)) return -1; temp = (mpw*) malloc((4*size+2)*sizeof(mpw)); if (temp) { mpnsize(c, size); mpbpowmod_w(n, m->size, m->data, e->size, e->data, c->data, temp); free(temp); return 0; } return -1; } int rsapri(const mpbarrett* n, const mpnumber* d, const mpnumber* c, mpnumber* m) { register size_t size = n->size; register mpw* temp; if (mpgex(c->size, c->data, n->size, n->modl)) return -1; temp = (mpw*) malloc((4*size+2)*sizeof(mpw)); if (temp) { mpnsize(m, size); mpbpowmod_w(n, c->size, c->data, d->size, d->data, m->data, temp); free(temp); return 0; } return -1; } int rsapricrt(const mpbarrett* n, const mpbarrett* p, const mpbarrett* q, const mpnumber* dp, const mpnumber* dq, const mpnumber* qi, const mpnumber* c, mpnumber* m) { register size_t nsize = n->size; register size_t psize = p->size; register size_t qsize = q->size; register mpw* ptemp; register mpw* qtemp; if (mpgex(c->size, c->data, n->size, n->modl)) return -1; ptemp = (mpw*) malloc((6*psize+2)*sizeof(mpw)); if (ptemp == (mpw*) 0) return -1; qtemp = (mpw*) malloc((6*qsize+2)*sizeof(mpw)); if (qtemp == (mpw*) 0) { free(ptemp); return -1; } #pragma omp parallel sections { #pragma omp section { /* resize c for powmod p */ mpsetx(psize*2, ptemp, c->size, c->data); /* reduce modulo p before we powmod */ mpbmod_w(p, ptemp, ptemp+psize, ptemp+2*psize); /* compute j1 = c^dp mod p, store @ ptemp */ mpbpowmod_w(p, psize, ptemp+psize, dp->size, dp->data, ptemp, ptemp+2*psize); } #pragma omp section { /* resize c for powmod q */ mpsetx(qsize*2, qtemp, c->size, c->data); /* reduce modulo q before we powmod */ mpbmod_w(q, qtemp, qtemp+qsize, qtemp+2*qsize); /* compute j2 = c^dq mod q, store @ qtemp */ mpbpowmod_w(q, qsize, qtemp+qsize, dq->size, dq->data, qtemp, qtemp+2*qsize); } } /* compute j1-j2 mod p, store @ ptemp */ mpbsubmod_w(p, psize, ptemp, qsize, qtemp, ptemp, ptemp+2*psize); /* compute h = c*(j1-j2) mod p, store @ ptemp */ mpbmulmod_w(p, psize, ptemp, psize, qi->data, ptemp, ptemp+2*psize); /* make sure the message gets the proper size */ mpnsize(m, nsize); /* compute m = h*q + j2 */ mpmul(m->data, psize, ptemp, qsize, q->modl); mpaddx(nsize, m->data, qsize, qtemp); free(ptemp); free(qtemp); return 0; } int rsavrfy(const mpbarrett* n, const mpnumber* e, const mpnumber* m, const mpnumber* c) { int rc = 0; register size_t size = n->size; register mpw* temp; if (mpgex(m->size, m->data, n->size, n->modl)) return rc; if (mpgex(c->size, c->data, n->size, n->modl)) return rc; temp = (mpw*) malloc((5*size+2)*sizeof(mpw)); if (temp) { mpbpowmod_w(n, m->size, m->data, e->size, e->data, temp, temp+size); rc = mpeqx(size, temp, c->size, c->data); free(temp); } return rc; } beecrypt-4.2.1/rsakp.c0000644000175000001440000001076211216147021011535 00000000000000/* * Copyright (c) 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file rsakp.c * \brief RSA keypair. * \author Bob Deblier * \ingroup IF_m IF_rsa_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/rsakp.h" #include "beecrypt/mpprime.h" /*!\addtogroup IF_rsa_m * \{ */ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, size_t bits) { /* * Generates an RSA Keypair for use with the Chinese Remainder Theorem */ size_t pbits = (bits+1) >> 1; size_t qbits = (bits - pbits); size_t nsize = MP_BITS_TO_WORDS(bits+MP_WBITS-1); size_t psize = MP_BITS_TO_WORDS(pbits+MP_WBITS-1); size_t qsize = MP_BITS_TO_WORDS(qbits+MP_WBITS-1); size_t pqsize = psize+qsize; mpw* temp = (mpw*) malloc((16*pqsize+6)*sizeof(mpw)); if (temp) { mpbarrett psubone, qsubone; mpnumber phi, min; mpw* divmod = temp; mpw* dividend = divmod+nsize+1; mpw* workspace = dividend+nsize+1; int shift; /* set e to default value if e is empty */ if (kp->e.size == 0 && !kp->e.data) mpnsetw(&kp->e, 65537U); /* generate a random prime p, so that gcd(p-1,e) = 1 */ mpprnd_w(&kp->p, rgc, pbits, mpptrials(pbits), &kp->e, temp); /* find out how big q should be */ shift = MP_WORDS_TO_BITS(nsize) - bits; mpzero(nsize, dividend); dividend[0] |= MP_MSBMASK; dividend[nsize-1] |= MP_LSBMASK; mpndivmod(divmod, nsize+1, dividend, psize, kp->p.modl, workspace); mprshift(nsize+1, divmod, shift); mpnzero(&min); mpnset(&min, nsize+1-psize, divmod); /* generate a random prime q, with min/max constraints, so that gcd(q-1,e) = 1 */ if (mpprndr_w(&kp->q, rgc, qbits, mpptrials(qbits), &min, (mpnumber*) 0, &kp->e, temp)) { /* shouldn't happen */ mpnfree(&min); free(temp); return -1; } mpnfree(&min); mpbzero(&psubone); mpbzero(&qsubone); mpnzero(&phi); /* set n = p*q, with appropriate size (pqsize may be > nsize) */ mpmul(temp, psize, kp->p.modl, qsize, kp->q.modl); mpbset(&kp->n, nsize, temp+pqsize-nsize); /* compute p-1 */ mpbsubone(&kp->p, temp); mpbset(&psubone, psize, temp); /* compute q-1 */ mpbsubone(&kp->q, temp); mpbset(&qsubone, qsize, temp); /* compute phi = (p-1)*(q-1) */ mpmul(temp, psize, psubone.modl, qsize, qsubone.modl); mpnset(&phi, nsize, temp); /* compute d = inv(e) mod phi; if gcd(e, phi) != 1 then this function will fail */ if (mpninv(&kp->d, &kp->e, &phi) == 0) { /* shouldn't happen, since gcd(p-1,e) = 1 and gcd(q-1,e) = 1 ==> gcd((p-1)(q-1),e) = 1 */ mpnfree(&phi); free(temp); return -1; } /* compute dp = d mod (p-1) */ mpnsize(&kp->dp, psize); mpbmod_w(&psubone, kp->d.data, kp->dp.data, temp); /* compute dq = d mod (q-1) */ mpnsize(&kp->dq, qsize); mpbmod_w(&qsubone, kp->d.data, kp->dq.data, temp); /* compute qi = inv(q) mod p */ mpninv(&kp->qi, (mpnumber*) &kp->q, (mpnumber*) &kp->p); mpnfree(&phi); free(temp); return 0; } return -1; } int rsakpInit(rsakp* kp) { memset(kp, 0, sizeof(rsakp)); /* or mpbzero(&kp->n); mpnzero(&kp->e); mpnzero(&kp->d); mpbzero(&kp->p); mpbzero(&kp->q); mpnzero(&kp->dp); mpnzero(&kp->dq); mpnzero(&kp->qi); */ return 0; } int rsakpFree(rsakp* kp) { /* wipe all secret key components */ mpbfree(&kp->n); mpnfree(&kp->e); mpnwipe(&kp->d); mpnfree(&kp->d); mpbwipe(&kp->p); mpbfree(&kp->p); mpbwipe(&kp->q); mpbfree(&kp->q); mpnwipe(&kp->dp); mpnfree(&kp->dp); mpnwipe(&kp->dq); mpnfree(&kp->dq); mpnwipe(&kp->qi); mpnfree(&kp->qi); return 0; } int rsakpCopy(rsakp* dst, const rsakp* src) { mpbcopy(&dst->n, &src->n); mpncopy(&dst->e, &src->e); mpncopy(&dst->d, &src->d); mpbcopy(&dst->p, &src->p); mpbcopy(&dst->q, &src->q); mpncopy(&dst->dp, &src->dp); mpncopy(&dst->dp, &src->dp); mpncopy(&dst->qi, &src->qi); return 0; } /*!\} */ beecrypt-4.2.1/aclocal.m40000644000175000001440000115362711226307155012131 00000000000000# generated automatically by aclocal 1.11 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],, [m4_warning([this file was generated for autoconf 2.63. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 56 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl _LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\[$]0 --fallback-echo"')dnl " lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` ;; esac _LT_OUTPUT_LIBTOOL_INIT ]) # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) cat >"$CONFIG_LT" <<_LTEOF #! $SHELL # Generated by $as_me. # Run this file to recreate a libtool stub with the current configuration. lt_cl_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2008 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. if test "$no_create" != yes; then lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) fi ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_XSI_SHELLFNS sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(whole_archive_flag_spec, $1)='' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX # ----------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl AC_LINK_IFELSE(AC_LANG_PROGRAM,[ lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. m4_defun([_LT_PROG_ECHO_BACKSLASH], [_LT_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac ECHO=${lt_ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF [$]* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(lt_ECHO) ]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that does not interpret backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [AC_CHECK_TOOL(AR, ar, false) test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1]) AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line __oline__ "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi # Handle Gentoo/FreeBSD as it was Linux case $host_vendor in gentoo) version_type=linux ;; *) version_type=freebsd-$objformat ;; esac case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; linux) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' need_lib_prefix=no need_version=no ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method == "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC*) # IBM XL 8.0 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE(int foo(void) {}, _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' ) LDFLAGS="$save_LDFLAGS" else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then _LT_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [fix_srcfile_path], [1], [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_PROG_CXX # ------------ # Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ # compiler, we have our own version here. m4_defun([_LT_PROG_CXX], [ pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) AC_PROG_CXX if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_CXX dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_CXX], []) # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [AC_REQUIRE([_LT_PROG_CXX])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 will use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; xl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=echo else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_PROG_F77 # ------------ # Since AC_PROG_F77 is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_F77], [ pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) AC_PROG_F77 if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_F77 dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_F77], []) # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_REQUIRE([_LT_PROG_F77])dnl AC_LANG_PUSH(Fortran 77) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${F77-"f77"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_PROG_FC # ----------- # Since AC_PROG_FC is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_FC], [ pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) AC_PROG_FC if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_FC dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_FC], []) # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_REQUIRE([_LT_PROG_FC])dnl AC_LANG_PUSH(Fortran) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${FC-"f95"} compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC="$lt_save_CC" ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC= CC=${RC-"windres"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC="$lt_save_CC" ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_XSI_SHELLFNS # --------------------- # Bourne and XSI compatible variants of some useful shell functions. m4_defun([_LT_PROG_XSI_SHELLFNS], [case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $[*] )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } dnl func_dirname_and_basename dnl A portable version of this function is already defined in general.m4sh dnl so there is no need for it here. # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[[^=]]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$[@]"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]+=\$[2]" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]=\$$[1]\$[2]" } _LT_EOF ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [0], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # Generated from ltversion.in. # serial 3012 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.2.6]) m4_define([LT_PACKAGE_REVISION], [1.3012]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.2.6' macro_revision='1.3012' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 4 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Figure out how to run the assembler. -*- Autoconf -*- # Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_PROG_AS # ---------- AC_DEFUN([AM_PROG_AS], [# By default we simply use the C compiler to build assembly code. AC_REQUIRE([AC_PROG_CC]) test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) beecrypt-4.2.1/hmacsha256.c0000644000175000001440000000355611216147021012261 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha256.c * \brief HMAC-SHA-256 message digest algorithm. * \author Bob Deblier * \ingroup HMAC_m HMAC_sha256_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha256.h" /*!\addtogroup HMAC_sha256_m * \{ */ const keyedHashFunction hmacsha256 = { "HMAC-SHA-256", sizeof(hmacsha256Param), 64, 32, 64, 512, 32, (keyedHashFunctionSetup) hmacsha256Setup, (keyedHashFunctionReset) hmacsha256Reset, (keyedHashFunctionUpdate) hmacsha256Update, (keyedHashFunctionDigest) hmacsha256Digest }; int hmacsha256Setup (hmacsha256Param* sp, const byte* key, size_t keybits) { return hmacSetup(sp->kxi, sp->kxo, &sha256, &sp->sparam, key, keybits); } int hmacsha256Reset (hmacsha256Param* sp) { return hmacReset(sp->kxi, &sha256, &sp->sparam); } int hmacsha256Update(hmacsha256Param* sp, const byte* data, size_t size) { return hmacUpdate(&sha256, &sp->sparam, data, size); } int hmacsha256Digest(hmacsha256Param* sp, byte* data) { return hmacDigest(sp->kxo, &sha256, &sp->sparam, data); } /*!\} */ beecrypt-4.2.1/ripemd320.c0000644000175000001440000003526311216403305012125 00000000000000/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file ripemd320.c * \brief RIPEMD-320 hash function. * \author Jeff Johnson * \author Bob Deblier * \ingroup HASH_m HASH_ripemd320_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/ripemd320.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_ripemd320_m * \{ */ /*@unchecked@*/ /*@observer@*/ static uint32_t ripemd320hinit[10] = { 0x67452301U, 0xefcdab89U, 0x98badcfeU, 0x10325476U, 0xc3d2e1f0U, 0x76543210U, 0xfedcba98U, 0x89abcdefU, 0x01234567U, 0x3c2d1e0fU }; /*@-sizeoftype@*/ /*@unchecked@*/ /*@observer@*/ const hashFunction ripemd320 = { .name = "RIPEMD-320", .paramsize = sizeof(ripemd320Param), .blocksize = 64, .digestsize = 40, .reset = (hashFunctionReset) ripemd320Reset, .update = (hashFunctionUpdate) ripemd320Update, .digest = (hashFunctionDigest) ripemd320Digest }; /*@=sizeoftype@*/ int ripemd320Reset(register ripemd320Param* mp) { /*@-sizeoftype@*/ memcpy(mp->h, ripemd320hinit, 10 * sizeof(uint32_t)); memset(mp->data, 0, 16 * sizeof(uint32_t)); /*@=sizeoftype@*/ #if (MP_WBITS == 64) mpzero(1, mp->length); #elif (MP_WBITS == 32) mpzero(2, mp->length); #else # error #endif mp->offset = 0; return 0; } #define LSR1(a, b, c, d, e, x, s) \ a = ROTL32((b^c^d) + a + x, s) + e;\ c = ROTL32(c, 10); #define LSR2(a, b, c, d, e, x, s) \ a = ROTL32(((b&c)|(~b&d)) + a + x + 0x5a827999U, s) + e;\ c = ROTL32(c, 10); #define LSR3(a, b, c, d, e, x, s) \ a = ROTL32(((b|~c)^d) + a + x + 0x6ed9eba1U, s) + e; \ c = ROTL32(c, 10); #define LSR4(a, b, c, d, e, x, s) \ a = ROTL32(((b&d)|(c&~d)) + a + x + 0x8f1bbcdcU, s) + e; \ c = ROTL32(c, 10); #define LSR5(a, b, c, d, e, x, s) \ a = ROTL32((b^(c|~d)) + a + x + 0xa953fd4eU, s) + e; \ c = ROTL32(c, 10); #define RSR5(a, b, c, d, e, x, s) \ a = ROTL32((b^c^d) + a + x, s) + e;\ c = ROTL32(c, 10); #define RSR4(a, b, c, d, e, x, s) \ a = ROTL32(((b&c)|(~b&d)) + a + x + 0x7a6d76e9U, s) + e;\ c = ROTL32(c, 10); #define RSR3(a, b, c, d, e, x, s) \ a = ROTL32(((b|~c)^d) + a + x + 0x6d703ef3U, s) + e; \ c = ROTL32(c, 10); #define RSR2(a, b, c, d, e, x, s) \ a = ROTL32(((b&d)|(c&~d)) + a + x + 0x5c4dd124U, s) + e; \ c = ROTL32(c, 10); #define RSR1(a, b, c, d, e, x, s) \ a = ROTL32((b^(c|~d)) + a + x + 0x50a28be6U, s) + e; \ c = ROTL32(c, 10); #ifndef ASM_RIPEMD320PROCESS void ripemd320Process(ripemd320Param* mp) { register uint32_t la, lb, lc, ld, le; register uint32_t ra, rb, rc, rd, re; register uint32_t temp; register uint32_t* x; #ifdef WORDS_BIGENDIAN register byte t; #endif x = mp->data; #ifdef WORDS_BIGENDIAN t = 16; while (t--) { temp = swapu32(*x); *(x++) = temp; } x = mp->data; #endif la = mp->h[0]; lb = mp->h[1]; lc = mp->h[2]; ld = mp->h[3]; le = mp->h[4]; ra = mp->h[5]; rb = mp->h[6]; rc = mp->h[7]; rd = mp->h[8]; re = mp->h[9]; /* In theory OpenMP would allows us to do the 'left' and 'right' sections in parallel, * but in practice the overhead make the code much slower */ /* left round 1 */ LSR1(la, lb, lc, ld, le, x[ 0], 11); LSR1(le, la, lb, lc, ld, x[ 1], 14); LSR1(ld, le, la, lb, lc, x[ 2], 15); LSR1(lc, ld, le, la, lb, x[ 3], 12); LSR1(lb, lc, ld, le, la, x[ 4], 5); LSR1(la, lb, lc, ld, le, x[ 5], 8); LSR1(le, la, lb, lc, ld, x[ 6], 7); LSR1(ld, le, la, lb, lc, x[ 7], 9); LSR1(lc, ld, le, la, lb, x[ 8], 11); LSR1(lb, lc, ld, le, la, x[ 9], 13); LSR1(la, lb, lc, ld, le, x[10], 14); LSR1(le, la, lb, lc, ld, x[11], 15); LSR1(ld, le, la, lb, lc, x[12], 6); LSR1(lc, ld, le, la, lb, x[13], 7); LSR1(lb, lc, ld, le, la, x[14], 9); LSR1(la, lb, lc, ld, le, x[15], 8); /* right round 1 */ RSR1(ra, rb, rc, rd, re, x[ 5], 8); RSR1(re, ra, rb, rc, rd, x[14], 9); RSR1(rd, re, ra, rb, rc, x[ 7], 9); RSR1(rc, rd, re, ra, rb, x[ 0], 11); RSR1(rb, rc, rd, re, ra, x[ 9], 13); RSR1(ra, rb, rc, rd, re, x[ 2], 15); RSR1(re, ra, rb, rc, rd, x[11], 15); RSR1(rd, re, ra, rb, rc, x[ 4], 5); RSR1(rc, rd, re, ra, rb, x[13], 7); RSR1(rb, rc, rd, re, ra, x[ 6], 7); RSR1(ra, rb, rc, rd, re, x[15], 8); RSR1(re, ra, rb, rc, rd, x[ 8], 11); RSR1(rd, re, ra, rb, rc, x[ 1], 14); RSR1(rc, rd, re, ra, rb, x[10], 14); RSR1(rb, rc, rd, re, ra, x[ 3], 12); RSR1(ra, rb, rc, rd, re, x[12], 6); temp = la; la = ra; ra = temp; /* left round 2 */ LSR2(le, la, lb, lc, ld, x[ 7], 7); LSR2(ld, le, la, lb, lc, x[ 4], 6); LSR2(lc, ld, le, la, lb, x[13], 8); LSR2(lb, lc, ld, le, la, x[ 1], 13); LSR2(la, lb, lc, ld, le, x[10], 11); LSR2(le, la, lb, lc, ld, x[ 6], 9); LSR2(ld, le, la, lb, lc, x[15], 7); LSR2(lc, ld, le, la, lb, x[ 3], 15); LSR2(lb, lc, ld, le, la, x[12], 7); LSR2(la, lb, lc, ld, le, x[ 0], 12); LSR2(le, la, lb, lc, ld, x[ 9], 15); LSR2(ld, le, la, lb, lc, x[ 5], 9); LSR2(lc, ld, le, la, lb, x[ 2], 11); LSR2(lb, lc, ld, le, la, x[14], 7); LSR2(la, lb, lc, ld, le, x[11], 13); LSR2(le, la, lb, lc, ld, x[ 8], 12); /* right round 2 */ RSR2(re, ra, rb, rc, rd, x[ 6], 9); RSR2(rd, re, ra, rb, rc, x[11], 13); RSR2(rc, rd, re, ra, rb, x[ 3], 15); RSR2(rb, rc, rd, re, ra, x[ 7], 7); RSR2(ra, rb, rc, rd, re, x[ 0], 12); RSR2(re, ra, rb, rc, rd, x[13], 8); RSR2(rd, re, ra, rb, rc, x[ 5], 9); RSR2(rc, rd, re, ra, rb, x[10], 11); RSR2(rb, rc, rd, re, ra, x[14], 7); RSR2(ra, rb, rc, rd, re, x[15], 7); RSR2(re, ra, rb, rc, rd, x[ 8], 12); RSR2(rd, re, ra, rb, rc, x[12], 7); RSR2(rc, rd, re, ra, rb, x[ 4], 6); RSR2(rb, rc, rd, re, ra, x[ 9], 15); RSR2(ra, rb, rc, rd, re, x[ 1], 13); RSR2(re, ra, rb, rc, rd, x[ 2], 11); temp = lb; lb = rb; rb = temp; /* left round 3 */ LSR3(ld, le, la, lb, lc, x[ 3], 11); LSR3(lc, ld, le, la, lb, x[10], 13); LSR3(lb, lc, ld, le, la, x[14], 6); LSR3(la, lb, lc, ld, le, x[ 4], 7); LSR3(le, la, lb, lc, ld, x[ 9], 14); LSR3(ld, le, la, lb, lc, x[15], 9); LSR3(lc, ld, le, la, lb, x[ 8], 13); LSR3(lb, lc, ld, le, la, x[ 1], 15); LSR3(la, lb, lc, ld, le, x[ 2], 14); LSR3(le, la, lb, lc, ld, x[ 7], 8); LSR3(ld, le, la, lb, lc, x[ 0], 13); LSR3(lc, ld, le, la, lb, x[ 6], 6); LSR3(lb, lc, ld, le, la, x[13], 5); LSR3(la, lb, lc, ld, le, x[11], 12); LSR3(le, la, lb, lc, ld, x[ 5], 7); LSR3(ld, le, la, lb, lc, x[12], 5); /* right round 3 */ RSR3(rd, re, ra, rb, rc, x[15], 9); RSR3(rc, rd, re, ra, rb, x[ 5], 7); RSR3(rb, rc, rd, re, ra, x[ 1], 15); RSR3(ra, rb, rc, rd, re, x[ 3], 11); RSR3(re, ra, rb, rc, rd, x[ 7], 8); RSR3(rd, re, ra, rb, rc, x[14], 6); RSR3(rc, rd, re, ra, rb, x[ 6], 6); RSR3(rb, rc, rd, re, ra, x[ 9], 14); RSR3(ra, rb, rc, rd, re, x[11], 12); RSR3(re, ra, rb, rc, rd, x[ 8], 13); RSR3(rd, re, ra, rb, rc, x[12], 5); RSR3(rc, rd, re, ra, rb, x[ 2], 14); RSR3(rb, rc, rd, re, ra, x[10], 13); RSR3(ra, rb, rc, rd, re, x[ 0], 13); RSR3(re, ra, rb, rc, rd, x[ 4], 7); RSR3(rd, re, ra, rb, rc, x[13], 5); temp = lc; lc = rc; rc = temp; /* left round 4 */ LSR4(lc, ld, le, la, lb, x[ 1], 11); LSR4(lb, lc, ld, le, la, x[ 9], 12); LSR4(la, lb, lc, ld, le, x[11], 14); LSR4(le, la, lb, lc, ld, x[10], 15); LSR4(ld, le, la, lb, lc, x[ 0], 14); LSR4(lc, ld, le, la, lb, x[ 8], 15); LSR4(lb, lc, ld, le, la, x[12], 9); LSR4(la, lb, lc, ld, le, x[ 4], 8); LSR4(le, la, lb, lc, ld, x[13], 9); LSR4(ld, le, la, lb, lc, x[ 3], 14); LSR4(lc, ld, le, la, lb, x[ 7], 5); LSR4(lb, lc, ld, le, la, x[15], 6); LSR4(la, lb, lc, ld, le, x[14], 8); LSR4(le, la, lb, lc, ld, x[ 5], 6); LSR4(ld, le, la, lb, lc, x[ 6], 5); LSR4(lc, ld, le, la, lb, x[ 2], 12); /* right round 4 */ RSR4(rc, rd, re, ra, rb, x[ 8], 15); RSR4(rb, rc, rd, re, ra, x[ 6], 5); RSR4(ra, rb, rc, rd, re, x[ 4], 8); RSR4(re, ra, rb, rc, rd, x[ 1], 11); RSR4(rd, re, ra, rb, rc, x[ 3], 14); RSR4(rc, rd, re, ra, rb, x[11], 14); RSR4(rb, rc, rd, re, ra, x[15], 6); RSR4(ra, rb, rc, rd, re, x[ 0], 14); RSR4(re, ra, rb, rc, rd, x[ 5], 6); RSR4(rd, re, ra, rb, rc, x[12], 9); RSR4(rc, rd, re, ra, rb, x[ 2], 12); RSR4(rb, rc, rd, re, ra, x[13], 9); RSR4(ra, rb, rc, rd, re, x[ 9], 12); RSR4(re, ra, rb, rc, rd, x[ 7], 5); RSR4(rd, re, ra, rb, rc, x[10], 15); RSR4(rc, rd, re, ra, rb, x[14], 8); temp = ld; ld = rd; rd = temp; /* left round 5 */ LSR5(lb, lc, ld, le, la, x[ 4], 9); LSR5(la, lb, lc, ld, le, x[ 0], 15); LSR5(le, la, lb, lc, ld, x[ 5], 5); LSR5(ld, le, la, lb, lc, x[ 9], 11); LSR5(lc, ld, le, la, lb, x[ 7], 6); LSR5(lb, lc, ld, le, la, x[12], 8); LSR5(la, lb, lc, ld, le, x[ 2], 13); LSR5(le, la, lb, lc, ld, x[10], 12); LSR5(ld, le, la, lb, lc, x[14], 5); LSR5(lc, ld, le, la, lb, x[ 1], 12); LSR5(lb, lc, ld, le, la, x[ 3], 13); LSR5(la, lb, lc, ld, le, x[ 8], 14); LSR5(le, la, lb, lc, ld, x[11], 11); LSR5(ld, le, la, lb, lc, x[ 6], 8); LSR5(lc, ld, le, la, lb, x[15], 5); LSR5(lb, lc, ld, le, la, x[13], 6); /* right round 5 */ RSR5(rb, rc, rd, re, ra, x[12] , 8); RSR5(ra, rb, rc, rd, re, x[15] , 5); RSR5(re, ra, rb, rc, rd, x[10] , 12); RSR5(rd, re, ra, rb, rc, x[ 4] , 9); RSR5(rc, rd, re, ra, rb, x[ 1] , 12); RSR5(rb, rc, rd, re, ra, x[ 5] , 5); RSR5(ra, rb, rc, rd, re, x[ 8] , 14); RSR5(re, ra, rb, rc, rd, x[ 7] , 6); RSR5(rd, re, ra, rb, rc, x[ 6] , 8); RSR5(rc, rd, re, ra, rb, x[ 2] , 13); RSR5(rb, rc, rd, re, ra, x[13] , 6); RSR5(ra, rb, rc, rd, re, x[14] , 5); RSR5(re, ra, rb, rc, rd, x[ 0] , 15); RSR5(rd, re, ra, rb, rc, x[ 3] , 13); RSR5(rc, rd, re, ra, rb, x[ 9] , 11); RSR5(rb, rc, rd, re, ra, x[11] , 11); temp = le; le = re; re = temp; /* combine results */ mp->h[0] += la; mp->h[1] += lb; mp->h[2] += lc; mp->h[3] += ld; mp->h[4] += le; mp->h[5] += ra; mp->h[6] += rb; mp->h[7] += rc; mp->h[8] += rd; mp->h[9] += re; } #endif int ripemd320Update(ripemd320Param* mp, const byte* data, size_t size) { register uint32_t proclength; #if (MP_WBITS == 64) mpw add[1]; mpsetw(1, add, size); mplshift(1, add, 3); mpadd(1, mp->length, add); #elif (MP_WBITS == 32) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); (void) mpadd(2, mp->length, add); #else # error #endif while (size > 0) { proclength = ((mp->offset + size) > 64U) ? (64U - mp->offset) : size; /*@-mayaliasunique@*/ memcpy(((byte *) mp->data) + mp->offset, data, proclength); /*@=mayaliasunique@*/ size -= proclength; data += proclength; mp->offset += proclength; if (mp->offset == 64U) { ripemd320Process(mp); mp->offset = 0; } } return 0; } static void ripemd320Finish(ripemd320Param* mp) /*@modifies mp @*/ { register byte *ptr = ((byte *) mp->data) + mp->offset++; *(ptr++) = 0x80; if (mp->offset > 56) { while (mp->offset++ < 64) *(ptr++) = 0; ripemd320Process(mp); mp->offset = 0; } ptr = ((byte *) mp->data) + mp->offset; while (mp->offset++ < 56) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[0] = (byte)(mp->length[0] ); ptr[1] = (byte)(mp->length[0] >> 8); ptr[2] = (byte)(mp->length[0] >> 16); ptr[3] = (byte)(mp->length[0] >> 24); ptr[4] = (byte)(mp->length[0] >> 32); ptr[5] = (byte)(mp->length[0] >> 40); ptr[6] = (byte)(mp->length[0] >> 48); ptr[7] = (byte)(mp->length[0] >> 56); #elif (MP_WBITS == 32) ptr[0] = (byte)(mp->length[1] ); ptr[1] = (byte)(mp->length[1] >> 8); ptr[2] = (byte)(mp->length[1] >> 16); ptr[3] = (byte)(mp->length[1] >> 24); ptr[4] = (byte)(mp->length[0] ); ptr[5] = (byte)(mp->length[0] >> 8); ptr[6] = (byte)(mp->length[0] >> 16); ptr[7] = (byte)(mp->length[0] >> 24); #else # error #endif ripemd320Process(mp); mp->offset = 0; } /*@-protoparammatch@*/ int ripemd320Digest(ripemd320Param* mp, byte* data) { ripemd320Finish(mp); /* encode 5 integers little-endian style */ data[ 0] = (byte)(mp->h[0] ); data[ 1] = (byte)(mp->h[0] >> 8); data[ 2] = (byte)(mp->h[0] >> 16); data[ 3] = (byte)(mp->h[0] >> 24); data[ 4] = (byte)(mp->h[1] ); data[ 5] = (byte)(mp->h[1] >> 8); data[ 6] = (byte)(mp->h[1] >> 16); data[ 7] = (byte)(mp->h[1] >> 24); data[ 8] = (byte)(mp->h[2] ); data[ 9] = (byte)(mp->h[2] >> 8); data[10] = (byte)(mp->h[2] >> 16); data[11] = (byte)(mp->h[2] >> 24); data[12] = (byte)(mp->h[3] ); data[13] = (byte)(mp->h[3] >> 8); data[14] = (byte)(mp->h[3] >> 16); data[15] = (byte)(mp->h[3] >> 24); data[16] = (byte)(mp->h[4] ); data[17] = (byte)(mp->h[4] >> 8); data[18] = (byte)(mp->h[4] >> 16); data[19] = (byte)(mp->h[4] >> 24); data[20] = (byte)(mp->h[5] ); data[21] = (byte)(mp->h[5] >> 8); data[22] = (byte)(mp->h[5] >> 16); data[23] = (byte)(mp->h[5] >> 24); data[24] = (byte)(mp->h[6] ); data[25] = (byte)(mp->h[6] >> 8); data[26] = (byte)(mp->h[6] >> 16); data[27] = (byte)(mp->h[6] >> 24); data[28] = (byte)(mp->h[7] ); data[29] = (byte)(mp->h[7] >> 8); data[30] = (byte)(mp->h[7] >> 16); data[31] = (byte)(mp->h[7] >> 24); data[32] = (byte)(mp->h[8] ); data[33] = (byte)(mp->h[8] >> 8); data[34] = (byte)(mp->h[8] >> 16); data[35] = (byte)(mp->h[8] >> 24); data[36] = (byte)(mp->h[9] ); data[37] = (byte)(mp->h[9] >> 8); data[38] = (byte)(mp->h[9] >> 16); data[39] = (byte)(mp->h[9] >> 24); (void) ripemd320Reset(mp); return 0; } /*@=protoparammatch@*/ /*!\} */ beecrypt-4.2.1/blowfish.c0000644000175000001440000004631111216625757012252 00000000000000/* * Copyright (c) 1999, 2000, 2002, 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file blowfish.c * \brief Blowfish block cipher. * \author Bob Deblier * \ingroup BC_m BC_blowfish_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/blowfish.h" #include "beecrypt/endianness.h" #ifdef ASM_BLOWFISHENCRYPTECB extern int blowfishEncryptECB(blowfishparam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_BLOWFISHDECRYPTECB extern int blowfishDecryptECB(blowfishparam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_BLOWFISHENCRYPTCBC extern int blowfishEncryptCBC(blowfishparam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_BLOWFISHDECRYPTCBC extern int blowfishDecryptCBC(blowfishparam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_BLOWFISHENCRYPTCTR extern int blowfishEncryptCTR(blowfishparam*, uint32_t*, const uint32_t*, unsigned int); #endif #ifdef ASM_BLOWFISHDECRYPTCTR extern int blowfishDecryptCTR(blowfishparam*, uint32_t*, const uint32_t*, unsigned int); #endif static uint32_t _bf_p[BLOWFISHPSIZE] = { 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b }; static uint32_t _bf_s[1024] = { 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a, 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7, 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0, 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 }; #define EROUND(l,r) l ^= *(p++); r ^= ((s[((l>>24)&0xff)+0x000]+s[((l>>16)&0xff)+0x100])^s[((l>>8)&0xff)+0x200])+s[((l>>0)&0xff)+0x300] #define DROUND(l,r) l ^= *(p--); r ^= ((s[((l>>24)&0xff)+0x000]+s[((l>>16)&0xff)+0x100])^s[((l>>8)&0xff)+0x200])+s[((l>>0)&0xff)+0x300] const blockCipher blowfish = { .name = "Blowfish", .paramsize = sizeof(blowfishParam), .blocksize = 8, .keybitsmin = 64, .keybitsmax = 448, .keybitsinc = 32, .setup = (blockCipherSetup) blowfishSetup, .setiv = (blockCipherSetIV) blowfishSetIV, .setctr = (blockCipherSetCTR) blowfishSetCTR, .getfb = (blockCipherFeedback) blowfishFeedback, .raw = { .encrypt = (blockCipherRawcrypt) blowfishEncrypt, .decrypt = (blockCipherRawcrypt) blowfishDecrypt }, .ecb = { #ifdef AES_BLOWFISHENCRYPTECB .encrypt = (blockCipherModcrypt) blowfishEncryptECB, #else .encrypt = (blockCipherModcrypt) 0, #endif #ifdef AES_BLOWFISHENCRYPTECB .decrypt = (blockCipherModcrypt) blowfishDecryptECB, #else .decrypt = (blockCipherModcrypt) 0 #endif }, .cbc = { #ifdef AES_BLOWFISHENCRYPTCBC .encrypt = (blockCipherModcrypt) blowfishEncryptCBC, #else .encrypt = (blockCipherModcrypt) 0, #endif #ifdef AES_BLOWFISHENCRYPTCBC .decrypt = (blockCipherModcrypt) blowfishDecryptCBC, #else .decrypt = (blockCipherModcrypt) 0 #endif }, .ctr = { #ifdef AES_BLOWFISHENCRYPTCTR .encrypt = (blockCipherModcrypt) blowfishEncryptCTR, #else .encrypt = (blockCipherModcrypt) 0, #endif #ifdef AES_BLOWFISHENCRYPTCTR .decrypt = (blockCipherModcrypt) blowfishDecryptCTR, #else .decrypt = (blockCipherModcrypt) 0 #endif }, }; int blowfishSetup(blowfishParam* bp, const byte* key, size_t keybits, cipherOperation op) { if ((op != ENCRYPT) && (op != DECRYPT)) return -1; if (((keybits & 7) == 0) && (keybits >= 32) && (keybits <= 448)) { register uint32_t* p = bp->p; register uint32_t* s = bp->s; register unsigned int i, j, k; uint32_t tmp, work[2]; memcpy(s, _bf_s, 1024 * sizeof(uint32_t)); for (i = 0, k = 0; i < BLOWFISHPSIZE; i++) { tmp = 0; for (j = 0; j < 4; j++) { tmp <<= 8; tmp |= key[k++]; if (k >= (keybits >> 3)) k = 0; } p[i] = _bf_p[i] ^ tmp; } work[0] = work[1] = 0; for (i = 0; i < BLOWFISHPSIZE; i += 2, p += 2) { blowfishEncrypt(bp, work, work); #if WORDS_BIGENDIAN p[0] = work[0]; p[1] = work[1]; #else p[0] = swapu32(work[0]); p[1] = swapu32(work[1]); #endif } for (i = 0; i < 1024; i += 2, s += 2) { blowfishEncrypt(bp, work, work); #if WORDS_BIGENDIAN s[0] = work[0]; s[1] = work[1]; #else s[0] = swapu32(work[0]); s[1] = swapu32(work[1]); #endif } /* clear fdback/iv */ bp->fdback[0] = 0; bp->fdback[1] = 0; return 0; } return -1; } #ifndef ASM_BLOWFISHSETIV int blowfishSetIV(blowfishParam* bp, const byte* iv) { if (iv) memcpy(bp->fdback, iv, 8); else memset(bp->fdback, 0, 8); return 0; } #endif #ifndef ASM_BLOWFISHSETCTR int blowfishSetCTR(blowfishParam* bp, const byte* nivz, size_t counter) { unsigned int blockwords = MP_BYTES_TO_WORDS(8); if (nivz) { mpw tmp[MP_BYTES_TO_WORDS(8)]; os2ip((mpw*) bp->fdback, blockwords, nivz, 8); mpsetws(blockwords, tmp, counter); mpadd(blockwords, (mpw*) bp->fdback, tmp); } else mpsetws(blockwords, (mpw*) bp->fdback, counter); return 0; } #endif #ifndef ASM_BLOWFISHENCRYPT int blowfishEncrypt(blowfishParam* bp, uint32_t* dst, const uint32_t* src) { #if WORDS_BIGENDIAN register uint32_t xl = src[0], xr = src[1]; #else register uint32_t xl = swapu32(src[0]), xr = swapu32(src[1]); #endif register uint32_t* p = bp->p; register uint32_t* s = bp->s; EROUND(xl, xr); EROUND(xr, xl); EROUND(xl, xr); EROUND(xr, xl); EROUND(xl, xr); EROUND(xr, xl); EROUND(xl, xr); EROUND(xr, xl); EROUND(xl, xr); EROUND(xr, xl); EROUND(xl, xr); EROUND(xr, xl); EROUND(xl, xr); EROUND(xr, xl); EROUND(xl, xr); EROUND(xr, xl); #if WORDS_BIGENDIAN dst[1] = xl ^ *(p++); dst[0] = xr ^ *(p++); #else dst[1] = swapu32(xl ^ *(p++)); dst[0] = swapu32(xr ^ *(p++)); #endif return 0; } #endif #ifndef ASM_BLOWFISHDECRYPT int blowfishDecrypt(blowfishParam* bp, uint32_t* dst, const uint32_t* src) { #if WORDS_BIGENDIAN register uint32_t xl = src[0], xr = src[1]; #else register uint32_t xl = swapu32(src[0]), xr = swapu32(src[1]); #endif register uint32_t* p = bp->p+BLOWFISHPSIZE-1; register uint32_t* s = bp->s; DROUND(xl, xr); DROUND(xr, xl); DROUND(xl, xr); DROUND(xr, xl); DROUND(xl, xr); DROUND(xr, xl); DROUND(xl, xr); DROUND(xr, xl); DROUND(xl, xr); DROUND(xr, xl); DROUND(xl, xr); DROUND(xr, xl); DROUND(xl, xr); DROUND(xr, xl); DROUND(xl, xr); DROUND(xr, xl); #if WORDS_BIGENDIAN dst[1] = xl ^ *(p--); dst[0] = xr ^ *(p--); #else dst[1] = swapu32(xl ^ *(p--)); dst[0] = swapu32(xr ^ *(p--)); #endif return 0; } #endif uint32_t* blowfishFeedback(blowfishParam* bp) { return bp->fdback; } beecrypt-4.2.1/hmacsha384.c0000644000175000001440000000354311216147021012257 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha384.c * \brief HMAC-SHA-384 message digest algorithm. * \author Bob Deblier * \ingroup HMAC_m HMAC_sha384_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha384.h" /*!\addtogroup HMAC_sha384_m * \{ */ const keyedHashFunction hmacsha384 = { "HMAC-SHA-384", sizeof(hmacsha384Param), 128, 48, 64, 512, 32, (keyedHashFunctionSetup) hmacsha384Setup, (keyedHashFunctionReset) hmacsha384Reset, (keyedHashFunctionUpdate) hmacsha384Update, (keyedHashFunctionDigest) hmacsha384Digest }; int hmacsha384Setup (hmacsha384Param* sp, const byte* key, size_t keybits) { return hmacSetup(sp->kxi, sp->kxo, &sha384, &sp->sparam, key, keybits); } int hmacsha384Reset (hmacsha384Param* sp) { return hmacReset(sp->kxi, &sha384, &sp->sparam); } int hmacsha384Update(hmacsha384Param* sp, const byte* data, size_t size) { return hmacUpdate(&sha384, &sp->sparam, data, size); } int hmacsha384Digest(hmacsha384Param* sp, byte* data) { return hmacDigest(sp->kxo, &sha384, &sp->sparam, data); } /*!\} */ beecrypt-4.2.1/dlpk.c0000644000175000001440000000426611216147021011351 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dlpk.h * \brief Discrete Logarithm public key. * \author Bob Deblier * \ingroup DL_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/dlpk.h" /*!\addtogroup DL_m * \{ */ int dlpk_pInit(dlpk_p* pk) { if (dldp_pInit(&pk->param) < 0) return -1; mpnzero(&pk->y); return 0; } int dlpk_pFree(dlpk_p* pk) { if (dldp_pFree(&pk->param) < 0) return -1; mpnfree(&pk->y); return 0; } int dlpk_pCopy(dlpk_p* dst, const dlpk_p* src) { if (dldp_pCopy(&dst->param, &src->param) < 0) return -1; mpncopy(&dst->y, &src->y); return 0; } int dlpk_pEqual(const dlpk_p* a, const dlpk_p* b) { return dldp_pEqual(&a->param, &b->param) && mpeqx(a->y.size, a->y.data, b->y.size, b->y.data); } int dlpk_pgoqValidate(const dlpk_p* pk, randomGeneratorContext* rgc, int cofactor) { register int rc = dldp_pgoqValidate(&pk->param, rgc, cofactor); if (rc <= 0) return rc; if (mpleone(pk->y.size, pk->y.data)) return 0; if (mpgex(pk->y.size, pk->y.data, pk->param.p.size, pk->param.p.modl)) return 0; return 1; } int dlpk_pgonValidate(const dlpk_p* pk, randomGeneratorContext* rgc) { register int rc = dldp_pgonValidate(&pk->param, rgc); if (rc <= 0) return rc; if (mpleone(pk->y.size, pk->y.data)) return 0; if (mpgex(pk->y.size, pk->y.data, pk->param.p.size, pk->param.p.modl)) return 0; return 1; } /*!\} */ beecrypt-4.2.1/base64.c0000644000175000001440000002170311216147021011476 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file base64.c * \brief Base64 encoding and decoding. * \author Bob Deblier */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/base64.h" #if HAVE_ENDIAN_H && HAVE_ASM_BYTEORDER_H # include #endif #include "beecrypt/endianness.h" #if HAVE_CTYPE_H # include #endif static const char* to_b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /* encode 64 characters per line */ #define CHARS_PER_LINE 64 char* b64enc(const memchunk* chunk) { int div = chunk->size / 3; int rem = chunk->size % 3; int chars = div*4 + rem + 1; int newlines = (chars + CHARS_PER_LINE - 1) / CHARS_PER_LINE; const byte* data = chunk->data; char* string = (char*) malloc(chars + newlines + 1); if (string) { register char* buf = string; chars = 0; while (div > 0) { buf[0] = to_b64[ (data[0] >> 2) & 0x3f]; buf[1] = to_b64[((data[0] << 4) & 0x30) | ((data[1] >> 4) & 0xf)]; buf[2] = to_b64[((data[1] << 2) & 0x3c) | ((data[2] >> 6) & 0x3)]; buf[3] = to_b64[ data[2] & 0x3f]; data += 3; buf += 4; div--; chars += 4; if (chars == CHARS_PER_LINE) { chars = 0; *(buf++) = '\n'; } } switch (rem) { case 2: buf[0] = to_b64[ (data[0] >> 2) & 0x3f]; buf[1] = to_b64[((data[0] << 4) & 0x30) + ((data[1] >> 4) & 0xf)]; buf[2] = to_b64[ (data[1] << 2) & 0x3c]; buf[3] = '='; buf += 4; chars += 4; break; case 1: buf[0] = to_b64[ (data[0] >> 2) & 0x3f]; buf[1] = to_b64[ (data[0] << 4) & 0x30]; buf[2] = '='; buf[3] = '='; buf += 4; chars += 4; break; } /* *(buf++) = '\n'; This would result in a buffer overrun */ *buf = '\0'; } return string; } memchunk* b64dec(const char* string) { /* return a decoded memchunk, or a null pointer in case of failure */ memchunk* rc = 0; if (string) { register int length = strlen(string); /* do a format verification first */ if (length > 0) { register int count = 0, rem = 0; register const char* tmp = string; while (length > 0) { register int skip = strspn(tmp, to_b64); count += skip; length -= skip; tmp += skip; if (length > 0) { register int i, vrfy = strcspn(tmp, to_b64); for (i = 0; i < vrfy; i++) { if (isspace(tmp[i])) continue; if (tmp[i] == '=') { /* we should check if we're close to the end of the string */ rem = count % 4; /* rem must be either 2 or 3, otherwise no '=' should be here */ if (rem < 2) return 0; /* end-of-message recognized */ break; } else { /* Transmission error; RFC tells us to ignore this, but: * - the rest of the message is going to even more corrupt since we're sliding bits out of place * If a message is corrupt, it should be dropped. Period. */ return 0; } } length -= vrfy; tmp += vrfy; } } rc = memchunkAlloc((count / 4) * 3 + (rem ? (rem - 1) : 0)); if (rc) { if (count > 0) { register int i, qw = 0, tw = 0; register byte* data = rc->data; length = strlen(tmp = string); for (i = 0; i < length; i++) { register char ch = string[i]; register byte bits = 0; if (isspace(ch)) continue; if ((ch >= 'A') && (ch <= 'Z')) { bits = (byte) (ch - 'A'); } else if ((ch >= 'a') && (ch <= 'z')) { bits = (byte) (ch - 'a' + 26); } else if ((ch >= '0') && (ch <= '9')) { bits = (byte) (ch - '0' + 52); } else if (ch == '+') { bits = 62; } else if (ch == '/') { bits = 63; } else if (ch == '=') break; switch (qw++) { case 0: data[tw+0] = (bits << 2) & 0xfc; break; case 1: data[tw+0] |= (bits >> 4) & 0x03; data[tw+1] = (bits << 4) & 0xf0; break; case 2: data[tw+1] |= (bits >> 2) & 0x0f; data[tw+2] = (bits << 6) & 0xc0; break; case 3: data[tw+2] |= bits & 0x3f; break; } if (qw == 4) { qw = 0; tw += 3; } } } } } } return rc; } int b64encode_chars_per_line = B64ENCODE_CHARS_PER_LINE; const char * b64encode_eolstr = B64ENCODE_EOLSTR; char* b64encode(const void* data, size_t ns) { static char b64enc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; const char *e; const unsigned char *s = data; unsigned char *t, *te; int nt; int lc; unsigned c; if (s == NULL) return NULL; if (ns == 0) ns = strlen((const char*) s); nt = ((ns + 2) / 3) * 4; /* Add additional bytes necessary for eol string(s). */ if (b64encode_chars_per_line > 0 && b64encode_eolstr != NULL) { lc = (nt + b64encode_chars_per_line - 1) / b64encode_chars_per_line; if (((nt + b64encode_chars_per_line - 1) % b64encode_chars_per_line) != 0) ++lc; nt += lc * strlen(b64encode_eolstr); } t = te = malloc(nt + 1); lc = 0; if (te) { while (ns > 0) { c = *s++; *te++ = b64enc[ (c >> 2) ], lc++; *te++ = b64enc[ ((c & 0x3) << 4) | (((ns-1) > 0 ? *s : 0) >> 4) ], lc++; if (--ns == 0) { *te++ = '='; *te++ = '='; continue; } c = *s++; *te++ = b64enc[ ((c & 0xf) << 2) | (((ns-1) > 0 ? *s : 0) >> 6) ], lc++; if (--ns == 0) { *te++ = '='; continue; } *te++ = b64enc[ (int)(*s & 0x3f) ], lc++; /* Append eol string if desired. */ if (b64encode_chars_per_line > 0 && b64encode_eolstr != NULL) { if (lc >= b64encode_chars_per_line) { for (e = b64encode_eolstr; *e != '\0'; e++) *te++ = *e; lc = 0; } } s++; --ns; } /* Append eol string if desired. */ if (b64encode_chars_per_line > 0 && b64encode_eolstr != NULL) { if (lc != 0) { for (e = b64encode_eolstr; *e != '\0'; e++) *te++ = *e; } } *te = '\0'; } return (char*) t; } #define CRC24_INIT 0xb704ceL #define CRC24_POLY 0x1864cfbL char* b64crc (const unsigned char* data, size_t ns) { const unsigned char *s = data; uint32_t crc = CRC24_INIT; while (ns-- > 0) { int i; crc ^= (*s++) << 16; for (i = 0; i < 8; i++) { crc <<= 1; if (crc & 0x1000000) crc ^= CRC24_POLY; } } crc &= 0xffffff; #if !WORDS_BIGENDIAN crc = swapu32(crc); #endif data = (byte *)&crc; data++; ns = 3; return b64encode(data, ns); } const char* b64decode_whitespace = B64DECODE_WHITESPACE; int b64decode(const char* s, void** datap, size_t* lenp) { unsigned char b64dec[256]; const unsigned char *t; unsigned char *te; int ns, nt; unsigned a, b, c, d; if (s == NULL) return 1; /* Setup character lookup tables. */ memset(b64dec, 0x80, sizeof(b64dec)); for (c = 'A'; c <= 'Z'; c++) b64dec[ c ] = 0 + (c - 'A'); for (c = 'a'; c <= 'z'; c++) b64dec[ c ] = 26 + (c - 'a'); for (c = '0'; c <= '9'; c++) b64dec[ c ] = 52 + (c - '0'); b64dec[(unsigned)'+'] = 62; b64dec[(unsigned)'/'] = 63; b64dec[(unsigned)'='] = 0; /* Mark whitespace characters. */ if (b64decode_whitespace) { const char *e; for (e = b64decode_whitespace; *e != '\0'; e++) { if (b64dec[ (unsigned)*e ] == 0x80) b64dec[ (unsigned)*e ] = 0x81; } } /* Validate input buffer */ ns = 0; for (t = (unsigned char*) s; *t != '\0'; t++) { switch (b64dec[(unsigned) *t]) { case 0x80: /* invalid chararcter */ return 3; case 0x81: /* white space */ break; default: ns++; break; } } if (((unsigned) ns) & 0x3) return 2; nt = (ns / 4) * 3; t = te = malloc(nt + 1); while (ns > 0) { /* Get next 4 characters, ignoring whitespace. */ while ((a = b64dec[ (unsigned)*s++ ]) == 0x81) ; while ((b = b64dec[ (unsigned)*s++ ]) == 0x81) ; while ((c = b64dec[ (unsigned)*s++ ]) == 0x81) ; while ((d = b64dec[ (unsigned)*s++ ]) == 0x81) ; ns -= 4; *te++ = (a << 2) | (b >> 4); if (s[-2] == '=') break; *te++ = (b << 4) | (c >> 2); if (s[-1] == '=') break; *te++ = (c << 6) | d; } if (ns != 0) { /* XXX can't happen, just in case */ if (t) free((void *)t); return 1; } if (lenp) *lenp = (te - t); if (datap) *datap = (void *)t; else if (t) free((void *)t); return 0; } beecrypt-4.2.1/depcomp0000755000175000001440000004426711225166714011647 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free # Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: beecrypt-4.2.1/md5.c0000644000175000001440000001653611223574571011123 00000000000000/* * Copyright (c) 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file md5.c * \brief MD5 hash function * \author Bob Deblier * \ingroup HASH_m HASH_md5_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/md5.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_md5_m * \{ */ static uint32_t md5hinit[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }; const hashFunction md5 = { .name = "MD5", .paramsize = sizeof(md5Param), .blocksize = 64, .digestsize = 16, .reset = (hashFunctionReset) md5Reset, .update = (hashFunctionUpdate) md5Update, .digest = (hashFunctionDigest) md5Digest }; int md5Reset(register md5Param* mp) { memcpy(mp->h, md5hinit, 4 * sizeof(uint32_t)); memset(mp->data, 0, 16 * sizeof(uint32_t)); #if (MP_WBITS == 64) mpzero(1, mp->length); #elif (MP_WBITS == 32) mpzero(2, mp->length); #else # error #endif mp->offset = 0; return 0; } #define FF(a, b, c, d, w, s, t) \ a = ROTL32(((b&(c^d))^d) + a + w + t, s) + b; #define GG(a, b, c, d, w, s, t) \ a = ROTL32(((d&(b^c))^c) + a + w + t, s) + b; #define HH(a, b, c, d, w, s, t) \ a = ROTL32((b^c^d) + a + w + t, s) + b; #define II(a, b, c, d, w, s, t) \ a = ROTL32((c^(b|~d)) + a + w + t, s) + b; #ifndef ASM_MD5PROCESS void md5Process(md5Param* mp) { register uint32_t a,b,c,d; register uint32_t* w; #if WORDS_BIGENDIAN register byte t; #endif w = mp->data; #if WORDS_BIGENDIAN t = 16; while (t--) { register uint32_t temp = swapu32(*w); *(w++) = temp; } w = mp->data; #endif a = mp->h[0]; b = mp->h[1]; c = mp->h[2]; d = mp->h[3]; FF(a, b, c, d, w[ 0], 7, 0xd76aa478); FF(d, a, b, c, w[ 1], 12, 0xe8c7b756); FF(c, d, a, b, w[ 2], 17, 0x242070db); FF(b, c, d, a, w[ 3], 22, 0xc1bdceee); FF(a, b, c, d, w[ 4], 7, 0xf57c0faf); FF(d, a, b, c, w[ 5], 12, 0x4787c62a); FF(c, d, a, b, w[ 6], 17, 0xa8304613); FF(b, c, d, a, w[ 7], 22, 0xfd469501); FF(a, b, c, d, w[ 8], 7, 0x698098d8); FF(d, a, b, c, w[ 9], 12, 0x8b44f7af); FF(c, d, a, b, w[10], 17, 0xffff5bb1); FF(b, c, d, a, w[11], 22, 0x895cd7be); FF(a, b, c, d, w[12], 7, 0x6b901122); FF(d, a, b, c, w[13], 12, 0xfd987193); FF(c, d, a, b, w[14], 17, 0xa679438e); FF(b, c, d, a, w[15], 22, 0x49b40821); GG(a, b, c, d, w[ 1], 5, 0xf61e2562); GG(d, a, b, c, w[ 6], 9, 0xc040b340); GG(c, d, a, b, w[11], 14, 0x265e5a51); GG(b, c, d, a, w[ 0], 20, 0xe9b6c7aa); GG(a, b, c, d, w[ 5], 5, 0xd62f105d); GG(d, a, b, c, w[10], 9, 0x02441453); GG(c, d, a, b, w[15], 14, 0xd8a1e681); GG(b, c, d, a, w[ 4], 20, 0xe7d3fbc8); GG(a, b, c, d, w[ 9], 5, 0x21e1cde6); GG(d, a, b, c, w[14], 9, 0xc33707d6); GG(c, d, a, b, w[ 3], 14, 0xf4d50d87); GG(b, c, d, a, w[ 8], 20, 0x455a14ed); GG(a, b, c, d, w[13], 5, 0xa9e3e905); GG(d, a, b, c, w[ 2], 9, 0xfcefa3f8); GG(c, d, a, b, w[ 7], 14, 0x676f02d9); GG(b, c, d, a, w[12], 20, 0x8d2a4c8a); HH(a, b, c, d, w[ 5], 4, 0xfffa3942); HH(d, a, b, c, w[ 8], 11, 0x8771f681); HH(c, d, a, b, w[11], 16, 0x6d9d6122); HH(b, c, d, a, w[14], 23, 0xfde5380c); HH(a, b, c, d, w[ 1], 4, 0xa4beea44); HH(d, a, b, c, w[ 4], 11, 0x4bdecfa9); HH(c, d, a, b, w[ 7], 16, 0xf6bb4b60); HH(b, c, d, a, w[10], 23, 0xbebfbc70); HH(a, b, c, d, w[13], 4, 0x289b7ec6); HH(d, a, b, c, w[ 0], 11, 0xeaa127fa); HH(c, d, a, b, w[ 3], 16, 0xd4ef3085); HH(b, c, d, a, w[ 6], 23, 0x04881d05); HH(a, b, c, d, w[ 9], 4, 0xd9d4d039); HH(d, a, b, c, w[12], 11, 0xe6db99e5); HH(c, d, a, b, w[15], 16, 0x1fa27cf8); HH(b, c, d, a, w[ 2], 23, 0xc4ac5665); II(a, b, c, d, w[ 0], 6, 0xf4292244); II(d, a, b, c, w[ 7], 10, 0x432aff97); II(c, d, a, b, w[14], 15, 0xab9423a7); II(b, c, d, a, w[ 5], 21, 0xfc93a039); II(a, b, c, d, w[12], 6, 0x655b59c3); II(d, a, b, c, w[ 3], 10, 0x8f0ccc92); II(c, d, a, b, w[10], 15, 0xffeff47d); II(b, c, d, a, w[ 1], 21, 0x85845dd1); II(a, b, c, d, w[ 8], 6, 0x6fa87e4f); II(d, a, b, c, w[15], 10, 0xfe2ce6e0); II(c, d, a, b, w[ 6], 15, 0xa3014314); II(b, c, d, a, w[13], 21, 0x4e0811a1); II(a, b, c, d, w[ 4], 6, 0xf7537e82); II(d, a, b, c, w[11], 10, 0xbd3af235); II(c, d, a, b, w[ 2], 15, 0x2ad7d2bb); II(b, c, d, a, w[ 9], 21, 0xeb86d391); mp->h[0] += a; mp->h[1] += b; mp->h[2] += c; mp->h[3] += d; } #endif int md5Update(md5Param* mp, const byte* data, size_t size) { register uint32_t proclength; #if (MP_WBITS == 64) mpw add[1]; mpsetw(1, add, size); mplshift(1, add, 3); mpadd(1, mp->length, add); #elif (MP_WBITS == 32) mpw add[2]; mpsetws(2, add, size); mplshift(2, add, 3); mpadd(2, mp->length, add); #else # error #endif while (size > 0) { /* no truncation of data is possible here: maximum value returned is 64! */ proclength = (uint32_t) ((mp->offset + size) > 64U) ? (64U - mp->offset) : size; memcpy(((byte *) mp->data) + mp->offset, data, proclength); size -= proclength; data += proclength; mp->offset += proclength; if (mp->offset == 64U) { md5Process(mp); mp->offset = 0; } } return 0; } static void md5Finish(md5Param* mp) { register byte *ptr = ((byte *) mp->data) + mp->offset++; *(ptr++) = 0x80; if (mp->offset > 56) { while (mp->offset++ < 64) *(ptr++) = 0; md5Process(mp); mp->offset = 0; } ptr = ((byte *) mp->data) + mp->offset; while (mp->offset++ < 56) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[0] = (byte)(mp->length[0] ); ptr[1] = (byte)(mp->length[0] >> 8); ptr[2] = (byte)(mp->length[0] >> 16); ptr[3] = (byte)(mp->length[0] >> 24); ptr[4] = (byte)(mp->length[0] >> 32); ptr[5] = (byte)(mp->length[0] >> 40); ptr[6] = (byte)(mp->length[0] >> 48); ptr[7] = (byte)(mp->length[0] >> 56); #elif (MP_WBITS == 32) ptr[0] = (byte)(mp->length[1] ); ptr[1] = (byte)(mp->length[1] >> 8); ptr[2] = (byte)(mp->length[1] >> 16); ptr[3] = (byte)(mp->length[1] >> 24); ptr[4] = (byte)(mp->length[0] ); ptr[5] = (byte)(mp->length[0] >> 8); ptr[6] = (byte)(mp->length[0] >> 16); ptr[7] = (byte)(mp->length[0] >> 24); #else # error #endif md5Process(mp); mp->offset = 0; } int md5Digest(md5Param* mp, byte* data) { md5Finish(mp); /* encode 4 integers little-endian style */ data[ 0] = (byte)(mp->h[0] ); data[ 1] = (byte)(mp->h[0] >> 8); data[ 2] = (byte)(mp->h[0] >> 16); data[ 3] = (byte)(mp->h[0] >> 24); data[ 4] = (byte)(mp->h[1] ); data[ 5] = (byte)(mp->h[1] >> 8); data[ 6] = (byte)(mp->h[1] >> 16); data[ 7] = (byte)(mp->h[1] >> 24); data[ 8] = (byte)(mp->h[2] ); data[ 9] = (byte)(mp->h[2] >> 8); data[10] = (byte)(mp->h[2] >> 16); data[11] = (byte)(mp->h[2] >> 24); data[12] = (byte)(mp->h[3] ); data[13] = (byte)(mp->h[3] >> 8); data[14] = (byte)(mp->h[3] >> 16); data[15] = (byte)(mp->h[3] >> 24); md5Reset(mp); return 0; } /*!\} */ beecrypt-4.2.1/c++/0000777000175000001440000000000011226307272010706 500000000000000beecrypt-4.2.1/c++/lang/0000777000175000001440000000000011226307272011627 500000000000000beecrypt-4.2.1/c++/lang/System.cxx0000664000175000001440000000256310146672743013573 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include "beecrypt/c++/lang/System.h" #include "beecrypt/c++/io/FileInputStream.h" using beecrypt::io::FileInputStream; #include "beecrypt/c++/io/FileOutputStream.h" using beecrypt::io::FileOutputStream; using namespace beecrypt::lang; namespace { FileInputStream fin(stdin); FileOutputStream fout(stdout); FileOutputStream ferr(stderr); PrintStream pout(fout); PrintStream perr(ferr); } InputStream& System::in = fin; PrintStream& System::out = pout; PrintStream& System::err = perr; beecrypt-4.2.1/c++/lang/String.cxx0000644000175000001440000002264611216147022013541 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/String.h" #include "beecrypt/c++/lang/Character.h" #include "beecrypt/c++/lang/Integer.h" #include "beecrypt/c++/lang/Long.h" using namespace beecrypt::lang; #include #include #include String::String(array& swapWith) { assert(swapWith.size() <= Integer::MAX_VALUE); _value.swap(swapWith); } String::String(const array& lhs, const array& rhs) : _value(lhs.size() + rhs.size()) { assert(_value.size() <= Integer::MAX_VALUE); if (lhs.size()) memcpy(_value.data(), lhs.data(), lhs.size() * sizeof(jchar)); if (rhs.size()) memcpy(_value.data() + lhs.size(), rhs.data(), rhs.size() * sizeof(jchar)); } String::String() { } String::String(char c) : _value(1) { u_charsToUChars(&c, _value.data(), 1); } String::String(jchar c) : _value(&c, 1) { } String::String(const char* value) : _value(::strlen(value)) { assert(_value.size() <= Integer::MAX_VALUE); u_charsToUChars(value, _value.data(), _value.size()); } String::String(const jchar* value, int offset, int length) : _value(value+offset, length) { assert(_value.size() <= Integer::MAX_VALUE); } String::String(const array& copy) : _value(copy) { assert(_value.size() <= Integer::MAX_VALUE); } String::String(const String& copy) : _value(copy._value) { assert(_value.size() <= Integer::MAX_VALUE); } String::String(const UnicodeString& copy) : _value((int) copy.length()) { assert(_value.size() <= Integer::MAX_VALUE); copy.extract(0, copy.length(), _value.data()); } String& String::operator=(const String& copy) { _value = copy._value; assert(_value.size() <= Integer::MAX_VALUE); return *this; } String& String::operator=(const UnicodeString& copy) { assert(copy.length() <= Integer::MAX_VALUE); _value.resize((int) copy.length()); copy.extract(0, copy.length(), _value.data()); return *this; } int String::compareTo(const String& str) const throw () { int result; register int tlen = _value.size(), alen = str._value.size(), min; if (tlen < alen) { min = tlen; result = -1; } else if (tlen > alen) { min = alen; result = 1; } else { min = tlen; result = 0; } if (min > 0) { register const jchar *tdata = _value.data(), *adata = str._value.data(); register int tmp; do { tmp = (int) *(tdata++) - (int) *(adata++); if (tmp) return tmp; } while (--min > 0); } return result; } jchar String::charAt(int index) const throw (IndexOutOfBoundsException) { if ((index < 0) || (index >= _value.size())) throw IndexOutOfBoundsException(); return _value[index]; } int String::compareToIgnoreCase(const String& str) const throw () { return toUnicodeString().caseCompare(str.toUnicodeString(), 0); } String String::concat(const String& str) const throw () { return String(_value, str._value); } bool String::contains(const CharSequence& seq) const throw () { return indexOf(seq.toString()) >= 0; } bool String::contentEquals(const CharSequence& seq) const throw () { register int tlen = _value.size(); if (tlen != seq.length()) return false; for (int i = 0; i < tlen; i++) if (_value[i] != seq.charAt(i)) return false; return true; } bool String::endsWith(const String& suffix) const throw () { register int tlen = _value.size(), slen = suffix._value.size(); if (slen > tlen) return false; const jchar *tdata = _value.data() + tlen - slen, *sdata = suffix._value.data(); while (slen > 0) { if (*(tdata++) != *(sdata++)) return false; slen--; } return true; } bool String::equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const String* s = dynamic_cast(obj); if (s) return compareTo(*s) == 0; } return false; } bool String::equals(const String& str) const throw () { return compareTo(str) == 0; } bool String::equalsIgnoreCase(const String& str) const throw () { if (this == &str) return true; return compareToIgnoreCase(str) == 0; } int String::indexOf(int ch, int fromIndex) const throw () { if (ch < 0) return -1; if ((fromIndex < 0) || (fromIndex >= _value.size())) return -1; if (ch < Character::MIN_SUPPLEMENTARY_CODE_POINT) { // it's a regular jchar for (int i = fromIndex; i < _value.size(); i++) if (_value[i] == ch) return i; return -1; } /*!\todo if (ch <= 0x10ffff) { // convert this to two jchars } */ return -1; } int String::indexOf(const String& str, int fromIndex) const throw () { register int tlen = _value.size(), slen = str._value.size(); assert(tlen <= Integer::MAX_VALUE); if (fromIndex >= tlen) return (slen == 0) ? (int) tlen : -1; assert(fromIndex <= Integer::MAX_VALUE); if (slen == 0) return fromIndex; int max = tlen - slen; for (int i = fromIndex; i <= max; i++) { // find the first character while (_value[i] != str._value[0]) { if (i < max) i++; else return -1; } // find the rest int j = i + 1; int last = i + slen; for (int k = 1; (j < last) && _value[j] == str._value[k]; j++, k++); if (j == last) return i; } return -1; } jint String::hashCode() const throw () { register jint result = 0; for (int i = 0; i < _value.size(); i++) result = (result * 31) + _value[i]; return result; } int String::length() const throw () { return _value.size(); } bool String::startsWith(const String& prefix, int offset) const throw () { register int tlen = _value.size(), plen = prefix._value.size(); assert(offset <= Integer::MAX_VALUE); if (offset + plen > tlen) return false; const jchar *tdata = _value.data() + offset, *pdata = prefix._value.data(); while (plen > 0) { if (*(tdata++) != *(pdata++)) return false; plen--; } return true; } CharSequence* String::subSequence(int beginIndex, int endIndex) const throw (IndexOutOfBoundsException) { assert(beginIndex <= Integer::MAX_VALUE); assert(endIndex <= Integer::MAX_VALUE); if (beginIndex > endIndex || endIndex > _value.size()) throw IndexOutOfBoundsException(); if (beginIndex == 0 && endIndex == _value.size()) return new String(*this); else return new String(_value.data(), beginIndex, endIndex - beginIndex); } String String::substring(int beginIndex) const throw (IndexOutOfBoundsException) { assert(beginIndex <= Integer::MAX_VALUE); if (beginIndex > _value.size()) throw IndexOutOfBoundsException(); if (beginIndex == 0) return *this; else return String(_value.data(), beginIndex, _value.size() - beginIndex); } String String::substring(int beginIndex, int endIndex) const throw (IndexOutOfBoundsException) { assert(beginIndex <= Integer::MAX_VALUE); assert(endIndex <= Integer::MAX_VALUE); if (beginIndex > endIndex || endIndex > _value.size()) throw IndexOutOfBoundsException(); if (beginIndex == 0 && endIndex == _value.size()) return *this; else return String(_value.data(), beginIndex, endIndex - beginIndex); } const array& String::toCharArray() const throw () { return _value; } String String::toLowerCase() const throw () { return String(toUnicodeString().toLower()); } String String::toUpperCase() const throw () { return String(toUnicodeString().toUpper()); } String String::toString() const throw () { return *this; } UnicodeString String::toUnicodeString() const throw () { return UnicodeString(_value.data(), (int32_t) _value.size()); } String String::valueOf(bool b) { if (b) return String("true"); else return String("false"); } String String::valueOf(jint i) { return Integer::toString(i); } String String::valueOf(jlong l) { return Long::toString(l); } String beecrypt::lang::operator+(const String& s1, const String& s2) { return s1.concat(s2); } bool beecrypt::lang::operator<(const String& s1, const String& s2) { return (s1.compareTo(s2) < 0); } std::ostream& beecrypt::lang::operator<<(std::ostream& stream, const String* str) { if (str) return stream << (*str); else return stream << "null"; } std::ostream& beecrypt::lang::operator<<(std::ostream& stream, const String& str) { const array& src = str.toCharArray(); if (src.size()) { UErrorCode status = U_ZERO_ERROR; UConverter* loc; loc = ucnv_open(0, &status); if (U_FAILURE(status)) throw RuntimeException("ucnv_open failed"); int need = ucnv_fromUChars(loc, 0, 0, src.data(), src.size(), &status); if (U_FAILURE(status)) if (status != U_BUFFER_OVERFLOW_ERROR) throw RuntimeException("ucnv_fromUChars failed"); char* out = new char[need+1]; status = U_ZERO_ERROR; ucnv_fromUChars(loc, out, need+1, src.data(), src.size(), &status); if (U_FAILURE(status)) throw RuntimeException("ucnv_fromUChars failed"); stream << out; delete[] out; ucnv_close(loc); } return stream; } beecrypt-4.2.1/c++/lang/Thread.cxx0000644000175000001440000002367011216644060013504 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #if !WIN32 && HAVE_TIME_H # include #endif #if HAVE_ERRNO_H # include #endif #include "beecrypt/c++/lang/Thread.h" #include "beecrypt/c++/lang/String.h" #include "beecrypt/c++/lang/StringBuilder.h" #include "beecrypt/c++/lang/Error.h" #include "beecrypt/c++/lang/RuntimeException.h" using namespace beecrypt::lang; #ifdef HAVE_PTHREAD_H # include "beecrypt/c++/posix.h" #endif Thread::thread_map Thread::_tmap; bc_mutex_t Thread::_tmap_lock = Thread::init(); /* TODO THE MAIN THREAD CANNOT BE JOINED! */ #if WIN32 Thread Thread::_main("main", GetCurrentThreadId()); #elif HAVE_SYNCH_H Thread Thread::_main("main", thr_self()); #elif HAVE_PTHREAD_H Thread Thread::_main("main", pthread_self()); #else # error #endif #if WIN32 DWORD Thread::start_routine(void* args) #else void* Thread::start_routine(void* args) #endif { register Thread* t = (Thread*) args; #if WIN32 if (WaitForSingleObject(_tmap_lock, INFINITE) != WAIT_OBJECT_0) throw RuntimeException("WaitForSingleObject failed"); #elif HAVE_SYNCH_H if (mutex_lock(&_tmap_lock)) throw RuntimeException("mutex_lock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_lock(&_tmap_lock), "pthread_mutex_lock failed in Thread::start_routine()"); #else # error #endif _tmap[t->_tid] = t; #if WIN32 if (!ReleaseMutex(_tmap_lock)) throw RuntimeException("ReleaseMutex failed"); #elif HAVE_SYNCH_H if (mutex_unlock(&_tmap_lock)) throw RuntimeException("mutex_unlock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_unlock(&_tmap_lock), "pthread_mutex_unlock failed"); #else # error #endif t->_target->run(); if (!t->_daemon) { t->monitor->lock(); t->_state = Thread::TERMINATED; t->_joiner->lock(); t->_joiner->notifyAll(); t->_joiner->unlock(); t->monitor->unlock(); } return 0; } bc_mutex_t Thread::init() { bc_mutex_t lock; #if WIN32 if (!(lock = CreateMutex(NULL, FALSE, NULL))) throw RuntimeException("CreateMutex failed"); #elif HAVE_SYNCH_H if (mutex_init(&lock, USYNC_THREAD, 0)) throw RuntimeException("mutex_init failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_init(&lock, 0), "pthread_mutex_init failed"); #else # error #endif _tmap[_main._tid] = &_main; return lock; } Thread* Thread::find(bc_threadid_t id) { Thread* result = 0; #if WIN32 if (WaitForSingleObject(_tmap_lock, INFINITE) != WAIT_OBJECT_0) throw RuntimeException("WaitForSingleObject failed"); #elif HAVE_SYNCH_H if (mutex_lock(&_tmap_lock)) throw RuntimeException("mutex_lock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_lock(&_tmap_lock), "pthread_mutex_lock failed in Thread::find(bc_threadid_t)"); #else # error #endif thread_map_iterator it = _tmap.find(id); if (it != _tmap.end()) result = it->second; #if WIN32 if (!ReleaseMutex(_tmap_lock)) throw RuntimeException("ReleaseMutex failed"); #elif HAVE_SYNCH_H if (mutex_unlock(&_tmap_lock)) throw RuntimeException("mutex_unlock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_unlock(&_tmap_lock), "pthread_mutex_unlock failed"); #else # error #endif return result; } Thread* Thread::currentThread() { #if WIN32 return find(GetCurrentThreadId()); #elif HAVE_SYNCH_H return find(thr_self()); #elif HAVE_PTHREAD_H return find(pthread_self()); #else # error #endif } void Thread::sleep(jlong millis) throw (InterruptedException) { Object sleeper; synchronized (sleeper) { sleeper.wait(millis); } } void Thread::yield() { #if WIN32 SwitchToThread(); #elif HAVE_THREAD_H thr_yield(); #elif HAVE_SCHED_H sched_yield(); #endif } Thread::Thread(const String& name, bc_threadid_t id) : _name(name) { _target = this; _stacksize = 0; _daemon = true; _interrupted = false; _state = Thread::RUNNABLE; _monitoring = monitor = Monitor::getInstance(); _joiner = 0; } Thread::Thread() { _target = this; _stacksize = 0; _daemon = false; _interrupted = false; _state = Thread::NEW; _monitoring = monitor = Monitor::getInstance(); _joiner = Monitor::getInstance(); } Thread::Thread(const String& name) : _name(name) { _target = this; _stacksize = 0; _daemon = false; _interrupted = false; _state = Thread::NEW; _monitoring = monitor = Monitor::getInstance(); _joiner = Monitor::getInstance(); } Thread::Thread(Runnable& target) : _target(&target) { _stacksize = 0; _daemon = false; _interrupted = false; _state = Thread::NEW; _monitoring = monitor = Monitor::getInstance(); _joiner = Monitor::getInstance(); } Thread::Thread(Runnable& target, const String& name) : _target(&target), _name(name) { _stacksize = 0; _daemon = false; _interrupted = false; _state = Thread::NEW; _monitoring = monitor = Monitor::getInstance(); _joiner = Monitor::getInstance(); } Thread::Thread(Runnable& target, const String& name, size_t stacksize) : _target(&target), _name(name) { _stacksize = stacksize; _daemon = false; _interrupted = false; _state = Thread::NEW; _monitoring = monitor = Monitor::getInstance(); _joiner = Monitor::getInstance(); } Thread::~Thread() { /* The main Thread can't have a joiner */ if (_joiner) { if (!_daemon) { if (_state != Thread::NEW) { join(); #if WIN32 if (WaitForSingleObject(_tid, INFINITE) != WAIT_OBJECT_0) throw RuntimeException("WaitForSingleObject failed"); if (!CloseHandle(_tid)) throw RuntimeException("CloseHandle failed"); #elif HAVE_THREAD_H if (thr_join(_tid, 0, 0)) throw RuntimeException("thr_join failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_join(_tid, 0), "pthread_join failed"); #endif } #if WIN32 if (WaitForSingleObject(_tmap_lock, INFINITE) != WAIT_OBJECT_0) throw RuntimeException("WaitForSingleObject failed"); #elif HAVE_SYNCH_H if (mutex_lock(&_tmap_lock)) throw RuntimeException("mutex_lock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_lock(&_tmap_lock), "pthread_mutex_lock failed in Thread::~Thread()"); #else # error #endif _tmap.erase(_tid); #if WIN32 if (!ReleaseMutex(_tmap_lock)) throw RuntimeException("ReleaseMutex failed"); #elif HAVE_SYNCH_H if (mutex_unlock(&_tmap_lock)) throw RuntimeException("mutex_unlock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_unlock(&_tmap_lock), "pthread_mutex_unlock failed"); #else # error #endif } delete _joiner; _joiner = 0; } } void Thread::start() throw (IllegalThreadStateException) { monitor->lock(); if (_state != Thread::NEW) { monitor->unlock(); throw IllegalThreadStateException("Thread was already started"); } #if WIN32 if (!(_thr = CreateThread(NULL, _stacksize, (LPTHREAD_START_ROUTINE) start_routine, this, 0, &_tid))) throw RuntimeException("CreateThread failed"); #else # if HAVE_THREAD_H if (thr_create(0, _stacksize, start_routine, this, _daemon ? THR_DAEMON : 0, &_tid)) throw RuntimeException("thr_create failed"); # elif HAVE_PTHREAD_H if (_stacksize || _daemon) { pthread_attr_t attr; posixErrorDetector(pthread_attr_init(&attr), "pthread_attr_init failed"); if (_stacksize) posixErrorDetector(pthread_attr_setstacksize(&attr, _stacksize), "pthread_attr_setstacksize failed"); if (_daemon) posixErrorDetector(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED), "pthread_attr_setdetachstate failed"); posixErrorDetector(pthread_create(&_tid, &attr, start_routine, this), "pthread_create failed"); posixErrorDetector(pthread_attr_destroy(&attr), "pthread_attr_destroy failed"); } else { posixErrorDetector(pthread_create(&_tid, 0, start_routine, this), "pthread_create failed"); } # else # error # endif _thr = _tid; #endif _state = Thread::RUNNABLE; monitor->unlock(); } const String& Thread::getName() const throw () { return _name; } Thread::State Thread::getState() const throw () { return _state; } void Thread::interrupt() { monitor->lock(); if (_state == Thread::WAITING || _state == Thread::TIMED_WAITING) _monitoring->interrupt(_tid); else _interrupted = true; monitor->unlock(); } bool Thread::interrupted() { if (_monitoring->interrupted(_tid) || _interrupted) { _interrupted = false; return true; } return false; } bool Thread::isAlive() const throw () { switch (_state) { case Thread::NEW: case Thread::TERMINATED: return false; default: return true; } } bool Thread::isDaemon() const throw () { return _daemon; } bool Thread::isInterrupted() const throw () { return _interrupted || _monitoring->isInterrupted(_tid); } void Thread::join() throw (InterruptedException) { if (_joiner == 0) { throw Error("You cannot join the main thread"); } monitor->lock(); if (_state != Thread::NEW) { while (_state != Thread::TERMINATED) { monitor->unlock(); _joiner->lock(); _joiner->wait(0); _joiner->unlock(); monitor->lock(); } } monitor->unlock(); } void Thread::run() { } void Thread::setDaemon(bool on) throw (IllegalThreadStateException) { if (_state != NEW) throw IllegalThreadStateException("Thread was already started"); _daemon = on; } String Thread::toString() const throw () { return StringBuilder("Thread[").append(getName()).append("]").toString(); } beecrypt-4.2.1/c++/lang/Makefile.in0000644000175000001440000005241011226307160013606 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ TESTS = teststring$(EXEEXT) testthread$(EXEEXT) testnotify$(EXEEXT) check_PROGRAMS = teststring$(EXEEXT) testthread$(EXEEXT) \ testnotify$(EXEEXT) subdir = c++/lang DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxlang_la_LIBADD = am_libcxxlang_la_OBJECTS = Character.lo Integer.lo Long.lo Object.lo \ String.lo StringBuffer.lo StringBuilder.lo System.lo Thread.lo \ Throwable.lo libcxxlang_la_OBJECTS = $(am_libcxxlang_la_OBJECTS) am_testnotify_OBJECTS = testnotify.$(OBJEXT) testnotify_OBJECTS = $(am_testnotify_OBJECTS) testnotify_DEPENDENCIES = ../libbeecrypt_cxx.la am_teststring_OBJECTS = teststring.$(OBJEXT) teststring_OBJECTS = $(am_teststring_OBJECTS) teststring_DEPENDENCIES = ../libbeecrypt_cxx.la am_testthread_OBJECTS = testthread.$(OBJEXT) testthread_OBJECTS = $(am_testthread_OBJECTS) testthread_DEPENDENCIES = ../libbeecrypt_cxx.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxlang_la_SOURCES) $(testnotify_SOURCES) \ $(teststring_SOURCES) $(testthread_SOURCES) DIST_SOURCES = $(libcxxlang_la_SOURCES) $(testnotify_SOURCES) \ $(teststring_SOURCES) $(testthread_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxlang.la cxxlangdir = $(pkgincludedir)/c++/lang libcxxlang_la_SOURCES = \ Character.cxx \ Integer.cxx \ Long.cxx \ Object.cxx \ String.cxx \ StringBuffer.cxx \ StringBuilder.cxx \ System.cxx \ Thread.cxx \ Throwable.cxx teststring_SOURCES = teststring.cxx teststring_LDADD = ../libbeecrypt_cxx.la testthread_SOURCES = testthread.cxx testthread_LDADD = ../libbeecrypt_cxx.la testnotify_SOURCES = testnotify.cxx testnotify_LDADD = ../libbeecrypt_cxx.la all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/lang/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/lang/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxlang.la: $(libcxxlang_la_OBJECTS) $(libcxxlang_la_DEPENDENCIES) $(CXXLINK) $(libcxxlang_la_OBJECTS) $(libcxxlang_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list testnotify$(EXEEXT): $(testnotify_OBJECTS) $(testnotify_DEPENDENCIES) @rm -f testnotify$(EXEEXT) $(CXXLINK) $(testnotify_OBJECTS) $(testnotify_LDADD) $(LIBS) teststring$(EXEEXT): $(teststring_OBJECTS) $(teststring_DEPENDENCIES) @rm -f teststring$(EXEEXT) $(CXXLINK) $(teststring_OBJECTS) $(teststring_LDADD) $(LIBS) testthread$(EXEEXT): $(testthread_OBJECTS) $(testthread_DEPENDENCIES) @rm -f testthread$(EXEEXT) $(CXXLINK) $(testthread_OBJECTS) $(testthread_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Character.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Integer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Long.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Object.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/String.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StringBuffer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StringBuilder.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/System.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Thread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Throwable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testnotify.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teststring.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testthread.Po@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/lang/Object.cxx0000644000175000001440000010131011216643757013503 00000000000000/* * Copyright (c) 2004, 2005 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #if HAVE_ERRNO_H # include #endif #include #include "beecrypt/timestamp.h" #include "beecrypt/c++/lang/Object.h" #include "beecrypt/c++/lang/Integer.h" #include "beecrypt/c++/lang/Thread.h" #include "beecrypt/c++/lang/Error.h" #include "beecrypt/c++/lang/CloneNotSupportedException.h" #include "beecrypt/c++/lang/IllegalMonitorStateException.h" #include "beecrypt/c++/lang/InterruptedException.h" #include "beecrypt/c++/lang/StringBuilder.h" using namespace beecrypt::lang; #if HAVE_PTHREAD_H # include "beecrypt/c++/posix.h" #endif #include Object::Monitor::Monitor() : _owner(0), _interruptee(0) { #if WIN32 if (!(_lock = CreateMutex(0, FALSE, 0))) throw Error("CreateMutex failed"); #elif HAVE_SYNCH_H if (mutex_init(&_lock, USYNC_THREAD, 0)) throw Error("mutex_init failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_init(&_lock, 0), "pthread_mutex_init failed "); #else # error #endif _lock_count = 0; } void Object::Monitor::internal_state_lock() { #if WIN32 if (WaitForSingleObject(_lock, INFINITE) != WAIT_OBJECT_0) throw RuntimeException("WaitForSingleObject failed"); #elif HAVE_SYNCH_H if (mutex_lock(&_lock)) throw RuntimeException("mutex_lock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_lock(&_lock), "pthread_mutex_lock failed in Object::Monitor::internal_state_lock()"); #else # error #endif } void Object::Monitor::internal_state_unlock() { #if WIN32 if (!ReleaseMutex(_lock)) throw RuntimeException("ReleaseMutex failed"); #elif HAVE_SYNCH_H if (mutex_unlock(&_lock)) throw RuntimeException("mutex_unlock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_unlock(&_lock), "pthread_mutex_unlock failed in Object::Monitor::internal_state_unlock()"); #else # error #endif } bool Object::Monitor::interrupted(bc_threadid_t target) { bool result; internal_state_lock(); result = (_interruptee == target); if (result) _interruptee = false; internal_state_unlock(); return result; } bool Object::Monitor::isInterrupted(bc_threadid_t target) { bool result; internal_state_lock(); result = (_interruptee == target); internal_state_unlock(); return result; } bool Object::Monitor::isLocked() { bool result; internal_state_lock(); result = (_lock_count != 0); internal_state_unlock(); return result; } Object::Monitor* Object::Monitor::getInstance(bool fair) { if (fair) return new FairMonitor(); else return new NonfairMonitor(); } Object::NonfairMonitor::NonfairMonitor() { #if WIN32 if (!(_lock_sig = CreateSemaphore(NULL, 0, 0x7fffffff, NULL))) throw Error("CreateSemaphore failed"); _lock_sig_all = false; if (!(_lock_sig_all_done = CreateEvent(NULL, FALSE, FALSE, NULL))) throw Error("CreateEvent failed"); if (!(_notify_sig = CreateSemaphore(NULL, 0, 0x7fffffff, NULL))) throw Error("CreateSemaphore failed"); _notify_sig_all = false; if (!(_notify_sig_all_done = CreateEvent(NULL, FALSE, FALSE, NULL))) throw Error("CreateEvent failed"); #elif HAVE_SYNCH_H if (cond_init(&_lock_sig, USYNC_THREAD, 0)) throw Error("cond_init failed"); if (cond_init(&_notify_sig, USYNC_THREAD, 0)) throw Error("cond_init failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_cond_init(&_lock_sig, 0), "pthread_cond_init failed"); posixErrorDetector(pthread_cond_init(&_notify_sig, 0), "pthread_cond_init failed"); #else # error #endif _lock_wthreads = 0; _notify_wthreads = 0; } Object::NonfairMonitor::~NonfairMonitor() { #if WIN32 if (!CloseHandle(_lock)) throw Error("CloseHandle failed"); if (!CloseHandle(_lock_sig)) throw Error("CloseHandle failed"); if (!CloseHandle(_lock_sig_all_done)) throw Error("CloseHandle failed"); if (!CloseHandle(_notify_sig)) throw Error("CloseHandle failed"); if (!CloseHandle(_notify_sig_all_done)) throw Error("CloseHandle failed"); #elif HAVE_SYNCH_H if (mutex_destroy(&_lock)) throw Error("mutex_destroy failed"); if (cond_destroy(&_lock_sig)) throw Error("cond_destroy failed"); if (cond_destroy(&_notify_sig)) throw Error("cond_destroy failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_lock(&_lock), "pthread_mutex_lock failed in Object::NonfairMonitor::~NonfairMonitor()"); posixErrorDetector(pthread_mutex_unlock(&_lock), "pthread_mutex_unlock failed"); posixErrorDetector(pthread_mutex_destroy(&_lock), "pthread_mutex_destroy failed"); posixErrorDetector(pthread_cond_destroy(&_lock_sig), "pthread_cond_destroy failed"); posixErrorDetector(pthread_cond_destroy(&_notify_sig), "pthread_cond_destroy failed"); #else # error #endif } void Object::NonfairMonitor::interrupt(bc_threadid_t target) { internal_state_lock(); _interruptee = target; if (_notify_wthreads) { #if WIN32 _notify_sig_all = true; if (!ReleaseSemaphore(_notify_sig, _notify_wthreads, 0)) throw Error("ReleaseSemaphore failed"); #elif HAVE_SYNCH_H if (cond_broadcast(&_notify_sig)) throw Error("cond_broadcast failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_cond_broadcast(&_notify_sig), "pthread_cond_broadcast failed"); #else # error #endif } internal_state_unlock(); } void Object::NonfairMonitor::lock() { #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); if (_lock_count) { if (_owner == self) { if (++_lock_count == 0) throw Error("maximum lock count exceeded"); internal_state_unlock(); return; } else { if (++_lock_wthreads == 0) throw Error("maximum waiting threads exceeded"); while (_lock_count) { #if WIN32 switch (SignalObjectAndWait(_lock, _lock_sig, INFINITE, FALSE)) { case WAIT_OBJECT_0: break; default: throw Error("SignalObjectAndWait failed"); } if (WaitForSingleObject(_lock, INFINITE) != WAIT_OBJECT_0) throw Error("WaitForSingleObject failed"); #elif HAVE_SYNCH_H switch (cond_wait(&_lock_sig, &_lock)) { case EINTR: case 0: break; default: throw Error("cond_wait failed"); } #elif HAVE_PTHREAD_H int err; switch ((err = pthread_cond_wait(&_lock_sig, &_lock))) { case EINTR: case 0: break; default: posixErrorDetector(err, "pthread_cond_wait failed"); } #else # error #endif } _lock_wthreads--; #if WIN32 if (_lock_sig_all && (_lock_wthreads == 0)) { if (!ReleaseMutex(_lock)) throw Error("ReleaseMutex failed"); switch (SignalObjectAndWait(_lock_sig_all_done, _lock, INFINITE, FALSE)) { case WAIT_OBJECT_0: break; default: throw Error("SetEvent failed"); } } #endif } } _owner = self; _lock_count = 1; internal_state_unlock(); } void Object::NonfairMonitor::lockInterruptibly() throw (InterruptedException) { bool interrupted = false; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); if (_interruptee == self) { interrupted = true; _interruptee = 0; } if (!interrupted) { if (_lock_count) { if (_owner == self) { if (++_lock_count == 0) throw Error("maximum lock count exceeded"); internal_state_unlock(); return; } else { if (++_lock_wthreads == 0) throw Error("maximum waiting threads exceeded"); while (_lock_count) { #if WIN32 switch (SignalObjectAndWait(_lock, _lock_sig, INFINITE, FALSE)) { case WAIT_OBJECT_0: break; default: throw Error("SignalObjectAndWait failed"); } if (WaitForSingleObject(_lock, INFINITE) != WAIT_OBJECT_0) throw Error("WaitForSingleObject failed"); #elif HAVE_SYNCH_H switch (cond_wait(&_lock_sig, &_lock)) { case EINTR: interrupted = true; case 0: break; default: throw Error("cond_wait failed"); } #elif HAVE_PTHREAD_H int err; switch ((err = pthread_cond_wait(&_lock_sig, &_lock))) { case EINTR: interrupted = true; case 0: break; default: posixErrorDetector(err, "pthread_cond_wait failed"); } #else # error #endif } _lock_wthreads--; #if WIN32 if (_lock_sig_all && (_lock_wthreads == 0)) { if (!ReleaseMutex(_lock)) throw Error("ReleaseMutex failed"); switch (SignalObjectAndWait(_lock_sig_all_done, _lock, INFINITE, FALSE)) { case WAIT_OBJECT_0: break; default: throw Error("SetEvent failed"); } } #endif } } if (!interrupted) { _owner = self; _lock_count = 1; } } internal_state_unlock(); if (interrupted) throw InterruptedException(); } bool Object::NonfairMonitor::tryLock() { bool result = false; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); if (_lock_count) { result = (_owner == self); if (result) if (++_lock_count == 0) throw Error("maximum lock count exceeded"); } else { _lock_count = 1; _owner = self; } internal_state_unlock(); return result; } void Object::NonfairMonitor::unlock() { bool owned; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); if ((owned = (_owner == self))) { if (!--_lock_count) { if (_lock_wthreads) { #if WIN32 if (!ReleaseSemaphore(_lock_sig, 1, 0)) throw Error("ReleaseSemaphore failed"); #elif HAVE_SYNCH_H if (cond_signal(&_lock_sig)) throw Error("cond_signal failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_cond_signal(&_lock_sig), "pthread_cond_signal failed"); #else # error #endif } _owner = 0; } } internal_state_unlock(); if (!owned) throw IllegalMonitorStateException(); } void Object::NonfairMonitor::notify() { bool owned; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); owned = (_owner == self); if (owned) { if (_notify_wthreads) { #if WIN32 if (!ReleaseSemaphore(_notify_sig, 1, 0)) throw Error("ReleaseSemaphore failed"); #elif HAVE_SYNCH_H if (cond_signal(&_notify_sig)) throw Error("cond_signal failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_cond_signal(&_notify_sig), "pthread_cond_signal failed"); #else # error #endif } } internal_state_unlock(); if (!owned) throw IllegalMonitorStateException(); } void Object::NonfairMonitor::notifyAll() { bool owned; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); owned = (_owner == self); if (owned) { if (_notify_wthreads) { #if WIN32 _notify_sig_all = true; if (!ReleaseSemaphore(_notify_sig, _notify_wthreads, 0)) throw Error("ReleaseSemaphore failed"); #elif HAVE_SYNCH_H if (cond_broadcast(&_notify_sig)) throw Error("cond_broadcast failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_cond_broadcast(&_notify_sig), "pthread_cond_broadcast failed"); #else # error #endif } } internal_state_unlock(); if (!owned) throw IllegalMonitorStateException(); } void Object::NonfairMonitor::wait(jlong timeout) throw (InterruptedException) { bool owned, interrupted = false; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); if (_interruptee == self) { interrupted = true; _interruptee = 0; } if (!interrupted && (owned = (_owner == self))) { #if WIN32 bool last_waiter; #endif unsigned int save_lock_count = _lock_count; _owner = 0; _lock_count = 0; if (++_notify_wthreads == 0) throw Error("maximum waiting threads exceeded"); #if WIN32 if (!ReleaseSemaphore(_lock_sig, 1, 0)) throw Error("ReleaseSemaphore failed"); switch (SignalObjectAndWait(_lock, _notify_sig, timeout ? timeout : INFINITE, TRUE)) { case WAIT_IO_COMPLETION: interrupted = true; case WAIT_OBJECT_0: case WAIT_TIMEOUT: break; default: throw Error("SignalObjectAndWait failed"); } if (WaitForSingleObject(_lock, INFINITE) != WAIT_OBJECT_0) throw Error("WaitForSingleObject failed"); #else register int rc; # if HAVE_SYNCH_H if (cond_signal(&_lock_sig)) throw Error("cond_signal failed"); if (timeout) { timestruc to; to.tv_sec = timeout / 1000; to.tv_nsec = (timeout % 1000) * 1000000L; rc = cond_reltimedwait(&_notify_sig, &_lock, &to); } else rc = cond_wait(&_notify_sig, &_lock); # elif HAVE_PTHREAD_H posixErrorDetector(pthread_cond_signal(&_lock_sig), "pthread_cond_signal failed"); if (timeout) { struct timespec to; timeout += timestamp(); to.tv_sec = timeout / 1000; to.tv_nsec = (timeout % 1000) * 1000000L; rc = pthread_cond_timedwait(&_notify_sig, &_lock, &to); } else rc = pthread_cond_wait(&_notify_sig, &_lock); # else # error # endif switch (rc) { case EINTR: interrupted = true; case ETIMEDOUT: break; case 0: if (_interruptee == self) { interrupted = true; _interruptee = 0; } break; default: # if HAVE_SYNCH_H if (timeout) throw Error("cond_timedwait failed"); else throw Error("cond_wait failed"); # elif HAVE_PTHREAD_H if (timeout) throw Error("pthread_cond_timedwait failed"); else throw Error("pthread_cond_wait failed"); # else # error # endif } #endif if (_lock_count) { // owner cannot be self; somebody else obtained the lock; wait until it's out turn if (++_lock_wthreads == 0) throw Error("maximum waiting threads exceeded"); do { #if WIN32 switch (SignalObjectAndWait(_lock, _lock_sig, INFINITE, TRUE)) { case WAIT_IO_COMPLETION: interrupted = true; case WAIT_OBJECT_0: break; default: throw Error("SignalObjectAndWait failed"); } if (WaitForSingleObject(_lock, INFINITE) != WAIT_OBJECT_0) throw Error("WaitForSingleObject failed"); #elif HAVE_SYNCH_H switch (cond_wait(&_lock_sig, &_lock)) { case EINTR: interrupted = true; case 0: break; default: throw Error("cond_wait failed"); } #elif HAVE_PTHREAD_H switch (pthread_cond_wait(&_lock_sig, &_lock)) { case EINTR: interrupted = true; case 0: break; default: throw Error("pthread_cond_wait failed"); } #else # error #endif } while (_lock_count); _lock_wthreads--; } _notify_wthreads--; _owner = self; _lock_count = save_lock_count; #if WIN32 if (_notify_sig_all && (_notify_wthreads == 0)) if (!SetEvent(_notify_sig_all_done)) throw Error("SetEvent failed"); #endif } internal_state_unlock(); if (interrupted) throw InterruptedException(); } Object::FairMonitor::waiter::waiter(bc_threadid_t owner, unsigned int lock_count) : owner(owner), lock_count(lock_count) { #if WIN32 if (!(event = CreateEvent(NULL, FALSE, FALSE, NULL))) throw Error("CreateEvent failed"); #elif HAVE_THREAD_H if (cond_init(&event, USYNC_THREAD, 0)) throw Error("cond_init failed"); #elif HAVE_PTHREAD_H if (pthread_cond_init(&event, 0)) throw Error("pthread_cond_init failed"); #else # error #endif next = 0; prev = 0; } Object::FairMonitor::waiter::~waiter() { #if WIN32 if (!CloseHandle(event)) throw Error("CloseHandle failed"); #elif HAVE_THREAD_H if (cond_destroy(&event)) throw Error("cond_destroy failed"); #elif HAVE_PTHREAD_H if (pthread_cond_destroy(&event)) throw Error("pthread_cond_destroy failed"); #else # error #endif } Object::FairMonitor::FairMonitor() { _lock_count = 0; _lock_head = _lock_tail = 0; _notify_head = _notify_tail = 0; } Object::FairMonitor::~FairMonitor() { internal_state_lock(); /*!\todo should a warning be given when there are still has pending locks? */ while (_lock_head) { waiter* tmp = _lock_head; _lock_head = _lock_head->next; delete tmp; } /*!\todo should a warning be given when there are still has pending waits? */ while (_notify_head) { waiter* tmp = _notify_head; _notify_head = _notify_head->next; delete tmp; } internal_state_unlock(); #if WIN32 if (!CloseHandle(_lock)) throw Error("CloseHandle failed"); #elif HAVE_SYNCH_H if (mutex_destroy(&_lock)) throw Error("mutex_destroy failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_destroy(&_lock), "pthread_mutex_destroy failed"); #else # error #endif } void Object::FairMonitor::interrupt(bc_threadid_t target) { internal_state_lock(); _interruptee = target; if (_notify_head) { waiter* tmp = _notify_head; do { if (tmp->owner == target) { if (_notify_head == tmp) { if (!(_notify_head = tmp->next)) _notify_tail = 0; } else { if ((tmp->prev->next = tmp->next)) tmp->next->prev = tmp->prev; else _notify_tail = 0; } tmp->next = 0; #if WIN32 if (!SetEvent(tmp->event)) throw Error("SetEvent failed"); #elif HAVE_SYNCH_H if (cond_signal(&tmp->event)) throw Error("cond_signal failed"); #elif HAVE_PTHREAD_H if (pthread_cond_signal(&tmp->event)) throw Error("pthread_cond_signal failed"); #else # error #endif break; } tmp = tmp->next; } while (tmp); } internal_state_unlock(); } void Object::FairMonitor::lock() { #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); if (_lock_count) { if (_owner == self) { if (++_lock_count == 0) throw Error("maximum lock count exceeded"); internal_state_unlock(); return; } else { waiter* me = new waiter(self, 1); if (_lock_head) { me->prev = _lock_tail; _lock_tail = _lock_tail->next = me; } else _lock_head = _lock_tail = me; while (_owner != self) { #if WIN32 switch (SignalObjectAndWait(_lock, me->event, INFINITE, FALSE)) { case WAIT_OBJECT_0: break; default: throw Error("SignalObjectAndWait failed"); } if (WaitForSingleObject(_lock, INFINITE) != WAIT_OBJECT_0) throw Error("WaitForSingleObject failed"); #elif HAVE_SYNCH_H switch (cond_wait(&me->event, &_lock)) { case EINTR: case 0: break; default: throw Error("cond_wait failed"); } #elif HAVE_PTHREAD_H switch (pthread_cond_wait(&me->event, &_lock)) { case EINTR: case 0: break; default: throw Error("pthread_cond_wait failed"); } #else # error #endif } delete me; } } else { _owner = self; _lock_count = 1; } internal_state_unlock(); } void Object::FairMonitor::lockInterruptibly() throw (InterruptedException) { bool interrupted = false; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); if (_interruptee == self) { interrupted = true; _interruptee = 0; } if (!interrupted) { if (_lock_count) { if (_owner == self) { if (++_lock_count == 0) throw Error("maximum lock count exceeded"); internal_state_unlock(); return; } else { waiter* me = new waiter(self, 1); if (_lock_head) { me->prev = _lock_tail; _lock_tail = _lock_tail->next = me; } else _lock_head = _lock_tail = me; while (_owner != self) { #if WIN32 switch (SignalObjectAndWait(_lock, me->event, INFINITE, FALSE)) { case WAIT_OBJECT_0: break; default: throw Error("SignalObjectAndWait failed"); } if (WaitForSingleObject(_lock, INFINITE) != WAIT_OBJECT_0) throw Error("WaitForSingleObject failed"); #elif HAVE_SYNCH_H switch (cond_wait(&me->event, &_lock)) { case EINTR: interrupted = true; case 0: break; default: throw Error("cond_wait failed"); } #elif HAVE_PTHREAD_H switch (pthread_cond_wait(&me->event, &_lock)) { case EINTR: interrupted = true; case 0: break; default: throw Error("pthread_cond_wait failed"); } #else # error #endif } delete me; } } if (!interrupted) { _owner = self; _lock_count = 1; } } internal_state_unlock(); if (interrupted) throw InterruptedException(); } bool Object::FairMonitor::tryLock() { bool result = false; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); if (_lock_count) { result = (_owner == self); if (result) if (++_lock_count == 0) throw Error("maximum lock count exceeded"); } else { _lock_count = 1; _owner = self; } internal_state_unlock(); return result; } void Object::FairMonitor::unlock() { bool owned; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); owned = (_owner == self); if (owned) { if (!--_lock_count) { if (_lock_head) { _owner = _lock_head->owner; _lock_count = _lock_head->lock_count; #if WIN32 if (!SetEvent(_lock_head->event)) throw Error("SetEvent failed"); #elif HAVE_SYNCH_H if (cond_signal(&_lock_head->event)) throw Error("cond_signal failed"); #elif HAVE_PTHREAD_H if (pthread_cond_signal(&_lock_head->event)) throw Error("pthread_cond_signal failed"); #else # error #endif if ((_lock_head = _lock_head->next)) _lock_head->prev = 0; else _lock_tail = 0; } else { // no more waiters for the lock _owner = 0; } } } internal_state_unlock(); if (!owned) throw IllegalMonitorStateException(); } void Object::FairMonitor::notify() { bool owned; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); owned = (_owner == self); if (owned) { if (_notify_head) { // take head from notify list, signal it, and move it from notify list to the tail of the lock list waiter* target = _notify_head; #if WIN32 if (!SetEvent(&target->event)) throw Error("SetEvent failed"); #elif HAVE_SYNCH_H if (cond_signal(&target->event)) throw Error("cond_signal failed"); #elif HAVE_PTHREAD_H if (pthread_cond_signal(&target->event)) throw Error("pthread_cond_signal failed"); #else # error #endif if ((_notify_head = _notify_head->next)) _notify_head->prev = 0; else _notify_tail = 0; if (_lock_head) { target->prev = _lock_tail; _lock_tail = _lock_tail->next = target; } else _lock_head = _lock_tail = target; } } internal_state_unlock(); if (!owned) throw IllegalMonitorStateException(); } void Object::FairMonitor::notifyAll() { bool owned; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); owned = (_owner == self); if (owned) { if (_notify_head) { while (_notify_head) { waiter* target = _notify_head; #if WIN32 if (!SetEvent(target->event)) throw Error("SetEvent failed"); #elif HAVE_SYNCH_H if (cond_signal(&target->event)) throw Error("cond_signal failed"); #elif HAVE_PTHREAD_H if (pthread_cond_signal(&target->event)) throw Error("pthread_cond_signal failed"); #else # error #endif if ((_notify_head = _notify_head->next)) _notify_head->prev = 0; else _notify_tail = 0; if (_lock_head) { target->prev = _lock_tail; _lock_tail = _lock_tail->next = target; } else _lock_head = _lock_tail = target; } } } internal_state_unlock(); if (!owned) throw IllegalMonitorStateException(); } void Object::FairMonitor::wait(jlong timeout) throw (InterruptedException) { bool owned, interrupted = false; #if WIN32 bc_threadid_t self = GetCurrentThreadId(); #elif HAVE_SYNCH_H bc_threadid_t self = thr_self(); #elif HAVE_PTHREAD_H bc_threadid_t self = pthread_self(); #else # error #endif internal_state_lock(); if (_interruptee == self) { interrupted = true; _interruptee = 0; } if (!interrupted && (owned = (_owner == self))) { waiter* me = new waiter(_owner, _lock_count); // append to notify queue if (_notify_head) { me->prev = _notify_tail; _notify_tail = _notify_tail->next = me; } else { _notify_head = _notify_tail = me; } if (_lock_head) { // transfer ownership to the head of the lock list _owner = _lock_head->owner; _lock_count = _lock_head->lock_count; #if WIN32 if (!SetEvent(_lock_head->event)) throw Error("SetEvent failed"); #elif HAVE_SYNCH_H if (cond_signal(&_lock_head->event)) throw Error("cond_signal failed"); #elif HAVE_PTHREAD_H if (pthread_cond_signal(&_lock_head->event)) throw Error("pthread_cond_signal failed"); #else # error #endif if ((_lock_head = _lock_head->next)) _lock_head->prev = 0; else _lock_tail = 0; } else { // nobody is waiting for the lock _owner = 0; _lock_count = 0; } #if WIN32 #else register int rc; # if HAVE_SYNCH_H if (timeout) { timestruc to; to.tv_sec = timeout / 1000; to.tv_nsec = (timeout % 1000) * 1000000L; rc = cond_reltimedwait(&me->event, &_lock, &to); } else rc = cond_wait(&me->event, &_lock); # elif HAVE_PTHREAD_H if (timeout) { struct timespec to; timeout += timestamp(); to.tv_sec = timeout / 1000; to.tv_nsec = (timeout % 1000) * 1000000L; rc = pthread_cond_timedwait(&me->event, &_lock, &to); } else rc = pthread_cond_wait(&me->event, &_lock); # else # error # endif switch (rc) { case EINTR: interrupted = true; // run on into next case case ETIMEDOUT: // event was not received, and definitely not interrupted: remove me from the notify list if (_notify_head == me) { if (!(_notify_head = me->next)) _notify_tail = 0; } else { if ((me->prev->next = me->next)) me->next->prev = me->prev; else _notify_tail = 0; } me->next = 0; break; case 0: if (_interruptee == self) { interrupted = true; _interruptee = 0; } break; default: # if HAVE_SYNCH_H if (timeout) throw Error("cond_reltimedwait failed"); else throw Error("cond_wait failed"); # elif HAVE_PTHREAD_H if (timeout) throw Error("pthread_cond_timedwait failed"); else throw Error("pthread_cond_wait failed"); # else # error # endif } #endif // after receiving the signal, we simply take the ownership _owner = me->owner; _lock_count = me->lock_count; delete me; } internal_state_unlock(); if (interrupted) throw InterruptedException(); } Object::Synchronizer::Synchronizer(const Object* obj) : _ref(obj), _once(true) { _ref->lock(); } Object::Synchronizer::Synchronizer(const Object& obj) : _ref(&obj), _once(true) { _ref->lock(); } Object::Synchronizer::~Synchronizer() { _ref->unlock(); } bool Object::Synchronizer::checkonce() { if (_once) { _once = false; return true; } return false; } bc_mutex_t Object::_init_lock = Object::init(); bc_mutex_t Object::init() { bc_mutex_t tmp; #if WIN32 if (!(tmp = CreateMutex(NULL, FALSE, NULL))) throw Error("CreateMutex failed"); #elif HAVE_SYNCH_H if (mutex_init(&tmp, USYNC_THREAD, 0)) throw Error("mutex_init failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_init(&tmp, 0), "pthread_mutex_init failed"); #else # error #endif return tmp; } Object::Object() : _ref_count(0), monitor(0) { } Object::~Object() { delete monitor; monitor = 0; } Object* Object::clone() const throw (CloneNotSupportedException) { throw CloneNotSupportedException(); } bool Object::equals(const Object* cmp) const throw () { return this == cmp; } jint Object::hashCode() const throw () { if (sizeof(this) == sizeof(jint)) { return (jint) (unsigned long) this; } else { return (jint) ((unsigned long) this ^ ((unsigned long) this) >> 32); } } void Object::lock() const { while (!monitor) { // lazy initialization of the notifier #if WIN32 if (WaitForSingleObject(_init_lock, INFINITE) != WAIT_OBJECT_0) throw Error("WaitForSingleObject failed"); #elif HAVE_SYNCH_H if (mutex_lock(&_init_lock)) throw Error("mutex_lock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_lock(&_init_lock), "pthread_mutex_lock failed in Object::lock()"); #else # error #endif if (!monitor) { monitor = Monitor::getInstance(); } #if WIN32 if (!ReleaseMutex(_init_lock)) throw Error("ReleaseMutex failed"); #elif HAVE_SYNCH_H if (mutex_unlock(&_init_lock)) throw Error("mutex_unlock failed"); #elif HAVE_PTHREAD_H posixErrorDetector(pthread_mutex_unlock(&_init_lock), "pthread_mutex_unlock failed"); #else # error #endif } Thread* t = Thread::currentThread(); if (t) { t->_state = Thread::BLOCKED; t->_monitoring = monitor; } monitor->lock(); if (t) { t->_state = Thread::RUNNABLE; t->_monitoring = t->monitor; } } void Object::unlock() const { if (!monitor) throw IllegalMonitorStateException("Object has no monitor"); monitor->unlock(); } void Object::notify() const { if (!monitor) throw IllegalMonitorStateException("Object has no monitor"); monitor->notify(); } void Object::notifyAll() const { if (!monitor) throw IllegalMonitorStateException("Object has no monitor"); monitor->notifyAll(); } void Object::wait(jlong timeout) const throw (InterruptedException) { if (timeout < 0) { throw IllegalArgumentException("timeout value must be >= 0"); } else { bool interrupted = false; if (!monitor) throw IllegalMonitorStateException("Object has no monitor"); Thread* t = Thread::find(monitor->_owner); // alternatively: Thread::currentThread() if (t) { t->monitor->lock(); if (t->_interrupted) { t->_interrupted = false; t->monitor->unlock(); throw InterruptedException(); } else { t->_state = (timeout == 0) ? Thread::WAITING : Thread::TIMED_WAITING; t->_monitoring = monitor; t->monitor->unlock(); } } try { monitor->wait(timeout); } catch (InterruptedException) { interrupted = true; } if (t) { t->monitor->lock(); t->_state = Thread::RUNNABLE; t->_monitoring = t->monitor; t->_interrupted = false; t->monitor->unlock(); } if (interrupted) throw InterruptedException(); } } String Object::toString() const throw () { return StringBuilder(typeid(*this).name()).append('@').append(Integer::toHexString(hashCode())).toString(); } void beecrypt::lang::collection_attach(Object* obj) throw () { assert(obj != 0); obj->_ref_count++; } void beecrypt::lang::collection_detach(Object* obj) throw () { assert(obj != 0); obj->_ref_count--; } void beecrypt::lang::collection_remove(Object* obj) throw () { assert(obj != 0); if (--obj->_ref_count == 0) delete obj; } void beecrypt::lang::collection_rcheck(Object* obj) throw () { assert(obj != 0); if (obj->_ref_count == 0) delete obj; } beecrypt-4.2.1/c++/lang/StringBuffer.cxx0000664000175000001440000000763210301156432014672 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/StringBuffer.h" using namespace beecrypt::lang; #include StringBuffer::StringBuffer() : _buffer(16) { _used = 0; } StringBuffer::StringBuffer(const char* s) : _buffer(16 + strlen(s)) { u_charsToUChars(s, _buffer.data(), _used = strlen(s)); } StringBuffer::StringBuffer(const String& s) : _buffer(16 + s._value.size()) { memcpy(_buffer.data(), s._value.data(), (_used = s._value.size()) * sizeof(jchar)); } StringBuffer& StringBuffer::append(bool b) { return append(b ? "true" : "false"); } StringBuffer& StringBuffer::append(char c) { synchronized (this) { core_ensureCapacity(_used+1); u_charsToUChars(&c, _buffer.data() + _used++, 1); } return *this; } Appendable& StringBuffer::append(jchar c) { synchronized (this) { core_ensureCapacity(_used+1); _buffer[_used++] = c; } return *this; } Appendable& StringBuffer::append(const CharSequence& c) { synchronized (this) { jint need = c.length(); core_ensureCapacity(_used + need); for (jint i = 0; i < need; i++) _buffer[_used++] = c.charAt(i); } return *this; } StringBuffer& StringBuffer::append(const char* s) { synchronized (this) { jint need = strlen(s); core_ensureCapacity(_used + need); u_charsToUChars(s, _buffer.data() + _used, need); _used += need; } return *this; } StringBuffer& StringBuffer::append(const String& s) { synchronized (this) { jint need = s._value.size(); core_ensureCapacity(_used + need); memcpy(_buffer.data() + _used, s._value.data(), need * sizeof(jchar)); _used += need; } return *this; } StringBuffer& StringBuffer::append(const StringBuffer& s) { synchronized (this) { jint need = s._used; core_ensureCapacity(_used + need); memcpy(_buffer.data() + _used, s._buffer.data(), need * sizeof(jchar)); _used += need; } return *this; } void StringBuffer::core_ensureCapacity(jint minimum) { if (minimum > _buffer.size()) { jint newcapacity = _buffer.size() * 2 + 2; if (minimum > newcapacity) newcapacity = minimum; _buffer.resize(newcapacity); } } void StringBuffer::ensureCapacity(jint minimum) { synchronized (this) { core_ensureCapacity(minimum); } } jchar StringBuffer::charAt(jint index) const throw (IndexOutOfBoundsException) { jchar result = 0; synchronized (this) { if (index >= _used) throw IndexOutOfBoundsException(); result = _buffer[index]; } return result; } jint StringBuffer::length() const throw () { jint result = 0; synchronized (this) { result = _used; } return result; } CharSequence* StringBuffer::subSequence(jint beginIndex, jint endIndex) const throw (IndexOutOfBoundsException) { String* result = 0; synchronized (this) { if (beginIndex < 0 || endIndex < 0) throw IndexOutOfBoundsException(); if (beginIndex > endIndex || endIndex > _used) throw IndexOutOfBoundsException(); result = new String(_buffer.data(), beginIndex, endIndex - beginIndex); } return result; } String StringBuffer::toString() const throw () { synchronized (this) { return String(_buffer.data(), 0, _used); } return String(); } beecrypt-4.2.1/c++/lang/Makefile.am0000664000175000001440000000117110502514362013575 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxlang.la cxxlangdir=$(pkgincludedir)/c++/lang libcxxlang_la_SOURCES = \ Character.cxx \ Integer.cxx \ Long.cxx \ Object.cxx \ String.cxx \ StringBuffer.cxx \ StringBuilder.cxx \ System.cxx \ Thread.cxx \ Throwable.cxx TESTS = teststring testthread testnotify check_PROGRAMS = teststring testthread testnotify teststring_SOURCES = teststring.cxx teststring_LDADD = ../libbeecrypt_cxx.la testthread_SOURCES = testthread.cxx testthread_LDADD = ../libbeecrypt_cxx.la testnotify_SOURCES = testnotify.cxx testnotify_LDADD = ../libbeecrypt_cxx.la beecrypt-4.2.1/c++/lang/StringBuilder.cxx0000664000175000001440000001103610301156465015046 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/StringBuilder.h" #include "beecrypt/c++/lang/Character.h" #include "beecrypt/c++/lang/Integer.h" #include "beecrypt/c++/lang/Long.h" using namespace beecrypt::lang; #include StringBuilder::StringBuilder() : _buffer(16) { _used = 0; } StringBuilder::StringBuilder(const char* s) : _buffer(16 + strlen(s)) { u_charsToUChars(s, _buffer.data(), _used = strlen(s)); } StringBuilder::StringBuilder(const String& s) : _buffer(16 + s._value.size()) { memcpy(_buffer.data(), s._value.data(), (_used = s._value.size()) * sizeof(jchar)); } StringBuilder& StringBuilder::append(bool b) { return append(b ? "true" : "false"); } StringBuilder& StringBuilder::append(char c) { ensureCapacity(_used+1); u_charsToUChars(&c, _buffer.data() + _used++, 1); return *this; } Appendable& StringBuilder::append(jchar c) { ensureCapacity(_used+1); _buffer[_used++] = c; return *this; } Appendable& StringBuilder::append(const CharSequence& c) { jint need = c.length(); ensureCapacity(_used + need); for (jint i = 0; i < need; i++) _buffer[_used++] = c.charAt(i); return *this; } StringBuilder& StringBuilder::append(jint i) { return append(Integer::toString(i)); } StringBuilder& StringBuilder::append(jlong l) { return append(Long::toString(l)); } StringBuilder& StringBuilder::append(const char* s) { jint need = strlen(s); ensureCapacity(_used + need); u_charsToUChars(s, _buffer.data() + _used, need); _used += need; return *this; } StringBuilder& StringBuilder::append(const String& s) { jint need = s._value.size(); ensureCapacity(_used + need); memcpy(_buffer.data() + _used, s._value.data(), need * sizeof(jchar)); _used += need; return *this; } StringBuilder& StringBuilder::append(const StringBuilder& s) { jint need = s._used; ensureCapacity(_used + need); memcpy(_buffer.data() + _used, s._buffer.data(), need * sizeof(jchar)); _used += need; return *this; } StringBuilder& StringBuilder::append(const Object* obj) { if (obj) return append(obj->toString()); else return append("(null)"); } StringBuilder& StringBuilder::reverse() { /*!\todo needed for BigInteger::toString() functions */ bool hasSurrogate = false; jint n = _used - 1; for (jint i = (n-1) >> 1; i >= 0; --i) { jchar c1 = _buffer[i]; jchar c2 = _buffer[n-i]; if (!hasSurrogate) hasSurrogate = (c1 >= Character::MIN_SURROGATE && c1 <= Character::MAX_SURROGATE) || (c2 >= Character::MIN_SURROGATE && c2 <= Character::MAX_SURROGATE); _buffer[i] = c2; _buffer[n-i] = c1; } if (hasSurrogate) { for (jint i = 0; i < _used-1; i++) { jchar c1 = _buffer[i]; if (Character::isLowSurrogate(c1)) { jchar c2 = _buffer[i+1]; if (Character::isHighSurrogate(c2)) { _buffer[i++] = c2; _buffer[i] = c1; } } } } return *this; } void StringBuilder::ensureCapacity(jint minimum) { if (minimum > _buffer.size()) { jint newcapacity = _buffer.size() * 2 + 2; if (minimum > newcapacity) newcapacity = minimum; _buffer.resize(newcapacity); } } jchar StringBuilder::charAt(jint index) const throw (IndexOutOfBoundsException) { if (index >= _used) throw IndexOutOfBoundsException(); return _buffer[index]; } jint StringBuilder::length() const throw () { return _used; } CharSequence* StringBuilder::subSequence(jint beginIndex, jint endIndex) const throw (IndexOutOfBoundsException) { if (beginIndex < 0 || endIndex < 0) throw IndexOutOfBoundsException(); if (beginIndex > endIndex || endIndex > _used) throw IndexOutOfBoundsException(); return new String(_buffer.data(), beginIndex, endIndex - beginIndex); } String StringBuilder::toString() const throw () { return String(_buffer.data(), 0, _used); } beecrypt-4.2.1/c++/lang/teststring.cxx0000664000175000001440000000262710177665137014521 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include using namespace std; int main(int argc, char* argv[]) { String a("The quick brown fox jumps"); String b("over the lazy dog"); std::cout << a.substring(0, 3) << std::endl; std::cout << a.indexOf((int) 'q') << std::endl; std::cout << a.indexOf((int) 'z') << std::endl; std::cout << a.indexOf("brown") << std::endl; std::cout << a.contains(String("cat")) << std::endl; std::cout << (a + ' ' + b) << std::endl; std::cout << a.equalsIgnoreCase("THE QUICK BROWN FOX JUMPS") << std::endl; } beecrypt-4.2.1/c++/lang/Integer.cxx0000664000175000001440000000561010242105303013654 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/Integer.h" #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include using namespace beecrypt::lang; const jint Integer::MIN_VALUE = (((jint) 1) << 31); const jint Integer::MAX_VALUE = ~MIN_VALUE; String Integer::toString(jint i) throw () { char tmp[12]; #if SIZE_LONG == 4 sprintf(tmp, "%d", i); #else sprintf(tmp, "%ld", i); #endif return String(tmp); } String Integer::toHexString(jint i) throw () { char tmp[10]; #if SIZEOF_LONG == 4 sprintf(tmp, "%x", i); #else sprintf(tmp, "%lx", i); #endif return String(tmp); } String Integer::toOctalString(jint i) throw () { char tmp[13]; #if SIZEOF_INT == 4 sprintf(tmp, "%o", i); #else sprintf(tmp, "%lo", i); #endif return String(tmp); } jint Integer::parseInteger(const String& s) throw (NumberFormatException) { UErrorCode status = U_ZERO_ERROR; NumberFormat* nf = NumberFormat::createInstance(status); if (nf) { Formattable fmt((int32_t) 0); nf->parse(s.toUnicodeString(), fmt, status); delete nf; if (U_FAILURE(status)) throw NumberFormatException("unable to parse string to jint value"); return fmt.getLong(); } else throw RuntimeException("unable to create ICU NumberFormat instance"); } Integer::Integer(jint value) throw () : _val(value) { } Integer::Integer(const String& s) throw (NumberFormatException) : _val(parseInteger(s)) { } jint Integer::hashCode() const throw () { return _val; } jbyte Integer::byteValue() const throw () { return (jbyte) _val; } jshort Integer::shortValue() const throw () { return (jshort) _val; } jint Integer::intValue() const throw () { return _val; } jlong Integer::longValue() const throw () { return (jlong) _val; } jint Integer::compareTo(const Integer& i) const throw () { if (_val == i._val) return 0; else if (_val < i._val) return -1; else return 1; } String Integer::toString() const throw () { char tmp[12]; #if SIZE_LONG == 4 sprintf(tmp, "%d", _val); #else sprintf(tmp, "%ld", _val); #endif return String(tmp); } beecrypt-4.2.1/c++/lang/Throwable.cxx0000644000175000001440000000360711216147022014216 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/Throwable.h" #include "beecrypt/c++/lang/String.h" #include "beecrypt/c++/lang/IllegalStateException.h" using namespace beecrypt::lang; Throwable::Throwable() { _cause = this; } Throwable::Throwable(const char* message) : _msg(message ? new String(message) : 0) { _cause = this; } Throwable::Throwable(const String& message) : _msg(new String(message)) { _cause = this; } Throwable::Throwable(const String* message, const Throwable* cause) : _msg(message ? new String(*message) : 0), _cause(cause) { } Throwable::Throwable(const Throwable* cause) : _cause(cause) { if (_cause && _cause->_msg) _msg = new String(*_cause->_msg); else _msg = 0; } Throwable::~Throwable() { delete _msg; } const String* Throwable::getMessage() const throw () { return _msg; } const Throwable* Throwable::getCause() const throw () { return _cause; } Throwable& Throwable::initCause(const Throwable& cause) { if (_cause) throw IllegalStateException("cause was already specified"); _cause = &cause; return *this; } beecrypt-4.2.1/c++/lang/Long.cxx0000664000175000001440000000622610207103550013165 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/Long.h" #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include using namespace beecrypt::lang; const jlong Long::MIN_VALUE = (((jlong) 1) << 63); const jlong Long::MAX_VALUE = ~MIN_VALUE; String Long::toString(jlong l) throw () { char tmp[21]; #if WIN32 sprintf(tmp, "%I64d", l); #elif SIZE_LONG == 8 sprintf(tmp, "%ld", l); #elif HAVE_LONG_LONG sprintf(tmp, "%lld", l); #else # error #endif return String(tmp); } String Long::toHexString(jlong l) throw () { char tmp[18]; #if WIN32 sprintf(tmp, "%I64x", l); #elif SIZEOF_LONG == 8 sprintf(tmp, "%lx", l); #elif HAVE_LONG_LONG sprintf(tmp, "%llx", l); #else # error #endif return String(tmp); } String Long::toOctalString(jlong l) throw () { char tmp[23]; #if WIN32 sprintf(tmp, "%I64o", l); #elif SIZEOF_LONG == 8 sprintf(tmp, "%lo", l); #elif HAVE_LONG_LONG sprintf(tmp, "%llo", l); #else # error #endif return String(tmp); } jlong Long::parseLong(const String& s) throw (NumberFormatException) { UErrorCode status = U_ZERO_ERROR; NumberFormat* nf = NumberFormat::createInstance(status); if (nf) { Formattable fmt((int64_t) 0); nf->parse(s.toUnicodeString(), fmt, status); delete nf; if (U_FAILURE(status)) throw NumberFormatException("unable to parse string to jlong value"); return fmt.getInt64(); } else throw RuntimeException("unable to create ICU NumberFormat instance"); } Long::Long(jlong value) throw () : _val(value) { } Long::Long(const String& s) throw (NumberFormatException) : _val(parseLong(s)) { } jint Long::hashCode() const throw () { return (jint) _val ^ (jint)(_val >> 32); } jbyte Long::byteValue() const throw () { return (jbyte) _val; } jshort Long::shortValue() const throw () { return (jshort) _val; } jint Long::intValue() const throw () { return (jint) _val; } jlong Long::longValue() const throw () { return _val; } jint Long::compareTo(const Long& l) const throw () { if (_val == l._val) return 0; else if (_val < l._val) return -1; else return 1; } String Long::toString() const throw () { char tmp[21]; #if WIN32 sprintf(tmp, "%I64d", _val); #elif SIZE_LONG == 8 sprintf(tmp, "%ld", _val); #elif HAVE_LONG_LONG sprintf(tmp, "%lld", _val); #else # error #endif return String(tmp); } beecrypt-4.2.1/c++/lang/Character.cxx0000664000175000001440000000436210207102744014165 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/Character.h" using namespace beecrypt::lang; const jchar Character::MIN_VALUE = (jchar) 0; const jchar Character::MAX_VALUE = (jchar) 0xFFFF; const jchar Character::MIN_HIGH_SURROGATE = (jchar) 0xD800; const jchar Character::MAX_HIGH_SURROGATE = (jchar) 0xDBFF; const jchar Character::MIN_LOW_SURROGATE = (jchar) 0xDC00; const jchar Character::MAX_LOW_SURROGATE = (jchar) 0xDFFF; const jchar Character::MIN_SURROGATE = MIN_HIGH_SURROGATE; const jchar Character::MAX_SURROGATE = MAX_LOW_SURROGATE; const jint Character::MIN_SUPPLEMENTARY_CODE_POINT = 0x10000; const jint Character::MIN_CODE_POINT = 0; const jint Character::MAX_CODE_POINT = 0x10FFFF; const jint Character::MIN_RADIX = 2; const jint Character::MAX_RADIX = 36; String Character::toString(jchar c) throw () { return String(&c, 0, 1); } bool Character::isHighSurrogate(jchar c) throw () { return c >= MIN_HIGH_SURROGATE && c <= MAX_HIGH_SURROGATE; } bool Character::isLowSurrogate(jchar c) throw () { return c >= MIN_LOW_SURROGATE && c <= MAX_LOW_SURROGATE; } Character::Character(jchar value) throw () : _val(value) { } jint Character::hashCode() const throw () { return _val; } jint Character::compareTo(const Character& c) const throw () { if (_val == c._val) return 0; else if (_val < c._val) return -1; else return 1; } String Character::toString() const throw () { return String(_val); } beecrypt-4.2.1/c++/lang/testnotify.cxx0000664000175000001440000000246610177665220014515 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/Thread.h" using beecrypt::lang::Thread; #include using namespace std; Object flag; class Waiter : public Thread { public: virtual void run() { cout << "Waiter starting" << endl; synchronized(flag) { flag.wait(); } cout << "Waiter ending" << endl; } }; int main(int argc, char* argv[]) { Waiter a, b, c, d; a.start(); b.start(); c.start(); d.start(); Thread::sleep(100); synchronized (flag) { flag.notifyAll(); } } beecrypt-4.2.1/c++/lang/testthread.cxx0000664000175000001440000000352510201400550014426 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/Thread.h" using beecrypt::lang::Thread; #include using namespace std; class Worker : public Thread { private: size_t _count; public: Worker(const char* ident) : Thread(ident) { _count = 0; } virtual void run() { cout << "Worker[" << getName() << "] starting" << endl; try { while (!isInterrupted()) { pop(); cout << "Worker[" << getName() << "] popped" << endl; } } catch (InterruptedException) { cout << "Worker[" << getName() << "] interrupted" << endl; } cout << "Worker[" << getName() << "] ending" << endl; } void pop() { synchronized (this) { if (_count == 0) wait(); _count--; } } void push() { synchronized (this) { _count++; notify(); } } }; int main(int argc, char* argv[]) { Worker a("one"); Worker b("two"); a.start(); a.sleep(100); b.start(); b.sleep(100); a.push(); a.push(); b.push(); a.push(); a.yield(); b.interrupt(); a.push(); a.yield(); a.interrupt(); a.yield(); } beecrypt-4.2.1/c++/Makefile.in0000644000175000001440000007265011226307160012675 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ TESTS = testks$(EXEEXT) testdsa$(EXEEXT) testrsa$(EXEEXT) \ testdhies$(EXEEXT) check_PROGRAMS = testks$(EXEEXT) testdsa$(EXEEXT) testrsa$(EXEEXT) \ testdhies$(EXEEXT) subdir = c++ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libbeecrypt_cxx_la_DEPENDENCIES = ../libbeecrypt.la lang/libcxxlang.la \ math/libcxxmath.la io/libcxxio.la nio/libcxxnio.la \ util/libcxxutil.la security/libcxxsecurity.la \ crypto/libcxxcrypto.la beeyond/libcxxbeeyond.la am_libbeecrypt_cxx_la_OBJECTS = adapter.lo resource.lo libbeecrypt_cxx_la_OBJECTS = $(am_libbeecrypt_cxx_la_OBJECTS) libbeecrypt_cxx_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(libbeecrypt_cxx_la_LDFLAGS) $(LDFLAGS) -o $@ am_testdhies_OBJECTS = testdhies.$(OBJEXT) testdhies_OBJECTS = $(am_testdhies_OBJECTS) testdhies_DEPENDENCIES = libbeecrypt_cxx.la am_testdsa_OBJECTS = testdsa.$(OBJEXT) testdsa_OBJECTS = $(am_testdsa_OBJECTS) testdsa_DEPENDENCIES = libbeecrypt_cxx.la am_testks_OBJECTS = testks.$(OBJEXT) testks_OBJECTS = $(am_testks_OBJECTS) testks_DEPENDENCIES = libbeecrypt_cxx.la am_testrsa_OBJECTS = testrsa.$(OBJEXT) testrsa_OBJECTS = $(am_testrsa_OBJECTS) testrsa_DEPENDENCIES = libbeecrypt_cxx.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libbeecrypt_cxx_la_SOURCES) $(testdhies_SOURCES) \ $(testdsa_SOURCES) $(testks_SOURCES) $(testrsa_SOURCES) DIST_SOURCES = $(libbeecrypt_cxx_la_SOURCES) $(testdhies_SOURCES) \ $(testdsa_SOURCES) $(testks_SOURCES) $(testrsa_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive DATA = $(noinst_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBBEECRYPT_CXX_LT_CURRENT = 7 LIBBEECRYPT_CXX_LT_AGE = 0 LIBBEECRYPT_CXX_LT_REVISION = 0 INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = lang math io nio util security crypto beeyond . provider cxxdir = $(pkgincludedir)/c++ lib_LTLIBRARIES = libbeecrypt_cxx.la libbeecrypt_cxx_la_SOURCES = \ adapter.cxx \ resource.cxx libbeecrypt_cxx_la_LIBADD = ../libbeecrypt.la lang/libcxxlang.la math/libcxxmath.la io/libcxxio.la nio/libcxxnio.la util/libcxxutil.la security/libcxxsecurity.la crypto/libcxxcrypto.la beeyond/libcxxbeeyond.la -licuuc -licuio -licui18n libbeecrypt_cxx_la_LDFLAGS = -no-undefined -version-info $(LIBBEECRYPT_CXX_LT_CURRENT):$(LIBBEECRYPT_CXX_LT_REVISION):$(LIBBEECRYPT_CXX_LT_AGE) noinst_DATA = beecrypt-test.conf TESTS_ENVIRONMENT = BEECRYPT_CONF_FILE=beecrypt-test.conf CLEANFILES = beecrypt-test.conf testks_SOURCES = testks.cxx testks_LDADD = libbeecrypt_cxx.la testdsa_SOURCES = testdsa.cxx testdsa_LDADD = libbeecrypt_cxx.la testrsa_SOURCES = testrsa.cxx testrsa_LDADD = libbeecrypt_cxx.la testdhies_SOURCES = testdhies.cxx testdhies_LDADD = libbeecrypt_cxx.la all: all-recursive .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libbeecrypt_cxx.la: $(libbeecrypt_cxx_la_OBJECTS) $(libbeecrypt_cxx_la_DEPENDENCIES) $(libbeecrypt_cxx_la_LINK) -rpath $(libdir) $(libbeecrypt_cxx_la_OBJECTS) $(libbeecrypt_cxx_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list testdhies$(EXEEXT): $(testdhies_OBJECTS) $(testdhies_DEPENDENCIES) @rm -f testdhies$(EXEEXT) $(CXXLINK) $(testdhies_OBJECTS) $(testdhies_LDADD) $(LIBS) testdsa$(EXEEXT): $(testdsa_OBJECTS) $(testdsa_DEPENDENCIES) @rm -f testdsa$(EXEEXT) $(CXXLINK) $(testdsa_OBJECTS) $(testdsa_LDADD) $(LIBS) testks$(EXEEXT): $(testks_OBJECTS) $(testks_DEPENDENCIES) @rm -f testks$(EXEEXT) $(CXXLINK) $(testks_OBJECTS) $(testks_LDADD) $(LIBS) testrsa$(EXEEXT): $(testrsa_OBJECTS) $(testrsa_DEPENDENCIES) @rm -f testrsa$(EXEEXT) $(CXXLINK) $(testrsa_OBJECTS) $(testrsa_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adapter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdhies.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdsa.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testrsa.Po@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-recursive all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am \ install-libLTLIBRARIES install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ uninstall-libLTLIBRARIES beecrypt-test.conf: @echo "provider.1=provider/.libs/base.so" > beecrypt-test.conf # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/provider/0000777000175000001440000000000011226307274012542 500000000000000beecrypt-4.2.1/c++/provider/BaseProvider.cxx0000644000175000001440000002731711216650646015604 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/AESCipher.h" #include "beecrypt/c++/provider/BeeCertificateFactory.h" #include "beecrypt/c++/provider/BeeCertPathValidator.h" #include "beecrypt/c++/provider/BaseProvider.h" #include "beecrypt/c++/provider/BeeKeyStore.h" #include "beecrypt/c++/provider/BeeSecureRandom.h" #include "beecrypt/c++/provider/BlowfishCipher.h" #include "beecrypt/c++/provider/DHIESCipher.h" #include "beecrypt/c++/provider/DHIESParameters.h" #include "beecrypt/c++/provider/DHKeyAgreement.h" #include "beecrypt/c++/provider/DHKeyFactory.h" #include "beecrypt/c++/provider/DHKeyPairGenerator.h" #include "beecrypt/c++/provider/DHParameterGenerator.h" #include "beecrypt/c++/provider/DHParameters.h" #include "beecrypt/c++/provider/DSAKeyFactory.h" #include "beecrypt/c++/provider/DSAKeyPairGenerator.h" #include "beecrypt/c++/provider/DSAParameterGenerator.h" #include "beecrypt/c++/provider/DSAParameters.h" #include "beecrypt/c++/provider/HMACMD5.h" #include "beecrypt/c++/provider/HMACSHA1.h" #include "beecrypt/c++/provider/HMACSHA256.h" #include "beecrypt/c++/provider/HMACSHA384.h" #include "beecrypt/c++/provider/HMACSHA512.h" #include "beecrypt/c++/provider/MD5Digest.h" #include "beecrypt/c++/provider/MD5withRSASignature.h" #include "beecrypt/c++/provider/PKCS12KeyFactory.h" #include "beecrypt/c++/provider/RSAKeyFactory.h" #include "beecrypt/c++/provider/RSAKeyPairGenerator.h" #include "beecrypt/c++/provider/SHA1Digest.h" #include "beecrypt/c++/provider/SHA224Digest.h" #include "beecrypt/c++/provider/SHA256Digest.h" #include "beecrypt/c++/provider/SHA384Digest.h" #include "beecrypt/c++/provider/SHA512Digest.h" #include "beecrypt/c++/provider/SHA1withDSASignature.h" #include "beecrypt/c++/provider/SHA1withRSASignature.h" #include "beecrypt/c++/provider/SHA256withRSASignature.h" #include "beecrypt/c++/provider/SHA384withRSASignature.h" #include "beecrypt/c++/provider/SHA512withRSASignature.h" namespace { const String PROVIDER_NAME("BeeCrypt++"); const String PROVIDER_INFO("Copyright (c) 2004 Beeyond Software Holding BV"); const double PROVIDER_VERSION = 4.2; } extern "C" { #if WIN32 # define PROVAPI __declspec(dllexport) #else # define PROVAPI #endif PROVAPI void* beecrypt_AESCipher_create() { return new beecrypt::provider::AESCipher(); } PROVAPI void* beecrypt_BeeCertificateFactory_create() { return new beecrypt::provider::BeeCertificateFactory(); } PROVAPI void* beecrypt_BeeCertPathValidator_create() { return new beecrypt::provider::BeeCertPathValidator(); } PROVAPI void* beecrypt_BeeKeyStore_create() { return new beecrypt::provider::BeeKeyStore(); } PROVAPI void* beecrypt_BeeSecureRandom_create() { return new beecrypt::provider::BeeSecureRandom(); } PROVAPI void* beecrypt_BlowfishCipher_create() { return new beecrypt::provider::BlowfishCipher(); } PROVAPI void* beecrypt_DHIESCipher_create() { return new beecrypt::provider::DHIESCipher(); } PROVAPI void* beecrypt_DHIESParameters_create() { return new beecrypt::provider::DHIESParameters(); } PROVAPI void* beecrypt_DHKeyAgreement_create() { return new beecrypt::provider::DHKeyAgreement(); } PROVAPI void* beecrypt_DHKeyFactory_create() { return new beecrypt::provider::DHKeyFactory(); } PROVAPI void* beecrypt_DHKeyPairGenerator_create() { return new beecrypt::provider::DHKeyPairGenerator(); } PROVAPI void* beecrypt_HParameterGenerator_create() { return new beecrypt::provider::DHParameterGenerator(); } PROVAPI void* beecrypt_DHParameters_create() { return new beecrypt::provider::DHParameters(); } PROVAPI void* beecrypt_DSAKeyFactory_create() { return new beecrypt::provider::DSAKeyFactory(); } PROVAPI void* beecrypt_DSAKeyPairGenerator_create() { return new beecrypt::provider::DSAKeyPairGenerator(); } PROVAPI void* beecrypt_DSAParameterGenerator_create() { return new beecrypt::provider::DSAParameterGenerator(); } PROVAPI void* beecrypt_DSAParameters_create() { return new beecrypt::provider::DSAParameters(); } PROVAPI void* beecrypt_HMACMD5_create() { return new beecrypt::provider::HMACMD5(); } PROVAPI void* beecrypt_HMACSHA1_create() { return new beecrypt::provider::HMACSHA1(); } PROVAPI void* beecrypt_HMACSHA256_create() { return new beecrypt::provider::HMACSHA256(); } PROVAPI void* beecrypt_HMACSHA384_create() { return new beecrypt::provider::HMACSHA384(); } PROVAPI void* beecrypt_HMACSHA512_create() { return new beecrypt::provider::HMACSHA512(); } PROVAPI void* beecrypt_MD5Digest_create() { return new beecrypt::provider::MD5Digest(); } PROVAPI void* beecrypt_MD5withRSASignature_create() { return new beecrypt::provider::MD5withRSASignature(); } PROVAPI void* beecrypt_PKCS12KeyFactory_create() { return new beecrypt::provider::PKCS12KeyFactory(); } PROVAPI void* beecrypt_RSAKeyFactory_create() { return new beecrypt::provider::RSAKeyFactory(); } PROVAPI void* beecrypt_RSAKeyPairGenerator_create() { return new beecrypt::provider::RSAKeyPairGenerator(); } PROVAPI void* beecrypt_SHA1Digest_create() { return new beecrypt::provider::SHA1Digest(); } PROVAPI void* beecrypt_SHA224Digest_create() { return new beecrypt::provider::SHA224Digest(); } PROVAPI void* beecrypt_SHA256Digest_create() { return new beecrypt::provider::SHA256Digest(); } PROVAPI void* beecrypt_SHA384Digest_create() { return new beecrypt::provider::SHA384Digest(); } PROVAPI void* beecrypt_SHA512Digest_create() { return new beecrypt::provider::SHA512Digest(); } PROVAPI void* beecrypt_SHA1withDSASignature_create() { return new beecrypt::provider::SHA1withDSASignature(); } PROVAPI void* beecrypt_SHA1withRSASignature_create() { return new beecrypt::provider::SHA1withRSASignature(); } PROVAPI void* beecrypt_SHA256withRSASignature_create() { return new beecrypt::provider::SHA256withRSASignature(); } PROVAPI void* beecrypt_SHA384withRSASignature_create() { return new beecrypt::provider::SHA384withRSASignature(); } PROVAPI void* beecrypt_SHA512withRSASignature_create() { return new beecrypt::provider::SHA512withRSASignature(); } } using namespace beecrypt::provider; BaseProvider::BaseProvider() : Provider(PROVIDER_NAME, PROVIDER_VERSION, PROVIDER_INFO) { _dlhandle = 0; init(); } BaseProvider::BaseProvider(void* dlhandle) : Provider(PROVIDER_NAME, PROVIDER_VERSION, PROVIDER_INFO) { _dlhandle = dlhandle; init(); } void BaseProvider::init() { setProperty("AlgorithmParameterGenerator.DH" , "beecrypt_DHParameterGenerator_create"); setProperty("AlgorithmParameterGenerator.DSA" , "beecrypt_DSAParameterGenerator_create"); setProperty("AlgorithmParameters.DH" , "beecrypt_DHParameters_create"); setProperty("AlgorithmParameters.DHIES" , "beecrypt_DHIESParameters_create"); setProperty("AlgorithmParameters.DSA" , "beecrypt_DSAParameters_create"); setProperty("CertificateFactory.BEE" , "beecrypt_BeeCertificateFactory_create"); setProperty("CertPathValidator.BEE" , "beecrypt_BeeCertPathValidator_create"); setProperty("Cipher.AES" , "beecrypt_AESCipher_create"); setProperty("Cipher.AES SupportedPaddings" , "NOPADDING,PKCS5Padding"); setProperty("Cipher.Blowfish" , "beecrypt_BlowfishCipher_create"); setProperty("Cipher.Blowfish SupportedPaddings" , "NOPADDING,PKCS5Padding"); setProperty("Cipher.DHIES" , "beecrypt_DHIESCipher_create"); setProperty("KeyAgreement.DH" , "beecrypt_DHKeyAgreement_create"); setProperty("KeyFactory.DH" , "beecrypt_DHKeyFactory_create"); setProperty("KeyFactory.DSA" , "beecrypt_DSAKeyFactory_create"); setProperty("KeyFactory.RSA" , "beecrypt_RSAKeyFactory_create"); setProperty("KeyStore.BEE" , "beecrypt_BeeKeyStore_create"); setProperty("KeyPairGenerator.DH" , "beecrypt_DHKeyPairGenerator_create"); setProperty("KeyPairGenerator.DSA" , "beecrypt_DSAKeyPairGenerator_create"); setProperty("KeyPairGenerator.RSA" , "beecrypt_RSAKeyPairGenerator_create"); setProperty("Mac.HmacMD5" , "beecrypt_HMACMD5_create"); setProperty("Mac.HmacSHA1" , "beecrypt_HMACSHA1_create"); setProperty("Mac.HmacSHA256" , "beecrypt_HMACSHA256_create"); setProperty("Mac.HmacSHA384" , "beecrypt_HMACSHA384_create"); setProperty("Mac.HmacSHA512" , "beecrypt_HMACSHA512_create"); setProperty("MessageDigest.MD5" , "beecrypt_MD5Digest_create"); setProperty("MessageDigest.SHA-1" , "beecrypt_SHA1Digest_create"); setProperty("MessageDigest.SHA-256" , "beecrypt_SHA256Digest_create"); setProperty("MessageDigest.SHA-384" , "beecrypt_SHA384Digest_create"); setProperty("MessageDigest.SHA-512" , "beecrypt_SHA512Digest_create"); setProperty("SecretKeyFactory.PKCS#12/PBE" , "beecrypt_PKCS12KeyFactory_create"); setProperty("SecureRandom.BEE" , "beecrypt_BeeSecureRandom_create"); setProperty("Signature.MD5withRSA" , "beecrypt_MD5withRSASignature_create"); setProperty("Signature.SHA1withDSA" , "beecrypt_SHA1withDSASignature_create"); setProperty("Signature.SHA1withRSA" , "beecrypt_SHA1withRSASignature_create"); setProperty("Signature.SHA256withRSA" , "beecrypt_SHA256withRSASignature_create"); setProperty("Signature.SHA384withRSA" , "beecrypt_SHA384withRSASignature_create"); setProperty("Signature.SHA512withRSA" , "beecrypt_SHA512withRSASignature_create"); setProperty("Alg.Alias.Cipher.DHAES" , "Cipher.DHIES"); setProperty("Alg.Alias.Cipher.DHES" , "Cipher.DHIES"); setProperty("Alg.Alias.KeyAgreement.DiffieHellman" , "KeyAgreement.DH"); setProperty("Alg.Alias.KeyFactory.DiffieHellman" , "KeyFactory.DH"); setProperty("Alg.Alias.KeyPairGenerator.DiffieHellman" , "KeyPairGenerator.DH"); setProperty("Alg.Alias.Mac.HMAC-MD5" , "Mac.HmacMD5"); setProperty("Alg.Alias.Mac.HMAC-SHA-1" , "Mac.HmacSHA1"); setProperty("Alg.Alias.Mac.HMAC-SHA-256" , "Mac.HmacSHA256"); setProperty("Alg.Alias.Mac.HMAC-SHA-384" , "Mac.HmacSHA384"); setProperty("Alg.Alias.Mac.HMAC-SHA-512" , "Mac.HmacSHA512"); setProperty("Alg.Alias.Signature.DSS" , "Signature.SHA1withDSA"); setProperty("Alg.Alias.Signature.SHAwithDSA" , "Signature.SHA1withDSA"); setProperty("Alg.Alias.Signature.SHA/DSA" , "Signature.SHA1withDSA"); setProperty("Alg.Alias.Signature.SHA-1/DSA" , "Signature.SHA1withDSA"); } extern "C" { #if WIN32 __declspec(dllexport) #endif Provider* provider_instantiate(void* dlhandle) { return new BaseProvider(dlhandle); } } beecrypt-4.2.1/c++/provider/BlowfishCipher.cxx0000664000175000001440000000200310213541022016071 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/BlowfishCipher.h" #include "beecrypt/blowfish.h" using namespace beecrypt::provider; BlowfishCipher::BlowfishCipher() : BlockCipher(blowfish) { } beecrypt-4.2.1/c++/provider/RSAPrivateKeyImpl.cxx0000664000175000001440000000526410205364461016463 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/RSAPrivateKeyImpl.h" #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/beeyond/BeeOutputStream.h" using beecrypt::beeyond::BeeOutputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_RSA("RSA"); } RSAPrivateKeyImpl::RSAPrivateKeyImpl(const RSAPrivateKey& copy) : _n(copy.getModulus()), _d(copy.getPrivateExponent()) { _enc = 0; } RSAPrivateKeyImpl::RSAPrivateKeyImpl(const RSAPrivateKeyImpl& copy) : _n(copy._n), _d(copy._d) { _enc = 0; } RSAPrivateKeyImpl::RSAPrivateKeyImpl(const BigInteger& n, const BigInteger& d) : _n(n), _d(d) { _enc = 0; } RSAPrivateKeyImpl::~RSAPrivateKeyImpl() { delete _enc; } RSAPrivateKeyImpl* RSAPrivateKeyImpl::clone() const throw () { return new RSAPrivateKeyImpl(*this); } bool RSAPrivateKeyImpl::equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const RSAPrivateKey* pri = dynamic_cast(obj); if (pri) { if (pri->getModulus() != _n) return false; if (pri->getPrivateExponent() != _d) return false; return true; } } return false; } const BigInteger& RSAPrivateKeyImpl::getModulus() const throw () { return _n; } const BigInteger& RSAPrivateKeyImpl::getPrivateExponent() const throw () { return _d; } const bytearray* RSAPrivateKeyImpl::getEncoded() const throw () { if (!_enc) { try { ByteArrayOutputStream bos; BeeOutputStream bee(bos); bee.writeBigInteger(_n); bee.writeBigInteger(_d); bee.close(); _enc = bos.toByteArray(); } catch (IOException&) { } } return _enc; } const String& RSAPrivateKeyImpl::getAlgorithm() const throw () { return ALGORITHM_RSA; } const String* RSAPrivateKeyImpl::getFormat() const throw () { return &FORMAT_BEE; } beecrypt-4.2.1/c++/provider/SHA224Digest.cxx0000644000175000001440000000470511216650507015212 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include "beecrypt/c++/provider/SHA224Digest.h" using namespace beecrypt::provider; SHA224Digest::SHA224Digest() : _digest(28) { if (sha224Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha224Reset"); } SHA224Digest::~SHA224Digest() { } SHA224Digest* SHA224Digest::clone() const throw () { SHA224Digest* result = new SHA224Digest(); memcpy(&result->_param, &_param, sizeof(sha224Param)); return result; } const bytearray& SHA224Digest::engineDigest() { if (sha224Digest(&_param, _digest.data())) throw ProviderException("BeeCrypt internal error in sha224Digest"); return _digest; } int SHA224Digest::engineDigest(byte* data, int offset, int length) throw (ShortBufferException) { if (!data) throw NullPointerException(); if (length < 32) throw ShortBufferException(); if (sha224Digest(&_param, data)) throw ProviderException("BeeCrypt internal error in sha224Digest"); return 32; } int SHA224Digest::engineGetDigestLength() { return 32; } void SHA224Digest::engineReset() { if (sha224Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha224Reset"); } void SHA224Digest::engineUpdate(byte b) { if (sha224Update(&_param, &b, 1)) throw ProviderException("BeeCrypt internal error in sha224Update"); } void SHA224Digest::engineUpdate(const byte* data, int offset, int length) { if (sha224Update(&_param, data+offset, length)) throw ProviderException("BeeCrypt internal error in sha224Update"); } beecrypt-4.2.1/c++/provider/DHKeyPairGenerator.cxx0000664000175000001440000001046610210635004016625 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/adapter.h" #include "beecrypt/c++/crypto/spec/DHParameterSpec.h" #include "beecrypt/c++/provider/DHKeyPairGenerator.h" #include "beecrypt/c++/provider/DHPublicKeyImpl.h" #include "beecrypt/c++/provider/DHPrivateKeyImpl.h" #include "beecrypt/c++/security/KeyPair.h" #include "beecrypt/dldp.h" /* precomputed safe primes; it's easy to create generators for these; * * using a dldp_p struct, set p from the hex value; set q = p/2 and r = 2 * then call dldp_pgonGenerator. */ namespace { const char* P_2048 = "fd12e8b7e096a28a00fb548035953cf0eba64ceb5dff0f5672d376d59c196da729f6b5586f18e6f3f1a86c73c5b15662f59439613b309e52aa257488619e5f76a7c4c3f7a426bdeac66bf88343482941413cef06256b39c62744dcb97e7b78e36ec6b885b143f6f3ad0a1cd8a5713e338916613892a264d4a47e72b583fbdaf5bce2bbb0097f7e65cbc86d684882e5bb8196d522dcacd6ad00dfbcd8d21613bdb59c485a65a58325d792272c09ad1173e12c98d865adb4c4d676ada79830c58c37c42dff8536e28f148a23f296513816d3dfed0397a3d4d6e1fa24f07e1b01643a68b4274646a3b876e810206eddacea2b9ef7636a1da5880ef654288b857ea3"; const char* P_1024 = "e64a3deeddb723e2e4db54c2b09567d196367a86b3b302be07e43ffd7f2e016f866de5135e375bdd2fba6ea9b4299010fafa36dc6b02ba3853cceea07ee94bfe30e0cc82a69c73163be26e0c4012dfa0b2839c97d6cd71eee59a303d6177c6a6740ca63bd04c1ba084d6c369dc2fbfaeebe951d58a4824de52b580442d8cae77"; } using namespace beecrypt::provider; DHKeyPairGenerator::DHKeyPairGenerator() { _size = 0; _spec = 0; _srng = 0; } DHKeyPairGenerator::~DHKeyPairGenerator() { delete _spec; } KeyPair* DHKeyPairGenerator::genpair(randomGeneratorContext* rngc) { dhparam param; int l; mpnumber x; mpnumber y; if (_spec) { // we need q in dldp_pPair transform(param.p, _spec->getP()); transform(param.q, _spec->getP()); transform(param.g, _spec->getG()); l = _spec->getL(); } else { if (_size == 2048) { mpbsethex(¶m.p, P_2048); } else if (_size == 1024 || _size == 0) { mpbsethex(¶m.p, P_1024); } if (_size == 2048 || _size == 1024 || _size == 0) { mpnumber q; /* set q to half of P */ mpnset(&q, param.p.size, param.p.modl); mpdivtwo(q.size, q.data); mpbset(¶m.q, q.size, q.data); /* set r to 2 */ mpnsetw(¶m.r, 2); /* make a generator, order n */ dldp_pgonGenerator(¶m, rngc); } else { if (dldp_pgonMakeSafe(¶m, rngc, _size)) throw "unexpected error in dldp_pMakeSafe"; } } if (_spec && l) dldp_pPair_s(¶m, rngc, &x, &y, l); else dldp_pPair (¶m, rngc, &x, &y); KeyPair* result = new KeyPair(new DHPublicKeyImpl(param, y), new DHPrivateKeyImpl(param, x)); x.wipe(); return result; } KeyPair* DHKeyPairGenerator::engineGenerateKeyPair() { if (_srng) { randomGeneratorContextAdapter rngc(_srng); return genpair(&rngc); } else { randomGeneratorContext rngc(randomGeneratorDefault()); return genpair(&rngc); } } void DHKeyPairGenerator::engineInitialize(const AlgorithmParameterSpec& spec, SecureRandom* random) throw (InvalidAlgorithmParameterException) { const DHParameterSpec* dhspec = dynamic_cast(&spec); if (dhspec) { delete _spec; _spec = new DHParameterSpec(*dhspec); _srng = random; } else throw InvalidAlgorithmParameterException("not a DHParameterSpec"); } void DHKeyPairGenerator::engineInitialize(int keysize, SecureRandom* random) throw (InvalidParameterException) { if (keysize < 768) throw InvalidParameterException("Safe prime size must be at least 768 bits"); delete _spec; _size = keysize; _spec = 0; _srng = random; } beecrypt-4.2.1/c++/provider/BlockCipher.cxx0000664000175000001440000003024010302132265015356 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/lang/UnsupportedOperationException.h" using beecrypt::lang::UnsupportedOperationException; #include "beecrypt/c++/lang/Integer.h" using beecrypt::lang::Integer; #include "beecrypt/c++/crypto/Cipher.h" using beecrypt::crypto::Cipher; #include "beecrypt/c++/crypto/SecretKey.h" using beecrypt::crypto::SecretKey; #include "beecrypt/c++/crypto/spec/IvParameterSpec.h" using beecrypt::crypto::spec::IvParameterSpec; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include "beecrypt/c++/security/Security.h" using beecrypt::security::Security; #include "beecrypt/c++/provider/BlockCipher.h" #include using std::auto_ptr; using namespace beecrypt::provider; #define BUFFER_SIZE 4096 // must be a whole number of blocks const int BlockCipher::MODE_ECB = 0; const int BlockCipher::MODE_CBC = 1; const int BlockCipher::MODE_CTR = 2; const int BlockCipher::PADDING_NONE = 0; const int BlockCipher::PADDING_PKCS5 = 1; namespace { String FORMAT_RAW("RAW"); void hexdump(const byte* data, size_t size) { size_t i; for (i = 0; i < size; i++) { printf("%02x ", data[i]); if ((i & 0x1f) == 0x1f) printf("\n"); } if (i & 0x1f) printf("\n"); } } /*!\todo investigate getting buffer size from beecrypt.conf */ BlockCipher::BlockCipher(const blockCipher& cipher) : _ctxt(&cipher), _iv(cipher.blocksize) { jint blocksize = _ctxt.algo->blocksize; try { // check value of property blockcipher.buffer.size in beecrypt.conf const String* tmp = Security::getProperty("blockcipher.buffer.size"); if (tmp) { // value was configured jint size = Integer::parseInteger(*tmp); if (size <= 1024) throw ProviderException("blockcipher.buffer.size must be greater than or equal to 1024"); if (size % blocksize) throw ProviderException("blockcipher.buffer.size is not a multiple of this cipher's blocksize"); _buffer.resize(size); } else { // no value configured; use 1K blocks _buffer.resize(1024 * blocksize); } } catch (NumberFormatException&) { throw ProviderException("blockcipher.buffer.size not set to a numeric value"); } // clear the iv memset(_iv.data(), 0, _iv.size()); _opmode = NOCRYPT; _blmode = MODE_ECB; _padding = PADDING_NONE; _bufcnt = 0; _buflwm = 0; } bytearray* BlockCipher::engineDoFinal(const byte* input, int inputOffset, int inputLength) throw (IllegalBlockSizeException, BadPaddingException) { bytearray* tmp = 0; int outputLength = engineGetOutputSize(inputLength); if (outputLength > 0) { tmp = new bytearray(outputLength); int realLength = engineDoFinal(input, inputOffset, inputLength, *tmp, 0); // unpadding may have shortened the output if (realLength == 0) { // nothing remains delete tmp; tmp = 0; } else if (realLength < outputLength) { tmp->resize(realLength); } } engineReset(); return tmp; } int BlockCipher::engineDoFinal(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException, IllegalBlockSizeException, BadPaddingException) { int blocksize = _ctxt.algo->blocksize; _buflwm = 0; int total = process(input+inputOffset, inputLength, output.data() + outputOffset, output.size() - outputOffset); outputOffset += total; if ((_padding == PADDING_PKCS5) && (_opmode == Cipher::ENCRYPT_MODE)) { int padvalue = blocksize - (_bufcnt % blocksize); memset(_buffer.data() + _bufcnt, padvalue, padvalue); _bufcnt += padvalue; total += process(0, 0, output.data() + outputOffset, output.size() - outputOffset); } if (_bufcnt) throw BadPaddingException("input is not a whole number of blocks"); if ((_padding == PADDING_PKCS5) && (_opmode == Cipher::DECRYPT_MODE)) { if (total < blocksize) throw BadPaddingException("must have at least one whole block to unpad"); // sanity check: total must be a non-zero whole number of blocks const byte* unpad_check = output.data() + outputOffset; byte unpadvalue = *(--unpad_check); if (unpadvalue > blocksize) { printf("bad unpadvalue\n"); hexdump(output.data() + outputOffset, total); throw BadPaddingException("padding byte value is greater than blocksize"); } // check all values for (byte b = unpadvalue; b > 1; b--) if (unpadvalue != *(--unpad_check)) throw BadPaddingException("not all padding bytes have the same value"); total -= unpadvalue; } engineReset(); return total; } int BlockCipher::engineGetBlockSize() const throw () { return _ctxt.algo->blocksize; } int BlockCipher::engineGetKeySize(const Key& key) const throw (InvalidKeyException) { const SecretKey* secret = dynamic_cast(&key); if (secret) { const String* format = secret->getFormat(); if (!format) throw InvalidKeyException("key has no format"); if (!format->equals(&FORMAT_RAW)) throw InvalidKeyException("key format isn't RAW"); const bytearray* raw = secret->getEncoded(); if (!raw) throw InvalidKeyException("key contains no data"); return (raw->size() << 3); } else throw InvalidKeyException("not a SecretKey"); } int BlockCipher::engineGetOutputSize(int inputLength) throw () { int total = _bufcnt + inputLength; // PKCS5 padding + encryption can add up to (blocksize) bytes if ((_padding == PADDING_PKCS5) && (_opmode == Cipher::ENCRYPT_MODE)) { int blocksize = _ctxt.algo->blocksize; total += blocksize - (total % blocksize); } return total; } bytearray* BlockCipher::engineGetIV() { return new bytearray(_iv); } AlgorithmParameters* BlockCipher::engineGetParameters() throw () { return 0; } void BlockCipher::engineInit(int opmode, const Key& key, SecureRandom* random) throw (InvalidKeyException) { _opmode = opmode; _keybits = engineGetKeySize(key); if (blockCipherContextValidKeylen(&_ctxt, _keybits) <= 0) throw InvalidKeyException("unsupported key length"); _key = *(dynamic_cast(key).getEncoded()); engineReset(); } void BlockCipher::engineInit(int opmode, const Key& key, AlgorithmParameters* params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) { if (params) { try { auto_ptr tmp(params->getParameterSpec(typeid(IvParameterSpec))); engineInit(opmode, key, *tmp, random); } catch (InvalidParameterSpecException& e) { throw InvalidAlgorithmParameterException().initCause(e); } } else engineInit(opmode, key, random); } void BlockCipher::engineInit(int opmode, const Key& key, const AlgorithmParameterSpec& params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) { const IvParameterSpec* iv = dynamic_cast(¶ms); if (!iv) throw InvalidAlgorithmParameterException("BlockCipher only accepts an IvParameterSpec"); if (iv->getIV().size() != _ctxt.algo->blocksize) throw InvalidAlgorithmParameterException("IV length must be equal to blocksize"); if (blockCipherContextSetIV(&_ctxt, iv->getIV().data())) throw ProviderException("BeeCrypt internal error in blockCipherContextSetIV"); _iv = iv->getIV(); engineInit(opmode, key, random); } bytearray* BlockCipher::engineUpdate(const byte* input, int inputOffset, int inputLength) { bytearray* tmp = new bytearray(engineGetOutputSize(inputLength)); int total = process(input+inputOffset, inputLength, tmp->data(), tmp->size()); if (total == 0) { delete tmp; tmp = 0; } else if (total < tmp->size()) { tmp->resize(total); } return tmp; } int BlockCipher::engineUpdate(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException) { return process(input+inputOffset, inputLength, output.data() + outputOffset, output.size() - outputOffset); } void BlockCipher::engineSetMode(const String& mode) throw (NoSuchAlgorithmException) { if (mode.length() == 0 || mode.equalsIgnoreCase("ECB")) _blmode = MODE_ECB; else if (mode.equalsIgnoreCase("CBC")) _blmode = MODE_CBC; else if (mode.equalsIgnoreCase("CTR")) _blmode = MODE_CTR; else throw NoSuchAlgorithmException(); } void BlockCipher::engineSetPadding(const String& padding) throw (NoSuchPaddingException) { if (padding.length() == 0 || padding.equalsIgnoreCase("None") || padding.equalsIgnoreCase("NoPadding")) _padding = PADDING_NONE; else if (padding.equalsIgnoreCase("PKCS5") || padding.equalsIgnoreCase("PKCS#5") || padding.equalsIgnoreCase("PKCS5Padding")) _padding = PADDING_PKCS5; else throw NoSuchPaddingException(); } /*!\brief The core encryption/decryption processing function. * It makes sure that: * - all input and output is properly 32-bit aligned * - at least 'buffer low water mark' bytes remain in the buffer (for unpadding) */ int BlockCipher::process(const byte* input, int inputLength, byte* output, int outputLength) throw (ShortBufferException) { int blocksize = _ctxt.algo->blocksize; int total = 0; do { bool copyIn, copyOut; const uint32_t *in; uint32_t *out; int blocks; int bytes; copyIn = ((((byte) (unsigned long) input) & 0x3) != 0) || (_bufcnt > 0) || (_bufcnt < _buflwm); if (copyIn) { int copy = _buffer.size() - _bufcnt; if (copy > inputLength) copy = inputLength; if (copy) { memcpy(_buffer.data() + _bufcnt, input, copy); _bufcnt += copy; input += copy; inputLength -= copy; } blocks = (_bufcnt - _buflwm) / blocksize; in = (const uint32_t*) _buffer.data(); } else { blocks = inputLength / blocksize; in = (const uint32_t*) input; } copyOut = (((byte) (unsigned long) output) & 0x3) != 0; if (copyOut) { int maxblocks = _buffer.size() / blocksize; if (blocks > maxblocks) blocks = maxblocks; out = (uint32_t*) _buffer.data(); } else out = (uint32_t*) output; if (blocks) { bytes = blocks * blocksize; if (bytes > outputLength) throw ShortBufferException("BlockCipher output buffer too short"); switch (_blmode) { case MODE_ECB: blockCipherContextECB(&_ctxt, out, in, blocks); break; case MODE_CBC: blockCipherContextCBC(&_ctxt, out, in, blocks); break; case MODE_CTR: blockCipherContextCTR(&_ctxt, out, in, blocks); break; } if (copyOut) memcpy(output, out, bytes); total += bytes; if (copyIn) { _bufcnt -= bytes; } else { input += bytes; inputLength -= bytes; } output += bytes; outputLength -= bytes; } else bytes = 0; if (_bufcnt > bytes) { // bytes remain in buffer; move them to the front memmove(_buffer.data(), _buffer.data() + _bufcnt, _bufcnt - bytes); } if (inputLength < (blocksize + _buflwm)) { // less than one block remains; copy it into the buffer memcpy(_buffer.data() + _bufcnt, input, inputLength); _bufcnt += inputLength; inputLength = 0; } } while (inputLength > 0); return total; } void BlockCipher::engineReset() { if (_opmode == Cipher::ENCRYPT_MODE || _opmode == Cipher::DECRYPT_MODE) { if (blockCipherContextSetup(&_ctxt, _key.data(), _keybits, (cipherOperation) _opmode)) throw ProviderException("BeeCrypt internal error in blockCipherContextSetup"); if (_opmode == Cipher::DECRYPT_MODE && _padding == PADDING_PKCS5) { // keep one block for unpadding _buflwm = _ctxt.algo->blocksize; } } else throw UnsupportedOperationException("unsupported mode"); } beecrypt-4.2.1/c++/provider/HMAC.cxx0000664000175000001440000000647010213030414013703 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/pkcs12.h" #include "beecrypt/c++/crypto/interfaces/PBEKey.h" using beecrypt::crypto::interfaces::PBEKey; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/provider/HMAC.h" using namespace beecrypt::provider; HMAC::HMAC(const keyedHashFunction& mac, const hashFunction& hash) : _digest(mac.digestsize), _ctxt(&mac) { _kf = &mac; _hf = &hash; } const bytearray& HMAC::engineDoFinal() { keyedHashFunctionContextDigest(&_ctxt, _digest.data()); return _digest; } int HMAC::engineDoFinal(byte* data, int offset, int length) throw (ShortBufferException) { if (!data) throw NullPointerException(); if (length < _digest.size()) throw ShortBufferException(); keyedHashFunctionContextDigest(&_ctxt, data); return _digest.size(); } int HMAC::engineGetMacLength() { return _digest.size(); } void HMAC::engineReset() { keyedHashFunctionContextReset(&_ctxt); } void HMAC::engineUpdate(byte b) { keyedHashFunctionContextUpdate(&_ctxt, &b, 1); } void HMAC::engineUpdate(const byte* data, int offset, int length) { keyedHashFunctionContextUpdate(&_ctxt, data+offset, length); } void HMAC::engineInit(const Key& key, const AlgorithmParameterSpec* spec) throw (InvalidKeyException, InvalidAlgorithmParameterException) { if (spec) throw InvalidAlgorithmParameterException("No AlgorithmParameterSpec supported"); #if 0 // key derivation should be done by caller; we can't know whether it's PKCS#5 or PKCS#12 const PBEKey* pbe = dynamic_cast(&key); if (pbe) { bytearray _rawk, _salt, _mack(_digest.size()); int _iter; if (pbe->getEncoded()) _rawk = *(pbe->getEncoded()); else throw InvalidKeyException("PBEKey must have an encoding"); if (pbe->getSalt()) _salt = *(pbe->getSalt()); _iter = pbe->getIterationCount(); if (pkcs12_derive_key(_hf, PKCS12_ID_MAC, _rawk.data(), _rawk.size(), _salt.data(), _salt.size(), _iter, _mack.data(), _mack.size())) throw InvalidKeyException("pkcs12_derive_key returned error"); keyedHashFunctionContextSetup(&_ctxt, _mack.data(), _mack.size() << 3); return; } #endif const SecretKey* sec = dynamic_cast(&key); if (sec) { bytearray _rawk; if (sec->getEncoded()) _rawk = *(sec->getEncoded()); else throw InvalidKeyException("SecretKey must have an encoding"); keyedHashFunctionContextSetup(&_ctxt, _rawk.data(), _rawk.size() << 3); return; } throw InvalidKeyException("expected a SecretKey or a PBEKey"); } beecrypt-4.2.1/c++/provider/DHParameterGenerator.cxx0000664000175000001440000000531610205327162017206 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/adapter.h" using beecrypt::randomGeneratorContextAdapter; #include "beecrypt/c++/provider/DHParameterGenerator.h" #include "beecrypt/c++/security/AlgorithmParameters.h" using beecrypt::security::AlgorithmParameters; #include "beecrypt/c++/crypto/spec/DHParameterSpec.h" using beecrypt::crypto::spec::DHParameterSpec; using namespace beecrypt::provider; DHParameterGenerator::DHParameterGenerator() { _size = 0; _spec = 0; _srng = 0; } DHParameterGenerator::~DHParameterGenerator() { delete _spec; } AlgorithmParameters* DHParameterGenerator::engineGenerateParameters() { if (!_spec) { dldp_p param; if (_srng) { randomGeneratorContextAdapter rngc(_srng); if (dldp_pgonMakeSafe(¶m, &rngc, _size)) throw "unexpected error in dldp_pMake"; } else { randomGeneratorContext rngc(randomGeneratorDefault()); if (dldp_pgonMakeSafe(¶m, &rngc, _size)) throw "unexpected error in dldp_pMake"; } _spec = new DHParameterSpec(BigInteger(param.p), BigInteger(param.g)); } try { AlgorithmParameters* param = AlgorithmParameters::getInstance("DH"); param->init(*_spec); return param; } catch (Exception&) { } return 0; } void DHParameterGenerator::engineInit(const AlgorithmParameterSpec& spec, SecureRandom* random) throw (InvalidAlgorithmParameterException) { const DHParameterSpec* dhspec = dynamic_cast(&spec); if (dhspec) { delete _spec; _spec = new DHParameterSpec(*dhspec); _srng = random; } else throw InvalidAlgorithmParameterException("expected DHParameterSpec"); } void DHParameterGenerator::engineInit(int keysize, SecureRandom* random) throw (InvalidParameterException) { if ((keysize < 768) || ((keysize & 0x3f) != 0)) throw InvalidParameterException("Prime size must be greater than 768 and be a multiple of 64"); delete _spec; _size = keysize; _spec = 0; _srng = random; } beecrypt-4.2.1/c++/provider/DSAKeyPairGenerator.cxx0000664000175000001440000001151110205352201016730 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/adapter.h" using beecrypt::randomGeneratorContextAdapter; #include "beecrypt/c++/provider/DSAKeyPairGenerator.h" #include "beecrypt/c++/provider/DSAPublicKeyImpl.h" #include "beecrypt/c++/provider/DSAPrivateKeyImpl.h" #include "beecrypt/c++/security/KeyPair.h" using beecrypt::security::KeyPair; #include "beecrypt/c++/security/spec/DSAParameterSpec.h" using beecrypt::security::spec::DSAParameterSpec; namespace { const char* P_512 = "fca682ce8e12caba26efccf7110e526db078b05edecbcd1eb4a208f3ae1617ae01f35b91a47e6df63413c5e12ed0899bcd132acd50d99151bdc43ee737592e17"; const char* Q_512 = "962eddcc369cba8ebb260ee6b6a126d9346e38c5"; const char* G_512 = "678471b27a9cf44ee91a49c5147db1a9aaf244f05a434d6486931d2d14271b9e35030b71fd73da179069b32e2935630e1c2062354d0da20a6c416e50be794ca4"; const char* P_768 = "e9e642599d355f37c97ffd3567120b8e25c9cd43e927b3a9670fbec5d890141922d2c3b3ad2480093799869d1e846aab49fab0ad26d2ce6a22219d470bce7d777d4a21fbe9c270b57f607002f3cef8393694cf45ee3688c11a8c56ab127a3daf"; const char* Q_768 = "9cdbd84c9f1ac2f38d0f80f42ab952e7338bf511"; const char* G_768 = "30470ad5a005fb14ce2d9dcd87e38bc7d1b1c5facbaecbe95f190aa7a31d23c4dbbcbe06174544401a5b2c020965d8c2bd2171d3668445771f74ba084d2029d83c1c158547f3a9f1a2715be23d51ae4d3e5a1f6a7064f316933a346d3f529252"; const char* P_1024 = "fd7f53811d75122952df4a9c2eece4e7f611b7523cef4400c31e3f80b6512669455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff26660b76b9950a5a49f9fe8047b1022c24fbba9d7feb7c61bf83b57e7c6a8a6150f04fb83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c7"; const char* Q_1024 = "9760508f15230bccb292b982a2eb840bf0581cf5"; const char* G_1024 = "f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea82f9574c0b3d0782675159578ebad4594fe67107108180b449167123e84c281613b7cf09328cc8a6e13c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a01243bcca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a"; } using namespace beecrypt::provider; DSAKeyPairGenerator::DSAKeyPairGenerator() { _size = 0; _spec = 0; _srng = 0; } DSAKeyPairGenerator::~DSAKeyPairGenerator() { delete _spec; } KeyPair* DSAKeyPairGenerator::genpair(randomGeneratorContext* rngc) { dsaparam param; mpnumber x; mpnumber y; if (_spec) { transform(param.p, _spec->getP()); transform(param.q, _spec->getQ()); transform(param.g, _spec->getG()); } else { if (_size == 512) { mpbsethex(¶m.p, P_512); mpbsethex(¶m.q, Q_512); mpnsethex(¶m.g, G_512); } else if (_size == 768) { mpbsethex(¶m.p, P_768); mpbsethex(¶m.q, Q_768); mpnsethex(¶m.g, G_768); } else if ((_size == 1024) || !_size) { mpbsethex(¶m.p, P_1024); mpbsethex(¶m.q, Q_1024); mpnsethex(¶m.g, G_1024); } else { if (dsaparamMake(¶m, rngc, _size)) throw "unexpected error in dsaparamMake"; } } if (dldp_pPair(¶m, rngc, &x, &y)) throw "unexpected error in dldp_pPair"; KeyPair* result = new KeyPair(new DSAPublicKeyImpl(param, y), new DSAPrivateKeyImpl(param, x)); x.wipe(); return result; } KeyPair* DSAKeyPairGenerator::engineGenerateKeyPair() { if (_srng) { randomGeneratorContextAdapter rngc(_srng); return genpair(&rngc); } else { randomGeneratorContext rngc(randomGeneratorDefault()); return genpair(&rngc); } } void DSAKeyPairGenerator::engineInitialize(const AlgorithmParameterSpec& spec, SecureRandom* random) throw (InvalidAlgorithmParameterException) { const DSAParameterSpec* dsaspec = dynamic_cast(&spec); if (dsaspec) { delete _spec; _spec = new DSAParameterSpec(*dsaspec); _srng = random; } else throw InvalidAlgorithmParameterException("not a DSAParameterSpec"); } void DSAKeyPairGenerator::engineInitialize(int keysize, SecureRandom* random) throw (InvalidParameterException) { if ((keysize < 512) || (keysize > 1024) || ((keysize & 0x3f) != 0)) throw InvalidParameterException("Prime size must range from 512 to 1024 bits and be a multiple of 64"); delete _spec; _size = keysize; _spec = 0; _srng = random; } beecrypt-4.2.1/c++/provider/DHKeyFactory.cxx0000664000175000001440000001243110205372252015473 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DHKeyFactory.h" #include "beecrypt/c++/provider/DHPrivateKeyImpl.h" #include "beecrypt/c++/provider/DHPublicKeyImpl.h" #include "beecrypt/c++/io/ByteArrayInputStream.h" using beecrypt::io::ByteArrayInputStream; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; #include "beecrypt/c++/crypto/spec/DHPrivateKeySpec.h" using beecrypt::crypto::spec::DHPrivateKeySpec; #include "beecrypt/c++/crypto/spec/DHPublicKeySpec.h" using beecrypt::crypto::spec::DHPublicKeySpec; #include "beecrypt/c++/beeyond/AnyEncodedKeySpec.h" using beecrypt::beeyond::AnyEncodedKeySpec; #include "beecrypt/c++/beeyond/BeeInputStream.h" using beecrypt::beeyond::BeeInputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_DH("DH"); DHPrivateKey* generatePrivate(const bytearray& enc) { try { ByteArrayInputStream bis(enc); BeeInputStream bee(bis); BigInteger p, g, x; p = bee.readBigInteger(); g = bee.readBigInteger(); x = bee.readBigInteger(); return new DHPrivateKeyImpl(p, g, x); } catch (IOException&) { } return 0; } DHPublicKey* generatePublic(const bytearray& enc) { try { ByteArrayInputStream bis(enc); BeeInputStream bee(bis); BigInteger p, g, y; p = bee.readBigInteger(); g = bee.readBigInteger(); y = bee.readBigInteger(); return new DHPublicKeyImpl(p, g, y); } catch (IOException&) { } return 0; } } DHKeyFactory::DHKeyFactory() { } PrivateKey* DHKeyFactory::engineGeneratePrivate(const KeySpec& spec) throw (InvalidKeySpecException) { const DHPrivateKeySpec* dh = dynamic_cast(&spec); if (dh) { return new DHPrivateKeyImpl(dh->getP(), dh->getG(), dh->getX()); } const EncodedKeySpec* enc = dynamic_cast(&spec); if (enc) { if (enc->getFormat().equals(FORMAT_BEE)) { DHPrivateKey* pri = generatePrivate(enc->getEncoded()); if (pri) return pri; throw InvalidKeySpecException("Invalid KeySpec encoding"); } throw InvalidKeySpecException("Unsupported KeySpec format"); } throw InvalidKeySpecException("Unsupported KeySpec type"); } PublicKey* DHKeyFactory::engineGeneratePublic(const KeySpec& spec) throw (InvalidKeySpecException) { const DHPublicKeySpec* dh = dynamic_cast(&spec); if (dh) { return new DHPublicKeyImpl(dh->getP(), dh->getG(), dh->getY()); } const EncodedKeySpec* enc = dynamic_cast(&spec); if (enc) { if (enc->getFormat().equals(FORMAT_BEE)) { DHPublicKey* pub = generatePublic(enc->getEncoded()); if (pub) return pub; throw InvalidKeySpecException("Invalid KeySpec encoding"); } throw InvalidKeySpecException("Unsupported KeySpec format"); } throw InvalidKeySpecException("Unsupported KeySpec type"); } KeySpec* DHKeyFactory::engineGetKeySpec(const Key& key, const type_info& info) throw (InvalidKeySpecException) { const DHPublicKey* pub = dynamic_cast(&key); if (pub) { if (info == typeid(KeySpec) || info == typeid(DHPublicKeySpec)) { const DHParams& params = pub->getParams(); return new DHPublicKeySpec(pub->getY(), params.getP(), params.getG()); } if (info == typeid(EncodedKeySpec)) { const String* format = pub->getFormat(); if (format) { const bytearray* enc = pub->getEncoded(); if (enc) return new AnyEncodedKeySpec(*format, *enc); } } throw InvalidKeySpecException("Unsupported KeySpec type"); } const DHPrivateKey* pri = dynamic_cast(&key); if (pri) { if (info == typeid(KeySpec) || info == typeid(DHPrivateKeySpec)) { const DHParams& params = pri->getParams(); return new DHPrivateKeySpec(pri->getX(), params.getP(), params.getG()); } if (info == typeid(EncodedKeySpec)) { const String* format = pri->getFormat(); if (format) { const bytearray* enc = pri->getEncoded(); if (enc) return new AnyEncodedKeySpec(*format, *enc); } } throw InvalidKeySpecException("Unsupported KeySpec type"); } throw InvalidKeySpecException("Unsupported Key type"); } Key* DHKeyFactory::engineTranslateKey(const Key& key) throw (InvalidKeyException) { const DHPublicKey* pub = dynamic_cast(&key); if (pub) return new DHPublicKeyImpl(*pub); const DHPrivateKey* pri = dynamic_cast(&key); if (pri) return new DHPrivateKeyImpl(*pri); throw InvalidKeyException("Unsupported Key type"); } beecrypt-4.2.1/c++/provider/PKCS12KeyFactory.cxx0000664000175000001440000000436610213030506016103 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/PKCS12PBEKey.h" using beecrypt::beeyond::PKCS12PBEKey; #include "beecrypt/c++/crypto/spec/PBEKeySpec.h" using beecrypt::crypto::spec::PBEKeySpec; #include "beecrypt/c++/provider/PKCS12KeyFactory.h" using namespace beecrypt::provider; PKCS12KeyFactory::PKCS12KeyFactory() { } SecretKey* PKCS12KeyFactory::engineGenerateSecret(const KeySpec& spec) throw (InvalidKeySpecException) { const PBEKeySpec* pbe = dynamic_cast(&spec); if (pbe) { return new PKCS12PBEKey(pbe->getPassword(), pbe->getSalt(), pbe->getIterationCount()); } throw InvalidKeySpecException("Expected a PBEKeySpec"); } KeySpec* PKCS12KeyFactory::engineGetKeySpec(const SecretKey& key, const type_info& info) throw (InvalidKeySpecException) { const PBEKey* pbe = dynamic_cast(&key); if (pbe) { if (info == typeid(KeySpec) || info == typeid(PBEKeySpec)) { return new PBEKeySpec(&pbe->getPassword(), pbe->getSalt(), pbe->getIterationCount(), 0); } throw InvalidKeySpecException("Unsupported KeySpec type"); } throw InvalidKeySpecException("Unsupported SecretKey type"); } SecretKey* PKCS12KeyFactory::engineTranslateKey(const SecretKey& key) throw (InvalidKeyException) { const PBEKey* pbe = dynamic_cast(&key); if (pbe) { return new PKCS12PBEKey(pbe->getPassword(), pbe->getSalt(), pbe->getIterationCount()); } throw InvalidKeyException("Unsupported SecretKey type"); } beecrypt-4.2.1/c++/provider/DHKeyAgreement.cxx0000664000175000001440000001061010302132405015760 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DHKeyAgreement.h" #include "beecrypt/c++/provider/DHPublicKeyImpl.h" #include "beecrypt/c++/crypto/interfaces/DHPrivateKey.h" using beecrypt::crypto::interfaces::DHPrivateKey; #include "beecrypt/c++/crypto/interfaces/DHPublicKey.h" using beecrypt::crypto::interfaces::DHPublicKey; #include "beecrypt/c++/crypto/SecretKeyFactory.h" using beecrypt::crypto::SecretKeyFactory; #include "beecrypt/c++/crypto/spec/SecretKeySpec.h" using beecrypt::crypto::spec::SecretKeySpec; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include using std::auto_ptr; using namespace beecrypt::provider; DHKeyAgreement::DHKeyAgreement() { _state = UNINITIALIZED; _secret = 0; } DHKeyAgreement::~DHKeyAgreement() { delete _secret; } Key* DHKeyAgreement::engineDoPhase(const Key& key, bool lastPhase) throw (InvalidKeyException, IllegalStateException) { if (_state == INITIALIZED) { const DHPublicKey* pub = dynamic_cast(&key); if (pub) { transform(_y, pub->getY()); if (mpz(_y.size, _y.data) || mpgex(_y.size, _y.data, _param.p.size, _param.p.modl)) throw InvalidKeyException("y must be in range [1 .. (p-1)]"); mpnumber _s; if (dlsvdp_pDHSecret(&_param, &_x, &_y, &_s)) throw ProviderException("BeeCrypt internal error in dlsvdp_pDHSecret"); if (lastPhase) { size_t req = (_s.bitlength() + 8) >> 3; _secret = new bytearray(req); i2osp(_secret->data(), _secret->size(), _s.data, _s.size); _state = SHARED; return 0; } else { // multi-party DH return new DHPublicKeyImpl(_param, _s); } } else throw InvalidKeyException("not a DHPublicKey"); } else throw IllegalStateException("DHKeyAgreement wasn't initialized"); } void DHKeyAgreement::engineInit(const Key& key, SecureRandom* random) throw (InvalidKeyException) { const DHPrivateKey* pri = dynamic_cast(&key); if (pri) { transform(_param.p, pri->getParams().getP()); transform(_param.g, pri->getParams().getG()); transform(_x, pri->getX()); _state = INITIALIZED; } else throw InvalidKeyException("not a DHPrivateKey"); } bytearray* DHKeyAgreement::engineGenerateSecret() throw (IllegalStateException) { if (_state == SHARED) { bytearray* tmp = _secret; _secret = 0; _state = INITIALIZED; return tmp; } else throw IllegalStateException(); } int DHKeyAgreement::engineGenerateSecret(bytearray& b, int offset) throw (IllegalStateException, ShortBufferException) { if (_state == SHARED) { int size = _secret->size(); if ((b.size() - offset) > size) throw ShortBufferException(); memcpy(b.data() + offset, _secret->data(), size); delete _secret; _secret = 0; _state = INITIALIZED; return size; } else throw IllegalStateException(); } SecretKey* DHKeyAgreement::engineGenerateSecret(const String& algorithm) throw (IllegalStateException, NoSuchAlgorithmException, InvalidKeyException) { if (_state == SHARED) { _state = INITIALIZED; SecretKeyFactory* skf = SecretKeyFactory::getInstance(algorithm); SecretKeySpec spec(*_secret, algorithm); delete _secret; _secret = 0; try { auto_ptr tmp(skf->generateSecret(spec)); return tmp.release(); } catch (InvalidKeySpecException& e) { throw InvalidKeyException().initCause(e); } } else throw IllegalStateException(); } void DHKeyAgreement::engineInit(const Key& key, const AlgorithmParameterSpec& spec, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) { engineInit(key, random); } beecrypt-4.2.1/c++/provider/HMACMD5.cxx0000664000175000001440000000221710302132351014206 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacmd5.h" #include "beecrypt/c++/provider/HMACMD5.h" using namespace beecrypt::provider; HMACMD5::HMACMD5() : HMAC(hmacmd5, md5) { } HMACMD5* HMACMD5::clone() const throw () { HMACMD5* result = new HMACMD5(); memcpy(result->_ctxt.param, _ctxt.param, _ctxt.algo->paramsize); return result; } beecrypt-4.2.1/c++/provider/DSAParameterGenerator.cxx0000664000175000001440000000545510205352304017322 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/dsa.h" #include "beecrypt/c++/adapter.h" using beecrypt::randomGeneratorContextAdapter; #include "beecrypt/c++/provider/DSAParameterGenerator.h" #include "beecrypt/c++/security/AlgorithmParameters.h" using beecrypt::security::AlgorithmParameters; #include "beecrypt/c++/security/spec/DSAParameterSpec.h" using beecrypt::security::spec::DSAParameterSpec; using namespace beecrypt::provider; DSAParameterGenerator::DSAParameterGenerator() { _size = 0; _spec = 0; _srng = 0; } DSAParameterGenerator::~DSAParameterGenerator() { delete _spec; } AlgorithmParameters* DSAParameterGenerator::engineGenerateParameters() { if (!_spec) { dsaparam param; if (_srng) { randomGeneratorContextAdapter rngc(_srng); if (dsaparamMake(¶m, &rngc, _size)) throw "unexpected error in dsaparamMake"; } else { randomGeneratorContext rngc(randomGeneratorDefault()); if (dsaparamMake(¶m, &rngc, _size)) throw "unexpected error in dsaparamMake"; } _spec = new DSAParameterSpec(BigInteger(param.p), BigInteger(param.q), BigInteger(param.g)); } try { AlgorithmParameters* param = AlgorithmParameters::getInstance("DSA"); param->init(*_spec); return param; } catch (Exception&) { } return 0; } void DSAParameterGenerator::engineInit(const AlgorithmParameterSpec& spec, SecureRandom* random) throw (InvalidAlgorithmParameterException) { const DSAParameterSpec* dsaspec = dynamic_cast(&spec); if (dsaspec) { delete _spec; _spec = new DSAParameterSpec(*dsaspec); _srng = random; } else throw InvalidAlgorithmParameterException("expected DSAParameterSpec"); } void DSAParameterGenerator::engineInit(int keysize, SecureRandom* random) throw (InvalidParameterException) { if ((keysize < 512) || (keysize > 1024) || ((keysize & 0x3f) != 0)) throw InvalidParameterException("Prime size must range from 512 to 1024 bits and be a multiple of 64"); delete _spec; _size = keysize; _spec = 0; _srng = random; } beecrypt-4.2.1/c++/provider/HMACSHA512.cxx0000664000175000001440000000225510302132372014471 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha512.h" #include "beecrypt/c++/provider/HMACSHA512.h" using namespace beecrypt::provider; HMACSHA512::HMACSHA512() : HMAC(hmacsha512, sha512) { } HMACSHA512* HMACSHA512::clone() const throw () { HMACSHA512* result = new HMACSHA512(); memcpy(result->_ctxt.param, _ctxt.param, _ctxt.algo->paramsize); return result; } beecrypt-4.2.1/c++/provider/SHA1withRSASignature.cxx0000664000175000001440000000202410200715205017006 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/SHA1withRSASignature.h" #include "beecrypt/sha1.h" using namespace beecrypt::provider; SHA1withRSASignature::SHA1withRSASignature() : PKCS1RSASignature(&sha1) { } beecrypt-4.2.1/c++/provider/AESCipher.cxx0000664000175000001440000000175210132754075014754 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/AESCipher.h" #include "beecrypt/aes.h" using namespace beecrypt::provider; AESCipher::AESCipher() : BlockCipher(aes) { } beecrypt-4.2.1/c++/provider/MD5Digest.cxx0000664000175000001440000000460110302132333014714 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include "beecrypt/c++/provider/MD5Digest.h" using namespace beecrypt::provider; MD5Digest::MD5Digest() : _digest(16) { if (md5Reset(&_param)) throw ProviderException("BeeCrypt internal error in md5Reset"); } MD5Digest::~MD5Digest() { } MD5Digest* MD5Digest::clone() const throw () { MD5Digest* result = new MD5Digest(); memcpy(&result->_param, &_param, sizeof(md5Param)); return result; } const bytearray& MD5Digest::engineDigest() { if (md5Digest(&_param, _digest.data())) throw ProviderException("BeeCrypt internal error in md5Digest"); return _digest; } int MD5Digest::engineDigest(byte* data, int offset, int length) throw (ShortBufferException) { if (!data) throw NullPointerException(); if (length < 16) throw ShortBufferException(); if (md5Digest(&_param, data)) throw ProviderException("BeeCrypt internal error in md5Digest"); return 16; } int MD5Digest::engineGetDigestLength() { return 16; } void MD5Digest::engineReset() { if (md5Reset(&_param)) throw ProviderException("BeeCrypt internal error in md5Reset"); } void MD5Digest::engineUpdate(byte b) { if (md5Update(&_param, &b, 1)) throw ProviderException("BeeCrypt internal error in md5Update"); } void MD5Digest::engineUpdate(const byte* data, int offset, int length) { if (md5Update(&_param, data+offset, length)) throw ProviderException("BeeCrypt internal error in md5Update"); } beecrypt-4.2.1/c++/provider/Makefile.in0000644000175000001440000006161211226307161014524 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = c++/provider DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(sysconfdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) base_la_DEPENDENCIES = $(top_builddir)/c++/libbeecrypt_cxx.la am_base_la_OBJECTS = AESCipher.lo BeeCertificateFactory.lo \ BeeCertPathValidator.lo BaseProvider.lo BeeKeyStore.lo \ BeeSecureRandom.lo BlockCipher.lo BlowfishCipher.lo \ DHIESCipher.lo DHIESParameters.lo DHKeyAgreement.lo \ DHKeyFactory.lo DHKeyPairGenerator.lo DHParameterGenerator.lo \ DHParameters.lo DHPrivateKeyImpl.lo DHPublicKeyImpl.lo \ DSAKeyFactory.lo DSAKeyPairGenerator.lo \ DSAParameterGenerator.lo DSAParameters.lo DSAPrivateKeyImpl.lo \ DSAPublicKeyImpl.lo HMAC.lo HMACMD5.lo HMACSHA1.lo \ HMACSHA256.lo HMACSHA384.lo HMACSHA512.lo KeyProtector.lo \ MD5Digest.lo MD5withRSASignature.lo PKCS1RSASignature.lo \ PKCS12KeyFactory.lo RSAKeyFactory.lo RSAKeyPairGenerator.lo \ RSAPrivateCrtKeyImpl.lo RSAPrivateKeyImpl.lo \ RSAPublicKeyImpl.lo SHA1Digest.lo SHA224Digest.lo \ SHA256Digest.lo SHA384Digest.lo SHA512Digest.lo \ SHA1withDSASignature.lo SHA1withRSASignature.lo \ SHA256withRSASignature.lo SHA384withRSASignature.lo \ SHA512withRSASignature.lo base_la_OBJECTS = $(am_base_la_OBJECTS) base_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ $(base_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(base_la_SOURCES) DIST_SOURCES = $(base_la_SOURCES) DATA = $(nodist_sysconf_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkglibdir = $(libdir)/beecrypt ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = -licuuc -licuio LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu pkglib_LTLIBRARIES = base.la nodist_sysconf_DATA = beecrypt.conf base_la_SOURCES = \ AESCipher.cxx \ BeeCertificateFactory.cxx \ BeeCertPathValidator.cxx \ BaseProvider.cxx \ BeeKeyStore.cxx \ BeeSecureRandom.cxx \ BlockCipher.cxx \ BlowfishCipher.cxx \ DHIESCipher.cxx \ DHIESParameters.cxx \ DHKeyAgreement.cxx \ DHKeyFactory.cxx \ DHKeyPairGenerator.cxx \ DHParameterGenerator.cxx \ DHParameters.cxx \ DHPrivateKeyImpl.cxx \ DHPublicKeyImpl.cxx \ DSAKeyFactory.cxx \ DSAKeyPairGenerator.cxx \ DSAParameterGenerator.cxx \ DSAParameters.cxx \ DSAPrivateKeyImpl.cxx \ DSAPublicKeyImpl.cxx \ HMAC.cxx \ HMACMD5.cxx \ HMACSHA1.cxx \ HMACSHA256.cxx \ HMACSHA384.cxx \ HMACSHA512.cxx \ KeyProtector.cxx \ MD5Digest.cxx \ MD5withRSASignature.cxx \ PKCS1RSASignature.cxx \ PKCS12KeyFactory.cxx \ RSAKeyFactory.cxx \ RSAKeyPairGenerator.cxx \ RSAPrivateCrtKeyImpl.cxx \ RSAPrivateKeyImpl.cxx \ RSAPublicKeyImpl.cxx \ SHA1Digest.cxx \ SHA224Digest.cxx \ SHA256Digest.cxx \ SHA384Digest.cxx \ SHA512Digest.cxx \ SHA1withDSASignature.cxx \ SHA1withRSASignature.cxx \ SHA256withRSASignature.cxx \ SHA384withRSASignature.cxx \ SHA512withRSASignature.cxx base_la_LDFLAGS = -module base_la_LIBADD = $(top_builddir)/c++/libbeecrypt_cxx.la CLEANFILES = beecrypt.conf all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/provider/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/provider/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done base.la: $(base_la_OBJECTS) $(base_la_DEPENDENCIES) $(base_la_LINK) -rpath $(pkglibdir) $(base_la_OBJECTS) $(base_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AESCipher.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BaseProvider.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeCertPathValidator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeCertificateFactory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeKeyStore.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeSecureRandom.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BlockCipher.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BlowfishCipher.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHIESCipher.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHIESParameters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHKeyAgreement.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHKeyFactory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHKeyPairGenerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHParameterGenerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHParameters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHPrivateKeyImpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHPublicKeyImpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DSAKeyFactory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DSAKeyPairGenerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DSAParameterGenerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DSAParameters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DSAPrivateKeyImpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DSAPublicKeyImpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HMAC.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HMACMD5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HMACSHA1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HMACSHA256.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HMACSHA384.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HMACSHA512.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/KeyProtector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MD5Digest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MD5withRSASignature.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PKCS12KeyFactory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PKCS1RSASignature.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RSAKeyFactory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RSAKeyPairGenerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RSAPrivateCrtKeyImpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RSAPrivateKeyImpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RSAPublicKeyImpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA1Digest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA1withDSASignature.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA1withRSASignature.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA224Digest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA256Digest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA256withRSASignature.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA384Digest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA384withRSASignature.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA512Digest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SHA512withRSASignature.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nodist_sysconfDATA: $(nodist_sysconf_DATA) @$(NORMAL_INSTALL) test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" @list='$(nodist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \ done uninstall-nodist_sysconfDATA: @$(NORMAL_UNINSTALL) @list='$(nodist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(sysconfdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sysconfdir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(sysconfdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-nodist_sysconfDATA install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nodist_sysconfDATA uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-nodist_sysconfDATA install-pdf install-pdf-am \ install-pkglibLTLIBRARIES install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-nodist_sysconfDATA uninstall-pkglibLTLIBRARIES beecrypt.conf: @echo "provider.1=$(pkgaltlibdir)/base.so" > beecrypt.conf # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/provider/SHA256Digest.cxx0000664000175000001440000000472510302132304015204 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include "beecrypt/c++/provider/SHA256Digest.h" using namespace beecrypt::provider; SHA256Digest::SHA256Digest() : _digest(32) { if (sha256Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha256Reset"); } SHA256Digest::~SHA256Digest() { } SHA256Digest* SHA256Digest::clone() const throw () { SHA256Digest* result = new SHA256Digest(); memcpy(&result->_param, &_param, sizeof(sha256Param)); return result; } const bytearray& SHA256Digest::engineDigest() { if (sha256Digest(&_param, _digest.data())) throw ProviderException("BeeCrypt internal error in sha256Digest"); return _digest; } int SHA256Digest::engineDigest(byte* data, int offset, int length) throw (ShortBufferException) { if (!data) throw NullPointerException(); if (length < 32) throw ShortBufferException(); if (sha256Digest(&_param, data)) throw ProviderException("BeeCrypt internal error in sha256Digest"); return 32; } int SHA256Digest::engineGetDigestLength() { return 32; } void SHA256Digest::engineReset() { if (sha256Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha256Reset"); } void SHA256Digest::engineUpdate(byte b) { if (sha256Update(&_param, &b, 1)) throw ProviderException("BeeCrypt internal error in sha256Update"); } void SHA256Digest::engineUpdate(const byte* data, int offset, int length) { if (sha256Update(&_param, data+offset, length)) throw ProviderException("BeeCrypt internal error in sha256Update"); } beecrypt-4.2.1/c++/provider/DHPrivateKeyImpl.cxx0000664000175000001440000000632210205372011016313 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DHPrivateKeyImpl.h" #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/beeyond/BeeOutputStream.h" using beecrypt::beeyond::BeeOutputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_DH("DH"); } DHPrivateKeyImpl::DHPrivateKeyImpl(const DHPrivateKey& copy) : _x(copy.getX()) { _params = new DHParameterSpec(copy.getParams()); _enc = 0; } DHPrivateKeyImpl::DHPrivateKeyImpl(const DHPrivateKeyImpl& copy) : _x(copy._x) { _params = new DHParameterSpec(*copy._params); _enc = 0; } DHPrivateKeyImpl::DHPrivateKeyImpl(const DHParams& params, const BigInteger& x) : _x(x) { _params = new DHParameterSpec(params.getP(), params.getG(), params.getL()); _enc = 0; } DHPrivateKeyImpl::DHPrivateKeyImpl(const dhparam& params, const mpnumber& x) : _x(x) { _params = new DHParameterSpec(BigInteger(params.p), BigInteger(params.g)); _enc = 0; } DHPrivateKeyImpl::DHPrivateKeyImpl(const BigInteger& p, const BigInteger& g, const BigInteger& x) : _x(x) { _params = new DHParameterSpec(p, g); _enc = 0; } DHPrivateKeyImpl::~DHPrivateKeyImpl() { delete _params; delete _enc; } DHPrivateKeyImpl* DHPrivateKeyImpl::clone() const throw () { return new DHPrivateKeyImpl(*this); } bool DHPrivateKeyImpl::equals(const Object* obj) const throw () { if (this == obj) return true; const DHPrivateKey* pri = dynamic_cast(obj); if (pri) { if (pri->getParams().getP() != _params->getP()) return false; if (pri->getParams().getG() != _params->getG()) return false; if (pri->getX() != _x) return false; return true; } return false; } const DHParams& DHPrivateKeyImpl::getParams() const throw () { return *_params; } const BigInteger& DHPrivateKeyImpl::getX() const throw () { return _x; } const bytearray* DHPrivateKeyImpl::getEncoded() const throw () { if (!_enc) { try { ByteArrayOutputStream bos; BeeOutputStream bee(bos); bee.writeBigInteger(_params->getP()); bee.writeBigInteger(_params->getG()); bee.writeBigInteger(_x); bee.close(); _enc = bos.toByteArray(); } catch (IOException&) { } } return _enc; } const String& DHPrivateKeyImpl::getAlgorithm() const throw () { return ALGORITHM_DH; } const String* DHPrivateKeyImpl::getFormat() const throw () { return &FORMAT_BEE; } beecrypt-4.2.1/c++/provider/RSAKeyFactory.cxx0000664000175000001440000001534010215532660015631 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/RSAKeyFactory.h" #include "beecrypt/c++/provider/RSAPrivateKeyImpl.h" #include "beecrypt/c++/provider/RSAPrivateCrtKeyImpl.h" #include "beecrypt/c++/provider/RSAPublicKeyImpl.h" #include "beecrypt/c++/io/ByteArrayInputStream.h" using beecrypt::io::ByteArrayInputStream; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; #include "beecrypt/c++/security/spec/RSAPrivateKeySpec.h" using beecrypt::security::spec::RSAPrivateKeySpec; #include "beecrypt/c++/security/spec/RSAPrivateCrtKeySpec.h" using beecrypt::security::spec::RSAPrivateCrtKeySpec; #include "beecrypt/c++/security/spec/RSAPublicKeySpec.h" using beecrypt::security::spec::RSAPublicKeySpec; #include "beecrypt/c++/beeyond/AnyEncodedKeySpec.h" using beecrypt::beeyond::AnyEncodedKeySpec; #include "beecrypt/c++/beeyond/BeeInputStream.h" using beecrypt::beeyond::BeeInputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_RSA("RSA"); RSAPrivateKey* generatePrivate(const bytearray& enc) throw (InvalidKeySpecException) { try { ByteArrayInputStream bis(enc); BeeInputStream bee(bis); BigInteger n, d; n = bee.readBigInteger(); d = bee.readBigInteger(); if (bee.available() > 0) { BigInteger e, p, q, dp, dq, qi; e = bee.readBigInteger(); p = bee.readBigInteger(); q = bee.readBigInteger(); dp = bee.readBigInteger(); dq = bee.readBigInteger(); qi = bee.readBigInteger(); return new RSAPrivateCrtKeyImpl(n, e, d, p, q, dp, dq, qi); } return new RSAPrivateKeyImpl(n, d); } catch (IOException&) { throw InvalidKeySpecException("Invalid KeySpec encoding"); } } RSAPublicKey* generatePublic(const bytearray& enc) throw (InvalidKeySpecException) { try { ByteArrayInputStream bis(enc); BeeInputStream bee(bis); BigInteger n, e; n = bee.readBigInteger(); e = bee.readBigInteger(); return new RSAPublicKeyImpl(n, e); } catch (IOException&) { throw InvalidKeySpecException("Invalid KeySpec encoding"); } } } RSAKeyFactory::RSAKeyFactory() { } PrivateKey* RSAKeyFactory::engineGeneratePrivate(const KeySpec& spec) throw (InvalidKeySpecException) { const RSAPrivateKeySpec* rsa = dynamic_cast(&spec); if (rsa) { const RSAPrivateCrtKeySpec* crt = dynamic_cast(rsa); if (crt) return new RSAPrivateCrtKeyImpl(crt->getModulus(), crt->getPublicExponent(), crt->getPrivateExponent(), crt->getPrimeP(), crt->getPrimeQ(), crt->getPrimeExponentP(), crt->getPrimeExponentQ(), crt->getCrtCoefficient()); else return new RSAPrivateKeyImpl(rsa->getModulus(), rsa->getPrivateExponent()); } const EncodedKeySpec* enc = dynamic_cast(&spec); if (enc) { if (enc->getFormat().equals(FORMAT_BEE)) { return generatePrivate(enc->getEncoded()); } throw InvalidKeySpecException("Unsupported KeySpec format"); } throw InvalidKeySpecException("Unsupported KeySpec type"); } PublicKey* RSAKeyFactory::engineGeneratePublic(const KeySpec& spec) throw (InvalidKeySpecException) { const RSAPublicKeySpec* rsa = dynamic_cast(&spec); if (rsa) { return new RSAPublicKeyImpl(rsa->getModulus(), rsa->getPublicExponent()); } const EncodedKeySpec* enc = dynamic_cast(&spec); if (enc) { if (enc->getFormat().equals(FORMAT_BEE)) { return generatePublic(enc->getEncoded()); } throw InvalidKeySpecException("Unsupported KeySpec format"); } throw InvalidKeySpecException("Unsupported KeySpec type"); } KeySpec* RSAKeyFactory::engineGetKeySpec(const Key& key, const type_info& info) throw (InvalidKeySpecException) { const RSAPublicKey* pub = dynamic_cast(&key); if (pub) { if (info == typeid(KeySpec) || info == typeid(RSAPublicKeySpec)) { return new RSAPublicKeySpec(pub->getModulus(), pub->getPublicExponent()); } if (info == typeid(EncodedKeySpec)) { const String* format = pub->getFormat(); if (format) { const bytearray* enc = pub->getEncoded(); if (enc) return new AnyEncodedKeySpec(*format, *enc); } } throw InvalidKeySpecException("Unsupported KeySpec type"); } const RSAPrivateCrtKey* crt = dynamic_cast(&key); if (crt) { if (info == typeid(KeySpec) || info == typeid(RSAPrivateCrtKeySpec)) { return new RSAPrivateCrtKeySpec(crt->getModulus(), crt->getPublicExponent(), crt->getPrivateExponent(), crt->getPrimeP(), crt->getPrimeQ(), crt->getPrimeExponentP(), crt->getPrimeExponentQ(), crt->getCrtCoefficient()); } if (info == typeid(EncodedKeySpec)) { const String* format = pub->getFormat(); if (format) { const bytearray* enc = pub->getEncoded(); if (enc) return new AnyEncodedKeySpec(*format, *enc); } } } const RSAPrivateKey* pri = dynamic_cast(&key); if (pri) { if (info == typeid(KeySpec) || info == typeid(RSAPrivateKeySpec)) { return new RSAPrivateKeySpec(pri->getModulus(), pri->getPrivateExponent()); } if (info == typeid(EncodedKeySpec)) { const String* format = pub->getFormat(); if (format) { const bytearray* enc = pub->getEncoded(); if (enc) return new AnyEncodedKeySpec(*format, *enc); } } throw InvalidKeySpecException("Unsupported KeySpec type"); } throw InvalidKeySpecException("Unsupported Key type"); } Key* RSAKeyFactory::engineTranslateKey(const Key& key) throw (InvalidKeyException) { const RSAPublicKey* pub = dynamic_cast(&key); if (pub) return new RSAPublicKeyImpl(*pub); const RSAPrivateKey* pri = dynamic_cast(&key); if (pri) { const RSAPrivateCrtKey* crt = dynamic_cast(pri); if (crt) return new RSAPrivateCrtKeyImpl(*crt); else return new RSAPrivateKeyImpl(*pri); } throw InvalidKeyException("Unsupported Key type"); } beecrypt-4.2.1/c++/provider/Makefile.am0000644000175000001440000000264411216650526014520 00000000000000INCLUDES = -I$(top_srcdir)/include LIBS = -licuuc -licuio AUTOMAKE_OPTIONS = gnu pkglibdir=$(libdir)/beecrypt pkglib_LTLIBRARIES = base.la nodist_sysconf_DATA = beecrypt.conf base_la_SOURCES = \ AESCipher.cxx \ BeeCertificateFactory.cxx \ BeeCertPathValidator.cxx \ BaseProvider.cxx \ BeeKeyStore.cxx \ BeeSecureRandom.cxx \ BlockCipher.cxx \ BlowfishCipher.cxx \ DHIESCipher.cxx \ DHIESParameters.cxx \ DHKeyAgreement.cxx \ DHKeyFactory.cxx \ DHKeyPairGenerator.cxx \ DHParameterGenerator.cxx \ DHParameters.cxx \ DHPrivateKeyImpl.cxx \ DHPublicKeyImpl.cxx \ DSAKeyFactory.cxx \ DSAKeyPairGenerator.cxx \ DSAParameterGenerator.cxx \ DSAParameters.cxx \ DSAPrivateKeyImpl.cxx \ DSAPublicKeyImpl.cxx \ HMAC.cxx \ HMACMD5.cxx \ HMACSHA1.cxx \ HMACSHA256.cxx \ HMACSHA384.cxx \ HMACSHA512.cxx \ KeyProtector.cxx \ MD5Digest.cxx \ MD5withRSASignature.cxx \ PKCS1RSASignature.cxx \ PKCS12KeyFactory.cxx \ RSAKeyFactory.cxx \ RSAKeyPairGenerator.cxx \ RSAPrivateCrtKeyImpl.cxx \ RSAPrivateKeyImpl.cxx \ RSAPublicKeyImpl.cxx \ SHA1Digest.cxx \ SHA224Digest.cxx \ SHA256Digest.cxx \ SHA384Digest.cxx \ SHA512Digest.cxx \ SHA1withDSASignature.cxx \ SHA1withRSASignature.cxx \ SHA256withRSASignature.cxx \ SHA384withRSASignature.cxx \ SHA512withRSASignature.cxx base_la_LDFLAGS = -module base_la_LIBADD = $(top_builddir)/c++/libbeecrypt_cxx.la CLEANFILES = beecrypt.conf beecrypt.conf: @echo "provider.1=$(pkgaltlibdir)/base.so" > beecrypt.conf beecrypt-4.2.1/c++/provider/SHA384Digest.cxx0000664000175000001440000000472510302132310015203 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include "beecrypt/c++/provider/SHA384Digest.h" using namespace beecrypt::provider; SHA384Digest::SHA384Digest() : _digest(48) { if (sha384Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha384Reset"); } SHA384Digest::~SHA384Digest() { } SHA384Digest* SHA384Digest::clone() const throw () { SHA384Digest* result = new SHA384Digest(); memcpy(&result->_param, &_param, sizeof(sha384Param)); return result; } const bytearray& SHA384Digest::engineDigest() { if (sha384Digest(&_param, _digest.data())) throw ProviderException("BeeCrypt internal error in sha384Digest"); return _digest; } int SHA384Digest::engineDigest(byte* data, int offset, int length) throw (ShortBufferException) { if (!data) throw NullPointerException(); if (length < 48) throw ShortBufferException(); if (sha384Digest(&_param, data)) throw ProviderException("BeeCrypt internal error in sha384Digest"); return 48; } int SHA384Digest::engineGetDigestLength() { return 48; } void SHA384Digest::engineReset() { if (sha384Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha384Reset"); } void SHA384Digest::engineUpdate(byte b) { if (sha384Update(&_param, &b, 1)) throw ProviderException("BeeCrypt internal error in sha384Update"); } void SHA384Digest::engineUpdate(const byte* data, int offset, int length) { if (sha384Update(&_param, data+offset, length)) throw ProviderException("BeeCrypt internal error in sha384Update"); } beecrypt-4.2.1/c++/provider/SHA256withRSASignature.cxx0000664000175000001440000000203710200715211017163 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/SHA256withRSASignature.h" #include "beecrypt/sha256.h" using namespace beecrypt::provider; SHA256withRSASignature::SHA256withRSASignature() : PKCS1RSASignature(&sha256) { } beecrypt-4.2.1/c++/provider/DSAPrivateKeyImpl.cxx0000664000175000001440000000665210205372027016444 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DSAPrivateKeyImpl.h" #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/beeyond/BeeOutputStream.h" using beecrypt::beeyond::BeeOutputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_DSA("DSA"); } DSAPrivateKeyImpl::DSAPrivateKeyImpl(const DSAPrivateKey& copy) { _params = new DSAParameterSpec(copy.getParams()); _x = copy.getX(); _enc = 0; } DSAPrivateKeyImpl::DSAPrivateKeyImpl(const DSAPrivateKeyImpl& copy) { _params = new DSAParameterSpec(*copy._params); _x = copy._x; _enc = 0; } DSAPrivateKeyImpl::DSAPrivateKeyImpl(const DSAParams& params, const BigInteger& x) : _x(x) { _params = new DSAParameterSpec(params.getP(), params.getQ(), params.getG()); _enc = 0; } DSAPrivateKeyImpl::DSAPrivateKeyImpl(const dsaparam& params, const mpnumber& x) : _x(x) { _params = new DSAParameterSpec(BigInteger(params.p), BigInteger(params.q), BigInteger(params.g)); _enc = 0; } DSAPrivateKeyImpl::DSAPrivateKeyImpl(const BigInteger& p, const BigInteger& q, const BigInteger& g, const BigInteger& x) : _x(x) { _params = new DSAParameterSpec(p, q, g); _enc = 0; } DSAPrivateKeyImpl::~DSAPrivateKeyImpl() { delete _params; delete _enc; } DSAPrivateKeyImpl* DSAPrivateKeyImpl::clone() const throw () { return new DSAPrivateKeyImpl(*this); } bool DSAPrivateKeyImpl::equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const DSAPrivateKey* pri = dynamic_cast(obj); if (pri) { if (pri->getParams().getP() != _params->getP()) return false; if (pri->getParams().getQ() != _params->getQ()) return false; if (pri->getParams().getG() != _params->getG()) return false; if (pri->getX() != _x) return false; return true; } } return false; } const DSAParams& DSAPrivateKeyImpl::getParams() const throw () { return *_params; } const BigInteger& DSAPrivateKeyImpl::getX() const throw () { return _x; } const bytearray* DSAPrivateKeyImpl::getEncoded() const throw () { if (!_enc) { try { ByteArrayOutputStream bos; BeeOutputStream bee(bos); bee.writeBigInteger(_params->getP()); bee.writeBigInteger(_params->getQ()); bee.writeBigInteger(_params->getG()); bee.writeBigInteger(_x); bee.close(); _enc = bos.toByteArray(); } catch (IOException&) { } } return _enc; } const String& DSAPrivateKeyImpl::getAlgorithm() const throw () { return ALGORITHM_DSA; } const String* DSAPrivateKeyImpl::getFormat() const throw () { return &FORMAT_BEE; } beecrypt-4.2.1/c++/provider/DSAPublicKeyImpl.cxx0000664000175000001440000000662610205372022016244 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DSAPublicKeyImpl.h" #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/beeyond/BeeOutputStream.h" using beecrypt::beeyond::BeeOutputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_DSA("DSA"); } DSAPublicKeyImpl::DSAPublicKeyImpl(const DSAPublicKey& copy) { _params = new DSAParameterSpec(copy.getParams()); _y = copy.getY(); _enc = 0; } DSAPublicKeyImpl::DSAPublicKeyImpl(const DSAPublicKeyImpl& copy) : _y(copy._y) { _params = new DSAParameterSpec(*copy._params); _enc = 0; } DSAPublicKeyImpl::DSAPublicKeyImpl(const DSAParams& params, const BigInteger& y) : _y(y) { _params = new DSAParameterSpec(params.getP(), params.getQ(), params.getG()); _enc = 0; } DSAPublicKeyImpl::DSAPublicKeyImpl(const dsaparam& params, const mpnumber& y) : _y(y) { _params = new DSAParameterSpec(BigInteger(params.p), BigInteger(params.q), BigInteger(params.g)); _enc = 0; } DSAPublicKeyImpl::DSAPublicKeyImpl(const BigInteger& p, const BigInteger& q, const BigInteger& g, const BigInteger& y) { _params = new DSAParameterSpec(p, q, g); _y = y; _enc = 0; } DSAPublicKeyImpl::~DSAPublicKeyImpl() { delete _params; delete _enc; } DSAPublicKeyImpl* DSAPublicKeyImpl::clone() const throw () { return new DSAPublicKeyImpl(*this); } bool DSAPublicKeyImpl::equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const DSAPublicKey* pub = dynamic_cast(obj); if (pub) { if (pub->getParams().getP() != _params->getP()) return false; if (pub->getParams().getQ() != _params->getQ()) return false; if (pub->getParams().getG() != _params->getG()) return false; if (pub->getY() != _y) return false; return true; } } return false; } const DSAParams& DSAPublicKeyImpl::getParams() const throw () { return *_params; } const BigInteger& DSAPublicKeyImpl::getY() const throw () { return _y; } const bytearray* DSAPublicKeyImpl::getEncoded() const throw () { if (!_enc) { try { ByteArrayOutputStream bos; BeeOutputStream bee(bos); bee.writeBigInteger(_params->getP()); bee.writeBigInteger(_params->getQ()); bee.writeBigInteger(_params->getG()); bee.writeBigInteger(_y); bee.close(); _enc = bos.toByteArray(); } catch (IOException&) { } } return _enc; } const String& DSAPublicKeyImpl::getAlgorithm() const throw () { return ALGORITHM_DSA; } const String* DSAPublicKeyImpl::getFormat() const throw () { return &FORMAT_BEE; } beecrypt-4.2.1/c++/provider/HMACSHA384.cxx0000664000175000001440000000225510302132362014477 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha384.h" #include "beecrypt/c++/provider/HMACSHA384.h" using namespace beecrypt::provider; HMACSHA384::HMACSHA384() : HMAC(hmacsha384, sha384) { } HMACSHA384* HMACSHA384::clone() const throw () { HMACSHA384* result = new HMACSHA384(); memcpy(result->_ctxt.param, _ctxt.param, _ctxt.algo->paramsize); return result; } beecrypt-4.2.1/c++/provider/SHA384withRSASignature.cxx0000664000175000001440000000203710200715215017171 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/SHA384withRSASignature.h" #include "beecrypt/sha384.h" using namespace beecrypt::provider; SHA384withRSASignature::SHA384withRSASignature() : PKCS1RSASignature(&sha384) { } beecrypt-4.2.1/c++/provider/SHA1withDSASignature.cxx0000664000175000001440000002234410205353501017001 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/adapter.h" #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/provider/SHA1withDSASignature.h" #include "beecrypt/c++/security/interfaces/DSAPrivateKey.h" using beecrypt::security::interfaces::DSAPrivateKey; #include "beecrypt/c++/security/interfaces/DSAPublicKey.h" using beecrypt::security::interfaces::DSAPublicKey; namespace { const byte TAG_SEQUENCE = 0x30; const byte TAG_INTEGER = 0x02; typedef int asn1error; const asn1error DER_NOT_ENOUGH_DATA = -1; const asn1error DER_IMPLICIT_TAG_LENGTH = -2; const asn1error DER_TAG_TOO_LONG = -3; const asn1error DER_FORMAT_ERROR = -4; const asn1error DER_CONVERSION_ERROR = -5; /* compute the size of a DER length encoding */ int asn1_der_length(int length) throw () { if (length < 0x80) return 1; if (length < 0x100) return 2; if (length < 0x10000) return 3; if (length < 0x1000000) return 4; else return 5; } int asn1_der_length_of(const mpnumber& n) throw () { int sigbits = mpbits(n.size, n.data); return ((sigbits + 7) >> 3) + (((sigbits & 7) == 0) ? 1 : 0); } int asn1_der_length_of_rssig(const mpnumber& r, const mpnumber& s) throw () { int intlen, seqlen = 0; intlen = asn1_der_length_of(r); seqlen += 1 + asn1_der_length(intlen) + intlen; intlen = asn1_der_length_of(s); seqlen += 1 + asn1_der_length(intlen) + intlen; return 1 + asn1_der_length(seqlen) + seqlen; } int asn1_der_encode_length(byte* data, int length) throw () { if (length < 0x80) { data[0] = (byte) length; return 1; } else if (length < 0x100) { data[0] = (byte) 0x81; data[1] = (byte) length; return 2; } else if (length < 0x10000) { data[0] = (byte) 0x82; data[1] = (byte) (length >> 8); data[2] = (byte) (length ); return 3; } else if (length < 0x1000000) { data[0] = (byte) 0x83; data[1] = (byte) (length >> 16); data[2] = (byte) (length >> 8); data[3] = (byte) (length ); return 4; } else { data[0] = (byte) 0x84; data[1] = (byte) (length >> 24); data[2] = (byte) (length >> 16); data[3] = (byte) (length >> 8); data[4] = (byte) (length ); return 5; } } int asn1_der_decode_length(const byte* data, int size, int* length) throw (asn1error) { int length_bytes; byte tmp; if (size == 0) throw DER_NOT_ENOUGH_DATA; tmp = *(data++); if (tmp < 0x80) { *length = tmp; length_bytes = 0; } else { byte length_bytes = tmp & 0x7f; if (length_bytes == 0) throw DER_IMPLICIT_TAG_LENGTH; if (length_bytes >= size) throw DER_NOT_ENOUGH_DATA; if (length_bytes > sizeof(int)) throw DER_TAG_TOO_LONG; int temp = 0; for (byte i = 0; i < length_bytes; i++) { tmp = *(data++); temp <<= 8; temp += tmp; } *length = temp; } return 1 + length_bytes; } int asn1_der_encode(byte* data, const mpnumber& n) throw () { int offset = 1, length = asn1_der_length_of(n); data[0] = TAG_INTEGER; offset += asn1_der_encode_length(data+offset, length); i2osp(data+offset, length, n.data, n.size); offset += length; return offset; } int asn1_der_decode(const byte* data, int size, mpnumber& n) throw (asn1error) { int length, offset = 1; if (size < 2) throw DER_NOT_ENOUGH_DATA; if (data[0] != TAG_INTEGER) throw DER_FORMAT_ERROR; offset += asn1_der_decode_length(data+offset, size-offset, &length); if (length > (size-offset)) throw DER_NOT_ENOUGH_DATA; if (mpnsetbin(&n, data+offset, length)) throw DER_CONVERSION_ERROR; offset += length; return offset; } int asn1_der_encode_rssig(byte* data, const mpnumber& r, const mpnumber& s) throw () { int intlen, seqlen = 0; intlen = asn1_der_length_of(r); seqlen += 1 + asn1_der_length(intlen) + intlen; intlen = asn1_der_length_of(s); seqlen += 1 + asn1_der_length(intlen) + intlen; *(data++) = TAG_SEQUENCE; data += asn1_der_encode_length(data, seqlen); data += asn1_der_encode(data, r); data += asn1_der_encode(data, s); return 1 + asn1_der_length(seqlen) + seqlen; } int asn1_der_decode_rssig(const byte* data, int size, mpnumber& r, mpnumber& s) throw (asn1error) { int tmp, length, offset = 1; if (size < 2) throw DER_NOT_ENOUGH_DATA; if (data[0] != TAG_SEQUENCE) throw DER_FORMAT_ERROR; offset += asn1_der_decode_length(data+offset, size-offset, &length); if (length > (size-offset)) throw DER_NOT_ENOUGH_DATA; tmp = asn1_der_decode(data+offset, length, r); offset += tmp; length -= tmp; tmp = asn1_der_decode(data+offset, length, s); offset += tmp; length -= tmp; if (length > 0) throw DER_FORMAT_ERROR; return offset; } } using namespace beecrypt::provider; SHA1withDSASignature::SHA1withDSASignature() { } AlgorithmParameters* SHA1withDSASignature::engineGetParameters() const { return 0; } void SHA1withDSASignature::engineSetParameter(const AlgorithmParameterSpec& spec) throw (InvalidAlgorithmParameterException) { throw InvalidAlgorithmParameterException("not supported for this algorithm"); } void SHA1withDSASignature::engineInitSign(const PrivateKey& key, SecureRandom* random) throw (InvalidKeyException) { const DSAPrivateKey* dsa = dynamic_cast(&key); if (dsa) { /* copy key information */ transform(_params.p, dsa->getParams().getP()); transform(_params.q, dsa->getParams().getQ()); transform(_params.g, dsa->getParams().getG()); transform(_x, dsa->getX()); /* reset the hash function */ sha1Reset(&_sp); _srng = random; } else throw InvalidKeyException("key must be a DSAPrivateKey"); } void SHA1withDSASignature::engineInitVerify(const PublicKey& key) throw (InvalidKeyException) { const DSAPublicKey* dsa = dynamic_cast(&key); if (dsa) { /* copy key information */ transform(_params.p, dsa->getParams().getP()); transform(_params.q, dsa->getParams().getQ()); transform(_params.g, dsa->getParams().getG()); transform(_y, dsa->getY()); /* reset the hash function */ sha1Reset(&_sp); _srng = 0; } else throw InvalidKeyException("key must be a DSAPrivateKey"); } void SHA1withDSASignature::engineUpdate(byte b) { sha1Update(&_sp, &b, 1); } void SHA1withDSASignature::engineUpdate(const byte* data, int offset, int len) { sha1Update(&_sp, data+offset, len); } void SHA1withDSASignature::rawsign(mpnumber& r, mpnumber& s) throw (SignatureException) { mpnumber hm; byte digest[20]; sha1Digest(&_sp, digest); mpnsetbin(&hm, digest, 20); if (_srng) { randomGeneratorContextAdapter rngc(_srng); if (dsasign(&_params.p, &_params.q, &_params.g, &rngc, &hm, &_x, &r, &s)) throw SignatureException("internal error in dsasign function"); } else { randomGeneratorContext rngc(randomGeneratorDefault()); if (dsasign(&_params.p, &_params.q, &_params.g, &rngc, &hm, &_x, &r, &s)) throw SignatureException("internal error in dsasign function"); } } bool SHA1withDSASignature::rawvrfy(const mpnumber& r, const mpnumber& s) throw () { mpnumber hm; byte digest[20]; sha1Digest(&_sp, digest); mpnsetbin(&hm, digest, 20); return dsavrfy(&_params.p, &_params.q, &_params.g, &hm, &_y, &r, &s); } bytearray* SHA1withDSASignature::engineSign() throw (SignatureException) { mpnumber r, s; rawsign(r, s); bytearray* signature = new bytearray(asn1_der_length_of_rssig(r, s)); asn1_der_encode_rssig(signature->data(), r, s); return signature; } int SHA1withDSASignature::engineSign(byte* signature, int offset, int len) throw (ShortBufferException, SignatureException) { if (!signature) throw NullPointerException(); mpnumber r, s; rawsign(r, s); if (asn1_der_length_of_rssig(r, s) > (len - offset)) throw ShortBufferException(); return asn1_der_encode_rssig(signature+offset, r, s); } int SHA1withDSASignature::engineSign(bytearray& signature) throw (SignatureException) { mpnumber r, s; rawsign(r, s); signature.resize(asn1_der_length_of_rssig(r, s)); return asn1_der_encode_rssig(signature.data(), r, s); } bool SHA1withDSASignature::engineVerify(const byte* signature, int offset, int len) throw (SignatureException) { if (!signature) throw NullPointerException(); mpnumber r, s; try { asn1_der_decode_rssig(signature+offset, len-offset, r, s); } catch (asn1error&) { throw SignatureException("invalid signature"); } return rawvrfy(r, s); } beecrypt-4.2.1/c++/provider/DSAKeyFactory.cxx0000664000175000001440000001272410205372222015611 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DSAKeyFactory.h" #include "beecrypt/c++/provider/DSAPrivateKeyImpl.h" #include "beecrypt/c++/provider/DSAPublicKeyImpl.h" #include "beecrypt/c++/io/ByteArrayInputStream.h" using beecrypt::io::ByteArrayInputStream; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; #include "beecrypt/c++/security/spec/DSAPrivateKeySpec.h" using beecrypt::security::spec::DSAPrivateKeySpec; #include "beecrypt/c++/security/spec/DSAPublicKeySpec.h" using beecrypt::security::spec::DSAPublicKeySpec; #include "beecrypt/c++/beeyond/AnyEncodedKeySpec.h" using beecrypt::beeyond::AnyEncodedKeySpec; #include "beecrypt/c++/beeyond/BeeInputStream.h" using beecrypt::beeyond::BeeInputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_DSA("DSA"); DSAPrivateKey* generatePrivate(const bytearray& enc) { try { ByteArrayInputStream bis(enc); BeeInputStream bee(bis); BigInteger p, q, g, x; p = bee.readBigInteger(); q = bee.readBigInteger(); g = bee.readBigInteger(); x = bee.readBigInteger(); return new DSAPrivateKeyImpl(p, q, g, x); } catch (IOException&) { } return 0; } DSAPublicKey* generatePublic(const bytearray& enc) { try { ByteArrayInputStream bis(enc); BeeInputStream bee(bis); BigInteger p, q, g, y; p = bee.readBigInteger(); q = bee.readBigInteger(); g = bee.readBigInteger(); y = bee.readBigInteger(); return new DSAPublicKeyImpl(p, q, g, y); } catch (IOException&) { } return 0; } } DSAKeyFactory::DSAKeyFactory() { } PrivateKey* DSAKeyFactory::engineGeneratePrivate(const KeySpec& spec) throw (InvalidKeySpecException) { const DSAPrivateKeySpec* dsa = dynamic_cast(&spec); if (dsa) { return new DSAPrivateKeyImpl(dsa->getP(), dsa->getQ(), dsa->getG(), dsa->getX()); } const EncodedKeySpec* enc = dynamic_cast(&spec); if (enc) { if (enc->getFormat().equals(FORMAT_BEE)) { DSAPrivateKey* pri = generatePrivate(enc->getEncoded()); if (pri) return pri; throw InvalidKeySpecException("Invalid KeySpec encoding"); } throw InvalidKeySpecException("Unsupported KeySpec format"); } throw InvalidKeySpecException("Unsupported KeySpec type"); } PublicKey* DSAKeyFactory::engineGeneratePublic(const KeySpec& spec) throw (InvalidKeySpecException) { const DSAPublicKeySpec* dsa = dynamic_cast(&spec); if (dsa) { return new DSAPublicKeyImpl(dsa->getP(), dsa->getQ(), dsa->getG(), dsa->getY()); } const EncodedKeySpec* enc = dynamic_cast(&spec); if (enc) { if (enc->getFormat().equals(FORMAT_BEE)) { DSAPublicKey* pub = generatePublic(enc->getEncoded()); if (pub) return pub; throw InvalidKeySpecException("Invalid KeySpec encoding"); } throw InvalidKeySpecException("Unsupported KeySpec format"); } throw InvalidKeySpecException("Unsupported KeySpec type"); } KeySpec* DSAKeyFactory::engineGetKeySpec(const Key& key, const type_info& info) throw (InvalidKeySpecException) { const DSAPublicKey* pub = dynamic_cast(&key); if (pub) { if (info == typeid(KeySpec) || info == typeid(DSAPublicKeySpec)) { const DSAParams& params = pub->getParams(); return new DSAPublicKeySpec(pub->getY(), params.getP(), params.getQ(), params.getG()); } if (info == typeid(EncodedKeySpec)) { const String* format = pub->getFormat(); if (format) { const bytearray* enc = pub->getEncoded(); if (enc) return new AnyEncodedKeySpec(*format, *enc); } } throw InvalidKeySpecException("Unsupported KeySpec type"); } const DSAPrivateKey* pri = dynamic_cast(&key); if (pri) { if (info == typeid(KeySpec) || info == typeid(DSAPrivateKeySpec)) { const DSAParams& params = pri->getParams(); return new DSAPrivateKeySpec(pri->getX(), params.getP(), params.getQ(), params.getG()); } if (info == typeid(EncodedKeySpec)) { const String* format = pri->getFormat(); if (format) { const bytearray* enc = pri->getEncoded(); if (enc) return new AnyEncodedKeySpec(*format, *enc); } } throw InvalidKeySpecException("Unsupported KeySpec type"); } throw InvalidKeySpecException("Unsupported Key type"); } Key* DSAKeyFactory::engineTranslateKey(const Key& key) throw (InvalidKeyException) { const DSAPublicKey* pub = dynamic_cast(&key); if (pub) return new DSAPublicKeyImpl(*pub); const DSAPrivateKey* pri = dynamic_cast(&key); if (pri) return new DSAPrivateKeyImpl(*pri); throw InvalidKeyException("Unsupported Key type"); } beecrypt-4.2.1/c++/provider/SHA512Digest.cxx0000664000175000001440000000472510302132315015201 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include "beecrypt/c++/provider/SHA512Digest.h" using namespace beecrypt::provider; SHA512Digest::SHA512Digest() : _digest(64) { if (sha512Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha512Reset"); } SHA512Digest::~SHA512Digest() { } SHA512Digest* SHA512Digest::clone() const throw () { SHA512Digest* result = new SHA512Digest(); memcpy(&result->_param, &_param, sizeof(sha512Param)); return result; } const bytearray& SHA512Digest::engineDigest() { if (sha512Digest(&_param, _digest.data())) throw ProviderException("BeeCrypt internal error in sha512Digest"); return _digest; } int SHA512Digest::engineDigest(byte* data, int offset, int length) throw (ShortBufferException) { if (!data) throw NullPointerException(); if (length < 64) throw ShortBufferException(); if (sha512Digest(&_param, data)) throw ProviderException("BeeCrypt internal error in sha512Digest"); return 64; } int SHA512Digest::engineGetDigestLength() { return 64; } void SHA512Digest::engineReset() { if (sha512Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha512Reset"); } void SHA512Digest::engineUpdate(byte b) { if (sha512Update(&_param, &b, 1)) throw ProviderException("BeeCrypt internal error in sha512Digest"); } void SHA512Digest::engineUpdate(const byte* data, int offset, int length) { if (sha512Update(&_param, data+offset, length)) throw ProviderException("BeeCrypt internal error in sha512Digest"); } beecrypt-4.2.1/c++/provider/HMACSHA1.cxx0000664000175000001440000000223110302132355014315 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha1.h" #include "beecrypt/c++/provider/HMACSHA1.h" using namespace beecrypt::provider; HMACSHA1::HMACSHA1() : HMAC(hmacsha1, sha1) { } HMACSHA1* HMACSHA1::clone() const throw () { HMACSHA1* result = new HMACSHA1(); memcpy(result->_ctxt.param, _ctxt.param, _ctxt.algo->paramsize); return result; } beecrypt-4.2.1/c++/provider/KeyProtector.cxx0000664000175000001440000001655610302133214015634 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/beecrypt.h" #include "beecrypt/aes.h" #include "beecrypt/blockmode.h" #include "beecrypt/blockpad.h" #include "beecrypt/hmacsha256.h" #include "beecrypt/pkcs12.h" #include "beecrypt/sha256.h" #include "beecrypt/c++/provider/KeyProtector.h" #include "beecrypt/c++/beeyond/AnyEncodedKeySpec.h" using beecrypt::beeyond::AnyEncodedKeySpec; #include "beecrypt/c++/crypto/BadPaddingException.h" using beecrypt::crypto::BadPaddingException; #include "beecrypt/c++/io/ByteArrayInputStream.h" using beecrypt::io::ByteArrayInputStream; #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/io/DataInputStream.h" using beecrypt::io::DataInputStream; #include "beecrypt/c++/io/DataOutputStream.h" using beecrypt::io::DataOutputStream; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; #include using std::auto_ptr; using namespace beecrypt::provider; namespace { /* eventually these will be moved to a different location */ void pkcs5_pad(int blockbytes, bytearray& b) { int unpadded_size = b.size(); byte padvalue = blockbytes - (unpadded_size % blockbytes); b.resize(unpadded_size + padvalue); memset(b.data() + unpadded_size, padvalue, padvalue); } void pkcs5_unpad(int blockbytes, bytearray& b) throw (BadPaddingException) { byte padvalue = b[b.size() - 1]; if (padvalue > blockbytes) throw BadPaddingException(); for (int i = (b.size() - padvalue); i < (b.size() - 1); i++) if (b[i] != padvalue) throw BadPaddingException(); b.resize(b.size() - padvalue); } } KeyProtector::KeyProtector(PBEKey& key) throw (InvalidKeyException) { bytearray _rawk, _salt; int _iter; if (key.getEncoded()) _rawk = *(key.getEncoded()); else throw InvalidKeyException("PBEKey must have an encoding"); if (key.getSalt()) _salt = *(key.getSalt()); _iter = key.getIterationCount(); if (pkcs12_derive_key(&sha256, PKCS12_ID_CIPHER, _rawk.data(), _rawk.size(), _salt.data(), _salt.size(), _iter, _cipher_key, 32)) throw InvalidKeyException("pkcs12_derive_key returned error"); if (pkcs12_derive_key(&sha256, PKCS12_ID_MAC, _rawk.data(), _rawk.size(), _salt.data(), _salt.size(), _iter, _mac_key, 32)) throw InvalidKeyException("pkcs12_derive_key returned error"); if (pkcs12_derive_key(&sha256, PKCS12_ID_IV, _rawk.data(), _rawk.size(), _salt.data(), _salt.size(), _iter, _iv, 16)) throw InvalidKeyException("pkcs12_derive_key returned error"); } KeyProtector::~KeyProtector() throw () { // wipe everything memset(_cipher_key, 0, 32); memset(_mac_key, 0, 32); memset(_iv, 0, 16); } bytearray* KeyProtector::protect(const PrivateKey& pri) throw () { if (!pri.getEncoded()) return 0; if (!pri.getFormat()) return 0; /* Eventually we'll substitute this with the following construction: * DataOutputStream(CipherOutputStream(ByteArrayOutputStream))) */ ByteArrayOutputStream bos; DataOutputStream dos(bos); try { const bytearray* encoded_key = pri.getEncoded(); dos.writeUTF(pri.getAlgorithm()); dos.writeUTF(*pri.getFormat()); dos.writeInt(encoded_key->size()); dos.write(*encoded_key); dos.close(); bytearray cleartext, ciphertext, mac(hmacsha256.digestsize); bos.toByteArray(cleartext); // Compute the MAC before padding keyedHashFunctionContext mc(&hmacsha256); keyedHashFunctionContextSetup(&mc, _mac_key, 256); keyedHashFunctionContextUpdate(&mc, cleartext.data(), cleartext.size()); keyedHashFunctionContextDigest(&mc, mac.data()); // Pad the cleartext pkcs5_pad(aes.blocksize, cleartext); // Set the ciphertext size equal to the cleartext size ciphertext.resize(cleartext.size()); // Encrypt the cleartext blockCipherContext bc(&aes); blockCipherContextSetup(&bc, _cipher_key, 256, ENCRYPT); blockCipherContextSetIV(&bc, _iv); blockCipherContextCBC(&bc, (uint32_t*) ciphertext.data(), (const uint32_t*) cleartext.data(), cleartext.size() / 16); // Return the concatenation of the two bytearrays return new bytearray(ciphertext + mac); } catch (IOException&) { } return 0; } PrivateKey* KeyProtector::recover(const byte* data, int size) throw (NoSuchAlgorithmException, UnrecoverableKeyException) { // If we don't have at least enough data for the digest then bail out if (size <= hmacsha256.digestsize) throw UnrecoverableKeyException("encrypted key data way too short"); int ciphertext_size = size - hmacsha256.digestsize; // Check if we have a whole number of blocks in the data if ((ciphertext_size % aes.blocksize) != 0) throw UnrecoverableKeyException("encrypted key data is not a whole number of blocks"); bytearray ciphertext(data, ciphertext_size), cleartext(ciphertext_size); // Decrypt the ciphertext blockCipherContext bc(&aes); blockCipherContextSetup(&bc, _cipher_key, 256, DECRYPT); blockCipherContextSetIV(&bc, _iv); blockCipherContextCBC(&bc, (uint32_t*) cleartext.data(), (const uint32_t*) ciphertext.data(), ciphertext_size / 16); try { pkcs5_unpad(aes.blocksize, cleartext); } catch (BadPaddingException&) { // Corrupted data, most likely due to bad password throw UnrecoverableKeyException("bad padding"); } bytearray mac(hmacsha256.digestsize); // Verify the MAC before recovering the key keyedHashFunctionContext mc(&hmacsha256); keyedHashFunctionContextSetup(&mc, _mac_key, 256); keyedHashFunctionContextUpdate(&mc, cleartext.data(), cleartext.size()); keyedHashFunctionContextDigest(&mc, mac.data()); // Compare the two MACs and bail out if they're different if (memcmp(data + ciphertext_size, mac.data(), hmacsha256.digestsize)) throw UnrecoverableKeyException("mac of decrypted key didn't match"); // Now we're sure the password was correct, and we have the decrypted data ByteArrayInputStream bis(cleartext); DataInputStream dis(bis); try { String algorithm = dis.readUTF(); String format = dis.readUTF(); jint encsize = dis.readInt(); if (encsize <= 0) throw IOException(); bytearray enc(encsize); dis.readFully(enc); AnyEncodedKeySpec spec(format, enc); try { auto_ptr kf(KeyFactory::getInstance(algorithm)); return kf->generatePrivate(spec); } catch (InvalidKeySpecException&) { } catch (NoSuchAlgorithmException&) { } } catch (IOException&) { } throw UnrecoverableKeyException("parsing error in decrypted key"); } PrivateKey* KeyProtector::recover(const bytearray& b) throw (NoSuchAlgorithmException, UnrecoverableKeyException) { return recover(b.data(), b.size()); } beecrypt-4.2.1/c++/provider/RSAPrivateCrtKeyImpl.cxx0000664000175000001440000000764410205364503017135 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/RSAPrivateCrtKeyImpl.h" #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/beeyond/BeeOutputStream.h" using beecrypt::beeyond::BeeOutputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_RSA("RSA"); } RSAPrivateCrtKeyImpl::RSAPrivateCrtKeyImpl(const RSAPrivateCrtKey& copy) : _n(copy.getModulus()), _e(copy.getPublicExponent()), _d(copy.getPrivateExponent()), _p(copy.getPrimeP()), _q(copy.getPrimeQ()), _dp(copy.getPrimeExponentP()), _dq(copy.getPrimeExponentQ()), _qi(copy.getCrtCoefficient()) { _enc = 0; } RSAPrivateCrtKeyImpl::RSAPrivateCrtKeyImpl(const RSAPrivateCrtKeyImpl& copy) : _n(copy._n), _e(copy._e), _d(copy._d), _p(copy._p), _q(copy._q), _dp(copy._dp), _dq(copy._dq), _qi(copy._qi) { _enc = 0; } RSAPrivateCrtKeyImpl::RSAPrivateCrtKeyImpl(const BigInteger& n, const BigInteger& e, const BigInteger& d, const BigInteger& p, const BigInteger& q, const BigInteger& dp, const BigInteger& dq, const BigInteger& qi) : _n(n), _e(e), _d(d), _p(p), _q(q), _dp(dp), _dq(dq), _qi(qi) { _enc = 0; } RSAPrivateCrtKeyImpl::~RSAPrivateCrtKeyImpl() { delete _enc; } bool RSAPrivateCrtKeyImpl::equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const RSAPrivateKey* pri = dynamic_cast(obj); if (pri) { if (pri->getModulus() != _n) return false; if (pri->getPrivateExponent() != _d) return false; return true; } } return false; } RSAPrivateCrtKeyImpl* RSAPrivateCrtKeyImpl::clone() const throw () { return new RSAPrivateCrtKeyImpl(*this); } const BigInteger& RSAPrivateCrtKeyImpl::getModulus() const throw () { return _n; } const BigInteger& RSAPrivateCrtKeyImpl::getPrivateExponent() const throw () { return _d; } const BigInteger& RSAPrivateCrtKeyImpl::getPublicExponent() const throw () { return _e; } const BigInteger& RSAPrivateCrtKeyImpl::getPrimeP() const throw () { return _p; } const BigInteger& RSAPrivateCrtKeyImpl::getPrimeQ() const throw () { return _q; } const BigInteger& RSAPrivateCrtKeyImpl::getPrimeExponentP() const throw () { return _dp; } const BigInteger& RSAPrivateCrtKeyImpl::getPrimeExponentQ() const throw () { return _dq; } const BigInteger& RSAPrivateCrtKeyImpl::getCrtCoefficient() const throw () { return _qi; } const bytearray* RSAPrivateCrtKeyImpl::getEncoded() const throw () { if (!_enc) { try { ByteArrayOutputStream bos; BeeOutputStream bee(bos); bee.writeBigInteger(_n); bee.writeBigInteger(_d); bee.writeBigInteger(_e); bee.writeBigInteger(_p); bee.writeBigInteger(_q); bee.writeBigInteger(_dp); bee.writeBigInteger(_dq); bee.writeBigInteger(_qi); bee.close(); _enc = bos.toByteArray(); } catch (IOException&) { } } return _enc; } const String& RSAPrivateCrtKeyImpl::getAlgorithm() const throw () { return ALGORITHM_RSA; } const String* RSAPrivateCrtKeyImpl::getFormat() const throw () { return &FORMAT_BEE; } beecrypt-4.2.1/c++/provider/PKCS1RSASignature.cxx0000664000175000001440000001242010205371706016251 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/provider/PKCS1RSASignature.h" #include "beecrypt/c++/security/interfaces/RSAPrivateKey.h" using beecrypt::security::interfaces::RSAPrivateKey; #include "beecrypt/c++/security/interfaces/RSAPrivateCrtKey.h" using beecrypt::security::interfaces::RSAPrivateCrtKey; #include "beecrypt/c++/security/interfaces/RSAPublicKey.h" using beecrypt::security::interfaces::RSAPublicKey; #include "beecrypt/pkcs1.h" using namespace beecrypt::provider; PKCS1RSASignature::PKCS1RSASignature(const hashFunction* hf) : _hfc(hf) { } AlgorithmParameters* PKCS1RSASignature::engineGetParameters() const { return 0; } void PKCS1RSASignature::engineSetParameter(const AlgorithmParameterSpec& spec) throw (InvalidAlgorithmParameterException) { throw InvalidAlgorithmParameterException("unsupported for this algorithm"); } void PKCS1RSASignature::engineInitSign(const PrivateKey& key, SecureRandom* random) throw (InvalidKeyException) { const RSAPrivateKey* rsa = dynamic_cast(&key); if (rsa) { /* copy key information */ transform(_pair.n, rsa->getModulus()); transform(_pair.d, rsa->getPrivateExponent()); const RSAPrivateCrtKey* crt = dynamic_cast(rsa); if (crt) { transform(_pair.p, crt->getPrimeP()); transform(_pair.q, crt->getPrimeQ()); transform(_pair.dp, crt->getPrimeExponentP()); transform(_pair.dq, crt->getPrimeExponentQ()); transform(_pair.qi, crt->getCrtCoefficient()); _crt = true; } else _crt = false; /* reset the hash function */ hashFunctionContextReset(&_hfc); _srng = random; } else throw InvalidKeyException("key must be a RSAPrivateKey"); } void PKCS1RSASignature::engineInitVerify(const PublicKey& key) throw (InvalidKeyException) { const RSAPublicKey* rsa = dynamic_cast(&key); if (rsa) { /* copy key information */ transform(_pair.n, rsa->getModulus()); transform(_pair.e, rsa->getPublicExponent()); /* reset the hash function */ hashFunctionContextReset(&_hfc); _srng = 0; } else throw InvalidKeyException("key must be a RSAPrivateKey"); } void PKCS1RSASignature::engineUpdate(byte b) { hashFunctionContextUpdate(&_hfc, &b, 1); } void PKCS1RSASignature::engineUpdate(const byte* data, int offset, int len) { hashFunctionContextUpdate(&_hfc, data+offset, len); } bytearray* PKCS1RSASignature::engineSign() throw (SignatureException) { int sigsize = (_pair.n.bitlength()+7) >> 3; bytearray* signature = new bytearray(sigsize); engineSign(signature->data(), 0, signature->size()); return signature; } int PKCS1RSASignature::engineSign(byte* signature, int offset, int len) throw (ShortBufferException, SignatureException) { if (!signature) throw NullPointerException(); int sigsize = (_pair.n.bitlength()+7) >> 3; /* test if we have enough space in output buffer */ if (sigsize > (len - offset)) throw ShortBufferException(); /* okay, we can continue */ mpnumber c, m; bytearray em(sigsize); if (pkcs1_emsa_encode_digest(&_hfc, em.data(), em.size())) throw SignatureException("internal error in pkcs1_emsa_encode_digest"); mpnsetbin(&c, em.data(), sigsize); if (_crt) { if (rsapricrt(&_pair.n, &_pair.p, &_pair.q, &_pair.dp, &_pair.dq, &_pair.qi, &c, &m)) throw SignatureException("internal error in rsapricrt function"); } else { if (rsapri(&_pair.n, &_pair.d, &c, &m)) throw SignatureException("internal error in rsapri function"); } if (i2osp(signature+offset, sigsize, m.data, m.size)) throw SignatureException("internal error in i2osp"); return sigsize; } int PKCS1RSASignature::engineSign(bytearray& signature) throw (SignatureException) { int sigsize = (_pair.n.bitlength()+7) >> 3; signature.resize(sigsize); return engineSign(signature.data(), 0, signature.size()); } bool PKCS1RSASignature::engineVerify(const byte* signature, int offset, int len) throw (SignatureException) { if (!signature) throw NullPointerException(); int sigsize = (_pair.n.bitlength()+7) >> 3; /* test if we have enough data in signature */ if (sigsize > (len - offset)) return false; /* okay, we can continue */ mpnumber c, m; bytearray em(sigsize); if (pkcs1_emsa_encode_digest(&_hfc, em.data(), sigsize)) throw SignatureException("internal error in pkcs1_emsa_encode_digest"); mpnsetbin(&c, em.data(), sigsize); mpnsetbin(&m, signature+offset, sigsize); return rsavrfy(&_pair.n, &_pair.e, &m, &c) > 0; } beecrypt-4.2.1/c++/provider/BeeCertPathValidator.cxx0000664000175000001440000000716410262514306017203 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeCertPath.h" using beecrypt::beeyond::BeeCertPath; #include "beecrypt/c++/beeyond/BeeCertPathParameters.h" using beecrypt::beeyond::BeeCertPathParameters; #include "beecrypt/c++/beeyond/BeeCertPathValidatorResult.h" using beecrypt::beeyond::BeeCertPathValidatorResult; #include "beecrypt/c++/provider/BeeCertPathValidator.h" using namespace beecrypt::provider; BeeCertPathValidator::~BeeCertPathValidator() { } CertPathValidatorResult* BeeCertPathValidator::engineValidate(const CertPath& path, const CertPathParameters& params) throw (CertPathValidatorException, InvalidAlgorithmParameterException) { const BeeCertPathParameters* beeparams = dynamic_cast(¶ms); if (beeparams) { const List& cert = path.getCertificates(); const List& root = beeparams->getTrustedCertificates(); for (int i = 0; i < cert.size(); i++) { const BeeCertificate* beecert = dynamic_cast(cert.get(i)); if (beecert) { const BeeCertificate* tmp = beecert; while (tmp->hasParentCertificate()) { const Certificate* parent = &tmp->getParentCertificate(); try { Date created(tmp->getNotBefore()); // a certificate must be signed with its parent's public key tmp->verify(parent->getPublicKey()); // if the parent is not a BeeCertificate we can't validate tmp = dynamic_cast(parent); if (tmp) { // a certificate must have a creation date within the validity range of its parent tmp->checkValidity(created); } else throw CertPathValidatorException("Parent is not a BeeCertificate"); } catch (CertificateExpiredException&) { throw CertPathValidatorException("Parent expired before certificate was created"); } catch (CertificateNotYetValidException&) { throw CertPathValidatorException("Certificate was created before its parent"); } catch (CertPathValidatorException&) { throw; } catch (Exception& e) { // on any exception, the certificate path failed to validate throw CertPathValidatorException().initCause(e); } } // check if the final certificate we have is one of the root certificates for (int j = 0; j < root.size(); j++) { if (tmp->equals(root.get(j))) return new BeeCertPathValidatorResult(*tmp, beecert->getPublicKey()); } } else throw InvalidAlgorithmParameterException("CertPath should only contains BeeCertificate objects"); } throw CertPathValidatorException("CertPath does not lead to one of the trusted parent certificates"); } else throw InvalidAlgorithmParameterException("Invalid CertPathParameters subclass; only BeeCertPathParameters is accepted"); } beecrypt-4.2.1/c++/provider/RSAPublicKeyImpl.cxx0000664000175000001440000000524110205364445016264 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/RSAPublicKeyImpl.h" #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/beeyond/BeeOutputStream.h" using beecrypt::beeyond::BeeOutputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_RSA("RSA"); } RSAPublicKeyImpl::RSAPublicKeyImpl(const RSAPublicKey& copy) : _n(copy.getModulus()), _e(copy.getPublicExponent()) { _enc = 0; } RSAPublicKeyImpl::RSAPublicKeyImpl(const RSAPublicKeyImpl& copy) : _n(copy._n), _e(copy._e) { _enc = 0; } RSAPublicKeyImpl::RSAPublicKeyImpl(const BigInteger& n, const BigInteger& e) : _n(n), _e(e) { _enc = 0; } RSAPublicKeyImpl::~RSAPublicKeyImpl() { delete _enc; } RSAPublicKeyImpl* RSAPublicKeyImpl::clone() const throw () { return new RSAPublicKeyImpl(*this); } bool RSAPublicKeyImpl::equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const RSAPublicKey* pub = dynamic_cast(obj); if (pub) { if (pub->getModulus() != _n) return false; if (pub->getPublicExponent() != _e) return false; return true; } } return false; } const BigInteger& RSAPublicKeyImpl::getModulus() const throw () { return _n; } const BigInteger& RSAPublicKeyImpl::getPublicExponent() const throw () { return _e; } const bytearray* RSAPublicKeyImpl::getEncoded() const throw () { if (!_enc) { try { ByteArrayOutputStream bos; BeeOutputStream bee(bos); bee.writeBigInteger(_n); bee.writeBigInteger(_e); bee.close(); _enc = bos.toByteArray(); } catch (IOException&) { } } return _enc; } const String& RSAPublicKeyImpl::getAlgorithm() const throw () { return ALGORITHM_RSA; } const String* RSAPublicKeyImpl::getFormat() const throw () { return &FORMAT_BEE; } beecrypt-4.2.1/c++/provider/DHIESParameters.cxx0000664000175000001440000000504010213524775016065 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DHIESParameters.h" #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; using namespace beecrypt::provider; DHIESParameters::DHIESParameters() { _spec = 0; _dspec = 0; } DHIESParameters::~DHIESParameters() { delete _spec; delete _dspec; } const bytearray& DHIESParameters::engineGetEncoded(const String* format) throw (IOException) { throw IOException("not implemented"); } AlgorithmParameterSpec* DHIESParameters::engineGetParameterSpec(const type_info& info) throw (InvalidParameterSpecException) { if (info == typeid(DHIESDecryptParameterSpec)) { if (_dspec) return new DHIESDecryptParameterSpec(*_dspec); } else if (info == typeid(DHIESParameterSpec) || info == typeid(AlgorithmParameterSpec)) { if (_spec) return new DHIESParameterSpec(*_spec); } throw InvalidParameterSpecException(); } void DHIESParameters::engineInit(const AlgorithmParameterSpec& param) throw (InvalidParameterSpecException) { delete _spec; delete _dspec; _spec = 0; _dspec = 0; const DHIESParameterSpec* spec = dynamic_cast(¶m); if (spec) { _spec = new DHIESParameterSpec(*spec); const DHIESDecryptParameterSpec* dspec = dynamic_cast(spec); if (dspec) _dspec = new DHIESDecryptParameterSpec(*dspec); } else throw InvalidParameterSpecException("Expected a DHIESParameterSpec"); } void DHIESParameters::engineInit(const byte*, int, const String* format) { throw ProviderException("Not implemented"); } String DHIESParameters::engineToString() throw () { if (_dspec) return _dspec->toString(); if (_spec) return _spec->toString(); return String("(uninitialized)"); } beecrypt-4.2.1/c++/provider/DHPublicKeyImpl.cxx0000664000175000001440000000626410205372002016124 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DHPublicKeyImpl.h" #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/beeyond/BeeOutputStream.h" using beecrypt::beeyond::BeeOutputStream; using namespace beecrypt::provider; namespace { const String FORMAT_BEE("BEE"); const String ALGORITHM_DH("DH"); } DHPublicKeyImpl::DHPublicKeyImpl(const DHPublicKey& copy) : _y(copy.getY()) { _params = new DHParameterSpec(copy.getParams()); _enc = 0; } DHPublicKeyImpl::DHPublicKeyImpl(const DHPublicKeyImpl& copy) : _y(copy._y) { _params = new DHParameterSpec(*copy._params); _enc = 0; } DHPublicKeyImpl::DHPublicKeyImpl(const DHParams& params, const BigInteger& y) : _y(y) { _params = new DHParameterSpec(params.getP(), params.getG(), params.getL()); _enc = 0; } DHPublicKeyImpl::DHPublicKeyImpl(const dhparam& params, const mpnumber& y) : _y(y) { _params = new DHParameterSpec(BigInteger(params.p), BigInteger(params.g)); _enc = 0; } DHPublicKeyImpl::DHPublicKeyImpl(const BigInteger& p, const BigInteger& g, const BigInteger& y) : _y(y) { _params = new DHParameterSpec(p, g); _enc = 0; } DHPublicKeyImpl::~DHPublicKeyImpl() { delete _params; delete _enc; } DHPublicKeyImpl* DHPublicKeyImpl::clone() const throw () { return new DHPublicKeyImpl(*this); } bool DHPublicKeyImpl::equals(const Object* obj) const throw () { if (this == obj) return true; const DHPublicKey* pub = dynamic_cast(obj); if (pub) { if (pub->getParams().getP() != _params->getP()) return false; if (pub->getParams().getG() != _params->getG()) return false; if (pub->getY() != _y) return false; return true; } return false; } const DHParams& DHPublicKeyImpl::getParams() const throw () { return *_params; } const BigInteger& DHPublicKeyImpl::getY() const throw () { return _y; } const bytearray* DHPublicKeyImpl::getEncoded() const throw () { if (!_enc) { try { ByteArrayOutputStream bos; BeeOutputStream bee(bos); bee.writeBigInteger(_params->getP()); bee.writeBigInteger(_params->getG()); bee.writeBigInteger(_y); bee.close(); _enc = bos.toByteArray(); } catch (IOException&) { } } return _enc; } const String& DHPublicKeyImpl::getAlgorithm() const throw () { return ALGORITHM_DH; } const String* DHPublicKeyImpl::getFormat() const throw () { return &FORMAT_BEE; } beecrypt-4.2.1/c++/provider/DSAParameters.cxx0000664000175000001440000000433010202677253015637 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DSAParameters.h" #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; using namespace beecrypt::provider; DSAParameters::DSAParameters() { _spec = 0; } DSAParameters::~DSAParameters() { delete _spec; } const bytearray& DSAParameters::engineGetEncoded(const String* format) throw (IOException) { throw IOException("not implemented"); } AlgorithmParameterSpec* DSAParameters::engineGetParameterSpec(const type_info& info) throw (InvalidParameterSpecException) { if (info == typeid(AlgorithmParameterSpec) || info == typeid(DSAParameterSpec)) { if (_spec) { return new DSAParameterSpec(*_spec); } else throw InvalidParameterSpecException("not initialized"); } else throw InvalidParameterSpecException("expected a DSAParameterSpec"); } void DSAParameters::engineInit(const AlgorithmParameterSpec& spec) throw (InvalidParameterSpecException) { const DSAParameterSpec* tmp = dynamic_cast(&spec); if (tmp) { if (_spec) { delete _spec; _spec = 0; } _spec = new DSAParameterSpec(*tmp); } else throw InvalidParameterSpecException("expected a DSAParameterSpec"); } void DSAParameters::engineInit(const byte*, int, const String* format) { throw ProviderException("not implemented"); } String DSAParameters::engineToString() throw () { return String("(not implemented"); } beecrypt-4.2.1/c++/provider/DHIESCipher.cxx0000664000175000001440000002547010262514625015202 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DHIESCipher.h" #include "beecrypt/c++/provider/DHPublicKeyImpl.h" #include "beecrypt/c++/crypto/SecretKeyFactory.h" using beecrypt::crypto::SecretKeyFactory; #include "beecrypt/c++/crypto/spec/SecretKeySpec.h" using beecrypt::crypto::spec::SecretKeySpec; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include using std::auto_ptr; using namespace beecrypt::provider; DHIESCipher::DHIESCipher() { _dspec = 0; _spec = 0; _srng = 0; _kpg = 0; _ka = 0; _d = 0; _c = 0; _m = 0; _msg = 0; _buf = 0; try { _kpg = KeyPairGenerator::getInstance("DiffieHellman"); _ka = KeyAgreement::getInstance("DiffieHellman"); } catch (NoSuchAlgorithmException& e) { throw ProviderException().initCause(e); } } DHIESCipher::~DHIESCipher() { delete _dspec; delete _spec; delete _kpg; delete _ka; delete _m; delete _c; delete _d; delete _msg; } bytearray* DHIESCipher::engineDoFinal(const byte* input, int inputOffset, int inputLength) throw (IllegalBlockSizeException, BadPaddingException) { bytearray* tmp; if (_buf) { bytearray ciphertext; _buf->write(input, inputOffset, inputLength); _buf->toByteArray(ciphertext); if (_m->doFinal(ciphertext) == _dspec->getMac()) { // MAC matches; we can decrypt tmp = _c->doFinal(ciphertext); } else tmp = 0; } else { tmp = _c->doFinal(input, inputOffset, inputLength); _m->update(*tmp); _dspec = new DHIESDecryptParameterSpec(*_spec, _msg->getY(), _m->doFinal()); } reset(); return tmp; } int DHIESCipher::engineDoFinal(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException, IllegalBlockSizeException, BadPaddingException) { int tmp; if (_buf) { bytearray ciphertext; _buf->write(input, inputOffset, inputLength); _buf->toByteArray(ciphertext); if (_m->doFinal(ciphertext) == _dspec->getMac()) { // Mac matches; we can decrypt tmp = _c->doFinal(ciphertext.data(), 0, ciphertext.size(), output, outputOffset); } else tmp = 0; } else { tmp = _c->doFinal(input, inputOffset, inputLength, output, outputOffset); _m->update(output.data(), outputOffset, tmp); _dspec = new DHIESDecryptParameterSpec(*_spec, _msg->getY(), _m->doFinal()); } reset(); return tmp; } int DHIESCipher::engineGetBlockSize() const throw () { return _c->getBlockSize(); } bytearray* DHIESCipher::engineGetIV() { return _c->getIV(); } int DHIESCipher::engineGetOutputSize(int inputLength) throw () { return _c->getOutputSize(inputLength + (_buf ? _buf->size() : 0)); } AlgorithmParameters* DHIESCipher::engineGetParameters() throw () { try { auto_ptr tmp(AlgorithmParameters::getInstance("DHIES")); tmp->init(*_dspec); return tmp.release(); } catch (Exception& e) { throw ProviderException().initCause(e); } } void DHIESCipher::engineInit(int opmode, const Key& key, SecureRandom* random) throw (InvalidKeyException) { throw InvalidKeyException("DHIESCipher must be initialized with a key and parameters"); } void DHIESCipher::engineInit(int opmode, const Key& key, AlgorithmParameters* params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) { if (params) { try { auto_ptr tmp(params->getParameterSpec((opmode == Cipher::DECRYPT_MODE) ? typeid(DHIESDecryptParameterSpec) : typeid(DHIESParameterSpec))); engineInit(opmode, key, *tmp.get(), random); } catch (InvalidParameterSpecException& e) { throw InvalidAlgorithmParameterException().initCause(e); } } else engineInit(opmode, key, random); } void DHIESCipher::engineInit(int opmode, const Key& key, const AlgorithmParameterSpec& params, SecureRandom *random) throw (InvalidKeyException, InvalidAlgorithmParameterException) { const DHIESParameterSpec* spec; const DHIESDecryptParameterSpec* dspec; spec = dynamic_cast(¶ms); if (!spec) throw InvalidAlgorithmParameterException("not a DHIESParameterSpec"); if (opmode == Cipher::DECRYPT_MODE) { dspec = dynamic_cast(spec); if (!dspec) throw InvalidAlgorithmParameterException("not a DHIESParameterSpec"); } delete _spec; delete _dspec; delete _d; delete _c; delete _m; _spec = 0; _dspec = 0; _d = 0; _c = 0; _m = 0; try { _d = MessageDigest::getInstance(spec->getMessageDigestAlgorithm()); _c = Cipher::getInstance(spec->getCipherAlgorithm() + "/CBC/PKCS5Padding"); _m = Mac::getInstance(spec->getMacAlgorithm()); } catch (NoSuchAlgorithmException& e) { throw InvalidAlgorithmParameterException().initCause(e); } if (spec->getCipherKeyLength()) { int keybits = _d->getDigestLength() << 3; if (spec->getCipherKeyLength() >= keybits) throw new InvalidAlgorithmParameterException("DHIESParameterSpec invalid: cipher key length must be less than digest size"); if (spec->getMacKeyLength() >= keybits) throw new InvalidAlgorithmParameterException("DHIESParameterSpec invalid: mac key length must be less than digest size"); if (spec->getCipherKeyLength() + spec->getMacKeyLength() > keybits) throw new InvalidAlgorithmParameterException("DHIESParameterSpec invalid: sum of cipher and mac key lengths exceeds digest size"); } if (opmode == Cipher::ENCRYPT_MODE) { const DHPublicKey* pub = dynamic_cast(&key); if (pub) { _enc = pub; _dec = 0; _buf = 0; } else { std::cout << "Not a DHPublicKey; algorithm = " << key.getAlgorithm() << std::endl; throw InvalidKeyException("not a DHPublicKey"); } _spec = new DHIESParameterSpec(*spec); _dspec = 0; } else if (opmode == Cipher::DECRYPT_MODE) { const DHPrivateKey* pri = dynamic_cast(&key); if (pri) { _enc = 0; _dec = pri; _buf = new ByteArrayOutputStream(); } else throw InvalidKeyException("DHPrivateKey expected when decrypting"); _spec = new DHIESParameterSpec(*spec); _dspec = new DHIESDecryptParameterSpec(*dspec); } else throw ProviderException("unsupported opmode"); _opmode = opmode; _srng = random; reset(); } bytearray* DHIESCipher::engineUpdate(const byte* input, int inputOffset, int inputLength) { if (_buf) { _buf->write(input, inputOffset, inputLength); return 0; } else { bytearray* tmp = _c->update(input, inputOffset, inputLength); if (tmp) _m->update(*tmp); return tmp; } } int DHIESCipher::engineUpdate(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException) { if (_buf) { _buf->write(input, inputOffset, inputLength); return 0; } else { int tmp = _c->update(input, inputOffset, inputLength, output, outputOffset); if (tmp) _m->update(output.data(), outputOffset, tmp); return tmp; } } void DHIESCipher::engineSetMode(const String& mode) throw (NoSuchAlgorithmException) { throw NoSuchAlgorithmException(); } void DHIESCipher::engineSetPadding(const String& padding) throw (NoSuchPaddingException) { throw NoSuchPaddingException(); } void DHIESCipher::reset() { delete _msg; try { if (_buf) { _msg = new DHPublicKeyImpl(_dec->getParams(), _dspec->getEphemeralPublicKey()); _ka->init(*_dec, _srng); _ka->doPhase(*_msg, true); } else { // generate an ephemeral keypair _kpg->initialize(DHParameterSpec(_enc->getParams()), _srng); try { auto_ptr pair(_kpg->generateKeyPair()); _msg = new DHPublicKeyImpl(dynamic_cast(pair->getPublic())); _ka->init(pair->getPrivate(), _srng); _ka->doPhase(*_enc, true); } catch (Exception&) { throw ProviderException(); } } bytearray tmp; _msg->getY().toByteArray(tmp); _d->reset(); _d->update(tmp); _d->update(*_ka->generateSecret()); bytearray key(_d->getDigestLength()); _d->digest(key.data(), 0, key.size()); int cl = _spec->getCipherKeyLength() >> 3, ml = _spec->getMacKeyLength() >> 3; SecretKeySpec *cipherKeySpec, *macKeySpec; if (cl == 0 && ml == 0) { // both key lengths are zero; divide available key in two equal halves int half = key.size() >> 1; cipherKeySpec = new SecretKeySpec(key.data(), 0, half, "RAW"); macKeySpec = new SecretKeySpec(key.data(), half, half, "RAW"); } else if (cl == 0) { throw InvalidAlgorithmParameterException("if cipherKeyLength equals 0, then macKeyLength must also be 0"); } else if (ml == 0) { if (cl >= key.size()) throw InvalidAlgorithmParameterException("requested key size for cipher exceeds total key size"); cipherKeySpec = new SecretKeySpec(key.data(), 0, cl, "RAW"); macKeySpec = new SecretKeySpec(key.data(), cl, key.size() - cl, "RAW"); } else { if ((cl + ml) > key.size()) throw InvalidAlgorithmParameterException("requested key sizes for cipher and mac exceed total key size"); cipherKeySpec = new SecretKeySpec(key.data(), 0, cl, "RAW"); macKeySpec = new SecretKeySpec(key.data(), cl, ml, "RAW"); } try { // first try initializing the Cipher with the SecretKeySpec _c->init(_opmode, *cipherKeySpec, _srng); } catch (InvalidKeyException&) { // on failure, let's see if there's a SecretKeyFactory for the Cipher try { auto_ptr skf(SecretKeyFactory::getInstance(_c->getAlgorithm())); auto_ptr s(skf->generateSecret(*cipherKeySpec)); _c->init(_opmode, *s.get(), _srng); } catch (Exception& e) { throw InvalidKeyException().initCause(e); } } try { // first try initializing the Mac with the SecretKeySpec _m->init(*macKeySpec); } catch (InvalidKeyException&) { // on failure, let's see if there's a SecretKeyFactory for the Mac try { auto_ptr skf(SecretKeyFactory::getInstance(_m->getAlgorithm())); auto_ptr s(skf->generateSecret(*macKeySpec)); _m->init(*s.get()); } catch (Exception& e) { throw InvalidKeyException().initCause(e); } } } catch (InvalidAlgorithmParameterException& e) { throw ProviderException().initCause(e); } } beecrypt-4.2.1/c++/provider/BeeSecureRandom.cxx0000664000175000001440000000274210167732737016225 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/BeeSecureRandom.h" using namespace beecrypt::provider; BeeSecureRandom::BeeSecureRandom() { } BeeSecureRandom::BeeSecureRandom(const randomGenerator* rng) : _rngc(rng) { } BeeSecureRandom::~BeeSecureRandom() { } SecureRandomSpi* BeeSecureRandom::create() { return new BeeSecureRandom(); } void BeeSecureRandom::engineGenerateSeed(byte* data, int size) { entropyGatherNext(data, size); } void BeeSecureRandom::engineNextBytes(byte* data, int size) { randomGeneratorContextNext(&_rngc, data, size); } void BeeSecureRandom::engineSetSeed(const byte* data, int size) { randomGeneratorContextSeed(&_rngc, data, size); } beecrypt-4.2.1/c++/provider/BeeCertificateFactory.cxx0000664000175000001440000000327410262513655017401 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeCertificate.h" using beecrypt::beeyond::BeeCertificate; #include "beecrypt/c++/util/ArrayList.h" using beecrypt::util::ArrayList; #include "beecrypt/c++/provider/BeeCertificateFactory.h" using namespace beecrypt::provider; BeeCertificateFactory::BeeCertificateFactory() { } Certificate* BeeCertificateFactory::engineGenerateCertificate(InputStream& in) throw (CertificateException) { try { return new BeeCertificate(in); } catch (Exception& e) { throw CertificateException().initCause(e); } } Collection* BeeCertificateFactory::engineGenerateCertificates(InputStream& in) throw (CertificateException) { ArrayList* result = new ArrayList(); try { while (in.available()) { result->add(new BeeCertificate(in)); } } catch (...) { delete result; throw; } return result; } beecrypt-4.2.1/c++/provider/BeeKeyStore.cxx0000664000175000001440000003110010262514337015357 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/aes.h" #include "beecrypt/pkcs12.h" #include "beecrypt/sha256.h" #include "beecrypt/c++/crypto/Mac.h" using beecrypt::crypto::Mac; #include "beecrypt/c++/crypto/MacInputStream.h" using beecrypt::crypto::MacInputStream; #include "beecrypt/c++/crypto/MacOutputStream.h" using beecrypt::crypto::MacOutputStream; #include "beecrypt/c++/io/ByteArrayInputStream.h" using beecrypt::io::ByteArrayInputStream; #include "beecrypt/c++/io/DataInputStream.h" using beecrypt::io::DataInputStream; #include "beecrypt/c++/io/DataOutputStream.h" using beecrypt::io::DataOutputStream; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/security/SecureRandom.h" using beecrypt::security::SecureRandom; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include "beecrypt/c++/beeyond/BeeCertificate.h" using beecrypt::beeyond::BeeCertificate; #include "beecrypt/c++/beeyond/PKCS12PBEKey.h" using beecrypt::beeyond::PKCS12PBEKey; #include "beecrypt/c++/provider/KeyProtector.h" using beecrypt::provider::KeyProtector; #include "beecrypt/c++/provider/BeeKeyStore.h" #include using std::auto_ptr; using namespace beecrypt::provider; namespace { const array EMPTY_PASSWORD; } #define BKS_MAGIC ((jint) 0xbeecceec) #define BKS_VERSION_1 ((jint) 0x1) #define BKS_PRIVATEKEY_ENTRY ((jint) 0x1) #define BKS_CERTIFICATE_ENTRY ((jint) 0x2) BeeKeyStore::Names::Names(Hashtable& h) : _list(h.size()) { Iterator::Entry>* it = h.entrySet().iterator(); assert(it != 0); _pos = 0; while (it->hasNext()) { _list[_pos++] = new String(*it->next()->getKey()); } _pos = 0; } BeeKeyStore::Names::~Names() { for (int i = 0; i < _list.size(); i++) delete _list[i]; } bool BeeKeyStore::Names::hasMoreElements() throw () { return _pos < _list.size(); } const String* BeeKeyStore::Names::nextElement() throw (NoSuchElementException) { if (_pos >= _list.size()) throw NoSuchElementException(); return _list[_pos++]; } BeeKeyStore::KeyEntry::KeyEntry() throw () { } BeeKeyStore::KeyEntry::KeyEntry(const bytearray& b, const array& c) throw (CloneNotSupportedException) : chain(c) { encryptedkey = b; } BeeKeyStore::KeyEntry::~KeyEntry() { // delete all the certificates in the chain for (int i = 0; i < chain.size(); i++) delete chain[i]; } BeeKeyStore::CertEntry::CertEntry() throw () { cert = 0; } BeeKeyStore::CertEntry::CertEntry(const Certificate& c) throw (CloneNotSupportedException) { cert = BeeCertificate::cloneCertificate(c); } BeeKeyStore::CertEntry::~CertEntry() { delete cert; } BeeKeyStore::BeeKeyStore() { } Enumeration* BeeKeyStore::engineAliases() { return new Names(_entries); } bool BeeKeyStore::engineContainsAlias(const String& alias) { return _entries.containsKey(&alias); } void BeeKeyStore::engineDeleteEntry(const String& alias) throw (KeyStoreException) { delete _entries.remove(&alias); } const Date* BeeKeyStore::engineGetCreationDate(const String& alias) { const Date* result = 0; synchronized (this) { Entry* e = _entries.get(&alias); if (e) result = &e->date; } return result; } const Certificate* BeeKeyStore::engineGetCertificate(const String& alias) { const Certificate* result = 0; synchronized (this) { Entry* e = _entries.get(&alias); if (e) { CertEntry* ce = dynamic_cast(e); if (ce) { result = ce->cert; } else { KeyEntry* ke = dynamic_cast(e); if (ke) result = ke->chain[0]; } } } return result; } const String* BeeKeyStore::engineGetCertificateAlias(const Certificate& cert) { const String* result = 0; synchronized (this) { Iterator::Entry>* it = _entries.entrySet().iterator(); assert(it != 0); while (it->hasNext()) { class Map::Entry* e = it->next(); const CertEntry* ce = dynamic_cast(e->getValue()); if (ce) { if (cert.equals(ce->cert)) { result = e->getKey(); break; } } } delete it; } return result; } const array* BeeKeyStore::engineGetCertificateChain(const String& alias) { const array* result = 0; synchronized (this) { KeyEntry* ke = dynamic_cast(_entries.get(&alias)); if (ke) result = &ke->chain; } return result; } bool BeeKeyStore::engineIsCertificateEntry(const String& alias) { return dynamic_cast(_entries.get(&alias)) != 0; } void BeeKeyStore::engineSetCertificateEntry(const String& alias, const Certificate& cert) throw (KeyStoreException) { delete _entries.put(new String(alias), new CertEntry(cert)); } Key* BeeKeyStore::engineGetKey(const String& alias, const array& password) throw (NoSuchAlgorithmException, UnrecoverableKeyException) { Key* result = 0; synchronized (this) { Entry* e = _entries.get(&alias); if (e) { KeyEntry* ke = dynamic_cast(e); if (ke) { PKCS12PBEKey pbekey(password, &_salt, _iter); try { KeyProtector p(pbekey); result = p.recover(ke->encryptedkey); } catch (InvalidKeyException& e) { throw UnrecoverableKeyException().initCause(e); } } } } return result; } bool BeeKeyStore::engineIsKeyEntry(const String& alias) { return dynamic_cast(_entries.get(&alias)) != 0; } void BeeKeyStore::engineSetKeyEntry(const String& alias, const bytearray& key, const array& chain) throw (KeyStoreException) { delete _entries.put(new String(alias), new KeyEntry(key, chain)); } void BeeKeyStore::engineSetKeyEntry(const String& alias, const Key& key, const array& password, const array& chain) throw (KeyStoreException) { const PrivateKey* pri = dynamic_cast(&key); if (pri) { PKCS12PBEKey pbekey(password, &_salt, _iter); KeyProtector p(pbekey); bytearray* tmp = p.protect(*pri); if (tmp) { engineSetKeyEntry(alias, *tmp, chain); delete tmp; } else throw KeyStoreException("BeeKeyStore failed to protect key"); } else throw KeyStoreException("BeeKeyStore only supports storing of PrivateKey objects"); } int BeeKeyStore::engineSize() const { return _entries.size(); } void BeeKeyStore::engineLoad(InputStream* in, const array* password) throw (IOException, CertificateException, NoSuchAlgorithmException) { synchronized (this) { if (!in) { randomGeneratorContext rngc; /* salt size default is 64 bytes */ _salt.resize(64); /* generate a new salt */ randomGeneratorContextNext(&rngc, _salt.data(), _salt.size()); /* set default iteration count */ _iter = 1024; return; } auto_ptr m(Mac::getInstance("HMAC-SHA-256")); MacInputStream mis(*in, *m.get()); DataInputStream dis(mis); mis.on(false); jint magic = dis.readInt(); jint version = dis.readInt(); if (magic != BKS_MAGIC || version != BKS_VERSION_1) throw IOException("invalid BeeKeyStore format"); _entries.clear(); jint saltsize = dis.readInt(); if (saltsize <= 0) throw IOException("invalid BeeKeyStore salt size"); _salt.resize(saltsize); dis.readFully(_salt); _iter = dis.readInt(); if (_iter <= 0) throw IOException("invalid BeeKeyStore iteration count"); PKCS12PBEKey pbekey(password ? *password : EMPTY_PASSWORD, &_salt, _iter); m->init(pbekey); mis.on(true); jint entrycount = dis.readInt(); if (entrycount <= 0) throw IOException("invalid BeeKeyStore entry count"); for (jint i = 0; i < entrycount; i++) { String alias; switch (dis.readInt()) { case BKS_PRIVATEKEY_ENTRY: { alias = dis.readUTF(); auto_ptr e(new KeyEntry); e->date.setTime(dis.readLong()); jint keysize = dis.readInt(); if (keysize <= 0) throw IOException("invalid BeeKeyStore key length"); e->encryptedkey.resize((int) keysize); dis.readFully(e->encryptedkey); jint certcount = dis.readInt(); if (certcount <= 0) throw IOException("invalid BeeKeyStore certificate count"); e->chain.resize(certcount); for (jint j = 0; j < certcount; j++) { String type = dis.readUTF(); auto_ptr cf(CertificateFactory::getInstance(type)); jint certsize = dis.readInt(); if (certsize <= 0) throw IOException("invalid BeeKeyStore certificate size"); bytearray cert(certsize); dis.readFully(cert); ByteArrayInputStream bis(cert); e->chain[j] = cf->generateCertificate(bis); } delete _entries.put(new String(alias), e.release()); } break; case BKS_CERTIFICATE_ENTRY: { alias = dis.readUTF(); auto_ptr e(new CertEntry); e->date.setTime(dis.readLong()); String type = dis.readUTF(); auto_ptr cf(CertificateFactory::getInstance(type)); jint certsize = dis.readInt(); if (certsize <= 0) throw IOException("invalid BeeKeyStore certificate size"); bytearray cert(certsize); dis.readFully(cert); ByteArrayInputStream bis(cert); e->cert = cf->generateCertificate(bis); delete _entries.put(new String(alias), e.release()); } break; default: throw IOException("invalid BeeKeyStore entry tag"); } } bytearray computed_mac, original_mac; mis.on(false); jint macsize = dis.available(); if (macsize <= 0) throw IOException("invalid BeeKeyStore MAC size"); computed_mac = m->doFinal(); // we can safely cast, since we've excluded negative numbers if (macsize != computed_mac.size()) throw IOException("BeeKeyStore has been tampered with, or password was incorrect; incorrect mac size"); original_mac.resize(macsize); dis.readFully(original_mac); if (computed_mac != original_mac) throw IOException("BeeKeyStore has been tampered with, or password was incorrect; incorrect mac"); } } void BeeKeyStore::engineStore(OutputStream& out, const array* password) throw (IOException, CertificateException, NoSuchAlgorithmException) { synchronized (this) { auto_ptr m(Mac::getInstance("HMAC-SHA-256")); PKCS12PBEKey pbekey(password ? *password : EMPTY_PASSWORD, &_salt, _iter); m->init(pbekey); MacOutputStream mos(out, *m.get()); DataOutputStream dos(mos); mos.on(false); dos.writeInt(BKS_MAGIC); dos.writeInt(BKS_VERSION_1); dos.writeInt(_salt.size()); dos.write(_salt); dos.writeInt(_iter); mos.on(true); dos.writeInt(_entries.size()); Iterator::Entry>* it = _entries.entrySet().iterator(); assert(it != 0); while (it->hasNext()) { class Map::Entry* e = it->next(); const KeyEntry* ke = dynamic_cast(e->getValue()); if (ke) { dos.writeInt(BKS_PRIVATEKEY_ENTRY); dos.writeUTF(*e->getKey()); dos.writeLong(ke->date.getTime()); dos.writeInt(ke->encryptedkey.size()); dos.write(ke->encryptedkey); /* next do all the certificates for this key */ dos.writeInt(ke->chain.size()); for (int i = 0; i < ke->chain.size(); i++) { const Certificate* cert = ke->chain[i]; dos.writeUTF(cert->getType()); dos.writeInt(cert->getEncoded().size()); dos.write(cert->getEncoded()); } continue; } const CertEntry* ce = dynamic_cast(e->getValue()); if (ce) { dos.writeInt(BKS_CERTIFICATE_ENTRY); dos.writeUTF(*e->getKey()); dos.writeLong(ce->date.getTime()); dos.writeUTF(ce->cert->getType()); dos.writeInt(ce->cert->getEncoded().size()); dos.write(ce->cert->getEncoded()); continue; } throw ProviderException("entry is neither KeyEntry nor CertEntry"); } /* don't call close on a FilterOutputStream because the * underlying stream still has to write data! */ dos.flush(); mos.flush(); out.write(m->doFinal()); out.close(); } } beecrypt-4.2.1/c++/provider/MD5withRSASignature.cxx0000664000175000001440000000202010200715201016667 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/MD5withRSASignature.h" #include "beecrypt/md5.h" using namespace beecrypt::provider; MD5withRSASignature::MD5withRSASignature() : PKCS1RSASignature(&md5) { } beecrypt-4.2.1/c++/provider/SHA512withRSASignature.cxx0000664000175000001440000000203710200715221017157 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/SHA512withRSASignature.h" #include "beecrypt/sha512.h" using namespace beecrypt::provider; SHA512withRSASignature::SHA512withRSASignature() : PKCS1RSASignature(&sha512) { } beecrypt-4.2.1/c++/provider/HMACSHA256.cxx0000664000175000001440000000225510302132360014473 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha256.h" #include "beecrypt/c++/provider/HMACSHA256.h" using namespace beecrypt::provider; HMACSHA256::HMACSHA256() : HMAC(hmacsha256, sha256) { } HMACSHA256* HMACSHA256::clone() const throw () { HMACSHA256* result = new HMACSHA256(); memcpy(result->_ctxt.param, _ctxt.param, _ctxt.algo->paramsize); return result; } beecrypt-4.2.1/c++/provider/SHA1Digest.cxx0000664000175000001440000000463510302132230015026 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include "beecrypt/c++/provider/SHA1Digest.h" using namespace beecrypt::provider; SHA1Digest::SHA1Digest() : _digest(20) { if (sha1Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha1Reset"); } SHA1Digest::~SHA1Digest() { } SHA1Digest* SHA1Digest::clone() const throw () { SHA1Digest* result = new SHA1Digest(); memcpy(&result->_param, &_param, sizeof(sha1Param)); return result; } const bytearray& SHA1Digest::engineDigest() { if (sha1Digest(&_param, _digest.data())) throw ProviderException("BeeCrypt internal error in sha1Digest"); return _digest; } int SHA1Digest::engineDigest(byte* data, int offset, int length) throw (ShortBufferException) { if (!data) throw NullPointerException(); if (length < 20) throw ShortBufferException(); if (sha1Digest(&_param, data)) throw ProviderException("BeeCrypt internal error in sha1Digest"); return 20; } int SHA1Digest::engineGetDigestLength() { return 20; } void SHA1Digest::engineReset() { if (sha1Reset(&_param)) throw ProviderException("BeeCrypt internal error in sha1Reset"); } void SHA1Digest::engineUpdate(byte b) { if (sha1Update(&_param, &b, 1)) throw ProviderException("BeeCrypt internal error in sha1Update"); } void SHA1Digest::engineUpdate(const byte* data, int offset, int length) { if (sha1Update(&_param, data+offset, length)) throw ProviderException("BeeCrypt internal error in sha1Update"); } beecrypt-4.2.1/c++/provider/RSAKeyPairGenerator.cxx0000664000175000001440000000521010207071715016757 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/adapter.h" using beecrypt::randomGeneratorContextAdapter; #include "beecrypt/c++/provider/RSAKeyPairGenerator.h" #include "beecrypt/c++/provider/RSAPublicKeyImpl.h" #include "beecrypt/c++/provider/RSAPrivateCrtKeyImpl.h" #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; #include "beecrypt/rsakp.h" using namespace beecrypt::provider; RSAKeyPairGenerator::RSAKeyPairGenerator() { _size = 1024; _e = RSAKeyGenParameterSpec::F4; _srng = 0; } KeyPair* RSAKeyPairGenerator::genpair(randomGeneratorContext* rngc) { rsakp _pair; transform(_pair.e, _e); if (rsakpMake(&_pair, rngc, _size ? _size : 1024)) throw ProviderException("unexpected error in rsakpMake"); return new KeyPair(new RSAPublicKeyImpl(_pair.n, _pair.e), new RSAPrivateCrtKeyImpl(_pair.n, _pair.e, _pair.d, _pair.p, _pair.q, _pair.dp, _pair.dq, _pair.qi)); } KeyPair* RSAKeyPairGenerator::engineGenerateKeyPair() { if (_srng) { randomGeneratorContextAdapter rngc(_srng); return genpair(&rngc); } else { randomGeneratorContext rngc(randomGeneratorDefault()); return genpair(&rngc); } } void RSAKeyPairGenerator::engineInitialize(const AlgorithmParameterSpec& spec, SecureRandom* random) throw (InvalidAlgorithmParameterException) { const RSAKeyGenParameterSpec* rsaspec = dynamic_cast(&spec); if (rsaspec) { _size = rsaspec->getKeysize(); _e = rsaspec->getPublicExponent(); } else throw InvalidAlgorithmParameterException("not an RSAKeyGenParameterSpec"); } void RSAKeyPairGenerator::engineInitialize(int keysize, SecureRandom* random) throw (InvalidParameterException) { if (keysize < 512) throw InvalidParameterException("Modulus size must be at least 512 bits"); _size = keysize; _e = RSAKeyGenParameterSpec::F4; _srng = random; } beecrypt-4.2.1/c++/provider/DHParameters.cxx0000664000175000001440000000431310202677267015531 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/provider/DHParameters.h" #include "beecrypt/c++/security/ProviderException.h" using beecrypt::security::ProviderException; using namespace beecrypt::provider; DHParameters::DHParameters() { _spec = 0; } DHParameters::~DHParameters() { delete _spec; } const bytearray& DHParameters::engineGetEncoded(const String* format) throw (IOException) { throw IOException("not implemented"); } AlgorithmParameterSpec* DHParameters::engineGetParameterSpec(const type_info& info) throw (InvalidParameterSpecException) { if (info == typeid(AlgorithmParameterSpec) || info == typeid(DHParameterSpec)) { if (_spec) { return new DHParameterSpec(*_spec); } else throw InvalidParameterSpecException("not initialized"); } else throw InvalidParameterSpecException("expected a DHParameterSpec"); } void DHParameters::engineInit(const AlgorithmParameterSpec& spec) throw (InvalidParameterSpecException) { const DHParameterSpec* tmp = dynamic_cast(&spec); if (tmp) { if (_spec) { delete _spec; _spec = 0; } _spec = new DHParameterSpec(*tmp); } else throw InvalidParameterSpecException("expected a DHParameterSpec"); } void DHParameters::engineInit(const byte*, int, const String* format) { throw ProviderException("not implemented"); } String DHParameters::engineToString() throw () { return String("(not implemented"); } beecrypt-4.2.1/c++/testrsa.cxx0000664000175000001440000000440110164255577013046 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/Security.h" using beecrypt::security::Security; #include "beecrypt/c++/security/AlgorithmParameterGenerator.h" using beecrypt::security::AlgorithmParameterGenerator; #include "beecrypt/c++/security/AlgorithmParameters.h" using beecrypt::security::AlgorithmParameters; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; #include "beecrypt/c++/security/KeyPairGenerator.h" using beecrypt::security::KeyPairGenerator; #include "beecrypt/c++/security/Signature.h" using beecrypt::security::Signature; #include "beecrypt/c++/security/spec/EncodedKeySpec.h" using beecrypt::security::spec::EncodedKeySpec; #include using namespace std; #include int main(int argc, char* argv[]) { int failures = 0; try { KeyPairGenerator* kpg = KeyPairGenerator::getInstance("RSA"); kpg->initialize(1024); KeyPair* pair = kpg->generateKeyPair(); Signature* sig = Signature::getInstance("SHA1withRSA"); sig->initSign(pair->getPrivate()); bytearray* tmp = sig->sign(); sig->initVerify(pair->getPublic()); if (!sig->verify(*tmp)) { cerr << "signature failure" << endl; failures++; } delete tmp; delete sig; delete pair; delete kpg; } catch (Exception ex) { if (ex.getMessage()) cerr << "Exception: " << *ex.getMessage() << endl; failures++; } catch (...) { cerr << "exception" << endl; failures++; } return failures; } beecrypt-4.2.1/c++/nio/0000777000175000001440000000000011226307272011473 500000000000000beecrypt-4.2.1/c++/nio/Makefile.in0000644000175000001440000003734211226307161013462 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = c++/nio DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxnio_la_LIBADD = am_libcxxnio_la_OBJECTS = Buffer.lo ByteOrder.lo libcxxnio_la_OBJECTS = $(am_libcxxnio_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxnio_la_SOURCES) DIST_SOURCES = $(libcxxnio_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxnio.la cxxniodir = $(pkgincludedir)/c++/nio libcxxnio_la_SOURCES = \ Buffer.cxx \ ByteOrder.cxx all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/nio/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/nio/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxnio.la: $(libcxxnio_la_OBJECTS) $(libcxxnio_la_DEPENDENCIES) $(CXXLINK) $(libcxxnio_la_OBJECTS) $(libcxxnio_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Buffer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ByteOrder.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/nio/Makefile.am0000664000175000001440000000026710502514451013445 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxnio.la cxxniodir= $(pkgincludedir)/c++/nio libcxxnio_la_SOURCES = \ Buffer.cxx \ ByteOrder.cxx beecrypt-4.2.1/c++/nio/Buffer.cxx0000664000175000001440000000503610164007063013345 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/nio/Buffer.h" #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; using namespace beecrypt::nio; Buffer::Buffer(size_t capacity, size_t limit, bool readonly) { _capacity = capacity; _limit = limit; _position = 0; _marked = false; _readonly = readonly; } size_t Buffer::capacity() const throw () { return _capacity; } Buffer& Buffer::clear() throw () { _limit = _capacity; _position = 0; _marked = false; return *this; } Buffer& Buffer::flip() throw () { _limit = _position; _position = 0; _marked = false; return *this; } bool Buffer::hasRemaining() const throw () { return (_position < _limit); } bool Buffer::isReadOnly() const throw () { return _readonly; } Buffer& Buffer::limit(size_t newLimit) throw (IllegalArgumentException) { if (newLimit > _capacity) throw IllegalArgumentException("limit greater than capacity"); _limit = newLimit; if (_marked && (_mark > _limit)) _marked = false; return *this; } Buffer& Buffer::mark() throw () { _marked = true; _mark = _position; return *this; } size_t Buffer::position() const throw () { return _position; } Buffer& Buffer::position(size_t newPosition) throw (IllegalArgumentException) { if (newPosition > _limit) throw IllegalArgumentException("position greater than limit"); _position = newPosition; if (_marked && (_mark > _limit)) _marked = false; return *this; } size_t Buffer::remaining() const throw () { return (_limit - _position); } Buffer& Buffer::reset() throw (InvalidMarkException) { if (!_marked) throw InvalidMarkException(); _position = _mark; return *this; } Buffer& Buffer::rewind() throw () { _position = _mark = 0; return *this; } beecrypt-4.2.1/c++/nio/ByteOrder.cxx0000664000175000001440000000244310164007214014030 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/nio/ByteOrder.h" using namespace beecrypt::nio; ByteOrder::ByteOrder(const String& name) : _name(name) { } const ByteOrder ByteOrder::BIG_ENDIAN("BIG_ENDIAN"); const ByteOrder ByteOrder::LITTLE_ENDIAN("LITTLE_ENDIAN"); const ByteOrder& ByteOrder::nativeOrder() { #if WORDS_BIGENDIAN return BIG_ENDIAN; #else return LITTLE_ENDIAN; #endif } String ByteOrder::toString() const throw () { return _name; } beecrypt-4.2.1/c++/Makefile.am0000644000175000001440000000242211216147021012647 00000000000000LIBBEECRYPT_CXX_LT_CURRENT = 7 LIBBEECRYPT_CXX_LT_AGE = 0 LIBBEECRYPT_CXX_LT_REVISION = 0 INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = lang math io nio util security crypto beeyond . provider cxxdir=$(pkgincludedir)/c++ lib_LTLIBRARIES = libbeecrypt_cxx.la libbeecrypt_cxx_la_SOURCES = \ adapter.cxx \ resource.cxx libbeecrypt_cxx_la_LIBADD = ../libbeecrypt.la lang/libcxxlang.la math/libcxxmath.la io/libcxxio.la nio/libcxxnio.la util/libcxxutil.la security/libcxxsecurity.la crypto/libcxxcrypto.la beeyond/libcxxbeeyond.la -licuuc -licuio -licui18n libbeecrypt_cxx_la_LDFLAGS = -no-undefined -version-info $(LIBBEECRYPT_CXX_LT_CURRENT):$(LIBBEECRYPT_CXX_LT_REVISION):$(LIBBEECRYPT_CXX_LT_AGE) noinst_DATA = beecrypt-test.conf TESTS_ENVIRONMENT = BEECRYPT_CONF_FILE=beecrypt-test.conf TESTS = testks testdsa testrsa testdhies CLEANFILES = beecrypt-test.conf check_PROGRAMS = testks testdsa testrsa testdhies testks_SOURCES = testks.cxx testks_LDADD = libbeecrypt_cxx.la testdsa_SOURCES = testdsa.cxx testdsa_LDADD = libbeecrypt_cxx.la testrsa_SOURCES = testrsa.cxx testrsa_LDADD = libbeecrypt_cxx.la testdhies_SOURCES = testdhies.cxx testdhies_LDADD = libbeecrypt_cxx.la beecrypt-test.conf: @echo "provider.1=provider/.libs/base.so" > beecrypt-test.conf beecrypt-4.2.1/c++/testks.cxx0000664000175000001440000000462410213526037012670 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/FileInputStream.h" using beecrypt::io::FileInputStream; #include "beecrypt/c++/io/FileOutputStream.h" using beecrypt::io::FileOutputStream; #include "beecrypt/c++/security/KeyStore.h" using beecrypt::security::KeyStore; #include "beecrypt/c++/security/KeyPairGenerator.h" using beecrypt::security::KeyPairGenerator; #include "beecrypt/c++/beeyond/BeeCertificate.h" using beecrypt::beeyond::BeeCertificate; #include using std::cout; using std::endl; #include int main(int argc, char* argv[]) { try { array password(4); password[0] = (jchar) 't'; password[1] = (jchar) 'e'; password[2] = (jchar) 's'; password[3] = (jchar) 't'; KeyStore* ks = KeyStore::getInstance(KeyStore::getDefaultType()); if (argc == 2) { FileInputStream fin(fopen(argv[1], "rb")); ks->load(&fin, &password); Key* k = ks->getKey("rsa", password); cout << "k algorithm = " << k->getAlgorithm() << endl; delete k; } else { KeyPairGenerator* kpg = KeyPairGenerator::getInstance("RSA"); kpg->initialize(1024); KeyPair* pair = kpg->generateKeyPair(); array chain(1); chain[0] = BeeCertificate::self(pair->getPublic(), pair->getPrivate(), "SHA1withRSA"); FileOutputStream fos(fopen("keystore", "wb")); // create an empty stream ks->load((InputStream*) 0, &password); ks->setKeyEntry("rsa", pair->getPrivate(), password, chain); ks->store(fos, &password); } delete ks; } catch (Exception e) { if (e.getMessage()) cout << "Exception: " + *e.getMessage() << endl; } } beecrypt-4.2.1/c++/io/0000777000175000001440000000000011226307272011315 500000000000000beecrypt-4.2.1/c++/io/ByteArrayOutputStream.cxx0000664000175000001440000000570410302132563016255 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/ByteArrayOutputStream.h" #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::io; ByteArrayOutputStream::ByteArrayOutputStream() : buf(32) { count = 0; } ByteArrayOutputStream::ByteArrayOutputStream(jint size) : buf(size) { count = 0; } ByteArrayOutputStream::~ByteArrayOutputStream() { } void ByteArrayOutputStream::reset() throw () { count = 0; } jint ByteArrayOutputStream::size() throw () { return count; } bytearray* ByteArrayOutputStream::toByteArray() { bytearray* result = new bytearray(); toByteArray(*result); return result; } void ByteArrayOutputStream::toByteArray(bytearray& b) { synchronized (this) { b.resize(count); memcpy(b.data(), buf.data(), count); } } void ByteArrayOutputStream::toByteArray(byte* data, jint offset, jint length) { if (!data) throw NullPointerException(); synchronized (this) { memcpy(data+offset, buf.data(), length < count ? length : count); } } void ByteArrayOutputStream::close() throw (IOException) { } void ByteArrayOutputStream::flush() throw (IOException) { } void ByteArrayOutputStream::write(byte b) throw (IOException) { synchronized (this) { jint newcount = count+1; jint actualsz = buf.size(); if (actualsz < newcount) { if (actualsz == 0) buf.resize(32); else buf.resize(actualsz << 1); } buf[count++] = b; } } void ByteArrayOutputStream::write(const byte* data, jint offset, jint length) throw (IOException) { if (length) { if (!data) throw NullPointerException(); synchronized (this) { jint newcount = count + length; jint actualsz = buf.size(); if (newcount > actualsz) buf.resize(newcount > (actualsz << 1) ? newcount : (actualsz << 1)); memcpy(buf.data()+count, data, length); count += length; } } } void ByteArrayOutputStream::write(const bytearray& b) throw (IOException) { write(b.data(), 0, b.size()); } void ByteArrayOutputStream::writeTo(OutputStream& out) throw (IOException) { if (count) { synchronized (this) { out.write(buf.data(), 0, count); } } } beecrypt-4.2.1/c++/io/FileInputStream.cxx0000664000175000001440000000717610301155151015033 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #if HAVE_ERRNO_H # include #endif #include "beecrypt/c++/io/FileInputStream.h" #include "beecrypt/c++/lang/Integer.h" using beecrypt::lang::Integer; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::io; FileInputStream::FileInputStream(FILE* f) { _f = f; _mark = -1; } FileInputStream::~FileInputStream() { } int FileInputStream::available() throw (IOException) { if (!_f) throw IOException("not a valid file handle"); long _curr, _size; if ((_curr = ftell(_f)) == -1) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("ftell failed"); #endif if (fseek(_f, 0, SEEK_END)) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("fseek failed"); #endif if ((_size = ftell(_f)) == -1) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("ftell failed"); #endif if (fseek(_f, _curr, SEEK_SET)) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("fseek failed"); #endif if ((_size - _curr) > Integer::MAX_VALUE) return Integer::MAX_VALUE; else return (int)(_size - _curr); } void FileInputStream::close() throw (IOException) { if (_f) { if (fclose(_f)) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("fclose failed"); #endif _f = 0; } } void FileInputStream::mark(int readlimit) throw () { if (_f) _mark = ftell(_f); } bool FileInputStream::markSupported() throw () { return true; } int FileInputStream::read() throw (IOException) { if (!_f) throw IOException("not a valid file handle"); return fgetc(_f); } int FileInputStream::read(byte* data, int offset, int length) throw (IOException) { if (!_f) throw IOException("not a valid file handle"); if (!data) throw NullPointerException(); int rc = fread(data+offset, 1, length, _f); if (rc == 0) return -1; return rc; } int FileInputStream::read(bytearray& b) throw (IOException) { return read(b.data(), 0, b.size()); } void FileInputStream::reset() throw (IOException) { if (!_f) throw IOException("not a valid file handle"); if (_mark < 0) throw IOException("not a valid mark"); if (fseek(_f, _mark, SEEK_SET)) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("fseek failed"); #endif } int FileInputStream::skip(int n) throw (IOException) { if (!_f) throw IOException("not a valid file handle"); int _avail = available(); if (n > _avail) n = _avail; if (fseek(_f, (long) n, SEEK_CUR)) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("fseek failed"); #endif return n; } beecrypt-4.2.1/c++/io/InputStream.cxx0000664000175000001440000000420110207105265014223 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/InputStream.h" #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::io; jint InputStream::available() throw (IOException) { return 0; } void InputStream::close() throw (IOException) { } void InputStream::mark(jint readlimit) throw () { } bool InputStream::markSupported() throw () { return false; } jint InputStream::read(bytearray& b) throw (IOException) { return read(b.data(), 0, b.size()); } jint InputStream::read(byte* data, jint offset, jint length) throw (IOException) { if (!data) throw NullPointerException(); jint b = read(); if (b < 0) return -1; data[offset] = (byte) b; jint i = 1; try { while (i < length) { b = read(); if (b < 0) break; data[offset+i++] = (byte) b; } } catch (IOException&) { // ignore } return i; } jint InputStream::skip(jint n) throw (IOException) { jint remaining = n; byte skip[2048]; while (remaining > 0) { jint rc = read(skip, 0, remaining > 2048 ? 2048 : remaining); if (rc < 0) break; remaining -= rc; } return n - remaining; } void InputStream::reset() throw (IOException) { throw IOException("reset not supported"); } beecrypt-4.2.1/c++/io/Makefile.in0000644000175000001440000005144311226307160013301 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ TESTS = test$(EXEEXT) check_PROGRAMS = test$(EXEEXT) subdir = c++/io DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxio_la_DEPENDENCIES = am_libcxxio_la_OBJECTS = ByteArrayInputStream.lo \ ByteArrayOutputStream.lo DataInputStream.lo \ DataOutputStream.lo FileInputStream.lo FileOutputStream.lo \ FilterInputStream.lo FilterOutputStream.lo InputStream.lo \ OutputStream.lo PrintStream.lo PushbackInputStream.lo \ Writer.lo libcxxio_la_OBJECTS = $(am_libcxxio_la_OBJECTS) am_test_OBJECTS = test.$(OBJEXT) test_OBJECTS = $(am_test_OBJECTS) test_DEPENDENCIES = $(top_builddir)/c++/libbeecrypt_cxx.la \ $(top_builddir)/libbeecrypt.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxio_la_SOURCES) $(test_SOURCES) DIST_SOURCES = $(libcxxio_la_SOURCES) $(test_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxio.la cxxiodir = $(pkgincludedir)/c++/io libcxxio_la_SOURCES = \ ByteArrayInputStream.cxx \ ByteArrayOutputStream.cxx \ DataInputStream.cxx \ DataOutputStream.cxx \ FileInputStream.cxx \ FileOutputStream.cxx \ FilterInputStream.cxx \ FilterOutputStream.cxx \ InputStream.cxx \ OutputStream.cxx \ PrintStream.cxx \ PushbackInputStream.cxx \ Writer.cxx libcxxio_la_LIBADD = -licuuc test_SOURCES = test.cxx test_LDADD = $(top_builddir)/c++/libbeecrypt_cxx.la $(top_builddir)/libbeecrypt.la -licuuc -licuio all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/io/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/io/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxio.la: $(libcxxio_la_OBJECTS) $(libcxxio_la_DEPENDENCIES) $(CXXLINK) $(libcxxio_la_OBJECTS) $(libcxxio_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) @rm -f test$(EXEEXT) $(CXXLINK) $(test_OBJECTS) $(test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ByteArrayInputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ByteArrayOutputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DataInputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DataOutputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileInputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileOutputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FilterInputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FilterOutputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OutputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PrintStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PushbackInputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Writer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/io/FilterOutputStream.cxx0000664000175000001440000000310110167727665015613 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/FilterOutputStream.h" using namespace beecrypt::io; FilterOutputStream::FilterOutputStream(OutputStream& out) : out(out) { } FilterOutputStream::~FilterOutputStream() { } void FilterOutputStream::close() throw (IOException) { try { flush(); } catch (IOException) { // ignore } out.close(); } void FilterOutputStream::flush() throw (IOException) { out.flush(); } void FilterOutputStream::write(byte b) throw (IOException) { out.write(b); } void FilterOutputStream::write(const byte* data, int offset, int len) throw (IOException) { out.write(data, offset, len); } void FilterOutputStream::write(const bytearray& b) throw (IOException) { out.write(b.data(), 0, b.size()); } beecrypt-4.2.1/c++/io/PushbackInputStream.cxx0000664000175000001440000000674310302132602015710 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/PushbackInputStream.h" #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::io; PushbackInputStream::PushbackInputStream(InputStream& in, int size) : FilterInputStream(in), buf(size) { _closed = false; pos = 0; } PushbackInputStream::~PushbackInputStream() { } int PushbackInputStream::available() throw (IOException) { if (_closed) throw IOException("Stream closed"); return in.available() + (buf.size() - pos); } void PushbackInputStream::close() throw (IOException) { if (!_closed) { in.close(); _closed = true; } } int PushbackInputStream::read() throw (IOException) { if (_closed) throw IOException("Stream closed"); if (pos < buf.size()) return buf[pos++]; return in.read(); } bool PushbackInputStream::markSupported() throw () { return false; } int PushbackInputStream::read(byte* data, int offset, int length) throw (IOException) { if (!data) throw NullPointerException(); if (_closed) throw IOException("Stream closed"); if (length == 0) return 0; int buffered = buf.size() - pos; if (buffered > 0) { if (length < buffered) buffered = length; memcpy(data+offset, buf.data()+pos, buffered); pos += buffered; offset += buffered; length -= buffered; } if (length > 0) { int rc = in.read(data, offset, length); if (rc < 0) if (buffered == 0) return -1; // nothing in buffer and nothing read else return buffered; // something in buffer and nothing read return buffered + rc; // something in buffer and something read } return buffered; // everything was in buffer } int PushbackInputStream::skip(int n) throw (IOException) { if (_closed) throw IOException("Stream closed"); if (n == 0) return 0; int canskip = buf.size() - pos; if (canskip > 0) { if (n < canskip) { // more in buffer than we need to skip canskip = n; } pos += canskip; n -= canskip; } if (n > 0) { // apparently we didn't have enough in the buffer canskip += in.skip(n); } return canskip; } void PushbackInputStream::unread(byte b) throw (IOException) { if (_closed) throw IOException("Stream closed"); if (pos == 0) throw IOException("Pushback buffer is full"); buf[--pos] = b; } void PushbackInputStream::unread(const bytearray& b) throw (IOException) { unread(b.data(), 0, b.size()); } void PushbackInputStream::unread(const byte* data, int offset, int length) throw (IOException) { if (!data) throw NullPointerException(); pos -= length; memcpy(buf.data()+pos, data+offset, length); } beecrypt-4.2.1/c++/io/Makefile.am0000664000175000001440000000116510502514433013265 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxio.la cxxiodir= $(pkgincludedir)/c++/io libcxxio_la_SOURCES = \ ByteArrayInputStream.cxx \ ByteArrayOutputStream.cxx \ DataInputStream.cxx \ DataOutputStream.cxx \ FileInputStream.cxx \ FileOutputStream.cxx \ FilterInputStream.cxx \ FilterOutputStream.cxx \ InputStream.cxx \ OutputStream.cxx \ PrintStream.cxx \ PushbackInputStream.cxx \ Writer.cxx libcxxio_la_LIBADD = -licuuc TESTS = test check_PROGRAMS = test test_SOURCES = test.cxx test_LDADD = $(top_builddir)/c++/libbeecrypt_cxx.la $(top_builddir)/libbeecrypt.la -licuuc -licuio beecrypt-4.2.1/c++/io/FilterInputStream.cxx0000664000175000001440000000352310173173713015404 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/FilterInputStream.h" using namespace beecrypt::io; FilterInputStream::FilterInputStream(InputStream& in) : in(in) { } FilterInputStream::~FilterInputStream() { } int FilterInputStream::available() throw (IOException) { return in.available(); } void FilterInputStream::close() throw (IOException) { in.close(); } void FilterInputStream::mark(int readlimit) throw () { synchronized (this) { in.mark(readlimit); } } bool FilterInputStream::markSupported() throw () { return in.markSupported(); } int FilterInputStream::read() throw (IOException) { return in.read(); } int FilterInputStream::read(byte* data, int offset, int len) throw (IOException) { return in.read(data, offset, len); } int FilterInputStream::read(bytearray& b) throw (IOException) { return in.read(b); } void FilterInputStream::reset() throw (IOException) { synchronized (this) { in.reset(); } } int FilterInputStream::skip(int n) throw (IOException) { return in.skip(n); } beecrypt-4.2.1/c++/io/PrintStream.cxx0000664000175000001440000001307210207104654014227 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/PrintStream.h" #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/lang/IllegalArgumentException.h" using beecrypt::lang::IllegalArgumentException; #define MAX_BYTES_PER_CHARACTER 8 using namespace beecrypt::io; PrintStream::PrintStream(OutputStream& out, bool autoflush, const char* encoding) : FilterOutputStream(out) { UErrorCode status = U_ZERO_ERROR; _loc = ucnv_open(encoding, &status); if (U_FAILURE(status)) throw IllegalArgumentException("invalid encoding"); _closed = false; _error = false; _flush = autoflush; } PrintStream::~PrintStream() { ucnv_close(_loc); } void PrintStream::close() throw () { try { out.close(); _closed = true; } catch (IOException&) { _error = true; } } void PrintStream::flush() throw () { if (!_closed) { try { out.flush(); } catch (IOException&) { _error = true; } } } void PrintStream::write(byte b) throw () { if (!_closed) { try { out.write(b); } catch (IOException&) { _error = true; } } } void PrintStream::write(const byte* data, size_t offset, size_t length) throw () { if (!_closed) { try { out.write(data, offset, length); } catch (IOException&) { _error = true; } } } void PrintStream::print(const UChar* str, size_t length) throw () { if (!_closed) { try { UErrorCode status = U_ZERO_ERROR; // pre-flighting size_t need = ucnv_fromUChars(_loc, 0, 0, str, length, &status); if (U_FAILURE(status)) if (status != U_BUFFER_OVERFLOW_ERROR) throw IOException(); byte* buffer = new byte[need]; status = U_ZERO_ERROR; try { ucnv_fromUChars(_loc, (char*) buffer, need, str, length, &status); if (status != U_STRING_NOT_TERMINATED_WARNING) throw IOException(); out.write(buffer, 0, need); if (_flush) { for (size_t i = 0; i < length; i++) if (str[i] == 0xA) out.flush(); } delete[] buffer; } catch (IOException&) { delete[] buffer; throw; } } catch (IOException&) { _error = true; } } } void PrintStream::print(bool b) throw () { static const String* STR_TRUE = 0; static const String* STR_FALSE = 0; if (!_closed) { if (b) { if (!STR_FALSE) STR_FALSE = new String("true"); print(*STR_TRUE); } else { if (!STR_FALSE) STR_FALSE = new String("false"); print(*STR_FALSE); } } } void PrintStream::print(jchar ch) throw () { if (!_closed) { char buffer[MAX_BYTES_PER_CHARACTER]; try { UErrorCode status = U_ZERO_ERROR; // do conversion of one character size_t used = ucnv_fromUChars(_loc, buffer, 8, &ch, 1, &status); if (U_FAILURE(status)) throw IOException("failure in ucnv_fromUChars"); out.write((const byte*) buffer, 0, used); // check if we need to flush if (_flush && ch == 0xA) out.flush(); } catch (IOException&) { _error = true; } } } void PrintStream::print(jshort x) throw () { if (!_closed) { char tmp[7]; int rc; #if SIZEOF_int == 4 rc = sprintf(tmp, "%hd", x); #else rc = sprintf(tmp, "%d", x); #endif if (rc < 0) write((const byte*) tmp, 0, (size_t) rc); } } void PrintStream::print(jint x) throw () { if (!_closed) { char tmp[11]; int rc; #if SIZEOF_INT == 4 rc = sprintf(tmp, "%d", x); #else rc = sprintf(tmp, "%ld", x); #endif if (rc > 0) write((const byte*) tmp, 0, (size_t) rc); } } void PrintStream::print(jlong x) throw () { if (!_closed) { char tmp[21]; int rc; #if WIN32 rc = sprintf(tmp, "%I64d", x); #elif SIZEOF_LONG == 8 rc = sprintf(tmp, "%ld", x); #elif HAVE_LONG_LONG rc = sprintf(tmp, "%lld", x); #else # error #endif if (rc > 0) write((const byte*) tmp, 0, (size_t) rc); } } void PrintStream::print(const array& chars) throw () { print(chars.data(), chars.size()); } void PrintStream::print(const String& str) throw () { const array& tmp = str.toCharArray(); print(tmp.data(), tmp.size()); } void PrintStream::println() throw () { if (!_closed) { #if WIN32 print((jchar) 0xD); print((jchar) 0xA); #else print((jchar) 0xA); #endif } } void PrintStream::println(bool b) throw () { if (!_closed) { print(b); println(); } } void PrintStream::println(jshort x) throw () { if (!_closed) { print(x); println(); } } void PrintStream::println(jint x) throw () { if (!_closed) { print(x); println(); } } void PrintStream::println(jlong x) throw () { if (!_closed) { print(x); println(); } } void PrintStream::println(const array& chars) throw () { if (!_closed) { print(chars); println(); } } void PrintStream::println(const String& str) throw () { if (!_closed) { print(str); println(); } } beecrypt-4.2.1/c++/io/OutputStream.cxx0000664000175000001440000000270110167727736014451 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/OutputStream.h" #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::io; void OutputStream::close() throw (IOException) { } void OutputStream::flush() throw (IOException) { } void OutputStream::write(const byte* data, int offset, int length) throw (IOException) { if (length) { if (!data) throw NullPointerException(); for (int i = 0; i < length; i++) write(data[offset+i]); } } void OutputStream::write(const bytearray& b) throw (IOException) { write(b.data(), 0, b.size()); } beecrypt-4.2.1/c++/io/DataInputStream.cxx0000664000175000001440000001570710235423314015031 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/DataInputStream.h" #include "beecrypt/c++/io/EOFException.h" #include "beecrypt/c++/io/PushbackInputStream.h" #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #define MAX_BYTES_PER_CHARACTER 8 using namespace beecrypt::io; DataInputStream::DataInputStream(InputStream& in) : FilterInputStream(in) { _pin = ∈ _del = false; _utf = 0; _loc = 0; } DataInputStream::~DataInputStream() { if (_utf) { ucnv_close(_utf); _utf = 0; } if (_loc) { ucnv_close(_loc); _loc = 0; } if (_del) { delete _pin; _pin = 0; } } bool DataInputStream::readBoolean() throw (IOException) { register jint b = _pin->read(); if (b < 0) throw EOFException(); return (b != 0); } jbyte DataInputStream::readByte() throw (IOException) { register jint b = _pin->read(); if (b < 0) throw EOFException(); return static_cast(b); } jint DataInputStream::readUnsignedByte() throw (IOException) { register jint b = _pin->read(); if (b < 0) throw EOFException(); return b; } jshort DataInputStream::readShort() throw (IOException) { register jshort tmp = 0; register jint rc; for (register unsigned i = 0; i < 2; i++) { if ((rc = _pin->read()) < 0) throw EOFException(); tmp = (tmp << 8) + rc; } return tmp; } jint DataInputStream::readUnsignedShort() throw (IOException) { register jint tmp = 0, rc; for (register unsigned i = 0; i < 2; i++) { if ((rc = _pin->read()) < 0) throw EOFException(); tmp = (tmp << 8) + rc; } return tmp; } jchar DataInputStream::readChar() throw (IOException) { register jchar tmp = 0; register jint rc; for (register unsigned i = 0; i < 2; i++) { if ((rc = _pin->read()) < 0) throw EOFException(); tmp = (tmp << 8) + rc; } return tmp; } jint DataInputStream::readInt() throw (IOException) { register jint tmp = 0; register jint rc; for (register unsigned i = 0; i < 4; i++) { if ((rc = _pin->read()) < 0) throw EOFException(); tmp = (tmp << 8) + rc; } return tmp; } jlong DataInputStream::readLong() throw (IOException) { register jlong tmp = 0; register jint rc; for (register unsigned i = 0; i < 8; i++) { if ((rc = _pin->read()) < 0) throw EOFException(); tmp = (tmp << 8) + rc; } return tmp; } String DataInputStream::readUTF() throw (IOException) { UErrorCode status = U_ZERO_ERROR; if (!_utf) { // UTF-8 converter lazy initialization _utf = ucnv_open("UTF-8", &status); if (U_FAILURE(status)) throw IOException("unable to open ICU UTF-8 converter"); } jint utflen = readUnsignedShort(); if (utflen > 0) { byte* data = new byte[utflen]; readFully(data, 0, utflen); status = U_ZERO_ERROR; jint ulen = ucnv_toUChars(_utf, 0, 0, (const char*) data, (jint) utflen, &status); if (status != U_BUFFER_OVERFLOW_ERROR) { delete[] data; throw IOException("ucnv_toUChars failed"); } jchar* buffer = new jchar[ulen+1]; status = U_ZERO_ERROR; ucnv_toUChars(_utf, buffer, ulen+1, (const char*) data, (jint) utflen, &status); delete[] data; if (status != U_ZERO_ERROR) throw IOException("error in ucnv_toUChars"); String result(buffer, 0, ulen); delete[] buffer; return result; } else return String(); } String DataInputStream::readLine() throw (IOException) { UErrorCode status = U_ZERO_ERROR; if (!_loc) { // default locale converter lazy initialization _loc = ucnv_open(0, &status); if (U_FAILURE(status)) throw IOException("unable to open ICU default locale converter"); } array target_buffer(80); jint target_offset = 0; UChar* target = target_buffer.data(); const UChar* target_limit = target+1; char source_buffer[MAX_BYTES_PER_CHARACTER]; const char* source = source_buffer; char* source_limit = source_buffer; bool cr = false; jint ch; do { ch = _pin->read(); if (ch >= 0) { if ((source_limit-source_buffer) == MAX_BYTES_PER_CHARACTER) throw IOException("fubar in readLine"); *(source_limit++) = (byte) ch; } // use the default locale converter; flush if ch == -1 ucnv_toUnicode(_loc, &target, target_limit, &source, source_limit, NULL, (UBool) (ch == -1), &status); if (U_FAILURE(status)) throw IOException("ucnv_toUnicode failed"); if (target == target_limit) { // we got a whole character from the converter if (cr) { // last character read was ASCII ; is this one a ? if (target[-1] != 0x0A) { // unread the right number of bytes PushbackInputStream* p = dynamic_cast(_pin); if (p) p->unread((const byte*) source_buffer, 0, source-source_buffer); else throw IOException("fubar in dynamic_cast"); } // we're now officially at the end of the line break; } // did we get an ASCII ? if (target[-1] == 0x0A) break; // did we get an ASCII ? if (target[-1] == 0x0D) { cr = true; // the next character may be a but if not we'll have to 'unread' it if (!_del) { // lazy push _pin = new PushbackInputStream(in, MAX_BYTES_PER_CHARACTER); _del = true; } } else { // reset source pointers source = source_limit = source_buffer; // advance target_limit and target_offset target_limit++; target_offset++; // check if we have room left in the buffer if (target_offset == target_buffer.size()) { // no; double the size target_buffer.resize(target_buffer.size() * 2); } } } } while (ch >= 0); return String(target_buffer.data(), 0, target_offset); } void DataInputStream::readFully(byte* data, jint offset, jint length) throw (IOException) { if (!data) throw NullPointerException(); jint total = 0; while (total < length) { jint rc = _pin->read(data, offset+total, length-total); if (rc < 0) throw EOFException(); total += rc; } } void DataInputStream::readFully(bytearray& b) throw (IOException) { readFully(b.data(), 0, b.size()); } jint DataInputStream::skipBytes(jint n) throw (IOException) { jint total = 0, rc; while ((total < n) && ((rc = _pin->skip(n - total)) > 0)) total += rc; return total; } beecrypt-4.2.1/c++/io/ByteArrayInputStream.cxx0000664000175000001440000000506510302132550016050 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/ByteArrayInputStream.h" #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::io; ByteArrayInputStream::ByteArrayInputStream(const bytearray& b) : _buf(b) { _count = _buf.size(); _mark = 0; _pos = 0; } ByteArrayInputStream::ByteArrayInputStream(const byte* data, jint offset, jint length) : _buf(data+offset, length) { _count = _buf.size(); _mark = 0; _pos = 0; } ByteArrayInputStream::~ByteArrayInputStream() { } jint ByteArrayInputStream::available() throw (IOException) { return _count - _pos; } void ByteArrayInputStream::close() throw (IOException) { } void ByteArrayInputStream::mark(jint readlimit) throw () { _mark = _pos; } bool ByteArrayInputStream::markSupported() throw () { return true; } jint ByteArrayInputStream::read() throw (IOException) { register jint rc = -1; synchronized (this) { if (_pos < _count) rc = _buf[_pos++]; } return rc; } jint ByteArrayInputStream::read(byte* data, jint offset, jint length) throw (IOException) { if (!data) throw NullPointerException(); synchronized (this) { if (_pos >= _count) return -1; if (_pos + length > _count) length = _count - _pos; if (length == 0) return 0; memcpy(data+offset, _buf.data()+_pos, length); _pos += length; } return length; } jint ByteArrayInputStream::read(bytearray& b) throw (IOException) { return read(b.data(), 0, b.size()); } void ByteArrayInputStream::reset() throw (IOException) { synchronized (this) { _pos = _mark; } } jint ByteArrayInputStream::skip(jint n) throw (IOException) { synchronized (this) { if (_pos + n > _count) n = _count - _pos; _pos += n; } return n; } beecrypt-4.2.1/c++/io/test.cxx0000664000175000001440000000435710175642210012743 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/ByteArrayInputStream.h" using beecrypt::io::ByteArrayInputStream; #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/io/DataInputStream.h" using beecrypt::io::DataInputStream; #include "beecrypt/c++/io/DataOutputStream.h" using beecrypt::io::DataOutputStream; #include using namespace std; int main(int argc, char* argv[]) { String input("The quick brown fox jumps over the lazy dog"); int failures = 0; try { ByteArrayOutputStream bos; DataOutputStream dos(bos); dos.writeUTF(input); dos.close(); bytearray* b = bos.toByteArray(); if (b) { if (b->size() != 45) { cerr << "failed test 1" << endl; failures++; } ByteArrayInputStream bin(*b); DataInputStream din(bin); String test; test = din.readUTF(); if (!input.equals(test)) { cerr << "failed test 2" << endl; failures++; } if (din.available() != 0) { cerr << "failed test 3" << endl; cerr << "remaining bytes in stream: " << din.available() << endl; failures++; } din.close(); bin.close(); } else { cerr << "failed structural 1" << endl; failures++; } } catch (IOException&) { cerr << "failed structural 2" << endl; failures++; } catch (...) { cerr << "failed structural 3" << endl; failures++; } return failures; } beecrypt-4.2.1/c++/io/FileOutputStream.cxx0000664000175000001440000000477110301155165015237 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #if HAVE_ERRNO_H # include #endif #include "beecrypt/c++/io/FileOutputStream.h" #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::io; FileOutputStream::FileOutputStream(FILE *f) { _f = f; } FileOutputStream::~FileOutputStream() { } void FileOutputStream::close() throw (IOException) { if (_f) { if (fclose(_f)) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("fclose failed"); #endif _f = 0; } } void FileOutputStream::flush() throw (IOException) { if (!_f) throw IOException("no valid file handle to flush"); if (fflush(_f)) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("fflush failed"); #endif } void FileOutputStream::write(byte b) throw (IOException) { if (!_f) throw IOException("no valid file handle to write"); int rc = fwrite(&b, 1, 1, _f); if (rc < 1) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("incomplete fwrite"); #endif } void FileOutputStream::write(const byte* data, int offset, int length) throw (IOException) { if (length) { if (!data) throw NullPointerException(); if (!_f) throw IOException("no valid file handle to write"); int rc = fwrite(data+offset, 1, length, _f); if (rc < length) #if HAVE_ERRNO_H throw IOException(::strerror(errno)); #else throw IOException("incomplete fwrite"); #endif } } void FileOutputStream::write(const bytearray& b) throw (IOException) { write(b.data(), 0, b.size()); } beecrypt-4.2.1/c++/io/DataOutputStream.cxx0000664000175000001440000001114210246530110015212 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/DataOutputStream.h" #include #include using namespace beecrypt::io; DataOutputStream::DataOutputStream(OutputStream& out) : FilterOutputStream(out) { _utf = 0; written = 0; } DataOutputStream::~DataOutputStream() { if (_utf) ucnv_close(_utf); } jint DataOutputStream::size() const throw () { return written; } void DataOutputStream::write(byte b) throw (IOException) { synchronized (this) { out.write(b); written++; } } void DataOutputStream::write(const byte* data, jint offset, jint length) throw (IOException) { if (length) { synchronized (this) { out.write(data, offset, length); written += length; } } } void DataOutputStream::write(const bytearray& b) throw (IOException) { write(b.data(), 0, b.size()); } void DataOutputStream::writeBoolean(bool b) throw (IOException) { synchronized (this) { out.write(b ? 1 : 0); written++; } } void DataOutputStream::writeByte(byte b) throw (IOException) { synchronized (this) { out.write(b); written++; } } void DataOutputStream::writeShort(jshort s) throw (IOException) { synchronized (this) { out.write((s >> 8) ); written++; out.write((s ) & 0xff); written++; } } void DataOutputStream::writeInt(jint i) throw (IOException) { synchronized (this) { out.write((i >> 24) ); written++; out.write((i >> 16) & 0xff); written++; out.write((i >> 8) & 0xff); written++; out.write((i ) & 0xff); written++; } } #if defined(_MSC_VER) # pragma optimize("",off) #endif void DataOutputStream::writeLong(jlong l) throw (IOException) { synchronized (this) { out.write((l >> 56) ); written++; out.write((l >> 48) & 0xff); written++; out.write((l >> 40) & 0xff); written++; out.write((l >> 32) & 0xff); written++; out.write((l >> 24) & 0xff); written++; out.write((l >> 16) & 0xff); written++; out.write((l >> 8) & 0xff); written++; out.write((l ) & 0xff); written++; } } #if defined(_MSC_VER) # pragma optimize("",on) #endif void DataOutputStream::writeChar(jint v) throw (IOException) { synchronized (this) { out.write((v >> 8) && 0xff); written++; out.write((v ) && 0xff); written++; } } void DataOutputStream::writeChars(const String& str) throw (IOException) { const array& src = str.toCharArray(); synchronized (this) { for (jint i = 0; i < src.size(); i++) { out.write((src[i] >> 8) & 0xff); written++; out.write((src[i] ) & 0xff); written++; } } } void DataOutputStream::writeUTF(const String& str) throw (IOException) { UErrorCode status = U_ZERO_ERROR; if (!_utf) { // UTF-8 converter lazy initialization _utf = ucnv_open("UTF-8", &status); if (U_FAILURE(status)) throw IOException("unable to open ICU UTF-8 converter"); } const array& src = str.toCharArray(); // the expected status code here is U_BUFFER_OVERFLOW_ERROR jint need = ucnv_fromUChars(_utf, 0, 0, src.data(), src.size(), &status); if (U_FAILURE(status)) if (status != U_BUFFER_OVERFLOW_ERROR) throw IOException("ucnv_fromUChars failed"); if (need > 0xffff) throw IOException("String length >= 64K"); byte* buffer = new byte[need]; status = U_ZERO_ERROR; // the expected status code here is U_STRING_NOT_TERMINATED_WARNING ucnv_fromUChars(_utf, (char*) buffer, need, src.data(), src.size(), &status); if (status != U_STRING_NOT_TERMINATED_WARNING) { delete[] buffer; throw IOException("ucnv_fromUChars failed"); } // everything ready for the critical section try { synchronized (this) { out.write((need >> 8) & 0xff); written++; out.write((need ) & 0xff); written++; out.write(buffer, 0, need); written += need; } } catch (IOException&) { delete[] buffer; throw; } } beecrypt-4.2.1/c++/io/Writer.cxx0000664000175000001440000000413210207105727013232 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/io/Writer.h" #include "beecrypt/c++/lang/IllegalArgumentException.h" using beecrypt::lang::IllegalArgumentException; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::io; Writer::Writer() { lock = this; } Writer::Writer(Object& lock) : lock(&lock) { } Writer& Writer::append(jchar c) throw (IOException) { write(c); return *this; } Writer& Writer::append(const CharSequence& cseq) throw (IOException) { write(cseq.toString()); return *this; } void Writer::write(jint c) throw (IOException) { synchronized (lock) { jchar tmp = c; write(&tmp, 0, 1); } } void Writer::write(const array& cbuf) throw (IOException) { synchronized (lock) { write(cbuf.data(), 0, cbuf.size()); } } void Writer::write(const String& str) throw (IOException) { synchronized (lock) { const array& tmp = str.toCharArray(); write(tmp.data(), 0, tmp.size()); } } void Writer::write(const String& str, jint off, jint len) throw (IOException) { if (off < 0 || len < 0 || off + len >= str.length()) throw IllegalArgumentException(); synchronized (lock) { const array& tmp = str.toCharArray(); write(tmp.data(), off, len); } } beecrypt-4.2.1/c++/util/0000777000175000001440000000000011226307272011663 500000000000000beecrypt-4.2.1/c++/util/Makefile.in0000644000175000001440000006346111226307161013653 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ TESTS = testlist$(EXEEXT) testdate$(EXEEXT) testprop$(EXEEXT) check_PROGRAMS = testlist$(EXEEXT) testdate$(EXEEXT) testprop$(EXEEXT) subdir = c++/util DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxutil_la_DEPENDENCIES = concurrent/libcxxutilconcurrent.la am_libcxxutil_la_OBJECTS = Date.lo Properties.lo libcxxutil_la_OBJECTS = $(am_libcxxutil_la_OBJECTS) am_testdate_OBJECTS = testdate.$(OBJEXT) testdate_OBJECTS = $(am_testdate_OBJECTS) testdate_DEPENDENCIES = ../libbeecrypt_cxx.la am_testlist_OBJECTS = testlist.$(OBJEXT) testlist_OBJECTS = $(am_testlist_OBJECTS) testlist_DEPENDENCIES = ../libbeecrypt_cxx.la am_testprop_OBJECTS = testprop.$(OBJEXT) testprop_OBJECTS = $(am_testprop_OBJECTS) testprop_DEPENDENCIES = ../libbeecrypt_cxx.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxutil_la_SOURCES) $(testdate_SOURCES) \ $(testlist_SOURCES) $(testprop_SOURCES) DIST_SOURCES = $(libcxxutil_la_SOURCES) $(testdate_SOURCES) \ $(testlist_SOURCES) $(testprop_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = concurrent . noinst_LTLIBRARIES = libcxxutil.la cxxutildir = $(pkgincludedir)/c++/util libcxxutil_la_SOURCES = \ Date.cxx \ Properties.cxx libcxxutil_la_LIBADD = concurrent/libcxxutilconcurrent.la testlist_SOURCES = testlist.cxx testlist_LDADD = ../libbeecrypt_cxx.la testdate_SOURCES = testdate.cxx testdate_LDADD = ../libbeecrypt_cxx.la testprop_SOURCES = testprop.cxx testprop_LDADD = ../libbeecrypt_cxx.la all: all-recursive .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/util/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/util/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxutil.la: $(libcxxutil_la_OBJECTS) $(libcxxutil_la_DEPENDENCIES) $(CXXLINK) $(libcxxutil_la_OBJECTS) $(libcxxutil_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list testdate$(EXEEXT): $(testdate_OBJECTS) $(testdate_DEPENDENCIES) @rm -f testdate$(EXEEXT) $(CXXLINK) $(testdate_OBJECTS) $(testdate_LDADD) $(LIBS) testlist$(EXEEXT): $(testlist_OBJECTS) $(testlist_DEPENDENCIES) @rm -f testlist$(EXEEXT) $(CXXLINK) $(testlist_OBJECTS) $(testlist_LDADD) $(LIBS) testprop$(EXEEXT): $(testprop_OBJECTS) $(testprop_DEPENDENCIES) @rm -f testprop$(EXEEXT) $(CXXLINK) $(testprop_OBJECTS) $(testprop_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Date.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Properties.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testprop.Po@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/util/Makefile.am0000664000175000001440000000106510502514222013626 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = concurrent . noinst_LTLIBRARIES = libcxxutil.la cxxutildir= $(pkgincludedir)/c++/util libcxxutil_la_SOURCES =\ Date.cxx \ Properties.cxx libcxxutil_la_LIBADD = concurrent/libcxxutilconcurrent.la TESTS = testlist testdate testprop check_PROGRAMS = testlist testdate testprop testlist_SOURCES = testlist.cxx testlist_LDADD = ../libbeecrypt_cxx.la testdate_SOURCES = testdate.cxx testdate_LDADD = ../libbeecrypt_cxx.la testprop_SOURCES = testprop.cxx testprop_LDADD = ../libbeecrypt_cxx.la beecrypt-4.2.1/c++/util/testlist.cxx0000664000175000001440000000375710176755057014227 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/util/ArrayList.h" using beecrypt::util::ArrayList; template class ArrayList; #include int main() { try { ArrayList l; String* s1 = new String("abc"); String* s2 = new String("cde"); std::cout << "l.size() = " << l.size() << std::endl; l.add(s1); l.add(s2); std::cout << "the lot: " << l.toString() << std::endl; ArrayList m; m.addAll(l); Iterator* it = l.iterator(); if (it) { while (it->hasNext()) { String* s = it->next(); std::cout << "got String [" << *s << "]" << std::endl; } std::cout << "no more strings available" << std::endl; delete it; } if (l.remove(s1)) std::cout << "removed first string" << std::endl; else std::cout << "failed to remove first string" << std::endl; std::cout << "l.size() = " << l.size() << std::endl; l.clear(); std::cout << "l.size() = " << l.size() << std::endl; std::cout << "m.size() = " << m.size() << std::endl; std::cout << "that was all, folks!" << std::endl; } catch (Exception& e) { std::cout << "Exception:" << e.getMessage() << std::endl; } } beecrypt-4.2.1/c++/util/testdate.cxx0000644000175000001440000000212211216147022014127 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/util/Date.h" using beecrypt::util::Date; #include #include using namespace std; int main(int argc, char* argv[]) { Date now; // cout << now.toString() << endl; } beecrypt-4.2.1/c++/util/concurrent/0000777000175000001440000000000011226307272014045 500000000000000beecrypt-4.2.1/c++/util/concurrent/Makefile.in0000644000175000001440000004750511226307161016036 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = c++/util/concurrent DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxutilconcurrent_la_DEPENDENCIES = \ locks/libcxxutilconcurrentlocks.la am_libcxxutilconcurrent_la_OBJECTS = libcxxutilconcurrent_la_OBJECTS = \ $(am_libcxxutilconcurrent_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxutilconcurrent_la_SOURCES) DIST_SOURCES = $(libcxxutilconcurrent_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = locks . noinst_LTLIBRARIES = libcxxutilconcurrent.la cxxutilconcurrentdir = $(pkgincludedir)/c++/util/concurrent libcxxutilconcurrent_la_SOURCES = libcxxutilconcurrent_la_LIBADD = locks/libcxxutilconcurrentlocks.la all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/util/concurrent/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/util/concurrent/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxutilconcurrent.la: $(libcxxutilconcurrent_la_OBJECTS) $(libcxxutilconcurrent_la_DEPENDENCIES) $(LINK) $(libcxxutilconcurrent_la_OBJECTS) $(libcxxutilconcurrent_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/util/concurrent/Makefile.am0000664000175000001440000000043710502514344016017 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = locks . noinst_LTLIBRARIES = libcxxutilconcurrent.la cxxutilconcurrentdir= $(pkgincludedir)/c++/util/concurrent libcxxutilconcurrent_la_SOURCES = libcxxutilconcurrent_la_LIBADD = locks/libcxxutilconcurrentlocks.la beecrypt-4.2.1/c++/util/concurrent/locks/0000777000175000001440000000000011226307272015160 500000000000000beecrypt-4.2.1/c++/util/concurrent/locks/Makefile.in0000644000175000001440000004721011226307161017142 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ TESTS = testthread$(EXEEXT) check_PROGRAMS = testthread$(EXEEXT) subdir = c++/util/concurrent/locks DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxutilconcurrentlocks_la_LIBADD = am_libcxxutilconcurrentlocks_la_OBJECTS = ReentrantLock.lo libcxxutilconcurrentlocks_la_OBJECTS = \ $(am_libcxxutilconcurrentlocks_la_OBJECTS) am_testthread_OBJECTS = testthread.$(OBJEXT) testthread_OBJECTS = $(am_testthread_OBJECTS) testthread_DEPENDENCIES = ../../../libbeecrypt_cxx.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxutilconcurrentlocks_la_SOURCES) \ $(testthread_SOURCES) DIST_SOURCES = $(libcxxutilconcurrentlocks_la_SOURCES) \ $(testthread_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxutilconcurrentlocks.la cxxutilconcurrentlocksdir = $(pkgincludedir)/c++/util/concurrent/locks libcxxutilconcurrentlocks_la_SOURCES = \ ReentrantLock.cxx testthread_SOURCES = testthread.cxx testthread_LDADD = ../../../libbeecrypt_cxx.la all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/util/concurrent/locks/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/util/concurrent/locks/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxutilconcurrentlocks.la: $(libcxxutilconcurrentlocks_la_OBJECTS) $(libcxxutilconcurrentlocks_la_DEPENDENCIES) $(CXXLINK) $(libcxxutilconcurrentlocks_la_OBJECTS) $(libcxxutilconcurrentlocks_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list testthread$(EXEEXT): $(testthread_OBJECTS) $(testthread_DEPENDENCIES) @rm -f testthread$(EXEEXT) $(CXXLINK) $(testthread_OBJECTS) $(testthread_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ReentrantLock.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testthread.Po@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/util/concurrent/locks/Makefile.am0000664000175000001440000000056510502514257017137 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxutilconcurrentlocks.la cxxutilconcurrentlocksdir= $(pkgincludedir)/c++/util/concurrent/locks libcxxutilconcurrentlocks_la_SOURCES = \ ReentrantLock.cxx TESTS = testthread check_PROGRAMS = testthread testthread_SOURCES = testthread.cxx testthread_LDADD = ../../../libbeecrypt_cxx.la beecrypt-4.2.1/c++/util/concurrent/locks/ReentrantLock.cxx0000664000175000001440000000516110245537453020406 00000000000000/* * Copyright (c) 2004, 2005 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/Thread.h" using beecrypt::lang::Thread; #include "beecrypt/c++/util/concurrent/locks/ReentrantLock.h" using namespace beecrypt::util::concurrent::locks; ReentrantLock::Cond::Cond(Object* lock) : lock(lock) { } void ReentrantLock::Cond::await() throw (InterruptedException) { lock->wait(0); } void ReentrantLock::Cond::awaitUninterruptibly() { while (true) { try { lock->wait(0); return; } catch (InterruptedException&) { } } } void ReentrantLock::Cond::signal() { lock->notify(); } void ReentrantLock::Cond::signalAll() { lock->notifyAll(); } ReentrantLock::ReentrantLock(bool fair) { monitor = Monitor::getInstance(fair); } void ReentrantLock::lock() { Thread* t = Thread::currentThread(); if (t) { t->_state = Thread::BLOCKED; t->_monitoring = monitor; } monitor->lock(); if (t) { t->_state = Thread::RUNNABLE; t->_monitoring = t->monitor; } } void ReentrantLock::lockInterruptibly() throw (InterruptedException) { bool interrupted = false; Thread* t = Thread::currentThread(); if (t) { t->_state = Thread::BLOCKED; t->_monitoring = monitor; } try { monitor->lockInterruptibly(); } catch (InterruptedException&) { interrupted = true; } if (t) { t->_state = Thread::RUNNABLE; t->_monitoring = t->monitor; } if (interrupted) throw InterruptedException(); } Condition* ReentrantLock::newCondition() { return new Cond(this); } bool ReentrantLock::tryLock() { bool result; Thread* t = Thread::currentThread(); if (t) { t->_state = Thread::BLOCKED; t->_monitoring = monitor; } result = monitor->tryLock(); if (t) { t->_state = Thread::RUNNABLE; t->_monitoring = t->monitor; } return result; } void ReentrantLock::unlock() { monitor->unlock(); } beecrypt-4.2.1/c++/util/concurrent/locks/testthread.cxx0000644000175000001440000000446411216147022017771 00000000000000/* * Copyright (c) 2005 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/Thread.h" using beecrypt::lang::Thread; #include "beecrypt/c++/util/concurrent/locks/ReentrantLock.h" using beecrypt::util::concurrent::locks::ReentrantLock; #include using namespace std; class Worker : public Thread { private: size_t _count; protected: ReentrantLock lock; Condition* cond; public: Worker(const char* ident) : Thread(ident), _count(0) { cond = lock.newCondition(); } ~Worker() { delete cond; } virtual void run() { cout << "Worker[" << getName() << "] starting" << endl; try { while (!isInterrupted()) { pop(); cout << "Worker[" << getName() << "] popped" << endl; } } catch (InterruptedException) { cout << "Worker[" << getName() << "] interrupted" << endl; } cout << "Worker[" << getName() << "] ending" << endl; } void pop() throw (InterruptedException) { lock.lock(); try { if (_count == 0) cond->await(); _count--; lock.unlock(); } catch (...) { lock.unlock(); throw; } } void push() { lock.lock(); _count++; cond->signal(); lock.unlock(); } }; int main(int argc, char* argv[]) { try { Worker a("a"); Worker b("b"); a.start(); a.sleep(100); b.start(); b.sleep(100); a.push(); a.push(); b.push(); a.push(); a.yield(); b.interrupt(); a.push(); a.yield(); a.interrupt(); a.yield(); b.join(); a.join(); } catch (Exception& e) { std::cout << "Exception:" << e.getMessage() << std::endl; } } beecrypt-4.2.1/c++/util/Properties.cxx0000664000175000001440000001206610232112745014461 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/util/Properties.h" using beecrypt::util::Properties; #include "beecrypt/c++/util/Date.h" using beecrypt::util::Date; #include "beecrypt/c++/io/DataInputStream.h" using beecrypt::io::DataInputStream; #include "beecrypt/c++/io/PrintStream.h" using beecrypt::io::PrintStream; using namespace beecrypt::util; Properties::Names::Names(Hashtable& h) : _list(h.size()) { Iterator::Entry>* it = h.entrySet().iterator(); _pos = 0; while (it->hasNext()) { const String* name = dynamic_cast(it->next()->getKey()); if (name) _list[_pos++] = new String(*name); else _list[_pos++] = 0; } _pos = 0; } Properties::Names::~Names() { for (int i = 0; i < _list.size(); i++) delete _list[i]; } bool Properties::Names::hasMoreElements() throw () { return _pos < _list.size(); } const String* Properties::Names::nextElement() throw (NoSuchElementException) { if (_pos >= _list.size()) throw NoSuchElementException(); return _list[_pos++]; } Properties::Properties() { defaults = 0; } Properties::Properties(const Properties& copy) { defaults = copy.defaults; putAll(copy); } Properties::Properties(const Properties* defaults) : defaults(defaults) { } void Properties::enumerate(Hashtable& h) const { if (defaults) defaults->enumerate(h); Iterator::Entry>* it = entrySet().iterator(); assert(it != 0); while (it->hasNext()) { class Map::Entry* p = it->next(); const String* key = dynamic_cast(p->getKey()); if (key) { const String* value = dynamic_cast(p->getValue()); if (value) { String* newKey = new String(*key); String* newValue = new String(*value); Object* oldValue = h.put(newKey, newValue); if (oldValue) { delete newKey; delete oldValue; } } } } delete it; } const String* Properties::getProperty(const String& key) const throw () { const String* result = dynamic_cast(Hashtable::get(&key)); if (!result && defaults) return defaults->getProperty(key); else return result; } const String* Properties::getProperty(const String& key, const String& defaultValue) const throw () { const String* result = getProperty(key); if (result) return result; else return &defaultValue; } Object* Properties::setProperty(const String& key, const String& value) { String* tmp = new String(key); Object* result = put(tmp, new String(value)); if (result) // Hashtable already contained key tmp; we can free it delete tmp; return result; } Enumeration* Properties::propertyNames() const { Hashtable h; enumerate(h); return new Names(h); } void Properties::load(InputStream& in) throw (IOException) { String line; DataInputStream dis(in); try { synchronized (this) { while (dis.available()) { line = dis.readLine(); if (line.indexOf((UChar) 0x23) != 0) { // more advanced parsing can come later // see if we can find an '=' somewhere inside the string int32_t eqidx = line.indexOf((UChar) 0x3D); if (eqidx >= 0) { // we can split the line into two parts Object* tmp = put(new String(line.substring(0, eqidx)), new String(line.substring(eqidx+1))); if (tmp) delete tmp; } } // else it's a comment line which we discard } } } catch (IOException&) { throw; } } void Properties::store(OutputStream& out, const String& header) throw (IOException) { /*!\todo first enumerate (recursively) into a new Hashtable, then get all the keys from it */ Date now; /*!\todo use an OutputWriter instead of a PrintStream */ PrintStream ps(out); ps.println("# " + header); ps.println("# " + now.toString()); synchronized (this) { Iterator::Entry>* it = entrySet().iterator(); assert (it != 0); while (it->hasNext()) { class Map::Entry* p = it->next(); const String* key = dynamic_cast(p->getKey()); if (key) { const String* value = dynamic_cast(p->getValue()); if (value) { ps.print(*key); ps.print((jchar) 0x3D); ps.println(*value); } } } } } beecrypt-4.2.1/c++/util/testprop.cxx0000664000175000001440000000276110177665311014220 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/System.h" using beecrypt::lang::System; #include "beecrypt/c++/util/Properties.h" using beecrypt::util::Properties; #include #include using namespace std; #include int main(int argc, char* argv[]) { Properties p; p.setProperty("apple", "red"); p.setProperty("yam", "orange"); p.setProperty("lime", "green"); p.setProperty("grape", "blue"); #if 0 Enumeration* e = p.propertyNames(); while (e->hasMoreElements()) { const String* s = e->nextElement(); cout << *s << endl; } delete e; #endif p.store(System::out, "properties test"); } beecrypt-4.2.1/c++/util/Date.cxx0000644000175000001440000000440611216147022013176 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/timestamp.h" #include "beecrypt/c++/util/Date.h" #include namespace { #if WIN32 __declspec(thread) DateFormat* format = 0; #else __thread DateFormat* format = 0; #endif } using namespace beecrypt::util; Date::Date() throw () { _time = timestamp(); } Date::Date(jlong time) throw () { _time = time; } bool Date::equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const Date* d = dynamic_cast(obj); if (d) return _time == d->_time; } return false; } bool Date::equals(const Date& d) const throw () { return _time == d._time; } Date* Date::clone() const throw () { return new Date(_time); } jint Date::compareTo(const Date& d) const throw () { if (_time == d._time) return 0; else if (_time < d._time) return -1; else return 1; } jint Date::hashCode() const throw () { return (jint) _time ^ (jint)(_time >> 32); } bool Date::after(const Date& cmp) const throw () { return _time > cmp._time; } bool Date::before(const Date& cmp) const throw () { return _time < cmp._time; } jlong Date::getTime() const throw () { return _time; } void Date::setTime(jlong time) throw () { _time = time; } String Date::toString() const throw () { String result; if (!format) format = DateFormat::createDateTimeInstance(); UnicodeString tmp; result = format->format((UDate) _time, tmp); return result; } beecrypt-4.2.1/c++/math/0000777000175000001440000000000011226307272011637 500000000000000beecrypt-4.2.1/c++/math/testbigint.cxx0000644000175000001440000000207411216147022014450 00000000000000#ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; int main() { int failures = 0; std::cout << BigInteger::TEN.add(BigInteger::TEN).negate().toString() << std::endl; std::cout << BigInteger::ONE.add(BigInteger::TEN.negate()).toString() << std::endl; std::cout << BigInteger::TEN.add(BigInteger::ONE.negate()).toString() << std::endl; std::cout << BigInteger::TEN.subtract(BigInteger::TEN).toString() << std::endl; std::cout << BigInteger::ZERO.subtract(BigInteger::TEN).toString() << std::endl; std::cout << BigInteger::ONE.subtract(BigInteger::TEN).toString() << std::endl; std::cout << BigInteger::TEN.subtract(BigInteger::ONE).toString() << std::endl; std::cout << BigInteger::TEN.multiply(BigInteger::TEN).subtract(BigInteger::ONE).toString() << std::endl; std::cout << BigInteger::valueOf(97).toString() << std::endl; BigInteger n = BigInteger::ONE.negate(); BigInteger m = n.add(BigInteger::ONE); if (m == BigInteger::ZERO) printf("success\n"); else failures++; return failures; } beecrypt-4.2.1/c++/math/Makefile.in0000644000175000001440000004657511226307161013636 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ TESTS = testbigint$(EXEEXT) check_PROGRAMS = testbigint$(EXEEXT) subdir = c++/math DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxmath_la_LIBADD = am_libcxxmath_la_OBJECTS = BigInteger.lo libcxxmath_la_OBJECTS = $(am_libcxxmath_la_OBJECTS) am_testbigint_OBJECTS = testbigint.$(OBJEXT) testbigint_OBJECTS = $(am_testbigint_OBJECTS) testbigint_DEPENDENCIES = ../libbeecrypt_cxx.la ../../libbeecrypt.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxmath_la_SOURCES) $(testbigint_SOURCES) DIST_SOURCES = $(libcxxmath_la_SOURCES) $(testbigint_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxmath.la cxxmathdir = $(pkgincludedir)/c++/math libcxxmath_la_SOURCES = \ BigInteger.cxx testbigint_SOURCES = testbigint.cxx testbigint_LDADD = ../libbeecrypt_cxx.la ../../libbeecrypt.la all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/math/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/math/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxmath.la: $(libcxxmath_la_OBJECTS) $(libcxxmath_la_DEPENDENCIES) $(CXXLINK) $(libcxxmath_la_OBJECTS) $(libcxxmath_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list testbigint$(EXEEXT): $(testbigint_OBJECTS) $(testbigint_DEPENDENCIES) @rm -f testbigint$(EXEEXT) $(CXXLINK) $(testbigint_OBJECTS) $(testbigint_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BigInteger.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testbigint.Po@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/math/Makefile.am0000644000175000001440000000050311216155242013602 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxmath.la cxxmathdir=$(pkgincludedir)/c++/math libcxxmath_la_SOURCES = \ BigInteger.cxx TESTS = testbigint check_PROGRAMS = testbigint testbigint_SOURCES = testbigint.cxx testbigint_LDADD = ../libbeecrypt_cxx.la ../../libbeecrypt.la beecrypt-4.2.1/c++/math/BigInteger.cxx0000644000175000001440000003164111216147022014315 00000000000000/* * Copyright (c) 2005 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/math/BigInteger.h" #include "beecrypt/c++/lang/Character.h" using beecrypt::lang::Character; #include "beecrypt/c++/lang/StringBuilder.h" using beecrypt::lang::StringBuilder; #include "beecrypt/c++/lang/ArithmeticException.h" using beecrypt::lang::ArithmeticException; #include "beecrypt/c++/lang/OutOfMemoryError.h" using beecrypt::lang::OutOfMemoryError; #include using namespace beecrypt::math; namespace { const String STRZERO("0"); } const BigInteger BigInteger::ZERO; const BigInteger BigInteger::ONE(1); const BigInteger BigInteger::TEN(10); BigInteger::BigInteger() : size(0), data(0), sign(0) { } BigInteger::BigInteger(jlong val) { if (val == 0) { size = 0; data = 0; sign = 0; } else { if (val < 0) { sign = -1; val = -val; } else sign = 1; if (sizeof(jlong) == sizeof(mpw)) size = 1; else size = 2; data = (mpw*) malloc(size * sizeof(mpw)); if (data == 0) throw OutOfMemoryError(); if (sizeof(jlong) == sizeof(mpw)) { data[0] = val; } else { data[0] = (val >> 32); data[1] = (val ); } } } BigInteger::BigInteger(size_t size, mpw* data, int sign) : size(size), data(data), sign(sign) { } BigInteger::BigInteger(const bytearray& val) { if (val.size() == 0) { size = 0; data = 0; sign = 0; } else { int skip = 0; while ((skip < val.size()) && (val[skip] == 0)) skip++; size = MP_BYTES_TO_WORDS(val.size() - skip + MP_WBYTES - 1); data = (mpw*) malloc(size * sizeof(mpw)); if (data == 0) throw OutOfMemoryError(); os2ip(data, size, val.data(), val.size()); if (val[0] & 0x80) { mpneg(size, data); sign = -1; } else sign = 1; } } BigInteger::BigInteger(const mpnumber& n) { if (mpz(n.size, n.data)) { size = 0; data = 0; sign = 0; } else { size_t sigbits = mpbits(n.size, n.data); size = MP_BITS_TO_WORDS(sigbits + MP_WBITS - 1); data = (mpw*) malloc(size * sizeof(mpw)); if (data == 0) throw new OutOfMemoryError(); // eliminate zero most-significant-words mpcopy(size, data, n.data + n.size - size); sign = 1; } } BigInteger::BigInteger(const mpbarrett& b) { if (mpz(b.size, b.modl)) { size = 0; data = 0; sign = 0; } else { size_t sigbits = mpbits(b.size, b.modl); size = MP_BITS_TO_WORDS(sigbits + MP_WBITS - 1); data = (mpw*) malloc(size * sizeof(mpw)); if (data == 0) throw new OutOfMemoryError(); // eliminate zero most-significant-words mpcopy(size, data, b.modl + b.size - size); sign = 1; } } BigInteger::BigInteger(const BigInteger& copy) : size(copy.size), sign(copy.sign) { if (sign) { data = (mpw*) malloc(size * sizeof(mpw)); if (data == 0) throw OutOfMemoryError(); mpcopy(size, data, copy.data); } else data = 0; } BigInteger::~BigInteger() { if (sign) free(data); } BigInteger& BigInteger::operator=(const BigInteger& copy) { if (copy.sign == 0) { if (sign) { delete data; size = 0; data = 0; sign = 0; } } else { if (size != copy.size) { data = (mpw*) realloc(data, (size = copy.size) * sizeof(mpw)); if (data == 0) throw OutOfMemoryError(); } mpcopy(size, data, copy.data); sign = copy.sign; } return *this; } bool BigInteger::operator==(const BigInteger& val) const throw () { return (sign == val.sign) && ((sign == 0) || mpeqx(size, data, val.size, val.data)); } bool BigInteger::operator!=(const BigInteger& val) const throw () { return (sign != val.sign) || ((sign != 0) && mpnex(size, data, val.size, val.data)); } BigInteger BigInteger::valueOf(jlong val) { return BigInteger(val); } jint BigInteger::hashCode() const throw () { return 0; } jbyte BigInteger::byteValue() const throw () { return (jbyte) (sign * data[size-1]); } jshort BigInteger::shortValue() const throw () { return (jshort) (sign * data[size-1]); } jint BigInteger::intValue() const throw () { return (jint) (sign * data[size-1]); } jlong BigInteger::longValue() const throw () { #if MP_WBITS == 64 return (jlong) (sign * data[size-1]); #else if (size == 1) return (jlong) (sign * data[size-1]); else return (jlong) (sign * ((data[size-2] << 32) + data[size-1])); #endif } jint BigInteger::compareTo(const BigInteger& val) const throw () { if (sign == val.sign) { if (sign == 0) return 0; return sign * mpcmpx(size, data, val.size, val.data); } else return (sign > val.sign) ? 1 : -1; } bool BigInteger::equals(const Object* obj) const throw () { if (this == obj) return true; const BigInteger* cmp = dynamic_cast(obj); if (cmp) { if (sign != cmp->sign) return false; if (sign && mpnex(size, data, cmp->size, cmp->data)) return false; return true; } return false; } String BigInteger::toString() const throw () { return toString(10); } String BigInteger::toString(int radix) const { if (radix < Character::MIN_RADIX || radix > Character::MAX_RADIX) radix = 10; if (sign == 0) return STRZERO; StringBuilder tmp; /* allocate enough space to hold a copy of this (size+1), result (size+2) and workspace (2) */ mpw* rdata = (mpw*) malloc((2*size+5) * sizeof(mpw)); if (rdata) { mpw* result = rdata+size+1; mpw* wksp = result+size+2; mpw nradix = radix; mpsetx(size+1, rdata, size, data); size_t shift = mpnorm(1, &nradix); mplshift(size+1, rdata, shift); do { int remainder; mpndivmod(result, size+1, rdata, 1, &nradix, wksp); remainder = (result[size+1] >> shift); mpcopy(size+1, rdata, result); mplshift(size+1, rdata, shift); if (remainder < 10) tmp.append((jchar)(48 + remainder)); else tmp.append((jchar)(55 + remainder)); } while (mpnz(size+1, rdata)); free(rdata); if (sign < 0) tmp.append('-'); return tmp.reverse().toString(); } else throw OutOfMemoryError(); } jint BigInteger::signum() const throw () { return sign; } BigInteger BigInteger::add(const BigInteger& val) const { if (val.sign == 0) return *this; if (sign == 0) return val; if (sign == val.sign) { size_t rsize = size > val.size ? size : val.size; // allocate one extra word for addition carry-over mpw* rdata = (mpw*) malloc((rsize+1) * sizeof(mpw)); if (rdata == 0) throw OutOfMemoryError(); mpsetx(rsize, rdata, size, data); if (mpaddx(rsize, rdata, val.size, val.data)) { // there was a carry-over; move result up by one word mpmove(rsize, rdata+1, rdata); rsize++; rdata[0] = 1; } return BigInteger(rsize, rdata, sign); } else { int cmp = mpcmpx(size, data, val.size, val.data); if (cmp == 0) return ZERO; // subtract the smallest from the biggest value size_t rsize = (cmp < 0) ? val.size : size; mpw* rdata = (mpw*) malloc(rsize * sizeof(mpw)); if (rdata == 0) throw OutOfMemoryError(); if (cmp < 0) { mpcopy(rsize, rdata, val.data); mpsubx(rsize, rdata, size, data); } else { mpcopy(rsize, rdata, data); mpsubx(rsize, rdata, val.size, val.data); } size_t skip = 0; while ((skip < rsize) && rdata[skip] == 0) skip++; if (skip == rsize) { free(rdata); return ZERO; } if (skip) { rsize -= skip; mpmove(rsize, rdata, rdata+skip); } return BigInteger(rsize, rdata, cmp * sign); } } BigInteger BigInteger::subtract(const BigInteger& val) const { if (sign == 0) return val.negate(); if (val.sign == 0) return *this; if (sign != val.sign) { size_t rsize = size > val.size ? size : val.size; // allocate one extra word for addition carry-over mpw* rdata = (mpw*) malloc((rsize+1) * sizeof(mpw)); if (rdata == 0) throw OutOfMemoryError(); mpsetx(rsize, rdata, size, data); if (mpaddx(rsize, rdata, val.size, val.data)) { // there was a carry-over; move result up by one word mpmove(rsize, rdata+1, rdata); rsize++; rdata[0] = 1; } return BigInteger(rsize, rdata, sign); } else { int cmp = mpcmpx(size, data, val.size, val.data); if (cmp == 0) return ZERO; // subtract the smallest from the biggest value, so we don't get a carry size_t rsize = (cmp < 0) ? val.size : size; mpw* rdata = (mpw*) malloc(rsize * sizeof(mpw)); if (rdata == 0) throw OutOfMemoryError(); if (cmp < 0) { mpcopy(rsize, rdata, val.data); mpsubx(rsize, rdata, size, data); } else { mpcopy(rsize, rdata, data); mpsubx(rsize, rdata, val.size, val.data); } size_t skip = 0; while ((skip < rsize) && (rdata[skip] == 0)) skip++; if (skip) { rsize -= skip; mpmove(rsize, rdata, rdata+skip); } return BigInteger(rsize, rdata, cmp * sign); } } BigInteger BigInteger::multiply(const BigInteger& val) const { if (sign == 0 || val.sign == 0) return BigInteger(); size_t rsize = size + val.size; mpw* rdata = (mpw*) malloc(rsize * sizeof(mpw)); if (rdata == 0) throw OutOfMemoryError(); mpmul(rdata, size, data, val.size, val.data); if (rdata[0] == 0) { rsize--; mpmove(rsize, rdata, rdata+1); } return BigInteger(rsize, rdata, sign * val.sign); } #if 0 BigInteger BigInteger::mod(const BigInteger& m) const throw (ArithmeticException) { if (m.compareTo(ZERO) <= 0) throw ArithmeticException("m must be > 0"); if (mpltx(size, data, m.size, m.data)) { if (sign == -1) return m.subtract(*this); else return *this; } else { mpw* tmp = (mpw*) malloc(size + 2*m.size+1); if (tmp == 0) throw OutOfMemoryError(); mpmod(tmp, size, data, m.size, m.data, tmp+size); if (sign == -1) { mpneg(size, tmp); mpaddx(size, tmp, m.size, m.data); } size_t skip = 0; while ((skip < size) && (tmp[skip] == 0)) skip++; if (skip == size) { free(tmp); return ZERO; } if (skip) mpmove(size - skip, tmp, tmp + skip); return BigInteger(size - skip, tmp, 1); } } BigInteger BigInteger::modPow(const BigInteger& exponent, const BigInteger& m) const { // if the modulus is not positive, bail out if (m.sign <= 0) throw ArithmeticException("modulus must be > 0"); // this ^ 0 mod m is 1 except when m == 1, when it is 0 // 1 ^ exponent mod m is 1 except when m == 1, when it is 0 if (exponent.sign == 0 || equals(&ONE)) { if (m.equals(&ONE)) return ZERO; else return ONE; } // 0 ^ exponent mod m is 0 when exponent != 0 (which was already excluded earlier) if (equals(&ZERO)) return ZERO; // we need to bring this into the range 0 .. (m-1) // if the exponent is negative, compute the modular inverse of this before } #endif BigInteger BigInteger::negate() const { if (mpz(size, data)) return BigInteger(); mpw* rdata = (mpw*) malloc(size * sizeof(mpw)); if (rdata == 0) throw OutOfMemoryError(); mpcopy(size, rdata, data); return BigInteger(size, rdata, -sign); } bytearray* BigInteger::toByteArray() const { bytearray* result = new bytearray(); toByteArray(*result); return result; } void BigInteger::toByteArray(bytearray& b) const { if (sign == 0) { b.resize(1); b[0] = 0; } else if (sign == 1) { size_t sigbits = mpbits(size, data); size_t req = (sigbits+8) >> 3; b.resize(req); i2osp(b.data(), req, data, size); } else { size_t sigbits = mpbits(size, data); size_t req = (sigbits+7) >> 3; b.resize(req); mpw* tmp = (mpw*) malloc(size * sizeof(mpw)); if (tmp == 0) throw OutOfMemoryError(); mpcopy(size, tmp, data); mpneg(size, tmp); i2osp(b.data(), req, tmp, size); free(tmp); } } #if 0 void beecrypt::math::transform(BigInteger& b, const mpnumber& n) { if (mpz(n.size, n.data)) { if (b.sign) { free(b.data); b.size = 0; b.data = 0; b.sign = 0; } } else { if (b.size != n.size) { b.data = (mpw*) realloc(b.data, b.size * sizeof(mpw)); if (b.data == 0) throw OutOfMemoryError(); } mpcopy(b.size, b.data, n.data); b.sign = 1; } } #endif void beecrypt::math::transform(mpnumber& n, const BigInteger& val) { switch (val.sign) { case 0: mpnfree(&n); break; case 1: mpnset(&n, val.size, val.data); break; default: throw IllegalArgumentException("can only transform non-negative numbers"); } } void beecrypt::math::transform(mpbarrett& b, const BigInteger& val) { switch (val.sign) { case 0: mpbfree(&b); break; case 1: mpbset(&b, val.size, val.data); break; default: throw IllegalArgumentException("can only transform non-negative numbers"); } } beecrypt-4.2.1/c++/testdhies.cxx0000664000175000001440000000537310227176501013353 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/AlgorithmParameterGenerator.h" using beecrypt::security::AlgorithmParameterGenerator; #include "beecrypt/c++/security/KeyPairGenerator.h" using beecrypt::security::KeyPairGenerator; #include "beecrypt/c++/crypto/Cipher.h" using beecrypt::crypto::Cipher; #include "beecrypt/c++/crypto/interfaces/DHPublicKey.h" using beecrypt::crypto::interfaces::DHPublicKey; #include "beecrypt/c++/crypto/interfaces/DHPrivateKey.h" using beecrypt::crypto::interfaces::DHPrivateKey; #include "beecrypt/c++/beeyond/DHIESParameterSpec.h" using beecrypt::beeyond::DHIESParameterSpec; #include using std::type_info; #include using namespace std; #include int main(int argc, char* argv[]) { int failures = 0; try { bytearray original(31415); SecureRandom::getSeed(original.data(), original.size()); KeyPairGenerator* kpg = KeyPairGenerator::getInstance("DiffieHellman"); kpg->initialize(1024); KeyPair* pair = kpg->generateKeyPair(); Cipher* c = Cipher::getInstance("DHIES"); c->init(Cipher::ENCRYPT_MODE, pair->getPublic(), DHIESParameterSpec("SHA-512", "AES", "HMAC-SHA-512")); size_t ciphertextsize = c->getOutputSize(original.size()); bytearray ciphertext(ciphertextsize); size_t used = c->doFinal(original.data(), 0, original.size(), ciphertext, 0); ciphertext.resize(used); AlgorithmParameters* p = c->getParameters(); c->init(Cipher::DECRYPT_MODE, pair->getPrivate(), p); size_t cleartextsize = c->getOutputSize(ciphertext.size()); bytearray cleartext(cleartextsize); used = c->doFinal(ciphertext.data(), 0, ciphertext.size(), cleartext, 0); cleartext.resize(used); if (original != cleartext) failures++; delete p; delete c; delete pair; delete kpg; } catch (Exception& ex) { cerr << "Exception: " << *ex.getMessage() << endl; failures++; } catch (...) { cerr << "exception" << endl; failures++; } return failures; } beecrypt-4.2.1/c++/adapter.cxx0000644000175000001440000000316011216147021012757 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/adapter.h" using namespace beecrypt; int sraSetup(SecureRandom* random) { return 0; } int sraSeed(SecureRandom* random, const byte* data, size_t size) { random->setSeed(data, size); return 0; } int sraNext(SecureRandom* random, byte* data, size_t size) { random->nextBytes(data, size); return 0; } int sraCleanup(SecureRandom* random) { return 0; } const randomGenerator sraprng = { "SecureRandom Adapter", 0, (randomGeneratorSetup) sraSetup, (randomGeneratorSeed) sraSeed, (randomGeneratorNext) sraNext, (randomGeneratorCleanup) sraCleanup }; randomGeneratorContextAdapter::randomGeneratorContextAdapter(SecureRandom* random) : randomGeneratorContext(&sraprng) { param = (randomGeneratorParam*) random; } // SecureRandom systemsr; beecrypt-4.2.1/c++/resource.cxx0000644000175000001440000000172611216147021013174 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #include "beecrypt/c++/resource.h" #if WIN32 const char* BEECRYPT_CONF_FILE = "beecrypt.conf"; #else const char* BEECRYPT_CONF_FILE = "/etc/beecrypt.conf"; #endif beecrypt-4.2.1/c++/beeyond/0000777000175000001440000000000011226307273012334 500000000000000beecrypt-4.2.1/c++/beeyond/testcert.cxx0000664000175000001440000000520510205574230014630 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeCertificate.h" using beecrypt::beeyond::BeeCertificate; #include "beecrypt/c++/io/ByteArrayInputStream.h" using beecrypt::io::ByteArrayInputStream; #include "beecrypt/c++/security/AlgorithmParameterGenerator.h" using beecrypt::security::AlgorithmParameterGenerator; #include "beecrypt/c++/security/AlgorithmParameters.h" using beecrypt::security::AlgorithmParameters; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; #include "beecrypt/c++/security/KeyPairGenerator.h" using beecrypt::security::KeyPairGenerator; #include "beecrypt/c++/security/Signature.h" using beecrypt::security::Signature; #include "beecrypt/c++/security/cert/CertificateFactory.h" using beecrypt::security::cert::CertificateFactory; #include "beecrypt/c++/security/spec/EncodedKeySpec.h" using beecrypt::security::spec::EncodedKeySpec; #include using namespace std; #include int main(int argc, char* argv[]) { int failures = 0; try { KeyPairGenerator* kpg = KeyPairGenerator::getInstance("RSA"); kpg->initialize(1024); KeyPair* pair = kpg->generateKeyPair(); BeeCertificate* self = BeeCertificate::self(pair->getPublic(), pair->getPrivate(), "SHA1withRSA"); ByteArrayInputStream bis(self->getEncoded()); CertificateFactory* cf = CertificateFactory::getInstance(self->getType()); Certificate* cert = cf->generateCertificate(bis); cert->verify(pair->getPublic()); if (!cert->equals(self)) { std::cout << "cloned certificate differs" << std::endl; failures++; } delete cert; delete cf; delete self; delete pair; delete kpg; } catch (Exception& ex) { std::cerr << " type " << typeid(ex).name() << std::endl; failures++; } catch (...) { std::cerr << "exception" << std::endl; failures++; } return failures; } beecrypt-4.2.1/c++/beeyond/DHIESDecryptParameterSpec.cxx0000664000175000001440000000274110245547610017646 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/DHIESDecryptParameterSpec.h" using namespace beecrypt::beeyond; DHIESDecryptParameterSpec::DHIESDecryptParameterSpec(const DHIESParameterSpec& copy, const BigInteger& key, const bytearray& mac) : DHIESParameterSpec(copy), _pub(key), _mac(mac) { } DHIESDecryptParameterSpec::DHIESDecryptParameterSpec(const DHIESDecryptParameterSpec& copy) : DHIESParameterSpec(copy), _pub(copy._pub), _mac(copy._mac) { } const BigInteger& DHIESDecryptParameterSpec::getEphemeralPublicKey() const throw () { return _pub; } const bytearray& DHIESDecryptParameterSpec::getMac() const throw () { return _mac; } beecrypt-4.2.1/c++/beeyond/BeeCertificate.cxx0000644000175000001440000004130511216147022015626 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeCertificate.h" #include "beecrypt/c++/beeyond/AnyEncodedKeySpec.h" #include "beecrypt/c++/io/ByteArrayInputStream.h" using beecrypt::io::ByteArrayInputStream; #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/lang/ClassCastException.h" using beecrypt::lang::ClassCastException; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/Long.h" using beecrypt::lang::Long; #include "beecrypt/c++/lang/StringBuilder.h" using beecrypt::lang::StringBuilder; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; #include "beecrypt/c++/security/Signature.h" using beecrypt::security::Signature; #include "beecrypt/c++/security/cert/CertificateFactory.h" using beecrypt::security::cert::CertificateFactory; #include using std::auto_ptr; using namespace beecrypt::beeyond; Certificate* BeeCertificate::cloneCertificate(const Certificate& cert) throw (CloneNotSupportedException) { const Cloneable* c = dynamic_cast(&cert); if (c) { return dynamic_cast(c->clone()); } else { ByteArrayInputStream bis(cert.getEncoded()); try { auto_ptr cf(CertificateFactory::getInstance(cert.getType())); return cf->generateCertificate(bis); } catch (CertificateException&) { throw CloneNotSupportedException("Unable to clone Certificate through its encoding"); } catch (NoSuchAlgorithmException&) { throw CloneNotSupportedException("Unable to clone Certificate through CertificateFactory of type " + cert.getType()); } } } PublicKey* BeeCertificate::clonePublicKey(const PublicKey& key) throw (CloneNotSupportedException) { const Cloneable* c = dynamic_cast(&key); if (c) { return dynamic_cast(c->clone()); } else { try { auto_ptr kf(KeyFactory::getInstance(key.getAlgorithm())); PublicKey* p = dynamic_cast(kf->translateKey(key)); if (p) return p; else throw ClassCastException("KeyFactory didn't translate key into PublicKey"); } catch (NoSuchAlgorithmException&) { throw CloneNotSupportedException("Unable to clone key through KeyFactory of type " + key.getAlgorithm()); } catch (InvalidKeyException&) { throw CloneNotSupportedException("Unable to clone PublicKey because KeyFactory says it's invalid"); } } } BeeCertificate::UnknownField::UnknownField() throw () { } BeeCertificate::UnknownField::UnknownField(const UnknownField& copy) throw () : encoding(copy.encoding) { type = copy.type; } BeeCertificate::Field* BeeCertificate::UnknownField::clone() const throw () { return new BeeCertificate::UnknownField(*this); } void BeeCertificate::UnknownField::decode(DataInputStream& in) throw (IOException) { encoding.resize(in.available()); in.readFully(encoding); } void BeeCertificate::UnknownField::encode(DataOutputStream& out) const throw (IOException) { out.write(encoding); } const jint BeeCertificate::PublicKeyField::FIELD_TYPE = 0x5055424b; // 'PUBK' BeeCertificate::PublicKeyField::PublicKeyField() throw () { type = BeeCertificate::PublicKeyField::FIELD_TYPE; pub = 0; } BeeCertificate::PublicKeyField::PublicKeyField(const PublicKey& key) throw (CloneNotSupportedException) { type = BeeCertificate::PublicKeyField::FIELD_TYPE; pub = clonePublicKey(key); } BeeCertificate::PublicKeyField::~PublicKeyField() { delete pub; } BeeCertificate::Field* BeeCertificate::PublicKeyField::clone() const throw (CloneNotSupportedException) { return new BeeCertificate::PublicKeyField(*pub); } void BeeCertificate::PublicKeyField::decode(DataInputStream& in) throw (IOException) { String algorithm = in.readUTF(); String format = in.readUTF(); jint encsize = in.readInt(); if (encsize <= 0) throw IOException("Invalid key encoding size"); bytearray enc(encsize); in.readFully(enc); AnyEncodedKeySpec spec(format, enc); try { auto_ptr kf(KeyFactory::getInstance(algorithm)); pub = kf->generatePublic(spec); } catch (InvalidKeySpecException&) { throw IOException("Invalid key spec"); } catch (NoSuchAlgorithmException&) { throw IOException("Invalid key format"); } } void BeeCertificate::PublicKeyField::encode(DataOutputStream& out) const throw (IOException) { out.writeUTF(pub->getAlgorithm()); out.writeUTF(*pub->getFormat()); const bytearray* pubenc = pub->getEncoded(); if (!pubenc) throw NullPointerException("PublicKey has no encoding"); out.writeInt(pubenc->size()); out.write(*pubenc); } const jint BeeCertificate::ParentCertificateField::FIELD_TYPE = 0x43455254; // 'CERT' BeeCertificate::ParentCertificateField::ParentCertificateField() throw () { type = BeeCertificate::ParentCertificateField::FIELD_TYPE; parent = 0; } BeeCertificate::ParentCertificateField::ParentCertificateField(Certificate* cert) throw () { type = BeeCertificate::ParentCertificateField::FIELD_TYPE; parent = cert; } BeeCertificate::ParentCertificateField::ParentCertificateField(const Certificate& cert) throw (CloneNotSupportedException) { type = BeeCertificate::ParentCertificateField::FIELD_TYPE; parent = cloneCertificate(cert); } BeeCertificate::ParentCertificateField::~ParentCertificateField() { delete parent; } BeeCertificate::Field* BeeCertificate::ParentCertificateField::clone() const throw (CloneNotSupportedException) { return new BeeCertificate::ParentCertificateField(*parent); } void BeeCertificate::ParentCertificateField::decode(DataInputStream& in) throw (IOException) { String type = in.readUTF(); jint encsize = in.readInt(); if (encsize <= 0) throw IOException("Invalid certificate encoding size"); bytearray enc(encsize); in.readFully(enc); ByteArrayInputStream bin(enc); try { auto_ptr cf(CertificateFactory::getInstance(type)); parent = cf->generateCertificate(bin); } catch (CertificateException&) { throw IOException("Invalid certificate encoding"); } catch (NoSuchAlgorithmException&) { throw IOException("Invalid certificate type"); } } void BeeCertificate::ParentCertificateField::encode(DataOutputStream& out) const throw (IOException) { out.writeUTF(parent->getType()); try { const bytearray& parentenc = parent->getEncoded(); out.writeInt(parentenc.size()); out.write(parentenc); } catch (CertificateEncodingException&) { throw IOException("Couldn't encoding certificate"); } } BeeCertificate::Field* BeeCertificate::instantiateField(jint type) { switch (type) { case PublicKeyField::FIELD_TYPE: return new PublicKeyField(); case ParentCertificateField::FIELD_TYPE: return new ParentCertificateField(); default: return new UnknownField(); } } const Date BeeCertificate::FOREVER(Long::MAX_VALUE); BeeCertificate::BeeCertificate() : Certificate("BEE") { enc = 0; } BeeCertificate::BeeCertificate(InputStream& in) throw (IOException) : Certificate("BEE") { enc = 0; DataInputStream dis(in); issuer = dis.readUTF(); subject = dis.readUTF(); created.setTime(dis.readLong()); expires.setTime(dis.readLong()); jint fieldCount = dis.readInt(); if (fieldCount < 0) throw IOException("field count < 0"); for (jint i = 0; i < fieldCount; i++) { jint type = dis.readInt(); jint fieldSize = dis.readInt(); if (fieldSize < 0) throw IOException("field size < 0"); bytearray fenc(fieldSize); dis.readFully(fenc); ByteArrayInputStream bis(fenc); DataInputStream fis(bis); Field* f = instantiateField(type); try { f->decode(fis); fields.add(f); } catch (...) { delete f; throw; } } signatureAlgorithm = dis.readUTF(); jint sigSize = dis.readInt(); if (sigSize < 0) throw IOException("signature size < 0"); if (sigSize > 0) { signature.resize(sigSize); dis.readFully(signature); } } BeeCertificate::BeeCertificate(const BeeCertificate& copy) throw (CloneNotSupportedException) : Certificate("BEE") { issuer = copy.issuer; subject = copy.subject; created = copy.created; expires = copy.expires; for (int i = 0; i < copy.fields.size(); i++) fields.add(copy.fields.get(i)->clone()); signatureAlgorithm = copy.signatureAlgorithm; signature = copy.signature; enc = 0; } BeeCertificate::~BeeCertificate() { delete enc; } BeeCertificate* BeeCertificate::clone() const throw () { return new BeeCertificate(*this); } const bytearray& BeeCertificate::getEncoded() const throw (CertificateEncodingException) { if (!enc) { ByteArrayOutputStream bos; DataOutputStream dos(bos); try { encodeTBS(dos); dos.writeUTF(signatureAlgorithm); dos.writeInt(signature.size()); dos.write(signature); dos.close(); bos.close(); enc = bos.toByteArray(); } catch (IOException& e) { throw CertificateEncodingException().initCause(e); } } return *enc; } const PublicKey& BeeCertificate::getPublicKey() const { for (int i = 0; i < fields.size(); i++) { Field* f = fields.get(i); if (f->type == PublicKeyField::FIELD_TYPE) { const PublicKeyField* pkf = dynamic_cast(f); if (pkf) return *pkf->pub; else throw GeneralSecurityException("Somebody's trying to cheat with a new Field subclass"); } } throw CertificateException("no PublicKeyField in this certificate; test first with hasPublicKey()"); } const Certificate& BeeCertificate::getParentCertificate() const { for (int i = 0; i < fields.size(); i++) { Field* f = fields.get(i); if (f->type == ParentCertificateField::FIELD_TYPE) { const ParentCertificateField* pcf = dynamic_cast(f); if (pcf) return *pcf->parent; else throw GeneralSecurityException("Somebody's trying to cheat with a new Field subclass"); } } throw CertificateException("no ParentCertificateField in this certificate; test first with hasParentCertificate()"); } void BeeCertificate::verify(const PublicKey& pub) const throw (CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException) { auto_ptr sig(Signature::getInstance(signatureAlgorithm)); auto_ptr tmp(encodeTBS()); sig->initVerify(pub); sig->update(*tmp.get()); if (!sig->verify(signature)) throw CertificateException("signature doesn't match"); } void BeeCertificate::verify(const PublicKey& pub, const String& sigProvider) const throw (CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException) { auto_ptr sig(Signature::getInstance(signatureAlgorithm, sigProvider)); auto_ptr tmp(encodeTBS()); sig->initVerify(pub); sig->update(*tmp.get()); if (!sig->verify(signature)) throw CertificateException("signature doesn't match"); } String BeeCertificate::toString() const throw () { StringBuilder tmp("Bee Certificate issued by "); tmp.append(issuer).append(" subject ").append(subject).append(" valid from ").append(created.toString()).append(" until ").append(expires.equals(FOREVER) ? "-" : expires.toString()); /*!\todo add fields */ return tmp.toString(); } void BeeCertificate::checkValidity() const throw (CertificateExpiredException, CertificateNotYetValidException) { checkValidity(Date()); } void BeeCertificate::checkValidity(const Date& at) const throw (CertificateExpiredException, CertificateNotYetValidException) { if (at.before(created)) throw CertificateNotYetValidException(); if (!expires.equals(FOREVER)) if (at.after(expires)) throw CertificateExpiredException(); if (hasParentCertificate()) { // parent certificate had to be valid when this one was created const BeeCertificate* tmp = dynamic_cast(&getParentCertificate()); if (tmp) tmp->checkValidity(created); } } const Date& BeeCertificate::getNotAfter() const throw () { return expires; } const Date& BeeCertificate::getNotBefore() const throw () { return created; } const bytearray& BeeCertificate::getSignature() const throw () { return signature; } const String& BeeCertificate::getSigAlgName() const throw () { return signatureAlgorithm; } bool BeeCertificate::hasPublicKey() const { for (int i = 0; i < fields.size(); i++) { Field* f = fields.get(i); if (f->type == PublicKeyField::FIELD_TYPE) { // do an extra check with dynamic_cast if (dynamic_cast(f)) return true; else throw GeneralSecurityException("Somebody's trying to cheat with a new Field subclass"); } } return false; } bool BeeCertificate::hasParentCertificate() const { for (int i = 0; i < fields.size(); i++) { Field* f = fields.get(i); if (f->type == ParentCertificateField::FIELD_TYPE) { // do an extra check with dynamic_cast if (dynamic_cast(f)) return true; else throw GeneralSecurityException("Somebody's trying to cheat with a new Field subclass"); } } return false; } bool BeeCertificate::isSelfSignedCertificate() const { // if there's a parent certificate, this certificate isn't self-signed if (hasParentCertificate()) return false; // no public key means that we cannot verify if (!hasPublicKey()) return false; try { verify(getPublicKey()); return true; } catch (Exception&) { return false; } } void BeeCertificate::encodeTBS(DataOutputStream& out) const throw (IOException) { out.writeUTF(issuer); out.writeUTF(subject); out.writeLong(created.getTime()); out.writeLong(expires.getTime()); out.writeInt(fields.size()); for (int i = 0; i < fields.size(); i++) { ByteArrayOutputStream bout; DataOutputStream dout(bout); Field* f = fields.get(i); f->encode(dout); dout.close(); bytearray fenc; bout.toByteArray(fenc); out.writeInt(f->type); out.writeInt(fenc.size()); out.write(fenc); } } bytearray* BeeCertificate::encodeTBS() const throw (CertificateEncodingException) { ByteArrayOutputStream bos; DataOutputStream dos(bos); try { encodeTBS(dos); dos.close(); } catch (IOException& e) { throw CertificateEncodingException().initCause(e); } return bos.toByteArray(); } BeeCertificate* BeeCertificate::self(const PublicKey& pub, const PrivateKey& pri, const String& signatureAlgorithm) throw (InvalidKeyException, CertificateEncodingException, SignatureException, NoSuchAlgorithmException) { // if the public key doesn't have an encoding, it's not worth going through the effort if (!pub.getEncoded()) throw InvalidKeyException("PublicKey doesn't have an encoding"); auto_ptr sig(Signature::getInstance(signatureAlgorithm)); sig->initSign(pri); BeeCertificate* cert = new BeeCertificate(); try { // issuer is kept blank cert->subject = String("Public Key Certificate"); cert->expires = FOREVER; cert->signatureAlgorithm = signatureAlgorithm; cert->fields.add(new PublicKeyField(pub)); auto_ptr tmp(cert->encodeTBS()); sig->update(*tmp.get()); sig->sign(cert->signature); } catch (...) { delete cert; throw; } return cert; } BeeCertificate* BeeCertificate::make(const PublicKey& pub, const PrivateKey& pri, const String& signatureAlgorithm, const Certificate& parent) throw (InvalidKeyException, CertificateEncodingException, SignatureException, NoSuchAlgorithmException) { // if the public key doesn't have an encoding, it's not worth going through the effort if (!pub.getEncoded()) throw InvalidKeyException("PublicKey doesn't have an encoding"); auto_ptr sig(Signature::getInstance(signatureAlgorithm)); sig->initSign(pri); BeeCertificate* cert = new BeeCertificate(); try { // issuer is kept blank cert->subject = String("Public Key Certificate"); cert->expires = FOREVER; cert->signatureAlgorithm = signatureAlgorithm; cert->fields.add(new PublicKeyField(pub)); cert->fields.add(new ParentCertificateField(parent)); auto_ptr tmp(cert->encodeTBS()); sig->update(*tmp); sig->sign(cert->signature); } catch (...) { delete cert; throw; } return cert; } beecrypt-4.2.1/c++/beeyond/BeeEncodedKeySpec.cxx0000664000175000001440000000236510245547555016256 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeEncodedKeySpec.h" using namespace beecrypt::beeyond; BeeEncodedKeySpec::BeeEncodedKeySpec(const byte* data, int size) : EncodedKeySpec(data, size) { } BeeEncodedKeySpec::BeeEncodedKeySpec(const bytearray& copy) : EncodedKeySpec(copy) { } const String& BeeEncodedKeySpec::getFormat() const throw () { static const String FORMAT("BEE"); return FORMAT; } beecrypt-4.2.1/c++/beeyond/BeeInputStream.cxx0000664000175000001440000000243110205371644015664 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeInputStream.h" using namespace beecrypt::beeyond; BeeInputStream::BeeInputStream(InputStream& in) : DataInputStream(in) { } BeeInputStream::~BeeInputStream() { } BigInteger BeeInputStream::readBigInteger() throw (IOException) { int size = readInt(); if (size <= 0) throw IOException("invalid BigInteger size"); bytearray data(size); readFully(data); return BigInteger(data); } beecrypt-4.2.1/c++/beeyond/Makefile.in0000644000175000001440000005160211226307160014314 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ TESTS = testcert$(EXEEXT) check_PROGRAMS = testcert$(EXEEXT) subdir = c++/beeyond DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxbeeyond_la_LIBADD = am_libcxxbeeyond_la_OBJECTS = AnyEncodedKeySpec.lo BeeCertificate.lo \ BeeCertPath.lo BeeCertPathParameters.lo \ BeeCertPathValidatorResult.lo BeeEncodedKeySpec.lo \ BeeInputStream.lo BeeOutputStream.lo DHIESParameterSpec.lo \ DHIESDecryptParameterSpec.lo PKCS12PBEKey.lo libcxxbeeyond_la_OBJECTS = $(am_libcxxbeeyond_la_OBJECTS) am_testcert_OBJECTS = testcert.$(OBJEXT) testcert_OBJECTS = $(am_testcert_OBJECTS) testcert_DEPENDENCIES = ../libbeecrypt_cxx.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxbeeyond_la_SOURCES) $(testcert_SOURCES) DIST_SOURCES = $(libcxxbeeyond_la_SOURCES) $(testcert_SOURCES) DATA = $(noinst_DATA) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = -licuuc -licuio LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxbeeyond.la libcxxbeeyond_la_SOURCES = \ AnyEncodedKeySpec.cxx \ BeeCertificate.cxx \ BeeCertPath.cxx \ BeeCertPathParameters.cxx \ BeeCertPathValidatorResult.cxx \ BeeEncodedKeySpec.cxx \ BeeInputStream.cxx \ BeeOutputStream.cxx \ DHIESParameterSpec.cxx \ DHIESDecryptParameterSpec.cxx \ PKCS12PBEKey.cxx noinst_DATA = beecrypt-test.conf TESTS_ENVIRONMENT = BEECRYPT_CONF_FILE=beecrypt-test.conf CLEANFILES = beecrypt-test.conf testcert_SOURCES = testcert.cxx testcert_LDADD = ../libbeecrypt_cxx.la all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/beeyond/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/beeyond/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxbeeyond.la: $(libcxxbeeyond_la_OBJECTS) $(libcxxbeeyond_la_DEPENDENCIES) $(CXXLINK) $(libcxxbeeyond_la_OBJECTS) $(libcxxbeeyond_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list testcert$(EXEEXT): $(testcert_OBJECTS) $(testcert_DEPENDENCIES) @rm -f testcert$(EXEEXT) $(CXXLINK) $(testcert_OBJECTS) $(testcert_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AnyEncodedKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeCertPath.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeCertPathParameters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeCertPathValidatorResult.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeCertificate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeEncodedKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeInputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BeeOutputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHIESDecryptParameterSpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHIESParameterSpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PKCS12PBEKey.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcert.Po@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am beecrypt-test.conf: @echo "provider.1=../provider/.libs/base.so" > beecrypt-test.conf # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/beeyond/BeeCertPathParameters.cxx0000664000175000001440000000400310176676075017161 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeCertPathParameters.h" #include "beecrypt/c++/beeyond/BeeCertificate.h" #include "beecrypt/c++/util/ArrayList.h" using namespace beecrypt::beeyond; BeeCertPathParameters::BeeCertPathParameters() { } BeeCertPathParameters::BeeCertPathParameters(KeyStore& keystore) throw (KeyStoreException, InvalidAlgorithmParameterException) { Enumeration* aliases = keystore.aliases(); while (aliases->hasMoreElements()) { const String* alias = aliases->nextElement(); if (keystore.isCertificateEntry(*alias)) { // only add BeeCertificates const BeeCertificate* beecert = dynamic_cast(keystore.getCertificate(*alias)); if (beecert) _cert.add(beecert->clone()); } } delete aliases; if (_cert.size() == 0) throw InvalidAlgorithmParameterException("KeyStore doesn't contain any trusted BeeCertificates"); } const List& BeeCertPathParameters::getTrustedCertificates() const { return _cert; } BeeCertPathParameters* BeeCertPathParameters::clone() const throw () { BeeCertPathParameters* tmp = new BeeCertPathParameters(); tmp->_cert.addAll(_cert); return tmp; } beecrypt-4.2.1/c++/beeyond/BeeOutputStream.cxx0000664000175000001440000000234310205365017016064 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeOutputStream.h" using namespace beecrypt::beeyond; BeeOutputStream::BeeOutputStream(OutputStream& out) : DataOutputStream(out) { } BeeOutputStream::~BeeOutputStream() { } void BeeOutputStream::writeBigInteger(const BigInteger& n) throw (IOException) { bytearray data; n.toByteArray(data); writeInt(data.size()); write(data); } beecrypt-4.2.1/c++/beeyond/PKCS12PBEKey.cxx0000664000175000001440000000355510207110120014666 00000000000000#define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/PKCS12PBEKey.h" using namespace beecrypt::beeyond; PKCS12PBEKey::PKCS12PBEKey(const array& password, const bytearray* salt, int iterationCount) : _pswd(password) { if (salt) _salt = new bytearray(*salt); else _salt = 0; _iter = iterationCount; _enc = 0; } PKCS12PBEKey::~PKCS12PBEKey() { delete _salt; } bool PKCS12PBEKey::operator==(const Key& compare) const throw () { const PBEKey* tmp = dynamic_cast(&compare); if (tmp) { if (_pswd != tmp->getPassword()) return false; if (_salt && tmp->getSalt()) { if (*_salt != *tmp->getSalt()) return false; } else if (_salt || tmp->getSalt()) return false; if (_iter != tmp->getIterationCount()) return false; return true; } return false; } PKCS12PBEKey* PKCS12PBEKey::clone() const { return new PKCS12PBEKey(_pswd, _salt, _iter); } bytearray* PKCS12PBEKey::encode(const array& password) { int i; bytearray* result = new bytearray((password.size() + 1) * 2); for (i = 0; i < password.size(); i++) { (*result)[2*i ] = (password[i] >> 8) & 0xff; (*result)[2*i+1] = (password[i] ) & 0xff; } (*result)[2*i ] = 0; (*result)[2*i+1] = 0; return result; } int PKCS12PBEKey::getIterationCount() const throw () { return _iter; } const array& PKCS12PBEKey::getPassword() const throw () { return _pswd; } const bytearray* PKCS12PBEKey::getSalt() const throw () { return _salt; } const bytearray* PKCS12PBEKey::getEncoded() const throw () { if (!_enc) _enc = encode(_pswd); return _enc; } const String& PKCS12PBEKey::getAlgorithm() const throw () { static const String ALGORITHM("PKCS#12/PBE"); return ALGORITHM; } const String* PKCS12PBEKey::getFormat() const throw () { static const String FORMAT("RAW"); return &FORMAT; } beecrypt-4.2.1/c++/beeyond/Makefile.am0000664000175000001440000000135410502513407014303 00000000000000INCLUDES = -I$(top_srcdir)/include LIBS = -licuuc -licuio AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxbeeyond.la libcxxbeeyond_la_SOURCES = \ AnyEncodedKeySpec.cxx \ BeeCertificate.cxx \ BeeCertPath.cxx \ BeeCertPathParameters.cxx \ BeeCertPathValidatorResult.cxx \ BeeEncodedKeySpec.cxx \ BeeInputStream.cxx \ BeeOutputStream.cxx \ DHIESParameterSpec.cxx \ DHIESDecryptParameterSpec.cxx \ PKCS12PBEKey.cxx noinst_DATA = beecrypt-test.conf TESTS_ENVIRONMENT = BEECRYPT_CONF_FILE=beecrypt-test.conf TESTS = testcert CLEANFILES = beecrypt-test.conf check_PROGRAMS = testcert testcert_SOURCES = testcert.cxx testcert_LDADD = ../libbeecrypt_cxx.la beecrypt-test.conf: @echo "provider.1=../provider/.libs/base.so" > beecrypt-test.conf beecrypt-4.2.1/c++/beeyond/BeeCertPath.cxx0000664000175000001440000000272110176730402015123 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeCertPath.h" using namespace beecrypt::beeyond; BeeCertPath::BeeCertPath(const BeeCertificate& cert) : CertPath("BEE"), _cert(1) { _cert.add(cert.clone()); } bool BeeCertPath::equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const BeeCertPath* cmp = dynamic_cast(obj); if (cmp) return _cert.equals(&cmp->_cert); } return false; } const List& BeeCertPath::getCertificates() const { return _cert; } const bytearray& BeeCertPath::getEncoded() const { return _cert.get(0)->getEncoded(); } beecrypt-4.2.1/c++/beeyond/AnyEncodedKeySpec.cxx0000664000175000001440000000244010245547526016302 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/AnyEncodedKeySpec.h" using namespace beecrypt::beeyond; AnyEncodedKeySpec::AnyEncodedKeySpec(const String& format, const byte* data, int size) : EncodedKeySpec(data, size), _format(format) { } AnyEncodedKeySpec::AnyEncodedKeySpec(const String& format, const bytearray& copy) : EncodedKeySpec(copy), _format(format) { } const String& AnyEncodedKeySpec::getFormat() const throw () { return _format; } beecrypt-4.2.1/c++/beeyond/BeeCertPathValidatorResult.cxx0000664000175000001440000000353410171505340020167 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/BeeCertPathValidatorResult.h" #include "beecrypt/c++/beeyond/BeeCertificate.h" #include "beecrypt/c++/lang/ClassCastException.h" using beecrypt::lang::ClassCastException; #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; using namespace beecrypt::beeyond; BeeCertPathValidatorResult::BeeCertPathValidatorResult(const BeeCertificate& root, const PublicKey& pub) { _root = root.clone(); _pub = BeeCertificate::clonePublicKey(pub); } BeeCertPathValidatorResult::~BeeCertPathValidatorResult() { delete _root; delete _pub; } BeeCertPathValidatorResult* BeeCertPathValidatorResult::clone() const throw () { return new BeeCertPathValidatorResult(*_root, *_pub); } const BeeCertificate& BeeCertPathValidatorResult::getRootCertificate() const { return *_root; } const PublicKey& BeeCertPathValidatorResult::getPublicKey() const { return *_pub; } beecrypt-4.2.1/c++/beeyond/DHIESParameterSpec.cxx0000664000175000001440000001051510245547574016322 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/beeyond/DHIESParameterSpec.h" #include "beecrypt/c++/lang/Integer.h" using beecrypt::lang::Integer; #include "beecrypt/c++/lang/StringBuilder.h" using beecrypt::lang::StringBuilder; #include using std::auto_ptr; #include #include using namespace beecrypt::beeyond; DHIESParameterSpec::DHIESParameterSpec(const DHIESParameterSpec& copy) { _messageDigestAlgorithm = copy._messageDigestAlgorithm; _cipherAlgorithm = copy._cipherAlgorithm; _macAlgorithm = copy._macAlgorithm; _cipherKeyLength = copy._cipherKeyLength; _macKeyLength = copy._macKeyLength; } DHIESParameterSpec::DHIESParameterSpec(const String& messageDigestAlgorithm, const String& cipherAlgorithm, const String& macAlgorithm, int cipherKeyLength, int macKeyLength) { if (cipherKeyLength < 0 || macKeyLength < 0) throw IllegalArgumentException("key lengths must be >= 0"); if (cipherKeyLength & 0x3 || macKeyLength & 0x3) throw IllegalArgumentException("key lengths must be a multiple of 8 bits"); if (cipherKeyLength == 0 && macKeyLength != 0) throw IllegalArgumentException("if cipherKeyLength equals 0, then macKeyLength must also be 0"); _messageDigestAlgorithm = messageDigestAlgorithm; _cipherAlgorithm = cipherAlgorithm; _macAlgorithm = macAlgorithm; _cipherKeyLength = cipherKeyLength; _macKeyLength = macKeyLength; } DHIESParameterSpec::DHIESParameterSpec(const String& descriptor) throw (IllegalArgumentException) { UnicodeString match(descriptor.toUnicodeString()); UErrorCode status = U_ZERO_ERROR; UParseError error; auto_ptr p(RegexPattern::compile("DHIES\\((\\w(?:\\w|\\d)*(?:-(?:\\w|\\d)*)*),(\\w(?:\\w|\\d)*(?:-(?:\\w|\\d)*)*),(\\w(?:\\w|\\d)*(?:-(?:\\w|\\d)*)*)(?:,(\\d+))?(?:,(\\d+))?\\)", error, status)); if (U_FAILURE(status)) throw RuntimeException("RegexPattern doesn't compile"); auto_ptr m(p->matcher(match, status)); if (!m->matches(status)) throw IllegalArgumentException("couldn't parse descriptor into DHIES(,,[,[,]])"); _messageDigestAlgorithm = m->group(1, status); _cipherAlgorithm = m->group(2, status); _macAlgorithm = m->group(3, status); if (m->group(4, status).length()) { std::cout << "group(4) exists: [" << String(m->group(4, status)) << "]" << std::endl; _cipherKeyLength = Integer::parseInteger(m->group(4, status)); if (m->group(5, status).length()) _macKeyLength = Integer::parseInteger(m->group(5, status)); else _macKeyLength = 0; } else _cipherKeyLength = 0; } const String& DHIESParameterSpec::getCipherAlgorithm() const throw () { return _cipherAlgorithm; } int DHIESParameterSpec::getCipherKeyLength() const throw () { return _cipherKeyLength; } const String& DHIESParameterSpec::getMacAlgorithm() const throw () { return _macAlgorithm; } int DHIESParameterSpec::getMacKeyLength() const throw () { return _macKeyLength; } const String& DHIESParameterSpec::getMessageDigestAlgorithm() const throw () { return _messageDigestAlgorithm; } String DHIESParameterSpec::toString() const throw () { StringBuilder tmp("DHIES("); tmp.append(_messageDigestAlgorithm).append(',').append(_cipherAlgorithm).append(',').append(_macAlgorithm); if (_macKeyLength) { tmp.append(',').append(Integer::toString(_cipherKeyLength)); tmp.append(',').append(Integer::toString(_macKeyLength)); } else if (_cipherKeyLength) { tmp.append(',').append(Integer::toString(_cipherKeyLength)); } return tmp.append(')').toString(); } beecrypt-4.2.1/c++/crypto/0000777000175000001440000000000011226307273012227 500000000000000beecrypt-4.2.1/c++/crypto/KeyAgreement.cxx0000664000175000001440000000675410201374753015264 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/KeyAgreement.h" #include "beecrypt/c++/security/Security.h" using beecrypt::security::Security; using namespace beecrypt::crypto; KeyAgreement::KeyAgreement(KeyAgreementSpi* spi, const Provider* provider, const String& algorithm) { _kspi = spi; _prov = provider; _algo = algorithm; } KeyAgreement::~KeyAgreement() { delete _kspi; } KeyAgreement* KeyAgreement::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "KeyAgreement"); assert(dynamic_cast((KeyAgreementSpi*) tmp->cspi)); KeyAgreement* result = new KeyAgreement((KeyAgreementSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } KeyAgreement* KeyAgreement::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "KeyAgreement", provider); assert(dynamic_cast((KeyAgreementSpi*) tmp->cspi)); KeyAgreement* result = new KeyAgreement((KeyAgreementSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } KeyAgreement* KeyAgreement::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "KeyAgreement", provider); assert(dynamic_cast((KeyAgreementSpi*) tmp->cspi)); KeyAgreement* result = new KeyAgreement((KeyAgreementSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } void KeyAgreement::init(const Key& key, SecureRandom* random) throw (InvalidKeyException) { _kspi->engineInit(key, random); } void KeyAgreement::init(const Key& key, const AlgorithmParameterSpec& spec, SecureRandom* random) throw (InvalidKeyException) { _kspi->engineInit(key, spec, random); } Key* KeyAgreement::doPhase(const Key& key, bool lastPhase) throw (InvalidKeyException, IllegalStateException) { return _kspi->engineDoPhase(key, lastPhase); } bytearray* KeyAgreement::generateSecret() throw (IllegalStateException) { return _kspi->engineGenerateSecret(); } int KeyAgreement::generateSecret(bytearray& sharedSecret, int offset) throw (IllegalStateException, ShortBufferException) { return _kspi->engineGenerateSecret(sharedSecret, offset); } SecretKey* KeyAgreement::generateSecret(const String& algorithm) throw (IllegalStateException, NoSuchAlgorithmException, InvalidKeyException) { return _kspi->engineGenerateSecret(algorithm); } beecrypt-4.2.1/c++/crypto/spec/0000777000175000001440000000000011226307273013161 500000000000000beecrypt-4.2.1/c++/crypto/spec/SecretKeySpec.cxx0000664000175000001440000000274610245547412016346 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/spec/SecretKeySpec.h" using namespace beecrypt::crypto::spec; SecretKeySpec::SecretKeySpec(const byte* data, size_t offset, size_t length, const String& algorithm) : _data(data+offset, length), _algo(algorithm) { } SecretKeySpec::SecretKeySpec(const bytearray& b, const String& algorithm) : _data(b), _algo(algorithm) { } const String& SecretKeySpec::getAlgorithm() const throw () { return _algo; } const String* SecretKeySpec::getFormat() const throw () { static const String FORMAT("RAW"); return &FORMAT; } const bytearray* SecretKeySpec::getEncoded() const throw () { return &_data; } beecrypt-4.2.1/c++/crypto/spec/DHParameterSpec.cxx0000664000175000001440000000361510245547350016601 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/spec/DHParameterSpec.h" using namespace beecrypt::crypto::spec; DHParameterSpec::DHParameterSpec(const DHParams& copy) { _p = copy.getP(); _g = copy.getG(); _l = copy.getL(); } DHParameterSpec::DHParameterSpec(const DHParameterSpec& copy) { _p = copy._p; _g = copy._g; _l = copy._l; } DHParameterSpec::DHParameterSpec(const BigInteger& p, const BigInteger& g) { _p = p; _g = g; _l = 0; } DHParameterSpec::DHParameterSpec(const BigInteger& p, const BigInteger& g, int l) { _p = p; _g = g; _l = l; } bool DHParameterSpec::equals(const Object* obj) const throw () { if (this == obj) return true; const DHParameterSpec* spec = dynamic_cast(obj); if (spec) { if (_p != spec->_p) return false; if (_g != spec->_g) return false; return true; } return false; } const BigInteger& DHParameterSpec::getP() const throw () { return _p; } const BigInteger& DHParameterSpec::getG() const throw () { return _g; } int DHParameterSpec::getL() const throw () { return _l; } beecrypt-4.2.1/c++/crypto/spec/Makefile.in0000644000175000001440000004055111226307160015142 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = c++/crypto/spec DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxcryptospec_la_LIBADD = am_libcxxcryptospec_la_OBJECTS = DHParameterSpec.lo \ DHPrivateKeySpec.lo DHPublicKeySpec.lo IvParameterSpec.lo \ PBEKeySpec.lo SecretKeySpec.lo libcxxcryptospec_la_OBJECTS = $(am_libcxxcryptospec_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxcryptospec_la_SOURCES) DIST_SOURCES = $(libcxxcryptospec_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxcryptospec.la cxxcryptospecdir = $(pkgincludedir)/c++/crypto/spec libcxxcryptospec_la_SOURCES = \ DHParameterSpec.cxx \ DHPrivateKeySpec.cxx \ DHPublicKeySpec.cxx \ IvParameterSpec.cxx \ PBEKeySpec.cxx \ SecretKeySpec.cxx all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/crypto/spec/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/crypto/spec/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxcryptospec.la: $(libcxxcryptospec_la_OBJECTS) $(libcxxcryptospec_la_DEPENDENCIES) $(CXXLINK) $(libcxxcryptospec_la_OBJECTS) $(libcxxcryptospec_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHParameterSpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHPrivateKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DHPublicKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IvParameterSpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PBEKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SecretKeySpec.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/crypto/spec/DHPrivateKeySpec.cxx0000664000175000001440000000245310245547376016753 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/spec/DHPrivateKeySpec.h" using namespace beecrypt::crypto::spec; DHPrivateKeySpec::DHPrivateKeySpec(const BigInteger& x, const BigInteger& p, const BigInteger& g) : _p(p), _g(g), _x(x) { } const BigInteger& DHPrivateKeySpec::getP() const throw () { return _p; } const BigInteger& DHPrivateKeySpec::getG() const throw () { return _g; } const BigInteger& DHPrivateKeySpec::getX() const throw () { return _x; } beecrypt-4.2.1/c++/crypto/spec/IvParameterSpec.cxx0000664000175000001440000000242110170521321016641 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/spec/IvParameterSpec.h" using namespace beecrypt::crypto::spec; IvParameterSpec::IvParameterSpec(const byte* iv, size_t offset, size_t length) : _iv(iv+offset, length) { } IvParameterSpec::IvParameterSpec(const bytearray& iv) : _iv(iv) { } const bytearray& IvParameterSpec::getIV() const throw () { return _iv; } bytearray* IvParameterSpec::getIV() { return new bytearray(_iv); } beecrypt-4.2.1/c++/crypto/spec/Makefile.am0000664000175000001440000000046410502514444015133 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxcryptospec.la cxxcryptospecdir=$(pkgincludedir)/c++/crypto/spec libcxxcryptospec_la_SOURCES =\ DHParameterSpec.cxx \ DHPrivateKeySpec.cxx \ DHPublicKeySpec.cxx \ IvParameterSpec.cxx \ PBEKeySpec.cxx \ SecretKeySpec.cxx beecrypt-4.2.1/c++/crypto/spec/DHPublicKeySpec.cxx0000664000175000001440000000244510245547405016551 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/spec/DHPublicKeySpec.h" using namespace beecrypt::crypto::spec; DHPublicKeySpec::DHPublicKeySpec(const BigInteger& y, const BigInteger& p, const BigInteger& g) : _p(p), _g(g), _y(y) { } const BigInteger& DHPublicKeySpec::getP() const throw () { return _p; } const BigInteger& DHPublicKeySpec::getG() const throw () { return _g; } const BigInteger& DHPublicKeySpec::getY() const throw () { return _y; } beecrypt-4.2.1/c++/crypto/spec/PBEKeySpec.cxx0000664000175000001440000000334510207110001015475 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/spec/PBEKeySpec.h" using namespace beecrypt::crypto::spec; PBEKeySpec::PBEKeySpec(const array* password) : _password(password ? *password : 0) { _salt = 0; _iteration_count = 0; _key_length = 0; } PBEKeySpec::PBEKeySpec(const array* password, const bytearray* salt, size_t iterationCount, size_t keyLength) : _password(password ? *password : 0) { if (salt) _salt = new bytearray(*salt); _iteration_count = iterationCount; _key_length = keyLength; } PBEKeySpec::~PBEKeySpec() { _password.fill((jchar) ' '); } const array& PBEKeySpec::getPassword() const throw () { return _password; } const bytearray* PBEKeySpec::getSalt() const throw () { return _salt; } size_t PBEKeySpec::getIterationCount() const throw () { return _iteration_count; } size_t PBEKeySpec::getKeyLength() const throw () { return _key_length; } beecrypt-4.2.1/c++/crypto/SecretKeyFactory.cxx0000664000175000001440000000622010201374557016120 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/SecretKeyFactory.h" #include "beecrypt/c++/security/Security.h" using beecrypt::security::Security; using namespace beecrypt::crypto; SecretKeyFactory::SecretKeyFactory(SecretKeyFactorySpi* spi, const Provider* provider, const String& algorithm) { _kspi = spi; _prov = provider; _algo = algorithm; } SecretKeyFactory::~SecretKeyFactory() { delete _kspi; } SecretKeyFactory* SecretKeyFactory::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "SecretKeyFactory"); assert(dynamic_cast((SecretKeyFactorySpi*) tmp->cspi)); SecretKeyFactory* result = new SecretKeyFactory((SecretKeyFactorySpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } SecretKeyFactory* SecretKeyFactory::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "SecretKeyFactory", provider); assert(dynamic_cast((SecretKeyFactorySpi*) tmp->cspi)); SecretKeyFactory* result = new SecretKeyFactory((SecretKeyFactorySpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } SecretKeyFactory* SecretKeyFactory::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "SecretKeyFactory", provider); assert(dynamic_cast((SecretKeyFactorySpi*) tmp->cspi)); SecretKeyFactory* result = new SecretKeyFactory((SecretKeyFactorySpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } SecretKey* SecretKeyFactory::generateSecret(const KeySpec& spec) throw (InvalidKeySpecException) { return _kspi->engineGenerateSecret(spec); } KeySpec* SecretKeyFactory::getKeySpec(const SecretKey& key, const type_info& info) throw (InvalidKeySpecException) { return _kspi->engineGetKeySpec(key, info); } SecretKey* SecretKeyFactory::translateKey(const SecretKey& key) throw (InvalidKeyException) { return _kspi->engineTranslateKey(key); } const String& SecretKeyFactory::getAlgorithm() const throw () { return _algo; } const Provider& SecretKeyFactory::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/c++/crypto/Makefile.in0000644000175000001440000005354211226307160014214 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = c++/crypto DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxcrypto_la_DEPENDENCIES = spec/libcxxcryptospec.la am_libcxxcrypto_la_OBJECTS = Cipher.lo CipherSpi.lo KeyAgreement.lo \ Mac.lo MacInputStream.lo MacOutputStream.lo NullCipher.lo \ SecretKeyFactory.lo libcxxcrypto_la_OBJECTS = $(am_libcxxcrypto_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxcrypto_la_SOURCES) DIST_SOURCES = $(libcxxcrypto_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = spec noinst_LTLIBRARIES = libcxxcrypto.la cxxcryptodir = $(pkgincludedir)/c++/crypto libcxxcrypto_la_SOURCES = \ Cipher.cxx \ CipherSpi.cxx \ KeyAgreement.cxx \ Mac.cxx \ MacInputStream.cxx \ MacOutputStream.cxx \ NullCipher.cxx \ SecretKeyFactory.cxx libcxxcrypto_la_LIBADD = spec/libcxxcryptospec.la all: all-recursive .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/crypto/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/crypto/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxcrypto.la: $(libcxxcrypto_la_OBJECTS) $(libcxxcrypto_la_DEPENDENCIES) $(CXXLINK) $(libcxxcrypto_la_OBJECTS) $(libcxxcrypto_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cipher.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CipherSpi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/KeyAgreement.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mac.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MacInputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MacOutputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NullCipher.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SecretKeyFactory.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/crypto/Makefile.am0000664000175000001440000000056610502513313014176 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = spec noinst_LTLIBRARIES = libcxxcrypto.la cxxcryptodir=$(pkgincludedir)/c++/crypto libcxxcrypto_la_SOURCES = \ Cipher.cxx \ CipherSpi.cxx \ KeyAgreement.cxx \ Mac.cxx \ MacInputStream.cxx \ MacOutputStream.cxx \ NullCipher.cxx \ SecretKeyFactory.cxx libcxxcrypto_la_LIBADD = spec/libcxxcryptospec.la beecrypt-4.2.1/c++/crypto/NullCipher.cxx0000664000175000001440000000654010302132517014732 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/NullCipher.h" using namespace beecrypt::crypto; bytearray* NullCipher::NullCipherSpi::engineDoFinal(const byte* input, int inputOffset, int inputLength) throw (IllegalBlockSizeException, BadPaddingException) { if (inputLength == 0) return 0; return new bytearray(input+inputOffset, inputLength); } int NullCipher::NullCipherSpi::engineDoFinal(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException, IllegalBlockSizeException, BadPaddingException) { if (inputLength > 0) { if (output.size() - outputOffset > inputLength) throw ShortBufferException("output buffer too short"); memmove(output.data() + outputOffset, input+inputOffset, inputLength); } return inputLength; } int NullCipher::NullCipherSpi::engineGetBlockSize() const throw () { return 1; } bytearray* NullCipher::NullCipherSpi::engineGetIV() { return 0; } int NullCipher::NullCipherSpi::engineGetOutputSize(int inputLength) throw () { return inputLength; } AlgorithmParameters* NullCipher::NullCipherSpi::engineGetParameters() throw () { return 0; } void NullCipher::NullCipherSpi::engineInit(int opmode, const Key& key, SecureRandom* random) throw (InvalidKeyException) { } void NullCipher::NullCipherSpi::engineInit(int opmode, const Key& key, AlgorithmParameters* params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) { } void NullCipher::NullCipherSpi::engineInit(int opmode, const Key& key, const AlgorithmParameterSpec& params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) { } void NullCipher::NullCipherSpi::engineSetMode(const String& mode) throw (NoSuchAlgorithmException) { } void NullCipher::NullCipherSpi::engineSetPadding(const String& mode) throw (NoSuchPaddingException) { } bytearray* NullCipher::NullCipherSpi::engineUpdate(const byte* input, int inputOffset, int inputLength) { if (inputLength == 0) return 0; return new bytearray(input+inputOffset, inputLength); } int NullCipher::NullCipherSpi::engineUpdate(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException) { if (inputLength > 0) { if (output.size() - outputOffset > inputLength) throw ShortBufferException("output buffer too short"); memmove(output.data() + outputOffset, input+inputOffset, inputLength); } return inputLength; } NullCipher::NullCipher() : Cipher(new NullCipherSpi(), (const Provider*) 0, "") { } beecrypt-4.2.1/c++/crypto/MacOutputStream.cxx0000664000175000001440000000320010167730320015755 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/MacOutputStream.h" #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::crypto; MacOutputStream::MacOutputStream(OutputStream& out, Mac& m) : FilterOutputStream(out), mac(m) { _on = true; } MacOutputStream::~MacOutputStream() { } void MacOutputStream::write(byte b) throw (IOException) { out.write(b); if (_on) mac.update(b); } void MacOutputStream::write(const byte *data, int offset, int length) throw (IOException) { if (length) { out.write(data, offset, length); if (_on) mac.update(data, offset, length); } } void MacOutputStream::on(bool on) { _on = on; } Mac& MacOutputStream::getMac() { return mac; } void MacOutputStream::setMac(Mac& m) { mac = m; } beecrypt-4.2.1/c++/crypto/CipherSpi.cxx0000664000175000001440000000225710167731734014573 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/CipherSpi.h" #include "beecrypt/c++/lang/UnsupportedOperationException.h" using beecrypt::lang::UnsupportedOperationException; using namespace beecrypt::crypto; int CipherSpi::engineGetKeySize(const Key& key) const throw (InvalidKeyException) { throw UnsupportedOperationException(); } beecrypt-4.2.1/c++/crypto/Cipher.cxx0000664000175000001440000003345110201224666014105 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/Cipher.h" #include "beecrypt/c++/security/Security.h" using beecrypt::security::Security; #include #include using namespace beecrypt::crypto; namespace { RegexPattern* _amppat = 0; } const int Cipher::ENCRYPT_MODE = 1; const int Cipher::DECRYPT_MODE = 2; const int Cipher::WRAP_MODE = 3; const int Cipher::UNWRAP_MODE = 4; Cipher::Cipher(CipherSpi* spi, const Provider* provider, const String& transformation) { _cspi = spi; _prov = provider; _algo = transformation; _init = false; } Cipher::~Cipher() { delete _cspi; } Cipher* Cipher::getInstance(const String& transformation) throw (NoSuchAlgorithmException, NoSuchPaddingException) { UnicodeString match(transformation.toUnicodeString()); UErrorCode status = U_ZERO_ERROR; if (!_amppat) { UParseError error; _amppat = RegexPattern::compile("(\\w+)(?:/(\\w*))?(?:/(\\w+))?", error, status); // shouldn't happen if (U_FAILURE(status)) throw RuntimeException("ICU regex compilation problem"); } status = U_ZERO_ERROR; RegexMatcher *m = _amppat->matcher(match, status); status = U_ZERO_ERROR; if (m->matches(status)) { Security::spi* tmp; Cipher* result; // Step 1: try to find complete transformation try { tmp = Security::getSpi(transformation, "Cipher"); assert(dynamic_cast((CipherSpi*) (CipherSpi*) tmp->cspi)); result = new Cipher(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } catch (NoSuchAlgorithmException&) { // no problem yet } String algorithm, mode, padding; algorithm = m->group(1, status); mode = m->group(2, status); padding = m->group(3, status); // clean up the matcher; we don't need it anymore delete m; // Step 2: try to find algorithm/mode if (mode.length()) { try { tmp = Security::getSpi(algorithm + "/" + mode, "Cipher"); assert(dynamic_cast((CipherSpi*) (CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; if (padding.length()) { try { result->_cspi->engineSetPadding(padding); } catch (NoSuchPaddingException&) { delete result; throw; } } return result; } catch (NoSuchAlgorithmException&) { // no problem yet } } // Step 3: try to find algorithm//padding if (padding.length()) { try { tmp = Security::getSpi(algorithm + "//" + padding, "Cipher"); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; if (mode.length()) { try { result->_cspi->engineSetMode(mode); } catch (NoSuchAlgorithmException&) { delete result; throw; } } return result; } catch (NoSuchAlgorithmException&) { // no problem yet } } // Step 4: try to find algorithm tmp = Security::getSpi(algorithm, "Cipher"); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; if (mode.length()) { try { result->_cspi->engineSetMode(mode); } catch (NoSuchAlgorithmException&) { delete result; throw; } } if (padding.length()) { try { result->_cspi->engineSetPadding(padding); } catch (NoSuchPaddingException&) { delete result; throw; } } return result; } else { delete m; throw NoSuchAlgorithmException("Incorrect Algorithm/Mode/Padding syntax"); } } Cipher* Cipher::getInstance(const String& transformation, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException) { UErrorCode status = U_ZERO_ERROR; if (!_amppat) { UParseError error; _amppat = RegexPattern::compile("(\\w+)(?:/(\\w*))?(?:/(\\w+))?", error, status); // shouldn't happen if (U_FAILURE(status)) throw RuntimeException("ICU regex compilation problem"); } RegexMatcher *m = _amppat->matcher(transformation.toUnicodeString(), status); if (m->matches(status)) { Security::spi* tmp; Cipher* result; // Step 1: try to find complete transformation try { tmp = Security::getSpi(transformation, "Cipher", provider); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } catch (NoSuchAlgorithmException&) { // no problem yet } String algorithm, mode, padding; algorithm = m->group(1, status); mode = m->group(2, status); padding = m->group(3, status); // clean up the matcher; we don't need it anymore delete m; // Step 2: try to find algorithm/mode if (mode.length()) { try { tmp = Security::getSpi(algorithm + "/" + mode, "Cipher", provider); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; if (padding.length()) { try { result->_cspi->engineSetPadding(padding); } catch (NoSuchPaddingException&) { delete result; throw; } } return result; } catch (NoSuchAlgorithmException&) { // no problem yet } } // Step 3: try to find algorithm//padding if (padding.length()) { try { tmp = Security::getSpi(algorithm + "//" + padding, "Cipher", provider); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; if (mode.length()) { try { result->_cspi->engineSetMode(mode); } catch (NoSuchAlgorithmException&) { delete result; throw; } } return result; } catch (NoSuchAlgorithmException&) { // no problem yet } } // Step 4: try to find algorithm tmp = Security::getSpi(algorithm, "Cipher", provider); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; if (mode.length()) { try { result->_cspi->engineSetMode(mode); } catch (NoSuchAlgorithmException&) { delete result; throw; } } if (padding.length()) { try { result->_cspi->engineSetPadding(padding); } catch (NoSuchPaddingException) { delete result; throw; } } return result; } else throw NoSuchAlgorithmException("Incorrect Algorithm/Mode/Padding syntax"); } Cipher* Cipher::getInstance(const String& transformation, const Provider& provider) throw (NoSuchAlgorithmException, NoSuchPaddingException) { UErrorCode status = U_ZERO_ERROR; if (!_amppat) { UParseError error; _amppat = RegexPattern::compile("(\\w+)(?:/(\\w*))?(?:/(\\w+))?", error, status); // shouldn't happen if (U_FAILURE(status)) throw RuntimeException("ICU regex compilation problem"); } RegexMatcher *m = _amppat->matcher(transformation.toUnicodeString(), status); if (m->matches(status)) { Security::spi* tmp; Cipher* result; // Step 1: try to find complete transformation try { tmp = Security::getSpi(transformation, "Cipher", provider); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } catch (NoSuchAlgorithmException&) { // no problem yet } String algorithm, mode, padding; algorithm = m->group(1, status); mode = m->group(2, status); padding = m->group(3, status); // clean up the matcher; we don't need it anymore delete m; // Step 2: try to find algorithm/mode if (mode.length()) { try { tmp = Security::getSpi(algorithm + "/" + mode, "Cipher", provider); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; if (padding.length()) { try { result->_cspi->engineSetPadding(padding); } catch (NoSuchPaddingException&) { delete result; throw; } } return result; } catch (NoSuchAlgorithmException&) { // no problem yet } } // Step 3: try to find algorithm//padding if (padding.length()) { try { tmp = Security::getSpi(algorithm + "//" + padding, "Cipher", provider); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; if (mode.length()) { try { result->_cspi->engineSetMode(mode); } catch (NoSuchAlgorithmException&) { delete result; throw; } } return result; } catch (NoSuchAlgorithmException&) { // no problem yet } } // Step 4: try to find algorithm tmp = Security::getSpi(algorithm, "Cipher", provider); assert(dynamic_cast((CipherSpi*) tmp->cspi)); result = new Cipher((CipherSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; if (mode.length()) { try { result->_cspi->engineSetMode(mode); } catch (NoSuchAlgorithmException&) { delete result; throw; } } if (padding.length()) { try { result->_cspi->engineSetPadding(padding); } catch (NoSuchPaddingException&) { delete result; throw; } } return result; } else throw NoSuchAlgorithmException("Incorrect Algorithm/Mode/Padding syntax"); } bytearray* Cipher::doFinal() throw (IllegalStateException, IllegalBlockSizeException, BadPaddingException) { if (!_init) throw IllegalStateException("Cipher not initialized"); return _cspi->engineDoFinal(0, 0, 0); } bytearray* Cipher::doFinal(const bytearray& input) throw (IllegalStateException, IllegalBlockSizeException, BadPaddingException) { if (!_init) throw IllegalStateException("Cipher not initialized"); return _cspi->engineDoFinal(input.data(), 0, input.size()); } int Cipher::doFinal(bytearray& output, int outputOffset) throw (IllegalStateException, IllegalBlockSizeException, ShortBufferException, BadPaddingException) { if (!_init) throw IllegalStateException("Cipher not initialized"); return _cspi->engineDoFinal(0, 0, 0, output, outputOffset); } bytearray* Cipher::doFinal(const byte* input, int inputOffset, int inputLength) throw (IllegalStateException, IllegalBlockSizeException, BadPaddingException) { if (!_init) throw IllegalStateException("Cipher not initialized"); return _cspi->engineDoFinal(input, inputOffset, inputLength); } int Cipher::doFinal(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (IllegalStateException, IllegalBlockSizeException, ShortBufferException, BadPaddingException) { if (!_init) throw IllegalStateException("Cipher not initialized"); return _cspi->engineDoFinal(input, inputOffset, inputLength, output, outputOffset); } int Cipher::getBlockSize() const throw () { return _cspi->engineGetBlockSize(); } bytearray* Cipher::getIV() { return _cspi->engineGetIV(); } int Cipher::getOutputSize(int inputLength) throw () { return _cspi->engineGetOutputSize(inputLength); } AlgorithmParameters* Cipher::getParameters() throw () { return _cspi->engineGetParameters(); } const String& Cipher::getAlgorithm() const throw () { return _algo; } const Provider& Cipher::getProvider() const throw () { return *_prov; } void Cipher::init(int opmode, const Certificate& certificate, SecureRandom* random) throw (InvalidKeyException) { _cspi->engineInit(opmode, certificate.getPublicKey(), random); _init = true; } void Cipher::init(int opmode, const Key& key, SecureRandom* random) throw (InvalidKeyException) { _cspi->engineInit(opmode, key, random); _init = true; } void Cipher::init(int opmode, const Key& key, AlgorithmParameters* params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) { _cspi->engineInit(opmode, key, params, random); _init = true; } void Cipher::init(int opmode, const Key& key, const AlgorithmParameterSpec& params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) { _cspi->engineInit(opmode, key, params, random); _init = true; } bytearray* Cipher::update(const bytearray& input) throw (IllegalStateException) { if (!_init) throw IllegalStateException("Cipher not initialized"); return _cspi->engineUpdate(input.data(), 0, input.size()); } bytearray* Cipher::update(const byte* input, int inputOffset, int inputLength) throw (IllegalStateException) { if (!_init) throw IllegalStateException("Cipher not initialized"); return _cspi->engineUpdate(input, inputOffset, inputLength); } int Cipher::update(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (IllegalStateException, ShortBufferException) { if (!_init) throw IllegalStateException("Cipher not initialized"); return _cspi->engineUpdate(input, inputOffset, inputLength, output, outputOffset); } beecrypt-4.2.1/c++/crypto/Mac.cxx0000664000175000001440000001017010201374657013372 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/Mac.h" #include "beecrypt/c++/lang/IllegalArgumentException.h" using beecrypt::lang::IllegalArgumentException; #include "beecrypt/c++/security/Security.h" using beecrypt::security::Security; using namespace beecrypt::crypto; Mac::Mac(MacSpi* spi, const Provider* provider, const String& algorithm) { _mspi = spi; _algo = algorithm; _prov = provider; _init = false; } Mac::~Mac() { delete _mspi; } Mac* Mac::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "Mac"); assert(dynamic_cast((MacSpi*) tmp->cspi)); Mac* result = new Mac((MacSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } Mac* Mac::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "Mac", provider); assert(dynamic_cast((MacSpi*) tmp->cspi)); Mac* result = new Mac((MacSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } Mac* Mac::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "Mac", provider); assert(dynamic_cast((MacSpi*) tmp->cspi)); Mac* result = new Mac((MacSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } Mac* Mac::clone() const throw () { // don't forget to also clone the _init state! Mac* result = new Mac(_mspi->clone(), _prov, _algo); result->_init = _init; return result; } const bytearray& Mac::doFinal() throw (IllegalStateException) { if (!_init) throw IllegalStateException(); return _mspi->engineDoFinal(); } const bytearray& Mac::doFinal(const bytearray& b) throw (IllegalStateException) { if (!_init) throw IllegalStateException(); _mspi->engineUpdate(b.data(), 0, b.size()); return _mspi->engineDoFinal(); } int Mac::doFinal(byte* data, int offset, int length) throw (IllegalStateException, ShortBufferException) { if (!_init) throw IllegalStateException(); return _mspi->engineDoFinal(data, offset, length); } int Mac::getMacLength() { return _mspi->engineGetMacLength(); } void Mac::init(const Key& key) throw (InvalidKeyException) { try { _mspi->engineInit(key, 0); } catch (InvalidAlgorithmParameterException&) { throw IllegalArgumentException("Mac apparently requires an AlgorithmParameterSpec"); } _init = true; } void Mac::init(const Key& key, const AlgorithmParameterSpec* spec) throw (InvalidKeyException, InvalidAlgorithmParameterException) { _mspi->engineInit(key, spec); _init = true; } void Mac::reset() { _mspi->engineReset(); } void Mac::update(byte b) throw (IllegalStateException) { if (!_init) throw IllegalStateException(); _mspi->engineUpdate(b); } void Mac::update(const bytearray& b) throw (IllegalStateException) { if (!_init) throw IllegalStateException(); _mspi->engineUpdate(b.data(), 0, b.size()); } void Mac::update(const byte* data, int offset, int length) throw (IllegalStateException) { if (!_init) throw IllegalStateException(); _mspi->engineUpdate(data, offset, length); } const String& Mac::getAlgorithm() const throw () { return _algo; } const Provider& Mac::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/c++/crypto/MacInputStream.cxx0000664000175000001440000000327010167730273015572 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/crypto/MacInputStream.h" #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::crypto; MacInputStream::MacInputStream(InputStream& in, Mac& m) : FilterInputStream(in), mac(m) { _on = true; } MacInputStream::~MacInputStream() { } int MacInputStream::read() throw (IOException) { int rc = in.read(); if (rc >= 0 && _on) mac.update((byte) rc); return rc; } int MacInputStream::read(byte *data, int offset, int length) throw (IOException) { if (!data) throw NullPointerException(); int rc = in.read(data, offset, length); if (rc >= 0 && _on) mac.update(data, offset, rc); return rc; } void MacInputStream::on(bool on) { _on = on; } Mac& MacInputStream::getMac() { return mac; } void MacInputStream::setMac(Mac& m) { mac = m; } beecrypt-4.2.1/c++/testdsa.cxx0000664000175000001440000000453510202642343013020 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/AlgorithmParameterGenerator.h" using beecrypt::security::AlgorithmParameterGenerator; #include "beecrypt/c++/security/AlgorithmParameters.h" using beecrypt::security::AlgorithmParameters; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; #include "beecrypt/c++/security/KeyPairGenerator.h" using beecrypt::security::KeyPairGenerator; #include "beecrypt/c++/security/Signature.h" using beecrypt::security::Signature; #include "beecrypt/c++/security/spec/EncodedKeySpec.h" using beecrypt::security::spec::EncodedKeySpec; #include using namespace std; #include int main(int argc, char* argv[]) { int failures = 0; try { KeyPairGenerator* kpg = KeyPairGenerator::getInstance("DSA"); kpg->initialize(1024); KeyPair* pair = kpg->generateKeyPair(); Signature* sig = Signature::getInstance("SHA1withDSA"); sig->initSign(pair->getPrivate()); bytearray* tmp = sig->sign(); sig->initVerify(pair->getPublic()); if (!sig->verify(*tmp)) failures++; KeyFactory* kf = KeyFactory::getInstance(pair->getPublic().getAlgorithm()); KeySpec* spec = kf->getKeySpec(pair->getPublic(), typeid(EncodedKeySpec)); PublicKey* pub = kf->generatePublic(*spec); delete pub; delete spec; delete kf; delete tmp; delete sig; delete pair; delete kpg; } catch (Exception& ex) { cerr << "exception: " << ex.getMessage() << endl; failures++; } catch (...) { cerr << "exception" << endl; failures++; } return failures; } beecrypt-4.2.1/c++/security/0000777000175000001440000000000011226307273012556 500000000000000beecrypt-4.2.1/c++/security/DigestInputStream.cxx0000664000175000001440000000335610170521630016632 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/DigestInputStream.h" using namespace beecrypt::security; DigestInputStream::DigestInputStream(InputStream& in, MessageDigest& m) : FilterInputStream(in), digest(m) { _on = true; } int DigestInputStream::read() throw (IOException) { int rc = in.read(); if (rc >= 0 && _on) digest.update((byte) rc); return rc; } int DigestInputStream::read(byte *data, int offset, int length) throw (IOException) { if (!data) throw NullPointerException(); int rc = in.read(data, offset, length); if (rc >= 0 && _on) digest.update(data, offset, rc); return rc; } void DigestInputStream::on(bool on) { _on = on; } MessageDigest& DigestInputStream::getMessageDigest() { return digest; } void DigestInputStream::setMessageDigest(MessageDigest& m) { digest = m; } beecrypt-4.2.1/c++/security/spec/0000777000175000001440000000000011226307273013510 500000000000000beecrypt-4.2.1/c++/security/spec/DSAParameterSpec.cxx0000664000175000001440000000265710204665045017246 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/spec/DSAParameterSpec.h" using namespace beecrypt::security::spec; DSAParameterSpec::DSAParameterSpec(const DSAParams& copy) { _p = copy.getP(); _q = copy.getQ(); _g = copy.getG(); } DSAParameterSpec::DSAParameterSpec(const BigInteger& p, const BigInteger& q, const BigInteger& g) { _p = p; _q = q; _g = g; } const BigInteger& DSAParameterSpec::getP() const throw () { return _p; } const BigInteger& DSAParameterSpec::getQ() const throw () { return _q; } const BigInteger& DSAParameterSpec::getG() const throw () { return _g; } beecrypt-4.2.1/c++/security/spec/RSAKeyGenParameterSpec.cxx0000664000175000001440000000257210204661760020363 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/spec/RSAKeyGenParameterSpec.h" using namespace beecrypt::security::spec; const BigInteger RSAKeyGenParameterSpec::F0(3); const BigInteger RSAKeyGenParameterSpec::F4(65537); RSAKeyGenParameterSpec::RSAKeyGenParameterSpec(int keysize, const BigInteger& publicExponent) { _keysize = keysize; _e = publicExponent; } int RSAKeyGenParameterSpec::getKeysize() const throw () { return _keysize; } const BigInteger& RSAKeyGenParameterSpec::getPublicExponent() const throw () { return _e; } beecrypt-4.2.1/c++/security/spec/RSAPrivateCrtKeySpec.cxx0000664000175000001440000000370210204666450020071 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/spec/RSAPrivateCrtKeySpec.h" using namespace beecrypt::security::spec; RSAPrivateCrtKeySpec::RSAPrivateCrtKeySpec(const BigInteger& modulus, const BigInteger& publicExponent, const BigInteger& privateExponent, const BigInteger& primeP, const BigInteger& primeQ, const BigInteger& primeExponentP, const BigInteger& primeExponentQ, const BigInteger& crtCoefficient) : RSAPrivateKeySpec(modulus, privateExponent) { _e = publicExponent; _p = primeP; _q = primeQ; _dp = primeExponentP; _dq = primeExponentQ; _qi = crtCoefficient; } const BigInteger& RSAPrivateCrtKeySpec::getPublicExponent() const throw () { return _e; } const BigInteger& RSAPrivateCrtKeySpec::getPrimeP() const throw () { return _p; } const BigInteger& RSAPrivateCrtKeySpec::getPrimeQ() const throw () { return _q; } const BigInteger& RSAPrivateCrtKeySpec::getPrimeExponentP() const throw () { return _dp; } const BigInteger& RSAPrivateCrtKeySpec::getPrimeExponentQ() const throw () { return _dq; } const BigInteger& RSAPrivateCrtKeySpec::getCrtCoefficient() const throw () { return _qi; } beecrypt-4.2.1/c++/security/spec/RSAPublicKeySpec.cxx0000664000175000001440000000240710204666364017231 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/spec/RSAPublicKeySpec.h" using namespace beecrypt::security::spec; RSAPublicKeySpec::RSAPublicKeySpec(const BigInteger& modulus, const BigInteger& publicExponent) { _n = modulus; _e = publicExponent; } const BigInteger& RSAPublicKeySpec::getModulus() const throw () { return _n; } const BigInteger& RSAPublicKeySpec::getPublicExponent() const throw () { return _e; } beecrypt-4.2.1/c++/security/spec/DSAPublicKeySpec.cxx0000664000175000001440000000263110204665371017207 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/spec/DSAPublicKeySpec.h" using namespace beecrypt::security::spec; DSAPublicKeySpec::DSAPublicKeySpec(const BigInteger& y, const BigInteger& p, const BigInteger& q, const BigInteger& g) : _p(p), _q(q), _g(g), _y(y) { } const BigInteger& DSAPublicKeySpec::getP() const throw () { return _p; } const BigInteger& DSAPublicKeySpec::getQ() const throw () { return _q; } const BigInteger& DSAPublicKeySpec::getG() const throw () { return _g; } const BigInteger& DSAPublicKeySpec::getY() const throw () { return _y; } beecrypt-4.2.1/c++/security/spec/Makefile.in0000644000175000001440000004131211226307161015466 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = c++/security/spec DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxsecurityspec_la_LIBADD = am_libcxxsecurityspec_la_OBJECTS = DSAParameterSpec.lo \ DSAPrivateKeySpec.lo DSAPublicKeySpec.lo EncodedKeySpec.lo \ RSAKeyGenParameterSpec.lo RSAPrivateCrtKeySpec.lo \ RSAPrivateKeySpec.lo RSAPublicKeySpec.lo libcxxsecurityspec_la_OBJECTS = $(am_libcxxsecurityspec_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxsecurityspec_la_SOURCES) DIST_SOURCES = $(libcxxsecurityspec_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxsecurityspec.la cxxsecurityspecdir = $(pkgincludedir)/c++/security/spec libcxxsecurityspec_la_SOURCES = \ DSAParameterSpec.cxx \ DSAPrivateKeySpec.cxx \ DSAPublicKeySpec.cxx \ EncodedKeySpec.cxx \ RSAKeyGenParameterSpec.cxx \ RSAPrivateCrtKeySpec.cxx \ RSAPrivateKeySpec.cxx \ RSAPublicKeySpec.cxx all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/security/spec/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/security/spec/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxsecurityspec.la: $(libcxxsecurityspec_la_OBJECTS) $(libcxxsecurityspec_la_DEPENDENCIES) $(CXXLINK) $(libcxxsecurityspec_la_OBJECTS) $(libcxxsecurityspec_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DSAParameterSpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DSAPrivateKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DSAPublicKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EncodedKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RSAKeyGenParameterSpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RSAPrivateCrtKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RSAPrivateKeySpec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RSAPublicKeySpec.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/security/spec/DSAPrivateKeySpec.cxx0000664000175000001440000000263710204666261017410 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/spec/DSAPrivateKeySpec.h" using namespace beecrypt::security::spec; DSAPrivateKeySpec::DSAPrivateKeySpec(const BigInteger& x, const BigInteger& p, const BigInteger& q, const BigInteger& g): _p(p), _q(q), _g(g), _x(x) { } const BigInteger& DSAPrivateKeySpec::getP() const throw () { return _p; } const BigInteger& DSAPrivateKeySpec::getQ() const throw () { return _q; } const BigInteger& DSAPrivateKeySpec::getG() const throw () { return _g; } const BigInteger& DSAPrivateKeySpec::getX() const throw () { return _x; } beecrypt-4.2.1/c++/security/spec/Makefile.am0000664000175000001440000000060010502514164015451 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxsecurityspec.la cxxsecurityspecdir=$(pkgincludedir)/c++/security/spec libcxxsecurityspec_la_SOURCES =\ DSAParameterSpec.cxx \ DSAPrivateKeySpec.cxx \ DSAPublicKeySpec.cxx \ EncodedKeySpec.cxx \ RSAKeyGenParameterSpec.cxx \ RSAPrivateCrtKeySpec.cxx \ RSAPrivateKeySpec.cxx \ RSAPublicKeySpec.cxx beecrypt-4.2.1/c++/security/spec/EncodedKeySpec.cxx0000664000175000001440000000231110201157526016770 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/spec/EncodedKeySpec.h" using namespace beecrypt::security::spec; EncodedKeySpec::EncodedKeySpec(const byte* data, int size) : _encoded(data, size) { } EncodedKeySpec::EncodedKeySpec(const bytearray& copy) : _encoded(copy) { } const bytearray& EncodedKeySpec::getEncoded() const throw () { return _encoded; } beecrypt-4.2.1/c++/security/spec/RSAPrivateKeySpec.cxx0000664000175000001440000000241710204666547017431 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/spec/RSAPrivateKeySpec.h" using namespace beecrypt::security::spec; RSAPrivateKeySpec::RSAPrivateKeySpec(const BigInteger& modulus, const BigInteger& privateExponent) { _n = modulus; _d = privateExponent; } const BigInteger& RSAPrivateKeySpec::getModulus() const throw () { return _n; } const BigInteger& RSAPrivateKeySpec::getPrivateExponent() const throw () { return _d; } beecrypt-4.2.1/c++/security/MessageDigest.cxx0000664000175000001440000000701310177412562015747 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/MessageDigest.h" #include "beecrypt/c++/security/Security.h" using namespace beecrypt::security; MessageDigest::MessageDigest(MessageDigestSpi* spi, const Provider* provider, const String& algorithm) { _mspi = spi; _prov = provider; _algo = algorithm; } MessageDigest::~MessageDigest() { delete _mspi; } MessageDigest* MessageDigest::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "MessageDigest"); assert(dynamic_cast((MessageDigestSpi*) tmp->cspi)); MessageDigest* result = new MessageDigest((MessageDigestSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } MessageDigest* MessageDigest::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "MessageDigest", provider); assert(dynamic_cast((MessageDigestSpi*) tmp->cspi)); MessageDigest* result = new MessageDigest((MessageDigestSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } MessageDigest* MessageDigest::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "MessageDigest", provider); assert(dynamic_cast((MessageDigestSpi*) tmp->cspi)); MessageDigest* result = new MessageDigest((MessageDigestSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } MessageDigest* MessageDigest::clone() const throw (CloneNotSupportedException) { MessageDigestSpi* _mspc = _mspi->clone(); if (_mspc) return new MessageDigest(_mspc, _prov, _algo); else return 0; } const bytearray& MessageDigest::digest() { return _mspi->engineDigest(); } const bytearray& MessageDigest::digest(const bytearray& b) { _mspi->engineUpdate(b.data(), 0, b.size()); return _mspi->engineDigest(); } int MessageDigest::digest(byte* data, int offset, int length) throw (ShortBufferException) { return _mspi->engineDigest(data, offset, length); } int MessageDigest::getDigestLength() { return _mspi->engineGetDigestLength(); } void MessageDigest::reset() { _mspi->engineReset(); } void MessageDigest::update(byte b) { _mspi->engineUpdate(b); } void MessageDigest::update(const bytearray& b) { _mspi->engineUpdate(b.data(), 0, b.size()); } void MessageDigest::update(const byte* data, int offset, int length) { _mspi->engineUpdate(data, offset, length); } const String& MessageDigest::getAlgorithm() const throw () { return _algo; } const Provider& MessageDigest::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/c++/security/Provider.cxx0000664000175000001440000000576510207107700015016 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/Provider.h" #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; using namespace beecrypt::security; Provider::Instantiator::Instantiator(instantiator inst) : _inst(inst) { } Object* Provider::Instantiator::instantiate() { return _inst(); } Provider::Provider(const String& name, double version, const String& info) { _name = name; _info = info; _vers = version; UErrorCode status = U_ZERO_ERROR; _conv = ucnv_open(NULL, &status); if (U_FAILURE(status)) throw RuntimeException("failed to create default unicode converter"); #if WIN32 _dlhandle = NULL; #elif defined(RTLD_DEFAULT) _dlhandle = RTLD_DEFAULT; #else _dlhandle = (void*) 0; #endif } Provider::~Provider() { ucnv_close(_conv); } Object* Provider::instantiate(const String& key) const { Instantiator* inst = _imap.get(&key); if (inst) return inst->instantiate(); else return 0; } Object* Provider::setProperty(const String& key, const String& value) { Object* result = 0; synchronized (this) { // add it in the properties result = Properties::setProperty(key, value); // add it in the instantiator map only if there is no space in the value (i.e. it's a property instead of a class) if (value.indexOf((UChar) 0x20) == -1) { const array& src = value.toCharArray(); char symname[1024]; UErrorCode status = U_ZERO_ERROR; ucnv_fromUChars(_conv, symname, 1024, src.data(), src.size(), &status); if (status != U_ZERO_ERROR) throw RuntimeException("error in ucnv_fromUChars"); instantiator i; #if WIN32 if (!_dlhandle) _dlhandle = GetModuleHandle(NULL); i = (instantiator) GetProcAddress((HMODULE) _dlhandle, symname); #elif HAVE_DLFCN_H i = (instantiator) dlsym(_dlhandle, symname); #else # error #endif if (i) { Instantiator* tmp = _imap.put(new String(key), new Instantiator(i)); assert(tmp == 0); } } } return result; } const String& Provider::getInfo() const throw () { return _info; } const String& Provider::getName() const throw () { return _name; } double Provider::getVersion() const throw () { return _vers; } beecrypt-4.2.1/c++/security/SecureRandom.cxx0000664000175000001440000000622410177412562015615 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/SecureRandom.h" #include "beecrypt/c++/security/SecureRandomSpi.h" #include "beecrypt/c++/security/Security.h" using namespace beecrypt::security; SecureRandom* SecureRandom::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "SecureRandom"); assert(dynamic_cast(tmp->cspi)); SecureRandom* result = new SecureRandom(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } SecureRandom* SecureRandom::getInstance(const String& type, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(type, "SecureRandom", provider); assert(dynamic_cast(tmp->cspi)); SecureRandom* result = new SecureRandom(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } SecureRandom* SecureRandom::getInstance(const String& type, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(type, "SecureRandom", provider); assert(dynamic_cast(tmp->cspi)); SecureRandom* result = new SecureRandom(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } void SecureRandom::getSeed(byte* data, int size) { entropyGatherNext(data, size); } SecureRandom::SecureRandom() { Security::spi* tmp = Security::getFirstSpi("SecureRandom"); assert(dynamic_cast((SecureRandomSpi*) tmp->cspi)); _rspi = (SecureRandomSpi*) tmp->cspi; _type = tmp->name; _prov = tmp->prov; delete tmp; } SecureRandom::SecureRandom(SecureRandomSpi* rspi, const Provider* provider, const String& type) { _rspi = rspi; _prov = provider; _type = type; } SecureRandom::~SecureRandom() { delete _rspi; } void SecureRandom::generateSeed(byte* data, int size) { _rspi->engineGenerateSeed(data, size); } void SecureRandom::setSeed(const byte* data, int size) { _rspi->engineSetSeed(data, size); } void SecureRandom::nextBytes(byte* data, int size) { _rspi->engineNextBytes(data, size); } const String& SecureRandom::getType() const throw () { return _type; } const Provider& SecureRandom::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/c++/security/AlgorithmParameters.cxx0000664000175000001440000000710210202676305017170 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/AlgorithmParameters.h" #include "beecrypt/c++/security/AlgorithmParametersSpi.h" #include "beecrypt/c++/security/Provider.h" #include "beecrypt/c++/security/Security.h" #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; using namespace beecrypt::security; AlgorithmParameters::AlgorithmParameters(AlgorithmParametersSpi* spi, const Provider* provider, const String& algorithm) { _aspi = spi; _prov = provider; _algo = algorithm; } AlgorithmParameters::~AlgorithmParameters() { delete _aspi; } AlgorithmParameters* AlgorithmParameters::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "AlgorithmParameters"); assert(dynamic_cast(tmp->cspi)); AlgorithmParameters* result = new AlgorithmParameters(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } AlgorithmParameters* AlgorithmParameters::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "AlgorithmParameters", provider); assert(dynamic_cast(tmp->cspi)); AlgorithmParameters* result = new AlgorithmParameters(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } AlgorithmParameters* AlgorithmParameters::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "AlgorithmParameters", provider); assert(dynamic_cast(tmp->cspi)); AlgorithmParameters* result = new AlgorithmParameters(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } const bytearray& AlgorithmParameters::getEncoded(const String* format) throw (IOException) { return _aspi->engineGetEncoded(format); } AlgorithmParameterSpec* AlgorithmParameters::getParameterSpec(const type_info& info) throw (InvalidParameterSpecException) { return _aspi->engineGetParameterSpec(info); } void AlgorithmParameters::init(const AlgorithmParameterSpec& spec) throw (InvalidParameterSpecException) { _aspi->engineInit(spec); } void AlgorithmParameters::init(const byte* data, int size, const String* format) { _aspi->engineInit(data, size, format); } const String& AlgorithmParameters::getAlgorithm() const throw () { return _algo; } const Provider& AlgorithmParameters::getProvider() const throw () { return *_prov; } String AlgorithmParameters::toString() throw () { return _aspi->engineToString(); } beecrypt-4.2.1/c++/security/DigestOutputStream.cxx0000664000175000001440000000326410170522050017026 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/security/DigestOutputStream.h" using namespace beecrypt::security; DigestOutputStream::DigestOutputStream(OutputStream& out, MessageDigest& m) : FilterOutputStream(out), digest(m) { _on = true; } void DigestOutputStream::write(byte b) throw (IOException) { out.write(b); if (_on) digest.update(b); } void DigestOutputStream::write(const byte *data, int offset, int length) throw (IOException) { if (length) { out.write(data, offset, length); if (_on) digest.update(data, offset, length); } } void DigestOutputStream::on(bool on) { _on = on; } MessageDigest& DigestOutputStream::getMessageDigest() { return digest; } void DigestOutputStream::setMessageDigest(MessageDigest& m) { digest = m; } beecrypt-4.2.1/c++/security/Makefile.in0000644000175000001440000005512611226307161014544 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = c++/security DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxsecurity_la_DEPENDENCIES = cert/libcxxsecuritycert.la \ spec/libcxxsecurityspec.la am_libcxxsecurity_la_OBJECTS = AlgorithmParameterGenerator.lo \ AlgorithmParameters.lo DigestInputStream.lo \ DigestOutputStream.lo KeyFactory.lo KeyPair.lo \ KeyPairGenerator.lo KeyStore.lo MessageDigest.lo Provider.lo \ SecureRandom.lo Security.lo Signature.lo libcxxsecurity_la_OBJECTS = $(am_libcxxsecurity_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxsecurity_la_SOURCES) DIST_SOURCES = $(libcxxsecurity_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = auth cert spec noinst_LTLIBRARIES = libcxxsecurity.la cxxsecuritydir = $(pkgincludedir)/c++/security libcxxsecurity_la_SOURCES = \ AlgorithmParameterGenerator.cxx \ AlgorithmParameters.cxx \ DigestInputStream.cxx \ DigestOutputStream.cxx \ KeyFactory.cxx \ KeyPair.cxx \ KeyPairGenerator.cxx \ KeyStore.cxx \ MessageDigest.cxx \ Provider.cxx \ SecureRandom.cxx \ Security.cxx \ Signature.cxx libcxxsecurity_la_LIBADD = cert/libcxxsecuritycert.la spec/libcxxsecurityspec.la all: all-recursive .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/security/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/security/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxsecurity.la: $(libcxxsecurity_la_OBJECTS) $(libcxxsecurity_la_DEPENDENCIES) $(CXXLINK) $(libcxxsecurity_la_OBJECTS) $(libcxxsecurity_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AlgorithmParameterGenerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AlgorithmParameters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DigestInputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DigestOutputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/KeyFactory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/KeyPair.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/KeyPairGenerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/KeyStore.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageDigest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Provider.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SecureRandom.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Security.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Signature.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/security/KeyPair.cxx0000664000175000001440000000256410177400546014574 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/KeyPair.h" #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::security; KeyPair::KeyPair(PublicKey* pub, PrivateKey* pri) : _pub(pub), _pri(pri) { if (_pub == 0 || _pri == 0) throw NullPointerException(); } KeyPair::~KeyPair() { delete _pub; delete _pri; } const PublicKey& KeyPair::getPublic() const throw () { return *_pub; } const PrivateKey& KeyPair::getPrivate() const throw () { return *_pri; } beecrypt-4.2.1/c++/security/cert/0000777000175000001440000000000011226307273013513 500000000000000beecrypt-4.2.1/c++/security/cert/Makefile.in0000644000175000001440000004023011226307161015467 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = c++/security/cert DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcxxsecuritycert_la_LIBADD = am_libcxxsecuritycert_la_OBJECTS = Certificate.lo \ CertificateFactory.lo CertPath.lo CertPathValidator.lo libcxxsecuritycert_la_OBJECTS = $(am_libcxxsecuritycert_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcxxsecuritycert_la_SOURCES) DIST_SOURCES = $(libcxxsecuritycert_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxsecuritycert.la cxxsecuritycertdir = $(pkgincludedir)/c++/security/cert libcxxsecuritycert_la_SOURCES = \ Certificate.cxx \ CertificateFactory.cxx \ CertPath.cxx \ CertPathValidator.cxx all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/security/cert/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/security/cert/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libcxxsecuritycert.la: $(libcxxsecuritycert_la_OBJECTS) $(libcxxsecuritycert_la_DEPENDENCIES) $(CXXLINK) $(libcxxsecuritycert_la_OBJECTS) $(libcxxsecuritycert_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CertPath.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CertPathValidator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Certificate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CertificateFactory.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/security/cert/CertPath.cxx0000664000175000001440000000211410170470761015665 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/cert/CertPath.h" using namespace beecrypt::security::cert; CertPath::CertPath(const String& type) { _type = type; } const String& CertPath::getType() const throw () { return _type; } beecrypt-4.2.1/c++/security/cert/Makefile.am0000664000175000001440000000042010502514114015447 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libcxxsecuritycert.la cxxsecuritycertdir=$(pkgincludedir)/c++/security/cert libcxxsecuritycert_la_SOURCES =\ Certificate.cxx \ CertificateFactory.cxx \ CertPath.cxx \ CertPathValidator.cxx beecrypt-4.2.1/c++/security/cert/CertificateFactory.cxx0000664000175000001440000000574610207107474017742 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/cert/CertificateFactory.h" #include "beecrypt/c++/security/Security.h" using namespace beecrypt::security::cert; CertificateFactory::CertificateFactory(CertificateFactorySpi* spi, const Provider* provider, const String& type) { _cspi = spi; _prov = provider; _type = type; } CertificateFactory::~CertificateFactory() { delete _cspi; } CertificateFactory* CertificateFactory::getInstance(const String& type) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(type, "CertificateFactory"); assert(dynamic_cast((CertificateFactorySpi*) tmp->cspi)); CertificateFactory* result = new CertificateFactory((CertificateFactorySpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } CertificateFactory* CertificateFactory::getInstance(const String& type, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(type, "CertificateFactory", provider); assert(dynamic_cast((CertificateFactorySpi*) tmp->cspi)); CertificateFactory* result = new CertificateFactory((CertificateFactorySpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } CertificateFactory* CertificateFactory::getInstance(const String& type, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(type, "CertificateFactory", provider); assert(dynamic_cast((CertificateFactorySpi*) tmp->cspi)); CertificateFactory* result = new CertificateFactory((CertificateFactorySpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } Certificate* CertificateFactory::generateCertificate(InputStream& in) throw (CertificateException) { return _cspi->engineGenerateCertificate(in); } Collection* CertificateFactory::generateCertificates(InputStream& in) throw (CertificateException) { return _cspi->engineGenerateCertificates(in); } const String& CertificateFactory::getType() const throw () { return _type; } const Provider& CertificateFactory::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/c++/security/cert/Certificate.cxx0000664000175000001440000000267610170471007016404 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/cert/Certificate.h" #include using namespace beecrypt::security::cert; Certificate::Certificate(const String& type) { _type = type; } bool Certificate::equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const Certificate* c = dynamic_cast(obj); if (c) { if (!_type.equals(&c->_type)) return false; if (getEncoded() != c->getEncoded()) return false; return true; } } return false; } const String& Certificate::getType() const throw () { return _type; } beecrypt-4.2.1/c++/security/cert/CertPathValidator.cxx0000664000175000001440000000537710207107511017540 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/cert/CertPathValidator.h" #include "beecrypt/c++/security/Security.h" using namespace beecrypt::security::cert; CertPathValidator::CertPathValidator(CertPathValidatorSpi* spi, const Provider* provider, const String& algorithm) { _cspi = spi; _prov = provider; _algo = algorithm; } CertPathValidator::~CertPathValidator() { delete _cspi; } CertPathValidator* CertPathValidator::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "CertPathValidator"); assert(dynamic_cast((CertPathValidatorSpi*) tmp->cspi)); CertPathValidator* result = new CertPathValidator((CertPathValidatorSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } CertPathValidator* CertPathValidator::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "CertPathValidator", provider); assert(dynamic_cast((CertPathValidatorSpi*) tmp->cspi)); CertPathValidator* result = new CertPathValidator((CertPathValidatorSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } CertPathValidator* CertPathValidator::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "CertPathValidator", provider); assert(dynamic_cast((CertPathValidatorSpi*) tmp->cspi)); CertPathValidator* result = new CertPathValidator((CertPathValidatorSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } CertPathValidatorResult* CertPathValidator::validate(const CertPath& certPath, const CertPathParameters& params) throw (CertPathValidatorException, InvalidAlgorithmParameterException) { return _cspi->engineValidate(certPath, params); } beecrypt-4.2.1/c++/security/KeyPairGenerator.cxx0000664000175000001440000000637510177412562016450 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/KeyPairGenerator.h" #include "beecrypt/c++/security/Security.h" using namespace beecrypt::security; KeyPairGenerator::KeyPairGenerator(KeyPairGeneratorSpi* spi, const Provider* provider, const String& algorithm) { _kspi = spi; _prov = provider; _algo = algorithm; } KeyPairGenerator::~KeyPairGenerator() { delete _kspi; } KeyPairGenerator* KeyPairGenerator::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "KeyPairGenerator"); KeyPairGenerator* result = new KeyPairGenerator(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } KeyPairGenerator* KeyPairGenerator::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "KeyPairGenerator", provider); assert(dynamic_cast(tmp->cspi)); KeyPairGenerator* result = new KeyPairGenerator(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } KeyPairGenerator* KeyPairGenerator::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "KeyPairGenerator", provider); assert(dynamic_cast(tmp->cspi)); KeyPairGenerator* result = new KeyPairGenerator(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } KeyPair* KeyPairGenerator::generateKeyPair() { return _kspi->engineGenerateKeyPair(); } void KeyPairGenerator::initialize(const AlgorithmParameterSpec& spec) throw (InvalidAlgorithmParameterException) { _kspi->engineInitialize(spec, 0); } void KeyPairGenerator::initialize(const AlgorithmParameterSpec& spec, SecureRandom* random) throw (InvalidAlgorithmParameterException) { _kspi->engineInitialize(spec, random); } void KeyPairGenerator::initialize(int keysize) throw (InvalidParameterException) { _kspi->engineInitialize(keysize, 0); } void KeyPairGenerator::initialize(int keysize, SecureRandom* random) throw (InvalidParameterException) { _kspi->engineInitialize(keysize, random); } const String& KeyPairGenerator::getAlgorithm() const throw () { return _algo; } const Provider& KeyPairGenerator::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/c++/security/Makefile.am0000644000175000001440000000104011216147022014512 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu SUBDIRS = auth cert spec noinst_LTLIBRARIES = libcxxsecurity.la cxxsecuritydir=$(pkgincludedir)/c++/security libcxxsecurity_la_SOURCES =\ AlgorithmParameterGenerator.cxx \ AlgorithmParameters.cxx \ DigestInputStream.cxx \ DigestOutputStream.cxx \ KeyFactory.cxx \ KeyPair.cxx \ KeyPairGenerator.cxx \ KeyStore.cxx \ MessageDigest.cxx \ Provider.cxx \ SecureRandom.cxx \ Security.cxx \ Signature.cxx libcxxsecurity_la_LIBADD = cert/libcxxsecuritycert.la spec/libcxxsecurityspec.la beecrypt-4.2.1/c++/security/KeyFactory.cxx0000664000175000001440000000603210201374311015266 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/KeyFactory.h" #include "beecrypt/c++/security/Security.h" using namespace beecrypt::security; KeyFactory::KeyFactory(KeyFactorySpi* spi, const Provider* provider, const String& algorithm) { _kspi = spi; _prov = provider; _algo = algorithm; } KeyFactory::~KeyFactory() { delete _kspi; } KeyFactory* KeyFactory::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "KeyFactory"); assert(dynamic_cast(tmp->cspi)); KeyFactory* result = new KeyFactory(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } KeyFactory* KeyFactory::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "KeyFactory", provider); assert(dynamic_cast(tmp->cspi)); KeyFactory* result = new KeyFactory(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } KeyFactory* KeyFactory::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "KeyFactory", provider); assert(dynamic_cast(tmp->cspi)); KeyFactory* result = new KeyFactory(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } PrivateKey* KeyFactory::generatePrivate(const KeySpec& spec) throw (InvalidKeySpecException) { return _kspi->engineGeneratePrivate(spec); } PublicKey* KeyFactory::generatePublic(const KeySpec& spec) throw (InvalidKeySpecException) { return _kspi->engineGeneratePublic(spec); } KeySpec* KeyFactory::getKeySpec(const Key& key, const type_info& info) throw (InvalidKeySpecException) { return _kspi->engineGetKeySpec(key, info); } Key* KeyFactory::translateKey(const Key& key) throw (InvalidKeyException) { return _kspi->engineTranslateKey(key); } const String& KeyFactory::getAlgorithm() const throw () { return _algo; } const Provider& KeyFactory::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/c++/security/KeyStore.cxx0000664000175000001440000002265210262514147014773 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/KeyStore.h" #include "beecrypt/c++/security/Security.h" #include "beecrypt/c++/lang/StringBuilder.h" using beecrypt::lang::StringBuilder; #include "beecrypt/c++/lang/IllegalArgumentException.h" using beecrypt::lang::IllegalArgumentException; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::security; KeyStore::PasswordProtection::PasswordProtection(const array* password) : _pwd(password ? new array(*password) : 0), _destroyed(false) { } KeyStore::PasswordProtection::~PasswordProtection() { try { destroy(); } catch (DestroyFailedException&) { } } void KeyStore::PasswordProtection::destroy() throw (DestroyFailedException) { synchronized (this) { if (!_destroyed) { _destroyed = true; if (_pwd) { _pwd->fill((jchar) ' '); delete _pwd; _pwd = 0; } } } } const array* KeyStore::PasswordProtection::getPassword() const { const array* result = 0; synchronized (this) { if (_destroyed) throw IllegalStateException("password was destroyed"); result = _pwd; } return result; } bool KeyStore::PasswordProtection::isDestroyed() const throw () { bool result; synchronized (this) { result = _destroyed; } return result; } KeyStore::PrivateKeyEntry::PrivateKeyEntry(PrivateKey* privateKey, const array& chain) : _pri(privateKey), _chain(chain) { if (_pri == 0) throw NullPointerException("private key is null"); if (_chain.size() == 0) throw IllegalArgumentException("chain must contain at least one certificate"); for (int i = 0; i < _chain.size(); i++) if (_chain[i] == 0) throw IllegalArgumentException("chain contains null"); for (int i = 1; i < _chain.size(); i++) if (!_chain[i]->getType().equals(_chain[0]->getType())) throw IllegalArgumentException("chain contains certificates of different types"); if (!_pri->getAlgorithm().equals(_chain[0]->getPublicKey().getAlgorithm())) throw IllegalArgumentException("private key algorithm does not match public key algorithm in first certificate"); } KeyStore::PrivateKeyEntry::~PrivateKeyEntry() { delete _pri; for (int i = 0; i < _chain.size(); i++) delete _chain[i]; } const Certificate& KeyStore::PrivateKeyEntry::getCertificate() const { return *(_chain[0]); } const array& KeyStore::PrivateKeyEntry::getCertificateChain() const { return _chain; } const PrivateKey& KeyStore::PrivateKeyEntry::getPrivateKey() const { return *_pri; } String KeyStore::PrivateKeyEntry::toString() const throw () { StringBuilder tmp("private key entry and certificate chain with "); tmp.append(_chain.size()).append(" elements:\r\n"); for (int i = 0; i < _chain.size(); i++) tmp.append(_chain[i]->toString()).append("\r\n"); return tmp.toString(); } KeyStore::SecretKeyEntry::SecretKeyEntry(SecretKey* secretKey) : _sec(secretKey) { if (_sec == 0) throw NullPointerException("secret key is null"); } KeyStore::SecretKeyEntry::~SecretKeyEntry() { delete _sec; } const SecretKey& KeyStore::SecretKeyEntry::getSecretKey() const { return *_sec; } String KeyStore::SecretKeyEntry::toString() const throw () { return String("secret key entry with algorithm ") + _sec->getAlgorithm(); } KeyStore::TrustedCertificateEntry::TrustedCertificateEntry(Certificate* cert) : _cert(cert) { if (_cert == 0) throw NullPointerException("certificate is null"); } KeyStore::TrustedCertificateEntry::~TrustedCertificateEntry() { delete _cert; } const Certificate& KeyStore::TrustedCertificateEntry::getTrustedCertificate() const { return *_cert; } String KeyStore::TrustedCertificateEntry::toString() const throw () { return String("trusted certificate entry:\r\n") + _cert->toString(); } KeyStore::KeyStore(KeyStoreSpi* spi, const Provider* provider, const String& type) { _kspi = spi; _prov = provider; _type = type; _init = false; } KeyStore::~KeyStore() { delete _kspi; } KeyStore* KeyStore::getInstance(const String& type) throw (KeyStoreException) { try { Security::spi* tmp = Security::getSpi(type, "KeyStore"); assert(dynamic_cast(tmp->cspi)); KeyStore* result = new KeyStore(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } catch (NoSuchAlgorithmException& e) { throw KeyStoreException().initCause(e); } } KeyStore* KeyStore::getInstance(const String& type, const String& provider) throw (KeyStoreException, NoSuchProviderException) { try { Security::spi* tmp = Security::getSpi(type, "KeyStore", provider); assert(dynamic_cast(tmp->cspi)); KeyStore* result = new KeyStore(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } catch (NoSuchAlgorithmException& e) { throw KeyStoreException().initCause(e); } } KeyStore* KeyStore::getInstance(const String& type, const Provider& provider) throw (KeyStoreException) { try { Security::spi* tmp = Security::getSpi(type, "KeyStore", provider); assert(dynamic_cast(tmp->cspi)); KeyStore* result = new KeyStore(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } catch (NoSuchAlgorithmException& e) { throw KeyStoreException().initCause(e); } } const String& KeyStore::getDefaultType() { return Security::getKeyStoreDefault(); } Key* KeyStore::getKey(const String& alias, const array& password) throw (KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException) { if (!_init) throw KeyStoreException("uninitialized keystore"); return _kspi->engineGetKey(alias, password); } void KeyStore::setKeyEntry(const String& alias, const bytearray& key, const array& chain) throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); if (chain.size() == 0) throw IllegalArgumentException(); _kspi->engineSetKeyEntry(alias, key, chain); } void KeyStore::setKeyEntry(const String& alias, const Key& key, const array& password, const array& chain) throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); if (chain.size() == 0) throw IllegalArgumentException("chain should contain at least one certificate"); _kspi->engineSetKeyEntry(alias, key, password, chain); } Enumeration* KeyStore::aliases() { if (!_init) throw KeyStoreException("uninitialized keystore"); return _kspi->engineAliases(); } bool KeyStore::containsAlias(const String& alias) throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); return _kspi->engineContainsAlias(alias); } const Certificate* KeyStore::getCertificate(const String& alias) throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); return _kspi->engineGetCertificate(alias); } const String* KeyStore::getCertificateAlias(const Certificate& cert) throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); return _kspi->engineGetCertificateAlias(cert); } const array* KeyStore::getCertificateChain(const String& alias) throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); return _kspi->engineGetCertificateChain(alias); } void KeyStore::setCertificateEntry(const String& alias, const Certificate& cert) throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); _kspi->engineSetCertificateEntry(alias, cert); } bool KeyStore::isCertificateEntry(const String& alias) throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); return _kspi->engineIsCertificateEntry(alias); } bool KeyStore::isKeyEntry(const String& alias) throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); return _kspi->engineIsKeyEntry(alias); } void KeyStore::load(InputStream* in, const array* password) throw (IOException, NoSuchAlgorithmException, CertificateException) { _kspi->engineLoad(in, password); _init = true; } jint KeyStore::size() const throw (KeyStoreException) { if (!_init) throw KeyStoreException("uninitialized keystore"); return _kspi->engineSize(); } void KeyStore::store(OutputStream& out, const array* password) throw (KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException) { if (!_init) throw KeyStoreException("uninitialized keystore"); _kspi->engineStore(out, password); } const String& KeyStore::getType() const throw () { return _type; } const Provider& KeyStore::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/c++/security/auth/0000777000175000001440000000000011226307273013517 500000000000000beecrypt-4.2.1/c++/security/auth/Makefile.in0000644000175000001440000002633111226307161015501 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = c++/security/auth DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu # Sun Forte C++ doesn't like empty libraries # noinst_LTLIBRARIES = libcxxsecurityauth.la cxxsecurityauthdir = $(pkgincludedir)/c++/security/auth all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/security/auth/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/security/auth/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # libcxxsecurityauth_la_SOURCES = # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/c++/security/auth/Makefile.am0000644000175000001440000000036011216147022015457 00000000000000INCLUDES = -I$(top_srcdir)/include AUTOMAKE_OPTIONS = gnu # Sun Forte C++ doesn't like empty libraries # noinst_LTLIBRARIES = libcxxsecurityauth.la cxxsecurityauthdir=$(pkgincludedir)/c++/security/auth # libcxxsecurityauth_la_SOURCES = beecrypt-4.2.1/c++/security/Security.cxx0000664000175000001440000002154710257452023015035 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/resource.h" #include "beecrypt/c++/security/Security.h" #include "beecrypt/c++/io/FileInputStream.h" using beecrypt::io::FileInputStream; #include "beecrypt/c++/lang/Integer.h" using beecrypt::lang::Integer; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; using namespace beecrypt::security; namespace { const String KEYSTORE_DEFAULT_TYPE("BEE"); } bool Security::_init = false; Properties Security::_props; ArrayList Security::_providers; /* Have to use lazy initialization here; static initialization doesn't work. * Initialization adds a provider, apparently in another copy of Security, * instead of where we would expect it. * * Don't dlclose the libraries or uninstall the providers. They'll * disappear when the program closes. Since this happens only once per * application which uses this library, that's acceptable. * * What we eventually need to do is the following: * - treat the beecrypt.conf file as a collection of Properties, loaded from * file with loadProperties. * - get appropriate properties to do the initialization */ void Security::initialize() { synchronized (_providers) { _init = true; } /* get the configuration file here and load providers */ const char* path = getenv("BEECRYPT_CONF_FILE"); FILE* props; if (path) props = fopen(path, "r"); else props = fopen(BEECRYPT_CONF_FILE, "r"); if (!props) { std::cerr << "couldn't open beecrypt configuration file" << std::endl; } else { FileInputStream fis(props); try { UErrorCode status; UConverter* _loc = 0; // load properties from fis _props.load(fis); for (jint index = 1; true; index++) { const String* value = _props.getProperty(String("provider.") + Integer::toString(index)); if (value) { if (!_loc) { status = U_ZERO_ERROR; _loc = ucnv_open(0, &status); if (U_FAILURE(status)) throw RuntimeException("ucnv_open failed"); } const array& src = value->toCharArray(); int need = ucnv_fromUChars(_loc, 0, 0, src.data(), src.size(), &status); if (U_FAILURE(status)) if (status != U_BUFFER_OVERFLOW_ERROR) throw RuntimeException("ucnv_fromUChars failed"); char* shared_library = new char[need+1]; status = U_ZERO_ERROR; ucnv_fromUChars(_loc, shared_library, need+1, src.data(), src.size(), &status); if (U_FAILURE(status)) throw RuntimeException("ucnv_fromUChars failed"); #if WIN32 HANDLE handle = LoadLibraryEx(shared_library, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); #elif HAVE_DLFCN_H void *handle = dlopen(shared_library, RTLD_NOW); #else # error #endif if (handle) { #if WIN32 Provider* (*inst)(void*) = (Provider* (*)(void*)) GetProcAddress((HMODULE) handle, "provider_instantiate"); #elif HAVE_PTHREAD_H Provider* (*inst)(void*) = (Provider* (*)(void*)) dlsym(handle, "provider_instantiate"); #else # error #endif if (inst) { addProvider(inst(handle)); } else { std::cerr << "library doesn't contain symbol provider_const_ref" << std::endl; #if HAVE_DLFCN_H std::cerr << "dlerror: " << dlerror() << std::endl; #endif } } else { std::cerr << "unable to open shared library " << shared_library << std::endl; #if HAVE_DLFCN_H std::cerr << "dlerror: " << dlerror() << std::endl; #endif } delete[] shared_library; } else break; } } catch (IOException&) { } } } Security::spi::spi(Object* cspi, const Provider* prov, const String& name) : cspi(cspi), name(name), prov(prov) { } Security::spi* Security::getSpi(const String& name, const String& type) throw (NoSuchAlgorithmException) { Object* inst = 0; const Provider* p = 0; if (!_init) initialize(); String afind = type + "." + name; String alias = "Alg.Alias." + type + "." + name; synchronized (_providers) { for (int i = 0; i < _providers.size(); i++) { p = _providers.get(i); if (p->getProperty(afind)) { if ((inst = p->instantiate(afind))) break; } else { const String* alias_of = p->getProperty(alias); if (alias_of && (inst = p->instantiate(*alias_of))) break; } } } if (inst) return new spi(inst, p, name); throw NoSuchAlgorithmException(name + " " + type + " not available"); } Security::spi* Security::getSpi(const String& name, const String& type, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Object* inst = 0; const Provider* p = 0; if (!_init) initialize(); String afind = type + "." + name; String alias = "Alg.Alias." + type + "." + name; synchronized (_providers) { for (int i = 0; i < _providers.size(); i++) { p = _providers.get(i); if (p->getName().equals(provider)) { if (p->getProperty(afind)) { if ((inst = p->instantiate(afind))) break; } else { const String* alias_of = p->getProperty(alias); if (alias_of && (inst = p->instantiate(*alias_of))) break; } throw NoSuchAlgorithmException(name + " " + type + " not available"); } } } if (inst) return new spi(inst, p, name); throw NoSuchProviderException(provider + " Provider not available"); } Security::spi* Security::getSpi(const String& name, const String& type, const Provider& provider) throw (NoSuchAlgorithmException) { Object* inst; if (!_init) initialize(); String afind = type + "." + name; String alias = "Alg.Alias." + type + "." + name; if (provider.getProperty(afind)) { inst = provider.instantiate(afind); } else { const String* alias_of = provider.getProperty(alias); if (alias_of) inst = provider.instantiate(*alias_of); } if (inst) return new spi(inst, &provider, name); throw NoSuchAlgorithmException(name + " " + type + " not available"); } Security::spi* Security::getFirstSpi(const String& type) { Object* inst = 0; const Provider* p = 0; if (!_init) initialize(); String afind = type + "."; synchronized (_providers) { for (int i = 0; i < _providers.size(); i++) { p = _providers.get(i); Iterator::Entry>* it = p->entrySet().iterator(); assert(it != 0); while (it->hasNext()) { const String* s = dynamic_cast(it->next()->getKey()); if (s->startsWith(afind)) { if ((inst = p->instantiate(*s))) { String name(*s); delete it; return new spi(inst, p, name); } } } delete it; } } return 0; } const String& Security::getKeyStoreDefault() { return *_props.getProperty("keystore.default", KEYSTORE_DEFAULT_TYPE); } int Security::addProvider(Provider* provider) { if (!provider) throw NullPointerException(); int rc; if (!_init) initialize(); if (getProvider(provider->getName())) return -1; synchronized (_providers) { rc = (int) _providers.size(); _providers.add(provider); } return rc; } int Security::insertProviderAt(Provider* provider, int position) throw (IndexOutOfBoundsException) { if (!provider) throw NullPointerException(); if (!_init) initialize(); if (getProvider(provider->getName())) return -1; synchronized (_providers) { _providers.add(position, provider); } return position; } void Security::removeProvider(const String& name) { if (!_init) initialize(); synchronized (_providers) { for (int i = 0; i < _providers.size(); i++) { const Provider* p = _providers.get(i); if (p->getName().equals(name)) { _providers.remove(i); return; } } } } array Security::getProviders() { if (!_init) initialize(); return _providers.toArray(); } Provider* Security::getProvider(const String& name) { if (!_init) initialize(); for (int i = 0; i < _providers.size(); i++) { Provider* tmp = _providers.get(i); if (tmp->getName().equals(name)) return tmp; } return 0; } const String* Security::getProperty(const String& key) throw () { return _props.getProperty(key); } beecrypt-4.2.1/c++/security/AlgorithmParameterGenerator.cxx0000664000175000001440000001027410177412562020664 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/AlgorithmParameterGenerator.h" #include "beecrypt/c++/security/AlgorithmParameterGeneratorSpi.h" #include "beecrypt/c++/security/AlgorithmParameters.h" #include "beecrypt/c++/security/Provider.h" #include "beecrypt/c++/security/Security.h" #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using namespace beecrypt::security; AlgorithmParameterGenerator::AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi* spi, const Provider* provider, const String& algorithm) { _aspi = spi; _prov = provider; _algo = algorithm; } AlgorithmParameterGenerator::~AlgorithmParameterGenerator() { delete _aspi; } AlgorithmParameterGenerator* AlgorithmParameterGenerator::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "AlgorithmParameterGenerator"); assert(dynamic_cast(tmp->cspi)); AlgorithmParameterGenerator* result = new AlgorithmParameterGenerator(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } AlgorithmParameterGenerator* AlgorithmParameterGenerator::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "AlgorithmParameterGenerator", provider); assert(dynamic_cast(tmp->cspi)); AlgorithmParameterGenerator* result = new AlgorithmParameterGenerator(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } AlgorithmParameterGenerator* AlgorithmParameterGenerator::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "AlgorithmParameterGenerator", provider); assert(dynamic_cast(tmp->cspi)); AlgorithmParameterGenerator* result = new AlgorithmParameterGenerator(reinterpret_cast(tmp->cspi), tmp->prov, tmp->name); delete tmp; return result; } AlgorithmParameters* AlgorithmParameterGenerator::generateParameters() throw (InvalidAlgorithmParameterException) { return _aspi->engineGenerateParameters(); } void AlgorithmParameterGenerator::init(const AlgorithmParameterSpec& genParamSpec) throw (InvalidAlgorithmParameterException) { _aspi->engineInit(genParamSpec, 0); } void AlgorithmParameterGenerator::init(const AlgorithmParameterSpec& genParamSpec, SecureRandom* random) throw (InvalidAlgorithmParameterException) { _aspi->engineInit(genParamSpec, random); } void AlgorithmParameterGenerator::init(int size) throw (InvalidParameterException) { _aspi->engineInit(size, 0); } void AlgorithmParameterGenerator::init(int size, SecureRandom* random) throw (InvalidParameterException) { _aspi->engineInit(size, random); } const String& AlgorithmParameterGenerator::getAlgorithm() const throw () { return _algo; } const Provider& AlgorithmParameterGenerator::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/c++/security/Signature.cxx0000664000175000001440000001135210205371377015165 00000000000000/* * Copyright (c) 2004 Beeyond Software Holding BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/c++/security/Signature.h" #include "beecrypt/c++/security/Security.h" using namespace beecrypt::security; Signature::Signature(SignatureSpi* spi, const Provider* provider, const String& algorithm) { _sspi = spi; _prov = provider; _algo = algorithm; } Signature::~Signature() { delete _sspi; } Signature* Signature::getInstance(const String& algorithm) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "Signature"); assert(dynamic_cast((SignatureSpi*) tmp->cspi)); Signature* result = new Signature((SignatureSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } Signature* Signature::getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException) { Security::spi* tmp = Security::getSpi(algorithm, "Signature", provider); assert(dynamic_cast((SignatureSpi*) tmp->cspi)); Signature* result = new Signature((SignatureSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } Signature* Signature::getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException) { Security::spi* tmp = Security::getSpi(algorithm, "Signature", provider); assert(dynamic_cast((SignatureSpi*) tmp->cspi)); Signature* result = new Signature((SignatureSpi*) tmp->cspi, tmp->prov, tmp->name); delete tmp; return result; } AlgorithmParameters* Signature::getParameters() const { return _sspi->engineGetParameters(); } void Signature::setParameter(const AlgorithmParameterSpec& spec) throw (InvalidAlgorithmParameterException) { _sspi->engineSetParameter(spec); } void Signature::initSign(const PrivateKey& key) throw (InvalidKeyException) { _sspi->engineInitSign(key, (SecureRandom*) 0); state = SIGN; } void Signature::initSign(const PrivateKey& key, SecureRandom* random) throw (InvalidKeyException) { _sspi->engineInitSign(key, random); state = SIGN; } void Signature::initVerify(const PublicKey& key) throw (InvalidKeyException) { _sspi->engineInitVerify(key); state = VERIFY; } bytearray* Signature::sign() throw (IllegalStateException, SignatureException) { if (state != SIGN) throw IllegalStateException("object not initialized for signing"); return _sspi->engineSign(); } int Signature::sign(byte* outbuf, int offset, int len) throw (ShortBufferException, IllegalStateException, SignatureException) { if (state != SIGN) throw IllegalStateException("object not initialized for signing"); return _sspi->engineSign(outbuf, offset, len); } int Signature::sign(bytearray& out) throw (IllegalStateException, SignatureException) { if (state != SIGN) throw IllegalStateException("object not initialized for signing"); return _sspi->engineSign(out); } bool Signature::verify(const bytearray& signature) throw (IllegalStateException, SignatureException) { return verify(signature.data(), 0, signature.size()); } bool Signature::verify(const byte* signature, int offset, int len) throw (IllegalStateException, SignatureException) { if (state != VERIFY) throw IllegalStateException("object not initialized for verification"); return _sspi->engineVerify(signature, offset, len); } void Signature::update(byte b) throw (IllegalStateException) { if (state == UNINITIALIZED) throw IllegalStateException("object not initialized for signing or verification"); _sspi->engineUpdate(b); } void Signature::update(const byte* data, int offset, int len) throw (IllegalStateException) { if (state == UNINITIALIZED) throw IllegalStateException("object not initialized for signing or verification"); _sspi->engineUpdate(data, offset, len); } void Signature::update(const bytearray& b) throw (IllegalStateException) { update(b.data(), 0, b.size()); } const String& Signature::getAlgorithm() const throw () { return _algo; } const Provider& Signature::getProvider() const throw () { return *_prov; } beecrypt-4.2.1/blockmode.c0000644000175000001440000000767711216147021012367 00000000000000/* * Copyright (c) 2000, 2002, 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file blockmode.c * \brief Blockcipher operation modes. * \author Bob Deblier * \ingroup BC_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/blockmode.h" int blockEncryptECB(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) { register const unsigned int blockwords = bc->blocksize >> 2; while (nblocks > 0) { bc->raw.encrypt(bp, dst, src); dst += blockwords; src += blockwords; nblocks--; } return 0; } int blockDecryptECB(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) { register const unsigned int blockwords = bc->blocksize >> 2; while (nblocks > 0) { bc->raw.decrypt(bp, dst, src); dst += blockwords; src += blockwords; nblocks--; } return 0; } int blockEncryptCBC(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) { register const unsigned int blockwords = bc->blocksize >> 2; register uint32_t* fdback = bc->getfb(bp); if (nblocks > 0) { register unsigned int i; for (i = 0; i < blockwords; i++) dst[i] = src[i] ^ fdback[i]; bc->raw.encrypt(bp, dst, dst); nblocks--; while (nblocks > 0) { for (i = 0; i < blockwords; i++) dst[i+blockwords] = src[i+blockwords] ^ dst[i]; dst += blockwords; bc->raw.encrypt(bp, dst, dst); src += blockwords; nblocks--; } for (i = 0; i < blockwords; i++) fdback[i] = dst[i]; } return 0; } int blockDecryptCBC(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) { register const unsigned int blockwords = bc->blocksize >> 2; register uint32_t* fdback = bc->getfb(bp); register uint32_t* buf = (uint32_t*) malloc(blockwords * sizeof(uint32_t)); if (buf) { while (nblocks > 0) { register uint32_t tmp; register unsigned int i; bc->raw.decrypt(bp, buf, src); for (i = 0; i < blockwords; i++) { tmp = src[i]; dst[i] = buf[i] ^ fdback[i]; fdback[i] = tmp; } dst += blockwords; src += blockwords; nblocks--; } free(buf); return 0; } return -1; } int blockEncryptCTR(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) { /* host-endian counter is kept in fdback; * swap to big-endian buffer; * encrypt buffer; * src ^ ciphertext -> dst * increment fdback (as mpi) by one inlined; */ register const unsigned int blockwords = bc->blocksize >> 2; register uint32_t* fdback = bc->getfb(bp); register uint32_t* buf = (uint32_t*) malloc(blockwords * sizeof(uint32_t)); if (buf) { while (nblocks > 0) { unsigned int i, j; #if WORDS_BIGENDIAN bc->raw.encrypt(bp, buf, fdback); #else for (i = 0, j = blockwords-1; i < blockwords; i++, j--) buf[i] = swapu32(fdback[j]); bc->raw.encrypt(bp, buf, buf); #endif for (i = 0; i < blockwords; i++) dst[i] = src[i] ^ buf[i]; dst += blockwords; src += blockwords; nblocks--; /* increment counter */ mpaddw((blockwords >> 1), (mpw*) fdback, 1); } free(buf); return 0; } return -1; } beecrypt-4.2.1/AUTHORS0000664000175000001440000000025010254471561011324 00000000000000BeeCrypt Cryptograpy Library: Bob Deblier C++ Interface: Bob Deblier Python Interface: Jeff Johson beecrypt-4.2.1/README.WIN320000644000175000001440000000224411217166610011734 00000000000000This file contains information on how to build and use the BeeCrypt DLL on Win32 platforms. The platform of preference is currently MicroSoft Visual C++. For the basic library Visual C++ 6.0 will do the trick, but the C++ API will require version 7.0 or later. To be able to use the assembler files with Visual C++ 6.0, you need to have the Visual C++ 6.0 Processor Pack installed. It can be found at: http://msdn.microsoft.com/vstudio/downloads/ppack/default.asp To build the java glue into the DLL, you should also have Sun's JDK 1.4 (or later), including the JNI headers, installed. Use the project files available through SourceForge to compile. Once running, you can use any of three entropy source available on this platform, in order of preference: wavein (uses noise on the soundcard microphone port) console (uses keyboard clicks with a high resolution timer) wincrypt (uses random data generated by the Windows CryptAPI) To enable a specific entropy device, set variable BEECRYPT_ENTROPY to any of these three values; if not specified, the library will use 'wavein' as default. In the future, additional sources of entropy on this platform may be made available. beecrypt-4.2.1/gas/0000777000175000001440000000000011226307272011110 500000000000000beecrypt-4.2.1/gas/m68k.m40000664000175000001440000000272210254471670012064 00000000000000dnl m68k.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ifelse(REGISTERS_NEED_PERCENT,yes,` define(d0,%d0) define(d1,%d1) define(d2,%d2) define(d3,%d3) define(d4,%d4) define(d5,%d5) define(d6,%d6) define(d7,%d7) define(a0,%a0) define(a1,%a1) define(a2,%a2) define(a3,%a3) define(a4,%a4) define(a5,%a5) define(a6,%a6) define(a7,%a7) define(sp,%sp) ') ifelse(INSTRUCTIONS_NEED_DOT_SIZE_QUALIF,yes,` define(addal,adda.l) define(addl,add.l) define(addql,addq.l) define(addxl,addx.l) define(clrl,clr.l) define(lsll,lsl.l) define(movel,move.l) define(moveml,movem.l) define(moveal,movea.l) define(umull,umul.l) define(subl,sub.l) define(subql,subq.l) define(subxl,subx.l) ') beecrypt-4.2.1/gas/mpopt.x86_64.m40000664000175000001440000001011010427062714013356 00000000000000dnl mpopt.x86_64.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/x86_64.m4) C_FUNCTION_BEGIN(mpzero) movq %rdi,%rcx movq %rsi,%rdi xorq %rax,%rax rep stosq ret C_FUNCTION_END(mpzero) C_FUNCTION_BEGIN(mpfill) movq %rdi,%rcx movq %rsi,%rdi movq %rdx,%rax rep stosq ret C_FUNCTION_END(mpfill) C_FUNCTION_BEGIN(mpeven) movq -8(%rsi,%rdi,8),%rax notq %rax andq `$'1,%rax ret C_FUNCTION_END(mpeven) C_FUNCTION_BEGIN(mpodd) movq -8(%rsi,%rdi,8),%rax andq `$'1,%rax ret C_FUNCTION_END(mpodd) C_FUNCTION_BEGIN(mpaddw) movq %rdx,%rax xorq %rdx,%rdx leaq -8(%rsi,%rdi,8),%rsi addq %rax,(%rsi) decq %rdi jz LOCAL(mpaddw_skip) leaq -8(%rsi),%rsi .align 4 LOCAL(mpaddw_loop): adcq %rdx,(%rsi) leaq -8(%rsi),%rsi decq %rdi jnz LOCAL(mpaddw_loop) LOCAL(mpaddw_skip): sbbq %rax,%rax negq %rax ret C_FUNCTION_END(mpaddw) C_FUNCTION_BEGIN(mpsubw) movq %rdx,%rax xorq %rdx,%rdx leaq -8(%rsi,%rdi,8),%rsi subq %rax,(%rsi) decq %rdi jz LOCAL(mpsubw_skip) leaq -8(%rsi),%rsi .align 4 LOCAL(mpsubw_loop): sbbq %rdx,(%rsi) leaq -8(%rsi),%rsi decq %rdi jnz LOCAL(mpsubw_loop) LOCAL(mpsubw_skip): sbbq %rax,%rax negq %rax ret C_FUNCTION_END(mpsubw) C_FUNCTION_BEGIN(mpadd) xorq %r8,%r8 decq %rdi .align 4 LOCAL(mpadd_loop): movq (%rdx,%rdi,8),%rax movq (%rsi,%rdi,8),%r8 adcq %rax,%r8 movq %r8,(%rsi,%rdi,8) decq %rdi jns LOCAL(mpadd_loop) sbbq %rax,%rax negq %rax ret C_FUNCTION_END(mpadd) C_FUNCTION_BEGIN(mpsub) xorq %r8,%r8 decq %rdi .align 4 LOCAL(mpsub_loop): movq (%rdx,%rdi,8),%rax movq (%rsi,%rdi,8),%r8 sbbq %rax,%r8 movq %r8,(%rsi,%rdi,8) decq %rdi jns LOCAL(mpsub_loop) sbbq %rax,%rax negq %rax ret C_FUNCTION_END(mpsub) C_FUNCTION_BEGIN(mpdivtwo) leaq (%rsi,%rdi,8),%rsi negq %rdi xorq %rax,%rax .align 4 LOCAL(mpdivtwo_loop): rcrq `$'1,(%rsi,%rdi,8) inc %rdi jnz LOCAL(mpdivtwo_loop) ret C_FUNCTION_END(mpdivtwo) C_FUNCTION_BEGIN(mpmultwo) xorq %rdx,%rdx decq %rdi .align 4 LOCAL(mpmultwo_loop): movq (%rsi,%rdi,8),%rax adcq %rax,%rax movq %rax,(%rsi,%rdi,8) decq %rdi jns LOCAL(mpmultwo_loop) sbbq %rax,%rax negq %rax ret C_FUNCTION_END(mpmultwo) C_FUNCTION_BEGIN(mpsetmul) movq %rcx,%r8 movq %rdi,%rcx movq %rdx,%rdi xorq %rdx,%rdx decq %rcx .align 4 LOCAL(mpsetmul_loop): movq %rdx,%r9 movq (%rdi,%rcx,8),%rax mulq %r8 addq %r9,%rax adcq `$'0,%rdx movq %rax,(%rsi,%rcx,8) decq %rcx jns LOCAL(mpsetmul_loop) movq %rdx,%rax ret C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) movq %rcx,%r8 movq %rdi,%rcx movq %rdx,%rdi xorq %rdx,%rdx decq %rcx .align 4 LOCAL(mpaddmul_loop): movq %rdx,%r9 movq (%rdi,%rcx,8),%rax mulq %r8 addq %r9,%rax adcq `$'0,%rdx addq (%rsi,%rcx,8),%rax adcq `$'0,%rdx movq %rax,(%rsi,%rcx,8) decq %rcx jns LOCAL(mpaddmul_loop) movq %rdx,%rax ret C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) movq %rdi,%rcx movq %rsi,%rdi movq %rdx,%rsi xorq %r8,%r8 decq %rcx leaq (%rdi,%rcx,8),%rdi leaq (%rdi,%rcx,8),%rdi .align 4 LOCAL(mpaddsqrtrc_loop): movq (%rsi,%rcx,8),%rax mulq %rax addq %r8,%rax adcq `$'0,%rdx addq %rax,8(%rdi) adcq %rdx,0(%rdi) sbbq %r8,%r8 negq %r8 subq `$'16,%rdi decq %rcx jns LOCAL(mpaddsqrtrc_loop) movq %r8,%rax ret C_FUNCTION_END(mpaddsqrtrc) beecrypt-4.2.1/gas/mpopt.ia64.m40000664000175000001440000001664010254471670013204 00000000000000dnl mpopt.ia64.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/ia64.m4) define(`sze',`r14') define(`dst',`r15') define(`src',`r16') define(`alt',`r17') C_FUNCTION_BEGIN(mpzero) .prologue alloc saved_pfs = ar.pfs,2,0,0,0 mov saved_lc = ar.lc sub sze = in0,r0,1;; dnl adjust address shladd dst = sze,3,in1 dnl prepare loop mov ar.lc = sze;; .body LOCAL(mpzero_loop): st8 [dst] = r0,-8 br.ctop.dptk LOCAL(mpzero_loop);; mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 C_FUNCTION_END(mpzero) C_FUNCTION_BEGIN(mpcopy) .prologue alloc saved_pfs = ar.pfs,3,6,0,8 mov saved_lc = ar.lc mov saved_pr = pr sub sze = in0,r0,1;; dnl adjust addresses shladd dst = sze,3,in1 shladd src = sze,3,in2 dnl prepare modulo-scheduled loop mov ar.lc = sze mov ar.ec = 1 mov pr.rot = (1 << 16);; LOCAL(mpcopy_loop): (p16) ld8 r32 = [src],-8 (p17) st8 [dst] = r33,-8 br.ctop.dptk LOCAL(mpcopy_loop);; dnl epilogue (p17) st8 [dst] = r33,-8 ;; mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 C_FUNCTION_END(mpcopy) C_FUNCTION_BEGIN(mpadd) .prologue alloc saved_pfs = ar.pfs,3,5,0,8 mov saved_lc = ar.lc mov saved_pr = pr sub sze = in0,r0,1;; dnl adjust addresses shladd dst = sze,3,in1 shladd src = sze,3,in2 shladd alt = sze,3,in1 dnl prepare modulo-scheduled loop mov ar.lc = sze mov ar.ec = 2 mov pr.rot = ((1 << 16) | (1 << 19));; .body LOCAL(mpadd_loop): .pred.rel.mutex p20,p22 (p16) ld8 r32 = [alt],-8 (p16) ld8 r35 = [src],-8 (p20) add r36 = r33,r36 (p22) add r36 = r33,r36,1 ;; (p20) cmp.leu p19,p21 = r33,r36 (p22) cmp.ltu p19,p21 = r33,r36 (p18) st8 [dst] = r37,-8 br.ctop.dptk LOCAL(mpadd_loop);; dnl loop epilogue: final store (p18) st8 [dst] = r37,-8 dnl return carry .pred.rel.mutex p20,p22 (p20) add ret0 = r0,r0 (p22) add ret0 = r0,r0,1 ;; mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 C_FUNCTION_END(mpadd) C_FUNCTION_BEGIN(mpsub) .prologue alloc saved_pfs = ar.pfs,3,5,0,8 mov saved_lc = ar.lc mov saved_pr = pr sub sze = in0,r0,1;; dnl adjust addresses shladd dst = sze,3,in1 shladd src = sze,3,in2 shladd alt = sze,3,in1 dnl prepare modulo-scheduled loop mov ar.lc = sze mov ar.ec = 2 mov pr.rot = ((1 << 16) | (1 << 19));; .body LOCAL(mpsub_loop): .pred.rel.mutex p20,p22 (p16) ld8 r32 = [alt],-8 (p16) ld8 r35 = [src],-8 (p20) sub r36 = r33,r36 (p22) sub r36 = r33,r36,1 ;; (p20) cmp.geu p19,p21 = r33,r36 (p22) cmp.gtu p19,p21 = r33,r36 (p18) st8 [dst] = r37,-8 br.ctop.dptk LOCAL(mpsub_loop);; dnl loop epilogue: final store (p18) st8 [dst] = r37,-8 dnl return carry .pred.rel.mutex p20,p22 (p20) add ret0 = r0,r0 (p22) add ret0 = r0,r0,1 ;; mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 C_FUNCTION_END(mpsub) C_FUNCTION_BEGIN(mpmultwo) .prologue alloc saved_pfs = ar.pfs,2,6,0,8 mov saved_lc = ar.lc mov saved_pr = pr sub sze = in0,r0,1;; dnl adjust addresses shladd dst = sze,3,in1 shladd src = sze,3,in1 dnl prepare modulo-scheduled loop mov ar.lc = sze mov ar.ec = 2 mov pr.rot = ((1 << 16) | (1 << 19));; .body LOCAL(mpmultwo): .pred.rel.mutex p20,p22 (p16) ld8 r32 = [src],-8 (p20) add r36 = r33,r33 (p22) add r36 = r33,r33,1 ;; (p20) cmp.leu p19,p21 = r33,r36 (p22) cmp.ltu p19,p21 = r33,r36 (p18) st8 [dst] = r37,-8 br.ctop.dptk LOCAL(mpmultwo);; dnl loop epilogue: final store (p18) st8 [dst] = r37,-8 dnl return carry .pred.rel.mutex p20,p22 (p20) add ret0 = r0,r0 (p22) add ret0 = r0,r0,1 ;; mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 C_FUNCTION_END(mpmultwo) C_FUNCTION_BEGIN(mpsetmul) .prologue alloc saved_pfs = ar.pfs,4,4,0,8 mov saved_lc = ar.lc mov saved_pr = pr setf.sig f6 = in3 setf.sig f7 = r0 sub sze = in0,r0,1;; dnl adjust addresses shladd dst = sze,3,in1 shladd src = sze,3,in2 dnl prepare modulo-scheduled loop mov ar.lc = sze mov ar.ec = 3 mov pr.rot = (1 << 16);; .body LOCAL(mpsetmul_loop): (p16) ldf8 f32 = [src],-8 (p18) stf8 [dst] = f35,-8 (p17) xma.lu f34 = f6,f33,f7 (p17) xma.hu f7 = f6,f33,f7 br.ctop.dptk LOCAL(mpsetmul_loop);; dnl return carry getf.sig ret0 = f7;; mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) .prologue alloc saved_pfs = ar.pfs,4,4,0,8 mov saved_lc = ar.lc mov saved_pr = pr setf.sig f6 = in3 sub sze = in0,r0,1;; dnl adjust addresses shladd dst = sze,3,in1 shladd src = sze,3,in2 shladd alt = sze,3,in1;; dnl prepare the rotate-in carry mov r32 = r0 dnl prepare modulo-scheduled loop mov ar.lc = sze mov ar.ec = 4 mov pr.rot = ((1 << 16) | (1 << 21));; .body LOCAL(mpaddmul_loop): .pred.rel.mutex p24,p26 (p18) getf.sig r37 = f35 (p24) add r35 = r38,r35 (p17) xma.lu f34 = f6,f33,f37 (p18) getf.sig r33 = f39 (p26) add r35 = r38,r35,1 (p17) xma.hu f38 = f6,f33,f37 (p16) ldf8 f32 = [src],-8 (p16) ldf8 f36 = [alt],-8 ;; dnl set carry from this operation (p24) cmp.leu p23,p25 = r38,r35 (p26) cmp.ltu p23,p25 = r38,r35 (p20) st8 [dst] = r36,-8 br.ctop.dptk LOCAL(mpaddmul_loop);; dnl loop epilogue: final store (p20) st8 [dst] = r36,-8 dnl return carry .pred.rel.mutex p24,p26 (p24) add ret0 = r35,r0 (p26) add ret0 = r35,r0,1 mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 C_FUNCTION_END(mpaddmul) divert(-1) C_FUNCTION_BEGIN(mpaddsqrtrc) .prologue alloc saved_pfs = ar.pfs,4,12,0,16 mov saved_lc = ar.lc mov saved_pr = pr setf.sig f6 = in3 sub sze = in0,r0,1;; dnl adjust addresses dnl use two addresses for dst, and two for src shladd ? = sze,4,in1 shladd ? = sze,4,in1 shladd ? = sze,3,in2 shladd ? = sze,3,in2;; dnl prepare the rotate-in carry mov r32 = r0 dnl prepare modulo-scheduled loop mov ar.lc = sze mov ar.ec = 5 mov pr.rot = ((1 << 16) | (1 << 22));; .body LOCAL(mpaddsqrtrc_loop): (p16) ldf8 f32 = [src],-8 (p17) xma.lu f34 = f33,f33,f37 (p17) xma.hu f38 = f33,f33,f37 (p18) getf.sig r32 = f35 (p18) getf.sig r35 = f39 (p18) ld8 rlo = [alt],-8 .pred.rel.mutex p25,p29 (p25) add r33 = r33,r?? (p29) add r37 = r37,r??,1 .pred.rel.mutex p27,p31 (p27) add hi to carry (p31) add hi to carry+1 ;; (p16) ld8 r42 = [alt],-8 (p25) cmpleu p24,p28 = lo (p29) cmpltu p24,p28 = lo (p20) st8 lo (p27) cmpleu p26,p30 = hi (p31) cmpltu p26,p30 = hi (p21) st8 hi ;; br.ctop.dptk LOCAL(mpaddsqrtrc_loop);; dnl loop epilogue: final store (p21) st8 [dst] = r36,-8 mov pr = saved_pr, -1 mov ar.lc = saved_lc mov ar.pfs = saved_pfs br.ret.sptk b0 C_FUNCTION_END(mpaddsqrtrc) divert(0) beecrypt-4.2.1/gas/blowfishopt.i586.m40000664000175000001440000000632510254471670014334 00000000000000dnl blowfishopt.i586.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/x86.m4) dnl during this macro we assume: dnl bp in %esi, xl and xr in %ecx and %edx, %eax and %ebx clear define(`etworounds',` xorl $1+0(%esi),%ecx roll `$'16,%ecx movzx %ch,%eax movzx %cl,%ebx roll `$'16,%ecx movl 0x000+72(%esi,%eax,4),%edi addl 0x400+72(%esi,%ebx,4),%edi movzx %ch,%eax movzx %cl,%ebx xorl 0x800+72(%esi,%eax,4),%edi addl 0xC00+72(%esi,%ebx,4),%edi xorl %edi,%edx xorl $1+4(%esi),%edx roll `$'16,%edx movzx %dh,%eax movzx %dl,%ebx roll `$'16,%edx movl 0x000+72(%esi,%eax,4),%edi addl 0x400+72(%esi,%ebx,4),%edi movzx %dh,%eax movzx %dl,%ebx xorl 0x800+72(%esi,%eax,4),%edi addl 0xC00+72(%esi,%ebx,4),%edi xorl %edi,%ecx ') dnl bp in %esi, xl and xr in %ecx and %edx, %eax and %ebx clear define(`dtworounds',` xorl $1+4(%esi),%ecx roll `$'16,%ecx movzx %ch,%eax movzx %cl,%ebx roll `$'16,%ecx movl 0x000+72(%esi,%eax,4),%edi addl 0x400+72(%esi,%ebx,4),%edi movzx %ch,%eax movzx %cl,%ebx xorl 0x800+72(%esi,%eax,4),%edi addl 0xC00+72(%esi,%ebx,4),%edi xorl %edi,%edx xorl $1+0(%esi),%edx roll `$'16,%edx movzx %dh,%eax movzx %dl,%ebx roll `$'16,%edx movl 0x000+72(%esi,%eax,4),%edi addl 0x400+72(%esi,%ebx,4),%edi movzx %dh,%eax movzx %dl,%ebx xorl 0x800+72(%esi,%eax,4),%edi addl 0xC00+72(%esi,%ebx,4),%edi xorl %edi,%ecx ') C_FUNCTION_BEGIN(blowfishEncrypt) pushl %edi pushl %esi pushl %ebx movl 16(%esp),%esi movl 24(%esp),%edi movl 0(%edi),%ecx movl 4(%edi),%edx bswap %ecx bswap %edx etworounds(0) etworounds(8) etworounds(16) etworounds(24) etworounds(32) etworounds(40) etworounds(48) etworounds(56) movl 20(%esp),%edi xorl 64(%esi),%ecx xorl 68(%esi),%edx bswap %ecx bswap %edx movl %ecx,4(%edi) movl %edx,0(%edi) xorl %eax,%eax popl %ebx popl %esi popl %edi ret C_FUNCTION_END(blowfishEncrypt) C_FUNCTION_BEGIN(blowfishDecrypt) pushl %edi pushl %esi pushl %ebx movl 16(%esp),%esi movl 24(%esp),%edi movl 0(%edi),%ecx movl 4(%edi),%edx bswap %ecx bswap %edx dtworounds(64) dtworounds(56) dtworounds(48) dtworounds(40) dtworounds(32) dtworounds(24) dtworounds(16) dtworounds(8) movl 20(%esp),%edi xorl 4(%esi),%ecx xorl 0(%esi),%edx bswap %ecx bswap %edx movl %ecx,4(%edi) movl %edx,0(%edi) xorl %eax,%eax popl %ebx popl %esi popl %edi ret C_FUNCTION_END(blowfishDecrypt) beecrypt-4.2.1/gas/mpopt.alpha.m40000664000175000001440000000667710254471670013537 00000000000000dnl mpopt.alpha.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/alpha.m4) C_FUNCTION_BEGIN(mpadd) subq `$'16,1,`$'16 s8addq `$'16,0,`$'1 addq `$'17,`$'1,`$'17 addq `$'18,`$'1,`$'18 clr `$'0 .align 4 LOCAL(mpadd_loop): ldq `$'1,0(`$'17) ldq `$'2,0(`$'18) addq `$'1,`$'0,`$'3 cmpult `$'3,`$'1,`$'0 addq `$3',`$'2,`$'1 cmpult `$'1,`$'3,`$'2 stq `$'1,0(`$'17) or `$'2,`$'0,`$'0 subq `$'16,1,`$'16 subq `$'17,8,`$'17 subq `$'18,8,`$'18 bge `$'16,LOCAL(mpadd_loop) ret `$'31,(`$'26),1 C_FUNCTION_END(mpadd) C_FUNCTION_BEGIN(mpsub) subq `$'16,1,`$'16 s8addq `$'16,0,`$'1 addq `$'17,`$'1,`$'17 addq `$'18,`$'1,`$'18 clr `$'0 .align 4 LOCAL(mpsub_loop): ldq `$'1,0(`$'17) ldq `$'2,0(`$'18) subq `$'1,`$'0,`$'3 cmpult `$'1,`$'3,`$'0 subq `$'3,`$'2,`$'1 cmpult `$'3,`$'1,`$'2 stq `$'1,0(`$'17) or `$'2,`$'0,`$'0 subq `$'16,1,`$'16 subq `$'17,8,`$'17 subq `$'18,8,`$'18 bge `$'16,LOCAL(mpsub_loop) ret `$'31,(`$'26),1 C_FUNCTION_END(mpsub) C_FUNCTION_BEGIN(mpsetmul) subq `$'16,1,`$'16 s8addq `$'16,0,`$'1 addq `$'17,`$'1,`$'17 addq `$'18,`$'1,`$'18 clr `$'0 .align 4 LOCAL(mpsetmul_loop): ldq `$1',0(`$'18) mulq `$'19,`$'1,`$'2 umulh `$'19,`$'1,`$'3 addq `$'2,`$'0,`$'2 cmpult `$'2,`$'0,`$'0 stq `$'2,0(`$'17) addq `$'3,`$'0,`$'0 subq `$'16,1,`$'16 subq `$'17,8,`$'17 subq `$'18,8,`$'18 bge `$'16,LOCAL(mpsetmul_loop) ret `$'31,(`$'26),1 C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) subq `$'16,1,`$'16 s8addq `$'16,0,`$'1 addq `$'17,`$'1,`$'17 addq `$'18,`$'1,`$'18 clr `$'0 .align 4 LOCAL(mpaddmul_loop): ldq `$'1,0(`$'17) ldq `$'2,0(`$'18) mulq `$'19,`$'2,`$'3 umulh `$'19,`$'2,`$'4 addq `$'3,`$'0,`$'3 cmpult `$'3,`$'0,`$'0 addq `$'4,`$'0,`$'4 addq `$'3,`$'1,`$'3 cmpult `$'3,`$'1,`$'0 addq `$'4,`$'0,`$'0 stq `$'3,0(`$'17) subq `$'16,1,`$'16 subq `$'17,8,`$'17 subq `$'18,8,`$'18 bge `$'16,LOCAL(mpaddmul_loop) ret `$'31,(`$'26),1 C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) subq `$'16,1,`$'16 s8addq `$'16,0,`$'1 addq `$'17,`$'1,`$'17 addq `$'18,`$'1,`$'18 addq `$'17,`$'1,`$'17 clr `$'0 .align 4 LOCAL(mpaddsqrtrc_loop): ldq `$'1,0(`$'18) mulq `$1',`$1',`$'2 umulh `$1',`$1',`$'1 addq `$'2,`$'0,`$'3 cmpult `$3',`$'2,`$'0 ldq `$'2,8(`$'17) addq `$'1,`$'0,`$'1 addq `$'3,`$'2,`$'4 cmpult `$'4,`$'3,`$'0 ldq `$'3,0(`$'17) addq `$'1,`$'0,`$'2 cmpult `$2',`$'1,`$'0 stq `$'4,8(`$'17) addq `$'2,`$'3,`$'1 cmpult `$'1,`$'2,`$2' stq `$'1,0(`$'17) addq `$'2,`$'0,`$'0 subq `$'16,1,`$'16 subq `$'17,16,`$'17 subq `$'18,8,`$'18 bge `$'16,LOCAL(mpaddsqrtrc_loop) ret `$'31,(`$'26),1 C_FUNCTION_END(mpaddsqrtrc) beecrypt-4.2.1/gas/mpopt.ppc64.m40000664000175000001440000000665510424676561013407 00000000000000dnl mpopt.ppc64.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/ppc64.m4) C_FUNCTION_BEGIN(mpaddw) mtctr r3 sldi r0,r3,3 add r4,r4,r0 li r0,0 ldu r6,-8(r4) addc r6,r6,r5 std r6,0(r4) bdz LOCAL(mpaddw_skip) LOCAL(mpaddw_loop): ldu r6,-8(r4) adde r6,r0,r6 std r6,0(r4) bdnz LOCAL(mpaddw_loop) LOCAL(mpaddw_skip): addze r3,r0 blr C_FUNCTION_END(mpaddw) C_FUNCTION_BEGIN(mpsubw) mtctr r3 sldi r0,r3,3 add r4,r4,r0 li r0,0 ld r6,-8(r4) subfc r6,r5,r6 stdu r6,-8(r4) bdz LOCAL(mpsubw_skip) LOCAL(mpsubw_loop): ld r6,-8(r4) subfe r6,r0,r6 stdu r6, -8(r4) bdnz LOCAL(mpsubw_loop) LOCAL(mpsubw_skip): subfe r3,r0,r0 neg r3,r3 blr C_FUNCTION_END(mpsubw) C_FUNCTION_BEGIN(mpadd) mtctr r3 sldi r0,r3,3 add r4,r4,r0 add r5,r5,r0 li r0,0 ld r6,-8(r4) ldu r7,-8(r5) addc r6,r7,r6 stdu r6,-8(r4) bdz LOCAL(mpadd_skip) LOCAL(mpadd_loop): ld r6,-8(r4) ldu r7,-8(r5) adde r6,r7,r6 stdu r6,-8(r4) bdnz LOCAL(mpadd_loop) LOCAL(mpadd_skip): addze r3,r0 blr C_FUNCTION_END(mpadd) C_FUNCTION_BEGIN(mpsub) mtctr r3 sldi r0,r3,3 add r4,r4,r0 add r5,r5,r0 li r0,0 ld r6,-8(r4) ldu r7,-8(r5) subfc r6,r7,r6 stdu r6,-8(r4) bdz LOCAL(mpsub_skip) LOCAL(mpsub_loop): ld r6,-8(r4) ldu r7,-8(r5) subfe r6,r7,r6 stdu r6,-8(r4) bdnz LOCAL(mpsub_loop) LOCAL(mpsub_skip): subfe r3,r0,r0 neg r3,r3 blr C_FUNCTION_END(mpsub) C_FUNCTION_BEGIN(mpmultwo) mtctr r3 sldi r0,r3,3 add r4,r4,r0 li r0,0 ld r6,-8(r4) addc r6,r6,r6 stdu r6,-8(r4) bdz LOCAL(mpmultwo_skip) LOCAL(mpmultwo_loop): ld r6,-8(r4) adde r6,r6,r6 stdu r6,-8(r4) bdnz LOCAL(mpmultwo_loop) LOCAL(mpmultwo_skip): addze r3,r0 blr C_FUNCTION_END(mpmultwo) C_FUNCTION_BEGIN(mpsetmul) mtctr r3 sldi r0,r3,3 add r4,r4,r0 add r5,r5,r0 li r3,0 LOCAL(mpsetmul_loop): ldu r7,-8(r5) mulld r8,r7,r6 addc r8,r8,r3 mulhdu r9,r7,r6 addze r3,r9 stdu r8,-8(r4) bdnz LOCAL(mpsetmul_loop) blr C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) mtctr r3 sldi r0,r3,3 add r4,r4,r0 add r5,r5,r0 li r3,0 LOCAL(mpaddmul_loop): ldu r8,-8(r5) ldu r7,-8(r4) mulld r9,r8,r6 addc r9,r9,r3 mulhdu r10,r8,r6 addze r3,r10 addc r9,r9,r7 addze r3,r3 std r9,0(r4) bdnz LOCAL(mpaddmul_loop) blr C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) mtctr r3 sldi r0,r3,3 add r4,r4,r0 add r5,r5,r0 add r4,r4,r0 li r3,0 LOCAL(mpaddsqrtrc_loop): ldu r0,-8(r5) ld r6,-16(r4) ld r7,-8(r4) mulld r9,r0,r0 addc r9,r9,r3 mulhdu r8,r0,r0 addze r8,r8 li r3,0 addc r7,r7,r9 adde r6,r6,r8 addze r3,r3 std r7,-8(r4) stdu r6,-16(r4) bdnz LOCAL(mpaddsqrtrc_loop) blr C_FUNCTION_END(mpaddsqrtrc) beecrypt-4.2.1/gas/mpopt.sparcv8.m40000664000175000001440000000371110254471670014022 00000000000000dnl mpopt.sparcv8.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/sparc.m4) C_FUNCTION_BEGIN(mpsetmul) sll %o0,2,%g1 dec 4,%o2 clr %o0 LOCAL(mpsetmul_loop): ld [%o2+%g1],%g2 umul %o3,%g2,%g2 rd %y,%g3 addcc %o0,%g2,%g2 addx %g0,%g3,%o0 deccc 4,%g1 bnz LOCAL(mpsetmul_loop) st %g2,[%o1+%g1] retl nop C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) sll %o0,2,%g1 mov %o1,%o4 dec 4,%o1 dec 4,%o2 clr %o0 LOCAL(mpaddmul_loop): ld [%o2+%g1],%g2 ld [%o1+%g1],%g3 umul %o3,%g2,%g2 rd %y,%g4 addcc %o0,%g2,%g2 addx %g0,%g4,%g4 addcc %g2,%g3,%g2 addx %g0,%g4,%o0 deccc 4,%g1 bnz LOCAL(mpaddmul_loop) st %g2,[%o4+%g1] retl nop C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) sll %o0,2,%g1 add %o1,%g1,%o1 dec 4,%o2 add %o1,%g1,%o1 dec 8,%o1 clr %o0 LOCAL(mpaddsqrtrc_loop): ld [%o2+%g1],%g2 ldd [%o1],%o4 umul %g2,%g2,%g3 rd %y,%g2 addcc %o5,%g3,%o5 addxcc %o4,%g2,%o4 addx %g0,%g0,%o3 addcc %o5,%o0,%o5 addxcc %o4,%g0,%o4 addx %o3,%g0,%o0 std %o4,[%o1] deccc 4,%g1 bnz LOCAL(mpaddsqrtrc_loop) sub %o1,8,%o1 retl nop C_FUNCTION_END(mpaddsqrtrc) beecrypt-4.2.1/gas/blowfishopt.ppc.m40000664000175000001440000000550510254471670014422 00000000000000dnl blowfishopt.ppc.m4 dnl dnl Note: Only tested on big-endian PowerPC! dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/ppc.m4) define(`round',` lwz r9,$3(r3) xor $1,$1,r9 rlwinm r9,$1,10,22,29 rlwinm r10,$1,18,22,29 lwzx r9,r9,r28 lwzx r10,r10,r29 rlwinm r11,$1,26,22,29 add r9,r9,r10 lwzx r11,r11,r30 rlwinm r12,$1,2,22,29 xor r9,r9,r11 lwzx r12,r12,r31 add r9,r9,r12 xor $2,$2,r9 ') define(`eblock',` round(r7,r8,0) round(r8,r7,4) round(r7,r8,8) round(r8,r7,12) round(r7,r8,16) round(r8,r7,20) round(r7,r8,24) round(r8,r7,28) round(r7,r8,32) round(r8,r7,36) round(r7,r8,40) round(r8,r7,44) round(r7,r8,48) round(r8,r7,52) round(r7,r8,56) round(r8,r7,60) lwz r9,64(r3) lwz r10,68(r3) xor r7,r7,r9 xor r8,r8,r10 ') define(`dblock',` round(r7,r8,68) round(r8,r7,64) round(r7,r8,60) round(r8,r7,56) round(r7,r8,52) round(r8,r7,48) round(r7,r8,44) round(r8,r7,40) round(r7,r8,36) round(r8,r7,32) round(r7,r8,28) round(r8,r7,24) round(r7,r8,20) round(r8,r7,16) round(r7,r8,12) round(r8,r7,8) lwz r9,4(r3) lwz r10,0(r3) xor r7,r7,r9 xor r8,r8,r10 ') C_FUNCTION_BEGIN(blowfishEncrypt) la r1,-16(r1) stmw r28,0(r1) la r28,72(r3) la r29,1096(r3) la r30,2120(r3) la r31,3144(r3) ifelse(ASM_BIGENDIAN,yes,` lwz r7,0(r5) lwz r8,4(r5) ',` li r0,0 lwbrx r7,r5,r0 li r0,4 lwbrx r8,r5,r0 ') eblock ifelse(ASM_BIGENDIAN,yes,` stw r7,4(r4) stw r8,0(r4) ',` li r0,4 stwbrx r7,r4,r0 li r0,0 stwbrx r8,r4,r0 ') li r3,0 lmw r28,0(r1) la r1,16(r1) blr C_FUNCTION_END(blowfishEncrypt) C_FUNCTION_BEGIN(blowfishDecrypt) la r1,-16(r1) stmw r28,0(r1) la r28,72(r3) la r29,1096(r3) la r30,2120(r3) la r31,3144(r3) ifelse(ASM_BIGENDIAN,yes,` lwz r7,0(r5) lwz r8,4(r5) ',` li r0,0 lwbrx r7,r5,r0 li r0,4 lwbrx r7,r5,r0 ') dblock ifelse(ASM_BIGENDIAN,yes,` stw r7,4(r4) stw r8,0(r4) ',` li r0,4 stwbrx r7,r4,r0 li r0,0 stwbrx r7,r4,r0 ') li r3,0 lmw r28,0(r1) la r1,16(r1) blr C_FUNCTION_END(blowfishDecrypt) beecrypt-4.2.1/gas/mpopt.sparcv8plus.m40000664000175000001440000000646410254471670014736 00000000000000dnl mpopt.sparcv8plus.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/sparc.m4) C_FUNCTION_BEGIN(mpaddw) sll %o0,2,%g1 dec 4,%g1 clr %o0 lduw [%o1+%g1],%g2 addcc %g2,%o2,%g2 stw %g2,[%o1+%g1] brz,pn %g1,LOCAL(mpaddw_skip) dec 4,%g1 LOCAL(mpaddw_loop): lduw [%o1+%g1],%g2 addccc %g2,%g0,%g2 stw %g2,[%o1+%g1] brnz,pt %g1,LOCAL(mpaddw_loop) dec 4,%g1 LOCAL(mpaddw_skip): retl movcs %icc,1,%o0 C_FUNCTION_END(mpaddw) C_FUNCTION_BEGIN(mpsubw) sll %o0,2,%g1 dec 4,%g1 clr %o0 lduw [%o1+%g1],%g2 subcc %g2,%o2,%g2 stw %g2,[%o1+%g1] brz,pn %g1,LOCAL(mpsubw_skip) dec 4,%g1 LOCAL(mpsubw_loop): lduw [%o1+%g1],%g2 subccc %g2,%g0,%g2 stw %g2,[%o1+%g1] brnz,pt %g1,LOCAL(mpsubw_loop) dec 4,%g1 LOCAL(mpsubw_skip): retl movcs %icc,1,%o0 C_FUNCTION_END(mpsubw) C_FUNCTION_BEGIN(mpadd) sll %o0,2,%g1 dec 4,%g1 addcc %g0,%g0,%o0 LOCAL(mpadd_loop): lduw [%o1+%g1],%g2 lduw [%o2+%g1],%g3 addccc %g2,%g3,%g4 stw %g4,[%o1+%g1] brnz,pt %g1,LOCAL(mpadd_loop) dec 4,%g1 retl movcs %icc,1,%o0 C_FUNCTION_END(mpadd) C_FUNCTION_BEGIN(mpsub) sll %o0,2,%g1 dec 4,%g1 addcc %g0,%g0,%o0 LOCAL(mpsub_loop): lduw [%o1+%g1],%g2 lduw [%o2+%g1],%g3 subccc %g2,%g3,%g4 stw %g4,[%o1+%g1] brnz,pt %g1,LOCAL(mpsub_loop) dec 4,%g1 retl movcs %icc,1,%o0 C_FUNCTION_END(mpsub) C_FUNCTION_BEGIN(mpmultwo) sll %o0,2,%g1 dec 4,%g1 addcc %g0,%g0,%o0 LOCAL(mpmultwo_loop): lduw [%o1+%g1],%g2 addccc %g2,%g2,%g3 stw %g3,[%o1+%g1] brnz,pt %g1,LOCAL(mpmultwo_loop) dec 4,%g1 retl movcs %icc,1,%o0 C_FUNCTION_END(mpmultwo) C_FUNCTION_BEGIN(mpsetmul) sll %o0,2,%g1 dec 4,%g1 clr %o0 LOCAL(mpsetmul_loop): lduw [%o2+%g1],%g2 srlx %o0,32,%o0 mulx %o3,%g2,%g3 add %o0,%g3,%o0 stw %o0,[%o1+%g1] brnz,pt %g1,LOCAL(mpsetmul_loop) dec 4,%g1 retl srlx %o0,32,%o0 C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) sll %o0,2,%g1 dec 4,%g1 clr %o0 LOCAL(mpaddmul_loop): lduw [%o2+%g1],%g2 lduw [%o1+%g1],%g4 srlx %o0,32,%o0 mulx %o3,%g2,%g3 add %o0,%g3,%o0 add %o0,%g4,%o0 stw %o0,[%o1+%g1] brnz,pt %g1,LOCAL(mpaddmul_loop) dec 4,%g1 retl srlx %o0,32,%o0 C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) sll %o0,2,%g1 dec 4,%g1 add %o1,%g1,%o1 add %o1,%g1,%o1 clr %o0 LOCAL(mpaddsqrtrc_loop): lduw [%o2+%g1],%g2 ldx [%o1],%g4 mulx %g2,%g2,%g2 add %o0,%g4,%g3 clr %o0 add %g3,%g2,%g3 cmp %g4,%g3 movgu %xcc,1,%o0 stx %g3,[%o1] sub %o1,8,%o1 brnz,pt %g1,LOCAL(mpaddsqrtrc_loop) dec 4,%g1 retl nop C_FUNCTION_END(mpaddsqrtrc) beecrypt-4.2.1/gas/sparc.m40000664000175000001440000000205510254471670012406 00000000000000dnl sparc.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ifelse(substr(ASM_OS,0,7),solaris,` undefine(`C_FUNCTION_BEGIN') define(C_FUNCTION_BEGIN,` TEXTSEG GLOBL SYMNAME($1) SYMNAME($1): .register %g2,#scratch .register %g3,#scratch ') ') beecrypt-4.2.1/gas/Makefile.in0000644000175000001440000003041011226307162013065 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am's purpose is to add the GNU Assembler sources to the dist # # Copyright (c) 2001, 2002, 2003 X-Way Rights BV # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gas DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = depcomp = am__depfiles_maybe = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu no-dependencies EXTRA_DIST = \ alpha.m4 \ asmdefs.m4 \ blowfishopt.i586.m4 \ blowfishopt.ppc.m4 \ ia64.m4 \ m68k.m4 \ mpopt.alpha.m4 \ mpopt.arm.m4 \ mpopt.ia64.m4 \ mpopt.m68k.m4 \ mpopt.ppc.m4 \ mpopt.ppc64.m4 \ mpopt.s390x.m4 \ mpopt.sparcv8.m4 \ mpopt.sparcv8plus.m4 \ mpopt.x86.m4 \ mpopt.x86_64.m4 \ ppc.m4 \ ppc64.m4 \ sha1opt.x86.m4 \ sparc.m4 \ x86.m4 \ x86_64.m4 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gas/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gas/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/gas/mpopt.ppc.m40000664000175000001440000000667310254471670013230 00000000000000dnl mpopt.ppc.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/ppc.m4) C_FUNCTION_BEGIN(mpaddw) mtctr r3 slwi r0,r3,2 add r4,r4,r0 li r0,0 lwzu r6,-4(r4) addc r6,r6,r5 stw r6,0(r4) bdz LOCAL(mpaddw_skip) LOCAL(mpaddw_loop): lwzu r6,-4(r4) adde r6,r0,r6 stw r6,0(r4) bdnz LOCAL(mpaddw_loop) LOCAL(mpaddw_skip): addze r3,r0 blr C_FUNCTION_END(mpaddw) C_FUNCTION_BEGIN(mpsubw) mtctr r3 slwi r0,r3,2 add r4,r4,r0 li r0,0 lwz r6,-4(r4) subfc r6,r5,r6 stwu r6,-4(r4) bdz LOCAL(mpsubw_skip) LOCAL(mpsubw_loop): lwz r6,-4(r4) subfe r6,r0,r6 stwu r6, -4(r4) bdnz LOCAL(mpsubw_loop) LOCAL(mpsubw_skip): subfe r3,r0,r0 neg r3,r3 blr C_FUNCTION_END(mpsubw) C_FUNCTION_BEGIN(mpadd) mtctr r3 slwi r0,r3,2 add r4,r4,r0 add r5,r5,r0 li r0,0 lwz r6,-4(r4) lwzu r7,-4(r5) addc r6,r7,r6 stwu r6,-4(r4) bdz LOCAL(mpadd_skip) LOCAL(mpadd_loop): lwz r6,-4(r4) lwzu r7,-4(r5) adde r6,r7,r6 stwu r6,-4(r4) bdnz LOCAL(mpadd_loop) LOCAL(mpadd_skip): addze r3,r0 blr C_FUNCTION_END(mpadd) C_FUNCTION_BEGIN(mpsub) mtctr r3 slwi r0,r3,2 add r4,r4,r0 add r5,r5,r0 li r0,0 lwz r6,-4(r4) lwzu r7,-4(r5) subfc r6,r7,r6 stwu r6,-4(r4) bdz LOCAL(mpsub_skip) LOCAL(mpsub_loop): lwz r6,-4(r4) lwzu r7,-4(r5) subfe r6,r7,r6 stwu r6,-4(r4) bdnz LOCAL(mpsub_loop) LOCAL(mpsub_skip): subfe r3,r0,r0 neg r3,r3 blr C_FUNCTION_END(mpsub) C_FUNCTION_BEGIN(mpmultwo) mtctr r3 slwi r0,r3,2 add r4,r4,r0 li r0,0 lwz r6,-4(r4) addc r6,r6,r6 stwu r6,-4(r4) bdz LOCAL(mpmultwo_skip) LOCAL(mpmultwo_loop): lwz r6,-4(r4) adde r6,r6,r6 stwu r6,-4(r4) bdnz LOCAL(mpmultwo_loop) LOCAL(mpmultwo_skip): addze r3,r0 blr C_FUNCTION_END(mpmultwo) C_FUNCTION_BEGIN(mpsetmul) mtctr r3 slwi r0,r3,2 add r4,r4,r0 add r5,r5,r0 li r3,0 LOCAL(mpsetmul_loop): lwzu r7,-4(r5) mullw r8,r7,r6 addc r8,r8,r3 mulhwu r9,r7,r6 addze r3,r9 stwu r8,-4(r4) bdnz LOCAL(mpsetmul_loop) blr C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) mtctr r3 slwi r0,r3,2 add r4,r4,r0 add r5,r5,r0 li r3,0 LOCAL(mpaddmul_loop): lwzu r8,-4(r5) lwzu r7,-4(r4) mullw r9,r8,r6 addc r9,r9,r3 mulhwu r10,r8,r6 addze r3,r10 addc r9,r9,r7 addze r3,r3 stw r9,0(r4) bdnz LOCAL(mpaddmul_loop) blr C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) mtctr r3 slwi r0,r3,2 add r4,r4,r0 add r5,r5,r0 add r4,r4,r0 li r3,0 LOCAL(mpaddsqrtrc_loop): lwzu r0,-4(r5) lwz r6,-8(r4) lwz r7,-4(r4) mullw r9,r0,r0 addc r9,r9,r3 mulhwu r8,r0,r0 addze r8,r8 li r3,0 addc r7,r7,r9 adde r6,r6,r8 addze r3,r3 stw r7,-4(r4) stwu r6,-8(r4) bdnz LOCAL(mpaddsqrtrc_loop) blr C_FUNCTION_END(mpaddsqrtrc) beecrypt-4.2.1/gas/Makefile.am0000644000175000001440000000245211216153317013061 00000000000000# # Makefile.am's purpose is to add the GNU Assembler sources to the dist # # Copyright (c) 2001, 2002, 2003 X-Way Rights BV # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # AUTOMAKE_OPTIONS = gnu no-dependencies EXTRA_DIST = \ alpha.m4 \ asmdefs.m4 \ blowfishopt.i586.m4 \ blowfishopt.ppc.m4 \ ia64.m4 \ m68k.m4 \ mpopt.alpha.m4 \ mpopt.arm.m4 \ mpopt.ia64.m4 \ mpopt.m68k.m4 \ mpopt.ppc.m4 \ mpopt.ppc64.m4 \ mpopt.s390x.m4 \ mpopt.sparcv8.m4 \ mpopt.sparcv8plus.m4 \ mpopt.x86.m4 \ mpopt.x86_64.m4 \ ppc.m4 \ ppc64.m4 \ sha1opt.x86.m4 \ sparc.m4 \ x86.m4 \ x86_64.m4 beecrypt-4.2.1/gas/sha1opt.x86.m40000664000175000001440000001745110254471670013307 00000000000000dnl sha1opt.i586.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/x86.m4) .set K00, 0x5a827999 .set K20, 0x6ed9eba1 .set K40, 0x8f1bbcdc .set K60, 0xca62c1d6 .set PARAM_H, 0 .set PARAM_DATA, 20 define(`subround1',` movl $2,%ecx movl $1,%ebx movl $3,%edx roll `$'5,%eax xorl %edx,%ecx addl $4,%eax andl %ebx,%ecx addl `$'K00,%eax rorl `$'2,%ebx addl $5(%esi,%edi),%eax xorl %edx,%ecx movl %ebx,$1 addl %ecx,%eax movl %eax,$4 ') define(`subround2',` movl $2,%ecx movl $1,%ebx roll `$'5,%eax xorl %ebx,%ecx addl $4,%eax xorl $3,%ecx addl `$'K20,%eax rorl `$'2,%ebx addl $5(%esi,%edi),%eax movl %ebx,$1 addl %ecx,%eax movl %eax,$4 ') define(`subround3',` movl $2,%ecx roll `$'5,%eax movl $1,%ebx movl %ecx,%edx addl $4,%eax orl %ebx,%ecx andl %ebx,%edx andl $3,%ecx addl `$'K40,%eax orl %edx,%ecx addl $5(%esi,%edi),%eax rorl `$'2,%ebx addl %ecx,%eax movl %ebx,$1 movl %eax,$4 ') define(`subround4',` movl $2,%ecx movl $1,%ebx roll `$'5,%eax xorl %ebx,%ecx addl $4,%eax xorl $3,%ecx addl `$'K60,%eax rorl `$'2,%ebx addl $5(%esi,%edi),%eax movl %ebx,$1 addl %ecx,%eax movl %eax,$4 ') C_FUNCTION_BEGIN(sha1Process) pushl %edi pushl %esi pushl %ebx pushl %ebp movl 20(%esp),%esi subl `$'20,%esp leal PARAM_DATA(%esi),%edi movl %esp,%ebp movl `$'4,%ecx LOCAL(0): movl (%esi,%ecx,4),%edx movl %edx,(%ebp,%ecx,4) decl %ecx jns LOCAL(0) movl `$'15,%ecx .align 4 LOCAL(1): movl (%edi,%ecx,4),%edx ifdef(`USE_BSWAP',` bswap %edx ',` movl %edx,%eax andl `$'0xff00ff,%edx rol `$'8,%eax andl `$'0xff00ff,%eax ror `$'8,%edx or %eax,%edx ') mov %edx,(%edi,%ecx,4) decl %ecx jns LOCAL(1) leal PARAM_DATA(%esi),%edi movl `$'16,%ecx xorl %eax,%eax .align 4 LOCAL(2): movl 52(%edi),%eax movl 56(%edi),%ebx xorl 32(%edi),%eax xorl 36(%edi),%ebx xorl 8(%edi),%eax xorl 12(%edi),%ebx xorl (%edi),%eax xorl 4(%edi),%ebx roll `$'1,%eax roll `$'1,%ebx movl %eax,64(%edi) movl %ebx,68(%edi) movl 60(%edi),%eax movl 64(%edi),%ebx xorl 40(%edi),%eax xorl 44(%edi),%ebx xorl 16(%edi),%eax xorl 20(%edi),%ebx xorl 8(%edi),%eax xorl 12(%edi),%ebx roll `$'1,%eax roll `$'1,%ebx movl %eax,72(%edi) movl %ebx,76(%edi) addl `$'16,%edi decl %ecx jnz LOCAL(2) movl `$'PARAM_DATA,%edi movl (%ebp),%eax LOCAL(01_20): subround1( 4(%ebp), 8(%ebp), 12(%ebp), 16(%ebp), 0) subround1( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround1(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround1(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround1( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround1( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround1( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround1(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround1(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround1( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround1( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround1( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround1(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround1(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround1( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround1( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround1( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround1(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround1(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround1( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi LOCAL(21_40): subround2( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround2( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround2(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround2(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround2( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround2( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround2( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround2(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround2(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround2( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround2( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround2( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround2(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround2(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround2( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround2( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround2( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround2(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround2(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround2( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi LOCAL(41_60): subround3( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround3( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround3(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround3(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround3( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround3( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround3( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround3(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround3(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround3( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround3( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround3( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround3(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround3(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround3( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround3( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround3( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround3(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround3(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround3( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi LOCAL(61_80): subround4( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround4( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround4(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround4(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround4( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround4( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround4( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround4(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround4(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround4( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround4( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround4( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround4(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround4(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround4( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) addl `$'20,%edi subround4( 4(%ebp), %ebx , 12(%ebp), 16(%ebp), 0) subround4( (%ebp), %ebx , 8(%ebp), 12(%ebp), 4) subround4(16(%ebp), %ebx , 4(%ebp), 8(%ebp), 8) subround4(12(%ebp), %ebx , (%ebp), 4(%ebp), 12) subround4( 8(%ebp), %ebx , 16(%ebp), (%ebp), 16) movl `$'4,%ecx .align 4 LOCAL(3): movl (%ebp,%ecx,4),%eax addl %eax,(%esi,%ecx,4) decl %ecx jns LOCAL(3) addl `$'20,%esp popl %ebp popl %ebx popl %esi popl %edi ret C_FUNCTION_END(sha1Process) beecrypt-4.2.1/gas/x86.m40000664000175000001440000000273610257742170011730 00000000000000dnl x86.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ifelse(substr(ASM_ARCH,0,6),athlon,` define(USE_BSWAP) define(USE_MMX) ') ifelse(substr(ASM_ARCH,0,7),pentium,` define(USE_BSWAP) ') ifelse(ASM_ARCH,i586,` define(USE_BSWAP) ') ifelse(ASM_ARCH,i686,` define(USE_BSWAP) ') ifelse(ASM_ARCH,pentium-m,` undefine(`ALIGN') define(ALIGN,`.p2align 4') define(USE_MMX) define(USE_SSE) define(USE_SSE2) ') ifelse(ASM_ARCH,pentium-mmx,` define(USE_MMX) ') ifelse(ASM_ARCH,pentium2,` define(USE_MMX) ') ifelse(ASM_ARCH,pentium3,` define(USE_MMX) define(USE_SSE) ') ifelse(ASM_ARCH,pentium4,` undefine(`ALIGN') define(ALIGN,`.p2align 4') define(USE_MMX) define(USE_SSE) define(USE_SSE2) ') beecrypt-4.2.1/gas/mpopt.arm.m40000664000175000001440000000405110254471670013211 00000000000000dnl mpopt.arm.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) C_FUNCTION_BEGIN(mpsetmul) stmfd sp!, {r4, r5, lr} add r1, r1, r0, asl #2 add r2, r2, r0, asl #2 mov ip, #0 LOCAL(mpsetmul_loop): ldr r4, [r2, #-4]! mov r5, #0 umlal ip, r5, r3, r4 str ip, [r1, #-4]! mov ip, r5 subs r0, r0, #1 bne LOCAL(mpsetmul_loop) mov r0, ip ldmfd sp!, {r4, r5, pc} C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) stmfd sp!, {r4, r5, r6, lr} add r1, r1, r0, asl #2 add r2, r2, r0, asl #2 mov ip, #0 LOCAL(mpaddmul_loop): ldr r4, [r2, #-4]! ldr r5, [r1, #-4] mov r6, #0 umlal ip, r6, r3, r4 adds r5, r5, ip adc ip, r6, #0 str r5, [r1, #-4]! subs r0, r0, #1 bne LOCAL(mpaddmul_loop) mov r0, ip ldmfd sp!, {r4, r5, r6, pc} C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) stmfd sp!, {r4, r5, r6, lr} add r1, r1, r0, asl #3 add r2, r2, r0, asl #2 mov r3, #0 mov ip, #0 LOCAL(mpaddsqrtrc_loop): ldr r4, [r2, #-4]! mov r6, #0 umlal ip, r6, r4, r4 ldr r5, [r1, #-4] ldr r4, [r1, #-8] adds r5, r5, ip adcs r4, r4, r6 str r5, [r1, #-4] str r4, [r1, #-8]! adc ip, r3, #0 subs r0, r0, #1 bne LOCAL(mpaddsqrtrc_loop) mov r0, ip ldmfd sp!, {r4, r5, r6, pc} C_FUNCTION_END(mpaddsqrtrc) beecrypt-4.2.1/gas/x86_64.m40000664000175000001440000000175510254471670012242 00000000000000dnl x86_64.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl ABI specifies for integer/pointer parameters: dnl param 1: %rdi dnl param 2: %rsi dnl param 3: %rdx dnl param 4: %rcx beecrypt-4.2.1/gas/asmdefs.m40000664000175000001440000000377110254471670012726 00000000000000dnl asmdefs.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ifelse(substr(ASM_OS,0,7),freebsd,` define(USE_SIZE_DIRECTIVE,yes) define(USE_TYPE_DIRECTIVE,yes) ') ifelse(substr(ASM_OS,0,5),linux,` define(USE_SIZE_DIRECTIVE,yes) define(USE_TYPE_DIRECTIVE,yes) ') ifelse(substr(ASM_OS,0,6),cygwin,` define(USE_TYPE_DIRECTIVE,yes) define(SYMTYPE,` .def SYMNAME($1); .scl 2; .type 32; .endef ') define(C_FUNCTION_END,` .section .drectve .ascii " -export:$1" ') ') define(SYMNAME,`GSYM_PREFIX`$1'') define(LOCAL,`LSYM_PREFIX`$1'') ifdef(`ALIGN',,`define(`ALIGN',`')') ifelse(USE_TYPE_DIRECTIVE,yes,` ifelse(substr(ASM_ARCH,0,3),arm,` define(FUNCTION_TYPE,`function') ',` ifelse(substr(ASM_ARCH,0,5),sparc,` define(FUNCTION_TYPE,`#function') ',` define(FUNCTION_TYPE,`@function') ') ') ifdef(`SYMTYPE',,` define(SYMTYPE,` .type SYMNAME($1),FUNCTION_TYPE ') ') define(C_FUNCTION_BEGIN,` TEXTSEG ALIGN GLOBL SYMNAME($1) SYMTYPE($1) SYMNAME($1): ') ',` define(C_FUNCTION_BEGIN,` TEXTSEG ALIGN GLOBL SYMNAME($1) SYMNAME($1): ') ') ifdef(C_FUNCTION_END,`',` ifelse(USE_SIZE_DIRECTIVE,yes,` define(C_FUNCTION_END,` LOCAL($1)_size: .size SYMNAME($1), LOCAL($1)_size - SYMNAME($1) ') ',` define(C_FUNCTION_END,`') ') ') beecrypt-4.2.1/gas/alpha.m40000664000175000001440000000206410254471670012363 00000000000000dnl alpha.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA undefine(`C_FUNCTION_BEGIN') define(C_FUNCTION_BEGIN,` .text .align 5 .globl $1 .ent $1 $1: .frame `$'sp, 0, `$'26 .prologue 0 ') undefine(`C_FUNCTION_END') define(C_FUNCTION_END,` .end $1 ') beecrypt-4.2.1/gas/mpopt.m68k.m40000664000175000001440000000603710254471670013225 00000000000000dnl mpopt.m68k.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/m68k.m4) dnl works C_FUNCTION_BEGIN(mpadd) move.l 4(%sp),%d0 movea.l 8(%sp),%a0 movea.l 12(%sp),%a1 move.l %d0,%d1 lsl.l #2,%d0 subq.l #1,%d1 adda.l %d0,%a0 adda.l %d0,%a1 clr %d0 .align 2 LOCAL(mpadd_loop): addx.l -(%a1),-(%a0) dbf %d1,LOCAL(mpadd_loop) addx.l %d0,%d0 rts C_FUNCTION_END(mpadd) dnl works C_FUNCTION_BEGIN(mpsub) move.l 4(%sp),%d0 movea.l 8(%sp),%a0 movea.l 12(%sp),%a1 move.l %d0,%d1 lsl.l #2,%d0 subq.l #1,%d1 adda.l %d0,%a0 adda.l %d0,%a1 clr %d0 .align 2 LOCAL(mpsub_loop): subx.l -(%a1),-(%a0) dbf %d1,LOCAL(mpsub_loop) addx.l %d0,%d0 rts C_FUNCTION_END(mpsub) dnl works C_FUNCTION_BEGIN(mpsetmul) movem.l %d2-%d5,-(%sp) move.l 20(%sp),%d0 movea.l 24(%sp),%a0 movea.l 28(%sp),%a1 move.l 32(%sp),%d2 move.l %d0,%d5 lsl.l #2,%d0 subq.l #1,%d5 adda.l %d0,%a0 adda.l %d0,%a1 clr.l %d3 clr.l %d4 .align 2 LOCAL(mpsetmul_loop): move.l -(%a1),%d1 mulu.l %d2,%d0:%d1 add.l %d3,%d1 addx.l %d4,%d0 move.l %d1,-(%a0) move.l %d0,%d3 dbf %d5,LOCAL(mpsetmul_loop) movem.l (%sp)+,%d2-%d5 rts C_FUNCTION_END(mpsetmul) dnl works C_FUNCTION_BEGIN(mpaddmul) movem.l %d2-%d5,-(%sp) move.l 20(%sp),%d0 movea.l 24(%sp),%a0 movea.l 28(%sp),%a1 move.l 32(%sp),%d2 move.l %d0,%d5 lsl.l #2,%d0 subq.l #1,%d5 adda.l %d0,%a0 adda.l %d0,%a1 clr.l %d3 clr.l %d4 .align 2 LOCAL(mpaddmul_loop): move.l -(%a1),%d1 mulu.l %d2,%d0:%d1 add.l %d3,%d1 addx.l %d4,%d0 add.l -(%a0),%d1 addx.l %d4,%d0 move.l %d1,(%a0) move.l %d0,%d3 dbf %d5,LOCAL(mpaddmul_loop) movem.l (%sp)+,%d2-%d5 rts C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) movem.l %d3-%d5,-(%sp) move.l 16(%sp),%d0 movea.l 20(%sp),%a0 movea.l 24(%sp),%a1 move.l %d0,%d5 lsl.l #2,%d0 subq.l #1,%d5 adda.l %d0,%a0 adda.l %d0,%a0 adda.l %d0,%a1 clr.l %d3 clr.l %d4 LOCAL(mpaddsqrtrc_loop): move.l -(%a1),%d1 dnl square %d1 into %d0 and %d1 mulu.l %d1,%d0:%d1 add.l %d3,%d1 addx.l %d4,%d0 add.l -(%a0),%d1 addx.l %d4,%d0 move.l %d1,(%a0) clr.l %d3 add.l -(%a0),%d0 addx.l %d4,%d3 move.l %d0,0(%a0) dbf %d5,LOCAL(mpaddsqrtrc_loop) movem.l (%sp)+,%d3-%d5 rts C_FUNCTION_END(mpaddsqrtrc) beecrypt-4.2.1/gas/ppc64.m40000664000175000001440000000446010254471670012234 00000000000000dnl ppc64.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ifelse(substr(ASM_OS,0,3),aix,` define(USE_NUMERIC_REGISTERS) undefine(`C_FUNCTION_BEGIN') define(C_FUNCTION_BEGIN,` .toc .globl $1[DS] .csect $1[DS] .llong .$1[PR], TOC[tc0], 0 .toc .globl .$1[PR] .csect .$1[PR] ') undefine(`C_FUNCTION_END') define(C_FUNCTION_END,` .tbtag 0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0 ') .machine "ppc64" ') ifelse(substr(ASM_OS,0,5),linux,` define(USE_NUMERIC_REGISTERS) dnl trampoline definitions from glibc-2.3.2/sysdeps/powerpc/powerpc64/dl-machine.h undefine(`C_FUNCTION_BEGIN') define(C_FUNCTION_BEGIN,` .section .text .align 2 .globl .$1 .type .$1,@function .section ".opd","aw" .align 3 .globl $1 .size $1,24 $1: .quad .$1,.TOC.@tocbase,0 .previous .$1: ') undefine(`C_FUNCTION_END') define(C_FUNCTION_END,` .LT_$1: .long 0 .byte 0x00,0x0c,0x24,0x40,0x00,0x00,0x00,0x00 .long .LT_$1 - .$1 .short .LT_$1_name_end-.LT_$1_name_start .LT_$1_name_start: .ascii "$1" .LT_$1_name_end: .align 2 .size .$1,. - .$1 .previous ') ') ifdef(`USE_NUMERIC_REGISTERS',` define(r0,0) define(r1,1) define(r2,2) define(r3,3) define(r4,4) define(r5,5) define(r6,6) define(r7,7) define(r8,8) define(r9,9) define(r10,10) define(r11,11) define(r12,12) define(r13,13) define(r14,14) define(r15,15) define(r16,16) define(r17,17) define(r18,18) define(r19,19) define(r20,20) define(r21,21) define(r22,22) define(r23,23) define(r24,24) define(r25,25) define(r26,26) define(r27,27) define(r28,28) define(r29,29) define(r30,30) define(r31,31) ') beecrypt-4.2.1/gas/ppc.m40000664000175000001440000000415110443331040012041 00000000000000dnl ppc.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ifelse(substr(ASM_OS,0,3),aix,` define(USE_NUMERIC_REGISTERS) undefine(`C_FUNCTION_BEGIN') define(C_FUNCTION_BEGIN,` .toc .globl $1[DS] .csect $1[DS] .long .$1[PR], TOC[tc0], 0 .toc .globl .$1[PR] .csect .$1[PR] ') undefine(`C_FUNCTION_END') define(C_FUNCTION_END,` .tbtag 0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0 ') define(LOAD_ADDRESS,` lwz $2,L$1(r2) ') define(EXTERNAL_VARIABLE,` .toc L$1: .tc $1[TC],$1[RW] ') .machine "ppc" ') ifelse(substr(ASM_OS,0,6),darwin,` define(LOAD_ADDRESS,` lis $2,hi16($1) la $2,lo16($1)($2) ') define(EXTERNAL_VARIABLE) ') ifelse(substr(ASM_OS,0,5),linux,` define(USE_NUMERIC_REGISTERS) define(LOAD_ADDRESS,` lis $2,$1@ha la $2,$1@l($2) ') define(EXTERNAL_VARIABLE) ') ifelse(substr(ASM_OS,0,6),lynxos,` define(USE_NUMERIC_REGISTERS) ') ifdef(`USE_NUMERIC_REGISTERS',` define(r0,0) define(r1,1) define(r2,2) define(r3,3) define(r4,4) define(r5,5) define(r6,6) define(r7,7) define(r8,8) define(r9,9) define(r10,10) define(r11,11) define(r12,12) define(r13,13) define(r14,14) define(r15,15) define(r16,16) define(r17,17) define(r18,18) define(r19,19) define(r20,20) define(r21,21) define(r22,22) define(r23,23) define(r24,24) define(r25,25) define(r26,26) define(r27,27) define(r28,28) define(r29,29) define(r30,30) define(r31,31) ') beecrypt-4.2.1/gas/ia64.m40000664000175000001440000000274510254471670012047 00000000000000dnl ia64.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA define(`saved_pfs',`r31') define(`saved_lc',`r30') define(`saved_pr',`r29') ifelse(substr(ASM_OS,0,5),linux,` undefine(`C_FUNCTION_BEGIN') define(C_FUNCTION_BEGIN,` TEXTSEG ALIGN GLOBL SYMNAME($1)# .proc SYMNAME($1)# SYMNAME($1): ') undefine(`C_FUNCTION_END') define(C_FUNCTION_END,` .endp SYMNAME($1)# ') ') ifelse(substr(ASM_OS,0,4),hpux,` undefine(`C_FUNCTION_BEGIN') define(C_FUNCTION_BEGIN,` TEXTSEG ALIGN GLOBL SYMNAME($1) .proc SYMNAME($1) SYMNAME($1): ') undefine(`C_FUNCTION_END') define(C_FUNCTION_END,` .endp SYMNAME($1) ') ') .explicit beecrypt-4.2.1/gas/mpopt.x86.m40000664000175000001440000001432310427062764013064 00000000000000dnl mpopt.x86.m4 dnl dnl Copyright (c) 2003 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) include(ASM_SRCDIR/x86.m4) C_FUNCTION_BEGIN(mpzero) pushl %edi movl 8(%esp),%ecx movl 12(%esp),%edi xorl %eax,%eax rep; stosl popl %edi ret C_FUNCTION_END(mpzero) C_FUNCTION_BEGIN(mpfill) pushl %edi movl 8(%esp),%ecx movl 12(%esp),%edi movl 16(%esp),%eax rep; stosl popl %edi ret C_FUNCTION_END(mpfill) C_FUNCTION_BEGIN(mpeven) movl 4(%esp),%ecx movl 8(%esp),%eax movl -4(%eax,%ecx,4),%eax notl %eax andl `$'1,%eax ret C_FUNCTION_END(mpeven) C_FUNCTION_BEGIN(mpodd) movl 4(%esp),%ecx movl 8(%esp),%eax movl -4(%eax,%ecx,4),%eax andl `$'1,%eax ret C_FUNCTION_END(mpodd) C_FUNCTION_BEGIN(mpaddw) pushl %edi movl 8(%esp),%ecx movl 12(%esp),%edi movl 16(%esp),%eax xorl %edx,%edx leal -4(%edi,%ecx,4),%edi addl %eax,(%edi) decl %ecx jz LOCAL(mpaddw_skip) leal -4(%edi),%edi .align 4 LOCAL(mpaddw_loop): adcl %edx,(%edi) leal -4(%edi),%edi decl %ecx jnz LOCAL(mpaddw_loop) LOCAL(mpaddw_skip): sbbl %eax,%eax negl %eax popl %edi ret C_FUNCTION_END(mpaddw) C_FUNCTION_BEGIN(mpsubw) pushl %edi movl 8(%esp),%ecx movl 12(%esp),%edi movl 16(%esp),%eax xorl %edx,%edx leal -4(%edi,%ecx,4),%edi subl %eax,(%edi) decl %ecx jz LOCAL(mpsubw_skip) leal -4(%edi),%edi .align 4 LOCAL(mpsubw_loop): sbbl %edx,(%edi) leal -4(%edi),%edi decl %ecx jnz LOCAL(mpsubw_loop) LOCAL(mpsubw_skip): sbbl %eax,%eax negl %eax popl %edi ret C_FUNCTION_END(mpsubw) C_FUNCTION_BEGIN(mpadd) pushl %edi pushl %esi movl 12(%esp),%ecx movl 16(%esp),%edi movl 20(%esp),%esi xorl %edx,%edx decl %ecx .align 4 LOCAL(mpadd_loop): movl (%esi,%ecx,4),%eax movl (%edi,%ecx,4),%edx adcl %eax,%edx movl %edx,(%edi,%ecx,4) decl %ecx jns LOCAL(mpadd_loop) sbbl %eax,%eax negl %eax popl %esi popl %edi ret C_FUNCTION_END(mpadd) C_FUNCTION_BEGIN(mpsub) pushl %edi pushl %esi movl 12(%esp),%ecx movl 16(%esp),%edi movl 20(%esp),%esi xorl %edx,%edx decl %ecx .align 4 LOCAL(mpsub_loop): movl (%esi,%ecx,4),%eax movl (%edi,%ecx,4),%edx sbbl %eax,%edx movl %edx,(%edi,%ecx,4) decl %ecx jns LOCAL(mpsub_loop) sbbl %eax,%eax negl %eax popl %esi popl %edi ret C_FUNCTION_END(mpsub) C_FUNCTION_BEGIN(mpdivtwo) pushl %edi movl 8(%esp),%ecx movl 12(%esp),%edi leal (%edi,%ecx,4),%edi negl %ecx xorl %eax,%eax .align 4 LOCAL(mpdivtwo_loop): rcrl `$'1,(%edi,%ecx,4) inc %ecx jnz LOCAL(mpdivtwo_loop) popl %edi ret C_FUNCTION_END(mpdivtwo) C_FUNCTION_BEGIN(mpmultwo) pushl %edi movl 8(%esp),%ecx movl 12(%esp),%edi xorl %edx,%edx decl %ecx .align 4 LOCAL(mpmultwo_loop): movl (%edi,%ecx,4),%eax adcl %eax,%eax movl %eax,(%edi,%ecx,4) decl %ecx jns LOCAL(mpmultwo_loop) sbbl %eax,%eax negl %eax popl %edi ret C_FUNCTION_END(mpmultwo) C_FUNCTION_BEGIN(mpsetmul) pushl %edi pushl %esi ifdef(`USE_SSE2',` movl 12(%esp),%ecx movl 16(%esp),%edi movl 20(%esp),%esi movd 24(%esp),%mm1 pxor %mm0,%mm0 decl %ecx .align 4 LOCAL(mpsetmul_loop): movd (%esi,%ecx,4),%mm2 pmuludq %mm1,%mm2 paddq %mm2,%mm0 movd %mm0,(%edi,%ecx,4) decl %ecx psrlq `$'32,%mm0 jns LOCAL(mpsetmul_loop) movd %mm0,%eax emms ',` pushl %ebx pushl %ebp movl 20(%esp),%ecx movl 24(%esp),%edi movl 28(%esp),%esi movl 32(%esp),%ebp xorl %edx,%edx decl %ecx .align 4 LOCAL(mpsetmul_loop): movl %edx,%ebx movl (%esi,%ecx,4),%eax mull %ebp addl %ebx,%eax adcl `$'0,%edx movl %eax,(%edi,%ecx,4) decl %ecx jns LOCAL(mpsetmul_loop) movl %edx,%eax popl %ebp popl %ebx ') popl %esi popl %edi ret C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) pushl %edi pushl %esi ifdef(`USE_SSE2',` movl 12(%esp),%ecx movl 16(%esp),%edi movl 20(%esp),%esi movd 24(%esp),%mm1 pxor %mm0,%mm0 decl %ecx .align 4 LOCAL(mpaddmul_loop): movd (%esi,%ecx,4),%mm2 movd (%edi,%ecx,4),%mm3 pmuludq %mm1,%mm2 paddq %mm2,%mm3 paddq %mm3,%mm0 movd %mm0,(%edi,%ecx,4) decl %ecx psrlq $32,%mm0 jns LOCAL(mpaddmul_loop) movd %mm0,%eax emms ',` pushl %ebx pushl %ebp movl 20(%esp),%ecx movl 24(%esp),%edi movl 28(%esp),%esi movl 32(%esp),%ebp xorl %edx,%edx decl %ecx .align 4 LOCAL(mpaddmul_loop): movl %edx,%ebx movl (%esi,%ecx,4),%eax mull %ebp addl %ebx,%eax adcl `$'0,%edx addl (%edi,%ecx,4),%eax adcl `$'0,%edx movl %eax,(%edi,%ecx,4) decl %ecx jns LOCAL(mpaddmul_loop) movl %edx,%eax popl %ebp popl %ebx ') popl %esi popl %edi ret C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) pushl %edi pushl %esi ifdef(`USE_SSE2',` movl 12(%esp),%ecx movl 16(%esp),%edi movl 20(%esp),%esi pxor %mm0,%mm0 decl %ecx .align 4 LOCAL(mpaddsqrtrc_loop): movd (%esi,%ecx,4),%mm2 pmuludq %mm2,%mm2 movd 4(%edi,%ecx,8),%mm3 paddq %mm2,%mm3 movd 0(%edi,%ecx,8),%mm4 paddq %mm3,%mm0 movd %mm0,4(%edi,%ecx,8) psrlq $32,%mm0 paddq %mm4,%mm0 movd %mm0,0(%edi,%ecx,8) decl %ecx psrlq $32,%mm0 jns LOCAL(mpaddsqrtrc_loop) movd %mm0,%eax emms ',` pushl %ebx movl 16(%esp),%ecx movl 20(%esp),%edi movl 24(%esp),%esi xorl %ebx,%ebx decl %ecx .align 4 LOCAL(mpaddsqrtrc_loop): movl (%esi,%ecx,4),%eax mull %eax addl %ebx,%eax adcl `$'0,%edx addl %eax,4(%edi,%ecx,8) adcl %edx,(%edi,%ecx,8) sbbl %ebx,%ebx negl %ebx decl %ecx jns LOCAL(mpaddsqrtrc_loop) movl %ebx,%eax popl %ebx ') popl %esi popl %edi ret C_FUNCTION_END(mpaddsqrtrc) C_FUNCTION_BEGIN(mppndiv) movl 4(%esp),%edx movl 8(%esp),%eax divl 12(%esp) ret C_FUNCTION_END(mppndiv) beecrypt-4.2.1/gas/mpopt.s390x.m40000664000175000001440000000403510254471670013322 00000000000000dnl mpopt.s390x.m4 dnl dnl Copyright (c) 2003, 2004 Bob Deblier dnl dnl Author: Bob Deblier dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public dnl License as published by the Free Software Foundation; either dnl version 2.1 of the License, or (at your option) any later version. dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with this library; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include(config.m4) include(ASM_SRCDIR/asmdefs.m4) C_FUNCTION_BEGIN(mpsetmul) stmg %r6,%r7,48(%r15) sllg %r6,%r2,3 aghi %r6,-8 xgr %r2,%r2 xgr %r7,%r7 LOCAL(mpsetmul_loop): lgr %r1,%r5 mlg %r0,0(%r4,%r6) algr %r1,%r2 alcgr %r0,%r7 stg %r1,0(%r3,%r6) lgr %r2,%r0 aghi %r6,-8 jhe LOCAL(mpsetmul_loop) lmg %r6,%r7,48(%r15) br %r14 C_FUNCTION_END(mpsetmul) C_FUNCTION_BEGIN(mpaddmul) stmg %r6,%r7,48(%r15) sllg %r6,%r2,3 aghi %r6,-8 xgr %r2,%r2 xgr %r7,%r7 LOCAL(mpaddmul_loop): lgr %r1,%r5 mlg %r0,0(%r4,%r6) algr %r1,%r2 alcgr %r0,%r7 alg %r1,0(%r3,%r6) alcgr %r0,%r7 stg %r1,0(%r3,%r6) lgr %r2,%r0 aghi %r6,-8 jhe LOCAL(mpaddmul_loop) lmg %r6,%r7,48(%r15) br %r14 C_FUNCTION_END(mpaddmul) C_FUNCTION_BEGIN(mpaddsqrtrc) stmg %r6,%r7,48(%r15) sllg %r5,%r2,3 sllg %r6,%r2,4 aghi %r5,-8 aghi %r6,-16 xgr %r2,%r2 xgr %r7,%r7 LOCAL(mpaddsqrtrc_loop): lg %r1,0(%r4,%r5) mlg %r0,0(%r4,%r5) algr %r1,%r2 alcgr %r0,%r7 xgr %r2,%r2 alg %r1,8(%r3,%r6) alcg %r0,0(%r3,%r6) alcgr %r2,%r7 stg %r1,8(%r3,%r6) stg %r0,0(%r3,%r6) aghi %r5,-8 aghi %r6,-16 jhe LOCAL(mpaddsqrtrc_loop) lmg %r6,%r7,48(%r15) br %r14 C_FUNCTION_END(mpaddsqrtrc) beecrypt-4.2.1/README0000644000175000001440000001117711223574571011146 00000000000000Welcome to the BeeCrypt crypto library! Copyright (c) 1997, 1998, 1999, 2000, 2001, 2004, 2005 X-Way Rights BV Copyright (c) 2002, 2003, 2005, 2006, 2009 Bob Deblier (for certain parts) Author: Bob Deblier This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For the specifics of this license, see file 'COPYING.LIB', included in this distribution. Welcome to version 4.2.0 of BeeCrypt: The C++ API has received a major overhaul and has been expanded to deal properly with multi-threading on the major platforms. About BeeCrypt: BeeCrypt started its life when the need for a portable and fast cryptography library arose at Virtual Unlimited in 1997. I'm still trying to make it faster, easier to use and more portable, in addition to providing better documentation. Note that depending on where you are, the use of cryptography may be limited or forbidden by law. Before using this library, make sure you are legally entitled to do so. Most of the algorithms are implemented from reliable sources such as: "Handbook of Applied Cryptography" Alfred J. Menezes, Paul C. van Oorschot, Scott A. Vanstone CRC Press "Applied Cryptography", second edition Bruce Schneier Wiley For crypto enthusiasts these books are invaluable background material. IEEE P1363 "Standard Specifications for Public Key Cryptography" is a very interesting draft standard, which we will try to comply with. The structures in the library are geared towards exchange with Java and its security and cryptography classes. This library can also be accessed from Java by installing BeeCrypt for Java, a JCE 1.2 crypto provider and the counterpart of this library. Included in the library are: - entropy sources for initializing pseudo-random generators - pseudo-random generators: FIPS-186, Mersenne Twister - block ciphers: AES, Blowfish - hash functions: MD5, RIPEMD-128, RIPEMD-160, RIPEMD-256, RIPEMD-320, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512 - keyed hash functions: HMAC-MD5, HMAC-SHA-1, HMAC-SHA-224, HMAC-SHA-256, HMAC-SHA-384, HMAC-SHA-512 - multi-precision integer library, with assembler-optimized routines for several processors - probabilistic primality testing, with optimized small prime trial division - discrete logarithm parameter generation over a prime field - Diffie-Hellman key agreement - DSA signature scheme - ElGamal signature scheme (two variants) - RSA keypair generation with chinese remainder theorem variables - RSA public & private key operations - DHAES encryption scheme Planned for the near future are: - compliance with and compliance statements for IEEE P1363 - switch from OSS to ALSA for entropy gathering - experiments with CUDA (AES, MD6?) - more blockciphers (Twofish, ... ) - more blockcipher modes (OFB, ... ) - more hash functions (SHA-3 candidates, HAVAL, Tiger) - Elliptic Curves (ECDSA, ... ) - RSA signatures as specified by RFC-2440. The library has been tested on the following platforms: - Cygwin - Darwin/MacOS X - Linux glibc 2.x alpha - Linux glibc 2.x arm - Linux glibc 2.x ia64 - Linux glibc 2.x m68k - Linux glibc 2.x ppc - Linux glibc 2.x ppc64 - Linux glibc 2.x s390 - Linux glibc 2.x s390x - Linux glibc 2.x sparc - Linux glibc 2.x x86 - Linux glibc 2.x x86_64/amd64 - Solaris 2.[6789] sparc (with Forte or gnu compilers) - Solaris 2.[78] x86 (with Forte or GNU compilers) - Tru64 Unix alpha - Win32 (Windows 95, 98, NT 4.0, 2000, XP) The library is currently in the process of being ported to: - MinGW - AIX (shared libraries don't seem to work in 64-bit mode) For more information, refer to the HTML documentation, which can be generated with Doxygen, in the docs directory. If you want to report bugs, make suggestions, contribute fixes or enhancements, please see the beecrypt-specific website: http://sourceforge.net/projects/beecrypt or contact me at mailto:bob.deblier@telenet.be Sincerely, Bob Deblier beecrypt-4.2.1/sha512.c0000644000175000001440000003174511216402715011430 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha512.c * \brief SHA-512 hash function, as specified by NIST FIPS 180-2. * \author Bob Deblier * \ingroup HASH_m HASH_sha512_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #ifdef OPTIMIZE_SSE2 # include #endif #if HAVE_ENDIAN_H && HAVE_ASM_BYTEORDER_H # include #endif #include "beecrypt/sha512.h" #include "beecrypt/sha2k64.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_sha512_m * \{ */ static const uint64_t hinit[8] = { #if (SIZEOF_UNSIGNED_LONG == 8) || !HAVE_UNSIGNED_LONG_LONG 0x6a09e667f3bcc908UL, 0xbb67ae8584caa73bUL, 0x3c6ef372fe94f82bUL, 0xa54ff53a5f1d36f1UL, 0x510e527fade682d1UL, 0x9b05688c2b3e6c1fUL, 0x1f83d9abfb41bd6bUL, 0x5be0cd19137e2179UL #else 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL #endif }; const hashFunction sha512 = { .name = "SHA-512", .paramsize = sizeof(sha512Param), .blocksize = 128, .digestsize = 64, .reset = (hashFunctionReset) sha512Reset, .update = (hashFunctionUpdate) sha512Update, .digest = (hashFunctionDigest) sha512Digest }; int sha512Reset(register sha512Param* sp) { memcpy(sp->h, hinit, 8 * sizeof(uint64_t)); memset(sp->data, 0, 80 * sizeof(uint64_t)); #if (MP_WBITS == 64) mpzero(2, sp->length); #elif (MP_WBITS == 32) mpzero(4, sp->length); #else # error #endif sp->offset = 0; return 0; } #ifdef OPTIMIZE_SSE2 # define R(x,s) _mm_srli_si64(x,s) # define S(x,s) _mm_xor_si64(_mm_srli_si64(x,s),_mm_slli_si64(x,64-(s))) # define CH(x,y,z) _mm_xor_si64(_m_pand(x,_mm_xor_si64(y,z)),z) # define MAJ(x,y,z) _m_por(_m_pand(_m_por(x,y),z),_m_pand(x,y)) # define SIG0(x) _mm_xor_si64(_mm_xor_si64(S(x,28),S(x,34)),S(x,39)) # define SIG1(x) _mm_xor_si64(_mm_xor_si64(S(x,14),S(x,18)),S(x,41)) # define sig0(x) _mm_xor_si64(_mm_xor_si64(S(x,1),S(x,8)),R(x,7)) # define sig1(x) _mm_xor_si64(_mm_xor_si64(S(x,19),S(x,61)),R(x,6)) # define ROUND(a,b,c,d,e,f,g,h,w,k) \ temp = _mm_add_si64(h, _mm_add_si64(_mm_add_si64(SIG1(e), CH(e,f,g)), _mm_add_si64(k, w))); \ h = _mm_add_si64(temp, _mm_add_si64(SIG0(a), MAJ(a,b,c))); \ d = _mm_add_si64(d, temp) #else # define R(x,s) ((x) >> (s)) # define S(x,s) ROTR64(x, s) # define CH(x,y,z) ((x&(y^z))^z) # define MAJ(x,y,z) (((x|y)&z)|(x&y)) # define SIG0(x) (S(x,28) ^ S(x,34) ^ S(x,39)) # define SIG1(x) (S(x,14) ^ S(x,18) ^ S(x,41)) # define sig0(x) (S(x,1) ^ S(x,8) ^ R(x,7)) # define sig1(x) (S(x,19) ^ S(x,61) ^ R(x,6)) # define ROUND(a,b,c,d,e,f,g,h,w,k) \ temp = h + SIG1(e) + CH(e,f,g) + k + w; \ h = temp + SIG0(a) + MAJ(a,b,c); \ d += temp #endif #ifndef ASM_SHA512PROCESS void sha512Process(register sha512Param* sp) { #ifdef OPTIMIZE_SSE2 # if defined(_MSC_VER) || defined(__INTEL_COMPILER) static const __m64 MASK = { 0x00FF00FF00FF00FF }; # elif defined(__GNUC__) static const __m64 MASK = { 0x00FF00FF, 0x00FF00FF }; # else # error # endif __m64 a, b, c, d, e, f, g, h, temp; register __m64 *w; register const __m64 *k; register byte t; w = (__m64*) sp->data; t = 16; while (t--) { temp = *w; *(w++) = _mm_xor_si64( _mm_slli_si64(_m_pshufw(_m_pand(temp, MASK), 27), 8), _m_pshufw(_m_pand(_mm_srli_si64(temp, 8), MASK), 27) ); } t = 64; while (t--) { temp = _mm_add_si64(_mm_add_si64(sig1(w[-2]), w[-7]), _mm_add_si64(sig0(w[-15]), w[-16])); *(w++) = temp; } w = (__m64*) sp->h; a = w[0]; b = w[1]; c = w[2]; d = w[3]; e = w[4]; f = w[5]; g = w[6]; h = w[7]; w = (__m64*) sp->data; k = (__m64*) SHA2_64BIT_K; #else register uint64_t a, b, c, d, e, f, g, h, temp; register uint64_t *w; register const uint64_t *k; register byte t; # if WORDS_BIGENDIAN w = sp->data + 16; # else w = sp->data; t = 16; while (t--) { temp = swapu64(*w); *(w++) = temp; } # endif t = 64; while (t--) { temp = sig1(w[-2]) + w[-7] + sig0(w[-15]) + w[-16]; *(w++) = temp; } w = sp->data; a = sp->h[0]; b = sp->h[1]; c = sp->h[2]; d = sp->h[3]; e = sp->h[4]; f = sp->h[5]; g = sp->h[6]; h = sp->h[7]; k = SHA2_64BIT_K; #endif ROUND(a,b,c,d,e,f,g,h,w[ 0],k[ 0]); ROUND(h,a,b,c,d,e,f,g,w[ 1],k[ 1]); ROUND(g,h,a,b,c,d,e,f,w[ 2],k[ 2]); ROUND(f,g,h,a,b,c,d,e,w[ 3],k[ 3]); ROUND(e,f,g,h,a,b,c,d,w[ 4],k[ 4]); ROUND(d,e,f,g,h,a,b,c,w[ 5],k[ 5]); ROUND(c,d,e,f,g,h,a,b,w[ 6],k[ 6]); ROUND(b,c,d,e,f,g,h,a,w[ 7],k[ 7]); ROUND(a,b,c,d,e,f,g,h,w[ 8],k[ 8]); ROUND(h,a,b,c,d,e,f,g,w[ 9],k[ 9]); ROUND(g,h,a,b,c,d,e,f,w[10],k[10]); ROUND(f,g,h,a,b,c,d,e,w[11],k[11]); ROUND(e,f,g,h,a,b,c,d,w[12],k[12]); ROUND(d,e,f,g,h,a,b,c,w[13],k[13]); ROUND(c,d,e,f,g,h,a,b,w[14],k[14]); ROUND(b,c,d,e,f,g,h,a,w[15],k[15]); ROUND(a,b,c,d,e,f,g,h,w[16],k[16]); ROUND(h,a,b,c,d,e,f,g,w[17],k[17]); ROUND(g,h,a,b,c,d,e,f,w[18],k[18]); ROUND(f,g,h,a,b,c,d,e,w[19],k[19]); ROUND(e,f,g,h,a,b,c,d,w[20],k[20]); ROUND(d,e,f,g,h,a,b,c,w[21],k[21]); ROUND(c,d,e,f,g,h,a,b,w[22],k[22]); ROUND(b,c,d,e,f,g,h,a,w[23],k[23]); ROUND(a,b,c,d,e,f,g,h,w[24],k[24]); ROUND(h,a,b,c,d,e,f,g,w[25],k[25]); ROUND(g,h,a,b,c,d,e,f,w[26],k[26]); ROUND(f,g,h,a,b,c,d,e,w[27],k[27]); ROUND(e,f,g,h,a,b,c,d,w[28],k[28]); ROUND(d,e,f,g,h,a,b,c,w[29],k[29]); ROUND(c,d,e,f,g,h,a,b,w[30],k[30]); ROUND(b,c,d,e,f,g,h,a,w[31],k[31]); ROUND(a,b,c,d,e,f,g,h,w[32],k[32]); ROUND(h,a,b,c,d,e,f,g,w[33],k[33]); ROUND(g,h,a,b,c,d,e,f,w[34],k[34]); ROUND(f,g,h,a,b,c,d,e,w[35],k[35]); ROUND(e,f,g,h,a,b,c,d,w[36],k[36]); ROUND(d,e,f,g,h,a,b,c,w[37],k[37]); ROUND(c,d,e,f,g,h,a,b,w[38],k[38]); ROUND(b,c,d,e,f,g,h,a,w[39],k[39]); ROUND(a,b,c,d,e,f,g,h,w[40],k[40]); ROUND(h,a,b,c,d,e,f,g,w[41],k[41]); ROUND(g,h,a,b,c,d,e,f,w[42],k[42]); ROUND(f,g,h,a,b,c,d,e,w[43],k[43]); ROUND(e,f,g,h,a,b,c,d,w[44],k[44]); ROUND(d,e,f,g,h,a,b,c,w[45],k[45]); ROUND(c,d,e,f,g,h,a,b,w[46],k[46]); ROUND(b,c,d,e,f,g,h,a,w[47],k[47]); ROUND(a,b,c,d,e,f,g,h,w[48],k[48]); ROUND(h,a,b,c,d,e,f,g,w[49],k[49]); ROUND(g,h,a,b,c,d,e,f,w[50],k[50]); ROUND(f,g,h,a,b,c,d,e,w[51],k[51]); ROUND(e,f,g,h,a,b,c,d,w[52],k[52]); ROUND(d,e,f,g,h,a,b,c,w[53],k[53]); ROUND(c,d,e,f,g,h,a,b,w[54],k[54]); ROUND(b,c,d,e,f,g,h,a,w[55],k[55]); ROUND(a,b,c,d,e,f,g,h,w[56],k[56]); ROUND(h,a,b,c,d,e,f,g,w[57],k[57]); ROUND(g,h,a,b,c,d,e,f,w[58],k[58]); ROUND(f,g,h,a,b,c,d,e,w[59],k[59]); ROUND(e,f,g,h,a,b,c,d,w[60],k[60]); ROUND(d,e,f,g,h,a,b,c,w[61],k[61]); ROUND(c,d,e,f,g,h,a,b,w[62],k[62]); ROUND(b,c,d,e,f,g,h,a,w[63],k[63]); ROUND(a,b,c,d,e,f,g,h,w[64],k[64]); ROUND(h,a,b,c,d,e,f,g,w[65],k[65]); ROUND(g,h,a,b,c,d,e,f,w[66],k[66]); ROUND(f,g,h,a,b,c,d,e,w[67],k[67]); ROUND(e,f,g,h,a,b,c,d,w[68],k[68]); ROUND(d,e,f,g,h,a,b,c,w[69],k[69]); ROUND(c,d,e,f,g,h,a,b,w[70],k[70]); ROUND(b,c,d,e,f,g,h,a,w[71],k[71]); ROUND(a,b,c,d,e,f,g,h,w[72],k[72]); ROUND(h,a,b,c,d,e,f,g,w[73],k[73]); ROUND(g,h,a,b,c,d,e,f,w[74],k[74]); ROUND(f,g,h,a,b,c,d,e,w[75],k[75]); ROUND(e,f,g,h,a,b,c,d,w[76],k[76]); ROUND(d,e,f,g,h,a,b,c,w[77],k[77]); ROUND(c,d,e,f,g,h,a,b,w[78],k[78]); ROUND(b,c,d,e,f,g,h,a,w[79],k[79]); #ifdef OPTIMIZE_SSE2 w = (__m64*) sp->h; w[0] = _mm_add_si64(w[0], a); w[1] = _mm_add_si64(w[1], b); w[2] = _mm_add_si64(w[2], c); w[3] = _mm_add_si64(w[3], d); w[4] = _mm_add_si64(w[4], e); w[5] = _mm_add_si64(w[5], f); w[6] = _mm_add_si64(w[6], g); w[7] = _mm_add_si64(w[7], h); _mm_empty(); #else sp->h[0] += a; sp->h[1] += b; sp->h[2] += c; sp->h[3] += d; sp->h[4] += e; sp->h[5] += f; sp->h[6] += g; sp->h[7] += h; #endif } #endif int sha512Update(register sha512Param* sp, const byte* data, size_t size) { register size_t proclength; #if (MP_WBITS == 64) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); mpadd(2, sp->length, add); #elif (MP_WBITS == 32) mpw add[4]; mpsetws(4, add, size); mplshift(4, add, 3); mpadd(4, sp->length, add); #else # error #endif while (size > 0) { proclength = ((sp->offset + size) > 128U) ? (128U - sp->offset) : size; memcpy(((byte *) sp->data) + sp->offset, data, proclength); size -= proclength; data += proclength; sp->offset += proclength; if (sp->offset == 128U) { sha512Process(sp); sp->offset = 0; } } return 0; } static void sha512Finish(register sha512Param* sp) { register byte *ptr = ((byte *) sp->data) + sp->offset++; *(ptr++) = 0x80; if (sp->offset > 112) { while (sp->offset++ < 128) *(ptr++) = 0; sha512Process(sp); sp->offset = 0; } ptr = ((byte *) sp->data) + sp->offset; while (sp->offset++ < 112) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[ 0] = (byte)(sp->length[0] >> 56); ptr[ 1] = (byte)(sp->length[0] >> 48); ptr[ 2] = (byte)(sp->length[0] >> 40); ptr[ 3] = (byte)(sp->length[0] >> 32); ptr[ 4] = (byte)(sp->length[0] >> 24); ptr[ 5] = (byte)(sp->length[0] >> 16); ptr[ 6] = (byte)(sp->length[0] >> 8); ptr[ 7] = (byte)(sp->length[0] ); ptr[ 8] = (byte)(sp->length[1] >> 56); ptr[ 9] = (byte)(sp->length[1] >> 48); ptr[10] = (byte)(sp->length[1] >> 40); ptr[11] = (byte)(sp->length[1] >> 32); ptr[12] = (byte)(sp->length[1] >> 24); ptr[13] = (byte)(sp->length[1] >> 16); ptr[14] = (byte)(sp->length[1] >> 8); ptr[15] = (byte)(sp->length[1] ); #elif (MP_WBITS == 32) ptr[ 0] = (byte)(sp->length[0] >> 24); ptr[ 1] = (byte)(sp->length[0] >> 16); ptr[ 2] = (byte)(sp->length[0] >> 8); ptr[ 3] = (byte)(sp->length[0] ); ptr[ 4] = (byte)(sp->length[1] >> 24); ptr[ 5] = (byte)(sp->length[1] >> 16); ptr[ 6] = (byte)(sp->length[1] >> 8); ptr[ 7] = (byte)(sp->length[1] ); ptr[ 8] = (byte)(sp->length[2] >> 24); ptr[ 9] = (byte)(sp->length[2] >> 16); ptr[10] = (byte)(sp->length[2] >> 8); ptr[11] = (byte)(sp->length[2] ); ptr[12] = (byte)(sp->length[3] >> 24); ptr[13] = (byte)(sp->length[3] >> 16); ptr[14] = (byte)(sp->length[3] >> 8); ptr[15] = (byte)(sp->length[3] ); #else # error #endif sha512Process(sp); sp->offset = 0; } int sha512Digest(register sha512Param* sp, byte* data) { sha512Finish(sp); /* encode 8 integers big-endian style */ data[ 0] = (byte)(sp->h[0] >> 56); data[ 1] = (byte)(sp->h[0] >> 48); data[ 2] = (byte)(sp->h[0] >> 40); data[ 3] = (byte)(sp->h[0] >> 32); data[ 4] = (byte)(sp->h[0] >> 24); data[ 5] = (byte)(sp->h[0] >> 16); data[ 6] = (byte)(sp->h[0] >> 8); data[ 7] = (byte)(sp->h[0] >> 0); data[ 8] = (byte)(sp->h[1] >> 56); data[ 9] = (byte)(sp->h[1] >> 48); data[10] = (byte)(sp->h[1] >> 40); data[11] = (byte)(sp->h[1] >> 32); data[12] = (byte)(sp->h[1] >> 24); data[13] = (byte)(sp->h[1] >> 16); data[14] = (byte)(sp->h[1] >> 8); data[15] = (byte)(sp->h[1] >> 0); data[16] = (byte)(sp->h[2] >> 56); data[17] = (byte)(sp->h[2] >> 48); data[18] = (byte)(sp->h[2] >> 40); data[19] = (byte)(sp->h[2] >> 32); data[20] = (byte)(sp->h[2] >> 24); data[21] = (byte)(sp->h[2] >> 16); data[22] = (byte)(sp->h[2] >> 8); data[23] = (byte)(sp->h[2] >> 0); data[24] = (byte)(sp->h[3] >> 56); data[25] = (byte)(sp->h[3] >> 48); data[26] = (byte)(sp->h[3] >> 40); data[27] = (byte)(sp->h[3] >> 32); data[28] = (byte)(sp->h[3] >> 24); data[29] = (byte)(sp->h[3] >> 16); data[30] = (byte)(sp->h[3] >> 8); data[31] = (byte)(sp->h[3] >> 0); data[32] = (byte)(sp->h[4] >> 56); data[33] = (byte)(sp->h[4] >> 48); data[34] = (byte)(sp->h[4] >> 40); data[35] = (byte)(sp->h[4] >> 32); data[36] = (byte)(sp->h[4] >> 24); data[37] = (byte)(sp->h[4] >> 16); data[38] = (byte)(sp->h[4] >> 8); data[39] = (byte)(sp->h[4] >> 0); data[40] = (byte)(sp->h[5] >> 56); data[41] = (byte)(sp->h[5] >> 48); data[42] = (byte)(sp->h[5] >> 40); data[43] = (byte)(sp->h[5] >> 32); data[44] = (byte)(sp->h[5] >> 24); data[45] = (byte)(sp->h[5] >> 16); data[46] = (byte)(sp->h[5] >> 8); data[47] = (byte)(sp->h[5] >> 0); data[48] = (byte)(sp->h[6] >> 56); data[49] = (byte)(sp->h[6] >> 48); data[50] = (byte)(sp->h[6] >> 40); data[51] = (byte)(sp->h[6] >> 32); data[52] = (byte)(sp->h[6] >> 24); data[53] = (byte)(sp->h[6] >> 16); data[54] = (byte)(sp->h[6] >> 8); data[55] = (byte)(sp->h[6] >> 0); data[56] = (byte)(sp->h[7] >> 56); data[57] = (byte)(sp->h[7] >> 48); data[58] = (byte)(sp->h[7] >> 40); data[59] = (byte)(sp->h[7] >> 32); data[60] = (byte)(sp->h[7] >> 24); data[61] = (byte)(sp->h[7] >> 16); data[62] = (byte)(sp->h[7] >> 8); data[63] = (byte)(sp->h[7] >> 0); sha512Reset(sp); return 0; } /*!\} */ beecrypt-4.2.1/config.h.in0000644000175000001440000002154211226307267012305 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if you are using AIX */ #undef AIX /* Define to 1 if you want to include the C++ code */ #undef CPPGLUE /* Define to 1 if you are using Cygwin */ #undef CYGWIN /* Define to 1 if you are using Darwin/MacOS X */ #undef DARWIN /* Define to 1 if you want to enable asynchronous I/O support */ #undef ENABLE_AIO /* Define to 1 if you want to enable multithread support */ #undef ENABLE_THREADS /* Define to 1 if you want to enable thread-local-storage support */ #undef ENABLE_THREAD_LOCAL_STORAGE /* Define to 1 if you are using FreeBSD */ #undef FREEBSD /* Define to 1 if you have the header file. */ #undef HAVE_AIO_H /* Define to 1 if you have the header file. */ #undef HAVE_ASM_BYTEORDER_H /* Define to 1 if you have the header file. */ #undef HAVE_ASSERT_H /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H /* Define to 1 if your system has device /dev/audio */ #undef HAVE_DEV_AUDIO /* Define to 1 if your system has device /dev/dsp */ #undef HAVE_DEV_DSP /* Define to 1 if your system has device /dev/random */ #undef HAVE_DEV_RANDOM /* Define to 1 if your system has device /dev/tty */ #undef HAVE_DEV_TTY /* Define to 1 if your system has device /dev/urandom */ #undef HAVE_DEV_URANDOM /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_ENDIAN_H /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `gethrtime' function. */ #undef HAVE_GETHRTIME /* . */ #undef HAVE_GETTIMEOFDAY /* . */ #undef HAVE_INLINE /* */ #undef HAVE_INT64_T /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `mtmalloc' library (-lmtmalloc). */ #undef HAVE_LIBMTMALLOC /* Define to 1 if you have the `winmm' library (-lwinmm). */ #undef HAVE_LIBWINMM /* */ #undef HAVE_LONG_LONG /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if you have the `memcmp' function. */ #undef HAVE_MEMCMP /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the header file. */ #undef HAVE_MTMALLOC_H /* Define to 1 if you have the `nanosleep' function. */ #undef HAVE_NANOSLEEP /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the header file. */ #undef HAVE_SCHED_H /* Define to 1 if you have the header file. */ #undef HAVE_SEMAPHORE_H /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcspn' function. */ #undef HAVE_STRCSPN /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strspn' function. */ #undef HAVE_STRSPN /* Define to 1 if you have the header file. */ #undef HAVE_SYNCH_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AUDIOIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_ENDIAN_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MMAN_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOUNDCARD_H /* . */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* . */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H /* Define to 1 if you have the header file. */ #undef HAVE_THREAD_H /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* */ #undef HAVE_UINT64_T /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* */ #undef HAVE_UNSIGNED_LONG_LONG /* Define to 1 if you are using HPUX */ #undef HPUX /* Define to 1 if you want to include the Java code */ #undef JAVAGLUE /* Define to 1 if you are using GNU/Linux */ #undef LINUX /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if you are using MinGW */ #undef MINGW /* Define to 1 if you are using NetBSD */ #undef NETBSD /* Define to 1 if you are using OpenBSD */ #undef OPENBSD /* Define to 1 if you are using OSF */ #undef OSF /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you want to include the Python code */ #undef PYTHONGLUE /* Define to 1 if you are using QNX */ #undef QNX /* Define to 1 if you are using SCO Unix */ #undef SCO_UNIX /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* The size of `signed char', as computed by sizeof. */ #undef SIZEOF_SIGNED_CHAR /* The size of `size_t', as computed by sizeof. */ #undef SIZEOF_SIZE_T /* The size of `unsigned char', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_CHAR /* The size of `unsigned int', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_INT /* The size of `unsigned long', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_LONG /* The size of `unsigned long long', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_LONG_LONG /* The size of `unsigned short', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_SHORT /* Define to 1 if you are using Solaris */ #undef SOLARIS /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION #ifndef WIN32 #undef WIN32 #endif /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `unsigned int' if does not define. */ #undef size_t #if ENABLE_THREADS # ifndef _REENTRANT # define _REENTRANT # endif # if LINUX # define _LIBC_REENTRANT # endif #else # ifdef _REENTRANT # undef _REENTRANT # endif #endif #if !ENABLE_THREAD_LOCAL_STORAGE # define __thread #endif beecrypt-4.2.1/include/0000777000175000001440000000000011226307271011760 500000000000000beecrypt-4.2.1/include/Makefile.in0000644000175000001440000012047311226307162013747 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @WITH_CPLUSPLUS_TRUE@am__append_1 = \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/array.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/mutex.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/AnyEncodedKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/BeeCertificate.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/BeeCertPath.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/BeeCertPathParameters.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/BeeCertPathValidatorResult.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/BeeEncodedKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/BeeInputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/BeeOutputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/DHIESDecryptParameterSpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/DHIESParameterSpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/beeyond/PKCS12PBEKey.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/BadPaddingException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/Cipher.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/CipherSpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/IllegalBlockSizeException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/KeyAgreement.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/KeyAgreementSpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/Mac.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/MacInputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/MacOutputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/MacSpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/NoSuchPaddingException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/NullCipher.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/SecretKeyFactory.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/SecretKeyFactorySpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/SecretKey.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/interfaces/DHKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/interfaces/DHParams.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/interfaces/DHPrivateKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/interfaces/DHPublicKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/interfaces/PBEKey.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/spec/DHParameterSpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/spec/DHPrivateKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/spec/DHPublicKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/spec/IvParameterSpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/spec/PBEKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/crypto/spec/SecretKeySpec.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/ByteArrayInputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/ByteArrayOutputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/Closeable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/DataInput.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/DataInputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/DataOutput.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/DataOutputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/EOFException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/FileInputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/FileOutputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/FilterInputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/FilterOutputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/Flushable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/InputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/IOException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/OutputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/PrintStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/PushbackInputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/io/Writer.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Appendable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/ArithmeticException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Character.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/CharSequence.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/ClassCastException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Cloneable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/CloneNotSupportedException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Comparable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Error.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Exception.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/IllegalArgumentException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/IllegalMonitorStateException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/IllegalStateException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/IllegalThreadStateException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/IndexOutOfBoundsException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Integer.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/InterruptedException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Long.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/NullPointerException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Number.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/NumberFormatException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Object.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/OutOfMemoryError.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Runnable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/RuntimeException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/StringBuffer.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/StringBuilder.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/String.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/System.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Thread.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/Throwable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/lang/UnsupportedOperationException.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/math/BigInteger.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/nio/Buffer.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/nio/ByteBuffer.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/nio/ByteOrder.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/nio/InvalidMarkException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/nio/ReadOnlyBufferException.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/AlgorithmParameterGenerator.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/AlgorithmParameterGeneratorSpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/AlgorithmParameters.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/AlgorithmParametersSpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/DigestInputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/DigestOutputStream.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/GeneralSecurityException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/InvalidAlgorithmParameterException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/InvalidKeyException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/InvalidParameterException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/KeyException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/KeyFactory.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/KeyFactorySpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/Key.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/KeyPairGenerator.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/KeyPairGeneratorSpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/KeyPair.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/KeyStoreException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/KeyStore.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/KeyStoreSpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/MessageDigest.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/MessageDigestSpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/NoSuchAlgorithmException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/NoSuchProviderException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/PrivateKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/ProviderException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/Provider.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/PublicKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/SecureRandom.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/SecureRandomSpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/Security.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/ShortBufferException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/SignatureException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/Signature.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/SignatureSpi.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/auth/Destroyable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/auth/DestroyFailedException.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertificateEncodingException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertificateException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertificateExpiredException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertificateFactory.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertificateFactorySpi.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/Certificate.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertificateNotYetValidException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertPath.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertPathParameters.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertPathValidatorException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertPathValidator.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertPathValidatorResult.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/cert/CertPathValidatorSpi.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/DSAKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/DSAParams.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/DSAPrivateKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/DSAPublicKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/ECKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/ECPrivateKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/ECPublicKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/RSAKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/RSAPrivateCrtKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/RSAPrivateKey.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/interfaces/RSAPublicKey.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/AlgorithmParameterSpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/DSAParameterSpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/DSAPrivateKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/DSAPublicKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/EncodedKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/InvalidKeySpecException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/InvalidParameterSpecException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/KeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/RSAKeyGenParameterSpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/RSAPrivateCrtKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/RSAPrivateKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/spec/RSAPublicKeySpec.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/security/UnrecoverableKeyException.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/AbstractCollection.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/AbstractList.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/AbstractMap.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/AbstractSet.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/ArrayList.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Collection.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/ConcurrentModificationException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Date.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Enumeration.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Hashtable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Iterable.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Iterator.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/List.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/ListIterator.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Map.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/NoSuchElementException.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Properties.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Queue.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/RandomAccess.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/Set.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/concurrent/Callable.h \ @WITH_CPLUSPLUS_TRUE@\ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/concurrent/locks/Condition.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/concurrent/locks/Lock.h \ @WITH_CPLUSPLUS_TRUE@beecrypt/c++/util/concurrent/locks/ReentrantLock.h subdir = include DIST_COMMON = $(am__nobase_include_HEADERS_DIST) $(noinst_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__nobase_include_HEADERS_DIST = beecrypt/aes.h beecrypt/aesopt.h \ beecrypt/api.h beecrypt/base64.h beecrypt/beecrypt.h \ beecrypt/blockmode.h beecrypt/blockpad.h beecrypt/blowfish.h \ beecrypt/blowfishopt.h beecrypt/dhies.h beecrypt/dldp.h \ beecrypt/dlkp.h beecrypt/dlpk.h beecrypt/dlsvdp-dh.h \ beecrypt/dsa.h beecrypt/elgamal.h beecrypt/endianness.h \ beecrypt/entropy.h beecrypt/fips186.h beecrypt/gnu.h \ beecrypt/hmac.h beecrypt/hmacmd5.h beecrypt/hmacsha1.h \ beecrypt/hmacsha224.h beecrypt/hmacsha256.h \ beecrypt/hmacsha384.h beecrypt/hmacsha512.h beecrypt/md4.h \ beecrypt/md5.h beecrypt/memchunk.h beecrypt/mpbarrett.h \ beecrypt/mp.h beecrypt/mpnumber.h beecrypt/mpopt.h \ beecrypt/mpprime.h beecrypt/mtprng.h beecrypt/pkcs12.h \ beecrypt/pkcs1.h beecrypt/ripemd128.h beecrypt/ripemd160.h \ beecrypt/ripemd256.h beecrypt/ripemd320.h beecrypt/rsa.h \ beecrypt/rsakp.h beecrypt/rsapk.h beecrypt/sha1.h \ beecrypt/sha1opt.h beecrypt/sha224.h beecrypt/sha256.h \ beecrypt/sha384.h beecrypt/sha512.h beecrypt/sha2k32.h \ beecrypt/sha2k64.h beecrypt/timestamp.h beecrypt/win.h \ beecrypt/c++/array.h beecrypt/c++/mutex.h \ beecrypt/c++/beeyond/AnyEncodedKeySpec.h \ beecrypt/c++/beeyond/BeeCertificate.h \ beecrypt/c++/beeyond/BeeCertPath.h \ beecrypt/c++/beeyond/BeeCertPathParameters.h \ beecrypt/c++/beeyond/BeeCertPathValidatorResult.h \ beecrypt/c++/beeyond/BeeEncodedKeySpec.h \ beecrypt/c++/beeyond/BeeInputStream.h \ beecrypt/c++/beeyond/BeeOutputStream.h \ beecrypt/c++/beeyond/DHIESDecryptParameterSpec.h \ beecrypt/c++/beeyond/DHIESParameterSpec.h \ beecrypt/c++/beeyond/PKCS12PBEKey.h \ beecrypt/c++/crypto/BadPaddingException.h \ beecrypt/c++/crypto/Cipher.h beecrypt/c++/crypto/CipherSpi.h \ beecrypt/c++/crypto/IllegalBlockSizeException.h \ beecrypt/c++/crypto/KeyAgreement.h \ beecrypt/c++/crypto/KeyAgreementSpi.h \ beecrypt/c++/crypto/Mac.h beecrypt/c++/crypto/MacInputStream.h \ beecrypt/c++/crypto/MacOutputStream.h \ beecrypt/c++/crypto/MacSpi.h \ beecrypt/c++/crypto/NoSuchPaddingException.h \ beecrypt/c++/crypto/NullCipher.h \ beecrypt/c++/crypto/SecretKeyFactory.h \ beecrypt/c++/crypto/SecretKeyFactorySpi.h \ beecrypt/c++/crypto/SecretKey.h \ beecrypt/c++/crypto/interfaces/DHKey.h \ beecrypt/c++/crypto/interfaces/DHParams.h \ beecrypt/c++/crypto/interfaces/DHPrivateKey.h \ beecrypt/c++/crypto/interfaces/DHPublicKey.h \ beecrypt/c++/crypto/interfaces/PBEKey.h \ beecrypt/c++/crypto/spec/DHParameterSpec.h \ beecrypt/c++/crypto/spec/DHPrivateKeySpec.h \ beecrypt/c++/crypto/spec/DHPublicKeySpec.h \ beecrypt/c++/crypto/spec/IvParameterSpec.h \ beecrypt/c++/crypto/spec/PBEKeySpec.h \ beecrypt/c++/crypto/spec/SecretKeySpec.h \ beecrypt/c++/io/ByteArrayInputStream.h \ beecrypt/c++/io/ByteArrayOutputStream.h \ beecrypt/c++/io/Closeable.h beecrypt/c++/io/DataInput.h \ beecrypt/c++/io/DataInputStream.h beecrypt/c++/io/DataOutput.h \ beecrypt/c++/io/DataOutputStream.h \ beecrypt/c++/io/EOFException.h \ beecrypt/c++/io/FileInputStream.h \ beecrypt/c++/io/FileOutputStream.h \ beecrypt/c++/io/FilterInputStream.h \ beecrypt/c++/io/FilterOutputStream.h \ beecrypt/c++/io/Flushable.h beecrypt/c++/io/InputStream.h \ beecrypt/c++/io/IOException.h beecrypt/c++/io/OutputStream.h \ beecrypt/c++/io/PrintStream.h \ beecrypt/c++/io/PushbackInputStream.h beecrypt/c++/io/Writer.h \ beecrypt/c++/lang/Appendable.h \ beecrypt/c++/lang/ArithmeticException.h \ beecrypt/c++/lang/Character.h beecrypt/c++/lang/CharSequence.h \ beecrypt/c++/lang/ClassCastException.h \ beecrypt/c++/lang/Cloneable.h \ beecrypt/c++/lang/CloneNotSupportedException.h \ beecrypt/c++/lang/Comparable.h beecrypt/c++/lang/Error.h \ beecrypt/c++/lang/Exception.h \ beecrypt/c++/lang/IllegalArgumentException.h \ beecrypt/c++/lang/IllegalMonitorStateException.h \ beecrypt/c++/lang/IllegalStateException.h \ beecrypt/c++/lang/IllegalThreadStateException.h \ beecrypt/c++/lang/IndexOutOfBoundsException.h \ beecrypt/c++/lang/Integer.h \ beecrypt/c++/lang/InterruptedException.h \ beecrypt/c++/lang/Long.h \ beecrypt/c++/lang/NullPointerException.h \ beecrypt/c++/lang/Number.h \ beecrypt/c++/lang/NumberFormatException.h \ beecrypt/c++/lang/Object.h \ beecrypt/c++/lang/OutOfMemoryError.h \ beecrypt/c++/lang/Runnable.h \ beecrypt/c++/lang/RuntimeException.h \ beecrypt/c++/lang/StringBuffer.h \ beecrypt/c++/lang/StringBuilder.h beecrypt/c++/lang/String.h \ beecrypt/c++/lang/System.h beecrypt/c++/lang/Thread.h \ beecrypt/c++/lang/Throwable.h \ beecrypt/c++/lang/UnsupportedOperationException.h \ beecrypt/c++/math/BigInteger.h beecrypt/c++/nio/Buffer.h \ beecrypt/c++/nio/ByteBuffer.h beecrypt/c++/nio/ByteOrder.h \ beecrypt/c++/nio/InvalidMarkException.h \ beecrypt/c++/nio/ReadOnlyBufferException.h \ beecrypt/c++/security/AlgorithmParameterGenerator.h \ beecrypt/c++/security/AlgorithmParameterGeneratorSpi.h \ beecrypt/c++/security/AlgorithmParameters.h \ beecrypt/c++/security/AlgorithmParametersSpi.h \ beecrypt/c++/security/DigestInputStream.h \ beecrypt/c++/security/DigestOutputStream.h \ beecrypt/c++/security/GeneralSecurityException.h \ beecrypt/c++/security/InvalidAlgorithmParameterException.h \ beecrypt/c++/security/InvalidKeyException.h \ beecrypt/c++/security/InvalidParameterException.h \ beecrypt/c++/security/KeyException.h \ beecrypt/c++/security/KeyFactory.h \ beecrypt/c++/security/KeyFactorySpi.h \ beecrypt/c++/security/Key.h \ beecrypt/c++/security/KeyPairGenerator.h \ beecrypt/c++/security/KeyPairGeneratorSpi.h \ beecrypt/c++/security/KeyPair.h \ beecrypt/c++/security/KeyStoreException.h \ beecrypt/c++/security/KeyStore.h \ beecrypt/c++/security/KeyStoreSpi.h \ beecrypt/c++/security/MessageDigest.h \ beecrypt/c++/security/MessageDigestSpi.h \ beecrypt/c++/security/NoSuchAlgorithmException.h \ beecrypt/c++/security/NoSuchProviderException.h \ beecrypt/c++/security/PrivateKey.h \ beecrypt/c++/security/ProviderException.h \ beecrypt/c++/security/Provider.h \ beecrypt/c++/security/PublicKey.h \ beecrypt/c++/security/SecureRandom.h \ beecrypt/c++/security/SecureRandomSpi.h \ beecrypt/c++/security/Security.h \ beecrypt/c++/security/ShortBufferException.h \ beecrypt/c++/security/SignatureException.h \ beecrypt/c++/security/Signature.h \ beecrypt/c++/security/SignatureSpi.h \ beecrypt/c++/security/auth/Destroyable.h \ beecrypt/c++/security/auth/DestroyFailedException.h \ beecrypt/c++/security/cert/CertificateEncodingException.h \ beecrypt/c++/security/cert/CertificateException.h \ beecrypt/c++/security/cert/CertificateExpiredException.h \ beecrypt/c++/security/cert/CertificateFactory.h \ beecrypt/c++/security/cert/CertificateFactorySpi.h \ beecrypt/c++/security/cert/Certificate.h \ beecrypt/c++/security/cert/CertificateNotYetValidException.h \ beecrypt/c++/security/cert/CertPath.h \ beecrypt/c++/security/cert/CertPathParameters.h \ beecrypt/c++/security/cert/CertPathValidatorException.h \ beecrypt/c++/security/cert/CertPathValidator.h \ beecrypt/c++/security/cert/CertPathValidatorResult.h \ beecrypt/c++/security/cert/CertPathValidatorSpi.h \ beecrypt/c++/security/interfaces/DSAKey.h \ beecrypt/c++/security/interfaces/DSAParams.h \ beecrypt/c++/security/interfaces/DSAPrivateKey.h \ beecrypt/c++/security/interfaces/DSAPublicKey.h \ beecrypt/c++/security/interfaces/ECKey.h \ beecrypt/c++/security/interfaces/ECPrivateKey.h \ beecrypt/c++/security/interfaces/ECPublicKey.h \ beecrypt/c++/security/interfaces/RSAKey.h \ beecrypt/c++/security/interfaces/RSAPrivateCrtKey.h \ beecrypt/c++/security/interfaces/RSAPrivateKey.h \ beecrypt/c++/security/interfaces/RSAPublicKey.h \ beecrypt/c++/security/spec/AlgorithmParameterSpec.h \ beecrypt/c++/security/spec/DSAParameterSpec.h \ beecrypt/c++/security/spec/DSAPrivateKeySpec.h \ beecrypt/c++/security/spec/DSAPublicKeySpec.h \ beecrypt/c++/security/spec/EncodedKeySpec.h \ beecrypt/c++/security/spec/InvalidKeySpecException.h \ beecrypt/c++/security/spec/InvalidParameterSpecException.h \ beecrypt/c++/security/spec/KeySpec.h \ beecrypt/c++/security/spec/RSAKeyGenParameterSpec.h \ beecrypt/c++/security/spec/RSAPrivateCrtKeySpec.h \ beecrypt/c++/security/spec/RSAPrivateKeySpec.h \ beecrypt/c++/security/spec/RSAPublicKeySpec.h \ beecrypt/c++/security/UnrecoverableKeyException.h \ beecrypt/c++/util/AbstractCollection.h \ beecrypt/c++/util/AbstractList.h \ beecrypt/c++/util/AbstractMap.h \ beecrypt/c++/util/AbstractSet.h beecrypt/c++/util/ArrayList.h \ beecrypt/c++/util/Collection.h \ beecrypt/c++/util/ConcurrentModificationException.h \ beecrypt/c++/util/Date.h beecrypt/c++/util/Enumeration.h \ beecrypt/c++/util/Hashtable.h beecrypt/c++/util/Iterable.h \ beecrypt/c++/util/Iterator.h beecrypt/c++/util/List.h \ beecrypt/c++/util/ListIterator.h beecrypt/c++/util/Map.h \ beecrypt/c++/util/NoSuchElementException.h \ beecrypt/c++/util/Properties.h beecrypt/c++/util/Queue.h \ beecrypt/c++/util/RandomAccess.h beecrypt/c++/util/Set.h \ beecrypt/c++/util/concurrent/Callable.h \ beecrypt/c++/util/concurrent/locks/Condition.h \ beecrypt/c++/util/concurrent/locks/Lock.h \ beecrypt/c++/util/concurrent/locks/ReentrantLock.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(nobase_include_HEADERS) $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ nobase_include_HEADERS = beecrypt/aes.h beecrypt/aesopt.h \ beecrypt/api.h beecrypt/base64.h beecrypt/beecrypt.h \ beecrypt/blockmode.h beecrypt/blockpad.h beecrypt/blowfish.h \ beecrypt/blowfishopt.h beecrypt/dhies.h beecrypt/dldp.h \ beecrypt/dlkp.h beecrypt/dlpk.h beecrypt/dlsvdp-dh.h \ beecrypt/dsa.h beecrypt/elgamal.h beecrypt/endianness.h \ beecrypt/entropy.h beecrypt/fips186.h beecrypt/gnu.h \ beecrypt/hmac.h beecrypt/hmacmd5.h beecrypt/hmacsha1.h \ beecrypt/hmacsha224.h beecrypt/hmacsha256.h \ beecrypt/hmacsha384.h beecrypt/hmacsha512.h beecrypt/md4.h \ beecrypt/md5.h beecrypt/memchunk.h beecrypt/mpbarrett.h \ beecrypt/mp.h beecrypt/mpnumber.h beecrypt/mpopt.h \ beecrypt/mpprime.h beecrypt/mtprng.h beecrypt/pkcs12.h \ beecrypt/pkcs1.h beecrypt/ripemd128.h beecrypt/ripemd160.h \ beecrypt/ripemd256.h beecrypt/ripemd320.h beecrypt/rsa.h \ beecrypt/rsakp.h beecrypt/rsapk.h beecrypt/sha1.h \ beecrypt/sha1opt.h beecrypt/sha224.h beecrypt/sha256.h \ beecrypt/sha384.h beecrypt/sha512.h beecrypt/sha2k32.h \ beecrypt/sha2k64.h beecrypt/timestamp.h beecrypt/win.h \ $(am__append_1) noinst_HEADERS = \ beecrypt/aes_be.h \ beecrypt/aes_le.h \ \ beecrypt/c++/adapter.h \ beecrypt/c++/posix.h \ beecrypt/c++/resource.h \ \ beecrypt/c++/provider/AESCipher.h \ beecrypt/c++/provider/BaseProvider.h \ beecrypt/c++/provider/BeeCertificateFactory.h \ beecrypt/c++/provider/BeeCertPathValidator.h \ beecrypt/c++/provider/BeeKeyFactory.h \ beecrypt/c++/provider/BeeKeyStore.h \ beecrypt/c++/provider/BeeSecureRandom.h \ beecrypt/c++/provider/BlockCipher.h \ beecrypt/c++/provider/BlowfishCipher.h \ beecrypt/c++/provider/DHIESCipher.h \ beecrypt/c++/provider/DHIESParameters.h \ beecrypt/c++/provider/DHKeyAgreement.h \ beecrypt/c++/provider/DHKeyFactory.h \ beecrypt/c++/provider/DHKeyPairGenerator.h \ beecrypt/c++/provider/DHParameterGenerator.h \ beecrypt/c++/provider/DHParameters.h \ beecrypt/c++/provider/DHPrivateKeyImpl.h \ beecrypt/c++/provider/DHPublicKeyImpl.h \ beecrypt/c++/provider/DSAKeyFactory.h \ beecrypt/c++/provider/DSAKeyPairGenerator.h \ beecrypt/c++/provider/DSAParameterGenerator.h \ beecrypt/c++/provider/DSAParameters.h \ beecrypt/c++/provider/DSAPrivateKeyImpl.h \ beecrypt/c++/provider/DSAPublicKeyImpl.h \ beecrypt/c++/provider/HMAC.h \ beecrypt/c++/provider/HMACMD5.h \ beecrypt/c++/provider/HMACSHA1.h \ beecrypt/c++/provider/HMACSHA256.h \ beecrypt/c++/provider/HMACSHA384.h \ beecrypt/c++/provider/HMACSHA512.h \ beecrypt/c++/provider/KeyProtector.h \ beecrypt/c++/provider/MD5Digest.h \ beecrypt/c++/provider/MD5withRSASignature.h \ beecrypt/c++/provider/PKCS12KeyFactory.h \ beecrypt/c++/provider/PKCS1RSASignature.h \ beecrypt/c++/provider/RSAKeyFactory.h \ beecrypt/c++/provider/RSAKeyPairGenerator.h \ beecrypt/c++/provider/RSAPrivateCrtKeyImpl.h \ beecrypt/c++/provider/RSAPrivateKeyImpl.h \ beecrypt/c++/provider/RSAPublicKeyImpl.h \ beecrypt/c++/provider/SHA1Digest.h \ beecrypt/c++/provider/SHA1withDSASignature.h \ beecrypt/c++/provider/SHA1withRSASignature.h \ beecrypt/c++/provider/SHA256Digest.h \ beecrypt/c++/provider/SHA224Digest.h \ beecrypt/c++/provider/SHA256withRSASignature.h \ beecrypt/c++/provider/SHA384Digest.h \ beecrypt/c++/provider/SHA384withRSASignature.h \ beecrypt/c++/provider/SHA512Digest.h \ beecrypt/c++/provider/SHA512withRSASignature.h \ \ beecrypt/java/beecrypt_provider_AES.h \ beecrypt/java/beecrypt_provider_DHKeyPairGenerator.h \ beecrypt/java/beecrypt_provider_HMACMD5.h \ beecrypt/java/beecrypt_provider_HMACSHA1.h \ beecrypt/java/beecrypt_provider_HMACSHA256.h \ beecrypt/java/beecrypt_provider_HMACSHA384.h \ beecrypt/java/beecrypt_provider_HMACSHA512.h \ beecrypt/java/beecrypt_provider_MD4.h \ beecrypt/java/beecrypt_provider_MD5.h \ beecrypt/java/beecrypt_provider_RSAKeyPairGenerator.h \ beecrypt/java/beecrypt_provider_SHA1.h \ beecrypt/java/beecrypt_provider_SHA224.h \ beecrypt/java/beecrypt_provider_SHA256.h \ beecrypt/java/beecrypt_provider_SHA384.h \ beecrypt/java/beecrypt_provider_SHA512.h \ beecrypt/java/beecrypt_tools.h \ \ beecrypt/python \ beecrypt/python/mpw-py.h \ beecrypt/python/rng-py.h EXTRA_DIST = beecrypt/Doxyheader beecrypt/c++/Doxyheader all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nobase_includeHEADERS: $(nobase_include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ echo "$(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \ echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \ $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \ done uninstall-nobase_includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(includedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-nobase_includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nobase_includeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-nobase_includeHEADERS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-nobase_includeHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/include/beecrypt/0000777000175000001440000000000011226307271013575 500000000000000beecrypt-4.2.1/include/beecrypt/hmacsha224.h0000644000175000001440000000303311216102377015514 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha224.h * \brief HMAC-SHA-224 message authentication code, headers. * \author Bob Deblier * \ingroup HMAC_m HMAC_sha224_m */ #ifndef _HMACSHA224_H #define _HMACSHA224_H #include "beecrypt/hmac.h" #include "beecrypt/sha224.h" /*!\ingroup HMAC_sha224_m */ typedef struct { sha224Param sparam; byte kxi[64]; byte kxo[64]; } hmacsha224Param; #ifdef __cplusplus extern "C" { #endif extern BEECRYPTAPI const keyedHashFunction hmacsha224; BEECRYPTAPI int hmacsha224Setup (hmacsha224Param*, const byte*, size_t); BEECRYPTAPI int hmacsha224Reset (hmacsha224Param*); BEECRYPTAPI int hmacsha224Update(hmacsha224Param*, const byte*, size_t); BEECRYPTAPI int hmacsha224Digest(hmacsha224Param*, byte*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/dlsvdp-dh.h0000644000175000001440000000231411216651412015545 00000000000000/* * Copyright (c) 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dlsvdp-dh.h * \brief Diffie-Hellman algorithm, headers. * \author Bob Deblier * \ingroup DL_m DL_dh_m */ #ifndef _DLSVDP_DH_H #define _DLSVDP_DH_H #include "beecrypt/dlkp.h" #ifdef __cplusplus extern "C" { #endif typedef dldp_p dhparam; typedef dlkp_p dhkp; BEECRYPTAPI int dlsvdp_pDHSecret(const dhparam*, const mpnumber*, const mpnumber*, mpnumber*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/dlkp.h0000644000175000001440000000301611216147022014607 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dlkp.h * \brief Discrete Logarithm keypair, headers. * \author Bob Deblier * \ingroup DL_m */ #ifndef _DLKP_H #define _DLKP_H #include "beecrypt/dlpk.h" /*!\ingroup DL_m */ #ifdef __cplusplus struct BEECRYPTAPI dlkp_p #else struct _dlkp_p #endif { dldp_p param; mpnumber y; mpnumber x; #ifdef __cplusplus dlkp_p(); dlkp_p(const dlkp_p&); ~dlkp_p(); #endif }; #ifndef __cplusplus typedef struct _dlkp_p dlkp_p; #endif #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int dlkp_pPair(dlkp_p*, randomGeneratorContext*, const dldp_p*); BEECRYPTAPI int dlkp_pInit(dlkp_p*); BEECRYPTAPI int dlkp_pFree(dlkp_p*); BEECRYPTAPI int dlkp_pCopy(dlkp_p*, const dlkp_p*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/ripemd256.h0000644000175000001440000000623711223566203015406 00000000000000/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file ripemd256.h * \brief RIPEMD-256 hash function, headers. * \author Jeff Johnson * \author Bob Deblier * \ingroup HASH_m HASH_rmd256_m */ #ifndef _RIPEMD256_H #define _RIPEMD256_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the RIPEMD-128 algorithm. * \ingroup HASH_rmd256_m */ #ifdef __cplusplus struct BEECRYPTAPI ripemd256Param #else struct _ripemd256Param #endif { /*!\var h */ uint32_t h[8]; /*!\var data */ uint32_t data[16]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[1]; #elif (MP_WBITS == 32) mpw length[2]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint32_t offset; }; #ifndef __cplusplus typedef struct _ripemd256Param ripemd256Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var ripemd256 * \brief Holds the full API description of the RIPEMD-128 algorithm. */ extern BEECRYPTAPI const hashFunction ripemd256; /*!\fn void ripemd256Process(ripemd256Param* mp) * \brief This function performs the core of the RIPEMD-128 hash algorithm; it * processes a block of 64 bytes. * \param mp The hash function's parameter block. */ BEECRYPTAPI void ripemd256Process(ripemd256Param* mp); /*!\fn int ripemd256Reset(ripemd256Param* mp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param mp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int ripemd256Reset (ripemd256Param* mp); /*!\fn int ripemd256Update(ripemd256Param* mp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param mp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int ripemd256Update (ripemd256Param* mp, const byte* data, size_t size); /*!\fn int ripemd256Digest(ripemd256Param* mp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param mp The hash function's parameter block. * \param digest The place to store the 20-byte digest. * \retval 0 on success. */ BEECRYPTAPI int ripemd256Digest (ripemd256Param* mp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/sha1opt.h0000644000175000001440000000276411216147022015245 00000000000000/* * Copyright (c) 2000, 2003 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _SHA1OPT_H #define _SHA1OPT_H #include "beecrypt/beecrypt.h" #include "beecrypt/sha1.h" #ifdef __cplusplus extern "C" { #endif #if WIN32 # if defined(_MSC_VER) && defined(_M_IX86) # define ASM_SHA1PROCESS # elif __INTEL__ && __MWERKS__ # define ASM_SHA1PROCESS # endif #endif #if defined(__GNUC__) # if defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686) # define ASM_SHA1PROCESS # endif #endif #if defined(__INTEL_COMPILER) # if defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686) # define ASM_SHA1PROCESS # endif #endif #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) #endif #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/blowfish.h0000644000175000001440000000762711216147022015506 00000000000000/* * Copyright (c) 1999, 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file blowfish.h * \brief Blowfish block cipher. * * For more information on this blockcipher, see: * "Applied Cryptography", second edition * Bruce Schneier * Wiley & Sons * * Also see http://www.counterpane.com/blowfish.html * * \author Bob Deblier * \ingroup BC_m BC_blowfish_m */ #ifndef _BLOWFISH_H #define _BLOWFISH_H #include "beecrypt/beecrypt.h" #include "beecrypt/blowfishopt.h" #define BLOWFISHROUNDS 16 #define BLOWFISHPSIZE (BLOWFISHROUNDS+2) /*!\brief Holds all the parameters necessary for the Blowfish cipher. * \ingroup BC_blowfish_m */ #ifdef __cplusplus struct BEECRYPTAPI blowfishParam #else struct _blowfishParam #endif { /*!\var p * \brief Holds the key expansion. */ uint32_t p[BLOWFISHPSIZE]; /*!\var s * \brief Holds the s-boxes. */ uint32_t s[1024]; /*!\var fdback * \brief Buffer to be used by block chaining or feedback modes. */ uint32_t fdback[2]; }; #ifndef __cplusplus typedef struct _blowfishParam blowfishParam; #endif #ifdef __cplusplus extern "C" { #endif /*!\var blowfish * \brief Holds the full API description of the Blowfish algorithm. */ extern const BEECRYPTAPI blockCipher blowfish; /*!\fn int blowfishSetup(blowfishParam* bp, const byte* key, size_t keybits, cipherOperation op) * \brief The function performs the cipher's key expansion. * \param bp The cipher's parameter block. * \param key The key value. * \param keybits The number of bits in the key; legal values are: 32 to 448, * in multiples of 8. * \param op ENCRYPT or DECRYPT. * \retval 0 on success. * \retval -1 on failure. */ BEECRYPTAPI int blowfishSetup (blowfishParam*, const byte*, size_t, cipherOperation); /*!\fn int blowfishSetIV(blowfishParam* bp, const byte* iv) * \brief This function sets the Initialization Vector. * \note This function is only useful in block chaining or feedback modes. * \param bp The cipher's parameter block. * \param iv The initialization vector; may be null. * \retval 0 on success. */ BEECRYPTAPI int blowfishSetIV (blowfishParam*, const byte* iv); BEECRYPTAPI int blowfishSetCTR (blowfishParam*, const byte* nivz, size_t counter); /*!\fn blowfishEncrypt(blowfishParam* bp, uint32_t* dst, const uint32_t* src) * \brief This function performs the Blowfish encryption; it encrypts one block * of 64 bits. * \param bp The cipher's parameter block. * \param dst The ciphertext; should be aligned on 32-bit boundary. * \param src The cleartext; should be aligned on 32-bit boundary. * \retval 0 on success. */ BEECRYPTAPI int blowfishEncrypt (blowfishParam*, uint32_t*, const uint32_t*); /*!\fn blowfishDecrypt(blowfishParam* bp, uint32_t* dst, const uint32_t* src) * \brief This function performs the Blowfish decryption; it Rderypts one block * of 64 bits. * \param bp The cipher's parameter block. * \param dst The cleartext; should be aligned on 32-bit boundary. * \param src The ciphertext; should be aligned on 32-bit boundary. * \retval 0 on success. */ BEECRYPTAPI int blowfishDecrypt (blowfishParam*, uint32_t*, const uint32_t*); BEECRYPTAPI uint32_t* blowfishFeedback(blowfishParam*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/mpprime.h0000664000175000001440000000356210254472206015344 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mpprime.h * \brief Multi-precision primes, headers. * \author Bob Deblier * \ingroup MP_m */ #ifndef _MPPRIME_H #define _MPPRIME_H #include "beecrypt/mpbarrett.h" #define SMALL_PRIMES_PRODUCT_MAX 32 extern mpw* mpspprod[SMALL_PRIMES_PRODUCT_MAX]; #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int mpptrials (size_t); BEECRYPTAPI int mppmilrab_w (const mpbarrett*, randomGeneratorContext*, int, mpw*); BEECRYPTAPI int mpprnd_w (mpbarrett*, randomGeneratorContext*, size_t, int, const mpnumber*, mpw*); BEECRYPTAPI int mpprndr_w (mpbarrett*, randomGeneratorContext*, size_t, int, const mpnumber*, const mpnumber*, const mpnumber*, mpw*); BEECRYPTAPI void mpprndsafe_w (mpbarrett*, randomGeneratorContext*, size_t, int, mpw*); BEECRYPTAPI void mpprndcon_w (mpbarrett*, randomGeneratorContext*, size_t, int, const mpnumber*, const mpnumber*, const mpnumber*, mpnumber*, mpw*); BEECRYPTAPI void mpprndconone_w(mpbarrett*, randomGeneratorContext*, size_t, int, const mpbarrett*, const mpnumber*, mpnumber*, int, mpw*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/0000777000175000001440000000000011226307271014145 500000000000000beecrypt-4.2.1/include/beecrypt/c++/posix.h0000644000175000001440000000037711216641321015377 00000000000000static void posixErrorDetector(const int err, const char* message) throw (Error) { if (err) { errno = err; perror(message); throw Error(String(message) + String(": ") + String(strerror(err))); } } beecrypt-4.2.1/include/beecrypt/c++/lang/0000777000175000001440000000000011226307270015065 500000000000000beecrypt-4.2.1/include/beecrypt/c++/lang/Throwable.h0000644000175000001440000000320511216147023017076 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Throwable.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_THROWABLE_H #define _CLASS_BEE_LANG_THROWABLE_H #include "beecrypt/api.h" #ifdef __cplusplus namespace beecrypt { namespace lang { class String; /*!\brief This class is the superclass of all errors and exceptions * used by the BeeCrypt C++ API * \ingroup CXX_LANG_m */ class BEECRYPTCXXAPI Throwable { private: String* _msg; const Throwable* _cause; public: Throwable(); Throwable(const char* message); // Throwable(const String* message); Throwable(const String& message); Throwable(const String* message, const Throwable* cause); Throwable(const Throwable* cause); ~Throwable(); const String* getMessage() const throw (); const Throwable* getCause() const throw (); Throwable& initCause(const Throwable&); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/CloneNotSupportedException.h0000644000175000001440000000267411216147023022466 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CloneNotSupportedException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_CLONENOTSUPPORTEDEXCEPTION_H #define _CLASS_BEE_LANG_CLONENOTSUPPORTEDEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/Exception.h" using beecrypt::lang::Exception; namespace beecrypt { namespace lang { /* \ingroup CXX_LANG_m */ class CloneNotSupportedException : public Exception { public: inline CloneNotSupportedException() {} inline CloneNotSupportedException(const char* message) : Exception(message) {} inline CloneNotSupportedException(const String& message) : Exception(message) {} inline ~CloneNotSupportedException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/NumberFormatException.h0000644000175000001440000000313711216147023021433 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file NumberFormatException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_NUMBERFORMATEXCEPTION_H #define _CLASS_BEE_LANG_NUMBERFORMATEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/IllegalArgumentException.h" using beecrypt::lang::IllegalArgumentException; namespace beecrypt { namespace lang { /*!\brief Thrown to indicate that the conversion from a String to a * numeric value due to an inappropriate format. * \ingroup CXX_LANG_m */ class NumberFormatException : public IllegalArgumentException { public: inline NumberFormatException() {} inline NumberFormatException(const char* message) : IllegalArgumentException(message) {} inline NumberFormatException(const String& message) : IllegalArgumentException(message) {} inline ~NumberFormatException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/ArithmeticException.h0000644000175000001440000000264711216147023021130 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ArithmeticException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_ARITHMETICEXCEPTION_H #define _CLASS_BEE_LANG_ARITHMETICEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; namespace beecrypt { namespace lang { /* \ingroup CXX_LANG_m */ class ArithmeticException : public RuntimeException { public: inline ArithmeticException() {} inline ArithmeticException(const char* message) : RuntimeException(message) {} inline ArithmeticException(const String& message) : RuntimeException(message) {} inline ~ArithmeticException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Cloneable.h0000644000175000001440000000230111216147023017027 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Cloneable.h * \ingroup CXX_LANG_m */ #ifndef _INTERFACE_BEE_LANG_CLONEABLE_H #define _INTERFACE_BEE_LANG_CLONEABLE_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; namespace beecrypt { namespace lang { class BEECRYPTCXXAPI Cloneable { public: virtual ~Cloneable() {} virtual Object* clone() const throw (CloneNotSupportedException) = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Error.h0000644000175000001440000000263511216147023016246 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Error.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_ERROR_H #define _CLASS_BEE_LANG_ERROR_H #ifdef __cplusplus #include "beecrypt/c++/lang/Throwable.h" using beecrypt::lang::Throwable; namespace beecrypt { namespace lang { /*!\brief This subclass of Throwable is used to indicate a serious * problem, which should not be caught by the application. * \ingroup CXX_LANG_m */ class Error : public Throwable { public: inline Error() {} inline Error(const char* message) : Throwable(message) {} inline Error(const String& message) : Throwable(message) {} inline ~Error() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Integer.h0000644000175000001440000000415711216147023016553 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Integer.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_INTEGER_H #define _CLASS_BEE_LANG_INTEGER_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/lang/Number.h" using beecrypt::lang::Number; #include "beecrypt/c++/lang/NumberFormatException.h" using beecrypt::lang::NumberFormatException; namespace beecrypt { namespace lang { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI Integer : public beecrypt::lang::Number, public virtual beecrypt::lang::Comparable { private: jint _val; public: static const jint MIN_VALUE; static const jint MAX_VALUE; static String toHexString(jint l) throw (); static String toOctalString(jint l) throw (); static String toString(jint l) throw (); static jint parseInteger(const String& s) throw (NumberFormatException); public: Integer(jint value) throw (); Integer(const String& s) throw (NumberFormatException); virtual ~Integer() {} virtual jint hashCode() const throw (); virtual jbyte byteValue() const throw (); virtual jshort shortValue() const throw (); virtual jint intValue() const throw (); virtual jlong longValue() const throw (); virtual jint compareTo(const Integer& anotherInteger) const throw (); virtual String toString() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/System.h0000644000175000001440000000244511216147023016440 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file System.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_SYSTEM_H #define _CLASS_BEE_LANG_SYSTEM_H #include "beecrypt/api.h" #ifdef __cplusplus #include "beecrypt/c++/io/InputStream.h" using beecrypt::io::InputStream; #include "beecrypt/c++/io/PrintStream.h" using beecrypt::io::PrintStream; namespace beecrypt { namespace lang { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI System { public: static InputStream& in; static PrintStream& out; static PrintStream& err; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Object.h0000644000175000001440000001611111216147023016355 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Object.h * \ingroup CXX_LANG_m * * Credit for the technique of emulating POSIX condition variables * on Win32 goes to Douglas C. Schmidt and Irfan Pyarali. * * \see http://www.cs.wustl.edu/~schmidt/win32-cv-1.html */ #ifndef _CLASS_BEE_LANG_OBJECT_H #define _CLASS_BEE_LANG_OBJECT_H #include "beecrypt/c++/lang/CloneNotSupportedException.h" using beecrypt::lang::CloneNotSupportedException; #include "beecrypt/c++/lang/InterruptedException.h" using beecrypt::lang::InterruptedException; #include "beecrypt/c++/lang/IllegalMonitorStateException.h" using beecrypt::lang::IllegalMonitorStateException; #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; #ifdef __cplusplus namespace beecrypt { namespace util { namespace concurrent { namespace locks { class BEECRYPTCXXAPI ReentrantLock; } } } namespace lang { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI Object { friend class Thread; friend class beecrypt::util::concurrent::locks::ReentrantLock; friend BEECRYPTCXXAPI void collection_attach(Object*) throw (); friend BEECRYPTCXXAPI void collection_detach(Object*) throw (); friend BEECRYPTCXXAPI void collection_remove(Object*) throw (); friend BEECRYPTCXXAPI void collection_rcheck(Object*) throw (); protected: /*!\brief This class is used to emulate Java's lock/wait/notify * methods. */ class Monitor { friend class Object; protected: bc_threadid_t _owner; bc_threadid_t _interruptee; bc_mutex_t _lock; volatile unsigned int _lock_count; void internal_state_lock(); void internal_state_unlock(); Monitor(); public: virtual ~Monitor() {} virtual void interrupt(bc_threadid_t) = 0; virtual bool interrupted(bc_threadid_t); virtual bool isInterrupted(bc_threadid_t); virtual bool isLocked(); virtual void lock() = 0; virtual void lockInterruptibly() throw (InterruptedException) = 0; virtual bool tryLock() = 0; virtual void notify() = 0; virtual void notifyAll() = 0; virtual void unlock() = 0; virtual void wait(jlong timeout) throw (InterruptedException) = 0; static Monitor* getInstance(bool fair = false); }; private: /*!\brief A Non-fair Monitor */ class NonfairMonitor : public Monitor { private: #if WIN32 HANDLE _lock_sig; // semaphore bool _lock_sig_all; HANDLE _lock_sig_all_done; // event unsigned int _lock_wthreads; HANDLE _notify_sig; // semaphore bool _notify_sig_all; HANDLE _notify_sig_all_done; // event unsigned int _notify_wthreads; #else bc_cond_t _lock_sig; unsigned int _lock_wthreads; bc_cond_t _notify_sig; unsigned int _notify_wthreads; #endif public: NonfairMonitor(); virtual ~NonfairMonitor(); virtual void interrupt(bc_threadid_t); virtual void lock(); virtual void lockInterruptibly() throw (InterruptedException); virtual bool tryLock(); virtual void unlock(); virtual void notify(); virtual void notifyAll(); virtual void wait(jlong timeout) throw (InterruptedException); }; class FairMonitor : public Monitor { private: struct waiter { bc_threadid_t owner; unsigned int lock_count; bc_cond_t event; waiter* next; waiter* prev; waiter(bc_threadid_t owner, unsigned int lock_count); ~waiter(); }; waiter* _lock_head; waiter* _lock_tail; waiter* _notify_head; waiter* _notify_tail; public: FairMonitor(); virtual ~FairMonitor(); virtual void interrupt(bc_threadid_t); virtual void lock(); virtual void lockInterruptibly() throw (InterruptedException); virtual bool tryLock(); virtual void unlock(); virtual void notify(); virtual void notifyAll(); virtual void wait(jlong timeout) throw (InterruptedException); }; private: /*!\brief The object's reference count (for use with Collections). * When this value is zero, it's safe to delete it. */ volatile unsigned int _ref_count; private: /*!\brief The object's monitor. * Initialized to zero, and only allocated when an Object's * is first synchronized. Classes which rely heavily on * synchronization should initialize this member in their * constructor with the Object::Monitor::getInstance() * method. * \see Object::Monitor::getInstance(bool fair = false) */ mutable Monitor* monitor; public: /*!\brief This class is used to emulate Java's 'synchronized' * methods. */ class BEECRYPTCXXAPI Synchronizer { private: const Object* _ref; bool _once; public: Synchronizer(const Object* obj); Synchronizer(const Object& obj); ~Synchronizer(); bool checkonce(); }; /*!\def synchronized * \brief Macro used to emulate Java's synchronization primitive. */ #define synchronized(obj) for (Object::Synchronizer _s(obj); _s.checkonce(); ) private: static bc_mutex_t _init_lock; static bc_mutex_t init(); private: void lock() const; void unlock() const; protected: virtual Object* clone() const throw (CloneNotSupportedException); public: Object(); virtual ~Object(); virtual bool equals(const Object* obj) const throw (); virtual jint hashCode() const throw (); void notify() const; void notifyAll() const; virtual String toString() const throw (); void wait(jlong millis = 0) const throw (InterruptedException); }; /*!\brief This function is used inside a collection to indicate that * the object is now attached to it. */ BEECRYPTCXXAPI void collection_attach(Object*) throw (); /*!\brief This function is used inside a collection to indicate that * the object has been detached to it. */ BEECRYPTCXXAPI void collection_detach(Object*) throw (); /*!\brief This function is used inside a collection to detach the * object, and delete it if no longer attached to any other * collections. */ BEECRYPTCXXAPI void collection_remove(Object*) throw (); /*!\brief This function checks if an object needs to be recycled: * the object is deleted if no longer attached to any collection. */ BEECRYPTCXXAPI void collection_rcheck(Object*) throw (); } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/RuntimeException.h0000644000175000001440000000304411216147023020452 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RuntimeException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_RUNTIMEEXCEPTION_H #define _CLASS_BEE_LANG_RUNTIMEEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/Exception.h" using beecrypt::lang::Exception; namespace beecrypt { namespace lang { /*!\brief This class is the superclass of exceptions that can be thrown * during normal operation. * \ingroup CXX_LANG_m */ class RuntimeException : public Exception { public: inline RuntimeException() {} inline RuntimeException(const char* message) : Exception(message) {} inline RuntimeException(const String& message) : Exception(message) {} inline RuntimeException(const Throwable* cause) : Exception(cause) {} inline ~RuntimeException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Exception.h0000644000175000001440000000276011216147023017112 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Exception.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_EXCEPTION_H #define _CLASS_BEE_LANG_EXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/Throwable.h" using beecrypt::lang::Throwable; namespace beecrypt { namespace lang { /*!\brief This subclass of Throwable is used to indicate a problem * which the application may want to catch. * \ingroup CXX_LANG_m */ class Exception : public Throwable { public: inline Exception() {} inline Exception(const char* message) : Throwable(message) {} inline Exception(const String& message) : Throwable(message) {} inline Exception(const Throwable* cause) : Throwable(cause) {} inline ~Exception() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Number.h0000644000175000001440000000274111216147023016403 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Number.h * \ingroup CXX_LANG_m */ #ifndef _ABSTRACT_CLASS_BEE_LANG_NUMBER_H #define _ABSTRACT_CLASS_BEE_LANG_NUMBER_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; namespace beecrypt { namespace lang { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI Number : public beecrypt::lang::Object { public: virtual ~Number() {} virtual jbyte byteValue() const throw () = 0; virtual jint intValue() const throw () = 0; virtual jlong longValue() const throw () = 0; virtual jshort shortValue() const throw () = 0; // virtual jfloat floatValue() const throw () = 0; // virtual jdouble doubeValue() const throw () = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Runnable.h0000644000175000001440000000211111216147023016710 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Runnable.h * \ingroup CXX_LANG_m */ #ifndef _INTERFACE_BEE_LANG_RUNNABLE_H #define _INTERFACE_BEE_LANG_RUNNABLE_H #ifdef __cplusplus namespace beecrypt { namespace lang { class BEECRYPTCXXAPI Runnable { public: virtual ~Runnable() {} virtual void run() = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/StringBuffer.h0000644000175000001440000000426311216147023017554 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file StringBuffer.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_STRINGBUFFER_H #define _CLASS_BEE_LANG_STRINGBUFFER_H #ifdef __cplusplus #include "beecrypt/c++/lang/Appendable.h" using beecrypt::lang::Appendable; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace lang { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI StringBuffer : public beecrypt::lang::Object, public virtual beecrypt::lang::Appendable, public virtual beecrypt::lang::CharSequence { friend class String; private: array _buffer; jint _used; void core_ensureCapacity(int minimum); public: StringBuffer(); StringBuffer(const char*); StringBuffer(const String&); virtual ~StringBuffer() {} virtual Appendable& append(jchar c); virtual Appendable& append(const CharSequence& cseq); StringBuffer& append(bool b); StringBuffer& append(char c); StringBuffer& append(const char*); StringBuffer& append(const String& s); StringBuffer& append(const StringBuffer& s); StringBuffer& append(const Object* obj); virtual jchar charAt(jint index) const throw (IndexOutOfBoundsException); void ensureCapacity(jint minimum); virtual jint length() const throw (); virtual CharSequence* subSequence(jint beginIndex, jint endIndex) const throw (IndexOutOfBoundsException); virtual String toString() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Long.h0000644000175000001440000000412611216147023016051 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Long.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_LONG_H #define _CLASS_BEE_LANG_LONG_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/lang/Number.h" using beecrypt::lang::Number; #include "beecrypt/c++/lang/NumberFormatException.h" using beecrypt::lang::NumberFormatException; namespace beecrypt { namespace lang { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI Long : public beecrypt::lang::Number, public virtual beecrypt::lang::Comparable { private: jlong _val; public: static const jlong MIN_VALUE; static const jlong MAX_VALUE; static String toHexString(jlong l) throw (); static String toOctalString(jlong l) throw (); static String toString(jlong l) throw (); static jlong parseLong(const String& s) throw (NumberFormatException); public: Long(jlong value) throw (); Long(const String& s) throw (NumberFormatException); virtual ~Long() {} virtual jbyte byteValue() const throw (); virtual jint compareTo(const Long& anotherLong) const throw (); virtual jint hashCode() const throw (); virtual jint intValue() const throw (); virtual jlong longValue() const throw (); virtual jshort shortValue() const throw (); virtual String toString() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/IndexOutOfBoundsException.h0000644000175000001440000000272711216147023022235 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file IndexOutOfBoundsException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_INDEXOUTOFBOUNDSEXCEPTION_H #define _CLASS_BEE_LANG_INDEXOUTOFBOUNDSEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; namespace beecrypt { namespace lang { /* \ingroup CXX_LANG_m */ class IndexOutOfBoundsException : public RuntimeException { public: inline IndexOutOfBoundsException() {} inline IndexOutOfBoundsException(const char* message) : RuntimeException(message) {} inline IndexOutOfBoundsException(const String& message) : RuntimeException(message) {} inline ~IndexOutOfBoundsException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/InterruptedException.h0000644000175000001440000000261411216147023021336 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file InterruptedException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_INTERRUPTEDEXCEPTION_H #define _CLASS_BEE_LANG_INTERRUPTEDEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/Exception.h" using beecrypt::lang::Exception; namespace beecrypt { namespace lang { /* \ingroup CXX_LANG_m */ class InterruptedException : public Exception { public: inline InterruptedException() {} inline InterruptedException(const char* message) : Exception(message) {} inline InterruptedException(const String& message) : Exception(message) {} inline ~InterruptedException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Appendable.h0000644000175000001440000000236211216147023017205 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Appendable.h * \ingroup CXX_LANG_m */ #ifndef _INTERFACE_BEE_LANG_APPENDABLE_H #define _INTERFACE_BEE_LANG_APPENDABLE_H #ifdef __cplusplus #include "beecrypt/c++/lang/CharSequence.h" using beecrypt::lang::CharSequence; namespace beecrypt { namespace lang { class BEECRYPTCXXAPI Appendable { public: virtual ~Appendable() {} virtual Appendable& append(jchar c) = 0; virtual Appendable& append(const CharSequence& cseq) = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/IllegalMonitorStateException.h0000644000175000001440000000275711216147023022763 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file IllegalMonitorStateException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_ILLEGALMONITORSTATEEXCEPTION_H #define _CLASS_BEE_LANG_ILLEGALMONITORSTATEEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; namespace beecrypt { namespace lang { /* \ingroup CXX_LANG_m */ class IllegalMonitorStateException : public RuntimeException { public: inline IllegalMonitorStateException() {} inline IllegalMonitorStateException(const char* message) : RuntimeException(message) {} inline IllegalMonitorStateException(const String& message) : RuntimeException(message) {} inline ~IllegalMonitorStateException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/StringBuilder.h0000644000175000001440000000437111216147023017731 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file StringBuilder.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_STRINGBUILDER_H #define _CLASS_BEE_LANG_STRINGBUILDER_H #ifdef __cplusplus #include "beecrypt/c++/lang/Appendable.h" using beecrypt::lang::Appendable; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace lang { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI StringBuilder : public beecrypt::lang::Object, public virtual beecrypt::lang::Appendable, public virtual beecrypt::lang::CharSequence { friend class String; private: array _buffer; int _used; public: StringBuilder(); StringBuilder(const char*); StringBuilder(const String&); virtual ~StringBuilder() {} virtual Appendable& append(jchar c); virtual Appendable& append(const CharSequence& cseq); StringBuilder& append(bool b); StringBuilder& append(char c); StringBuilder& append(jint i); StringBuilder& append(jlong l); StringBuilder& append(const char*); StringBuilder& append(const String& s); StringBuilder& append(const StringBuilder& s); StringBuilder& append(const Object* obj); StringBuilder& reverse(); virtual jchar charAt(jint index) const throw (IndexOutOfBoundsException); void ensureCapacity(jint minimum); virtual jint length() const throw (); virtual CharSequence* subSequence(jint beginIndex, jint endIndex) const throw (IndexOutOfBoundsException); virtual String toString() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Character.h0000644000175000001440000000413211216147023017043 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Character.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_CHARACTER_H #define _CLASS_BEE_LANG_CHARACTER_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace lang { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI Character : public beecrypt::lang::Object, public virtual beecrypt::lang::Comparable { private: jchar _val; public: static const jchar MIN_VALUE; static const jchar MAX_VALUE; static const jchar MIN_HIGH_SURROGATE; static const jchar MAX_HIGH_SURROGATE; static const jchar MIN_LOW_SURROGATE; static const jchar MAX_LOW_SURROGATE; static const jchar MIN_SURROGATE; static const jchar MAX_SURROGATE; static const jint MIN_SUPPLEMENTARY_CODE_POINT; static const jint MIN_CODE_POINT; static const jint MAX_CODE_POINT; static const jint MIN_RADIX; static const jint MAX_RADIX; static String toString(jchar c) throw (); static bool isHighSurrogate(jchar ch) throw (); static bool isLowSurrogate(jchar ch) throw (); public: Character(jchar value) throw (); virtual ~Character() {} virtual jint hashCode() const throw (); virtual jint compareTo(const Character& anotherCharacter) const throw (); virtual String toString() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/ClassCastException.h0000644000175000001440000000263711216147023020716 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ClassCastException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_CLASSCASTEXCEPTION_H #define _CLASS_BEE_LANG_CLASSCASTEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; namespace beecrypt { namespace lang { /* \ingroup CXX_LANG_m */ class ClassCastException : public RuntimeException { public: inline ClassCastException() {} inline ClassCastException(const char* message) : RuntimeException(message) {} inline ClassCastException(const String& message) : RuntimeException(message) {} inline ~ClassCastException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/String.h0000644000175000001440000001013311216147023016413 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file String.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_STRING_H #define _CLASS_BEE_LANG_STRING_H #include "beecrypt/api.h" #ifdef __cplusplus #include "beecrypt/c++/lang/CharSequence.h" using beecrypt::lang::CharSequence; #include "beecrypt/c++/lang/Comparable.h" using beecrypt::lang::Comparable; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/array.h" using beecrypt::array; using beecrypt::bytearray; #include #include namespace beecrypt { namespace lang { /*!\ingroup CXX_LANG_m * \brief This class represents Unicode character strings. * */ class BEECRYPTCXXAPI String : public beecrypt::lang::Object, public virtual beecrypt::lang::CharSequence, public virtual beecrypt::lang::Comparable { friend class Character; friend class StringBuffer; friend class StringBuilder; private: array _value; String(array&); String(const array&, const array&); public: static String valueOf(bool b); static String valueOf(jchar c); static String valueOf(jint i); static String valueOf(jlong l); public: String(); String(char); String(jchar); String(const char*); String(const jchar*, jint offset, jint length); String(const bytearray&); String(const array&); String(const String& copy); String(const UnicodeString& copy); virtual ~String() {} String& operator=(const String& copy); String& operator=(const UnicodeString& copy); virtual jchar charAt(jint index) const throw (IndexOutOfBoundsException); virtual jint compareTo(const String& str) const throw (); jint compareToIgnoreCase(const String& str) const throw (); String concat(const String& str) const throw (); bool contains(const CharSequence& seq) const throw (); bool contentEquals(const CharSequence& seq) const throw (); bool endsWith(const String& suffix) const throw (); virtual bool equals(const Object* obj) const throw (); bool equals(const String& str) const throw (); bool equalsIgnoreCase(const String& str) const throw (); virtual jint hashCode() const throw (); jint indexOf(jint ch, jint fromIndex = 0) const throw (); jint indexOf(const String& str, jint fromIndex = 0) const throw (); virtual jint length() const throw (); bool startsWith(const String& prefix, jint offset = 0) const throw (); virtual CharSequence* subSequence(jint beginIndex, jint endIndex) const throw (IndexOutOfBoundsException); String substring(jint beginIndex) const throw (IndexOutOfBoundsException); String substring(jint beginIndex, jint endIndex) const throw (IndexOutOfBoundsException); String toLowerCase() const throw (); String toUpperCase() const throw (); const array& toCharArray() const throw (); virtual String toString() const throw (); UnicodeString toUnicodeString() const throw (); }; BEECRYPTCXXAPI beecrypt::lang::String operator+(const beecrypt::lang::String& s1, const beecrypt::lang::String& s2); BEECRYPTCXXAPI bool operator<(const beecrypt::lang::String& s1, const beecrypt::lang::String& s2); BEECRYPTCXXAPI std::ostream& operator<<(std::ostream& stream, const beecrypt::lang::String& str); BEECRYPTCXXAPI std::ostream& operator<<(std::ostream& stream, const beecrypt::lang::String* str); } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/IllegalArgumentException.h0000644000175000001440000000310511216147023022101 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file IllegalArgumentException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_ILLEGALARGUMENTEXCEPTION_H #define _CLASS_BEE_LANG_ILLEGALARGUMENTEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; namespace beecrypt { namespace lang { /*!\brief This class is used to indicate that a method was passed an * illegal or inappropriate argument. * \ingroup CXX_LANG_m */ class IllegalArgumentException : public RuntimeException { public: inline IllegalArgumentException() {} inline IllegalArgumentException(const char* message) : RuntimeException(message) {} inline IllegalArgumentException(const String& message) : RuntimeException(message) {} inline ~IllegalArgumentException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Comparable.h0000644000175000001440000000222111216147023017211 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Comparable.h * \ingroup CXX_LANG_m */ #ifndef _INTERFACE_BEE_LANG_COMPARABLE_H #define _INTERFACE_BEE_LANG_COMPARABLE_H #include "beecrypt/api.h" #ifdef __cplusplus namespace beecrypt { namespace lang { template class Comparable { public: virtual ~Comparable() {} virtual jint compareTo(const T&) const throw () = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/IllegalThreadStateException.h0000644000175000001440000000301711216147023022531 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file IllegalThreadStateException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_ILLEGALTHREADSTATEEXCEPTION_H #define _CLASS_BEE_LANG_ILLEGALTHREADSTATEEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/IllegalArgumentException.h" using beecrypt::lang::IllegalArgumentException; namespace beecrypt { namespace lang { /* \ingroup CXX_LANG_m */ class IllegalThreadStateException : public IllegalArgumentException { public: inline IllegalThreadStateException() {} inline IllegalThreadStateException(const char* message) : IllegalArgumentException(message) {} inline IllegalThreadStateException(const String& message) : IllegalArgumentException(message) {} inline ~IllegalThreadStateException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/CharSequence.h0000644000175000001440000000271611216147023017523 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CharSequence.h * \ingroup CXX_LANG_m */ #ifndef _INTERFACE_BEE_LANG_CHARSEQUENCE_H #define _INTERFACE_BEE_LANG_CHARSEQUENCE_H #ifdef __cplusplus #include "beecrypt/c++/lang/IndexOutOfBoundsException.h" using beecrypt::lang::IndexOutOfBoundsException; namespace beecrypt { namespace lang { class BEECRYPTCXXAPI CharSequence { public: virtual ~CharSequence() {} virtual jchar charAt(jint index) const throw (IndexOutOfBoundsException) = 0; virtual jint length() const throw () = 0; virtual CharSequence* subSequence(jint beginIndex, jint endIndex) const throw (IndexOutOfBoundsException) = 0; virtual String toString() const throw () = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/Thread.h0000644000175000001440000000640311216147023016361 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Thread.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_THREAD_H #define _CLASS_BEE_LANG_THREAD_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/lang/Runnable.h" using beecrypt::lang::Runnable; #include "beecrypt/c++/lang/IllegalThreadStateException.h" using beecrypt::lang::IllegalThreadStateException; #include using std::map; namespace beecrypt { namespace lang { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI Thread : public Object, public virtual Runnable { friend class Object; friend class beecrypt::util::concurrent::locks::ReentrantLock; friend void MonitorEnter(const Object*); friend void MonitorExit(const Object*) throw (IllegalMonitorStateException); public: /*!\ingroup CXX_LANG_m */ enum BEECRYPTCXXAPI State { NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED }; private: Runnable* _target; String _name; bc_thread_t _thr; bc_threadid_t _tid; size_t _stacksize; bool _daemon; bool _interrupted; State _state; Monitor* _monitoring; Monitor* _joiner; #if WIN32 static DWORD WINAPI start_routine(void*); #else static void* start_routine(void*); #endif void terminate(); private: typedef map thread_map; typedef map::iterator thread_map_iterator; static thread_map _tmap; static bc_mutex_t _tmap_lock; static bc_mutex_t init(); static Thread _main; static Thread* find(bc_threadid_t); public: static void sleep(jlong millis) throw (InterruptedException); static void yield(); static Thread* currentThread(); private: Thread(const String&, bc_threadid_t); public: Thread(); Thread(const String& name); Thread(Runnable& target); Thread(Runnable& target, const String& name); Thread(Runnable& target, const String& name, size_t stacksize); virtual ~Thread(); virtual void run(); virtual String toString() const throw (); const String& getName() const throw (); Thread::State getState() const throw (); void interrupt(); bool interrupted(); bool isAlive() const throw (); bool isDaemon() const throw (); bool isInterrupted() const throw (); void join() throw (InterruptedException); void setDaemon(bool on) throw (IllegalThreadStateException); void start() throw (IllegalThreadStateException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/UnsupportedOperationException.h0000644000175000001440000000276711216147023023253 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file UnsupportedOperationException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_UNSUPPORTEDOPERATIONEXCEPTION_H #define _CLASS_BEE_LANG_UNSUPPORTEDOPERATIONEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; namespace beecrypt { namespace lang { /* \ingroup CXX_LANG_m */ class UnsupportedOperationException : public RuntimeException { public: inline UnsupportedOperationException() {} inline UnsupportedOperationException(const char* message) : RuntimeException(message) {} inline UnsupportedOperationException(const String& message) : RuntimeException(message) {} inline ~UnsupportedOperationException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/OutOfMemoryError.h0000644000175000001440000000267311216147023020416 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file OutOfMemoryError.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_OUTOFMEMORYERROR_H #define _CLASS_BEE_LANG_OUTOFMEMORYERROR_H #ifdef __cplusplus #include "beecrypt/c++/lang/Error.h" using beecrypt::lang::Error; namespace beecrypt { namespace lang { /*!\brief This class is used to indicate that the application has run * out of memory. * \ingroup CXX_LANG_m */ class OutOfMemoryError : public Error { public: inline OutOfMemoryError() {} inline OutOfMemoryError(const char* message) : Error(message) {} inline OutOfMemoryError(const String& message) : Error(message) {} inline ~OutOfMemoryError() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/NullPointerException.h0000644000175000001440000000306111216147023021301 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file NullPointerException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_NULLPOINTEREXCEPTION_H #define _CLASS_BEE_LANG_NULLPOINTEREXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; namespace beecrypt { namespace lang { /*!\brief This class is used to indicate that an application has * found a null pointer where an object was required. * \ingroup CXX_LANG_m */ class NullPointerException : public RuntimeException { public: inline NullPointerException() {} inline NullPointerException(const char* message) : RuntimeException(message) {} inline NullPointerException(const String& message) : RuntimeException(message) {} inline ~NullPointerException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/lang/IllegalStateException.h0000644000175000001440000000313711216147023021404 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file IllegalStateException.h * \ingroup CXX_LANG_m */ #ifndef _CLASS_BEE_LANG_ILLEGALSTATEEXCEPTION_H #define _CLASS_BEE_LANG_ILLEGALSTATEEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; namespace beecrypt { namespace lang { /*!\brief This class is used to indicate that a method was called at * an illegal or inappropriate time, e.g. before an object * was initialized. * \ingroup CXX_LANG_m */ class IllegalStateException : public RuntimeException { public: inline IllegalStateException() {} inline IllegalStateException(const char* message) : RuntimeException(message) {} inline IllegalStateException(const String& message) : RuntimeException(message) {} inline ~IllegalStateException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/mutex.h0000644000175000001440000000652311216147022015375 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file mutex.h * \brief MUTually EXclusive lock class. * \author Bob Deblier * \ingroup CXX_m */ #ifndef _CLASS_BEECRYPT_MUTEX_H #define _CLASS_BEECRYPT_MUTEX_H #include "beecrypt/api.h" #ifdef __cplusplus #if HAVE_ERRNO_H # include #endif namespace beecrypt { class BEECRYPTCXXAPI mutex { private: #ifdef ENABLE_THREADS bc_mutex_t _lock; #endif public: inline void init() throw (char*) { #if WIN32 _lock = CreateMutex((LPSECURITY_ATTRIBUTES) 0, FALSE, (LPCSTR) 0); if (!_lock) throw "CreateMutex failed"; #else register int rc; # if HAVE_SYNCH_H if ((rc = mutex_init(&_lock, USYNC_THREAD, 0))) throw strerror(rc); # elif HAVE_PTHREAD_H if ((rc = pthread_mutex_init(&_lock, 0))) throw strerror(rc); # else # error # endif #endif } inline void lock() throw (char*) { #if WIN32 if (WaitForSingleObject(_lock, INFINITE) == WAIT_OBJECT_0) return; throw "WaitForSingleObject failed"; #else register int rc; # if HAVE_SYNCH_H if ((rc = mutex_lock(&_lock))) throw strerror(rc); # elif HAVE_PTHREAD_H if ((rc = pthread_mutex_lock(&_lock))) throw strerror(rc); # else # error # endif #endif } inline bool trylock() throw (char*) { #if WIN32 switch (WaitForSingleObject(_lock, 0)) { case WAIT_TIMEOUT: return false; case WAIT_OBJECT_0: return true; default: throw "WaitForSingleObbject failed"; } #else register int rc; # if HAVE_SYNCH_H if ((rc = mutex_trylock(&_lock)) == 0) return true; if (rc == EBUSY) return false; throw strerror(rc); # elif HAVE_PTHREAD_H if ((rc = pthread_mutex_trylock(&_lock)) == 0) return true; if (rc == EBUSY) return false; throw strerror(rc); # else # error # endif #endif } inline void unlock() throw (char*) { #if WIN32 if (!ReleaseMutex(_lock)) throw "ReleaseMutex failed"; #else register int rc; # if HAVE_SYNCH_H if ((rc = mutex_unlock(&_lock))) throw strerror(rc); # elif HAVE_PTHREAD_H if ((rc = pthread_mutex_unlock(&_lock))) throw strerror(rc); # else # error # endif #endif } inline void destroy() throw (char*) { #if WIN32 if (!CloseHandle(_lock)) throw "CloseHandle failed"; #else register int rc; # if HAVE_SYNCH_H if ((rc = mutex_destroy(&_lock))) throw strerror(rc); # elif HAVE_PTHREAD_H if ((rc = pthread_mutex_destroy(&_lock))) throw strerror(rc); # else # error # endif #endif } }; } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/0000777000175000001440000000000011226307271015777 500000000000000beecrypt-4.2.1/include/beecrypt/c++/provider/SHA384Digest.h0000644000175000001440000000332511216147023020075 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA384Digest.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA384DIGEST_H #define _CLASS_SHA384DIGEST_H #include "beecrypt/beecrypt.h" #include "beecrypt/sha384.h" #ifdef __cplusplus #include "beecrypt/c++/security/MessageDigestSpi.h" using beecrypt::security::MessageDigestSpi; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; namespace beecrypt { namespace provider { class SHA384Digest : public MessageDigestSpi, public Cloneable { private: sha384Param _param; bytearray _digest; protected: virtual const bytearray& engineDigest(); virtual int engineDigest(byte*, int, int) throw (ShortBufferException); virtual int engineGetDigestLength(); virtual void engineReset(); virtual void engineUpdate(byte); virtual void engineUpdate(const byte*, int, int); public: SHA384Digest(); virtual ~SHA384Digest(); virtual SHA384Digest* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DHIESParameters.h0000644000175000001440000000350511216147023020743 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHIESParameters.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DHIESPARAMETERS_H #define _CLASS_DHIESPARAMETERS_H #ifdef __cplusplus #include "beecrypt/c++/security/AlgorithmParametersSpi.h" using beecrypt::security::AlgorithmParametersSpi; #include "beecrypt/c++/beeyond/DHIESDecryptParameterSpec.h" using beecrypt::beeyond::DHIESDecryptParameterSpec; namespace beecrypt { namespace provider { class DHIESParameters : public AlgorithmParametersSpi { private: DHIESParameterSpec* _spec; DHIESDecryptParameterSpec* _dspec; protected: virtual const bytearray& engineGetEncoded(const String* format = 0) throw (IOException); virtual AlgorithmParameterSpec* engineGetParameterSpec(const type_info&) throw (InvalidParameterSpecException); virtual void engineInit(const AlgorithmParameterSpec&) throw (InvalidParameterSpecException); virtual void engineInit(const byte*, int, const String* format = 0); virtual String engineToString() throw (); public: DHIESParameters(); virtual ~DHIESParameters(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/SHA1Digest.h0000644000175000001440000000330311216147023017713 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA1Digest.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA1DIGEST_H #define _CLASS_SHA1DIGEST_H #include "beecrypt/beecrypt.h" #include "beecrypt/sha1.h" #ifdef __cplusplus #include "beecrypt/c++/security/MessageDigestSpi.h" using beecrypt::security::MessageDigestSpi; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; namespace beecrypt { namespace provider { class SHA1Digest : public MessageDigestSpi, public Cloneable { private: sha1Param _param; bytearray _digest; protected: virtual const bytearray& engineDigest(); virtual int engineDigest(byte*, int, int) throw (ShortBufferException); virtual int engineGetDigestLength(); virtual void engineReset(); virtual void engineUpdate(byte); virtual void engineUpdate(const byte*, int, int); public: SHA1Digest(); virtual ~SHA1Digest(); virtual SHA1Digest* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/PKCS12KeyFactory.h0000644000175000001440000000276711216147023021000 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file PKCS12KeyFactory.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_PKCS12KEYFACTORY_H #define _CLASS_PKCS12KEYFACTORY_H #ifdef __cplusplus #include "beecrypt/c++/crypto/SecretKeyFactorySpi.h" using beecrypt::crypto::SecretKeyFactorySpi; namespace beecrypt { namespace provider { class PKCS12KeyFactory : public SecretKeyFactorySpi { protected: virtual SecretKey* engineGenerateSecret(const KeySpec&) throw (InvalidKeySpecException); virtual KeySpec* engineGetKeySpec(const SecretKey&, const type_info&) throw (InvalidKeySpecException); virtual SecretKey* engineTranslateKey(const SecretKey&) throw (InvalidKeyException); public: PKCS12KeyFactory(); virtual ~PKCS12KeyFactory() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/BlockCipher.h0000644000175000001440000000630311216147023020247 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BlockCipher.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_BLOCKCIPHER_H #define _CLASS_BLOCKCIPHER_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus #include "beecrypt/c++/crypto/CipherSpi.h" using beecrypt::crypto::CipherSpi; namespace beecrypt { namespace provider { class BlockCipher : public CipherSpi { private: static const int MODE_ECB; static const int MODE_CBC; static const int MODE_CTR; static const int PADDING_NONE; static const int PADDING_PKCS5; private: blockCipherContext _ctxt; int _opmode; int _blmode; int _padding; bytearray _key; int _keybits; bytearray _buffer; int _bufcnt; int _buflwm; bytearray _iv; int process(const byte* input, int inputLength, byte* output, int outputLength) throw (ShortBufferException); void engineReset(); protected: virtual bytearray* engineDoFinal(const byte* input, int inputOffset, int inputLength) throw (IllegalBlockSizeException, BadPaddingException); virtual int engineDoFinal(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException, IllegalBlockSizeException, BadPaddingException); virtual int engineGetBlockSize() const throw (); virtual bytearray* engineGetIV(); virtual int engineGetKeySize(const Key& key) const throw (InvalidKeyException); virtual int engineGetOutputSize(int inputLength) throw (); virtual AlgorithmParameters* engineGetParameters() throw (); virtual void engineInit(int opmode, const Key& key, SecureRandom* random) throw (InvalidKeyException); virtual void engineInit(int opmode, const Key& key, AlgorithmParameters* params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException); virtual void engineInit(int opmode, const Key& key, const AlgorithmParameterSpec& params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException); virtual bytearray* engineUpdate(const byte* input, int inputOffset, int inputLength); virtual int engineUpdate(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException); virtual void engineSetMode(const String& mode) throw (NoSuchAlgorithmException); virtual void engineSetPadding(const String& padding) throw (NoSuchPaddingException); BlockCipher(const blockCipher&); public: virtual ~BlockCipher() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/SHA224Digest.h0000644000175000001440000000332111216650402020062 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA224Digest.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA224DIGEST_H #define _CLASS_SHA224DIGEST_H #include "beecrypt/beecrypt.h" #include "beecrypt/sha224.h" #ifdef __cplusplus #include "beecrypt/c++/security/MessageDigestSpi.h" using beecrypt::security::MessageDigestSpi; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; namespace beecrypt { namespace provider { class SHA224Digest : public MessageDigestSpi, public Cloneable { private: sha224Param _param; bytearray _digest; protected: virtual const bytearray& engineDigest(); virtual int engineDigest(byte*, int, int) throw (ShortBufferException); virtual int engineGetDigestLength(); virtual void engineReset(); virtual void engineUpdate(byte); virtual void engineUpdate(const byte*, int, int); public: SHA224Digest(); virtual ~SHA224Digest(); virtual SHA224Digest* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/SHA1withDSASignature.h0000644000175000001440000000531311216147023021664 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA1withDSASignature.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA1WITHDSASIGNATURE_H #define _CLASS_SHA1WITHDSASIGNATURE_H #include "beecrypt/api.h" #include "beecrypt/dsa.h" #include "beecrypt/sha1.h" #ifdef __cplusplus #include "beecrypt/c++/security/SignatureSpi.h" using beecrypt::security::SecureRandom; using beecrypt::security::SignatureSpi; using beecrypt::security::AlgorithmParameters; using beecrypt::security::InvalidAlgorithmParameterException; using beecrypt::security::InvalidKeyException; using beecrypt::security::PrivateKey; using beecrypt::security::PublicKey; using beecrypt::security::ShortBufferException; using beecrypt::security::SignatureException; using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace provider { class SHA1withDSASignature : public SignatureSpi { friend class BeeCryptProvider; private: dsaparam _params; mpnumber _x; mpnumber _y; sha1Param _sp; SecureRandom* _srng; void rawsign(mpnumber &r, mpnumber&s) throw (SignatureException); bool rawvrfy(const mpnumber &r, const mpnumber&s) throw (); protected: virtual AlgorithmParameters* engineGetParameters() const; virtual void engineSetParameter(const AlgorithmParameterSpec&) throw (InvalidAlgorithmParameterException); virtual void engineInitSign(const PrivateKey&, SecureRandom*) throw (InvalidKeyException); virtual void engineInitVerify(const PublicKey&) throw (InvalidKeyException); virtual bytearray* engineSign() throw (SignatureException); virtual int engineSign(byte*, int, int) throw (ShortBufferException, SignatureException); virtual int engineSign(bytearray&) throw (SignatureException); virtual bool engineVerify(const byte*, int, int) throw (SignatureException); virtual void engineUpdate(byte); virtual void engineUpdate(const byte*, int, int); public: SHA1withDSASignature(); virtual ~SHA1withDSASignature() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/HMACSHA512.h0000644000175000001440000000224011216147023017352 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file HMACSHA512.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_HMACSHA512_H #define _CLASS_HMACSHA512_H #ifdef __cplusplus #include "beecrypt/c++/provider/HMAC.h" namespace beecrypt { namespace provider { class HMACSHA512 : public HMAC, public Cloneable { public: HMACSHA512(); virtual ~HMACSHA512() {} virtual HMACSHA512* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/SHA256withRSASignature.h0000644000175000001440000000230011216147023022047 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA256withRSASignature.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA256WITHRSASIGNATURE_H #define _CLASS_SHA256WITHRSASIGNATURE_H #ifdef __cplusplus #include "beecrypt/c++/provider/PKCS1RSASignature.h" namespace beecrypt { namespace provider { class SHA256withRSASignature : public PKCS1RSASignature { public: SHA256withRSASignature(); virtual ~SHA256withRSASignature() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DSAParameterGenerator.h0000644000175000001440000000332711216147023022204 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAParameterGenerator.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DSAPARAMETERGENERATOR_H #define _CLASS_DSAPARAMETERGENERATOR_H #ifdef __cplusplus #include "beecrypt/c++/security/AlgorithmParameterGeneratorSpi.h" using beecrypt::security::AlgorithmParameterGeneratorSpi; #include "beecrypt/c++/security/spec/DSAParameterSpec.h" using beecrypt::security::spec::DSAParameterSpec; namespace beecrypt { namespace provider { class DSAParameterGenerator : public AlgorithmParameterGeneratorSpi { private: int _size; DSAParameterSpec* _spec; SecureRandom* _srng; protected: virtual AlgorithmParameters* engineGenerateParameters(); virtual void engineInit(const AlgorithmParameterSpec&, SecureRandom*) throw (InvalidAlgorithmParameterException); virtual void engineInit(int, SecureRandom*) throw (InvalidParameterException); public: DSAParameterGenerator(); virtual ~DSAParameterGenerator(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/RSAPrivateKeyImpl.h0000644000175000001440000000375311216147023021343 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAPrivateKeyImpl.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_RSAPRIVATEKEYIMPL_H #define _CLASS_RSAPRIVATEKEYIMPL_H #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/interfaces/RSAPrivateKey.h" using beecrypt::security::interfaces::RSAPrivateKey; namespace beecrypt { namespace provider { class RSAPrivateKeyImpl : public Object, public RSAPrivateKey, public Cloneable { protected: BigInteger _n; BigInteger _d; mutable bytearray* _enc; public: RSAPrivateKeyImpl(const RSAPrivateKey&); RSAPrivateKeyImpl(const RSAPrivateKeyImpl&); RSAPrivateKeyImpl(const BigInteger&, const BigInteger&); virtual ~RSAPrivateKeyImpl(); virtual RSAPrivateKeyImpl* clone() const throw (); virtual bool equals(const Object* obj) const throw (); virtual const BigInteger& getModulus() const throw (); virtual const BigInteger& getPrivateExponent() const throw (); virtual const bytearray* getEncoded() const throw (); virtual const String& getAlgorithm() const throw (); virtual const String* getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/HMACSHA1.h0000644000175000001440000000233411216147023017207 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file HMACSHA1.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_HMACSHA1_H #define _CLASS_HMACSHA1_H #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/provider/HMAC.h" namespace beecrypt { namespace provider { class HMACSHA1 : public HMAC, public Cloneable { public: HMACSHA1(); virtual ~HMACSHA1() {} virtual HMACSHA1* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/BaseProvider.h0000644000175000001440000000236511216147023020453 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BaseProvider.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_BEECRYPTPROVIDER_H #define _CLASS_BEECRYPTPROVIDER_H #ifdef __cplusplus #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; namespace beecrypt { namespace provider { /*!\ingroup CXX_PROVIDER_m */ class BaseProvider : public Provider { private: void init(); public: BaseProvider(); BaseProvider(void*); virtual ~BaseProvider() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DHParameters.h0000644000175000001440000000337711216147023020411 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHParameters.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DHPARAMETERS_H #define _CLASS_DHPARAMETERS_H #ifdef __cplusplus #include "beecrypt/c++/security/AlgorithmParametersSpi.h" using beecrypt::security::AlgorithmParametersSpi; #include "beecrypt/c++/crypto/spec/DHParameterSpec.h" using beecrypt::crypto::spec::DHParameterSpec; namespace beecrypt { namespace provider { class DHParameters : public AlgorithmParametersSpi { private: DHParameterSpec* _spec; protected: virtual const bytearray& engineGetEncoded(const String* format = 0) throw (IOException); virtual AlgorithmParameterSpec* engineGetParameterSpec(const type_info&) throw (InvalidParameterSpecException); virtual void engineInit(const AlgorithmParameterSpec&) throw (InvalidParameterSpecException); virtual void engineInit(const byte*, int, const String* format = 0); virtual String engineToString() throw (); public: DHParameters(); virtual ~DHParameters(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DHPublicKeyImpl.h0000644000175000001440000000445211216147023021012 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHPublicKeyImpl.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DHPUBLICKEYIMPL_H #define _CLASS_DHPUBLICKEYIMPL_H #include "beecrypt/dlsvdp-dh.h" #ifdef __cplusplus #include "beecrypt/c++/crypto/interfaces/DHPublicKey.h" using beecrypt::crypto::interfaces::DHPublicKey; #include "beecrypt/c++/crypto/spec/DHParameterSpec.h" using beecrypt::crypto::spec::DHParameterSpec; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; using beecrypt::bytearray; using beecrypt::crypto::interfaces::DHParams; using beecrypt::lang::String; namespace beecrypt { namespace provider { class DHPublicKeyImpl : public Object, public DHPublicKey, public Cloneable { private: DHParameterSpec* _params; BigInteger _y; mutable bytearray* _enc; public: DHPublicKeyImpl(const DHPublicKey&); DHPublicKeyImpl(const DHPublicKeyImpl&); DHPublicKeyImpl(const DHParams&, const BigInteger&); DHPublicKeyImpl(const dhparam&, const mpnumber&); DHPublicKeyImpl(const BigInteger&, const BigInteger&, const BigInteger&); ~DHPublicKeyImpl(); virtual DHPublicKeyImpl* clone() const throw (); virtual bool equals(const Object* obj) const throw (); virtual const DHParams& getParams() const throw (); virtual const BigInteger& getY() const throw (); virtual const bytearray* getEncoded() const throw (); virtual const String& getAlgorithm() const throw (); virtual const String* getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DSAKeyFactory.h0000644000175000001440000000344011216147023020471 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAKeyFactory.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DSAKEYFACTORY_H #define _CLASS_DSAKEYFACTORY_H #ifdef __cplusplus #include "beecrypt/c++/security/KeyFactorySpi.h" using beecrypt::security::InvalidKeyException; using beecrypt::security::Key; using beecrypt::security::KeyFactorySpi; using beecrypt::security::PrivateKey; using beecrypt::security::PublicKey; using beecrypt::security::spec::InvalidKeySpecException; using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace provider { class DSAKeyFactory : public KeyFactorySpi { protected: virtual PrivateKey* engineGeneratePrivate(const KeySpec&) throw (InvalidKeySpecException); virtual PublicKey* engineGeneratePublic(const KeySpec&) throw (InvalidKeySpecException); virtual KeySpec* engineGetKeySpec(const Key&, const type_info&) throw (InvalidKeySpecException); virtual Key* engineTranslateKey(const Key&) throw (InvalidKeyException); public: DSAKeyFactory(); virtual ~DSAKeyFactory() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/HMACSHA256.h0000644000175000001440000000224011216147023017357 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file HMACSHA256.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_HMACSHA256_H #define _CLASS_HMACSHA256_H #ifdef __cplusplus #include "beecrypt/c++/provider/HMAC.h" namespace beecrypt { namespace provider { class HMACSHA256 : public HMAC, public Cloneable { public: HMACSHA256(); virtual ~HMACSHA256() {} virtual HMACSHA256* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DHKeyAgreement.h0000644000175000001440000000421511216147023020656 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHKeyAgreement.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DHKEYAGREEMENT_H #define _CLASS_DHKEYAGREEMENT_H #include "beecrypt/dlsvdp-dh.h" #ifdef __cplusplus #include "beecrypt/c++/crypto/KeyAgreementSpi.h" using beecrypt::crypto::KeyAgreementSpi; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; namespace beecrypt { namespace provider { class DHKeyAgreement : public KeyAgreementSpi { private: static const int UNINITIALIZED = 0; static const int INITIALIZED = 1; static const int SHARED = 2; int _state; dhparam _param; mpnumber _x; mpnumber _y; bytearray* _secret; protected: virtual void engineInit(const Key&, SecureRandom*) throw (InvalidKeyException); virtual void engineInit(const Key&, const AlgorithmParameterSpec&, SecureRandom*) throw (InvalidKeyException, InvalidAlgorithmParameterException); virtual Key* engineDoPhase(const Key&, bool) throw (InvalidKeyException, IllegalStateException); virtual bytearray* engineGenerateSecret() throw (IllegalStateException); virtual int engineGenerateSecret(bytearray&, int) throw (IllegalStateException, ShortBufferException); virtual SecretKey* engineGenerateSecret(const String&) throw (IllegalStateException, NoSuchAlgorithmException, InvalidKeyException); public: DHKeyAgreement(); virtual ~DHKeyAgreement(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DHKeyPairGenerator.h0000644000175000001440000000331111216147023021505 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHKeyPairGenerator.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DHKEYPAIRGENERATOR_H #define _CLASS_DHKEYPAIRGENERATOR_H #ifdef __cplusplus #include "beecrypt/c++/crypto/spec/DHParameterSpec.h" using beecrypt::crypto::spec::DHParameterSpec; #include "beecrypt/c++/security/KeyPairGeneratorSpi.h" using beecrypt::security::KeyPairGeneratorSpi; namespace beecrypt { namespace provider { class DHKeyPairGenerator : public KeyPairGeneratorSpi { private: int _size; DHParameterSpec* _spec; SecureRandom* _srng; KeyPair* genpair(randomGeneratorContext*); protected: virtual KeyPair* engineGenerateKeyPair(); virtual void engineInitialize(const AlgorithmParameterSpec&, SecureRandom*) throw (InvalidAlgorithmParameterException); virtual void engineInitialize(int, SecureRandom*) throw (InvalidParameterException); public: DHKeyPairGenerator(); virtual ~DHKeyPairGenerator(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DSAPrivateKeyImpl.h0000644000175000001440000000440411216147023021317 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAPrivateKeyImpl.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DSAPRIVATEKEYIMPL_H #define _CLASS_DSAPRIVATEKEYIMPL_H #include "beecrypt/dsa.h" #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/interfaces/DSAPrivateKey.h" using beecrypt::security::interfaces::DSAPrivateKey; #include "beecrypt/c++/security/spec/DSAParameterSpec.h" using beecrypt::security::spec::DSAParameterSpec; namespace beecrypt { namespace provider { class DSAPrivateKeyImpl : public Object, public DSAPrivateKey, public Cloneable { private: DSAParameterSpec* _params; BigInteger _x; mutable bytearray* _enc; public: DSAPrivateKeyImpl(const DSAPrivateKey&); DSAPrivateKeyImpl(const DSAPrivateKeyImpl&); DSAPrivateKeyImpl(const DSAParams&, const BigInteger&); DSAPrivateKeyImpl(const dsaparam&, const mpnumber&); DSAPrivateKeyImpl(const BigInteger&, const BigInteger&, const BigInteger&, const BigInteger&); virtual ~DSAPrivateKeyImpl(); virtual DSAPrivateKeyImpl* clone() const throw (); virtual bool equals(const Object* obj) const throw (); virtual const DSAParams& getParams() const throw (); virtual const BigInteger& getX() const throw (); virtual const bytearray* getEncoded() const throw (); virtual const String& getAlgorithm() const throw (); virtual const String* getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/RSAPublicKeyImpl.h0000644000175000001440000000373211216147023021144 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAPublicKeyImpl.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_RSAPUBLICKEYIMPL_H #define _CLASS_RSAPUBLICKEYIMPL_H #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/interfaces/RSAPublicKey.h" using beecrypt::security::interfaces::RSAPublicKey; namespace beecrypt { namespace provider { class RSAPublicKeyImpl : public Object, public RSAPublicKey, public Cloneable { private: BigInteger _n; BigInteger _e; mutable bytearray* _enc; public: RSAPublicKeyImpl(const RSAPublicKey&); RSAPublicKeyImpl(const RSAPublicKeyImpl&); RSAPublicKeyImpl(const BigInteger&, const BigInteger&); virtual ~RSAPublicKeyImpl(); virtual bool equals(const Object* obj) const throw (); virtual RSAPublicKeyImpl* clone() const throw (); virtual const BigInteger& getModulus() const throw (); virtual const BigInteger& getPublicExponent() const throw (); virtual const bytearray* getEncoded() const throw (); virtual const String& getAlgorithm() const throw (); virtual const String* getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/BeeSecureRandom.h0000644000175000001440000000304511216147023021065 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeSecureRandom.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_BEESECURERANDOM_H #define _CLASS_BEESECURERANDOM_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus #include "beecrypt/c++/security/SecureRandomSpi.h" using beecrypt::security::SecureRandomSpi; namespace beecrypt { namespace provider { /*!\ingroup CXX_PROVIDER_m */ class BeeSecureRandom : public SecureRandomSpi { private: randomGeneratorContext _rngc; protected: BeeSecureRandom(const randomGenerator*); private: static SecureRandomSpi* create(); virtual void engineGenerateSeed(byte*, int); virtual void engineNextBytes(byte*, int); virtual void engineSetSeed(const byte*, int); public: BeeSecureRandom(); virtual ~BeeSecureRandom(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DSAKeyPairGenerator.h0000644000175000001440000000345611216147023021633 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAKeyPairGenerator.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DSAKEYPAIRGENERATOR_H #define _CLASS_DSAKEYPAIRGENERATOR_H #ifdef __cplusplus #include "beecrypt/c++/security/KeyPairGeneratorSpi.h" using beecrypt::security::KeyPairGeneratorSpi; #include "beecrypt/c++/security/SecureRandom.h" using beecrypt::security::SecureRandom; #include "beecrypt/c++/security/spec/DSAParameterSpec.h" using beecrypt::security::spec::DSAParameterSpec; namespace beecrypt { namespace provider { class DSAKeyPairGenerator : public KeyPairGeneratorSpi { private: int _size; DSAParameterSpec* _spec; SecureRandom* _srng; KeyPair* genpair(randomGeneratorContext*); protected: virtual KeyPair* engineGenerateKeyPair(); virtual void engineInitialize(const AlgorithmParameterSpec&, SecureRandom*) throw (InvalidAlgorithmParameterException); virtual void engineInitialize(int, SecureRandom*) throw (InvalidParameterException); public: DSAKeyPairGenerator(); virtual ~DSAKeyPairGenerator(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/HMACSHA384.h0000644000175000001440000000224011216147023017361 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file HMACSHA384.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_HMACSHA384_H #define _CLASS_HMACSHA384_H #ifdef __cplusplus #include "beecrypt/c++/provider/HMAC.h" namespace beecrypt { namespace provider { class HMACSHA384 : public HMAC, public Cloneable { public: HMACSHA384(); virtual ~HMACSHA384() {} virtual HMACSHA384* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/AESCipher.h0000644000175000001440000000221511216147023017623 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AESCipher.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_AESCIPHER_H #define _CLASS_AESCIPHER_H #ifdef __cplusplus #include "beecrypt/c++/provider/BlockCipher.h" using beecrypt::provider::BlockCipher; namespace beecrypt { namespace provider { class AESCipher : public BlockCipher { public: AESCipher(); virtual ~AESCipher() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/SHA384withRSASignature.h0000644000175000001440000000230011216147023022051 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA384withRSASignature.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA384WITHRSASIGNATURE_H #define _CLASS_SHA384WITHRSASIGNATURE_H #ifdef __cplusplus #include "beecrypt/c++/provider/PKCS1RSASignature.h" namespace beecrypt { namespace provider { class SHA384withRSASignature : public PKCS1RSASignature { public: SHA384withRSASignature(); virtual ~SHA384withRSASignature() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/BeeKeyStore.h0000644000175000001440000001132311216147023020241 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeKeyStore.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_BEEKEYSTORE_H #define _CLASS_BEEKEYSTORE_H #ifdef __cplusplus #include "beecrypt/c++/security/KeyStoreSpi.h" using beecrypt::security::KeyStoreSpi; #include "beecrypt/c++/security/KeyFactory.h" using beecrypt::security::KeyFactory; #include "beecrypt/c++/security/cert/CertificateFactory.h" using beecrypt::security::cert::CertificateFactory; #include "beecrypt/c++/util/Enumeration.h" using beecrypt::util::Enumeration; #include "beecrypt/c++/util/Hashtable.h" using beecrypt::util::Hashtable; namespace beecrypt { namespace provider { /*!\brief The default BeeCrypt KeyStore. * \ingroup CXX_PROVIDER_m */ class BeeKeyStore : public KeyStoreSpi { private: class Entry : public beecrypt::lang::Object { public: Date date; virtual ~Entry() {} }; class KeyEntry : public Entry { public: bytearray encryptedkey; array chain; KeyEntry() throw (); KeyEntry(const bytearray& key, const array&) throw (CloneNotSupportedException); virtual ~KeyEntry(); }; class CertEntry : public Entry { public: Certificate* cert; CertEntry() throw (); CertEntry(const Certificate&) throw (CloneNotSupportedException); virtual ~CertEntry(); }; class Names : public beecrypt::lang::Object, public virtual beecrypt::util::Enumeration { private: array _list; int _pos; public: Names(Hashtable& h); virtual ~Names(); virtual bool hasMoreElements() throw (); virtual const String* nextElement() throw (NoSuchElementException); }; #if 0 typedef map keyfactory_map; keyfactory_map _keyfactories; typedef map certfactory_map; certfactory_map _certfactories; typedef map entry_map; entry_map _entries; class AliasEnum : public beecrypt::util::Enumeration { private: entry_map::const_iterator _it; entry_map::const_iterator _end; public: AliasEnum(const entry_map&); virtual ~AliasEnum() throw (); virtual bool hasMoreElements() throw (); virtual const String* nextElement() throw (NoSuchElementException); }; void clearall(); #else #endif private: bytearray _bmac; bytearray _salt; int _iter; Hashtable _entries; protected: virtual Enumeration* engineAliases(); virtual bool engineContainsAlias(const String& alias); virtual void engineDeleteEntry(const String& alias) throw (KeyStoreException); virtual const Date* engineGetCreationDate(const String& alias); virtual const Certificate* engineGetCertificate(const String& alias); virtual const String* engineGetCertificateAlias(const Certificate& cert); virtual const array* engineGetCertificateChain(const String& alias); virtual bool engineIsCertificateEntry(const String& alias); virtual void engineSetCertificateEntry(const String& alias, const Certificate& cert) throw (KeyStoreException); virtual Key* engineGetKey(const String& alias, const array& password) throw (NoSuchAlgorithmException, UnrecoverableKeyException); virtual bool engineIsKeyEntry(const String& alias); virtual void engineSetKeyEntry(const String& alias, const bytearray& key, const array&) throw (KeyStoreException); virtual void engineSetKeyEntry(const String& alias, const Key& key, const array& password, const array&) throw (KeyStoreException); virtual int engineSize() const; virtual void engineLoad(InputStream* in, const array* password) throw (IOException, CertificateException, NoSuchAlgorithmException); virtual void engineStore(OutputStream& out, const array* password) throw (IOException, CertificateException, NoSuchAlgorithmException); public: BeeKeyStore(); virtual ~BeeKeyStore() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/BlowfishCipher.h0000644000175000001440000000225311216147023020772 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BlowfishCipher.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_BLOWFISHCIPHER_H #define _CLASS_BLOWFISHCIPHER_H #ifdef __cplusplus #include "beecrypt/c++/provider/BlockCipher.h" using beecrypt::provider::BlockCipher; namespace beecrypt { namespace provider { class BlowfishCipher : public BlockCipher { public: BlowfishCipher(); virtual ~BlowfishCipher() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DHIESCipher.h0000644000175000001440000000740411216147023020054 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHIESCipher.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DHIESCIPHER_H #define _CLASS_DHIESCIPHER_H #ifdef __cplusplus #include "beecrypt/c++/crypto/Cipher.h" using beecrypt::crypto::Cipher; #include "beecrypt/c++/crypto/CipherSpi.h" using beecrypt::crypto::CipherSpi; #include "beecrypt/c++/crypto/KeyAgreement.h" using beecrypt::crypto::KeyAgreement; #include "beecrypt/c++/crypto/Mac.h" using beecrypt::crypto::Mac; #include "beecrypt/c++/crypto/interfaces/DHPrivateKey.h" using beecrypt::crypto::interfaces::DHPrivateKey; #include "beecrypt/c++/crypto/interfaces/DHPublicKey.h" using beecrypt::crypto::interfaces::DHPublicKey; #include "beecrypt/c++/io/ByteArrayOutputStream.h" using beecrypt::io::ByteArrayOutputStream; #include "beecrypt/c++/security/KeyPairGenerator.h" using beecrypt::security::KeyPairGenerator; #include "beecrypt/c++/security/MessageDigest.h" using beecrypt::security::MessageDigest; #include "beecrypt/c++/beeyond/DHIESDecryptParameterSpec.h" using beecrypt::beeyond::DHIESDecryptParameterSpec; namespace beecrypt { namespace provider { class DHIESCipher : public CipherSpi { private: DHIESDecryptParameterSpec* _dspec; DHIESParameterSpec* _spec; SecureRandom* _srng; KeyPairGenerator* _kpg; KeyAgreement* _ka; MessageDigest* _d; Cipher* _c; Mac* _m; DHPublicKey* _msg; ByteArrayOutputStream* _buf; int _opmode; const DHPublicKey* _enc; const DHPrivateKey* _dec; void reset(); protected: virtual bytearray* engineDoFinal(const byte* input, int inputOffset, int inputLength) throw (IllegalBlockSizeException, BadPaddingException); virtual int engineDoFinal(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException, IllegalBlockSizeException, BadPaddingException); virtual int engineGetBlockSize() const throw (); virtual bytearray* engineGetIV(); virtual int engineGetOutputSize(int inputLength) throw (); virtual AlgorithmParameters* engineGetParameters() throw (); virtual void engineInit(int opmode, const Key& key, SecureRandom* random) throw (InvalidKeyException); virtual void engineInit(int opmode, const Key& key, AlgorithmParameters* params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException); virtual void engineInit(int opmode, const Key& key, const AlgorithmParameterSpec& params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException); virtual bytearray* engineUpdate(const byte* input, int inputOffset, int inputLength); virtual int engineUpdate(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException); virtual void engineSetMode(const String& mode) throw (NoSuchAlgorithmException); virtual void engineSetPadding(const String& padding) throw (NoSuchPaddingException); public: DHIESCipher(); virtual ~DHIESCipher(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DSAParameters.h0000644000175000001440000000341411216147023020515 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAParameters.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DSAPARAMETERS_H #define _CLASS_DSAPARAMETERS_H #ifdef __cplusplus #include "beecrypt/c++/security/AlgorithmParametersSpi.h" using beecrypt::security::AlgorithmParametersSpi; #include "beecrypt/c++/security/spec/DSAParameterSpec.h" using beecrypt::security::spec::DSAParameterSpec; namespace beecrypt { namespace provider { class DSAParameters : public AlgorithmParametersSpi { private: DSAParameterSpec* _spec; protected: virtual const bytearray& engineGetEncoded(const String* format = 0) throw (IOException); virtual AlgorithmParameterSpec* engineGetParameterSpec(const type_info&) throw (InvalidParameterSpecException); virtual void engineInit(const AlgorithmParameterSpec&) throw (InvalidParameterSpecException); virtual void engineInit(const byte*, int, const String* format = 0); virtual String engineToString() throw (); public: DSAParameters(); virtual ~DSAParameters(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/SHA1withRSASignature.h0000644000175000001440000000226411216147023021704 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA1withRSASignature.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA1WITHRSASIGNATURE_H #define _CLASS_SHA1WITHRSASIGNATURE_H #ifdef __cplusplus #include "beecrypt/c++/provider/PKCS1RSASignature.h" namespace beecrypt { namespace provider { class SHA1withRSASignature : public PKCS1RSASignature { public: SHA1withRSASignature(); virtual ~SHA1withRSASignature() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DHParameterGenerator.h0000644000175000001440000000334611216147023022071 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHParameterGenerator.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DHPARAMETERGENERATOR_H #define _CLASS_DHPARAMETERGENERATOR_H #include "beecrypt/dldp.h" #ifdef __cplusplus #include "beecrypt/c++/security/AlgorithmParameterGeneratorSpi.h" using beecrypt::security::AlgorithmParameterGeneratorSpi; #include "beecrypt/c++/crypto/spec/DHParameterSpec.h" using beecrypt::crypto::spec::DHParameterSpec; namespace beecrypt { namespace provider { class DHParameterGenerator : public AlgorithmParameterGeneratorSpi { private: int _size; DHParameterSpec* _spec; SecureRandom* _srng; protected: virtual AlgorithmParameters* engineGenerateParameters(); virtual void engineInit(const AlgorithmParameterSpec&, SecureRandom*) throw (InvalidAlgorithmParameterException); virtual void engineInit(int, SecureRandom*) throw (InvalidParameterException); public: DHParameterGenerator(); virtual ~DHParameterGenerator(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/SHA512Digest.h0000644000175000001440000000332511216147023020066 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA512Digest.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA512DIGEST_H #define _CLASS_SHA512DIGEST_H #include "beecrypt/beecrypt.h" #include "beecrypt/sha512.h" #ifdef __cplusplus #include "beecrypt/c++/security/MessageDigestSpi.h" using beecrypt::security::MessageDigestSpi; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; namespace beecrypt { namespace provider { class SHA512Digest : public MessageDigestSpi, public Cloneable { private: sha512Param _param; bytearray _digest; protected: virtual const bytearray& engineDigest(); virtual int engineDigest(byte*, int, int) throw (ShortBufferException); virtual int engineGetDigestLength(); virtual void engineReset(); virtual void engineUpdate(byte); virtual void engineUpdate(const byte*, int, int); public: SHA512Digest(); virtual ~SHA512Digest(); virtual SHA512Digest* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DHKeyFactory.h0000644000175000001440000000343211216147023020356 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHKeyFactory.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DHKEYFACTORY_H #define _CLASS_DHKEYFACTORY_H #ifdef __cplusplus #include "beecrypt/c++/security/KeyFactorySpi.h" using beecrypt::security::InvalidKeyException; using beecrypt::security::Key; using beecrypt::security::KeyFactorySpi; using beecrypt::security::PrivateKey; using beecrypt::security::PublicKey; using beecrypt::security::spec::InvalidKeySpecException; using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace provider { class DHKeyFactory : public KeyFactorySpi { protected: virtual PrivateKey* engineGeneratePrivate(const KeySpec&) throw (InvalidKeySpecException); virtual PublicKey* engineGeneratePublic(const KeySpec&) throw (InvalidKeySpecException); virtual KeySpec* engineGetKeySpec(const Key&, const type_info&) throw (InvalidKeySpecException); virtual Key* engineTranslateKey(const Key&) throw (InvalidKeyException); public: DHKeyFactory(); virtual ~DHKeyFactory() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/BeeCertPathValidator.h0000644000175000001440000000270211216147023022055 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeCertPathValidator.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_BEECERTPATHVALIDATORSPI_H #define _CLASS_BEECERTPATHVALIDATORSPI_H #ifdef __cplusplus #include "beecrypt/c++/security/cert/CertPathValidatorSpi.h" using beecrypt::security::cert::CertPathValidatorSpi; namespace beecrypt { namespace provider { /*!\ingroup CXX_PROVIDER_m */ class BeeCertPathValidator : public CertPathValidatorSpi { protected: virtual CertPathValidatorResult* engineValidate(const CertPath& path, const CertPathParameters& params) throw (CertPathValidatorException, InvalidAlgorithmParameterException); public: virtual ~BeeCertPathValidator(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/SHA256Digest.h0000644000175000001440000000332511216147023020073 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA256Digest.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA256DIGEST_H #define _CLASS_SHA256DIGEST_H #include "beecrypt/beecrypt.h" #include "beecrypt/sha256.h" #ifdef __cplusplus #include "beecrypt/c++/security/MessageDigestSpi.h" using beecrypt::security::MessageDigestSpi; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; namespace beecrypt { namespace provider { class SHA256Digest : public MessageDigestSpi, public Cloneable { private: sha256Param _param; bytearray _digest; protected: virtual const bytearray& engineDigest(); virtual int engineDigest(byte*, int, int) throw (ShortBufferException); virtual int engineGetDigestLength(); virtual void engineReset(); virtual void engineUpdate(byte); virtual void engineUpdate(const byte*, int, int); public: SHA256Digest(); virtual ~SHA256Digest(); virtual SHA256Digest* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DHPrivateKeyImpl.h0000644000175000001440000000450211216147023021202 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHPrivateKeyImpl.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DHPRIVATEKEYIMPL_H #define _CLASS_DHPRIVATEKEYIMPL_H #include "beecrypt/dlsvdp-dh.h" #ifdef __cplusplus #include "beecrypt/c++/crypto/interfaces/DHPrivateKey.h" using beecrypt::crypto::interfaces::DHPrivateKey; #include "beecrypt/c++/crypto/spec/DHParameterSpec.h" using beecrypt::crypto::spec::DHParameterSpec; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; using beecrypt::bytearray; using beecrypt::crypto::interfaces::DHParams; using beecrypt::lang::String; namespace beecrypt { namespace provider { class DHPrivateKeyImpl : public Object, public DHPrivateKey, public Cloneable { private: DHParameterSpec* _params; BigInteger _x; mutable bytearray* _enc; public: DHPrivateKeyImpl(const DHPrivateKey&); DHPrivateKeyImpl(const DHPrivateKeyImpl&); DHPrivateKeyImpl(const DHParams&, const BigInteger&); DHPrivateKeyImpl(const dhparam&, const mpnumber&); DHPrivateKeyImpl(const BigInteger&, const BigInteger&, const BigInteger&); virtual ~DHPrivateKeyImpl(); virtual DHPrivateKeyImpl* clone() const throw (); virtual bool equals(const Object* obj) const throw (); virtual const DHParams& getParams() const throw (); virtual const BigInteger& getX() const throw (); virtual const bytearray* getEncoded() const throw (); virtual const String& getAlgorithm() const throw (); virtual const String* getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/HMACMD5.h0000644000175000001440000000221311216147023017074 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file HMACMD5.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_HMACMD5_H #define _CLASS_HMACMD5_H #ifdef __cplusplus #include "beecrypt/c++/provider/HMAC.h" namespace beecrypt { namespace provider { class HMACMD5 : public HMAC, public Cloneable { public: HMACMD5(); virtual ~HMACMD5() {} virtual HMACMD5* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/PKCS1RSASignature.h0000644000175000001440000000476711216147023021147 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file PKCS1RSASignature.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_PKCS1RSASIGNATURE_H #define _CLASS_PKCS1RSASIGNATURE_H #include "beecrypt/api.h" #include "beecrypt/rsa.h" #ifdef __cplusplus #include "beecrypt/c++/security/SignatureSpi.h" using beecrypt::security::SecureRandom; using beecrypt::security::SignatureSpi; using beecrypt::security::AlgorithmParameters; using beecrypt::security::InvalidAlgorithmParameterException; using beecrypt::security::InvalidKeyException; using beecrypt::security::PrivateKey; using beecrypt::security::PublicKey; using beecrypt::security::ShortBufferException; using beecrypt::security::SignatureException; using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace provider { class PKCS1RSASignature : SignatureSpi { private: rsakp _pair; bool _crt; hashFunctionContext _hfc; SecureRandom* _srng; protected: PKCS1RSASignature(const hashFunction*); virtual AlgorithmParameters* engineGetParameters() const; virtual void engineSetParameter(const AlgorithmParameterSpec&) throw (InvalidAlgorithmParameterException); virtual void engineInitSign(const PrivateKey&, SecureRandom*) throw (InvalidKeyException); virtual void engineInitVerify(const PublicKey&) throw (InvalidKeyException); virtual bytearray* engineSign() throw (SignatureException); virtual int engineSign(byte*, int, int) throw (ShortBufferException, SignatureException); virtual int engineSign(bytearray&) throw (SignatureException); virtual bool engineVerify(const byte*, int, int) throw (SignatureException); virtual void engineUpdate(byte); virtual void engineUpdate(const byte*, int, int); public: virtual ~PKCS1RSASignature() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/MD5Digest.h0000644000175000001440000000327211216147023017611 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file MD5Digest.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_MD5DIGEST_H #define _CLASS_MD5DIGEST_H #include "beecrypt/beecrypt.h" #include "beecrypt/md5.h" #ifdef __cplusplus #include "beecrypt/c++/security/MessageDigestSpi.h" using beecrypt::security::MessageDigestSpi; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; namespace beecrypt { namespace provider { class MD5Digest : public MessageDigestSpi, public Cloneable { private: md5Param _param; bytearray _digest; protected: virtual const bytearray& engineDigest(); virtual int engineDigest(byte*, int, int) throw (ShortBufferException); virtual int engineGetDigestLength(); virtual void engineReset(); virtual void engineUpdate(byte); virtual void engineUpdate(const byte*, int, int); public: MD5Digest(); virtual ~MD5Digest(); virtual MD5Digest* clone() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/SHA512withRSASignature.h0000644000175000001440000000230011216147023022042 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SHA512withRSASignature.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_SHA512WITHRSASIGNATURE_H #define _CLASS_SHA512WITHRSASIGNATURE_H #ifdef __cplusplus #include "beecrypt/c++/provider/PKCS1RSASignature.h" namespace beecrypt { namespace provider { class SHA512withRSASignature : public PKCS1RSASignature { public: SHA512withRSASignature(); virtual ~SHA512withRSASignature() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/MD5withRSASignature.h0000644000175000001440000000225611216147023021576 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file MD5withRSASignature.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_MD5WITHRSASIGNATURE_H #define _CLASS_MD5WITHRSASIGNATURE_H #ifdef __cplusplus #include "beecrypt/c++/provider/PKCS1RSASignature.h" namespace beecrypt { namespace provider { class MD5withRSASignature : public PKCS1RSASignature { public: MD5withRSASignature(); virtual ~MD5withRSASignature() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/RSAPrivateCrtKeyImpl.h0000644000175000001440000000531411216147023022007 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAPrivateCrtKeyImpl.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_RSAPRIVATECRTKEYIMPL_H #define _CLASS_RSAPRIVATECRTKEYIMPL_H #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/interfaces/RSAPrivateCrtKey.h" using beecrypt::security::interfaces::RSAPrivateCrtKey; namespace beecrypt { namespace provider { class RSAPrivateCrtKeyImpl : public Object, public RSAPrivateCrtKey, public Cloneable { private: BigInteger _n; BigInteger _e; BigInteger _d; BigInteger _p; BigInteger _q; BigInteger _dp; BigInteger _dq; BigInteger _qi; mutable bytearray* _enc; public: RSAPrivateCrtKeyImpl(const RSAPrivateCrtKey&); RSAPrivateCrtKeyImpl(const RSAPrivateCrtKeyImpl&); RSAPrivateCrtKeyImpl(const BigInteger& modulus, const BigInteger& publicExponent, const BigInteger& privateExponent, const BigInteger& primeP, const BigInteger& primeQ, const BigInteger& primeExponentP, const BigInteger& primeExponentQ, const BigInteger& crtCoefficient); virtual ~RSAPrivateCrtKeyImpl(); virtual RSAPrivateCrtKeyImpl* clone() const throw (); virtual bool equals(const Object* obj) const throw (); virtual const BigInteger& getModulus() const throw (); virtual const BigInteger& getPrivateExponent() const throw (); virtual const BigInteger& getPublicExponent() const throw (); virtual const BigInteger& getPrimeP() const throw (); virtual const BigInteger& getPrimeQ() const throw (); virtual const BigInteger& getPrimeExponentP() const throw (); virtual const BigInteger& getPrimeExponentQ() const throw (); virtual const BigInteger& getCrtCoefficient() const throw (); virtual const bytearray* getEncoded() const throw (); virtual const String& getAlgorithm() const throw (); virtual const String* getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/HMAC.h0000644000175000001440000000352511216147023016575 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file HMAC.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_HMAC_H #define _CLASS_HMAC_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus #include "beecrypt/c++/crypto/MacSpi.h" using beecrypt::crypto::MacSpi; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; namespace beecrypt { namespace provider { class HMAC : public MacSpi { private: bytearray _key; bytearray _digest; const keyedHashFunction* _kf; const hashFunction* _hf; protected: keyedHashFunctionContext _ctxt; protected: virtual const bytearray& engineDoFinal(); virtual int engineDoFinal(byte*, int, int) throw (ShortBufferException); virtual int engineGetMacLength(); virtual void engineInit(const Key&, const AlgorithmParameterSpec* spec) throw (InvalidKeyException, InvalidAlgorithmParameterException); virtual void engineReset(); virtual void engineUpdate(byte); virtual void engineUpdate(const byte*, int, int); protected: HMAC(const keyedHashFunction&, const hashFunction&); public: virtual ~HMAC() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/KeyProtector.h0000644000175000001440000000373411216147023020521 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyProtector.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_KEYPROTECTOR_H #define _CLASS_KEYPROTECTOR_H #include "beecrypt/api.h" #ifdef __cplusplus #include "beecrypt/c++/crypto/interfaces/PBEKey.h" using beecrypt::crypto::interfaces::PBEKey; #include "beecrypt/c++/security/PrivateKey.h" using beecrypt::security::PrivateKey; #include "beecrypt/c++/security/InvalidKeyException.h" using beecrypt::security::InvalidKeyException; #include "beecrypt/c++/security/UnrecoverableKeyException.h" using beecrypt::security::UnrecoverableKeyException; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; namespace beecrypt { namespace provider { /*!\ingroup CXX_PROVIDER_m */ class KeyProtector { private: byte _cipher_key[32]; byte _mac_key[32]; byte _iv[16]; public: KeyProtector(PBEKey&) throw (InvalidKeyException); ~KeyProtector() throw (); bytearray* protect(const PrivateKey&) throw (); PrivateKey* recover(const bytearray&) throw (NoSuchAlgorithmException, UnrecoverableKeyException); PrivateKey* recover(const byte*, int) throw (NoSuchAlgorithmException, UnrecoverableKeyException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/BeeCertificateFactory.h0000644000175000001440000000272711216147023022256 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeCertificateFactory.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_BEECERTIFICATEFACTORY_H #define _CLASS_BEECERTIFICATEFACTORY_H #ifdef __cplusplus #include "beecrypt/c++/security/cert/CertificateFactorySpi.h" using beecrypt::security::cert::CertificateFactorySpi; namespace beecrypt { namespace provider { /*!\ingroup CXX_PROVIDER_m */ class BeeCertificateFactory : public CertificateFactorySpi { protected: virtual Certificate* engineGenerateCertificate(InputStream& in) throw (CertificateException); virtual Collection* engineGenerateCertificates(InputStream& in) throw (CertificateException); public: BeeCertificateFactory(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/DSAPublicKeyImpl.h0000644000175000001440000000436411216147023021130 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAPublicKeyImpl.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_DSAPUBLICKEYIMPL_H #define _CLASS_DSAPUBLICKEYIMPL_H #include "beecrypt/dsa.h" #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/interfaces/DSAPublicKey.h" using beecrypt::security::interfaces::DSAPublicKey; #include "beecrypt/c++/security/spec/DSAParameterSpec.h" using beecrypt::security::spec::DSAParameterSpec; namespace beecrypt { namespace provider { class DSAPublicKeyImpl : public Object, public DSAPublicKey, public Cloneable { private: DSAParameterSpec* _params; BigInteger _y; mutable bytearray* _enc; public: DSAPublicKeyImpl(const DSAPublicKey&); DSAPublicKeyImpl(const DSAPublicKeyImpl&); DSAPublicKeyImpl(const DSAParams&, const BigInteger&); DSAPublicKeyImpl(const dsaparam&, const mpnumber&); DSAPublicKeyImpl(const BigInteger&, const BigInteger&, const BigInteger&, const BigInteger&); virtual ~DSAPublicKeyImpl(); virtual DSAPublicKeyImpl* clone() const throw (); virtual bool equals(const Object* obj) const throw (); virtual const DSAParams& getParams() const throw (); virtual const BigInteger& getY() const throw (); virtual const bytearray* getEncoded() const throw (); virtual const String& getAlgorithm() const throw (); virtual const String* getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/BeeKeyFactory.h0000644000175000001440000000405511216147023020560 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeKeyFactory.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_BEEKEYFACTORY_H #define _CLASS_BEEKEYFACTORY_H #ifdef __cplusplus #include "beecrypt/c++/security/KeyFactorySpi.h" using beecrypt::security::InvalidKeyException; using beecrypt::security::Key; using beecrypt::security::KeyFactorySpi; using beecrypt::security::PrivateKey; using beecrypt::security::PublicKey; using beecrypt::security::spec::InvalidKeySpecException; using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace provider { /*!\ingroup CXX_PROVIDER_m */ class BeeKeyFactory : public KeyFactorySpi { public: static PrivateKey* decodePrivate(const byte*, size_t, size_t); static PublicKey* decodePublic(const byte*, size_t, size_t); static bytearray* encode(const PrivateKey&); static bytearray* encode(const PublicKey&); protected: virtual PrivateKey* engineGeneratePrivate(const KeySpec&) throw (InvalidKeySpecException); virtual PublicKey* engineGeneratePublic(const KeySpec&) throw (InvalidKeySpecException); virtual KeySpec* engineGetKeySpec(const Key&, const type_info&) throw (InvalidKeySpecException); virtual Key* engineTranslateKey(const Key&) throw (InvalidKeyException); public: BeeKeyFactory(); virtual ~BeeKeyFactory(); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/RSAKeyPairGenerator.h0000644000175000001440000000371111216147023021643 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAKeyPairGenerator.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_RSAKEYPAIRGENERATOR_H #define _CLASS_RSAKEYPAIRGENERATOR_H #ifdef __cplusplus #include "beecrypt/c++/security/KeyPairGeneratorSpi.h" using beecrypt::security::KeyPairGeneratorSpi; using beecrypt::security::KeyPair; #include "beecrypt/c++/security/SecureRandom.h" using beecrypt::security::SecureRandom; #include "beecrypt/c++/security/spec/RSAKeyGenParameterSpec.h" using beecrypt::security::spec::RSAKeyGenParameterSpec; using beecrypt::security::InvalidAlgorithmParameterException; using beecrypt::security::InvalidParameterException; namespace beecrypt { namespace provider { class RSAKeyPairGenerator : public KeyPairGeneratorSpi { private: int _size; BigInteger _e; SecureRandom* _srng; KeyPair* genpair(randomGeneratorContext*); protected: virtual KeyPair* engineGenerateKeyPair(); virtual void engineInitialize(const AlgorithmParameterSpec&, SecureRandom*) throw (InvalidAlgorithmParameterException); virtual void engineInitialize(int, SecureRandom*) throw (InvalidParameterException); public: RSAKeyPairGenerator(); virtual ~RSAKeyPairGenerator() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/provider/RSAKeyFactory.h0000644000175000001440000000353611216147023020515 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAKeyFactory.h * \ingroup CXX_PROVIDER_m */ #ifndef _CLASS_RSAKEYFACTORY_H #define _CLASS_RSAKEYFACTORY_H #include "beecrypt/api.h" #ifdef __cplusplus #include "beecrypt/c++/security/KeyFactorySpi.h" using beecrypt::security::InvalidKeyException; using beecrypt::security::Key; using beecrypt::security::KeyFactorySpi; using beecrypt::security::PrivateKey; using beecrypt::security::PublicKey; using beecrypt::security::spec::InvalidKeySpecException; using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace provider { class RSAKeyFactory : public KeyFactorySpi { friend class BeeCryptProvider; protected: virtual PrivateKey* engineGeneratePrivate(const KeySpec&) throw (InvalidKeySpecException); virtual PublicKey* engineGeneratePublic(const KeySpec&) throw (InvalidKeySpecException); virtual KeySpec* engineGetKeySpec(const Key&, const type_info&) throw (InvalidKeySpecException); virtual Key* engineTranslateKey(const Key&) throw (InvalidKeyException); public: RSAKeyFactory(); virtual ~RSAKeyFactory() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/adapter.h0000644000175000001440000000255011216147022015647 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file adapter.h * \brief In-between layer for BeeCrypt C and C++ code. * \author Bob Deblier */ #ifndef _BEECRYPT_ADAPTER_H #define _BEECRYPT_ADAPTER_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus #include "beecrypt/c++/security/SecureRandom.h" using beecrypt::security::SecureRandom; namespace beecrypt { /*!\brief Class which transforms a SecureRandom generator into a randomGeneratorContext. */ struct BEECRYPTCXXAPI randomGeneratorContextAdapter : randomGeneratorContext { randomGeneratorContextAdapter(SecureRandom* random); }; } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/nio/0000777000175000001440000000000011226307271014732 500000000000000beecrypt-4.2.1/include/beecrypt/c++/nio/ByteBuffer.h0000644000175000001440000000474211216147023017057 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ByteBuffer.h * \ingroup CXX_NIO_m */ #ifndef _CLASS_BYTEBUFFER_H #define _CLASS_BYTEBUFFER_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::bytearray; #include "beecrypt/c++/lang/Comparable.h" using beecrypt::lang::Comparable; #include "beecrypt/c++/nio/Buffer.h" using beecrypt::nio::Buffer; #include "beecrypt/c++/nio/ByteOrder.h" using beecrypt::nio::ByteOrder; #include "beecrypt/c++/nio/ReadOnlyBufferException.h" using beecrypt::nio::ReadOnlyBufferException; /* Note: be careful; we have to derive a MappedByteBuffer class from this one * (which contains an mmap-ed fd) */ namespace beecrypt { namespace nio { class ByteBuffer : public Buffer, public Comparable { private: class fakebytearray : public bytearray { public: ~fakebytearray(); void set(byte* data, size_t size) throw (); }; fakebytearray _fake; byte* _data; bool _free; const ByteOrder* _order; ByteBuffer(const byte*, size_t); ByteBuffer(size_t capacity) throw (std::bad_alloc); public: virtual ~ByteBuffer(); static ByteBuffer* allocate(size_t capacity) throw (std::bad_alloc); static ByteBuffer* allocateDirect(size_t capacity) throw (std::bad_alloc); bytearray& array() throw (ReadOnlyBufferException, UnsupportedOperationException); const bytearray& array() const throw (UnsupportedOperationException); size_t arrayOffset() const throw (ReadOnlyBufferException, UnsupportedOperationException); ByteBuffer* asReadOnlyBuffer(); virtual bool isDirect() const throw (); bool hasArray() const throw (); const ByteOrder& order() const throw (); virtual int compareTo(const ByteBuffer& compare) const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/nio/ReadOnlyBufferException.h0000644000175000001440000000301111216147023021534 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ReadOnlyBufferException.h * \ingroup CXX_NIO_m */ #ifndef _CLASS_BEE_NIO_READONLYBUFFEREXCEPTION_H #define _CLASS_BEE_NIO_READONLYBUFFEREXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/UnsupportedOperationException.h" using beecrypt::lang::String; namespace beecrypt { namespace nio { /* \ingroup CXX_NIO_m */ class ReadOnlyBufferException : public UnsupportedOperationException { public: inline ReadOnlyBufferException() { } inline ReadOnlyBufferException(const char* message) : UnsupportedOperationException(message) { } inline ReadOnlyBufferException(const String* message) : UnsupportedOperationException(message) { } inline ~ReadOnlyBufferException() { } }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/nio/Buffer.h0000644000175000001440000000403711216147023016230 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Buffer.h * \ingroup CXX_NIO_m */ #ifndef _ABSTRACT_CLASS_BEE_NIO_BUFFER_H #define _ABSTRACT_CLASS_BEE_NIO_BUFFER_H #ifdef __cplusplus #include "beecrypt/c++/lang/IllegalArgumentException.h" using beecrypt::lang::IllegalArgumentException; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/nio/InvalidMarkException.h" using beecrypt::nio::InvalidMarkException; namespace beecrypt { namespace nio { class BEECRYPTCXXAPI Buffer : public Object { protected: size_t _capacity; size_t _limit; size_t _mark; size_t _position; bool _marked; bool _readonly; Buffer(size_t capacity, size_t limit, bool readonly); public: virtual ~Buffer() {}; size_t capacity() const throw (); Buffer& clear() throw (); Buffer& flip() throw (); bool hasRemaining() const throw (); virtual bool isReadOnly() const throw () = 0; size_t limit() const throw (); Buffer& limit(size_t newLimit) throw (IllegalArgumentException); Buffer& mark() throw (); size_t position() const throw (); Buffer& position(size_t newPosition) throw (IllegalArgumentException); size_t remaining() const throw (); Buffer& reset() throw (InvalidMarkException); Buffer& rewind() throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/nio/InvalidMarkException.h0000644000175000001440000000274111216147023021077 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file InvalidMarkException.h * \ingroup CXX_NIO_m */ #ifndef _CLASS_BEE_NIO_INVALIDMARKEXCEPTION_H #define _CLASS_BEE_NIO_INVALIDMARKEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/IllegalStateException.h" using beecrypt::lang::IllegalStateException; using beecrypt::lang::String; namespace beecrypt { namespace nio { /*!\ingroup CXX_NIO_m */ class InvalidMarkException : public IllegalStateException { public: inline InvalidMarkException() {} inline InvalidMarkException(const char* message) : IllegalStateException(message) {} inline InvalidMarkException(const String& message) : IllegalStateException(message) {} inline ~InvalidMarkException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/nio/ByteOrder.h0000644000175000001440000000271511216147023016717 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ByteOrder.h * \ingroup CXX_NIO_m */ #ifndef _CLASS_BEE_NIO_BYTEORDER_H #define _CLASS_BEE_NIO_BYTEORDER_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #ifdef BIG_ENDIAN # undef BIG_ENDIAN #endif #ifdef LITTLE_ENDIAN # undef LITTLE_ENDIAN #endif namespace beecrypt { namespace nio { class BEECRYPTCXXAPI ByteOrder : public Object { private: String _name; ByteOrder(const String& name); public: static const ByteOrder BIG_ENDIAN; static const ByteOrder LITTLE_ENDIAN; static const ByteOrder& nativeOrder(); public: virtual ~ByteOrder() {} virtual String toString() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/0000777000175000001440000000000011226307270014553 500000000000000beecrypt-4.2.1/include/beecrypt/c++/io/DataInput.h0000644000175000001440000000365011216147023016532 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DataInput.h * \ingroup CXX_IO_m */ #ifndef _INTERFACE_BEE_IO_DATAINPUT_H #define _INTERFACE_BEE_IO_DATAINPUT_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/io/IOException.h" using beecrypt::io::IOException; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI DataInput { public: virtual ~DataInput() {} virtual bool readBoolean() throw (IOException) = 0; virtual jbyte readByte() throw (IOException) = 0; virtual jchar readChar() throw (IOException) = 0; virtual void readFully(byte* data, jint offset, jint length) = 0; virtual void readFully(bytearray& b) = 0; virtual jint readInt() throw (IOException) = 0; virtual String readLine() throw (IOException) = 0; virtual jlong readLong() throw (IOException) = 0; virtual jshort readShort() throw (IOException) = 0; virtual jint readUnsignedByte() throw (IOException) = 0; virtual jint readUnsignedShort() throw (IOException) = 0; virtual String readUTF() throw (IOException) = 0; virtual jint skipBytes(jint n) throw (IOException) = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/OutputStream.h0000644000175000001440000000332611216147023017315 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file OutputStream.h * \ingroup CXX_IO_m */ #ifndef _ABSTRACT_CLASS_BEE_IO_OUTPUTSTREAM_H #define _ABSTRACT_CLASS_BEE_IO_OUTPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::bytearray; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/io/Closeable.h" using beecrypt::io::Closeable; #include "beecrypt/c++/io/Flushable.h" using beecrypt::io::Flushable; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI OutputStream : public Object, public virtual Closeable, public virtual Flushable { public: virtual ~OutputStream() {} virtual void close() throw (IOException); virtual void flush() throw (IOException); virtual void write(byte b) throw (IOException) = 0; virtual void write(const byte* data, int offset, int length) throw (IOException); virtual void write(const bytearray& b) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/ByteArrayOutputStream.h0000644000175000001440000000352611216147023021142 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ByteArrayOutputStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_BYTEARRAYOUTPUTSTREAM_H #define _CLASS_BEE_IO_BYTEARRAYOUTPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/OutputStream.h" using beecrypt::io::OutputStream; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI ByteArrayOutputStream : public OutputStream { protected: bytearray buf; int count; public: ByteArrayOutputStream(); ByteArrayOutputStream(int size); virtual ~ByteArrayOutputStream(); void reset() throw (); int size() throw (); bytearray* toByteArray(); void toByteArray(bytearray& b); void toByteArray(byte* data, int offset, int length); void writeTo(OutputStream& out) throw (IOException); virtual void close() throw (IOException); virtual void flush() throw (IOException); virtual void write(byte b) throw (IOException); virtual void write(const byte* data, int offset, int length) throw (IOException); virtual void write(const bytearray& b) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/EOFException.h0000644000175000001440000000251011216147023017123 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file EOFException.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_EOFEXCEPTION_H #define _CLASS_BEE_IO_EOFEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/io/IOException.h" using beecrypt::io::IOException; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class EOFException : public IOException { public: inline EOFException() {} inline EOFException(const char* message) : IOException(message) {} inline EOFException(const String& message) : IOException(message) {} inline ~EOFException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/IOException.h0000644000175000001440000000253011216147023017023 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file IOException.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_IOEXCEPTION_H #define _CLASS_BEE_IO_IOEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/Exception.h" using beecrypt::lang::Exception; using beecrypt::lang::String; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class IOException : public Exception { public: inline IOException() {} inline IOException(const char* message) : Exception(message) {} inline IOException(const String& message) : Exception(message) {} inline ~IOException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/ByteArrayInputStream.h0000644000175000001440000000355611216147023020744 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ByteArrayInputStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_BYTEARRAYINPUTSTREAM_H #define _CLASS_BEE_IO_BYTEARRAYINPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/InputStream.h" using beecrypt::io::InputStream; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI ByteArrayInputStream : public InputStream { protected: bytearray _buf; jint _count; jint _mark; jint _pos; public: ByteArrayInputStream(const byte* data, jint offset, jint length); ByteArrayInputStream(const bytearray& b); virtual ~ByteArrayInputStream(); virtual jint available() throw (IOException); virtual void close() throw (IOException); virtual void mark(jint readlimit) throw (); virtual bool markSupported() throw (); virtual jint read() throw (IOException); virtual jint read(byte* data, jint offset, jint length) throw (IOException); virtual jint read(bytearray& b) throw (IOException); virtual void reset() throw (IOException); virtual jint skip(jint n) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/FilterOutputStream.h0000644000175000001440000000307511216147023020464 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file FilterOutputStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_FILTEROUTPUTSTREAM_H #define _CLASS_BEE_IO_FILTEROUTPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/OutputStream.h" using beecrypt::io::OutputStream; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI FilterOutputStream : public OutputStream { protected: OutputStream& out; public: FilterOutputStream(OutputStream& out); virtual ~FilterOutputStream(); virtual void close() throw (IOException); virtual void flush() throw (IOException); virtual void write(byte b) throw (IOException); virtual void write(const byte* data, int offset, int length) throw (IOException); virtual void write(const bytearray& b) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/Closeable.h0000644000175000001440000000224711216147023016533 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Closeable.h * \ingroup CXX_IO_m */ #ifndef _INTERFACE_BEE_IO_CLOSEABLE_H #define _INTERFACE_BEE_IO_CLOSEABLE_H #ifdef __cplusplus #include "beecrypt/c++/io/IOException.h" using beecrypt::io::IOException; namespace beecrypt { namespace io { class BEECRYPTCXXAPI Closeable { public: virtual ~Closeable() {} virtual void close() throw (IOException) = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/PushbackInputStream.h0000644000175000001440000000351511216147023020575 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file PushbackInputStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_PUSHBACKINPUTSTREAM_H #define _CLASS_BEE_IO_PUSHBACKINPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/FilterInputStream.h" using beecrypt::io::FilterInputStream; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI PushbackInputStream : public FilterInputStream { private: bool _closed; protected: bytearray buf; jint pos; public: PushbackInputStream(InputStream& in, jint size = 1); virtual ~PushbackInputStream(); virtual jint available() throw (IOException); virtual void close() throw (IOException); virtual bool markSupported() throw (); virtual jint read() throw (IOException); virtual jint read(byte* data, jint offset, jint length) throw (IOException); virtual jint skip(jint n) throw (IOException); void unread(byte) throw (IOException); void unread(const byte* data, jint offset, jint length) throw (IOException); void unread(const bytearray& b) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/FilterInputStream.h0000644000175000001440000000331511216147023020260 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file FilterInputStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_FILTERINPUTSTREAM_H #define _CLASS_BEE_IO_FILTERINPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/InputStream.h" using beecrypt::io::InputStream; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI FilterInputStream : public InputStream { protected: InputStream& in; public: FilterInputStream(InputStream& in); virtual ~FilterInputStream(); virtual jint available() throw (IOException); virtual void close() throw (IOException); virtual void mark(jint) throw (); virtual bool markSupported() throw (); virtual jint read() throw (IOException); virtual jint read(byte* data, jint offset, jint length) throw (IOException); virtual jint read(bytearray& b) throw (IOException); virtual void reset() throw (IOException); virtual jint skip(jint) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/DataOutput.h0000644000175000001440000000355011216147023016732 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DataOutput.h * \ingroup CXX_IO_m */ #ifndef _INTERFACE_BEE_IO_DATAOUTPUT_H #define _INTERFACE_BEE_IO_DATAOUTPUT_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/io/IOException.h" using beecrypt::io::IOException; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI DataOutput { public: virtual ~DataOutput() {} virtual void write(const bytearray& b) throw (IOException) = 0; virtual void write(const byte* data, jint offset, jint length) throw (IOException) = 0; virtual void write(byte v) throw (IOException) = 0; virtual void writeBoolean(bool v) throw (IOException) = 0; virtual void writeByte(byte v) throw (IOException) = 0; virtual void writeChars(const String& s) throw (IOException) = 0; virtual void writeInt(jint v) throw (IOException) = 0; virtual void writeLong(jlong v) throw (IOException) = 0; virtual void writeShort(jshort v) throw (IOException) = 0; virtual void writeUTF(const String& str) throw (IOException) = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/PrintStream.h0000644000175000001440000000463111216147023017111 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file PrintStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_PRINTSTREAM_H #define _CLASS_BEE_IO_PRINTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/FilterOutputStream.h" using beecrypt::io::FilterOutputStream; #include namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI PrintStream : public FilterOutputStream { private: bool _closed; bool _error; bool _flush; UConverter* _loc; void print(const UChar*, size_t) throw (); protected: void setError() throw (); public: PrintStream(OutputStream& out, bool autoflush = false, const char* encoding = 0); virtual ~PrintStream(); virtual void close() throw (); virtual void flush() throw (); virtual void write(byte b) throw (); virtual void write(const byte* data, size_t offset, size_t length) throw (); bool checkError() throw (); void print(bool) throw (); void print(jchar) throw (); void print(jint) throw (); void print(jlong) throw (); void print(jshort) throw (); // void print(jfloat) throw (); // void print(jdouble) throw (); // void print(const char*) throw (); void print(const array&) throw (); void print(const String&) throw (); void println() throw (); void println(bool) throw (); void println(jchar) throw (); void println(jint) throw (); void println(jlong) throw (); void println(jshort) throw (); // void println(jfloat) throw (); // void println(jdouble) throw (); // void println(const char*) throw (); void println(const array&) throw (); void println(const String&) throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/FileOutputStream.h0000644000175000001440000000303411216147023020111 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file FileOutputStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_FILEOUTPUTSTREAM_H #define _CLASS_BEE_IO_FILEOUTPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/OutputStream.h" using beecrypt::io::OutputStream; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI FileOutputStream : public OutputStream { private: FILE* _f; public: FileOutputStream(FILE* f); virtual ~FileOutputStream(); virtual void close() throw (IOException); virtual void flush() throw (IOException); virtual void write(byte b) throw (IOException); virtual void write(const byte* data, int offset, int length) throw (IOException); virtual void write(const bytearray& b) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/FileInputStream.h0000644000175000001440000000333511216147023017714 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file FileInputStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_FILEINPUTSTREAM_H #define _CLASS_BEE_IO_FILEINPUTSTREAM_H #include #ifdef __cplusplus #include "beecrypt/c++/io/InputStream.h" using beecrypt::io::InputStream; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI FileInputStream : public InputStream { private: FILE* _f; long _mark; public: FileInputStream(FILE* f); virtual ~FileInputStream(); virtual jint available() throw (IOException); virtual void close() throw (IOException); virtual void mark(jint readlimit) throw (); virtual bool markSupported() throw (); virtual jint read() throw (IOException); virtual jint read(byte* data, jint offset, jint length) throw (IOException); virtual jint read(bytearray&) throw (IOException); virtual void reset() throw (IOException); virtual jint skip(jint n) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/DataOutputStream.h0000644000175000001440000000416711216147023020113 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DataOutputStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_DATAOUTPUTSTREAM_H #define _CLASS_BEE_IO_DATAOUTPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/DataOutput.h" using beecrypt::io::DataOutput; #include "beecrypt/c++/io/FilterOutputStream.h" using beecrypt::io::FilterOutputStream; #include namespace beecrypt { namespace io { /*!\ingroup CXX_LANG_m */ class BEECRYPTCXXAPI DataOutputStream : public FilterOutputStream, public virtual DataOutput { private: UConverter* _utf; protected: jint written; public: DataOutputStream(OutputStream& out); virtual ~DataOutputStream(); jint size() const throw (); virtual void write(byte b) throw (IOException); virtual void write(const byte* data, int offset, int length) throw (IOException); virtual void write(const bytearray& b) throw (IOException); virtual void writeBoolean(bool v) throw (IOException); virtual void writeByte(byte v) throw (IOException); virtual void writeChar(jint v) throw (IOException); virtual void writeChars(const String& s) throw (IOException); virtual void writeInt(jint v) throw (IOException); virtual void writeLong(jlong v) throw (IOException); virtual void writeShort(jshort v) throw (IOException); virtual void writeUTF(const String& str) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/InputStream.h0000644000175000001440000000340511216147023017112 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file InputStream.h * \ingroup CXX_IO_m */ #ifndef _ABSTRACT_CLASS_BEE_IO_INPUTSTREAM_H #define _ABSTRACT_CLASS_BEE_IO_INPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::bytearray; #include "beecrypt/c++/io/IOException.h" using beecrypt::io::IOException; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI InputStream : public Object { public: virtual ~InputStream() {}; virtual jint available() throw (IOException); virtual void close() throw (IOException); virtual void mark(jint readlimit) throw (); virtual bool markSupported() throw (); virtual jint read() throw (IOException) = 0; virtual jint read(byte* data, jint offset, jint length) throw (IOException); virtual jint read(bytearray& b) throw (IOException); virtual void reset() throw (IOException); virtual jint skip(jint n) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/Writer.h0000644000175000001440000000371411216147023016116 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Writer.h * \ingroup CXX_IO_m */ #ifndef _ABSTRACT_CLASS_BEE_IO_WRITER_H #define _ABSTRACT_CLASS_BEE_IO_WRITER_H #ifdef __cplusplus #include "beecrypt/c++/lang/Appendable.h" using beecrypt::lang::Appendable; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/io/Closeable.h" using beecrypt::io::Closeable; #include "beecrypt/c++/io/Flushable.h" using beecrypt::io::Flushable; namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI Writer : public Object, public virtual Closeable, public virtual Flushable, public virtual Appendable { protected: Object* lock; Writer(); Writer(Object& lock); public: virtual Writer& append(jchar c) throw (IOException); virtual Writer& append(const CharSequence& cseq) throw (IOException); virtual void write(const array& cbuf) throw (IOException); virtual void write(const jchar* cbuf, jint off, jint len) throw (IOException) = 0; virtual void write(jint c) throw (IOException); virtual void write(const String& str) throw (IOException); virtual void write(const String& str, jint off, jint len) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/DataInputStream.h0000644000175000001440000000421511216147023017704 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DataInputStream.h * \ingroup CXX_IO_m */ #ifndef _CLASS_BEE_IO_DATAINPUTSTREAM_H #define _CLASS_BEE_IO_DATAINPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/DataInput.h" using beecrypt::io::DataInput; #include "beecrypt/c++/io/FilterInputStream.h" using beecrypt::io::FilterInputStream; #include namespace beecrypt { namespace io { /*!\ingroup CXX_IO_m */ class BEECRYPTCXXAPI DataInputStream : public FilterInputStream, public virtual DataInput { private: bool _del; InputStream* _pin; UConverter* _utf; UConverter* _loc; public: DataInputStream(InputStream& in); virtual ~DataInputStream(); virtual bool readBoolean() throw (IOException); virtual jbyte readByte() throw (IOException); virtual jchar readChar() throw (IOException); virtual void readFully(byte* data, jint offset, jint length) throw (IOException); virtual void readFully(bytearray& b) throw (IOException); virtual jint readInt() throw (IOException); virtual String readLine() throw (IOException); virtual jlong readLong() throw (IOException); virtual jshort readShort() throw (IOException); virtual jint readUnsignedByte() throw (IOException); virtual jint readUnsignedShort() throw (IOException); virtual String readUTF() throw (IOException); virtual jint skipBytes(jint n) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/io/Flushable.h0000644000175000001440000000224711216147023016547 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Flushable.h * \ingroup CXX_IO_m */ #ifndef _INTERFACE_BEE_IO_FLUSHABLE_H #define _INTERFACE_BEE_IO_FLUSHABLE_H #ifdef __cplusplus #include "beecrypt/c++/io/IOException.h" using beecrypt::io::IOException; namespace beecrypt { namespace io { class BEECRYPTCXXAPI Flushable { public: virtual ~Flushable() {} virtual void flush() throw (IOException) = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/0000777000175000001440000000000011226307271015122 500000000000000beecrypt-4.2.1/include/beecrypt/c++/util/AbstractSet.h0000644000175000001440000000532211216147023017424 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AbstractSet.h * \ingroup CXX_UTIL_m */ #ifndef _ABSTRACT_CLASS_BEE_UTIL_ABSTRACTSET_H #define _ABSTRACT_CLASS_BEE_UTIL_ABSTRACTSET_H #ifdef __cplusplus #include "beecrypt/c++/util/AbstractCollection.h" using beecrypt::util::AbstractCollection; #include "beecrypt/c++/util/Set.h" using beecrypt::util::Set; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m * \warning See the description of beecrypt::util:Collection for limitations * on template parameter class E. */ template class AbstractSet : public AbstractCollection, public virtual Set { protected: AbstractSet() {} public: virtual bool equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { if (!dynamic_cast*>(obj)) return false; const Collection* c = dynamic_cast*>(obj); if (c->size() != size()) return false; return containsAll(*c); } return false; } virtual jint hashCode() const throw () { jint pos = size(), result = 0; Iterator* it = iterator(); assert(it != 0); while (--pos >= 0) { E* e = it->next(); result += e->hashCode(); } delete it; return result; } virtual Iterator* iterator() = 0; virtual Iterator* iterator() const = 0; virtual bool removeAll(const Collection& c) { bool result = false; jint pos = size(), cpos = c.size(); if (pos > cpos) { Iterator* it = c.iterator(); assert(it != 0); while (--cpos >= 0) result |= AbstractCollection::remove(it->next()); delete it; } else { Iterator* it = iterator(); assert(it != 0); while (--pos >= 0) if (c.contains(it->next())) { it->remove(); result = true; } delete it; } return result; } virtual jint size() const throw () = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Collection.h0000644000175000001440000000511511216147023017300 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Collection.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_COLLECTION_H #define _INTERFACE_BEE_UTIL_COLLECTION_H #ifdef __cplusplus #include "beecrypt/c++/util/Iterable.h" using beecrypt::util::Iterable; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m * * \note In deviation from the Java API, the add(), contains() and remove() * methods take the template parameter class E as parameter rather than * Object. * * There is a very important reason for this: in Java, even an interface is * an Object, but in this API it isn't. Using Object as parameter would * mean a great deal of dynamic_cast operations. * * From the OO point-of-view it makes much more sense that a collection of E * should only accept elements of class E as parameters. * * \warning If you do not use a parameter that is a subclass of Object (e.g. * an interface), then you must guarantee that it has a method which matches * Object::equals(). * */ template class Collection : public virtual Iterable { public: virtual ~Collection() {} virtual bool add(E* e) = 0; virtual bool addAll(const Collection& c) = 0; virtual void clear() = 0; virtual bool contains(const E* e) const = 0; virtual bool containsAll(const Collection& c) const = 0; virtual bool equals(const Object* obj) const throw () = 0; virtual jint hashCode() const throw () = 0; virtual bool isEmpty() const throw () = 0; virtual Iterator* iterator() = 0; virtual Iterator* iterator() const = 0; virtual bool remove(const E* e) = 0; virtual bool removeAll(const Collection& c) = 0; virtual bool retainAll(const Collection& c) = 0; virtual jint size() const throw () = 0; virtual array toArray() const = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Hashtable.h0000644000175000001440000004106611216147023017105 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Hashtable.h * \ingroup CXX_UTIL_m */ #ifndef _CLASS_BEE_UTIL_HASHTABLE_H #define _CLASS_BEE_UTIL_HASHTABLE_H #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/Integer.h" using beecrypt::lang::Integer; #include "beecrypt/c++/lang/IllegalStateException.h" using beecrypt::lang::IllegalStateException; #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/lang/OutOfMemoryError.h" using beecrypt::lang::OutOfMemoryError; #include "beecrypt/c++/lang/UnsupportedOperationException.h" using beecrypt::lang::UnsupportedOperationException; #include "beecrypt/c++/util/Map.h" using beecrypt::util::Map; #include "beecrypt/c++/util/AbstractSet.h" using beecrypt::util::AbstractSet; #include "beecrypt/c++/util/ConcurrentModificationException.h" using beecrypt::util::ConcurrentModificationException; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ template class Hashtable : public Object, public virtual Map, public virtual Cloneable { private: class Entry : public Object, public virtual Map::Entry, public virtual Cloneable { public: jint hash; K* key; V* value; Entry* next; Entry(jint hash, K* key, V* value, Entry* next = 0) : hash(hash), key(key), value(value), next(next) { } Entry(const Entry& copy) : hash(copy.hash), key(copy.key), value(copy.value), next(copy.next ? new Entry(*copy.next) : 0) { } virtual ~Entry() {} virtual Entry* clone() const throw (CloneNotSupportedException) { return new Entry(*this); } virtual bool equals(const class Map::Entry* e) const throw () { if (this == e) return true; return (key ? key->equals(e->getKey()) : (e->getKey() == 0)) && (value ? value->equals(e->getValue()) : (e->getValue() == 0)); } virtual bool equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const class Map::Entry* e = dynamic_cast::Entry*>(obj); if (e) return (key ? key->equals(e->getKey()) : (e->getKey() == 0)) && (value ? value->equals(e->getValue()) : (e->getValue() == 0)); } return false; } virtual K* getKey() const { return key; } virtual V* getValue() const { return value; } virtual jint hashCode() const throw () { return hash ^ (value ? value->hashCode() : 0); } virtual V* setValue(V* val) { if (val) { V* result = value; value = val; return result; } else throw NullPointerException(); } virtual String toString() const throw () { StringBuilder tmp; return tmp.append(key).append('=').append(value).toString(); } }; class HashIter : public Object { private: Hashtable* _ht; const Hashtable* _const_ht; protected: Entry* next; Entry* current; jint index; jint expect; protected: HashIter(Hashtable* h) : _ht(h), _const_ht(h) { expect = _const_ht->_modCount; index = _const_ht->_table.size(); next = current = 0; if (_const_ht->_count) while ((index > 0) && ((next = _const_ht->_table[--index]) == 0)); } HashIter(const Hashtable* h) : _ht(0), _const_ht(h) { expect = _const_ht->_modCount; index = _const_ht->_table.size(); next = current = 0; if (_const_ht->_count) while ((index > 0) && ((next = _const_ht->_table[--index]) == 0)); } public: virtual ~HashIter() {} virtual bool hasNext() throw () { return (next != 0); } Entry* nextEntry() throw (NoSuchElementException, ConcurrentModificationException) { if (_const_ht->_modCount != expect) throw ConcurrentModificationException(); Entry* e = next; if (!e) throw NoSuchElementException(); next = e->next; while (!next && index > 0) next = _const_ht->_table[--index]; return current = e; } virtual void remove() { if (!_ht) throw UnsupportedOperationException("Cannot remove items through const iterator"); if (!current) throw IllegalStateException(); if (_ht->_modCount != expect) throw ConcurrentModificationException(); K* key = current->key; current = 0; Entry* e = _ht->removeEntryForKey(key); if (e) { collection_remove(e->key); collection_remove(e->value); delete e; } expect = _ht->_modCount; } }; class EntryIter : public HashIter, public virtual Iterator::Entry> { public: EntryIter(Hashtable* h) : HashIter(h) { } EntryIter(const Hashtable* h) : HashIter(h) { } virtual ~EntryIter() {} virtual bool hasNext() throw () { return HashIter::hasNext(); } virtual class Map::Entry* next() throw (NoSuchElementException) { return this->nextEntry(); } virtual void remove() { HashIter::remove(); } }; class KeyIter : public HashIter, public virtual Iterator { public: KeyIter(Hashtable* h) : HashIter(h) { } KeyIter(const Hashtable* h) : HashIter(h) { } virtual ~KeyIter() {} virtual bool hasNext() throw () { return HashIter::hasNext(); } virtual K* next() throw (NoSuchElementException) { return this->nextEntry()->key; } virtual void remove() { HashIter::remove(); } }; class ValueIter : public HashIter, public virtual Iterator { public: ValueIter(Hashtable* h) : HashIter(h) { } ValueIter(const Hashtable* h) : HashIter(h) { } virtual ~ValueIter() {} virtual bool hasNext() throw () { return HashIter::hasNext(); } virtual V* next() throw (NoSuchElementException) { return this->nextEntry()->value; } virtual void remove() { HashIter::remove(); } }; class EntrySet : public AbstractSet::Entry> { private: Hashtable*_ht; public: EntrySet(Hashtable* h) : _ht(h) { } virtual ~EntrySet() {} virtual jint size() const throw () { return _ht->size(); } virtual Iterator::Entry>* iterator() { return new EntryIter(_ht); } virtual Iterator::Entry>* iterator() const { return new EntryIter(_ht); } }; class KeySet : public AbstractSet { private: Hashtable* _ht; public: KeySet(Hashtable* h) : _ht(h) { } virtual ~KeySet() {} virtual jint size() const throw () { return _ht->size(); } virtual Iterator* iterator() { return new KeyIter(_ht); } virtual Iterator* iterator() const { return new KeyIter(_ht); } }; class ValueCollection : public AbstractCollection { private: Hashtable* _ht; public: ValueCollection(Hashtable* h) : _ht(h) { } virtual ~ValueCollection() {} virtual jint size() const throw () { return _ht->size(); } virtual Iterator* iterator() { return new ValueIter(_ht); } virtual Iterator* iterator() const { return new ValueIter(_ht); } }; private: array _table; jint _count; jint _threshold; jfloat _loadFactor; jint _modCount; mutable bool _hashing; mutable Set::Entry>* _entries; mutable Set* _keys; mutable Collection* _values; protected: Entry* removeEntryForKey(const K* key) { jint hash = key->hashCode(); jint index = (hash & Integer::MAX_VALUE) % _table.size(); Entry* prev = 0; for (Entry* e = _table[index]; e; prev = e, e = e->next) if (hash == e->hash && key->equals(e->key)) { _modCount++; if (prev) prev->next = e->next; else _table[index] = e->next; _count--; return e; } return 0; } public: Hashtable(jint initialCapacity = 15, jfloat loadFactor = 0.75) { if (initialCapacity < 0 || loadFactor <= 0.0) throw IllegalArgumentException(); if (initialCapacity == 0) initialCapacity = 1; _table.resize(initialCapacity); _threshold = (jint)(initialCapacity * (_loadFactor = loadFactor)); _count = 0; _modCount = 0; _entries = 0; _keys = 0; _values = 0; _hashing = false; } Hashtable(const Hashtable& copy) : _table(copy._table.size()) { _loadFactor = copy._loadFactor; _threshold = copy._threshold; _count = 0; _modCount = 0; _entries = 0; _keys = 0; _values = 0; _hashing = false; putAll(copy); } virtual ~Hashtable() { clear(); delete _entries; delete _keys; delete _values; } virtual void clear() { synchronized (this) { _modCount++; for (jint index = _table.size(); index-- > 0; ) { for (Entry* e = _table[index]; e; ) { Entry *tmp = e->next; collection_remove(e->key); collection_remove(e->value); delete e; e = tmp; } _table[index] = 0; } _count = 0; } } virtual Object* clone() const throw (CloneNotSupportedException) { Object* result = 0; synchronized (this) { result = new Hashtable(*this); } return result; } virtual bool contains(const Object* obj) const { const V* value = dynamic_cast(obj); if (value) return containsValue(value); else return false; } virtual bool containsKey(const K* key) const { if (!key) throw NullPointerException(); synchronized (this) { jint index = (key->hashCode() & Integer::MAX_VALUE) % _table.size(); for (Entry* e = _table[index]; e; e = e->next) if (e->key->equals(key)) return true; } return false; } virtual bool containsValue(const V* value) const { if (!value) throw NullPointerException(); synchronized (this) { for (jint i = 0; i < _table.size(); i++) for (Entry* e = _table[i]; e; e = e->next) if (e->value->equals(value)) return true; } return false; } virtual Set::Entry>& entrySet() { if (!_entries) { synchronized (this) { if (!_entries) _entries = new EntrySet(this); } } return *_entries; } virtual const Set::Entry>& entrySet() const { if (!_entries) { synchronized (this) { if (!_entries) _entries = new EntrySet(const_cast(this)); } } return *_entries; } virtual bool equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const Map* map = dynamic_cast*>(obj); if (map) { synchronized (this) { if (_count != map->size()) return false; try { bool result = true; Iterator::Entry>* mit = map->entrySet().iterator(); assert(mit != 0); while (mit->hasNext()) { class Map::Entry* me = mit->next(); K* key = me->getKey(); V* value = me->getValue(); if (value) { if (!(map->get(key) == 0 && map->containsKey(key))) { result = false; break; } } else { if (!value->equals(map->get(key))) { result = false; break; } } } delete mit; return result; } catch (Exception&) { } } } } return false; } virtual V* get(const K* key) const { if (key) { synchronized (this) { jint index = (key->hashCode() & Integer::MAX_VALUE) % _table.size(); for (Entry* e = _table[index]; e; e = e->next) if (e->key->equals(key)) return e->value; } return 0; } else throw NullPointerException(); } virtual jint hashCode() const throw () { jint result = 0; synchronized (this) { if (_count == 0 || _hashing) return 0; _hashing = true; for (jint i = 0; i < _table.size(); i++) for (Entry* e = _table[i]; e; e = e->next) result += e->key->hashCode() ^ e->value->hashCode(); _hashing = false; } return result; } virtual bool isEmpty() const throw () { bool result = true; synchronized (this) { result = (_count == 0); } return result; } virtual Set& keySet() { if (_keys) { synchronized (this) { if (!_keys) _keys = new KeySet(this); } } return *_keys; } virtual const Set& keySet() const { if (_keys) { synchronized (this) { if (!_keys) _keys = new KeySet(const_cast(this)); } } return *_keys; } virtual V* put(K* key, V* value) { if (key && value) { jint hash = key->hashCode(); synchronized (this) { jint index = (hash & Integer::MAX_VALUE) % _table.size(); for (Entry* e = _table[index]; e != 0; e = e->next) { if (key->equals(e->key)) { // Existing key V* result = e->value; e->value = value; collection_attach(value); collection_detach(result); return result; } } // Non-existing key _modCount++; if (_count >= _threshold) { // Re-hash jint oldsize = _table.size(); if (oldsize == Integer::MAX_VALUE) throw OutOfMemoryError(); jint newsize = (_table.size() << 1) + 1; // test if overflow occured if (newsize < oldsize) newsize = Integer::MAX_VALUE; array retable(newsize); for (jint i = oldsize; i-- > 0; ) { for (Entry* e = _table[i]; e != 0; ) { Entry* tmp = e->next; index = (e->hash & Integer::MAX_VALUE) % newsize; e->next = retable[index]; retable[index] = e; e = tmp; } } // Swap retable and _table contents _table.swap(retable); _threshold = (jint)(newsize * _loadFactor); index = (hash & Integer::MAX_VALUE) % _table.size(); } Entry* tmp = _table[index]; _table[index] = new Entry(hash, key, value, tmp); _count++; collection_attach(key); collection_attach(value); } return 0; } else throw NullPointerException(); } virtual void putAll(const Map& m) { Iterator::Entry>* mit = m.entrySet().iterator(); assert(mit != 0); while (mit->hasNext()) { class Map::Entry* e = mit->next(); V* tmp = put(e->getKey(), e->getValue()); collection_rcheck(tmp); } delete mit; } virtual V* remove(const K* key) { if (key) { Entry* e = removeEntryForKey(key); if (e) { V* result = e->value; collection_remove(e->key); collection_detach(result); delete e; return result; } return 0; } else throw NullPointerException(); } virtual jint size() const throw () { jint result = 0; synchronized (this) { result = _count; } return result; } virtual Collection& values() { if (!_values) { synchronized (this) { if (!_values) _values = new ValueCollection(this); } } return *_values; } virtual const Collection& values() const { if (!_values) { synchronized (this) { if (!_values) _values = new ValueCollection(const_cast(this)); } } return *_values; } }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/RandomAccess.h0000644000175000001440000000214211216147023017544 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RandomAccess.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_RANDOMACCESS_H #define _INTERFACE_BEE_UTIL_RANDOMACCESS_H #ifdef __cplusplus #include "beecrypt/c++/util/Iterator.h" using beecrypt::util::Iterator; namespace beecrypt { namespace util { class BEECRYPTCXXAPI RandomAccess { }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/ConcurrentModificationException.h0000644000175000001440000000304311216147023023532 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ConcurrentModificationException.h * \ingroup CXX_UTIL_m */ #ifndef _CLASS_BEE_UTIL_CONCURRENTMODIFICATIONEXCEPTION_H #define _CLASS_BEE_UTIL_CONCURRENTMODIFICATIONEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ class ConcurrentModificationException : public RuntimeException { public: inline ConcurrentModificationException() {} inline ConcurrentModificationException(const char* message) : RuntimeException(message) {} inline ConcurrentModificationException(const String& message) : RuntimeException(message) {} inline ~ConcurrentModificationException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Iterable.h0000644000175000001440000000232011216147023016727 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Iterable.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_ITERABLE_H #define _INTERFACE_BEE_UTIL_ITERABLE_H #ifdef __cplusplus #include "beecrypt/c++/util/Iterator.h" using beecrypt::util::Iterator; namespace beecrypt { namespace util { template class Iterable { public: virtual ~Iterable() {} virtual Iterator* iterator() = 0; virtual Iterator* iterator() const = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/AbstractCollection.h0000644000175000001440000001207611216147023020770 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AbstractCollection.h * \ingroup CXX_UTIL_m */ #ifndef _ABSTRACT_CLASS_BEE_UTIL_ABSTRACTCOLLECTION_H #define _ABSTRACT_CLASS_BEE_UTIL_ABSTRACTCOLLECTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/Comparable.h" using beecrypt::lang::Comparable; #include "beecrypt/c++/lang/StringBuilder.h" using beecrypt::lang::StringBuilder; #include "beecrypt/c++/lang/ClassCastException.h" using beecrypt::lang::ClassCastException; #include "beecrypt/c++/lang/UnsupportedOperationException.h" using beecrypt::lang::UnsupportedOperationException; #include "beecrypt/c++/util/Collection.h" using beecrypt::util::Collection; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m * \warning See the description of beecrypt::util:Collection for limitations * on template parameter class E. */ template class AbstractCollection : public Object, public virtual Collection { protected: AbstractCollection() {} static inline bool equals(const E* e1, const E* e2) { if (e1 && e2) return e1->equals(e2); else return e1 == e2; } public: virtual ~AbstractCollection() {} virtual bool add(E* e) { throw UnsupportedOperationException(); } virtual bool addAll(const Collection& c) { bool result = false; jint pos = c.size(); Iterator* it = iterator(); assert(it != 0); while (--pos >= 0) result |= add(it->next()); delete it; return result; } virtual void clear() { jint pos = size(); Iterator* it = iterator(); assert(it != 0); while (--pos >= 0) { it->next(); it->remove(); } delete it; } virtual bool contains(const E* e) const { bool result = false; jint pos = size(); Iterator* it = iterator(); assert(it != 0); while (--pos >= 0) { if (equals(e, it->next())) { result = true; break; } } delete it; return result; } virtual bool containsAll(const Collection& c) const { bool result = true; jint pos = c.size(); Iterator* cit = c.iterator(); assert(cit != 0); while (--pos >= 0) if (!contains(cit->next())) { result = false; break; } delete cit; return result; } virtual bool equals(const Object* obj) const throw () { return Object::equals(obj); } virtual jint hashCode() const throw () { return Object::hashCode(); } virtual bool isEmpty() const throw () { return size() == 0; } virtual Iterator* iterator() = 0; virtual Iterator* iterator() const = 0; virtual bool remove(const E* e) { bool result = false; jint pos = size(); Iterator* it = iterator(); assert(it != 0); while (--pos >= 0) { if (equals(e, it->next())) { it->remove(); result = true; break; } } delete it; return result; } virtual bool removeAll(const Collection& c) { bool result = false; jint pos = size(); Iterator* it = iterator(); assert(it != 0); while (--pos >= 0) if (c.contains(it->next())) { it->remove(); result = true; break; } delete it; return result; } virtual bool retainAll(const Collection& c) { bool result = false; jint pos = c.size(); Iterator* it = c.iterator(); assert(it != 0); while (--pos >= 0) if (!c.contains(it->next())) { it->remove(); result = true; break; } delete it; return result; } virtual jint size() const throw () = 0; virtual array toArray() const { jint pos = size(); array result(pos); Iterator* it = iterator(); assert(it != 0); for (jint i = 0; --pos >= 0; i++) result[i] = it->next(); delete it; return result; } virtual String toString() const throw () { Iterator* it = iterator(); assert(it != 0); StringBuilder buf("["); for (jint pos = size(); pos > 0; pos--) { E* e = it->next(); if (reinterpret_cast(e) == reinterpret_cast(this)) buf.append("(this Collection)"); else buf.append(e); if (pos > 1) buf.append(", "); } delete it; buf.append("]"); return buf.toString(); } }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/AbstractMap.h0000644000175000001440000002143211216147023017406 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AbstractMap.h * \ingroup CXX_UTIL_m */ #ifndef _ABSTRACT_CLASS_BEE_UTIL_ABSTRACTMAP_H #define _ABSTRACT_CLASS_BEE_UTIL_ABSTRACTMAP_H #ifdef __cplusplus #include "beecrypt/c++/lang/NullPointerException.h" using beecrypt::lang::NullPointerException; #include "beecrypt/c++/util/Map.h" using beecrypt::util::Map; #include "beecrypt/c++/util/AbstractSet.h" using beecrypt::util::AbstractSet; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ template class AbstractMap : public Object, public virtual Map { private: class KeySet : public AbstractSet { private: class Iter : public Object, virtual public Iterator { private: Iterator::Entry>* _it; public: Iter(AbstractMap* m) : _it(m->entrySet().iterator()) { } Iter(const AbstractMap* m) : _it(m->entrySet().iterator()) { } virtual ~Iter() { delete _it; } virtual bool hasNext() throw () { return _it->hasNext(); } virtual K* next() throw (NoSuchElementException) { return _it->next()->getKey(); } virtual void remove() { _it->remove(); } }; private: AbstractMap* _m; public: KeySet(AbstractMap* m) : _m(m) { } virtual ~KeySet() {} virtual Iterator* iterator() { return new Iter(_m); } virtual Iterator* iterator() const { return new Iter(_m); } virtual jint size() const throw () { return _m->size(); } }; class Values : public AbstractCollection { private: class Iter : public Object, virtual public Iterator { private: Iterator::Entry>* _it; public: Iter(AbstractMap* m) : _it(m->entrySet().iterator()) { } Iter(const AbstractMap* m) : _it(m->entrySet().iterator()) { } virtual ~Iter() { delete _it; } virtual bool hasNext() throw () { return _it->hasNext(); } virtual V* next() throw (NoSuchElementException) { return _it->next()->getValue(); } virtual void remove() { _it->remove(); } }; private: AbstractMap* _m; public: Values(AbstractMap* m) : _m(m) { } virtual ~Values() {} virtual Iterator* iterator() { return new Iter(_m); } virtual Iterator* iterator() const { return new Iter(_m); } virtual jint size() const throw () { return _m->size(); } }; private: mutable Set* _keys; mutable Collection* _values; protected: AbstractMap() { _keys = 0; _values = 0; } public: virtual ~AbstractMap() { clear(); delete _keys; delete _values; } virtual void clear() { entrySet().clear(); } virtual bool containsKey(const K* key) const { bool result = false; jint pos = size(); Iterator::Entry>* it = entrySet().iterator(); assert(it != 0); if (key) { while (--pos >= 0) { class Map::Entry* e = it->next(); if (e->getKey->equals(key)) { result = true; break; } } } else { while (--pos >= 0) if (!it->next()) { result = true; break; } } delete it; return result; } virtual bool containsValue(const V* value) const { bool result = false; jint pos = size(); Iterator::Entry>* it = entrySet().iterator(); assert(it != 0); if (value) { while (--pos >= 0) { V* tmp = it->next()->getValue(); if (tmp && tmp->equals(value)) { result = true; break; } } } else { while (--pos >= 0) if (!it->next()) { result = true; break; } } delete it; return false; } virtual Set::Entry>& entrySet() = 0; virtual const Set::Entry>& entrySet() const = 0; virtual bool equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const Map* map = dynamic_cast >(obj); if (map) { if (map->size() != size()) return false; bool result = true; jint pos = size(); Iterator::Entry>* it = entrySet().iterator(); assert(it != 0); while (--pos >= 0) { class Map::Entry* e = it.next(); K* k = e->getKey(); V* v = e->getValue(); if (v) { if (!v->equals(map->get(k))) { result = false; break; } } else { if (map->get(k) || !map->containsKey(k)) { result = false; break; } } } delete it; return result; } } return false; } virtual V* get(const Object* key) const { V* result = 0; jint pos = size(); Iterator::Entry>* it = entrySet().iterator(); assert(it != 0); if (key) { while (--pos >= 0) { class Map::Entry* e = it->next(); if (key->equals(e->getKey())) { result = e->getValue(); break; } } } else { while (--pos >= 0) { class Map::Entry* e = it->next(); if (!e->getKey()) { result = e->getValue(); break; } } } delete it; return result; } virtual jint hashCode() const throw () { jint pos = size(), result = 0; Iterator::Entry>* it = entrySet().iterator(); assert(it != 0); while (--pos >= 0) result += it->next()->hashCode(); delete it; return result; } virtual bool isEmpty() { return entrySet().size() == 0; } virtual Set& keySet() { if (!_keys) _keys = new KeySet(this); return *_keys; } virtual const Set& keySet() const { if (!_keys) _keys = new KeySet(const_cast(this)); return *_keys; } virtual V* put(K* key, V* value) { throw UnsupportedOperationException(); } virtual void putAll(const Map& m) { jint pos = m.size(); Iterator::Entry>* mit = m.entrySet().iterator(); assert(mit != 0); while (--pos >= 0) { class Map::Entry* e = mit->next(); V* tmp = put(e->getKey(), e->getValue()); collection_rcheck(tmp); } delete mit; } virtual V* remove(const K* key) { V* result = 0; jint pos = size(); Iterator::Entry>* it = entrySet().iterator(); assert(it != 0); if (key) { while (--pos >= 0) { class Map::Entry* e = it->next(); if (key->equals(e->getKey())) { result = e->getValue(); break; } } } else { while (--pos >= 0) { class Map::Entry* e = it->next(); if (!e->getKey()) { result = e->getValue(); break; } } } if (result) it->remove(); delete it; return result; } virtual jint size() { return entrySet().size(); } virtual String toString() const throw () { Iterator::Entry>& it = entrySet.iterator(); StringBuilder buf("{"); for (jint pos = size(); pos > 0; pos--) { class Map::Entry* e = it.next(); K* k = e->getKey(); V* v = e->getValue(); if (k == this) buf.append("(this map)"); else buf.append(k); buf.append("="); if (v == this) buf.append("(this map)"); else buf.append(v); if (pos > 1) buf.append(", "); } buf.append("}"); return buf.toString(); } virtual Collection& values() { if (!_values) _values = new Values(this); return *_values; } virtual const Collection& values() const { if (!_values) _values = new Values(const_cast(this)); return *_values; } }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Enumeration.h0000644000175000001440000000246411216147023017477 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Enumeration.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_ENUMERATION_H #define _INTERFACE_BEE_UTIL_ENUMERATION_H #ifdef __cplusplus #include "beecrypt/c++/util/NoSuchElementException.h" using beecrypt::util::NoSuchElementException; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ template class Enumeration { public: virtual ~Enumeration() {} virtual bool hasMoreElements() throw () = 0; virtual E* nextElement() throw (NoSuchElementException) = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/ListIterator.h0000644000175000001440000000304711216147023017634 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ListIterator.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_LISTITERATOR_H #define _INTERFACE_BEE_UTIL_LISTITERATOR_H #ifdef __cplusplus #include "beecrypt/c++/util/Iterator.h" using beecrypt::util::Iterator; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ template class ListIterator : public virtual Iterator { public: virtual void add(E* e) = 0; virtual bool hasNext() throw () = 0; virtual bool hasPrevious() throw () = 0; virtual E* next() throw (NoSuchElementException) = 0; virtual int nextIndex() throw () = 0; virtual E* previous() throw (NoSuchElementException) = 0; virtual int previousIndex() throw () = 0; virtual void remove() = 0; virtual void set(E* e) = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Queue.h0000644000175000001440000000244111216147023016270 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Queue.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_QUEUE_H #define _INTERFACE_BEE_UTIL_QUEUE_H #ifdef __cplusplus #include "beecrypt/c++/util/Collection.h" using beecrypt::util::Collection; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ template class Queue : public virtual Collection { public: virtual E* element() = 0; virtual bool offer(E*) = 0; virtual E* peek() = 0; virtual E* poll() = 0; virtual E* remove() = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Date.h0000644000175000001440000000337511216147023016070 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Date.h * \ingroup CXX_UTIL_m */ #ifndef _CLASS_DATE_H #define _CLASS_DATE_H #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ class BEECRYPTCXXAPI Date : public Object, public Cloneable, public Comparable { private: jlong _time; public: Date() throw (); Date(jlong) throw (); virtual ~Date() {} virtual Date* clone() const throw (); virtual bool equals(const Object* obj) const throw (); bool equals(const Date& d) const throw (); virtual jint compareTo(const Date& anotherDate) const throw (); virtual jint hashCode() const throw (); virtual String toString() const throw (); bool after(const Date&) const throw (); bool before(const Date&) const throw (); jlong getTime() const throw (); void setTime(jlong) throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/List.h0000644000175000001440000000355411216147023016125 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file List.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_LIST_H #define _INTERFACE_BEE_UTIL_LIST_H #ifdef __cplusplus #include "beecrypt/c++/util/Collection.h" using beecrypt::util::Collection; #include "beecrypt/c++/util/ListIterator.h" using beecrypt::util::ListIterator; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ template class List : public virtual Collection { public: virtual ~List() {} virtual void add(jint index, E* e) = 0; virtual bool addAll(jint index, const Collection& c) = 0; virtual E* get(jint index) const throw (IndexOutOfBoundsException) = 0; virtual jint indexOf(const E* e) const = 0; virtual jint lastIndexOf(const E* e) const = 0; virtual ListIterator* listIterator(jint index = 0) throw (IndexOutOfBoundsException) = 0; virtual ListIterator* listIterator(jint index = 0) const throw (IndexOutOfBoundsException) = 0; virtual E* remove(jint index) = 0; virtual E* set(jint index, E* e) = 0; // virtual List subList(jint fromIndex, jint toIndex) const = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Iterator.h0000644000175000001440000000246411216147023017002 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Iterator.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_ITERATOR_H #define _INTERFACE_BEE_UTIL_ITERATOR_H #ifdef __cplusplus #include "beecrypt/c++/util/NoSuchElementException.h" using beecrypt::util::NoSuchElementException; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ template class Iterator { public: virtual ~Iterator() {} virtual bool hasNext() throw () = 0; virtual E* next() throw (NoSuchElementException) = 0; virtual void remove() = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/NoSuchElementException.h0000644000175000001440000000273311216147023021600 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file NoSuchElementException.h * \ingroup CXX_UTIL_m */ #ifndef _CLASS_BEE_UTIL_NOSUCHELEMENTEXCEPTION_H #define _CLASS_BEE_UTIL_NOSUCHELEMENTEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ class NoSuchElementException : public RuntimeException { public: inline NoSuchElementException() {} inline NoSuchElementException(const char* message) : RuntimeException(message) {} inline NoSuchElementException(const String& message) : RuntimeException(message) {} inline ~NoSuchElementException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/concurrent/0000777000175000001440000000000011226307271017304 500000000000000beecrypt-4.2.1/include/beecrypt/c++/util/concurrent/Callable.h0000644000175000001440000000221311225171753021071 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Callable.h * \ingroup CXX_UTIL_CONCURRENT_m */ #ifndef _INTERFACE_BEE_UTIL_CONCURRENT_CALLABLE_H #define _INTERFACE_BEE_UTIL_CONCURRENT_CALLABLE_H #ifdef __cplusplus namespace beecrypt { namespace util { namespace concurrent { template class Callable { public: virtual ~Callable() {} virtual V* call() = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/concurrent/locks/0000777000175000001440000000000011226307271020417 500000000000000beecrypt-4.2.1/include/beecrypt/c++/util/concurrent/locks/ReentrantLock.h0000644000175000001440000000420111216147023023250 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ReentrantLock.h * \ingroup CXX_UTIL_CONCURRENT_LOCKS_m */ #ifndef _CLASS_BEE_UTIL_CONCURRENT_LOCKS_REENTRANTLOCK_H #define _CLASS_BEE_UTIL_CONCURRENT_LOCKS_REENTRANTLOCK_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/util/concurrent/locks/Condition.h" using beecrypt::util::concurrent::locks::Condition; #include "beecrypt/c++/util/concurrent/locks/Lock.h" using beecrypt::util::concurrent::locks::Lock; namespace beecrypt { namespace util { namespace concurrent { namespace locks { /*!\ingroup CXX_UTIL_CONCURRENT_LOCKS_m */ class BEECRYPTCXXAPI ReentrantLock : public Object, public virtual Lock { private: class BEECRYPTCXXAPI Cond : public Object, public virtual Condition { private: Object* lock; public: Cond(Object*); virtual ~Cond() {} virtual void await() throw (InterruptedException); virtual void awaitUninterruptibly(); virtual void signal(); virtual void signalAll(); }; bool _fair; public: ReentrantLock(bool fair = false); virtual ~ReentrantLock() {} virtual void lock(); virtual void lockInterruptibly() throw (InterruptedException); virtual Condition* newCondition(); virtual bool tryLock(); virtual void unlock(); }; } } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/concurrent/locks/Lock.h0000644000175000001440000000314411216147023021372 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Lock.h * \ingroup CXX_UTIL_CONCURRENT_LOCKS_m */ #ifndef _INTERFACE_BEE_UTIL_CONCURRENT_LOCKS_LOCK_H #define _INTERFACE_BEE_UTIL_CONCURRENT_LOCKS_LOCK_H #ifdef __cplusplus #include "beecrypt/c++/lang/InterruptedException.h" using beecrypt::lang::InterruptedException; #include "beecrypt/c++/util/concurrent/locks/Condition.h" using beecrypt::util::concurrent::locks::Condition; namespace beecrypt { namespace util { namespace concurrent { namespace locks { /*!\ingroup CXX_UTIL_CONCURRENT_LOCKS_m */ class BEECRYPTCXXAPI Lock { public: virtual ~Lock() {} virtual void lock() = 0; virtual void lockInterruptibly() throw (InterruptedException) = 0; virtual Condition* newCondition() = 0; virtual bool tryLock() = 0; virtual void unlock() = 0; }; } } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/concurrent/locks/Condition.h0000644000175000001440000000275111216147023022433 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Condition.h * \ingroup CXX_UTIL_CONCURRENT_LOCKS_m */ #ifndef _INTERFACE_BEE_UTIL_CONCURRENT_LOCKS_CONDITION_H #define _INTERFACE_BEE_UTIL_CONCURRENT_LOCKS_CONDITION_H #ifdef __cplusplus #include "beecrypt/c++/lang/InterruptedException.h" using beecrypt::lang::InterruptedException; namespace beecrypt { namespace util { namespace concurrent { namespace locks { /*!\ingroup CXX_UTIL_CONCURRENT_LOCKS_m */ class BEECRYPTCXXAPI Condition { public: virtual ~Condition() {} virtual void await() throw (InterruptedException) = 0; virtual void awaitUninterruptibly() = 0; virtual void signal() = 0; virtual void signalAll() = 0; }; } } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Set.h0000644000175000001440000000220311216147023015733 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Set.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_SET_H #define _INTERFACE_BEE_UTIL_SET_H #ifdef __cplusplus #include "beecrypt/c++/util/Collection.h" using beecrypt::util::Collection; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ template class Set : public virtual Collection { }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Properties.h0000644000175000001440000000532511216147023017344 00000000000000/* * Copyright (c) 2004, 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Properties.h * \ingroup CXX_UTIL_m */ #ifndef _CLASS_PROPERTIES_H #define _CLASS_PROPERTIES_H #ifdef __cplusplus #include "beecrypt/c++/io/InputStream.h" using beecrypt::io::InputStream; #include "beecrypt/c++/io/OutputStream.h" using beecrypt::io::OutputStream; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/util/Enumeration.h" using beecrypt::util::Enumeration; #include "beecrypt/c++/util/Hashtable.h" using beecrypt::util::Hashtable; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ class BEECRYPTCXXAPI Properties : public Hashtable { private: class Names : public Object, public virtual Enumeration { private: array _list; jint _pos; public: Names(Hashtable& h); virtual ~Names(); virtual bool hasMoreElements() throw (); virtual const String* nextElement() throw (NoSuchElementException); }; void enumerate(Hashtable& h) const; protected: const Properties* defaults; public: Properties(); Properties(const Properties& copy); Properties(const Properties* defaults); virtual ~Properties() {} const String* getProperty(const String& key) const throw (); const String* getProperty(const String& key, const String& defaultValue) const throw (); /*!\warning If this method returns a non-null value, make sure * you pass it to beecrypt::lang::collection_rcheck(), which will delete * it if it's no longer attached to any other collection. */ Object* setProperty(const String& key, const String& value); Enumeration* propertyNames() const; void load(InputStream& in) throw (IOException); /*!\todo rewrite this method using an OutputWriter after obtaining all * keys through the enumerate method */ void store(OutputStream& out, const String& header) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/AbstractList.h0000644000175000001440000002346311216147023017612 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AbstractList.h * \ingroup CXX_UTIL_m */ #ifndef _ABSTRACT_CLASS_BEE_UTIL_ABSTRACTLIST_H #define _ABSTRACT_CLASS_BEE_UTIL_ABSTRACTLIST_H #ifdef __cplusplus #include "beecrypt/c++/util/AbstractCollection.h" using beecrypt::util::AbstractCollection; #include "beecrypt/c++/util/List.h" using beecrypt::util::List; #include "beecrypt/c++/lang/IllegalStateException.h" using beecrypt::lang::IllegalStateException; #include "beecrypt/c++/util/ConcurrentModificationException.h" using beecrypt::util::ConcurrentModificationException; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m * \warning class E must be a subclass of Object */ template class AbstractList : public AbstractCollection, public virtual List { private: class Iter : public Object, public virtual Iterator { private: AbstractList* _list; const AbstractList* _const_list; jint _pos; jint _last; jint _expect; public: Iter(AbstractList* list) : _list(list), _const_list(list) { _pos = 0; _last = -1; _expect = _const_list->modCount; } Iter(const AbstractList* list) : _list(0), _const_list(list) { _pos = 0; _last = -1; _expect = _const_list->modCount; } virtual ~Iter() {} virtual bool hasNext() throw () { return _pos < _const_list->size(); } virtual E* next() throw (NoSuchElementException) { if (_expect != _const_list->modCount) throw ConcurrentModificationException(); try { E* e = _const_list->get(_pos); _last = _pos++; return e; } catch (IndexOutOfBoundsException&) { if (_expect != _const_list->modCount) throw ConcurrentModificationException(); throw NoSuchElementException(); } } virtual void remove() { if (!_list) throw UnsupportedOperationException("Cannot remove items in a const iterator"); if (_last == -1) throw IllegalStateException(); if (_expect != _list->modCount) throw ConcurrentModificationException(); try { E* e = _list->remove(_last); if (e) collection_rcheck(e); if (_last < _pos) _pos--; _last = -1; _expect = _list->modCount; } catch (IndexOutOfBoundsException&) { throw ConcurrentModificationException(); } } }; class ListIter : public Object, public virtual ListIterator { private: AbstractList* _list; const AbstractList* _const_list; jint _pos; jint _last; jint _expect; public: ListIter(AbstractList* list, jint index) throw (IndexOutOfBoundsException) : _list(list), _const_list(list) { if (index < 0 || index > list->size()) throw IndexOutOfBoundsException(); _pos = index; _last = -1; _expect = _const_list->modCount; } ListIter(const AbstractList* list, jint index) throw (IndexOutOfBoundsException) : _list(0), _const_list(list) { if (index < 0 || index > list->size()) throw IndexOutOfBoundsException(); _pos = index; _last = -1; _expect = _const_list->modCount; } virtual ~ListIter() {} virtual void add(E* e) { if (!_list) throw UnsupportedOperationException("Cannot add items in a const iterator"); if (_expect != _list->modCount) throw ConcurrentModificationException(); try { _list->add(_pos++, e); _last = -1; _expect = _list->modCount; } catch (IndexOutOfBoundsException&) { throw ConcurrentModificationException(); } } virtual bool hasNext() throw () { return _pos < _const_list->size(); } virtual bool hasPrevious() throw () { return _pos > 0; } virtual E* next() throw (NoSuchElementException) { if (_expect != _const_list->modCount) throw ConcurrentModificationException(); try { E* e = _const_list->get(_pos); _last = _pos++; return e; } catch (IndexOutOfBoundsException&) { if (_expect != _const_list->modCount) throw ConcurrentModificationException(); throw NoSuchElementException(); } } virtual jint nextIndex() throw () { return _pos; } virtual E* previous() throw (NoSuchElementException) { if (_expect != _const_list->modCount) throw ConcurrentModificationException(); try { E* e = _const_list->get(_pos-1); _last = _pos--; return e; } catch (IndexOutOfBoundsException&) { if (_expect != _const_list->modCount) throw ConcurrentModificationException(); throw NoSuchElementException(); } } virtual jint previousIndex() throw () { return _pos-1; } virtual void remove() { if (!_list) throw UnsupportedOperationException("Cannot remove items in a const iterator"); if (_last == -1) throw IllegalStateException(); if (_expect != _list->modCount) throw ConcurrentModificationException(); try { E* e = _list->remove(_last); if (e) collection_rcheck(e); if (_last < _pos) _pos--; _last = -1; _expect = _list->modCount; } catch (IndexOutOfBoundsException&) { throw ConcurrentModificationException(); } } virtual void set(E* e) { if (!_list) throw UnsupportedOperationException("Cannot set items in a const iterator"); if (_last == -1) throw IllegalStateException(); if (_expect != _list->modCount) throw ConcurrentModificationException(); try { _list->set(_last, e); _expect = _list->modCount; } catch (IndexOutOfBoundsException&) { throw ConcurrentModificationException(); } } }; protected: jint modCount; protected: AbstractList() { modCount = 0; } public: virtual ~AbstractList() {} virtual bool add(E* e) { add(size(), e); return true; } virtual void add(jint index, E* e) { throw UnsupportedOperationException(); } virtual bool addAll(jint index, const Collection& c) { bool result = false; jint pos = c.size(); Iterator* cit = c.iterator(); assert(cit != 0); while (--pos >= 0) { add(index++, cit->next()); result = true; } delete cit; return result; } virtual void clear() { while (size()) { E* e = remove(0); if (e) collection_rcheck(e); } } virtual bool equals(const Object* obj) const throw () { if (this == obj) return true; if (obj) { const AbstractList* abs = dynamic_cast*>(obj); if (abs) { bool result = true; jint pos1 = size(), pos2 = abs->size(); ListIterator* lit1 = listIterator(); assert(lit1 != 0); ListIterator* lit2 = abs->listIterator(); assert(lit2 != 0); while (--pos1 >= 0 && --pos2 >= 0) { if (!AbstractCollection::equals(lit1->next(), lit2->next())) { result = false; break; } } if (result) { // if either of the iterators has any elements left, the lists differ result = (pos1 < 0) && (pos2 < 0); } delete lit1; delete lit2; return result; } } return false; } virtual E* get(jint index) const throw (IndexOutOfBoundsException) = 0; virtual jint hashCode() const throw () { register jint pos = size(), result = 1; Iterator* it = iterator(); assert(it != 0); while (--pos >= 0) { E* e = it->next(); result *= 31; if (e) result += e->hashCode(); } delete it; return result; } virtual jint indexOf(const E* e) const { jint pos = size(), result = -1; ListIterator* lit = listIterator(); assert(lit != 0); while (--pos >= 0) { if (AbstractCollection::equals(e, lit->next())) { result = lit->previousIndex(); break; } } delete lit; return result; } virtual Iterator* iterator() { return new Iter(this); } virtual Iterator* iterator() const { return new Iter(this); } virtual jint lastIndexOf(const E* e) const { jint result = -1; ListIterator* lit = listIterator(size()); assert(lit != 0); while (lit->hasPrevious()) { if (AbstractCollection::equals(e, lit->previous())) { result = lit->nextIndex(); break; } } delete lit; return result; } virtual ListIterator* listIterator(jint index = 0) throw (IndexOutOfBoundsException) { return new ListIter(this, index); } virtual ListIterator* listIterator(jint index = 0) const throw (IndexOutOfBoundsException) { return new ListIter(this, index); } virtual E* remove(jint index) { throw UnsupportedOperationException(); } virtual E* set(jint index, E* e) { throw UnsupportedOperationException(); } virtual jint size() const throw () = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/Map.h0000644000175000001440000000433711216147023015727 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Map.h * \ingroup CXX_UTIL_m */ #ifndef _INTERFACE_BEE_UTIL_MAP_H #define _INTERFACE_BEE_UTIL_MAP_H #ifdef __cplusplus #include "beecrypt/c++/util/Set.h" using beecrypt::util::Set; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m */ template class Map { public: class Entry { public: virtual ~Entry() {} virtual bool equals(const Entry* e) const throw () = 0; virtual bool equals(const Object* obj) const throw () = 0; virtual K* getKey() const = 0; virtual V* getValue() const = 0; virtual jint hashCode() const throw () = 0; virtual V* setValue(V*) = 0; }; public: virtual ~Map() {} virtual void clear() = 0; virtual bool containsKey(const K* key) const = 0; virtual bool containsValue(const V* value) const = 0; virtual Set& entrySet() = 0; virtual const Set& entrySet() const = 0; virtual Set& keySet() = 0; virtual const Set& keySet() const = 0; virtual bool equals(const Object* obj) const throw () = 0; virtual V* get(const K* key) const = 0; virtual jint hashCode() const throw () = 0; virtual bool isEmpty() const = 0; virtual V* put(K* key, V* value) = 0; virtual void putAll(const Map& m) = 0; virtual V* remove(const K* key) = 0; virtual jint size() const throw () = 0; virtual Collection& values() = 0; virtual const Collection& values() const = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/util/ArrayList.h0000644000175000001440000001207011216147023017115 00000000000000/* * Copyright (c) 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ArrayList.h * \ingroup CXX_UTIL_m */ #ifndef _CLASS_BEE_UTIL_ARRAYLIST_H #define _CLASS_BEE_UTIL_ARRAYLIST_H #ifdef __cplusplus #include "beecrypt/c++/util/AbstractList.h" using beecrypt::util::AbstractList; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/lang/IllegalArgumentException.h" using beecrypt::lang::IllegalArgumentException; #include "beecrypt/c++/util/RandomAccess.h" using beecrypt::util::RandomAccess; namespace beecrypt { namespace util { /*!\ingroup CXX_UTIL_m * \warning class E must be a subclass of Object */ template class ArrayList : public AbstractList, public virtual RandomAccess, public virtual Cloneable { private: array _table; jint _count; void fastInsert(jint index) { register jint move = _count - index; if (move) ::memmove(_table.data() + index + 1, _table.data() + index, move * sizeof(E*)); _table[index] = 0; _count++; } void fastRemove(jint index) { register jint move = _count - index - 1; if (move) ::memmove(_table.data() + index, _table.data() + index + 1, move * sizeof(E*)); _table[--_count] = 0; } public: ArrayList(jint initialCapacity = 10) :_table(initialCapacity) { if (initialCapacity < 0) throw IllegalArgumentException(); _count = 0; } ArrayList(Collection& c) : _table(c.size()) { addAll(c); } ArrayList(const ArrayList& copy) : _table(copy._table), _count(copy._count) { } virtual ~ArrayList() { clear(); } virtual bool add(E* e) { ensureCapacity(_count+1); if ((_table[_count++] = e)) collection_attach(e); return true; } virtual void add(jint index, E* e) { if (index < 0 || index > _count) throw IndexOutOfBoundsException(); ensureCapacity(_count+1); fastInsert(index); if ((_table[index] = e)) collection_attach(e); } virtual bool addAll(const Collection& c) { jint clen = c.size(); if (clen > 0) { ensureCapacity(_count + clen); Iterator* cit = c.iterator(); assert(cit != 0); while (cit->hasNext()) { E* tmp = cit->next(); if (tmp) collection_attach(tmp); _table[_count++] = tmp; } delete cit; return true; } return false; } virtual Object* clone() const throw () { return new ArrayList(*this); } virtual void clear() { for (jint i = 0; i < _count; i++) { E* tmp = _table[i]; if (tmp) { collection_remove(tmp); _table[i] = 0; } } _count = 0; _table.resize(10); } virtual bool contains(const E* e) const { return indexOf(e) >= 0; } virtual void ensureCapacity(jint minimum) { this->modCount++; if (minimum > _table.size()) { jint newcapacity = (_table.size() * 3) / 2 + 2; if (minimum > newcapacity) newcapacity = minimum; _table.resize(newcapacity); } } virtual E* get(jint index) const throw (IndexOutOfBoundsException) { if (index < 0 || index >= _count) throw IndexOutOfBoundsException(); return _table[index]; } virtual jint indexOf(const E* e) const { if (e) { for (jint i = 0; i < _count; i++) if (_table[i] && _table[i]->equals(e)) return i; } else { for (jint i = 0; i < _count; i++) if (!_table[i]) return i; } return -1; } virtual bool isEmpty() const throw () { return _count == 0; } virtual bool remove(const E* e) { for (jint i = 0; i < _count; i++) { E* tmp = _table[i]; if (AbstractCollection::equals(e, tmp)) { fastRemove(i); if (tmp) collection_remove(tmp); return true; } } return false; } virtual E* remove(jint index) throw (IndexOutOfBoundsException) { if (index < 0 || index >= _count) throw IndexOutOfBoundsException(); E* tmp = _table[index]; fastRemove(index); if (tmp) collection_detach(tmp); return tmp; } virtual jint size() const throw () { return _count; } virtual array toArray() const { return array(_table.data(), _count); } virtual void trimToSize() { _table.resize(_count); } }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/math/0000777000175000001440000000000011226307271015076 500000000000000beecrypt-4.2.1/include/beecrypt/c++/math/BigInteger.h0000664000175000001440000000625710507745266017231 00000000000000/* * Copyright (c) 2005 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BigInteger.h * \ingroup CXX_MATH_m */ #ifndef _CLASS_BEE_MATH_BIGINTEGER_H #define _CLASS_BEE_MATH_BIGINTEGER_H #include "beecrypt/mpbarrett.h" #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/lang/Number.h" using beecrypt::lang::Number; #include "beecrypt/c++/lang/ArithmeticException.h" using beecrypt::lang::ArithmeticException; #include "beecrypt/c++/lang/NumberFormatException.h" using beecrypt::lang::NumberFormatException; namespace beecrypt { namespace math { /*!\ingroup CXX_MATH_m */ class BEECRYPTCXXAPI BigInteger : public Number, public virtual Comparable { friend BEECRYPTCXXAPI void transform(mpnumber& m, const BigInteger&); friend BEECRYPTCXXAPI void transform(mpbarrett& b, const BigInteger&); private: size_t size; mpw* data; int sign; BigInteger(size_t, mpw*, int); public: static BigInteger valueOf(jlong val); static const BigInteger ZERO; static const BigInteger ONE; static const BigInteger TEN; public: BigInteger(); BigInteger(jlong val); BigInteger(const bytearray& val); BigInteger(const mpnumber&); BigInteger(const mpbarrett&); BigInteger(const BigInteger& val); virtual ~BigInteger(); BigInteger& operator=(const BigInteger& copy); bool operator==(const BigInteger& cmp) const throw (); bool operator!=(const BigInteger& cmp) const throw (); virtual jbyte byteValue() const throw (); virtual jint compareTo(const BigInteger& val) const throw (); virtual bool equals(const Object* obj) const throw (); virtual jint hashCode() const throw (); virtual jint intValue() const throw (); virtual jlong longValue() const throw (); virtual jshort shortValue() const throw (); virtual String toString() const throw (); jint signum() const throw (); BigInteger add(const BigInteger& val) const; BigInteger subtract(const BigInteger& val) const; BigInteger multiply(const BigInteger& val) const; BigInteger mod(const BigInteger& val) const throw (ArithmeticException); BigInteger modInverse(const BigInteger& m) const throw (ArithmeticException); // BigInteger modPow(const BigInteger& exponent, const BigInteger& m) const throw (ArithmeticException); BigInteger negate() const; bytearray* toByteArray() const; void toByteArray(bytearray& b) const; String toString(jint radix) const; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/Doxyheader0000664000175000001440000001164610507741123016111 00000000000000/*!\mainpage BeeCrypt C++ API Documentation * * \section intro_sec Introduction * * BeeCrypt started its life when the need for a portable and fast cryptography * library arose at Virtual Unlimited in 1997. I'm still trying to make it * faster, easier to use and more portable, in addition to providing better * documentation. * * \section license_sec License * * BeeCrypt is released under the following license: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Legal disclaimer: note that depending on where you are, the use of * cryptography may be limited or forbidden by law. Before using this library, * make sure you are legally entitled to do so. * * \section features_sec Features * * A new feature in version 4.x is the C++ API, built to resemble Java's * security and cryptography API. * * As of version 4.2.0 basic versions of Object and Thread have been * added and should work on any platform offering either POSIX, Solaris * or Win32 threads. Java's Collections system had to be adapted to work * in C++. See the documentation in class beecrypt::util::Collections * * Included in the base provider are broad spectrum of algorithms: *
    *
  • AlgorithmParameterGenerator *
      *
    • DH *
    • DSA *
    *
  • AlgorithmParameters *
      *
    • DH *
    • DHAES *
    • DSA *
    *
  • Cipher *
      *
    • AES *
    • Blowfish *
    • DHAES *
    *
  • KeyAgreement *
      *
    • DH *
    *
  • KeyPairGenerator *
      *
    • DH *
    • DSA *
    • RSA *
    *
  • Mac *
      *
    • HMAC-MD5 *
    • HMAC-SHA-1 *
    • HMAC-SHA-256 *
    • HMAC-SHA-384 *
    • HMAC-SHA-512 *
    *
  • MessageDigest *
      *
    • MD5 *
    • SHA-1 *
    • SHA-256 *
    • SHA-384 *
    • SHA-512 *
    *
  • Signature *
      *
    • MD5withRSA *
    • SHA1withDSA *
    • SHA1withRSA *
    • SHA256withRSA *
    • SHA384withRSA *
    • SHA512withRSA *
    *
* */ /*!\defgroup CXX_m C++ API */ /*!\defgroup CXX_IO_m C++ classes mimicking java.io */ /*!\defgroup CXX_LANG_m C++ classes mimicking java.lang */ /*!\defgroup CXX_NIO_m C++ classes mimicking java.nio */ /*!\defgroup CXX_SECURITY_m C++ classes mimicking java.security */ /*!\defgroup CXX_SECURITY_CERT_m C++ classes mimicking java.security.cert */ /*!\defgroup CXX_SECURITY_INTERFACES_m C++ classes mimicking java.security.interfaces */ /*!\defgroup CXX_SECURITY_SPEC_m C++ classes mimicking java.security.spec */ /*!\defgroup CXX_UTIL_m C++ classes mimicking java.util */ /*!\defgroup CXX_UTIL_CONCURRENT_m C++ classes mimicking java.util.concurrent */ /*!\defgroup CXX_UTIL_CONCURRENT_LOCKS_m C++ classes mimicking java.util.concurrent.locks */ /*!\defgroup CXX_CRYPTO_m C++ classes mimicking javax.crypto */ /*!\defgroup CXX_CRYPTO_INTERFACES_m C++ classes mimicking javax.crypto.interfaces */ /*!\defgroup CXX_CRYPTO_SPEC_m C++ classes mimicking javax.crypto.spec */ /*!\defgroup CXX_SECURITY_AUTH_m C++ classes mimicking javax.security.auth */ /*!\namespace beecrypt::io * \brief Namespace emulating java.io */ /*!\namespace beecrypt::lang * \brief Namespace emulating java.lang */ /*!\namespace beecrypt::nio * \brief Namespace emulating java.nio */ /*!\namespace beecrypt::security * \brief Namespace emulating java.security */ /*!\namespace beecrypt::security::cert * \brief Namespace emulating java.security.cert */ /*!\namespace beecrypt::security::interfaces * \brief Namespace emulating java.security.interfaces */ /*!\namespace beecrypt::security::spec * \brief Namespace emulating java.security.spec */ /*!\namespace beecrypt::util * \brief Namespace emulating java.util */ /*!\namespace beecrypt::util::concurrent * \brief Namespace emulating java.util.concurrent */ /*!\namespace beecrypt::util::concurrent::locks * \brief Namespace emulating java.util.concurrent.locks */ /*!\namespace beecrypt::crypto * \brief Namespace emulating javax.crypto */ /*!\namespace beecrypt::crypto::interfaces * \brief Namespace emulating javax.crypto.interfaces */ /*!\namespace beecrypt::crypto::spec * \brief Namespace emulating javax.crypto.spec */ /*!\namespace beecrypt::security::auth * \brief Namespace emulating javax.security.auth */ beecrypt-4.2.1/include/beecrypt/c++/Doxyfile.in0000644000175000001440000013710411216651614016204 00000000000000# Doxyfile 1.3.9.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "BeeCrypt C++" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = @top_srcdir@/docs/c++ # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of source # files, where putting all generated files in the same directory would otherwise # cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, # Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, # Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, # Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, # Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # This tag can be used to specify the encoding used in the generated output. # The encoding is not always determined by the language that is chosen, # but also whether or not the output is meant for Windows or non-Windows users. # In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES # forces the Windows encoding (this is the default for the Windows binary), # whereas setting the tag to NO uses a Unix-style encoding (the default for # all platforms other than Windows). USE_WINDOWS_ENCODING = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is used # as the annotated text. Otherwise, the brief description is used as-is. If left # blank, the following values are used ("$name" is automatically replaced with the # name of the entity): "The $name class" "The $name widget" "The $name file" # "is" "provides" "specifies" "contains" "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited # members of a class in the documentation of that class as if those members were # ordinary class members. Constructors, destructors and assignment operators of # the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = @top_srcdir@/ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources # only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = YES # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. SHOW_DIRECTORIES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. WARN_FORMAT = # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @top_srcdir@/include/beecrypt/c++/Doxyheader \ @top_srcdir@/include/beecrypt/c++/crypto \ @top_srcdir@/include/beecrypt/c++/crypto/interfaces \ @top_srcdir@/include/beecrypt/c++/crypto/spec \ @top_srcdir@/include/beecrypt/c++/io \ @top_srcdir@/include/beecrypt/c++/lang \ @top_srcdir@/include/beecrypt/c++/nio \ @top_srcdir@/include/beecrypt/c++/security \ @top_srcdir@/include/beecrypt/c++/security/auth \ @top_srcdir@/include/beecrypt/c++/security/cert \ @top_srcdir@/include/beecrypt/c++/security/interfaces \ @top_srcdir@/include/beecrypt/c++/security/spec \ @top_srcdir@/include/beecrypt/c++/util \ @top_srcdir@/include/beecrypt/c++/util/concurrent/locks # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm FILE_PATTERNS = *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories # that are symbolic links (a Unix filesystem feature) are excluded from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. EXCLUDE_PATTERNS = *config*.h # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = @top_srcdir@/docs/c++ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = dsfont # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_PREDEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = __cplusplus BEECRYPTCXXAPI= MP_WBITS=@MP_WBITS@ # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse the # parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or # super classes. Setting the tag to NO turns the diagrams off. Note that this # option is superseded by the HAVE_DOT option below. This is only a fallback. It is # recommended to install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found on the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes that # lay further from the root node will be omitted. Note that setting this option to # 1 or 2 may greatly reduce the computation time needed for large code bases. Also # note that a graph may be further truncated if the graph's image dimensions are # not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). # If 0 is used for the depth value (the default), the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO beecrypt-4.2.1/include/beecrypt/c++/resource.h0000644000175000001440000000176111216147022016061 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file resource.h * \author Bob Deblier * \ingroup CXX_m */ #ifndef _BEECRYPT_RESOURCE_H #define _BEECRYPT_RESOURCE_H #include "beecrypt/api.h" extern const char* BEECRYPT_CONF_FILE; #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/0000777000175000001440000000000011226307270015571 500000000000000beecrypt-4.2.1/include/beecrypt/c++/beeyond/BeeCertPath.h0000644000175000001440000000313711216147022020004 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeCertPath.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_BEECERTPATH_H #define _CLASS_BEECERTPATH_H #ifdef __cplusplus #include "beecrypt/c++/security/cert/CertPath.h" using beecrypt::security::cert::CertPath; #include "beecrypt/c++/beeyond/BeeCertificate.h" using beecrypt::beeyond::BeeCertificate; #include "beecrypt/c++/util/ArrayList.h" using beecrypt::util::ArrayList; namespace beecrypt { namespace beeyond { /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI BeeCertPath : public CertPath { private: ArrayList _cert; public: BeeCertPath(const BeeCertificate& cert); virtual ~BeeCertPath() {} virtual bool equals(const Object* obj) const throw (); virtual const List& getCertificates() const; virtual const bytearray& getEncoded() const; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/BeeEncodedKeySpec.h0000644000175000001440000000255611216147022021123 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeEncodedKeySpec.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_BEEENCODEDKEYSPEC_H #define _CLASS_BEEENCODEDKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/security/spec/EncodedKeySpec.h" using beecrypt::security::spec::EncodedKeySpec; namespace beecrypt { namespace beeyond { /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI BeeEncodedKeySpec : public EncodedKeySpec { public: BeeEncodedKeySpec(const byte*, int); BeeEncodedKeySpec(const bytearray&); virtual ~BeeEncodedKeySpec() {} virtual const String& getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/BeeCertPathValidatorResult.h0000644000175000001440000000340611216147022023050 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeCertPathValidatorResult.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_BEECERTPATHVALIDATORRESULT_H #define _CLASS_BEECERTPATHVALIDATORRESULT_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/cert/CertPathValidatorResult.h" using beecrypt::security::cert::CertPathValidatorResult; #include "beecrypt/c++/beeyond/BeeCertificate.h" using beecrypt::beeyond::BeeCertificate; namespace beecrypt { namespace beeyond { /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI BeeCertPathValidatorResult : public Object, public CertPathValidatorResult { private: BeeCertificate* _root; PublicKey* _pub; public: BeeCertPathValidatorResult(const BeeCertificate& root, const PublicKey& pub); virtual ~BeeCertPathValidatorResult(); virtual BeeCertPathValidatorResult* clone() const throw (); const BeeCertificate& getRootCertificate() const; const PublicKey& getPublicKey() const; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/DHIESParameterSpec.h0000644000175000001440000000466411216147022021174 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHIESParameterSpec.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_DHIESPARAMETERSPEC_H #define _CLASS_DHIESPARAMETERSPEC_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::bytearray; #include "beecrypt/c++/crypto/interfaces/DHPublicKey.h" using beecrypt::crypto::interfaces::DHPublicKey; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; #include "beecrypt/c++/security/spec/InvalidParameterSpecException.h" using beecrypt::security::spec::InvalidParameterSpecException; namespace beecrypt { namespace beeyond { /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI DHIESParameterSpec : public Object, public AlgorithmParameterSpec { private: String _messageDigestAlgorithm; String _cipherAlgorithm; String _macAlgorithm; int _cipherKeyLength; int _macKeyLength; public: DHIESParameterSpec(const DHIESParameterSpec& copy); DHIESParameterSpec(const String& messageDigestAlgorithm, const String& cipherAlgorithm, const String& macAlgorithm, int cipherKeyLength = 0, int macKeyLength = 0); DHIESParameterSpec(const String& descriptor) throw (IllegalArgumentException); virtual ~DHIESParameterSpec() {} virtual String toString() const throw (); const String& getCipherAlgorithm() const throw (); const String& getMacAlgorithm() const throw (); const String& getMessageDigestAlgorithm() const throw (); int getCipherKeyLength() const throw (); int getMacKeyLength() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/BeeCertificate.h0000644000175000001440000001527511216147022020522 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeCertificate.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_BEE_BEEYOND_BEECERTIFICATE_H #define _CLASS_BEE_BEEYOND_BEECERTIFICATE_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::array; #include "beecrypt/c++/io/DataInputStream.h" using beecrypt::io::DataInputStream; #include "beecrypt/c++/io/DataOutputStream.h" using beecrypt::io::DataOutputStream; #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; #include "beecrypt/c++/provider/BeeCertificateFactory.h" using beecrypt::provider::BeeCertificateFactory; #include "beecrypt/c++/security/PublicKey.h" using beecrypt::security::PublicKey; #include "beecrypt/c++/security/PrivateKey.h" using beecrypt::security::PrivateKey; #include "beecrypt/c++/security/cert/Certificate.h" using beecrypt::security::cert::Certificate; #include "beecrypt/c++/security/cert/CertificateExpiredException.h" using beecrypt::security::cert::CertificateExpiredException; #include "beecrypt/c++/security/cert/CertificateNotYetValidException.h" using beecrypt::security::cert::CertificateNotYetValidException; #include "beecrypt/c++/util/Date.h" using beecrypt::util::Date; #include "beecrypt/c++/util/ArrayList.h" using beecrypt::util::ArrayList; namespace beecrypt { namespace beeyond { /* We use short certificate chains, embedded in the certificate as parent certificates * Issuer is informational * Subject is used to identify the type of certificate */ /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI BeeCertificate : public Certificate, public Cloneable { friend class ::BeeCertificateFactory; public: static const Date FOREVER; static Certificate* cloneCertificate(const Certificate& cert) throw (CloneNotSupportedException); static PublicKey* clonePublicKey(const PublicKey& pub) throw (CloneNotSupportedException); protected: class BEECRYPTCXXAPI Field : public beecrypt::lang::Object { public: jint type; virtual ~Field() {} virtual Field* clone() const throw (CloneNotSupportedException) = 0; virtual void decode(DataInputStream&) throw (IOException) = 0; virtual void encode(DataOutputStream&) const throw (IOException) = 0; }; class BEECRYPTCXXAPI UnknownField : public Field { public: bytearray encoding; UnknownField() throw (); UnknownField(const UnknownField&) throw (); virtual ~UnknownField() {} virtual Field* clone() const throw (); virtual void decode(DataInputStream&) throw (IOException); virtual void encode(DataOutputStream&) const throw (IOException); }; class BEECRYPTCXXAPI PublicKeyField : public Field { public: static const jint FIELD_TYPE; PublicKey* pub; PublicKeyField() throw (); PublicKeyField(PublicKey* key) throw (); PublicKeyField(const PublicKey& key) throw (CloneNotSupportedException); virtual ~PublicKeyField(); virtual Field* clone() const throw (CloneNotSupportedException); virtual void decode(DataInputStream&) throw (IOException); virtual void encode(DataOutputStream&) const throw (IOException); }; class BEECRYPTCXXAPI ParentCertificateField : public Field { public: static const jint FIELD_TYPE; Certificate* parent; ParentCertificateField() throw (); ParentCertificateField(Certificate*) throw (); ParentCertificateField(const Certificate&) throw (CloneNotSupportedException); virtual ~ParentCertificateField(); virtual Field* clone() const throw (CloneNotSupportedException); virtual void decode(DataInputStream&) throw (IOException); virtual void encode(DataOutputStream&) const throw (IOException); }; virtual Field* instantiateField(jint type); protected: String issuer; String subject; Date created; Date expires; ArrayList fields; String signatureAlgorithm; bytearray signature; mutable bytearray* enc; BeeCertificate(); BeeCertificate(InputStream& in) throw (IOException); void encodeTBS(DataOutputStream& out) const throw (IOException); bytearray* encodeTBS() const throw (CertificateEncodingException); public: BeeCertificate(const BeeCertificate&) throw (CloneNotSupportedException); virtual ~BeeCertificate(); virtual BeeCertificate* clone() const throw (); virtual const bytearray& getEncoded() const throw (CertificateEncodingException); virtual const PublicKey& getPublicKey() const; virtual void verify(const PublicKey&) const throw (CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException); virtual void verify(const PublicKey&, const String&) const throw (CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException); virtual String toString() const throw (); void checkValidity() const throw (CertificateExpiredException, CertificateNotYetValidException); void checkValidity(const Date&) const throw (CertificateExpiredException, CertificateNotYetValidException); const String& getIssuer() const throw (); const String& getSubject() const throw (); const Date& getNotAfter() const throw (); const Date& getNotBefore() const throw (); const bytearray& getSignature() const throw (); const String& getSigAlgName() const throw (); bool hasPublicKey() const; bool hasParentCertificate() const; bool isSelfSignedCertificate() const; const Certificate& getParentCertificate() const; public: static BeeCertificate* self(const PublicKey& pub, const PrivateKey& pri, const String& signatureAlgorithm) throw (InvalidKeyException, CertificateEncodingException, SignatureException, NoSuchAlgorithmException); static BeeCertificate* make(const PublicKey& pub, const PrivateKey& pri, const String& signatureAlgorithm, const Certificate& parent) throw (InvalidKeyException, CertificateEncodingException, SignatureException, NoSuchAlgorithmException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/AnyEncodedKeySpec.h0000644000175000001440000000277511216147022021162 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AnyEncodedKeySpec.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_ANYENCODEDKEYSPEC_H #define _CLASS_ANYENCODEDKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/security/spec/EncodedKeySpec.h" using beecrypt::security::spec::EncodedKeySpec; namespace beecrypt { namespace beeyond { /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI AnyEncodedKeySpec : public EncodedKeySpec { private: String _format; public: AnyEncodedKeySpec(const String& format, const byte*, int); AnyEncodedKeySpec(const String& format, const bytearray&); virtual ~AnyEncodedKeySpec() {} virtual const String& getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/DHIESDecryptParameterSpec.h0000644000175000001440000000313511216147022022517 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHIESDecryptParameterSpec.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_DHIESDECRYPTPARAMETERSPEC_H #define _CLASS_DHIESDECRYPTPARAMETERSPEC_H #ifdef __cplusplus #include "beecrypt/c++/beeyond/DHIESParameterSpec.h" using beecrypt::beeyond::DHIESParameterSpec; namespace beecrypt { namespace beeyond { /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI DHIESDecryptParameterSpec : public DHIESParameterSpec { private: BigInteger _pub; bytearray _mac; public: DHIESDecryptParameterSpec(const DHIESParameterSpec& copy, const BigInteger& key, const bytearray& mac); DHIESDecryptParameterSpec(const DHIESDecryptParameterSpec& copy); virtual ~DHIESDecryptParameterSpec() {} const BigInteger& getEphemeralPublicKey() const throw (); const bytearray& getMac() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/PKCS12PBEKey.h0000644000175000001440000000367411216147022017567 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file PKCS12PBEKey.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_PKCS12PBEKEY_H #define _CLASS_PKCS12PBEKEY_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::array; using beecrypt::bytearray; #include "beecrypt/c++/crypto/interfaces/PBEKey.h" using beecrypt::crypto::interfaces::PBEKey; namespace beecrypt { namespace beeyond { /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI PKCS12PBEKey : public PBEKey { private: array _pswd; bytearray* _salt; int _iter; mutable bytearray* _enc; public: static bytearray* encode(const array&); public: PKCS12PBEKey(const array&, const bytearray*, int); virtual ~PKCS12PBEKey(); virtual bool operator==(const Key& compare) const throw (); virtual PKCS12PBEKey* clone() const; virtual int getIterationCount() const throw (); virtual const array& getPassword() const throw (); virtual const bytearray* getSalt() const throw (); virtual const bytearray* getEncoded() const throw (); virtual const String& getAlgorithm() const throw(); virtual const String* getFormat() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/BeeCertPathParameters.h0000644000175000001440000000412611216147022022027 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeCertPathParameters.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_BEECERTPATHPARAMETERS_H #define _CLASS_BEECERTPATHPARAMETERS_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/InvalidAlgorithmParameterException.h" using beecrypt::security::InvalidAlgorithmParameterException; #include "beecrypt/c++/security/KeyStore.h" using beecrypt::security::KeyStore; #include "beecrypt/c++/security/KeyStoreException.h" using beecrypt::security::KeyStoreException; #include "beecrypt/c++/security/cert/Certificate.h" using beecrypt::security::cert::Certificate; #include "beecrypt/c++/security/cert/CertPathParameters.h" using beecrypt::security::cert::CertPathParameters; #include "beecrypt/c++/util/ArrayList.h" using beecrypt::util::ArrayList; namespace beecrypt { namespace beeyond { class BEECRYPTCXXAPI BeeCertPathParameters : public Object, public CertPathParameters { private: ArrayList _cert; protected: BeeCertPathParameters(); public: BeeCertPathParameters(KeyStore& keystore) throw (KeyStoreException, InvalidAlgorithmParameterException); virtual ~BeeCertPathParameters() {}; virtual BeeCertPathParameters* clone() const throw (); const List& getTrustedCertificates() const; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/BeeInputStream.h0000644000175000001440000000255011216147022020543 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeInputStream.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_BEEINPUTSTREAM_H #define _CLASS_BEEINPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/DataInputStream.h" using beecrypt::io::DataInputStream; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; namespace beecrypt { namespace beeyond { /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI BeeInputStream : public DataInputStream { public: BeeInputStream(InputStream& in); virtual ~BeeInputStream(); BigInteger readBigInteger() throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/beeyond/BeeOutputStream.h0000644000175000001440000000257711216147022020755 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BeeOutputStream.h * \ingroup CXX_BEEYOND_m */ #ifndef _CLASS_BEEOUTPUTSTREAM_H #define _CLASS_BEEOUTPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/DataOutputStream.h" using beecrypt::io::DataOutputStream; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; namespace beecrypt { namespace beeyond { /*!\ingroup CXX_BEEYOND_m */ class BEECRYPTCXXAPI BeeOutputStream : public DataOutputStream { public: BeeOutputStream(OutputStream& out); virtual ~BeeOutputStream(); void writeBigInteger(const BigInteger&) throw (IOException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/0000777000175000001440000000000011226307270015464 500000000000000beecrypt-4.2.1/include/beecrypt/c++/crypto/spec/0000777000175000001440000000000011226307270016416 500000000000000beecrypt-4.2.1/include/beecrypt/c++/crypto/spec/IvParameterSpec.h0000644000175000001440000000324411216147023021535 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file IvParameterSpec.h * \ingroup CXX_CRYPTO_SPEC_m */ #ifndef _CLASS_BEE_CRYPTO_SPEC_IVPARAMETERSPEC_H #define _CLASS_BEE_CRYPTO_SPEC_IVPARAMETERSPEC_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::bytearray; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace crypto { namespace spec { /*!\ingroup CXX_CRYPTO_SPEC_m */ class BEECRYPTCXXAPI IvParameterSpec : public Object, public virtual AlgorithmParameterSpec { private: bytearray _iv; public: IvParameterSpec(const byte* iv, size_t offset, size_t length); IvParameterSpec(const bytearray& iv); virtual ~IvParameterSpec() {} const bytearray& getIV() const throw (); bytearray* getIV(); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/spec/DHParameterSpec.h0000644000175000001440000000363411216147023021455 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHParameterSpec.h * \ingroup CXX_CRYPTO_SPEC_m */ #ifndef _CLASS_BEE_CRYPTO_SPEC_DHPARAMETERSPEC_H #define _CLASS_BEE_CRYPTO_SPEC_DHPARAMETERSPEC_H #ifdef __cplusplus #include "beecrypt/c++/crypto/interfaces/DHParams.h" using beecrypt::crypto::interfaces::DHParams; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace crypto { namespace spec { /*!\ingroup CXX_CRYPTO_SPEC_m */ class BEECRYPTCXXAPI DHParameterSpec : public Object, public virtual AlgorithmParameterSpec, public virtual DHParams { private: BigInteger _p; BigInteger _g; int _l; public: DHParameterSpec(const DHParams&); DHParameterSpec(const DHParameterSpec&); DHParameterSpec(const BigInteger& p, const BigInteger& g); DHParameterSpec(const BigInteger& p, const BigInteger& g, int l); virtual ~DHParameterSpec() {} virtual bool equals(const Object* obj) const throw (); const BigInteger& getP() const throw (); const BigInteger& getG() const throw (); int getL() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/spec/DHPrivateKeySpec.h0000644000175000001440000000333511216147023021616 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHPrivateKeySpec.h * \ingroup CXX_CRYPTO_SPEC_m */ #ifndef _CLASS_BEE_CRYPTO_SPEC_DHPRIVATEKEYSPEC_H #define _CLASS_BEE_CRYPTO_SPEC_DHPRIVATEKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; namespace beecrypt { namespace crypto { namespace spec { /*!\ingroup CXX_CRYPTO_SPEC_m */ class BEECRYPTCXXAPI DHPrivateKeySpec : public Object, public virtual KeySpec { private: BigInteger _p; BigInteger _g; BigInteger _x; public: DHPrivateKeySpec(const BigInteger& x, const BigInteger& p, const BigInteger& g); virtual ~DHPrivateKeySpec() {} const BigInteger& getP() const throw (); const BigInteger& getG() const throw (); const BigInteger& getX() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/spec/SecretKeySpec.h0000644000175000001440000000334611216147023021217 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SecretKeySpec.h * \ingroup CXX_CRYPTO_SPEC_m */ #ifndef _CLASS_BEE_CRYPTO_SPEC_SECRETKEYSPEC_H #define _CLASS_BEE_CRYPTO_SPEC_SECRETKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; #include "beecrypt/c++/crypto/SecretKey.h" using beecrypt::crypto::SecretKey; namespace beecrypt { namespace crypto { namespace spec { /*!\ingroup CXX_CRYPTO_SPEC_m */ class BEECRYPTCXXAPI SecretKeySpec : public KeySpec, public virtual SecretKey { private: bytearray _data; String _algo; public: SecretKeySpec(const byte* data, size_t offset, size_t length, const String& algorithm); SecretKeySpec(const bytearray& b, const String& algorithm); virtual ~SecretKeySpec() {} virtual const String& getAlgorithm() const throw (); virtual const String* getFormat() const throw (); virtual const bytearray* getEncoded() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/spec/PBEKeySpec.h0000644000175000001440000000355711216147023020404 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file PBEKeySpec.h * \ingroup CXX_CRYPTO_SPEC_m */ #ifndef _CLASS_BEE_CRYPTO_SPEC_PBEKEYSPEC_H #define _CLASS_BEE_CRYPTO_SPEC_PBEKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::array; using beecrypt::bytearray; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace crypto { namespace spec { /*!\ingroup CXX_CRYPTO_SPEC_m */ class BEECRYPTCXXAPI PBEKeySpec : public Object, public virtual KeySpec { private: array _password; bytearray* _salt; size_t _iteration_count; size_t _key_length; public: PBEKeySpec(const array* password); PBEKeySpec(const array* password, const bytearray* salt, size_t iterationCount, size_t keyLength); virtual ~PBEKeySpec(); const array& getPassword() const throw (); const bytearray* getSalt() const throw (); size_t getIterationCount() const throw (); size_t getKeyLength() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/spec/DHPublicKeySpec.h0000644000175000001440000000332711216147023021423 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHPublicKeySpec.h * \ingroup CXX_CRYPTO_SPEC_m */ #ifndef _CLASS_BEE_CRYPTO_SPEC_DHPUBLICKEYSPEC_H #define _CLASS_BEE_CRYPTO_SPEC_DHPUBLICKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; namespace beecrypt { namespace crypto { namespace spec { /*!\ingroup CXX_CRYPTO_SPEC_m */ class BEECRYPTCXXAPI DHPublicKeySpec : public Object, public virtual KeySpec { private: BigInteger _p; BigInteger _g; BigInteger _y; public: DHPublicKeySpec(const BigInteger& y, const BigInteger& p, const BigInteger& g); virtual ~DHPublicKeySpec() {} const BigInteger& getP() const throw (); const BigInteger& getG() const throw (); const BigInteger& getY() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/KeyAgreementSpi.h0000644000175000001440000000515611216147023020611 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyAgreementSpi.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_KEYAGREEMENTSPI_H #define _CLASS_BEE_CRYPTO_KEYAGREEMENTSPI_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::bytearray; #include "beecrypt/c++/crypto/SecretKey.h" using beecrypt::crypto::SecretKey; #include "beecrypt/c++/lang/IllegalStateException.h" using beecrypt::lang::IllegalStateException; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/SecureRandom.h" using beecrypt::security::SecureRandom; #include "beecrypt/c++/security/InvalidAlgorithmParameterException.h" using beecrypt::security::InvalidAlgorithmParameterException; #include "beecrypt/c++/security/InvalidKeyException.h" using beecrypt::security::InvalidKeyException; #include "beecrypt/c++/security/ShortBufferException.h" using beecrypt::security::ShortBufferException; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI KeyAgreementSpi : public Object { friend class KeyAgreement; protected: virtual void engineInit(const Key&, SecureRandom*) throw (InvalidKeyException) = 0; virtual void engineInit(const Key&, const AlgorithmParameterSpec&, SecureRandom*) throw (InvalidKeyException, InvalidAlgorithmParameterException) = 0; virtual Key* engineDoPhase(const Key&, bool) = 0; virtual bytearray* engineGenerateSecret() throw (IllegalStateException) = 0; virtual int engineGenerateSecret(bytearray&, int) throw (IllegalStateException, ShortBufferException) = 0; virtual SecretKey* engineGenerateSecret(const String&) throw (IllegalStateException, NoSuchAlgorithmException, InvalidKeyException) = 0; public: virtual ~KeyAgreementSpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/MacInputStream.h0000644000175000001440000000305711216147023020447 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file MacInputStream.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_MACINPUTSTREAM_H #define _CLASS_BEE_CRYPTO_MACINPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/crypto/Mac.h" using beecrypt::crypto::Mac; #include "beecrypt/c++/io/FilterInputStream.h" using beecrypt::io::FilterInputStream; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI MacInputStream : public FilterInputStream { private: bool _on; protected: Mac& mac; public: MacInputStream(InputStream&, Mac&); virtual ~MacInputStream(); virtual int read() throw (IOException); virtual int read(byte* data, int offset, int length) throw (IOException); void on(bool); Mac& getMac(); void setMac(Mac&); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/MacOutputStream.h0000644000175000001440000000310711216147023020644 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file MacOutputStream.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_MACOUTPUTSTREAM_H #define _CLASS_BEE_CRYPTO_MACOUTPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/crypto/Mac.h" using beecrypt::crypto::Mac; #include "beecrypt/c++/io/FilterOutputStream.h" using beecrypt::io::FilterOutputStream; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI MacOutputStream : public FilterOutputStream { private: bool _on; protected: Mac& mac; public: MacOutputStream(OutputStream&, Mac&); virtual ~MacOutputStream(); virtual void write(byte) throw (IOException); virtual void write(const byte* data, int offset, int length) throw (IOException); void on(bool); Mac& getMac(); void setMac(Mac&); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/Cipher.h0000644000175000001440000001070711216147022016764 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Cipher.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_CIPHER_H #define _CLASS_BEE_CRYPTO_CIPHER_H #ifdef __cplusplus #include "beecrypt/c++/crypto/CipherSpi.h" using beecrypt::crypto::CipherSpi; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/cert/Certificate.h" using beecrypt::security::cert::Certificate; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI Cipher : public Object { public: static Cipher* getInstance(const String& transformation) throw (NoSuchAlgorithmException, NoSuchPaddingException); static Cipher* getInstance(const String& transformation, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException); static Cipher* getInstance(const String& transformation, const Provider& provider) throw (NoSuchAlgorithmException, NoSuchPaddingException); static const int ENCRYPT_MODE; static const int DECRYPT_MODE; static const int WRAP_MODE; static const int UNWRAP_MODE; static int getMaxAllowedKeyLength(const String& transformation) throw (NoSuchAlgorithmException); static AlgorithmParameterSpec* getMaxAllowedParameterSpec(const String& transformation) throw (NoSuchAlgorithmException); private: CipherSpi* _cspi; String _algo; const Provider* _prov; bool _init; protected: Cipher(CipherSpi* cipherSpi, const Provider* provider, const String& transformation); public: virtual ~Cipher(); bytearray* doFinal() throw (IllegalStateException, IllegalBlockSizeException, BadPaddingException); bytearray* doFinal(const bytearray& input) throw (IllegalStateException, IllegalBlockSizeException, BadPaddingException); int doFinal(bytearray& output, int outputOffset) throw (IllegalStateException, IllegalBlockSizeException, ShortBufferException, BadPaddingException); bytearray* doFinal(const byte* input, int inputOffset, int inputLength) throw (IllegalStateException, IllegalBlockSizeException, BadPaddingException); int doFinal(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset = 0) throw (IllegalStateException, IllegalBlockSizeException, ShortBufferException, BadPaddingException); // virtual int doFinal(ByteBuffer& input, ByteBuffer& output) throw (IllegalStateException, ShortBufferException, BadPaddingException); int getBlockSize() const throw (); int getKeySize() const throw (); int getOutputSize(int inputLength) throw (); AlgorithmParameters* getParameters() throw (); bytearray* getIV(); void init(int opmode, const Certificate& certificate, SecureRandom* random = 0) throw (InvalidKeyException); void init(int opmode, const Key& key, SecureRandom* random = 0) throw (InvalidKeyException); void init(int opmode, const Key& key, AlgorithmParameters* params, SecureRandom* random = 0) throw (InvalidKeyException, InvalidAlgorithmParameterException); void init(int opmode, const Key& key, const AlgorithmParameterSpec& params, SecureRandom* random = 0) throw (InvalidKeyException, InvalidAlgorithmParameterException); bytearray* update(const bytearray& input) throw (IllegalStateException); bytearray* update(const byte* input, int inputOffset, int inputLength) throw (IllegalStateException); int update(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset = 0) throw (IllegalStateException, ShortBufferException); // int update(ByteBuffer& input, ByteBuffer& output) throw (IllegalStateException, ShortBufferException); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/BadPaddingException.h0000644000175000001440000000274111216147022021405 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file BadPaddingException.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_BADPADDINGEXCEPTION_H #define _CLASS_BEE_CRYPTO_BADPADDINGEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BadPaddingException : public GeneralSecurityException { public: inline BadPaddingException() {} inline BadPaddingException(const char* message) : GeneralSecurityException(message) {} inline BadPaddingException(const String& message) : GeneralSecurityException(message) {} inline ~BadPaddingException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/SecretKeyFactory.h0000644000175000001440000000471211216147023021000 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SecretKeyFactory.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_SECRETKEYFACTORY_H #define _CLASS_BEE_CRYPTO_SECRETKEYFACTORY_H #ifdef __cplusplus #include "beecrypt/c++/crypto/SecretKeyFactorySpi.h" using beecrypt::crypto::SecretKeyFactorySpi; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI SecretKeyFactory : public Object { public: static SecretKeyFactory* getInstance(const String& algorithm) throw (NoSuchAlgorithmException); static SecretKeyFactory* getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static SecretKeyFactory* getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException); private: SecretKeyFactorySpi* _kspi; const Provider* _prov; String _algo; protected: SecretKeyFactory(SecretKeyFactorySpi* spi, const Provider* provider, const String& algorithm); public: virtual ~SecretKeyFactory(); SecretKey* generateSecret(const KeySpec&) throw (InvalidKeySpecException); KeySpec* getKeySpec(const SecretKey& key, const type_info&) throw (InvalidKeySpecException); SecretKey* translateKey(const SecretKey&) throw (InvalidKeyException); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/NoSuchPaddingException.h0000644000175000001440000000277111216147023022122 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file NoSuchPaddingException.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_NOSUCHPADDINGEXCEPTION_H #define _CLASS_BEE_CRYPTO_NOSUCHPADDINGEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class NoSuchPaddingException : public GeneralSecurityException { public: inline NoSuchPaddingException() {} inline NoSuchPaddingException(const char* message) : GeneralSecurityException(message) {} inline NoSuchPaddingException(const String& message) : GeneralSecurityException(message) {} inline ~NoSuchPaddingException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/SecretKey.h0000644000175000001440000000233011216147023017442 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SecretKey.h * \ingroup CXX_CRYPTO_m */ #ifndef _INTERFACE_BEE_CRYPTO_SECRETKEY_H #define _INTERFACE_BEE_CRYPTO_SECRETKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/Key.h" using beecrypt::security::Key; namespace beecrypt { namespace crypto { /*!\brief Secret key interface * \ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI SecretKey : public virtual Key { public: virtual ~SecretKey() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/KeyAgreement.h0000644000175000001440000000436111216147022020131 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyAgreement.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_KEYAGREEMENT_H #define _CLASS_BEE_CRYPTO_KEYAGREEMENT_H #ifdef __cplusplus #include "beecrypt/c++/crypto/KeyAgreementSpi.h" using beecrypt::crypto::KeyAgreementSpi; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI KeyAgreement : public Object { public: static KeyAgreement* getInstance(const String&) throw (NoSuchAlgorithmException); static KeyAgreement* getInstance(const String&, const String&) throw (NoSuchAlgorithmException, NoSuchProviderException); static KeyAgreement* getInstance(const String&, const Provider&) throw (NoSuchAlgorithmException); private: KeyAgreementSpi* _kspi; const Provider* _prov; String _algo; protected: KeyAgreement(KeyAgreementSpi* spi, const Provider* provider, const String& algorithm); public: virtual ~KeyAgreement(); void init(const Key&, SecureRandom* = 0) throw (InvalidKeyException); void init(const Key&, const AlgorithmParameterSpec&, SecureRandom* = 0) throw (InvalidKeyException); Key* doPhase(const Key&, bool) throw (InvalidKeyException, IllegalStateException); bytearray* generateSecret() throw (IllegalStateException); int generateSecret(bytearray&, int) throw (IllegalStateException, ShortBufferException); SecretKey* generateSecret(const String&) throw (IllegalStateException, NoSuchAlgorithmException, InvalidKeyException); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/CipherSpi.h0000644000175000001440000001051111216147022017431 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CipherSpi.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_CIPHERSPI_H #define _CLASS_BEE_CRYPTO_CIPHERSPI_H #include "beecrypt/api.h" #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::array; #include "beecrypt/c++/crypto/BadPaddingException.h" using beecrypt::crypto::BadPaddingException; #include "beecrypt/c++/crypto/IllegalBlockSizeException.h" using beecrypt::crypto::IllegalBlockSizeException; #include "beecrypt/c++/crypto/NoSuchPaddingException.h" using beecrypt::crypto::NoSuchPaddingException; #include "beecrypt/c++/lang/IllegalStateException.h" using beecrypt::lang::IllegalStateException; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/AlgorithmParameters.h" using beecrypt::security::AlgorithmParameters; #include "beecrypt/c++/security/InvalidAlgorithmParameterException.h" using beecrypt::security::InvalidAlgorithmParameterException; #include "beecrypt/c++/security/InvalidKeyException.h" using beecrypt::security::InvalidKeyException; #include "beecrypt/c++/security/Key.h" using beecrypt::security::Key; #include "beecrypt/c++/security/SecureRandom.h" using beecrypt::security::SecureRandom; #include "beecrypt/c++/security/ShortBufferException.h" using beecrypt::security::ShortBufferException; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI CipherSpi : public Object { friend class Cipher; protected: virtual bytearray* engineDoFinal(const byte* input, int inputOffset, int inputLength) throw (IllegalBlockSizeException, BadPaddingException) = 0; virtual int engineDoFinal(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException, IllegalBlockSizeException, BadPaddingException) = 0; // virtual int engineDoFinal(ByteBuffer& input, ByteBuffer& output) throw (ShortBufferException, IllegalBlockSizeException, BadPaddingException) = 0; virtual int engineGetBlockSize() const throw () = 0; virtual bytearray* engineGetIV() = 0; virtual int engineGetKeySize(const Key& key) const throw (InvalidKeyException); virtual int engineGetOutputSize(int inputLength) throw () = 0; virtual AlgorithmParameters* engineGetParameters() throw () = 0; virtual void engineInit(int opmode, const Key& key, SecureRandom* random) throw (InvalidKeyException) = 0; virtual void engineInit(int opmode, const Key& key, AlgorithmParameters* params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) = 0; virtual void engineInit(int opmode, const Key& key, const AlgorithmParameterSpec& params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException) = 0; virtual void engineSetMode(const String& mode) throw (NoSuchAlgorithmException) = 0; virtual void engineSetPadding(const String& padding) throw (NoSuchPaddingException) = 0; // virtual Key* engineUnwrap(const bytearray& wrappedKey, const String& wrappedKeyAlgorithm, int wrappedKeyType) throw (InvalidKeyException, NoSuchAlgorithmException) = 0; virtual bytearray* engineUpdate(const byte* input, int inputOffset, int inputLength) = 0; virtual int engineUpdate(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException) = 0; // virtual int engineUpdate(ByteBuffer& input, ByteBuffer& output) throw (ShortBufferException) = 0; // virtual bytearray* engineWrap(const Key& key) throw (IllegalBlockSizeException, InvalidKeyException) = 0; public: virtual ~CipherSpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/MacSpi.h0000644000175000001440000000441311216147023016724 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file MacSpi.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_MACSPI_H #define _CLASS_BEE_CRYPTO_MACSPI_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::array; #include "beecrypt/c++/lang/IllegalStateException.h" using beecrypt::lang::IllegalStateException; #include "beecrypt/c++/security/InvalidAlgorithmParameterException.h" using beecrypt::security::InvalidAlgorithmParameterException; #include "beecrypt/c++/security/InvalidKeyException.h" using beecrypt::security::InvalidKeyException; #include "beecrypt/c++/security/Key.h" using beecrypt::security::Key; #include "beecrypt/c++/security/ShortBufferException.h" using beecrypt::security::ShortBufferException; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI MacSpi : public Object { friend class Mac; protected: virtual const bytearray& engineDoFinal() = 0; virtual int engineDoFinal(byte*, int, int) throw (ShortBufferException) = 0; virtual int engineGetMacLength() = 0; virtual void engineInit(const Key&, const AlgorithmParameterSpec*) throw (InvalidKeyException, InvalidAlgorithmParameterException) = 0; virtual void engineReset() = 0; virtual void engineUpdate(byte) = 0; virtual void engineUpdate(const byte*, int, int) = 0; public: virtual ~MacSpi() {} virtual MacSpi* clone() const throw () = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/interfaces/0000777000175000001440000000000011226307270017607 500000000000000beecrypt-4.2.1/include/beecrypt/c++/crypto/interfaces/DHPublicKey.h0000644000175000001440000000301211216147023021770 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHPublicKey.h * \ingroup CXX_CRYPTO_INTERFACES_m */ #ifndef _INTERFACE_BEE_CRYPTO_INTERFACES_DHPUBLICKEY_H #define _INTERFACE_BEE_CRYPTO_INTERFACES_DHPUBLICKEY_H #include "beecrypt/mpnumber.h" #ifdef __cplusplus #include "beecrypt/c++/security/PublicKey.h" using beecrypt::security::PublicKey; #include "beecrypt/c++/crypto/interfaces/DHKey.h" using beecrypt::crypto::interfaces::DHKey; namespace beecrypt { namespace crypto { namespace interfaces { /*!\brief Diffie-Hellman public key interface * \ingroup CXX_CRYPTO_INTERFACES_m */ class DHPublicKey : public virtual PublicKey, public DHKey { public: virtual ~DHPublicKey() {} virtual const BigInteger& getY() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/interfaces/PBEKey.h0000644000175000001440000000272211216147023020753 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file PBEKey.h * \ingroup CXX_CRYPTO_INTERFACES_m */ #ifndef _INTERFACE_BEE_CRYPTO_INTERFACES_PBEKEY_H #define _INTERFACE_BEE_CRYPTO_INTERFACES_PBEKEY_H #ifdef __cplusplus #include "beecrypt/c++/crypto/SecretKey.h" using beecrypt::crypto::SecretKey; namespace beecrypt { namespace crypto { namespace interfaces { /*!\brief PBEKey interface * \ingroup CXX_CRYPTO_INTERFACES_m */ class BEECRYPTCXXAPI PBEKey : public SecretKey { public: virtual ~PBEKey() {} virtual int getIterationCount() const throw () = 0; virtual const array& getPassword() const throw () = 0; virtual const bytearray* getSalt() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/interfaces/DHKey.h0000644000175000001440000000252311216147023020637 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHKey.h * \ingroup CXX_CRYPTO_INTERFACES_m */ #ifndef _INTERFACE_BEE_CRYPTO_INTERFACES_DHKEY_H #define _INTERFACE_BEE_CRYPTO_INTERFACES_DHKEY_H #ifdef __cplusplus #include "beecrypt/c++/crypto/interfaces/DHParams.h" using beecrypt::crypto::interfaces::DHParams; namespace beecrypt { namespace crypto { namespace interfaces { /*!\brief Diffie-Hellman key interface * \ingroup CXX_CRYPTO_INTERFACES_m */ class DHKey { public: virtual ~DHKey() {} virtual const DHParams& getParams() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/interfaces/DHPrivateKey.h0000644000175000001440000000276311216147023022200 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHPrivateKey.h * \ingroup CXX_CRYPTO_INTERFACES_m */ #ifndef _INTERFACE_BEE_CRYPTO_INTERFACES_DHPRIVATEKEY_H #define _INTERFACE_BEE_CRYPTO_INTERFACES_DHPRIVATEKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/PrivateKey.h" using beecrypt::security::PrivateKey; #include "beecrypt/c++/crypto/interfaces/DHKey.h" using beecrypt::crypto::interfaces::DHKey; namespace beecrypt { namespace crypto { namespace interfaces { /*!\brief Diffie-Hellman private key interface * \ingroup CXX_CRYPTO_INTERFACES_m */ class DHPrivateKey : public virtual PrivateKey, public DHKey { public: virtual ~DHPrivateKey() {} virtual const BigInteger& getX() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/interfaces/DHParams.h0000644000175000001440000000262111216147023021331 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DHParams.h * \ingroup CXX_CRYPTO_INTERFACES_m */ #ifndef _INTERFACE_BEE_CRYPTO_INTERFACES_DHPARAMS_H #define _INTERFACE_BEE_CRYPTO_INTERFACES_DHPARAMS_H #ifdef __cplusplus #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; namespace beecrypt { namespace crypto { namespace interfaces { /*!\ingroup CXX_CRYPTO_INTERFACES_m */ class BEECRYPTCXXAPI DHParams { public: virtual ~DHParams() {} virtual const BigInteger& getP() const throw () = 0; virtual const BigInteger& getG() const throw () = 0; virtual int getL() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/IllegalBlockSizeException.h0000644000175000001440000000302111216147022022577 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file IllegalBlockSizeException.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_ILLEGALBLOCKSIZEEXCEPTION_H #define _CLASS_BEE_CRYPTO_ILLEGALBLOCKSIZEEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class IllegalBlockSizeException : public GeneralSecurityException { public: inline IllegalBlockSizeException() {} inline IllegalBlockSizeException(const char* message) : GeneralSecurityException(message) {} inline IllegalBlockSizeException(const String& message) : GeneralSecurityException(message) {} inline ~IllegalBlockSizeException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/NullCipher.h0000644000175000001440000000526111216147023017617 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file NullCipher.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_NULLCIPHER_H #define _CLASS_BEE_CRYPTO_NULLCIPHER_H #ifdef __cplusplus #include "beecrypt/c++/crypto/Cipher.h" using beecrypt::crypto::Cipher; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI NullCipher : public Cipher { private: class NullCipherSpi : public CipherSpi { protected: virtual bytearray* engineDoFinal(const byte* input, int inputOffset, int inputLength) throw (IllegalBlockSizeException, BadPaddingException); virtual int engineDoFinal(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException, IllegalBlockSizeException, BadPaddingException); virtual int engineGetBlockSize() const throw (); virtual bytearray* engineGetIV(); virtual int engineGetOutputSize(int inputLength) throw (); virtual AlgorithmParameters* engineGetParameters() throw (); virtual void engineInit(int opmode, const Key& key, SecureRandom* random) throw (InvalidKeyException); virtual void engineInit(int opmode, const Key& key, AlgorithmParameters* params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException); virtual void engineInit(int opmode, const Key& key, const AlgorithmParameterSpec& params, SecureRandom* random) throw (InvalidKeyException, InvalidAlgorithmParameterException); virtual void engineSetMode(const String& mode) throw (NoSuchAlgorithmException); virtual void engineSetPadding(const String& padding) throw (NoSuchPaddingException); virtual bytearray* engineUpdate(const byte* input, int inputOffset, int inputLength); virtual int engineUpdate(const byte* input, int inputOffset, int inputLength, bytearray& output, int outputOffset) throw (ShortBufferException); }; public: NullCipher(); virtual ~NullCipher() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/SecretKeyFactorySpi.h0000644000175000001440000000364211216147023021455 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SecretKeyFactorySpi.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_SECRETKEYFACTORYSPI_H #define _CLASS_BEE_CRYPTO_SECRETKEYFACTORYSPI_H #ifdef __cplusplus #include "beecrypt/c++/crypto/SecretKey.h" using beecrypt::crypto::SecretKey; #include "beecrypt/c++/security/InvalidKeyException.h" using beecrypt::security::InvalidKeyException; #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; #include "beecrypt/c++/security/spec/InvalidKeySpecException.h" using beecrypt::security::spec::InvalidKeySpecException; #include using std::type_info; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI SecretKeyFactorySpi : public Object { friend class SecretKeyFactory; protected: virtual SecretKey* engineGenerateSecret(const KeySpec&) throw (InvalidKeySpecException) = 0; virtual KeySpec* engineGetKeySpec(const SecretKey&, const type_info&) throw (InvalidKeySpecException) = 0; virtual SecretKey* engineTranslateKey(const SecretKey&) throw (InvalidKeyException) = 0; public: virtual ~SecretKeyFactorySpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/crypto/Mac.h0000644000175000001440000000531011216147023016245 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Mac.h * \ingroup CXX_CRYPTO_m */ #ifndef _CLASS_BEE_CRYPTO_MAC_H #define _CLASS_BEE_CRYPTO_MAC_H #ifdef __cplusplus #include "beecrypt/c++/crypto/MacSpi.h" using beecrypt::crypto::MacSpi; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; namespace beecrypt { namespace crypto { /*!\ingroup CXX_CRYPTO_m */ class BEECRYPTCXXAPI Mac : public Object { public: static Mac* getInstance(const String&) throw (NoSuchAlgorithmException); static Mac* getInstance(const String&, const String&) throw (NoSuchAlgorithmException, NoSuchProviderException); static Mac* getInstance(const String&, const Provider&) throw (NoSuchAlgorithmException); private: MacSpi* _mspi; String _algo; const Provider* _prov; bool _init; protected: Mac(MacSpi* macSpi, const Provider* provider, const String& algorithm); public: virtual ~Mac(); Mac* clone() const throw (); const bytearray& doFinal() throw (IllegalStateException); const bytearray& doFinal(const bytearray&) throw (IllegalStateException); int doFinal(byte* data, int offset, int length) throw (IllegalStateException, ShortBufferException); int getMacLength(); void init(const Key&) throw (InvalidKeyException); void init(const Key&, const AlgorithmParameterSpec*) throw (InvalidKeyException, InvalidAlgorithmParameterException); void reset(); void update(byte) throw (IllegalStateException); void update(const byte* data, int offset, int length) throw (IllegalStateException); void update(const bytearray&) throw (IllegalStateException); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/array.h0000644000175000001440000001135211216147022015345 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file array.h * \brief Array template class. * \author Bob Deblier * \ingroup CXX_m */ #ifndef _TEMPLATE_BEE_ARRAY_H #define _TEMPLATE_BEE_ARRAY_H #include "beecrypt/api.h" #ifdef __cplusplus #include #include #include namespace beecrypt { template class array; template array operator+(const array&, const array&); /*!\brief A basic array class. * \warning Only use this class for arrays of primitive types or pointers. */ template class array { friend array operator+ <> (const array&, const array&); protected: T* _data; int _size; public: array() throw () { _data = 0; _size = 0; } array(int size) throw (std::bad_alloc) { if (size > 0) { _data = (T*) calloc(size, sizeof(T)); if (_data == 0) throw std::bad_alloc(); } else _data = 0; _size = size; } array(const T* data, int size) throw (std::bad_alloc) { if (size > 0) { _data = (T*) malloc(size * sizeof(T)); if (_data == 0) throw std::bad_alloc(); _size = size; memcpy(_data, data, _size * sizeof(T)); } else { _data = 0; _size = 0; } } array(const array& copy) throw (std::bad_alloc) { if (copy._size) { _data = (T*) malloc(copy._size * sizeof(T)); if (_data == 0) throw std::bad_alloc(); _size = copy._size; memcpy(_data, copy._data, _size * sizeof(T)); } else { _data = 0; _size = 0; } } ~array() throw () { if (_data) { free(_data); _data = 0; } } array* clone() const throw (std::bad_alloc) { return new array(*this); } const array& operator=(const array& set) throw (std::bad_alloc) { resize(set._size); if (_size) memcpy(_data, set._data, _size * sizeof(T)); return *this; } bool operator==(const array& cmp) const throw () { if (_size != cmp._size) return false; if (_size == 0 && cmp._size == 0) return true; return !::memcmp(_data, cmp._data, _size * sizeof(T)); } bool operator!=(const array& cmp) const throw () { if (_size != cmp._size) return true; if (_size == 0 && cmp._size == 0) return false; return memcmp(_data, cmp._data, _size * sizeof(T)); } inline T* data() throw () { return _data; } inline const T* data() const throw () { return _data; } inline int size() const throw () { return _size; } void fill(T val) throw () { for (int i = 0; i < _size; i++) _data[i] = val; } void replace(T* data, int size) throw () { if (_data) free(_data); _data = data; _size = size; } void swap(array& swp) throw () { T* tmp_data = swp._data; int tmp_size = swp._size; swp._data = _data; swp._size = _size; _data = tmp_data; _size = tmp_size; } void resize(int newsize) throw (std::bad_alloc) { if (newsize > 0) { if (newsize != _size) { _data = (T*) (_data ? realloc(_data, newsize * sizeof(T)) : calloc(newsize, sizeof(T))); if (_data == 0) throw std::bad_alloc(); } } else { if (_data) { free(_data); _data = 0; } } _size = newsize; } inline T& operator[](int _n) throw () { return _data[_n]; } inline const T operator[](int _n) const throw () { return _data[_n]; } const array& operator+=(const array& rhs) throw () { if (rhs._size) { int _curr = _size; resize(_size+rhs._size); memcpy(_data+_curr, rhs._data, rhs._size * sizeof(T)); } return *this; } }; template array operator+(const array& lhs, const array& rhs) { array _con(lhs._size + rhs._size); if (lhs._size) memcpy(_con._data, lhs._data, lhs._size * sizeof(T)); if (rhs._size) memcpy(_con._data + lhs._size, rhs._data, rhs._size * sizeof(T)); return _con; } typedef array bytearray; typedef array jbytearray; typedef array jchararray; } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/0000777000175000001440000000000011226307271016014 500000000000000beecrypt-4.2.1/include/beecrypt/c++/security/PrivateKey.h0000644000175000001440000000232011216147023020155 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file PrivateKey.h * \ingroup CXX_SECURITY_m */ #ifndef _INTERFACE_BEE_SECURITY_PRIVATEKEY_H #define _INTERFACE_BEE_SECURITY_PRIVATEKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/Key.h" using beecrypt::security::Key; namespace beecrypt { namespace security { /*!\brief PrivateKey interface * \ingroup CXX_SECURITY_m */ class PrivateKey : public Key { public: virtual ~PrivateKey() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/KeyPairGeneratorSpi.h0000644000175000001440000000406511216147023021771 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyPairGeneratorSpi.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_KEYPAIRGENERATORSPI_H #define _CLASS_BEE_SECURITY_KEYPAIRGENERATORSPI_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/KeyPair.h" using beecrypt::security::KeyPair; #include "beecrypt/c++/security/SecureRandom.h" using beecrypt::security::SecureRandom; #include "beecrypt/c++/security/InvalidAlgorithmParameterException.h" using beecrypt::security::InvalidAlgorithmParameterException; #include "beecrypt/c++/security/InvalidParameterException.h" using beecrypt::security::InvalidParameterException; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI KeyPairGeneratorSpi : public Object { friend class KeyPairGenerator; protected: virtual KeyPair* engineGenerateKeyPair() = 0; virtual void engineInitialize(const AlgorithmParameterSpec&, SecureRandom*) throw (InvalidAlgorithmParameterException) = 0; virtual void engineInitialize(int, SecureRandom*) throw (InvalidParameterException) = 0; public: virtual ~KeyPairGeneratorSpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/NoSuchAlgorithmException.h0000644000175000001440000000302311216147023023020 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file NoSuchAlgorithmException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_NOSUCHALGORITHMEXCEPTION_H #define _CLASS_BEE_SECURITY_NOSUCHALGORITHMEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class NoSuchAlgorithmException : public GeneralSecurityException { public: inline NoSuchAlgorithmException() {} inline NoSuchAlgorithmException(const char* message) : GeneralSecurityException(message) {} inline NoSuchAlgorithmException(const String& message) : GeneralSecurityException(message) {} inline ~NoSuchAlgorithmException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/KeyFactorySpi.h0000644000175000001440000000413611216147023020635 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyFactorySpi.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_KEYFACTORYSPI_H #define _CLASS_BEE_SECURITY_KEYFACTORYSPI_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/PrivateKey.h" using beecrypt::security::PrivateKey; #include "beecrypt/c++/security/PublicKey.h" using beecrypt::security::PublicKey; #include "beecrypt/c++/security/InvalidKeyException.h" #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; #include "beecrypt/c++/security/spec/InvalidKeySpecException.h" using beecrypt::security::spec::InvalidKeySpecException; #include using std::type_info; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI KeyFactorySpi : public Object { friend class KeyFactory; protected: virtual PrivateKey* engineGeneratePrivate(const KeySpec& spec) throw (InvalidKeySpecException) = 0; virtual PublicKey* engineGeneratePublic(const KeySpec& spec) throw (InvalidKeySpecException) = 0; virtual KeySpec* engineGetKeySpec(const Key& key, const type_info& info) throw (InvalidKeySpecException) = 0; virtual Key* engineTranslateKey(const Key& key) throw (InvalidKeyException) = 0; public: virtual ~KeyFactorySpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/0000777000175000001440000000000011226307271016746 500000000000000beecrypt-4.2.1/include/beecrypt/c++/security/spec/RSAPrivateCrtKeySpec.h0000644000175000001440000000410211216147023022741 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAPrivateCrtKeySpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_RSAPRIVATECRTKEYSPEC_H #define _CLASS_BEE_SECURITY_SPEC_RSAPRIVATECRTKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/security/spec/RSAPrivateKeySpec.h" using beecrypt::security::spec::RSAPrivateKeySpec; namespace beecrypt { namespace security { namespace spec { /*!\ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI RSAPrivateCrtKeySpec : public RSAPrivateKeySpec { private: BigInteger _e; BigInteger _p; BigInteger _q; BigInteger _dp; BigInteger _dq; BigInteger _qi; public: RSAPrivateCrtKeySpec(const BigInteger& modulus, const BigInteger& publicExponent, const BigInteger& privateExponent, const BigInteger& primeP, const BigInteger& primeQ, const BigInteger& primeExponentP, const BigInteger& primeExponentQ, const BigInteger& crtCoefficient); virtual ~RSAPrivateCrtKeySpec() {} const BigInteger& getPublicExponent() const throw (); const BigInteger& getPrimeP() const throw (); const BigInteger& getPrimeQ() const throw (); const BigInteger& getPrimeExponentP() const throw (); const BigInteger& getPrimeExponentQ() const throw (); const BigInteger& getCrtCoefficient() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/RSAPublicKeySpec.h0000644000175000001440000000327011216147023022101 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAPublicKeySpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_RSAPUBLICKEYSPEC_H #define _CLASS_BEE_SECURITY_SPEC_RSAPUBLICKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace security { namespace spec { /*!\ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI RSAPublicKeySpec : public Object, public virtual KeySpec { private: BigInteger _n; BigInteger _e; public: RSAPublicKeySpec(const BigInteger& modulus, const BigInteger& publicExponent); virtual ~RSAPublicKeySpec() {} const BigInteger& getModulus() const throw (); const BigInteger& getPublicExponent() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/InvalidKeySpecException.h0000644000175000001440000000310011216147023023552 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file InvalidKeySpecException.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_INVALIDKEYSPECEXCEPTION_H #define _CLASS_BEE_SECURITY_SPEC_INVALIDKEYSPECEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { namespace spec { /*!\ingroup CXX_SECURITY_SPEC_m */ class InvalidKeySpecException : public GeneralSecurityException { public: inline InvalidKeySpecException() {} inline InvalidKeySpecException(const char* message) : GeneralSecurityException(message) {} inline InvalidKeySpecException(const String& message) : GeneralSecurityException(message) {} inline ~InvalidKeySpecException() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/DSAParameterSpec.h0000644000175000001440000000375011216147023022117 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAParameterSpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_DSAPARAMETERSPEC_H #define _CLASS_BEE_SECURITY_SPEC_DSAPARAMETERSPEC_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; #include "beecrypt/c++/security/interfaces/DSAParams.h" using beecrypt::security::interfaces::DSAParams; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace security { namespace spec { /*!\brief DSA parameter specification * \ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI DSAParameterSpec : public Object, public virtual AlgorithmParameterSpec, public virtual DSAParams { private: BigInteger _p; BigInteger _q; BigInteger _g; public: DSAParameterSpec(const DSAParams&); DSAParameterSpec(const BigInteger& p, const BigInteger& q, const BigInteger& g); virtual ~DSAParameterSpec() {} const BigInteger& getP() const throw (); const BigInteger& getQ() const throw (); const BigInteger& getG() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/InvalidParameterSpecException.h0000644000175000001440000000316011216147023024750 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file InvalidParameterSpecException.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_INVALIDPARAMETERSPECEXCEPTION_H #define _CLASS_BEE_SECURITY_SPEC_INVALIDPARAMETERSPECEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { namespace spec { /*!\ingroup CXX_SECURITY_SPEC_m */ class InvalidParameterSpecException : public GeneralSecurityException { public: inline InvalidParameterSpecException() {} inline InvalidParameterSpecException(const char* message) : GeneralSecurityException(message) {} inline InvalidParameterSpecException(const String& message) : GeneralSecurityException(message) {} inline ~InvalidParameterSpecException() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/AlgorithmParameterSpec.h0000644000175000001440000000247611216147023023442 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AlgorithmParameterSpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _INTERFACE_BEE_SECURITY_SPEC_ALGORITHMPARAMETERSPEC_H #define _INTERFACE_BEE_SECURITY_SPEC_ALGORITHMPARAMETERSPEC_H #include "beecrypt/api.h" #ifdef __cplusplus namespace beecrypt { namespace security { namespace spec { /*!\brief The base class for specification of cryptographic parameters. * \ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI AlgorithmParameterSpec { public: virtual ~AlgorithmParameterSpec() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/DSAPrivateKeySpec.h0000644000175000001440000000355511216147023022265 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAPrivateKeySpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_DSAPRIVATEKEYSPEC_H #define _CLASS_BEE_SECURITY_SPEC_DSAPRIVATEKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace security { namespace spec { /*!\brief DSA private key specification * \ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI DSAPrivateKeySpec : public Object, public virtual KeySpec { private: BigInteger _p; BigInteger _q; BigInteger _g; BigInteger _x; public: DSAPrivateKeySpec(const BigInteger& x, const BigInteger& p, const BigInteger& q, const BigInteger& g); virtual ~DSAPrivateKeySpec() {} const BigInteger& getP() const throw (); const BigInteger& getQ() const throw (); const BigInteger& getG() const throw (); const BigInteger& getX() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/RSAPrivateKeySpec.h0000644000175000001440000000330011216147023022267 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAPrivateKeySpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_RSAPRIVATEKEYSPEC_H #define _CLASS_BEE_SECURITY_SPEC_RSAPRIVATEKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace security { namespace spec { /*!\ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI RSAPrivateKeySpec : public Object, public virtual KeySpec { private: BigInteger _n; BigInteger _d; public: RSAPrivateKeySpec(const BigInteger& modulus, const BigInteger& privateExponent); virtual ~RSAPrivateKeySpec() {} const BigInteger& getModulus() const throw (); const BigInteger& getPrivateExponent() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/EncodedKeySpec.h0000644000175000001440000000316311216147023021657 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file EncodedKeySpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_ENCODEDKEYSPEC_H #define _CLASS_BEE_SECURITY_SPEC_ENCODEDKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace security { namespace spec { /*!\brief Encoded key specification * \ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI EncodedKeySpec : public Object, public virtual KeySpec { private: bytearray _encoded; public: EncodedKeySpec(const byte*, int); EncodedKeySpec(const bytearray&); virtual ~EncodedKeySpec() {} const bytearray& getEncoded() const throw (); virtual const String& getFormat() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/RSAKeyGenParameterSpec.h0000644000175000001440000000344111216147023023235 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAKeyGenParameterSpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_RSAKEYGENPARAMETERSPEC #define _CLASS_BEE_SECURITY_SPEC_RSAKEYGENPARAMETERSPEC #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace security { namespace spec { /*!\ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI RSAKeyGenParameterSpec : public Object, public virtual AlgorithmParameterSpec { public: static const BigInteger F0; static const BigInteger F4; private: int _keysize; BigInteger _e; public: RSAKeyGenParameterSpec(int, const BigInteger&); virtual ~RSAKeyGenParameterSpec() {} int getKeysize() const throw (); const BigInteger& getPublicExponent() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/DSAPublicKeySpec.h0000644000175000001440000000354611216147023022071 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAPublicKeySpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_SPEC_DSAPUBLICKEYSPEC_H #define _CLASS_BEE_SECURITY_SPEC_DSAPUBLICKEYSPEC_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; #include "beecrypt/c++/security/spec/KeySpec.h" using beecrypt::security::spec::KeySpec; namespace beecrypt { namespace security { namespace spec { /*!\brief DSA public key specification * \ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI DSAPublicKeySpec : public Object, public virtual KeySpec { private: BigInteger _p; BigInteger _q; BigInteger _g; BigInteger _y; public: DSAPublicKeySpec(const BigInteger& y, const BigInteger& p, const BigInteger& q, const BigInteger& g); virtual ~DSAPublicKeySpec() {} const BigInteger& getP() const throw (); const BigInteger& getQ() const throw (); const BigInteger& getG() const throw (); const BigInteger& getY() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/spec/KeySpec.h0000644000175000001440000000240211216147023020370 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeySpec.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _INTERFACE_BEE_SECURITY_SPEC_KEYSPEC_H #define _INTERFACE_BEE_SECURITY_SPEC_KEYSPEC_H #include "beecrypt/api.h" #ifdef __cplusplus namespace beecrypt { namespace security { namespace spec { /*!\brief Transparent specification of key material that represent a cryptographic key * \ingroup CXX_SECURITY_SPEC_m */ class BEECRYPTCXXAPI KeySpec { public: virtual ~KeySpec() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/DigestOutputStream.h0000644000175000001440000000331111216147023021707 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DigestOutputStream.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_DIGESTOUTPUTSTREAM_H #define _CLASS_BEE_SECURITY_DIGESTOUTPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/FilterOutputStream.h" using beecrypt::io::FilterOutputStream; #include "beecrypt/c++/security/MessageDigest.h" using beecrypt::security::MessageDigest; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI DigestOutputStream : public FilterOutputStream { private: bool _on; protected: MessageDigest& digest; public: DigestOutputStream(OutputStream& out, MessageDigest& m); virtual ~DigestOutputStream() {} virtual void write(byte b) throw (IOException); virtual void write(const byte* data, int offset, int length) throw (IOException); void on(bool on); MessageDigest& getMessageDigest(); void setMessageDigest(MessageDigest& m); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/KeyPair.h0000644000175000001440000000275011216147023017445 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyPair.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_KEYPAIR_H #define _CLASS_BEE_SECURITY_KEYPAIR_H #ifdef __cplusplus #include "beecrypt/c++/security/PrivateKey.h" using beecrypt::security::PrivateKey; #include "beecrypt/c++/security/PublicKey.h" using beecrypt::security::PublicKey; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI KeyPair : public Object { friend class KeyPairGenerator; private: PublicKey* _pub; PrivateKey* _pri; public: KeyPair(PublicKey*, PrivateKey*); virtual ~KeyPair(); const PublicKey& getPublic() const throw (); const PrivateKey& getPrivate() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/SignatureException.h0000644000175000001440000000274311216147023021723 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SignatureException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_SIGNATUREEXCEPTION_H #define _CLASS_BEE_SECURITY_SIGNATUREEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class SignatureException : public GeneralSecurityException { public: inline SignatureException() {} inline SignatureException(const char* message) : GeneralSecurityException(message) {} inline SignatureException(const String& message) : GeneralSecurityException(message) {} inline ~SignatureException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/ShortBufferException.h0000644000175000001440000000276311216147023022215 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ShortBufferException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_SHORTBUFFEREXCEPTION_H #define _CLASS_BEE_SECURITY_SHORTBUFFEREXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class ShortBufferException : public GeneralSecurityException { public: inline ShortBufferException() {} inline ShortBufferException(const char* message) : GeneralSecurityException(message) {} inline ShortBufferException(const String& message) : GeneralSecurityException(message) {} inline ~ShortBufferException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/AlgorithmParametersSpi.h0000644000175000001440000000417411216147023022531 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AlgorithmParametersSpi.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_ALGORITHMPARAMETERSSPI_H #define _CLASS_BEE_SECURITY_ALGORITHMPARAMETERSSPI_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::bytearray; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/io/IOException.h" using beecrypt::io::IOException; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; #include "beecrypt/c++/security/spec/InvalidParameterSpecException.h" using beecrypt::security::spec::InvalidParameterSpecException; #include using std::type_info; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI AlgorithmParametersSpi : public Object { friend class AlgorithmParameters; protected: virtual const bytearray& engineGetEncoded(const String* format = 0) throw (IOException) = 0; virtual AlgorithmParameterSpec* engineGetParameterSpec(const type_info& info) = 0; virtual void engineInit(const AlgorithmParameterSpec& spec) throw (InvalidParameterSpecException) = 0; virtual void engineInit(const byte* data, int size, const String* format = 0) = 0; virtual String engineToString() throw () = 0; public: virtual ~AlgorithmParametersSpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/InvalidAlgorithmParameterException.h0000644000175000001440000000331511216147023025054 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file InvalidAlgorithmParameterException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_INVALIDALGORITHMPARAMETEREXCEPTION_H #define _CLASS_BEE_SECURITY_INVALIDALGORITHMPARAMETEREXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class InvalidAlgorithmParameterException : public GeneralSecurityException { public: inline InvalidAlgorithmParameterException() {} inline InvalidAlgorithmParameterException(const char* message) : GeneralSecurityException(message) {} inline InvalidAlgorithmParameterException(const String& message) : GeneralSecurityException(message) {} inline InvalidAlgorithmParameterException(const Throwable* cause) : GeneralSecurityException(cause) {} inline ~InvalidAlgorithmParameterException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/Provider.h0000644000175000001440000000410311216147023017665 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Provider.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_PROVIDER_H #define _CLASS_BEE_SECURITY_PROVIDER_H #ifdef __cplusplus #include "beecrypt/c++/util/Properties.h" using beecrypt::util::Properties; #include namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class Provider : public Properties { friend class Security; private: typedef Object* (*instantiator)(); class Instantiator : public Object { private: instantiator _inst; public: Instantiator(instantiator inst); virtual ~Instantiator() {} Object* instantiate(); }; String _name; String _info; double _vers; UConverter* _conv; Hashtable _imap; Object* instantiate(const String& name) const; protected: #if WIN32 HANDLE _dlhandle; #else void* _dlhandle; #endif BEECRYPTCXXAPI Provider(const String& name, double version, const String& info); public: BEECRYPTCXXAPI virtual ~Provider(); BEECRYPTCXXAPI Object* setProperty(const String& key, const String& value); BEECRYPTCXXAPI const String& getName() const throw (); BEECRYPTCXXAPI const String& getInfo() const throw (); BEECRYPTCXXAPI double getVersion() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/DigestInputStream.h0000644000175000001440000000325611216147023021516 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DigestInputStream.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_DIGESTINPUTSTREAM_H #define _CLASS_BEE_SECURITY_DIGESTINPUTSTREAM_H #ifdef __cplusplus #include "beecrypt/c++/io/FilterInputStream.h" using beecrypt::io::FilterInputStream; #include "beecrypt/c++/security/MessageDigest.h" using beecrypt::security::MessageDigest; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI DigestInputStream : public FilterInputStream { private: bool _on; protected: MessageDigest& digest; public: DigestInputStream(InputStream& in, MessageDigest& m); virtual ~DigestInputStream() {} virtual int read() throw (IOException); virtual int read(byte* data, int offset, int length) throw (IOException); void on(bool on); MessageDigest& getMessageDigest(); void setMessageDigest(MessageDigest& m); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/InvalidKeyException.h0000644000175000001440000000277611216147023022027 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file InvalidKeyException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_INVALIDKEYEXCEPTION_H #define _CLASS_BEE_SECURITY_INVALIDKEYEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/KeyException.h" using beecrypt::security::KeyException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class InvalidKeyException : public KeyException { public: inline InvalidKeyException() {} inline InvalidKeyException(const char* message) : KeyException(message) {} inline InvalidKeyException(const String& message) : KeyException(message) {} inline InvalidKeyException(const Throwable* cause) : KeyException(cause) {} inline ~InvalidKeyException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/ProviderException.h0000644000175000001440000000310111216147023021541 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ProviderException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_PROVIDEREXCEPTION_H #define _CLASS_BEE_SECURITY_PROVIDEREXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/RuntimeException.h" using beecrypt::lang::RuntimeException; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class ProviderException : public RuntimeException { public: inline ProviderException() {} inline ProviderException(const char* message) : RuntimeException(message) {} inline ProviderException(const String& message) : RuntimeException(message) {} inline ProviderException(const Throwable* cause) : RuntimeException(cause) {} inline ~ProviderException() { } }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/AlgorithmParameters.h0000644000175000001440000000517311216147023022055 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AlgorithmParameters.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_ALGORITHMPARAMETERS_H #define _CLASS_BEE_SECURITY_ALGORITHMPARAMETERS_H #ifdef __cplusplus #include "beecrypt/c++/security/AlgorithmParametersSpi.h" using beecrypt::security::AlgorithmParametersSpi; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI AlgorithmParameters : public Object { public: static AlgorithmParameters* getInstance(const String& algorithm) throw (NoSuchAlgorithmException); static AlgorithmParameters* getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static AlgorithmParameters* getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException); private: AlgorithmParametersSpi* _aspi; const Provider* _prov; String _algo; protected: AlgorithmParameters(AlgorithmParametersSpi* spi, const Provider* provider, const String& algorithm); public: virtual ~AlgorithmParameters(); const bytearray& getEncoded(const String* format = 0) throw (IOException); AlgorithmParameterSpec* getParameterSpec(const type_info&) throw (InvalidParameterSpecException); void init(const AlgorithmParameterSpec& spec) throw (InvalidParameterSpecException); void init(const byte* data, int size, const String* format = 0); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); String toString() throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/Signature.h0000644000175000001440000000776111216147023020051 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Signature.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_SIGNATURE_H #define _CLASS_BEE_SECURITY_SIGNATURE_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/SignatureSpi.h" using beecrypt::security::SignatureSpi; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI Signature : public Object { protected: static const int UNINITIALIZED = 0; static const int VERIFY = 1; static const int SIGN = 2; public: /*!\brief Returns a Signature object that implements the requested algorithm. * * If the default provider has an implementation of the requested * algorithm that one is used; otherwise other providers are * searched. * * \param algorithm the standard name of the requested algorithm. * \throw NoSuchAlgorithmException if the requested algorithm is not available. */ static Signature* getInstance(const String& algorithm) throw (NoSuchAlgorithmException); /*!\brief Returns a Signature object that implements the requested algorithm, from the requested provider. * * \param algorithm the standard algorithm name. * \param provider the name of the provider. * \throw NoSuchAlgorithmException if the requested algorithm is not available in the requested provider. * \throw NoSuchProviderException if the requested provider is not available. */ static Signature* getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static Signature* getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException); protected: int state; private: SignatureSpi* _sspi; const Provider* _prov; String _algo; protected: Signature(SignatureSpi* spi, const Provider* provider, const String& algorithm); public: virtual ~Signature(); AlgorithmParameters* getParameters() const; void setParameter(const AlgorithmParameterSpec&) throw (InvalidAlgorithmParameterException); void initSign(const PrivateKey&) throw (InvalidKeyException); void initSign(const PrivateKey&, SecureRandom*) throw (InvalidKeyException); void initVerify(const PublicKey&) throw (InvalidKeyException); bytearray* sign() throw (IllegalStateException, SignatureException); int sign(byte*, int, int) throw (ShortBufferException, IllegalStateException, SignatureException); int sign(bytearray&) throw (IllegalStateException, SignatureException); bool verify(const bytearray&) throw (IllegalStateException, SignatureException); bool verify(const byte*, int, int) throw (IllegalStateException, SignatureException); void update(byte) throw (IllegalStateException); void update(const byte*, int, int) throw (IllegalStateException); void update(const bytearray&) throw (IllegalStateException); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/AlgorithmParameterGeneratorSpi.h0000644000175000001440000000426111216147023024212 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AlgorithmParameterGeneratorSpi.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_ALGORITHMPARAMETERGENERATORSPI_H #define _CLASS_BEE_SECURITY_ALGORITHMPARAMETERGENERATORSPI_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/AlgorithmParameters.h" using beecrypt::security::AlgorithmParameters; #include "beecrypt/c++/security/SecureRandom.h" using beecrypt::security::SecureRandom; #include "beecrypt/c++/security/InvalidAlgorithmParameterException.h" using beecrypt::security::InvalidAlgorithmParameterException; #include "beecrypt/c++/security/InvalidParameterException.h" using beecrypt::security::InvalidParameterException; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI AlgorithmParameterGeneratorSpi : public Object { friend class AlgorithmParameterGenerator; protected: virtual AlgorithmParameters* engineGenerateParameters() = 0; virtual void engineInit(const AlgorithmParameterSpec& genParamSpec, SecureRandom* random) throw (InvalidAlgorithmParameterException) = 0; virtual void engineInit(int size, SecureRandom* random) throw (InvalidParameterException) = 0; public: virtual ~AlgorithmParameterGeneratorSpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/SecureRandom.h0000644000175000001440000000450511216147023020470 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SecureRandom.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_SECURERANDOM_H #define _CLASS_BEE_SECURITY_SECURERANDOM_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus #include "beecrypt/c++/security/SecureRandomSpi.h" using beecrypt::security::SecureRandomSpi; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI SecureRandom : public Object { public: static SecureRandom* getInstance(const String& type) throw (NoSuchAlgorithmException); static SecureRandom* getInstance(const String& type, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static SecureRandom* getInstance(const String& type, const Provider& provider) throw (NoSuchAlgorithmException); static void getSeed(byte*, int); private: SecureRandomSpi* _rspi; const Provider* _prov; String _type; protected: SecureRandom(SecureRandomSpi* spi, const Provider* provider, const String& type); public: SecureRandom(); virtual ~SecureRandom(); void generateSeed(byte*, int); void nextBytes(byte*, int); void setSeed(const byte*, int); const String& getType() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/MessageDigestSpi.h0000644000175000001440000000355411216147023021304 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file MessageDigestSpi.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_MESSAGEDIGESTSPI_H #define _CLASS_BEE_SECURITY_MESSAGEDIGESTSPI_H #include "beecrypt/api.h" #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::bytearray; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/ShortBufferException.h" using beecrypt::security::ShortBufferException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI MessageDigestSpi : public Object { friend class MessageDigest; protected: virtual const bytearray& engineDigest() = 0; virtual int engineDigest(byte* data, int offset, int length) throw (ShortBufferException) = 0; virtual int engineGetDigestLength() = 0; virtual void engineReset() = 0; virtual void engineUpdate(byte b) = 0; virtual void engineUpdate(const byte* data, int offset, int length) = 0; public: virtual ~MessageDigestSpi() {} virtual MessageDigestSpi* clone() const throw (CloneNotSupportedException) = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/0000777000175000001440000000000011226307271016751 500000000000000beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertificateFactorySpi.h0000644000175000001440000000351011216147023023257 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertificateFactorySpi.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTIFICATEFACTORYSPI_H #define _CLASS_BEE_SECURITY_CERT_CERTIFICATEFACTORYSPI_H #include "beecrypt/api.h" #ifdef __cplusplus #include "beecrypt/c++/io/InputStream.h" using beecrypt::io::InputStream; #include "beecrypt/c++/io/OutputStream.h" using beecrypt::io::OutputStream; #include "beecrypt/c++/security/cert/Certificate.h" using beecrypt::security::cert::Certificate; #include "beecrypt/c++/util/Collection.h" using beecrypt::util::Collection; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class BEECRYPTCXXAPI CertificateFactorySpi : public Object { friend class CertificateFactory; protected: virtual Certificate* engineGenerateCertificate(InputStream& in) throw (CertificateException) = 0; virtual Collection* engineGenerateCertificates(InputStream& in) throw (CertificateException) = 0; public: virtual ~CertificateFactorySpi() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertPathValidator.h0000644000175000001440000000513111216147023022412 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertPathValidator.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTPATHVALIDATOR_H #define _CLASS_BEE_SECURITY_CERT_CERTPATHVALIDATOR_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; #include "beecrypt/c++/security/cert/CertPathValidatorSpi.h" using beecrypt::security::cert::CertPathValidatorSpi; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class BEECRYPTCXXAPI CertPathValidator : public Object { public: static CertPathValidator* getInstance(const String& algorithm) throw (NoSuchAlgorithmException); static CertPathValidator* getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static CertPathValidator* getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException); static const String& getDefaultType() throw (); private: CertPathValidatorSpi* _cspi; const Provider* _prov; String _algo; protected: CertPathValidator(CertPathValidatorSpi* spi, const Provider* provider, const String& algorithm); public: virtual ~CertPathValidator(); CertPathValidatorResult* validate(const CertPath& certPath, const CertPathParameters& params) throw (CertPathValidatorException, InvalidAlgorithmParameterException); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertificateExpiredException.h0000644000175000001440000000312711216147023024457 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertificateExpiredException.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTIFICATEEXPIREDEXCEPTION_H #define _CLASS_BEE_SECURITY_CERT_CERTIFICATEEXPIREDEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/cert/CertificateException.h" using beecrypt::security::cert::CertificateException; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class CertificateExpiredException : public CertificateException { public: inline CertificateExpiredException() {} inline CertificateExpiredException(const char* message) : CertificateException(message) {} inline CertificateExpiredException(const String& message) : CertificateException(message) {} inline ~CertificateExpiredException() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertPathValidatorException.h0000644000175000001440000000330111216147023024266 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertPathValidatorException.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTIFICATEVALIDATOREXCEPTION_H #define _CLASS_BEE_SECURITY_CERT_CERTIFICATEVALIDATOREXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class CertPathValidatorException : public GeneralSecurityException { public: inline CertPathValidatorException() {} inline CertPathValidatorException(const char* message) : GeneralSecurityException(message) {} inline CertPathValidatorException(const String& message) : GeneralSecurityException(message) {} inline CertPathValidatorException(const Throwable* cause) : GeneralSecurityException(cause) {} inline ~CertPathValidatorException() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertPath.h0000644000175000001440000000311311216147023020542 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertPath.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTPATH_H #define _CLASS_BEE_SECURITY_CERT_CERTPATH_H #include "beecrypt/api.h" #ifdef __cplusplus #include "beecrypt/c++/security/cert/Certificate.h" using beecrypt::security::cert::Certificate; #include "beecrypt/c++/util/List.h" using beecrypt::util::List; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class BEECRYPTCXXAPI CertPath : public Object { private: String _type; protected: CertPath(const String& type); public: virtual ~CertPath() {} virtual const List& getCertificates() const = 0; virtual const bytearray& getEncoded() const = 0; const String& getType() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertificateException.h0000644000175000001440000000320511216147023023133 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertificateException.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTIFICATEEXCEPTION_H #define _CLASS_BEE_SECURITY_CERT_CERTIFICATEEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class CertificateException : public GeneralSecurityException { public: inline CertificateException() {} inline CertificateException(const char* message) : GeneralSecurityException(message) {} inline CertificateException(const String& message) : GeneralSecurityException(message) {} inline CertificateException(const Throwable* cause) : GeneralSecurityException(cause) {} inline ~CertificateException() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertificateEncodingException.h0000644000175000001440000000330011216147023024576 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertificateEncodingException.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTIFICATEENCODINGEXCEPTION_H #define _CLASS_BEE_SECURITY_CERT_CERTIFICATEENCODINGEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/cert/CertificateException.h" using beecrypt::security::cert::CertificateException; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class CertificateEncodingException : public CertificateException { public: inline CertificateEncodingException() {} inline CertificateEncodingException(const char* message) : CertificateException(message) {} inline CertificateEncodingException(const String& message) : CertificateException(message) {} inline CertificateEncodingException(const Throwable* cause) : CertificateException(cause) {} inline ~CertificateEncodingException() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertificateNotYetValidException.h0000644000175000001440000000316711216147023025265 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertificateNotYetValidException.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTIFICATENOTYETVALIDEXCEPTION_H #define _CLASS_BEE_SECURITY_CERT_CERTIFICATENOTYETVALIDEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/cert/CertificateException.h" using beecrypt::security::cert::CertificateException; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class CertificateNotYetValidException : public CertificateException { public: inline CertificateNotYetValidException() {} inline CertificateNotYetValidException(const char* message) : CertificateException(message) {} inline CertificateNotYetValidException(const String& message) : CertificateException(message) {} inline ~CertificateNotYetValidException() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertPathValidatorResult.h0000644000175000001440000000250311216147023023611 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertPathValidatorResult.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _INTERFACE_BEE_SECURITY_CERT_CERTPATHVALIDATORRESULT_H #define _INTERFACE_BEE_SECURITY_CERT_CERTPATHVALIDATORRESULT_H #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class BEECRYPTCXXAPI CertPathValidatorResult : public virtual Cloneable { public: virtual ~CertPathValidatorResult() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertPathValidatorSpi.h0000644000175000001440000000411511216147023023067 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertPathValidatorSpi.h * \ingroup CXX_SECURITY_SPEC_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTPATHVALIDATORSPI_H #define _CLASS_BEE_SECURITY_CERT_CERTPATHVALIDATORSPI_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/security/InvalidAlgorithmParameterException.h" using beecrypt::security::InvalidAlgorithmParameterException; #include "beecrypt/c++/security/cert/CertPath.h" using beecrypt::security::cert::CertPath; #include "beecrypt/c++/security/cert/CertPathParameters.h" using beecrypt::security::cert::CertPathParameters; #include "beecrypt/c++/security/cert/CertPathValidatorException.h" using beecrypt::security::cert::CertPathValidatorException; #include "beecrypt/c++/security/cert/CertPathValidatorResult.h" using beecrypt::security::cert::CertPathValidatorResult; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class BEECRYPTCXXAPI CertPathValidatorSpi : public Object { friend class CertPathValidator; protected: virtual CertPathValidatorResult* engineValidate(const CertPath& path, const CertPathParameters& params) throw (CertPathValidatorException, InvalidAlgorithmParameterException) = 0; public: virtual ~CertPathValidatorSpi() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertPathParameters.h0000644000175000001440000000245211216147023022573 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertPathParameters.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _INTERFACE_BEE_SECURITY_CERT_CERTPATHPARAMETERS_H #define _INTERFACE_BEE_SECURITY_CERT_CERTPATHPARAMETERS_H #ifdef __cplusplus #include "beecrypt/c++/lang/Cloneable.h" using beecrypt::lang::Cloneable; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class BEECRYPTCXXAPI CertPathParameters : public virtual Cloneable { public: virtual ~CertPathParameters() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/CertificateFactory.h0000644000175000001440000000456311216147023022614 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file CertificateFactory.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTIFICATEFACTORY_H #define _CLASS_BEE_SECURITY_CERT_CERTIFICATEFACTORY_H #ifdef __cplusplus #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/cert/CertificateFactorySpi.h" using beecrypt::security::cert::CertificateFactorySpi; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class BEECRYPTCXXAPI CertificateFactory : public Object { public: static CertificateFactory* getInstance(const String& type) throw (NoSuchAlgorithmException); static CertificateFactory* getInstance(const String& type, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static CertificateFactory* getInstance(const String& type, const Provider& provider) throw (NoSuchAlgorithmException); private: CertificateFactorySpi* _cspi; const Provider* _prov; String _type; protected: CertificateFactory(CertificateFactorySpi* spi, const Provider* provider, const String& type); public: virtual ~CertificateFactory(); Certificate* generateCertificate(InputStream& in) throw (CertificateException); Collection* generateCertificates(InputStream& in) throw (CertificateException); const String& getType() const throw (); const Provider& getProvider() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/cert/Certificate.h0000644000175000001440000000524011216147023021255 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Certificate.h * \ingroup CXX_SECURITY_CERT_m */ #ifndef _CLASS_BEE_SECURITY_CERT_CERTIFICATE_H #define _CLASS_BEE_SECURITY_CERT_CERTIFICATE_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::array; #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; #include "beecrypt/c++/security/PublicKey.h" using beecrypt::security::PublicKey; #include "beecrypt/c++/security/InvalidKeyException.h" using beecrypt::security::InvalidKeyException; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; #include "beecrypt/c++/security/SignatureException.h" using beecrypt::security::SignatureException; #include "beecrypt/c++/security/cert/CertificateEncodingException.h" using beecrypt::security::cert::CertificateEncodingException; namespace beecrypt { namespace security { namespace cert { /*!\ingroup CXX_SECURITY_CERT_m */ class BEECRYPTCXXAPI Certificate : public Object { private: String _type; protected: Certificate(const String& type); public: virtual ~Certificate() {} virtual bool equals(const Object* obj) const throw (); virtual const bytearray& getEncoded() const throw (CertificateEncodingException) = 0; virtual const PublicKey& getPublicKey() const = 0; virtual void verify(const PublicKey&) const throw (CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException) = 0; virtual void verify(const PublicKey&, const String&) const throw (CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException) = 0; const String& getType() const throw (); }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/KeyException.h0000644000175000001440000000300711216147023020504 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_KEYEXCEPTION_H #define _CLASS_BEE_SECURITY_KEYEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class KeyException : public GeneralSecurityException { public: inline KeyException() {} inline KeyException(const char* message) : GeneralSecurityException(message) {} inline KeyException(const String& message) : GeneralSecurityException(message) {} inline KeyException(const Throwable* cause) : GeneralSecurityException(cause) {} inline ~KeyException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/GeneralSecurityException.h0000644000175000001440000000312511216147023023062 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file GeneralSecurityException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_GENERALSECURITYEXCEPTION_H #define _CLASS_BEE_SECURITY_GENERALSECURITYEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/Exception.h" using beecrypt::lang::Exception; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class GeneralSecurityException : public Exception { public: inline GeneralSecurityException() {} inline GeneralSecurityException(const char* message) : Exception(message) {} inline GeneralSecurityException(const String& message) : Exception(message) {} inline GeneralSecurityException(const Throwable* cause) : Exception(cause) {} inline ~GeneralSecurityException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/Key.h0000644000175000001440000000256111216147023016631 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Key.h * \ingroup CXX_SECURITY_m */ #ifndef _INTERFACE_BEE_SECURITY_KEY_H #define _INTERFACE_BEE_SECURITY_KEY_H #ifdef __cplusplus #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace security { /*!\brief The top-level interface for all keys. * \ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI Key { public: virtual ~Key() {} virtual const bytearray* getEncoded() const throw () = 0; virtual const String& getAlgorithm() const throw () = 0; virtual const String* getFormat() const throw () = 0; }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/0000777000175000001440000000000011226307271020137 500000000000000beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/DSAParams.h0000644000175000001440000000272311216147023021777 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAParams.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_BEE_SECURITY_INTERFACES_DSAPARAMS_H #define _INTERFACE_BEE_SECURITY_INTERFACES_DSAPARAMS_H #ifdef __cplusplus #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; namespace beecrypt { namespace security { namespace interfaces { /*!\brief DSA parameter interface * \ingroup CXX_SECURITY_INTERFACES_m */ class BEECRYPTCXXAPI DSAParams { public: virtual ~DSAParams() {} virtual const BigInteger& getP() const throw () = 0; virtual const BigInteger& getQ() const throw () = 0; virtual const BigInteger& getG() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/RSAKey.h0000644000175000001440000000250411216147023021317 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_BEE_SECURITY_INTERFACES_RSAKEY_H #define _INTERFACE_BEE_SECURITY_INTERFACES_RSAKEY_H #ifdef __cplusplus #include "beecrypt/c++/math/BigInteger.h" using beecrypt::math::BigInteger; namespace beecrypt { namespace security { namespace interfaces { /*!\brief RSA key interface. * \ingroup CXX_SECURITY_INTERFACES_m */ class RSAKey { public: virtual ~RSAKey() {} virtual const BigInteger& getModulus() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/ECPublicKey.h0000644000175000001440000000300211216147023022312 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ECPublicKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_ECPUBLICKEY_H #define _INTERFACE_ECPUBLICKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/interfaces/PublicKey.h" using beecrypt::security::interfaces::PublicKey; #include "beecrypt/c++/security/interfaces/ECKey.h" using beecrypt::security::interfaces::ECKey; #include "beecrypt/c++/security/spec/ECPoint.h" using beecrypt::security::spec::ECPoint; namespace beecrypt { namespace security { namespace interfaces { /*!\brief EC public key interface * \ingroup CXX_SECURITY_INTERFACES_m */ class ECPublicKey : public PublicKey, public ECKey { public: virtual const ECPoint& getW() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/ECKey.h0000644000175000001440000000242111216147023021157 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ECKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_ECKEY_H #define _INTERFACE_ECKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/spec/ECPoint.h" using beecrypt::security::spec::ECPoint; namespace beecrypt { namespace security { namespace interfaces { /*!\brief Elliptic Curve key interface * \ingroup CXX_SECURITY_INTERFACES_m */ class ECKey { public: virtual const ECParameterSpec& getParams() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/DSAPublicKey.h0000644000175000001440000000277511216147023022452 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAPublicKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_BEE_SECURITY_INTERFACES_DSAPUBLICKEY_H #define _INTERFACE_BEE_SECURITY_INTERFACES_DSAPUBLICKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/PublicKey.h" using beecrypt::security::PublicKey; #include "beecrypt/c++/security/interfaces/DSAKey.h" using beecrypt::security::interfaces::DSAKey; namespace beecrypt { namespace security { namespace interfaces { /*!\brief DSA public key interface * \ingroup CXX_SECURITY_INTERFACES_m */ class DSAPublicKey : public virtual PublicKey, public virtual DSAKey { public: virtual ~DSAPublicKey() {} virtual const BigInteger& getY() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/ECPrivateKey.h0000644000175000001440000000301211216147023022507 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file ECPrivateKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_ECPRIVATEKEY_H #define _INTERFACE_ECPRIVATEKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/interfaces/PrivateKey.h" using beecrypt::security::interfaces::PrivateKey; #include "beecrypt/c++/security/interfaces/ECKey.h" using beecrypt::security::interfaces::ECKey; #include "beecrypt/c++/security/spec/ECPoint.h" using beecrypt::security::spec::ECPoint; namespace beecrypt { namespace security { namespace interfaces { /*!\brief EC private key interface * \ingroup CXX_SECURITY_INTERFACES_m */ class ECPrivateKey : public PrivateKey, public ECKey { public: virtual const ECPoint& getS() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/RSAPrivateKey.h0000644000175000001440000000302411216147023022650 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAPrivateKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_BEE_SECURITY_INTERFACES_RSAPRIVATEKEY_H #define _INTERFACE_BEE_SECURITY_INTERFACES_RSAPRIVATEKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/PrivateKey.h" using beecrypt::security::PrivateKey; #include "beecrypt/c++/security/interfaces/RSAKey.h" using beecrypt::security::interfaces::RSAKey; namespace beecrypt { namespace security { namespace interfaces { /*!\brief RSA private key interface * \ingroup CXX_SECURITY_INTERFACES_m */ class RSAPrivateKey : public virtual PrivateKey, public virtual RSAKey { public: virtual ~RSAPrivateKey() {} virtual const BigInteger& getPrivateExponent() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/RSAPublicKey.h0000644000175000001440000000301211216147023022451 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAPublicKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_BEE_SECURITY_INTERFACES_RSAPUBLICKEY_H #define _INTERFACE_BEE_SECURITY_INTERFACES_RSAPUBLICKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/PublicKey.h" using beecrypt::security::PublicKey; #include "beecrypt/c++/security/interfaces/RSAKey.h" using beecrypt::security::interfaces::RSAKey; namespace beecrypt { namespace security { namespace interfaces { /*!\brief RSA public key interface * \ingroup CXX_SECURITY_INTERFACES_m */ class RSAPublicKey : public virtual PublicKey, public virtual RSAKey { public: virtual ~RSAPublicKey() {} virtual const BigInteger& getPublicExponent() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/RSAPrivateCrtKey.h0000644000175000001440000000360211216147023023323 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file RSAPrivateCrtKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_BEE_SECURITY_INTERFACES_RSAPRIVATECRTKEY_H #define _INTERFACE_BEE_SECURITY_INTERFACES_RSAPRIVATECRTKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/interfaces/RSAPrivateKey.h" using beecrypt::security::interfaces::RSAPrivateKey; namespace beecrypt { namespace security { namespace interfaces { /*!\brief The interface to an RSA private key, as defined in the PKCS#1 standard, using the Chinese Remainder Theorem (CRT) information values. * \ingroup CXX_SECURITY_INTERFACES_m */ class RSAPrivateCrtKey : public virtual RSAPrivateKey { public: virtual ~RSAPrivateCrtKey() {} virtual const BigInteger& getPublicExponent() const throw () = 0; virtual const BigInteger& getPrimeP() const throw () = 0; virtual const BigInteger& getPrimeQ() const throw () = 0; virtual const BigInteger& getPrimeExponentP() const throw () = 0; virtual const BigInteger& getPrimeExponentQ() const throw () = 0; virtual const BigInteger& getCrtCoefficient() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/DSAPrivateKey.h0000644000175000001440000000300611216147023022632 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAPrivateKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_BEE_SECURITY_INTERFACES_DSAPRIVATEKEY_H #define _INTERFACE_BEE_SECURITY_INTERFACES_DSAPRIVATEKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/PrivateKey.h" using beecrypt::security::PrivateKey; #include "beecrypt/c++/security/interfaces/DSAKey.h" using beecrypt::security::interfaces::DSAKey; namespace beecrypt { namespace security { namespace interfaces { /*!\brief DSA private key interface * \ingroup CXX_SECURITY_INTERFACES_m */ class DSAPrivateKey : public virtual PrivateKey, public virtual DSAKey { public: virtual ~DSAPrivateKey() {} virtual const BigInteger& getX() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/interfaces/DSAKey.h0000644000175000001440000000253711216147023021307 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DSAKey.h * \ingroup CXX_SECURITY_INTERFACES_m */ #ifndef _INTERFACE_BEE_SECURITY_INTERFACES_DSAKEY_H #define _INTERFACE_BEE_SECURITY_INTERFACES_DSAKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/interfaces/DSAParams.h" using beecrypt::security::interfaces::DSAParams; namespace beecrypt { namespace security { namespace interfaces { /*!\brief DSA key interface. * \ingroup CXX_SECURITY_INTERFACES_m */ class DSAKey { public: virtual ~DSAKey() {} virtual const DSAParams& getParams() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/MessageDigest.h0000644000175000001440000000507511216147023020630 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file MessageDigest.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_MESSAGEDIGEST_H #define _CLASS_BEE_SECURITY_MESSAGEDIGEST_H #ifdef __cplusplus #include "beecrypt/c++/security/MessageDigestSpi.h" using beecrypt::security::MessageDigestSpi; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI MessageDigest : public Object { public: static MessageDigest* getInstance(const String& algorithm) throw (NoSuchAlgorithmException); static MessageDigest* getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static MessageDigest* getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException); private: MessageDigestSpi* _mspi; const Provider* _prov; String _algo; protected: MessageDigest(MessageDigestSpi* spi, const Provider* provider, const String& algorithm); public: virtual ~MessageDigest(); virtual MessageDigest* clone() const throw (CloneNotSupportedException); const bytearray& digest(); const bytearray& digest(const bytearray& b); int digest(byte* data, int offset, int length) throw (ShortBufferException); int getDigestLength(); void reset(); void update(byte b); void update(const byte* data, int offset, int length); void update(const bytearray& b); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/UnrecoverableKeyException.h0000644000175000001440000000317411216147023023226 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file UnrecoverableKeyException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_UNRECOVERABLEKEYEXCEPTION_H #define _CLASS_BEE_SECURITY_UNRECOVERABLEKEYEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class UnrecoverableKeyException : public GeneralSecurityException { public: inline UnrecoverableKeyException() {} inline UnrecoverableKeyException(const char* message) : GeneralSecurityException(message) {} inline UnrecoverableKeyException(const String& message) : GeneralSecurityException(message) {} inline UnrecoverableKeyException(const Throwable* cause) : GeneralSecurityException(cause) {} inline ~UnrecoverableKeyException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/InvalidParameterException.h0000644000175000001440000000312611216147023023205 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file InvalidParameterException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_INVALIDPARAMETEREXCEPTION_H #define _CLASS_BEE_SECURITY_INVALIDPARAMETEREXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/IllegalArgumentException.h" using beecrypt::lang::IllegalArgumentException; #include "beecrypt/c++/lang/String.h" using beecrypt::lang::String; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class InvalidParameterException : public IllegalArgumentException { public: inline InvalidParameterException() {} inline InvalidParameterException(const char* message) : IllegalArgumentException(message) {} inline InvalidParameterException(const String& message) : IllegalArgumentException(message) {} inline ~InvalidParameterException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/KeyStore.h0000644000175000001440000001440511216147023017646 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyStore.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_KEYSTORE_H #define _CLASS_BEE_SECURITY_KEYSTORE_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::array; #include "beecrypt/c++/security/KeyStoreSpi.h" using beecrypt::security::KeyStoreSpi; #include "beecrypt/c++/security/PrivateKey.h" using beecrypt::security::PrivateKey; #include "beecrypt/c++/crypto/SecretKey.h" using beecrypt::crypto::SecretKey; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/auth/Destroyable.h" using beecrypt::security::auth::Destroyable; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI KeyStore : public Object { public: class BEECRYPTCXXAPI ProtectionParameter { public: virtual ~ProtectionParameter() {} }; class BEECRYPTCXXAPI LoadStoreParameter { public: virtual ~LoadStoreParameter() {} virtual KeyStore::ProtectionParameter* getProtectionParameter() = 0; }; class BEECRYPTCXXAPI PasswordProtection : public beecrypt::lang::Object, public virtual ProtectionParameter, public virtual beecrypt::security::auth::Destroyable { private: array* _pwd; bool _destroyed; public: PasswordProtection(const array* password); virtual ~PasswordProtection(); virtual void destroy() throw (DestroyFailedException); const array* getPassword() const; virtual bool isDestroyed() const throw (); }; class BEECRYPTCXXAPI Entry { public: virtual ~Entry() {} }; class BEECRYPTCXXAPI PrivateKeyEntry : public beecrypt::lang::Object, public virtual beecrypt::security::KeyStore::Entry { private: PrivateKey* _pri; array _chain; public: PrivateKeyEntry(PrivateKey* privateKey, const array& chain); virtual ~PrivateKeyEntry(); const Certificate& getCertificate() const; const array& getCertificateChain() const; const PrivateKey& getPrivateKey() const; virtual String toString() const throw (); }; class BEECRYPTCXXAPI SecretKeyEntry : public beecrypt::lang::Object, public virtual beecrypt::security::KeyStore::Entry { private: SecretKey* _sec; public: SecretKeyEntry(SecretKey* secretKey); virtual ~SecretKeyEntry(); const SecretKey& getSecretKey() const; virtual String toString() const throw (); }; class TrustedCertificateEntry : public beecrypt::lang::Object, public virtual beecrypt::security::KeyStore::Entry { private: Certificate* _cert; public: TrustedCertificateEntry(Certificate* cert); virtual ~TrustedCertificateEntry(); const Certificate& getTrustedCertificate() const; virtual String toString() const throw (); }; public: static KeyStore* getInstance(const String& type) throw (KeyStoreException); static KeyStore* getInstance(const String& type, const String& provider) throw (KeyStoreException, NoSuchProviderException); static KeyStore* getInstance(const String& type, const Provider& provider) throw (KeyStoreException); static const String& getDefaultType(); private: KeyStoreSpi* _kspi; const Provider* _prov; String _type; bool _init; protected: KeyStore(KeyStoreSpi* spi, const Provider* provider, const String& type); public: virtual ~KeyStore(); Enumeration* aliases(); bool containsAlias(const String& alias) throw (KeyStoreException); const Certificate* getCertificate(const String& alias) throw (KeyStoreException); const String* getCertificateAlias(const Certificate& cert) throw (KeyStoreException); const array* getCertificateChain(const String& alias) throw (KeyStoreException); bool isCertificateEntry(const String& alias) throw (KeyStoreException); void setCertificateEntry(const String& alias, const Certificate& cert) throw (KeyStoreException); void deleteEntry(const String& alias) throw (KeyStoreException); // KeyStore::Entry* getEntry(const String& alias, ); Key* getKey(const String& alias, const array& password) throw (KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException); bool isKeyEntry(const String& alias) throw (KeyStoreException); /*!\brief Assigns the given key to the specified alias * \warning A shallow copy of the chain array contents is made; * consider the contents absorbed by the entry, and hence the * certificate objects will be deleted in the entry destructor. */ void setKeyEntry(const String& alias, const bytearray& key, const array& chain) throw (KeyStoreException); /*!\brief Assigns the given key to the specified alias * \warning A shallow copy of the chain array contents is made; * consider the contents absorbed by the entry, and hence the * certificate objects will be deleted in the entry destructor. */ void setKeyEntry(const String& alias, const Key& key, const array& password, const array& chain) throw (KeyStoreException); jint size() const throw (KeyStoreException); void load(InputStream* in, const array* password) throw (IOException, NoSuchAlgorithmException, CertificateException); void store(OutputStream& out, const array* password) throw (KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException); const String& getType() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/auth/0000777000175000001440000000000011226307271016755 500000000000000beecrypt-4.2.1/include/beecrypt/c++/security/auth/DestroyFailedException.h0000644000175000001440000000300311216147023023447 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file DestroyFailedException.h * \ingroup CXX_SECURITY_AUTH_m */ #ifndef _CLASS_BEE_SECURITY_AUTH_DESTROYFAILEDEXCEPTION_H #define _CLASS_BEE_SECURITY_AUTH_DESTROYFAILEDEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/lang/Exception.h" using beecrypt::lang::Exception; using beecrypt::lang::String; namespace beecrypt { namespace security { namespace auth { /*!\ingroup CXX_SECURITY_AUTH_m */ class DestroyFailedException : public Exception { public: inline DestroyFailedException() {} inline DestroyFailedException(const char* message) : Exception(message) {} inline DestroyFailedException(const String& message) : Exception(message) {} inline ~DestroyFailedException() {} }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/auth/Destroyable.h0000644000175000001440000000261411216147023021316 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Destroyable.h * \ingroup CXX_SECURITY_AUTH_m */ #ifndef _INTERFACE_BEE_SECURITY_AUTH_DESTROYABLE_H #define _INTERFACE_BEE_SECURITY_AUTH_DESTROYABLE_H #ifdef __cplusplus #include "beecrypt/c++/security/auth/DestroyFailedException.h" using beecrypt::security::auth::DestroyFailedException; namespace beecrypt { namespace security { namespace auth { /*!\ingroup CXX_SECURITY_AUTH_m */ class BEECRYPTCXXAPI Destroyable { public: virtual ~Destroyable() {} virtual void destroy() throw (DestroyFailedException) = 0; virtual bool isDestroyed() const throw () = 0; }; } } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/SignatureSpi.h0000644000175000001440000000570511216147023020521 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SignatureSpi.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_SIGNATURESPI_H #define _CLASS_BEE_SECURITY_SIGNATURESPI_H #ifdef __cplusplus #include "beecrypt/c++/array.h" using beecrypt::bytearray; #include "beecrypt/c++/lang/IllegalStateException.h" using beecrypt::lang::IllegalStateException; #include "beecrypt/c++/security/AlgorithmParameters.h" using beecrypt::security::AlgorithmParameters; #include "beecrypt/c++/security/PrivateKey.h" using beecrypt::security::PrivateKey; #include "beecrypt/c++/security/PublicKey.h" using beecrypt::security::PublicKey; #include "beecrypt/c++/security/SecureRandom.h" using beecrypt::security::SecureRandom; #include "beecrypt/c++/security/InvalidAlgorithmParameterException.h" using beecrypt::security::InvalidAlgorithmParameterException; #include "beecrypt/c++/security/InvalidKeyException.h" using beecrypt::security::InvalidKeyException; #include "beecrypt/c++/security/ShortBufferException.h" using beecrypt::security::ShortBufferException; #include "beecrypt/c++/security/SignatureException.h" using beecrypt::security::SignatureException; #include "beecrypt/c++/security/spec/AlgorithmParameterSpec.h" using beecrypt::security::spec::AlgorithmParameterSpec; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI SignatureSpi : public Object { friend class Signature; protected: virtual AlgorithmParameters* engineGetParameters() const = 0; virtual void engineSetParameter(const AlgorithmParameterSpec&) throw (InvalidAlgorithmParameterException) = 0; virtual void engineInitSign(const PrivateKey&, SecureRandom*) throw (InvalidKeyException) = 0; virtual void engineInitVerify(const PublicKey&) = 0; virtual void engineUpdate(byte) = 0; virtual void engineUpdate(const byte*, int, int) = 0; virtual bytearray* engineSign() throw (SignatureException) = 0; virtual int engineSign(byte*, int, int) throw (ShortBufferException, SignatureException) = 0; virtual int engineSign(bytearray&) throw (SignatureException) = 0; virtual bool engineVerify(const byte*, int, int) throw (SignatureException) = 0; public: virtual ~SignatureSpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/KeyFactory.h0000644000175000001440000000472211216147023020162 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyFactory.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_KEYFACTORY_H #define _CLASS_BEE_SECURITY_KEYFACTORY_H #ifdef __cplusplus #include "beecrypt/c++/security/KeyFactorySpi.h" using beecrypt::security::KeyFactorySpi; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI KeyFactory : public Object { public: static KeyFactory* getInstance(const String& algorithm) throw (NoSuchAlgorithmException); static KeyFactory* getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static KeyFactory* getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException); private: KeyFactorySpi* _kspi; const Provider* _prov; String _algo; protected: KeyFactory(KeyFactorySpi* spi, const Provider* provider, const String& algorithm); public: virtual ~KeyFactory(); PrivateKey* generatePrivate(const KeySpec& spec) throw (InvalidKeySpecException); PublicKey* generatePublic(const KeySpec& spec) throw (InvalidKeySpecException); KeySpec* getKeySpec(const Key& key, const type_info& info) throw (InvalidKeySpecException); Key* translateKey(const Key& key) throw (InvalidKeyException); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/KeyPairGenerator.h0000644000175000001440000000511511216147023021312 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyPairGenerator.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_KEYPAIRGENERATOR_H #define _CLASS_BEE_SECURITY_KEYPAIRGENERATOR_H #ifdef __cplusplus #include "beecrypt/c++/security/KeyPairGeneratorSpi.h" using beecrypt::security::KeyPairGeneratorSpi; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI KeyPairGenerator : public Object { public: static KeyPairGenerator* getInstance(const String& algorithm) throw (NoSuchAlgorithmException); static KeyPairGenerator* getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static KeyPairGenerator* getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException); private: KeyPairGeneratorSpi* _kspi; const Provider* _prov; String _algo; protected: KeyPairGenerator(KeyPairGeneratorSpi* spi, const Provider* provider, const String& algorithm); public: virtual ~KeyPairGenerator(); KeyPair* generateKeyPair(); void initialize(const AlgorithmParameterSpec&) throw (InvalidAlgorithmParameterException); void initialize(const AlgorithmParameterSpec&, SecureRandom*) throw (InvalidAlgorithmParameterException); void initialize(int) throw(InvalidParameterException); void initialize(int, SecureRandom*) throw (InvalidParameterException); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/NoSuchProviderException.h0000644000175000001440000000301311216147023022663 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file NoSuchProviderException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_NOSUCHPROVIDEREXCEPTION_H #define _CLASS_BEE_SECURITY_NOSUCHPROVIDEREXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class NoSuchProviderException : public GeneralSecurityException { public: inline NoSuchProviderException() {} inline NoSuchProviderException(const char* message) : GeneralSecurityException(message) {} inline NoSuchProviderException(const String& message) : GeneralSecurityException(message) {} inline ~NoSuchProviderException() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/KeyStoreSpi.h0000644000175000001440000000653211216147023020324 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyStoreSpi.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_KEYSTORESPI_H #define _CLASS_BEE_SECURITY_KEYSTORESPI_H #include "beecrypt/api.h" #ifdef __cplusplus #include "beecrypt/c++/io/InputStream.h" using beecrypt::io::InputStream; #include "beecrypt/c++/io/OutputStream.h" using beecrypt::io::OutputStream; #include "beecrypt/c++/security/KeyStoreException.h" using beecrypt::security::KeyStoreException; #include "beecrypt/c++/security/UnrecoverableKeyException.h" using beecrypt::security::UnrecoverableKeyException; #include "beecrypt/c++/security/cert/Certificate.h" using beecrypt::security::cert::Certificate; #include "beecrypt/c++/util/Date.h" using beecrypt::util::Date; #include "beecrypt/c++/util/Enumeration.h" using beecrypt::util::Enumeration; #include using std::type_info; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI KeyStoreSpi : public Object { friend class KeyStore; protected: virtual Enumeration* engineAliases() = 0; virtual bool engineContainsAlias(const String& alias) = 0; virtual void engineDeleteEntry(const String& alias) throw (KeyStoreException) = 0; virtual const Date* engineGetCreationDate(const String& alias) = 0; virtual const Certificate* engineGetCertificate(const String& alias) = 0; virtual const String* engineGetCertificateAlias(const Certificate& cert) = 0; virtual const array* engineGetCertificateChain(const String& alias) = 0; virtual bool engineIsCertificateEntry(const String& alias) = 0; virtual void engineSetCertificateEntry(const String& alias, const Certificate& cert) throw (KeyStoreException) = 0; virtual Key* engineGetKey(const String& alias, const array& password) throw (NoSuchAlgorithmException, UnrecoverableKeyException) = 0; virtual bool engineIsKeyEntry(const String& alias) = 0; virtual void engineSetKeyEntry(const String& alias, const bytearray& key, const array&) throw (KeyStoreException) = 0; virtual void engineSetKeyEntry(const String& alias, const Key& key, const array& password, const array&) throw (KeyStoreException) = 0; virtual jint engineSize() const = 0; virtual void engineLoad(InputStream* in, const array* password) throw (IOException, CertificateException, NoSuchAlgorithmException) = 0; virtual void engineStore(OutputStream& out, const array* password) throw (IOException, CertificateException, NoSuchAlgorithmException) = 0; public: virtual ~KeyStoreSpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/AlgorithmParameterGenerator.h0000644000175000001440000000555211216147023023542 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file AlgorithmParameterGenerator.h * \author Bob Deblier * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_ALGORITHMPARAMETERGENERATOR_H #define _CLASS_BEE_SECURITY_ALGORITHMPARAMETERGENERATOR_H #ifdef __cplusplus #include "beecrypt/c++/security/AlgorithmParameterGeneratorSpi.h" using beecrypt::security::AlgorithmParameterGeneratorSpi; #include "beecrypt/c++/security/Provider.h" using beecrypt::security::Provider; #include "beecrypt/c++/security/NoSuchAlgorithmException.h" using beecrypt::security::NoSuchAlgorithmException; #include "beecrypt/c++/security/NoSuchProviderException.h" using beecrypt::security::NoSuchProviderException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI AlgorithmParameterGenerator : public Object { public: static AlgorithmParameterGenerator* getInstance(const String& algorithm) throw (NoSuchAlgorithmException); static AlgorithmParameterGenerator* getInstance(const String& algorithm, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static AlgorithmParameterGenerator* getInstance(const String& algorithm, const Provider& provider) throw (NoSuchAlgorithmException); private: AlgorithmParameterGeneratorSpi* _aspi; const Provider* _prov; String _algo; protected: AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi* spi, const Provider* provider, const String& algorithm); public: virtual ~AlgorithmParameterGenerator(); AlgorithmParameters* generateParameters() throw (InvalidAlgorithmParameterException); void init(const AlgorithmParameterSpec& genParamSpec) throw (InvalidAlgorithmParameterException); void init(const AlgorithmParameterSpec&, SecureRandom* random) throw (InvalidAlgorithmParameterException); void init(int size) throw (InvalidParameterException); void init(int size, SecureRandom* random) throw (InvalidParameterException); const String& getAlgorithm() const throw (); const Provider& getProvider() const throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/Security.h0000644000175000001440000000624511216147023017713 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file Security.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_SECURITY_H #define _CLASS_BEE_SECURITY_SECURITY_H #ifdef __cplusplus #include "beecrypt/c++/util/ArrayList.h" using beecrypt::util::ArrayList; #include "beecrypt/c++/security/cert/CertificateFactory.h" using beecrypt::security::cert::CertificateFactory; #include "beecrypt/c++/security/cert/CertPathValidator.h" using beecrypt::security::cert::CertPathValidator; #include "beecrypt/c++/crypto/Cipher.h" using beecrypt::crypto::Cipher; #include "beecrypt/c++/crypto/KeyAgreement.h" using beecrypt::crypto::KeyAgreement; #include "beecrypt/c++/crypto/Mac.h" using beecrypt::crypto::Mac; #include "beecrypt/c++/crypto/SecretKeyFactory.h" using beecrypt::crypto::SecretKeyFactory; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI Security { friend class AlgorithmParameterGenerator; friend class AlgorithmParameters; friend class ::CertificateFactory; friend class ::CertPathValidator; friend class ::Cipher; friend class ::KeyAgreement; friend class KeyFactory; friend class KeyPairGenerator; friend class KeyStore; friend class ::Mac; friend class MessageDigest; friend class ::SecretKeyFactory; friend class SecureRandom; friend class Signature; private: struct spi { Object* cspi; String name; const Provider* prov; spi(Object* cspi, const Provider*, const String&); }; static spi* getSpi(const String& name, const String& type) throw (NoSuchAlgorithmException); static spi* getSpi(const String& algo, const String& type, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException); static spi* getSpi(const String& algo, const String& type, const Provider&) throw (NoSuchAlgorithmException); static spi* getFirstSpi(const String& type); static const String& getKeyStoreDefault(); static bool _init; static Properties _props; static ArrayList _providers; static void initialize(); public: static int addProvider(Provider* provider); static int insertProviderAt(Provider* provider, int position) throw (IndexOutOfBoundsException); static void removeProvider(const String& name); static Provider* getProvider(const String& name); static array getProviders(); static const String* getProperty(const String& key) throw (); }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/SecureRandomSpi.h0000644000175000001440000000262711216147023021147 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file SecureRandomSpi.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_SECURERANDOMSPI_H #define _CLASS_BEE_SECURITY_SECURERANDOMSPI_H #ifdef __cplusplus #include "beecrypt/c++/lang/Object.h" using beecrypt::lang::Object; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class BEECRYPTCXXAPI SecureRandomSpi : public Object { friend class SecureRandom; protected: virtual void engineGenerateSeed(byte*, int) = 0; virtual void engineNextBytes(byte*, int) = 0; virtual void engineSetSeed(const byte*, int) = 0; public: virtual ~SecureRandomSpi() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/KeyStoreException.h0000644000175000001440000000306511216147023021525 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file KeyStoreException.h * \ingroup CXX_SECURITY_m */ #ifndef _CLASS_BEE_SECURITY_KEYSTOREEXCEPTION_H #define _CLASS_BEE_SECURITY_KEYSTOREEXCEPTION_H #ifdef __cplusplus #include "beecrypt/c++/security/GeneralSecurityException.h" using beecrypt::security::GeneralSecurityException; namespace beecrypt { namespace security { /*!\ingroup CXX_SECURITY_m */ class KeyStoreException : public GeneralSecurityException { public: inline KeyStoreException() {} inline KeyStoreException(const char* message) : GeneralSecurityException(message) {} inline KeyStoreException(const String& message) : GeneralSecurityException(message) {} inline KeyStoreException(const Throwable* cause) : GeneralSecurityException(cause) {} inline ~KeyStoreException() { } }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/c++/security/PublicKey.h0000644000175000001440000000231411216147023017764 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file PublicKey.h * \ingroup CXX_SECURITY_m */ #ifndef _INTERFACE_BEE_SECURITY_PUBLICKEY_H #define _INTERFACE_BEE_SECURITY_PUBLICKEY_H #ifdef __cplusplus #include "beecrypt/c++/security/Key.h" using beecrypt::security::Key; namespace beecrypt { namespace security { /*!\brief Public key interface. * \ingroup CXX_SECURITY_m */ class PublicKey : public Key { public: virtual ~PublicKey() {} }; } } #endif #endif beecrypt-4.2.1/include/beecrypt/hmacsha512.h0000644000175000001440000000305511216147022015514 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha512.h * \brief HMAC-SHA-512 message authentication code, headers. * \author Bob Deblier * \ingroup HMAC_m HMAC_sha512_m */ #ifndef _HMACSHA512_H #define _HMACSHA512_H #include "beecrypt/hmac.h" #include "beecrypt/sha512.h" /*!\ingroup HMAC_sha512_m */ typedef struct { sha512Param sparam; byte kxi[128]; byte kxo[128]; } hmacsha512Param; #ifdef __cplusplus extern "C" { #endif extern BEECRYPTAPI const keyedHashFunction hmacsha512; BEECRYPTAPI int hmacsha512Setup (hmacsha512Param*, const byte*, size_t); BEECRYPTAPI int hmacsha512Reset (hmacsha512Param*); BEECRYPTAPI int hmacsha512Update(hmacsha512Param*, const byte*, size_t); BEECRYPTAPI int hmacsha512Digest(hmacsha512Param*, byte*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/mpbarrett.h0000664000175000001440000001012610254472206015665 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mpbarrett.h * \brief Multi-precision integer routines using Barrett modular reduction, headers. * \author Bob Deblier * \ingroup MP_m */ #ifndef _MPBARRETT_H #define _MPBARRETT_H #include "beecrypt/beecrypt.h" #include "beecrypt/mpnumber.h" #ifdef __cplusplus # include #endif #ifdef __cplusplus struct BEECRYPTAPI mpbarrett #else struct _mpbarrett #endif { size_t size; mpw* modl; /* (size) words */ mpw* mu; /* (size+1) words */ #ifdef __cplusplus mpbarrett(); mpbarrett(const mpbarrett&); ~mpbarrett(); const mpbarrett& operator=(const mpbarrett&); void wipe(); size_t bitlength() const; #endif }; #ifndef __cplusplus typedef struct _mpbarrett mpbarrett; #else BEECRYPTAPI std::ostream& operator<<(std::ostream&, const mpbarrett&); #endif #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI void mpbzero(mpbarrett*); BEECRYPTAPI void mpbinit(mpbarrett*, size_t); BEECRYPTAPI void mpbfree(mpbarrett*); BEECRYPTAPI void mpbcopy(mpbarrett*, const mpbarrett*); BEECRYPTAPI void mpbwipe(mpbarrett*); BEECRYPTAPI void mpbset(mpbarrett*, size_t, const mpw*); BEECRYPTAPI int mpbsetbin(mpbarrett*, const byte*, size_t); BEECRYPTAPI int mpbsethex(mpbarrett*, const char*); BEECRYPTAPI void mpbsubone(const mpbarrett*, mpw*); BEECRYPTAPI void mpbmu_w(mpbarrett*, mpw*); BEECRYPTAPI void mpbrnd_w (const mpbarrett*, randomGeneratorContext*, mpw*, mpw*); BEECRYPTAPI void mpbrndodd_w(const mpbarrett*, randomGeneratorContext*, mpw*, mpw*); BEECRYPTAPI void mpbrndinv_w(const mpbarrett*, randomGeneratorContext*, mpw*, mpw*, mpw*); BEECRYPTAPI void mpbneg_w(const mpbarrett*, const mpw*, mpw*); BEECRYPTAPI void mpbmod_w(const mpbarrett*, const mpw*, mpw*, mpw*); BEECRYPTAPI void mpbaddmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*); BEECRYPTAPI void mpbsubmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*); BEECRYPTAPI void mpbmulmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*); BEECRYPTAPI void mpbsqrmod_w(const mpbarrett*, size_t, const mpw*, mpw*, mpw*); BEECRYPTAPI void mpbpowmod_w(const mpbarrett*, size_t, const mpw*, size_t, const mpw*, mpw*, mpw*); BEECRYPTAPI void mpbpowmodsld_w(const mpbarrett*, const mpw*, size_t, const mpw*, mpw*, mpw*); BEECRYPTAPI void mpbtwopowmod_w(const mpbarrett*, size_t, const mpw*, mpw*, mpw*); /* To be added: * simultaneous multiple exponentiation, for use in dsa and elgamal signature verification */ BEECRYPTAPI void mpbsm2powmod(const mpbarrett*, const mpw*, const mpw*, const mpw*, const mpw*); BEECRYPTAPI void mpbsm3powmod(const mpbarrett*, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*, const mpw*); BEECRYPTAPI int mpbpprime_w(const mpbarrett*, randomGeneratorContext*, int, mpw*); /* the next routines take mpnumbers as parameters */ BEECRYPTAPI void mpbnrnd(const mpbarrett*, randomGeneratorContext*, mpnumber*); BEECRYPTAPI void mpbnmulmod(const mpbarrett*, const mpnumber*, const mpnumber*, mpnumber*); BEECRYPTAPI void mpbnsqrmod(const mpbarrett*, const mpnumber*, mpnumber*); BEECRYPTAPI void mpbnpowmod (const mpbarrett*, const mpnumber*, const mpnumber*, mpnumber*); BEECRYPTAPI void mpbnpowmodsld(const mpbarrett*, const mpw*, const mpnumber*, mpnumber*); BEECRYPTAPI size_t mpbbits(const mpbarrett*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/sha512.h0000644000175000001440000000611111216147022014657 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha512.h * \brief SHA-512 hash function, headers. * \author Bob Deblier * \ingroup HASH_m HASH_sha512_m */ #ifndef _SHA512_H #define _SHA512_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the SHA-512 algorithm. * \ingroup HASH_sha512_m */ #ifdef __cplusplus struct BEECRYPTAPI sha512Param #else struct _sha512Param #endif { /*!\var h */ uint64_t h[8]; /*!\var data */ uint64_t data[80]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[2]; #elif (MP_WBITS == 32) mpw length[4]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint64_t offset; }; #ifndef __cplusplus typedef struct _sha512Param sha512Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var sha512 * \brief Holds the full API description of the SHA-512 algorithm. */ extern BEECRYPTAPI const hashFunction sha512; /*!\fn void sha512Process(sha512Param* sp) * \brief This function performs the core of the SHA-512 hash algorithm; it * processes a block of 128 bytes. * \param sp The hash function's parameter block. */ BEECRYPTAPI void sha512Process(sha512Param* sp); /*!\fn int sha512Reset(sha512Param* sp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param sp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int sha512Reset (sha512Param* sp); /*!\fn int sha512Update(sha512Param* sp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param sp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int sha512Update (sha512Param* sp, const byte* data, size_t size); /*!\fn int sha512Digest(sha512Param* sp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param sp The hash function's parameter block. * \param digest The place to store the 64-byte digest. * \retval 0 on success. */ BEECRYPTAPI int sha512Digest (sha512Param* sp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/aes_le.h0000644000175000001440000012121710532324353015115 00000000000000/* * Copyright (c) 2003, 2005 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ const uint32_t _aes_mask[4] = { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }; typedef struct { #if defined(OPTIMIZE_MMX) && (defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)) const uint64_t t0[256]; const uint64_t t1[256]; const uint64_t t2[256]; const uint64_t t3[256]; #else const uint32_t t0[256]; const uint32_t t1[256]; const uint32_t t2[256]; const uint32_t t3[256]; #endif const uint32_t t4[256]; } _table; const _table _aes_enc = { { 0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6, 0x0df2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591, 0x50303060, 0x03010102, 0xa96767ce, 0x7d2b2b56, 0x19fefee7, 0x62d7d7b5, 0xe6abab4d, 0x9a7676ec, 0x45caca8f, 0x9d82821f, 0x40c9c989, 0x877d7dfa, 0x15fafaef, 0xeb5959b2, 0xc947478e, 0x0bf0f0fb, 0xecadad41, 0x67d4d4b3, 0xfda2a25f, 0xeaafaf45, 0xbf9c9c23, 0xf7a4a453, 0x967272e4, 0x5bc0c09b, 0xc2b7b775, 0x1cfdfde1, 0xae93933d, 0x6a26264c, 0x5a36366c, 0x413f3f7e, 0x02f7f7f5, 0x4fcccc83, 0x5c343468, 0xf4a5a551, 0x34e5e5d1, 0x08f1f1f9, 0x937171e2, 0x73d8d8ab, 0x53313162, 0x3f15152a, 0x0c040408, 0x52c7c795, 0x65232346, 0x5ec3c39d, 0x28181830, 0xa1969637, 0x0f05050a, 0xb59a9a2f, 0x0907070e, 0x36121224, 0x9b80801b, 0x3de2e2df, 0x26ebebcd, 0x6927274e, 0xcdb2b27f, 0x9f7575ea, 0x1b090912, 0x9e83831d, 0x742c2c58, 0x2e1a1a34, 0x2d1b1b36, 0xb26e6edc, 0xee5a5ab4, 0xfba0a05b, 0xf65252a4, 0x4d3b3b76, 0x61d6d6b7, 0xceb3b37d, 0x7b292952, 0x3ee3e3dd, 0x712f2f5e, 0x97848413, 0xf55353a6, 0x68d1d1b9, 0x00000000, 0x2cededc1, 0x60202040, 0x1ffcfce3, 0xc8b1b179, 0xed5b5bb6, 0xbe6a6ad4, 0x46cbcb8d, 0xd9bebe67, 0x4b393972, 0xde4a4a94, 0xd44c4c98, 0xe85858b0, 0x4acfcf85, 0x6bd0d0bb, 0x2aefefc5, 0xe5aaaa4f, 0x16fbfbed, 0xc5434386, 0xd74d4d9a, 0x55333366, 0x94858511, 0xcf45458a, 0x10f9f9e9, 0x06020204, 0x817f7ffe, 0xf05050a0, 0x443c3c78, 0xba9f9f25, 0xe3a8a84b, 0xf35151a2, 0xfea3a35d, 0xc0404080, 0x8a8f8f05, 0xad92923f, 0xbc9d9d21, 0x48383870, 0x04f5f5f1, 0xdfbcbc63, 0xc1b6b677, 0x75dadaaf, 0x63212142, 0x30101020, 0x1affffe5, 0x0ef3f3fd, 0x6dd2d2bf, 0x4ccdcd81, 0x140c0c18, 0x35131326, 0x2fececc3, 0xe15f5fbe, 0xa2979735, 0xcc444488, 0x3917172e, 0x57c4c493, 0xf2a7a755, 0x827e7efc, 0x473d3d7a, 0xac6464c8, 0xe75d5dba, 0x2b191932, 0x957373e6, 0xa06060c0, 0x98818119, 0xd14f4f9e, 0x7fdcdca3, 0x66222244, 0x7e2a2a54, 0xab90903b, 0x8388880b, 0xca46468c, 0x29eeeec7, 0xd3b8b86b, 0x3c141428, 0x79dedea7, 0xe25e5ebc, 0x1d0b0b16, 0x76dbdbad, 0x3be0e0db, 0x56323264, 0x4e3a3a74, 0x1e0a0a14, 0xdb494992, 0x0a06060c, 0x6c242448, 0xe45c5cb8, 0x5dc2c29f, 0x6ed3d3bd, 0xefacac43, 0xa66262c4, 0xa8919139, 0xa4959531, 0x37e4e4d3, 0x8b7979f2, 0x32e7e7d5, 0x43c8c88b, 0x5937376e, 0xb76d6dda, 0x8c8d8d01, 0x64d5d5b1, 0xd24e4e9c, 0xe0a9a949, 0xb46c6cd8, 0xfa5656ac, 0x07f4f4f3, 0x25eaeacf, 0xaf6565ca, 0x8e7a7af4, 0xe9aeae47, 0x18080810, 0xd5baba6f, 0x887878f0, 0x6f25254a, 0x722e2e5c, 0x241c1c38, 0xf1a6a657, 0xc7b4b473, 0x51c6c697, 0x23e8e8cb, 0x7cdddda1, 0x9c7474e8, 0x211f1f3e, 0xdd4b4b96, 0xdcbdbd61, 0x868b8b0d, 0x858a8a0f, 0x907070e0, 0x423e3e7c, 0xc4b5b571, 0xaa6666cc, 0xd8484890, 0x05030306, 0x01f6f6f7, 0x120e0e1c, 0xa36161c2, 0x5f35356a, 0xf95757ae, 0xd0b9b969, 0x91868617, 0x58c1c199, 0x271d1d3a, 0xb99e9e27, 0x38e1e1d9, 0x13f8f8eb, 0xb398982b, 0x33111122, 0xbb6969d2, 0x70d9d9a9, 0x898e8e07, 0xa7949433, 0xb69b9b2d, 0x221e1e3c, 0x92878715, 0x20e9e9c9, 0x49cece87, 0xff5555aa, 0x78282850, 0x7adfdfa5, 0x8f8c8c03, 0xf8a1a159, 0x80898909, 0x170d0d1a, 0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0, 0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e, 0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c }, { 0x6363c6a5, 0x7c7cf884, 0x7777ee99, 0x7b7bf68d, 0xf2f2ff0d, 0x6b6bd6bd, 0x6f6fdeb1, 0xc5c59154, 0x30306050, 0x01010203, 0x6767cea9, 0x2b2b567d, 0xfefee719, 0xd7d7b562, 0xabab4de6, 0x7676ec9a, 0xcaca8f45, 0x82821f9d, 0xc9c98940, 0x7d7dfa87, 0xfafaef15, 0x5959b2eb, 0x47478ec9, 0xf0f0fb0b, 0xadad41ec, 0xd4d4b367, 0xa2a25ffd, 0xafaf45ea, 0x9c9c23bf, 0xa4a453f7, 0x7272e496, 0xc0c09b5b, 0xb7b775c2, 0xfdfde11c, 0x93933dae, 0x26264c6a, 0x36366c5a, 0x3f3f7e41, 0xf7f7f502, 0xcccc834f, 0x3434685c, 0xa5a551f4, 0xe5e5d134, 0xf1f1f908, 0x7171e293, 0xd8d8ab73, 0x31316253, 0x15152a3f, 0x0404080c, 0xc7c79552, 0x23234665, 0xc3c39d5e, 0x18183028, 0x969637a1, 0x05050a0f, 0x9a9a2fb5, 0x07070e09, 0x12122436, 0x80801b9b, 0xe2e2df3d, 0xebebcd26, 0x27274e69, 0xb2b27fcd, 0x7575ea9f, 0x0909121b, 0x83831d9e, 0x2c2c5874, 0x1a1a342e, 0x1b1b362d, 0x6e6edcb2, 0x5a5ab4ee, 0xa0a05bfb, 0x5252a4f6, 0x3b3b764d, 0xd6d6b761, 0xb3b37dce, 0x2929527b, 0xe3e3dd3e, 0x2f2f5e71, 0x84841397, 0x5353a6f5, 0xd1d1b968, 0x00000000, 0xededc12c, 0x20204060, 0xfcfce31f, 0xb1b179c8, 0x5b5bb6ed, 0x6a6ad4be, 0xcbcb8d46, 0xbebe67d9, 0x3939724b, 0x4a4a94de, 0x4c4c98d4, 0x5858b0e8, 0xcfcf854a, 0xd0d0bb6b, 0xefefc52a, 0xaaaa4fe5, 0xfbfbed16, 0x434386c5, 0x4d4d9ad7, 0x33336655, 0x85851194, 0x45458acf, 0xf9f9e910, 0x02020406, 0x7f7ffe81, 0x5050a0f0, 0x3c3c7844, 0x9f9f25ba, 0xa8a84be3, 0x5151a2f3, 0xa3a35dfe, 0x404080c0, 0x8f8f058a, 0x92923fad, 0x9d9d21bc, 0x38387048, 0xf5f5f104, 0xbcbc63df, 0xb6b677c1, 0xdadaaf75, 0x21214263, 0x10102030, 0xffffe51a, 0xf3f3fd0e, 0xd2d2bf6d, 0xcdcd814c, 0x0c0c1814, 0x13132635, 0xececc32f, 0x5f5fbee1, 0x979735a2, 0x444488cc, 0x17172e39, 0xc4c49357, 0xa7a755f2, 0x7e7efc82, 0x3d3d7a47, 0x6464c8ac, 0x5d5dbae7, 0x1919322b, 0x7373e695, 0x6060c0a0, 0x81811998, 0x4f4f9ed1, 0xdcdca37f, 0x22224466, 0x2a2a547e, 0x90903bab, 0x88880b83, 0x46468cca, 0xeeeec729, 0xb8b86bd3, 0x1414283c, 0xdedea779, 0x5e5ebce2, 0x0b0b161d, 0xdbdbad76, 0xe0e0db3b, 0x32326456, 0x3a3a744e, 0x0a0a141e, 0x494992db, 0x06060c0a, 0x2424486c, 0x5c5cb8e4, 0xc2c29f5d, 0xd3d3bd6e, 0xacac43ef, 0x6262c4a6, 0x919139a8, 0x959531a4, 0xe4e4d337, 0x7979f28b, 0xe7e7d532, 0xc8c88b43, 0x37376e59, 0x6d6ddab7, 0x8d8d018c, 0xd5d5b164, 0x4e4e9cd2, 0xa9a949e0, 0x6c6cd8b4, 0x5656acfa, 0xf4f4f307, 0xeaeacf25, 0x6565caaf, 0x7a7af48e, 0xaeae47e9, 0x08081018, 0xbaba6fd5, 0x7878f088, 0x25254a6f, 0x2e2e5c72, 0x1c1c3824, 0xa6a657f1, 0xb4b473c7, 0xc6c69751, 0xe8e8cb23, 0xdddda17c, 0x7474e89c, 0x1f1f3e21, 0x4b4b96dd, 0xbdbd61dc, 0x8b8b0d86, 0x8a8a0f85, 0x7070e090, 0x3e3e7c42, 0xb5b571c4, 0x6666ccaa, 0x484890d8, 0x03030605, 0xf6f6f701, 0x0e0e1c12, 0x6161c2a3, 0x35356a5f, 0x5757aef9, 0xb9b969d0, 0x86861791, 0xc1c19958, 0x1d1d3a27, 0x9e9e27b9, 0xe1e1d938, 0xf8f8eb13, 0x98982bb3, 0x11112233, 0x6969d2bb, 0xd9d9a970, 0x8e8e0789, 0x949433a7, 0x9b9b2db6, 0x1e1e3c22, 0x87871592, 0xe9e9c920, 0xcece8749, 0x5555aaff, 0x28285078, 0xdfdfa57a, 0x8c8c038f, 0xa1a159f8, 0x89890980, 0x0d0d1a17, 0xbfbf65da, 0xe6e6d731, 0x424284c6, 0x6868d0b8, 0x414182c3, 0x999929b0, 0x2d2d5a77, 0x0f0f1e11, 0xb0b07bcb, 0x5454a8fc, 0xbbbb6dd6, 0x16162c3a }, { 0x63c6a563, 0x7cf8847c, 0x77ee9977, 0x7bf68d7b, 0xf2ff0df2, 0x6bd6bd6b, 0x6fdeb16f, 0xc59154c5, 0x30605030, 0x01020301, 0x67cea967, 0x2b567d2b, 0xfee719fe, 0xd7b562d7, 0xab4de6ab, 0x76ec9a76, 0xca8f45ca, 0x821f9d82, 0xc98940c9, 0x7dfa877d, 0xfaef15fa, 0x59b2eb59, 0x478ec947, 0xf0fb0bf0, 0xad41ecad, 0xd4b367d4, 0xa25ffda2, 0xaf45eaaf, 0x9c23bf9c, 0xa453f7a4, 0x72e49672, 0xc09b5bc0, 0xb775c2b7, 0xfde11cfd, 0x933dae93, 0x264c6a26, 0x366c5a36, 0x3f7e413f, 0xf7f502f7, 0xcc834fcc, 0x34685c34, 0xa551f4a5, 0xe5d134e5, 0xf1f908f1, 0x71e29371, 0xd8ab73d8, 0x31625331, 0x152a3f15, 0x04080c04, 0xc79552c7, 0x23466523, 0xc39d5ec3, 0x18302818, 0x9637a196, 0x050a0f05, 0x9a2fb59a, 0x070e0907, 0x12243612, 0x801b9b80, 0xe2df3de2, 0xebcd26eb, 0x274e6927, 0xb27fcdb2, 0x75ea9f75, 0x09121b09, 0x831d9e83, 0x2c58742c, 0x1a342e1a, 0x1b362d1b, 0x6edcb26e, 0x5ab4ee5a, 0xa05bfba0, 0x52a4f652, 0x3b764d3b, 0xd6b761d6, 0xb37dceb3, 0x29527b29, 0xe3dd3ee3, 0x2f5e712f, 0x84139784, 0x53a6f553, 0xd1b968d1, 0x00000000, 0xedc12ced, 0x20406020, 0xfce31ffc, 0xb179c8b1, 0x5bb6ed5b, 0x6ad4be6a, 0xcb8d46cb, 0xbe67d9be, 0x39724b39, 0x4a94de4a, 0x4c98d44c, 0x58b0e858, 0xcf854acf, 0xd0bb6bd0, 0xefc52aef, 0xaa4fe5aa, 0xfbed16fb, 0x4386c543, 0x4d9ad74d, 0x33665533, 0x85119485, 0x458acf45, 0xf9e910f9, 0x02040602, 0x7ffe817f, 0x50a0f050, 0x3c78443c, 0x9f25ba9f, 0xa84be3a8, 0x51a2f351, 0xa35dfea3, 0x4080c040, 0x8f058a8f, 0x923fad92, 0x9d21bc9d, 0x38704838, 0xf5f104f5, 0xbc63dfbc, 0xb677c1b6, 0xdaaf75da, 0x21426321, 0x10203010, 0xffe51aff, 0xf3fd0ef3, 0xd2bf6dd2, 0xcd814ccd, 0x0c18140c, 0x13263513, 0xecc32fec, 0x5fbee15f, 0x9735a297, 0x4488cc44, 0x172e3917, 0xc49357c4, 0xa755f2a7, 0x7efc827e, 0x3d7a473d, 0x64c8ac64, 0x5dbae75d, 0x19322b19, 0x73e69573, 0x60c0a060, 0x81199881, 0x4f9ed14f, 0xdca37fdc, 0x22446622, 0x2a547e2a, 0x903bab90, 0x880b8388, 0x468cca46, 0xeec729ee, 0xb86bd3b8, 0x14283c14, 0xdea779de, 0x5ebce25e, 0x0b161d0b, 0xdbad76db, 0xe0db3be0, 0x32645632, 0x3a744e3a, 0x0a141e0a, 0x4992db49, 0x060c0a06, 0x24486c24, 0x5cb8e45c, 0xc29f5dc2, 0xd3bd6ed3, 0xac43efac, 0x62c4a662, 0x9139a891, 0x9531a495, 0xe4d337e4, 0x79f28b79, 0xe7d532e7, 0xc88b43c8, 0x376e5937, 0x6ddab76d, 0x8d018c8d, 0xd5b164d5, 0x4e9cd24e, 0xa949e0a9, 0x6cd8b46c, 0x56acfa56, 0xf4f307f4, 0xeacf25ea, 0x65caaf65, 0x7af48e7a, 0xae47e9ae, 0x08101808, 0xba6fd5ba, 0x78f08878, 0x254a6f25, 0x2e5c722e, 0x1c38241c, 0xa657f1a6, 0xb473c7b4, 0xc69751c6, 0xe8cb23e8, 0xdda17cdd, 0x74e89c74, 0x1f3e211f, 0x4b96dd4b, 0xbd61dcbd, 0x8b0d868b, 0x8a0f858a, 0x70e09070, 0x3e7c423e, 0xb571c4b5, 0x66ccaa66, 0x4890d848, 0x03060503, 0xf6f701f6, 0x0e1c120e, 0x61c2a361, 0x356a5f35, 0x57aef957, 0xb969d0b9, 0x86179186, 0xc19958c1, 0x1d3a271d, 0x9e27b99e, 0xe1d938e1, 0xf8eb13f8, 0x982bb398, 0x11223311, 0x69d2bb69, 0xd9a970d9, 0x8e07898e, 0x9433a794, 0x9b2db69b, 0x1e3c221e, 0x87159287, 0xe9c920e9, 0xce8749ce, 0x55aaff55, 0x28507828, 0xdfa57adf, 0x8c038f8c, 0xa159f8a1, 0x89098089, 0x0d1a170d, 0xbf65dabf, 0xe6d731e6, 0x4284c642, 0x68d0b868, 0x4182c341, 0x9929b099, 0x2d5a772d, 0x0f1e110f, 0xb07bcbb0, 0x54a8fc54, 0xbb6dd6bb, 0x162c3a16 }, { 0xc6a56363, 0xf8847c7c, 0xee997777, 0xf68d7b7b, 0xff0df2f2, 0xd6bd6b6b, 0xdeb16f6f, 0x9154c5c5, 0x60503030, 0x02030101, 0xcea96767, 0x567d2b2b, 0xe719fefe, 0xb562d7d7, 0x4de6abab, 0xec9a7676, 0x8f45caca, 0x1f9d8282, 0x8940c9c9, 0xfa877d7d, 0xef15fafa, 0xb2eb5959, 0x8ec94747, 0xfb0bf0f0, 0x41ecadad, 0xb367d4d4, 0x5ffda2a2, 0x45eaafaf, 0x23bf9c9c, 0x53f7a4a4, 0xe4967272, 0x9b5bc0c0, 0x75c2b7b7, 0xe11cfdfd, 0x3dae9393, 0x4c6a2626, 0x6c5a3636, 0x7e413f3f, 0xf502f7f7, 0x834fcccc, 0x685c3434, 0x51f4a5a5, 0xd134e5e5, 0xf908f1f1, 0xe2937171, 0xab73d8d8, 0x62533131, 0x2a3f1515, 0x080c0404, 0x9552c7c7, 0x46652323, 0x9d5ec3c3, 0x30281818, 0x37a19696, 0x0a0f0505, 0x2fb59a9a, 0x0e090707, 0x24361212, 0x1b9b8080, 0xdf3de2e2, 0xcd26ebeb, 0x4e692727, 0x7fcdb2b2, 0xea9f7575, 0x121b0909, 0x1d9e8383, 0x58742c2c, 0x342e1a1a, 0x362d1b1b, 0xdcb26e6e, 0xb4ee5a5a, 0x5bfba0a0, 0xa4f65252, 0x764d3b3b, 0xb761d6d6, 0x7dceb3b3, 0x527b2929, 0xdd3ee3e3, 0x5e712f2f, 0x13978484, 0xa6f55353, 0xb968d1d1, 0x00000000, 0xc12ceded, 0x40602020, 0xe31ffcfc, 0x79c8b1b1, 0xb6ed5b5b, 0xd4be6a6a, 0x8d46cbcb, 0x67d9bebe, 0x724b3939, 0x94de4a4a, 0x98d44c4c, 0xb0e85858, 0x854acfcf, 0xbb6bd0d0, 0xc52aefef, 0x4fe5aaaa, 0xed16fbfb, 0x86c54343, 0x9ad74d4d, 0x66553333, 0x11948585, 0x8acf4545, 0xe910f9f9, 0x04060202, 0xfe817f7f, 0xa0f05050, 0x78443c3c, 0x25ba9f9f, 0x4be3a8a8, 0xa2f35151, 0x5dfea3a3, 0x80c04040, 0x058a8f8f, 0x3fad9292, 0x21bc9d9d, 0x70483838, 0xf104f5f5, 0x63dfbcbc, 0x77c1b6b6, 0xaf75dada, 0x42632121, 0x20301010, 0xe51affff, 0xfd0ef3f3, 0xbf6dd2d2, 0x814ccdcd, 0x18140c0c, 0x26351313, 0xc32fecec, 0xbee15f5f, 0x35a29797, 0x88cc4444, 0x2e391717, 0x9357c4c4, 0x55f2a7a7, 0xfc827e7e, 0x7a473d3d, 0xc8ac6464, 0xbae75d5d, 0x322b1919, 0xe6957373, 0xc0a06060, 0x19988181, 0x9ed14f4f, 0xa37fdcdc, 0x44662222, 0x547e2a2a, 0x3bab9090, 0x0b838888, 0x8cca4646, 0xc729eeee, 0x6bd3b8b8, 0x283c1414, 0xa779dede, 0xbce25e5e, 0x161d0b0b, 0xad76dbdb, 0xdb3be0e0, 0x64563232, 0x744e3a3a, 0x141e0a0a, 0x92db4949, 0x0c0a0606, 0x486c2424, 0xb8e45c5c, 0x9f5dc2c2, 0xbd6ed3d3, 0x43efacac, 0xc4a66262, 0x39a89191, 0x31a49595, 0xd337e4e4, 0xf28b7979, 0xd532e7e7, 0x8b43c8c8, 0x6e593737, 0xdab76d6d, 0x018c8d8d, 0xb164d5d5, 0x9cd24e4e, 0x49e0a9a9, 0xd8b46c6c, 0xacfa5656, 0xf307f4f4, 0xcf25eaea, 0xcaaf6565, 0xf48e7a7a, 0x47e9aeae, 0x10180808, 0x6fd5baba, 0xf0887878, 0x4a6f2525, 0x5c722e2e, 0x38241c1c, 0x57f1a6a6, 0x73c7b4b4, 0x9751c6c6, 0xcb23e8e8, 0xa17cdddd, 0xe89c7474, 0x3e211f1f, 0x96dd4b4b, 0x61dcbdbd, 0x0d868b8b, 0x0f858a8a, 0xe0907070, 0x7c423e3e, 0x71c4b5b5, 0xccaa6666, 0x90d84848, 0x06050303, 0xf701f6f6, 0x1c120e0e, 0xc2a36161, 0x6a5f3535, 0xaef95757, 0x69d0b9b9, 0x17918686, 0x9958c1c1, 0x3a271d1d, 0x27b99e9e, 0xd938e1e1, 0xeb13f8f8, 0x2bb39898, 0x22331111, 0xd2bb6969, 0xa970d9d9, 0x07898e8e, 0x33a79494, 0x2db69b9b, 0x3c221e1e, 0x15928787, 0xc920e9e9, 0x8749cece, 0xaaff5555, 0x50782828, 0xa57adfdf, 0x038f8c8c, 0x59f8a1a1, 0x09808989, 0x1a170d0d, 0x65dabfbf, 0xd731e6e6, 0x84c64242, 0xd0b86868, 0x82c34141, 0x29b09999, 0x5a772d2d, 0x1e110f0f, 0x7bcbb0b0, 0xa8fc5454, 0x6dd6bbbb, 0x2c3a1616 }, { 0x63636363, 0x7c7c7c7c, 0x77777777, 0x7b7b7b7b, 0xf2f2f2f2, 0x6b6b6b6b, 0x6f6f6f6f, 0xc5c5c5c5, 0x30303030, 0x01010101, 0x67676767, 0x2b2b2b2b, 0xfefefefe, 0xd7d7d7d7, 0xabababab, 0x76767676, 0xcacacaca, 0x82828282, 0xc9c9c9c9, 0x7d7d7d7d, 0xfafafafa, 0x59595959, 0x47474747, 0xf0f0f0f0, 0xadadadad, 0xd4d4d4d4, 0xa2a2a2a2, 0xafafafaf, 0x9c9c9c9c, 0xa4a4a4a4, 0x72727272, 0xc0c0c0c0, 0xb7b7b7b7, 0xfdfdfdfd, 0x93939393, 0x26262626, 0x36363636, 0x3f3f3f3f, 0xf7f7f7f7, 0xcccccccc, 0x34343434, 0xa5a5a5a5, 0xe5e5e5e5, 0xf1f1f1f1, 0x71717171, 0xd8d8d8d8, 0x31313131, 0x15151515, 0x04040404, 0xc7c7c7c7, 0x23232323, 0xc3c3c3c3, 0x18181818, 0x96969696, 0x05050505, 0x9a9a9a9a, 0x07070707, 0x12121212, 0x80808080, 0xe2e2e2e2, 0xebebebeb, 0x27272727, 0xb2b2b2b2, 0x75757575, 0x09090909, 0x83838383, 0x2c2c2c2c, 0x1a1a1a1a, 0x1b1b1b1b, 0x6e6e6e6e, 0x5a5a5a5a, 0xa0a0a0a0, 0x52525252, 0x3b3b3b3b, 0xd6d6d6d6, 0xb3b3b3b3, 0x29292929, 0xe3e3e3e3, 0x2f2f2f2f, 0x84848484, 0x53535353, 0xd1d1d1d1, 0x00000000, 0xedededed, 0x20202020, 0xfcfcfcfc, 0xb1b1b1b1, 0x5b5b5b5b, 0x6a6a6a6a, 0xcbcbcbcb, 0xbebebebe, 0x39393939, 0x4a4a4a4a, 0x4c4c4c4c, 0x58585858, 0xcfcfcfcf, 0xd0d0d0d0, 0xefefefef, 0xaaaaaaaa, 0xfbfbfbfb, 0x43434343, 0x4d4d4d4d, 0x33333333, 0x85858585, 0x45454545, 0xf9f9f9f9, 0x02020202, 0x7f7f7f7f, 0x50505050, 0x3c3c3c3c, 0x9f9f9f9f, 0xa8a8a8a8, 0x51515151, 0xa3a3a3a3, 0x40404040, 0x8f8f8f8f, 0x92929292, 0x9d9d9d9d, 0x38383838, 0xf5f5f5f5, 0xbcbcbcbc, 0xb6b6b6b6, 0xdadadada, 0x21212121, 0x10101010, 0xffffffff, 0xf3f3f3f3, 0xd2d2d2d2, 0xcdcdcdcd, 0x0c0c0c0c, 0x13131313, 0xecececec, 0x5f5f5f5f, 0x97979797, 0x44444444, 0x17171717, 0xc4c4c4c4, 0xa7a7a7a7, 0x7e7e7e7e, 0x3d3d3d3d, 0x64646464, 0x5d5d5d5d, 0x19191919, 0x73737373, 0x60606060, 0x81818181, 0x4f4f4f4f, 0xdcdcdcdc, 0x22222222, 0x2a2a2a2a, 0x90909090, 0x88888888, 0x46464646, 0xeeeeeeee, 0xb8b8b8b8, 0x14141414, 0xdededede, 0x5e5e5e5e, 0x0b0b0b0b, 0xdbdbdbdb, 0xe0e0e0e0, 0x32323232, 0x3a3a3a3a, 0x0a0a0a0a, 0x49494949, 0x06060606, 0x24242424, 0x5c5c5c5c, 0xc2c2c2c2, 0xd3d3d3d3, 0xacacacac, 0x62626262, 0x91919191, 0x95959595, 0xe4e4e4e4, 0x79797979, 0xe7e7e7e7, 0xc8c8c8c8, 0x37373737, 0x6d6d6d6d, 0x8d8d8d8d, 0xd5d5d5d5, 0x4e4e4e4e, 0xa9a9a9a9, 0x6c6c6c6c, 0x56565656, 0xf4f4f4f4, 0xeaeaeaea, 0x65656565, 0x7a7a7a7a, 0xaeaeaeae, 0x08080808, 0xbabababa, 0x78787878, 0x25252525, 0x2e2e2e2e, 0x1c1c1c1c, 0xa6a6a6a6, 0xb4b4b4b4, 0xc6c6c6c6, 0xe8e8e8e8, 0xdddddddd, 0x74747474, 0x1f1f1f1f, 0x4b4b4b4b, 0xbdbdbdbd, 0x8b8b8b8b, 0x8a8a8a8a, 0x70707070, 0x3e3e3e3e, 0xb5b5b5b5, 0x66666666, 0x48484848, 0x03030303, 0xf6f6f6f6, 0x0e0e0e0e, 0x61616161, 0x35353535, 0x57575757, 0xb9b9b9b9, 0x86868686, 0xc1c1c1c1, 0x1d1d1d1d, 0x9e9e9e9e, 0xe1e1e1e1, 0xf8f8f8f8, 0x98989898, 0x11111111, 0x69696969, 0xd9d9d9d9, 0x8e8e8e8e, 0x94949494, 0x9b9b9b9b, 0x1e1e1e1e, 0x87878787, 0xe9e9e9e9, 0xcececece, 0x55555555, 0x28282828, 0xdfdfdfdf, 0x8c8c8c8c, 0xa1a1a1a1, 0x89898989, 0x0d0d0d0d, 0xbfbfbfbf, 0xe6e6e6e6, 0x42424242, 0x68686868, 0x41414141, 0x99999999, 0x2d2d2d2d, 0x0f0f0f0f, 0xb0b0b0b0, 0x54545454, 0xbbbbbbbb, 0x16161616 } }; #if defined(OPTIMIZE_MMX) && (defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)) # define _ae0 ((__m64*) _aes_enc.t0) # define _ae1 ((__m64*) _aes_enc.t1) # define _ae2 ((__m64*) _aes_enc.t2) # define _ae3 ((__m64*) _aes_enc.t3) # define _ae4 _aes_enc.t4 #else # define _ae0 _aes_enc.t0 # define _ae1 _aes_enc.t1 # define _ae2 _aes_enc.t2 # define _ae3 _aes_enc.t3 # define _ae4 _aes_enc.t4 #endif const _table _aes_dec = { { 0x50a7f451, 0x5365417e, 0xc3a4171a, 0x965e273a, 0xcb6bab3b, 0xf1459d1f, 0xab58faac, 0x9303e34b, 0x55fa3020, 0xf66d76ad, 0x9176cc88, 0x254c02f5, 0xfcd7e54f, 0xd7cb2ac5, 0x80443526, 0x8fa362b5, 0x495ab1de, 0x671bba25, 0x980eea45, 0xe1c0fe5d, 0x02752fc3, 0x12f04c81, 0xa397468d, 0xc6f9d36b, 0xe75f8f03, 0x959c9215, 0xeb7a6dbf, 0xda595295, 0x2d83bed4, 0xd3217458, 0x2969e049, 0x44c8c98e, 0x6a89c275, 0x78798ef4, 0x6b3e5899, 0xdd71b927, 0xb64fe1be, 0x17ad88f0, 0x66ac20c9, 0xb43ace7d, 0x184adf63, 0x82311ae5, 0x60335197, 0x457f5362, 0xe07764b1, 0x84ae6bbb, 0x1ca081fe, 0x942b08f9, 0x58684870, 0x19fd458f, 0x876cde94, 0xb7f87b52, 0x23d373ab, 0xe2024b72, 0x578f1fe3, 0x2aab5566, 0x0728ebb2, 0x03c2b52f, 0x9a7bc586, 0xa50837d3, 0xf2872830, 0xb2a5bf23, 0xba6a0302, 0x5c8216ed, 0x2b1ccf8a, 0x92b479a7, 0xf0f207f3, 0xa1e2694e, 0xcdf4da65, 0xd5be0506, 0x1f6234d1, 0x8afea6c4, 0x9d532e34, 0xa055f3a2, 0x32e18a05, 0x75ebf6a4, 0x39ec830b, 0xaaef6040, 0x069f715e, 0x51106ebd, 0xf98a213e, 0x3d06dd96, 0xae053edd, 0x46bde64d, 0xb58d5491, 0x055dc471, 0x6fd40604, 0xff155060, 0x24fb9819, 0x97e9bdd6, 0xcc434089, 0x779ed967, 0xbd42e8b0, 0x888b8907, 0x385b19e7, 0xdbeec879, 0x470a7ca1, 0xe90f427c, 0xc91e84f8, 0x00000000, 0x83868009, 0x48ed2b32, 0xac70111e, 0x4e725a6c, 0xfbff0efd, 0x5638850f, 0x1ed5ae3d, 0x27392d36, 0x64d90f0a, 0x21a65c68, 0xd1545b9b, 0x3a2e3624, 0xb1670a0c, 0x0fe75793, 0xd296eeb4, 0x9e919b1b, 0x4fc5c080, 0xa220dc61, 0x694b775a, 0x161a121c, 0x0aba93e2, 0xe52aa0c0, 0x43e0223c, 0x1d171b12, 0x0b0d090e, 0xadc78bf2, 0xb9a8b62d, 0xc8a91e14, 0x8519f157, 0x4c0775af, 0xbbdd99ee, 0xfd607fa3, 0x9f2601f7, 0xbcf5725c, 0xc53b6644, 0x347efb5b, 0x7629438b, 0xdcc623cb, 0x68fcedb6, 0x63f1e4b8, 0xcadc31d7, 0x10856342, 0x40229713, 0x2011c684, 0x7d244a85, 0xf83dbbd2, 0x1132f9ae, 0x6da129c7, 0x4b2f9e1d, 0xf330b2dc, 0xec52860d, 0xd0e3c177, 0x6c16b32b, 0x99b970a9, 0xfa489411, 0x2264e947, 0xc48cfca8, 0x1a3ff0a0, 0xd82c7d56, 0xef903322, 0xc74e4987, 0xc1d138d9, 0xfea2ca8c, 0x360bd498, 0xcf81f5a6, 0x28de7aa5, 0x268eb7da, 0xa4bfad3f, 0xe49d3a2c, 0x0d927850, 0x9bcc5f6a, 0x62467e54, 0xc2138df6, 0xe8b8d890, 0x5ef7392e, 0xf5afc382, 0xbe805d9f, 0x7c93d069, 0xa92dd56f, 0xb31225cf, 0x3b99acc8, 0xa77d1810, 0x6e639ce8, 0x7bbb3bdb, 0x097826cd, 0xf418596e, 0x01b79aec, 0xa89a4f83, 0x656e95e6, 0x7ee6ffaa, 0x08cfbc21, 0xe6e815ef, 0xd99be7ba, 0xce366f4a, 0xd4099fea, 0xd67cb029, 0xafb2a431, 0x31233f2a, 0x3094a5c6, 0xc066a235, 0x37bc4e74, 0xa6ca82fc, 0xb0d090e0, 0x15d8a733, 0x4a9804f1, 0xf7daec41, 0x0e50cd7f, 0x2ff69117, 0x8dd64d76, 0x4db0ef43, 0x544daacc, 0xdf0496e4, 0xe3b5d19e, 0x1b886a4c, 0xb81f2cc1, 0x7f516546, 0x04ea5e9d, 0x5d358c01, 0x737487fa, 0x2e410bfb, 0x5a1d67b3, 0x52d2db92, 0x335610e9, 0x1347d66d, 0x8c61d79a, 0x7a0ca137, 0x8e14f859, 0x893c13eb, 0xee27a9ce, 0x35c961b7, 0xede51ce1, 0x3cb1477a, 0x59dfd29c, 0x3f73f255, 0x79ce1418, 0xbf37c773, 0xeacdf753, 0x5baafd5f, 0x146f3ddf, 0x86db4478, 0x81f3afca, 0x3ec468b9, 0x2c342438, 0x5f40a3c2, 0x72c31d16, 0x0c25e2bc, 0x8b493c28, 0x41950dff, 0x7101a839, 0xdeb30c08, 0x9ce4b4d8, 0x90c15664, 0x6184cb7b, 0x70b632d5, 0x745c6c48, 0x4257b8d0 }, { 0xa7f45150, 0x65417e53, 0xa4171ac3, 0x5e273a96, 0x6bab3bcb, 0x459d1ff1, 0x58faacab, 0x03e34b93, 0xfa302055, 0x6d76adf6, 0x76cc8891, 0x4c02f525, 0xd7e54ffc, 0xcb2ac5d7, 0x44352680, 0xa362b58f, 0x5ab1de49, 0x1bba2567, 0x0eea4598, 0xc0fe5de1, 0x752fc302, 0xf04c8112, 0x97468da3, 0xf9d36bc6, 0x5f8f03e7, 0x9c921595, 0x7a6dbfeb, 0x595295da, 0x83bed42d, 0x217458d3, 0x69e04929, 0xc8c98e44, 0x89c2756a, 0x798ef478, 0x3e58996b, 0x71b927dd, 0x4fe1beb6, 0xad88f017, 0xac20c966, 0x3ace7db4, 0x4adf6318, 0x311ae582, 0x33519760, 0x7f536245, 0x7764b1e0, 0xae6bbb84, 0xa081fe1c, 0x2b08f994, 0x68487058, 0xfd458f19, 0x6cde9487, 0xf87b52b7, 0xd373ab23, 0x024b72e2, 0x8f1fe357, 0xab55662a, 0x28ebb207, 0xc2b52f03, 0x7bc5869a, 0x0837d3a5, 0x872830f2, 0xa5bf23b2, 0x6a0302ba, 0x8216ed5c, 0x1ccf8a2b, 0xb479a792, 0xf207f3f0, 0xe2694ea1, 0xf4da65cd, 0xbe0506d5, 0x6234d11f, 0xfea6c48a, 0x532e349d, 0x55f3a2a0, 0xe18a0532, 0xebf6a475, 0xec830b39, 0xef6040aa, 0x9f715e06, 0x106ebd51, 0x8a213ef9, 0x06dd963d, 0x053eddae, 0xbde64d46, 0x8d5491b5, 0x5dc47105, 0xd406046f, 0x155060ff, 0xfb981924, 0xe9bdd697, 0x434089cc, 0x9ed96777, 0x42e8b0bd, 0x8b890788, 0x5b19e738, 0xeec879db, 0x0a7ca147, 0x0f427ce9, 0x1e84f8c9, 0x00000000, 0x86800983, 0xed2b3248, 0x70111eac, 0x725a6c4e, 0xff0efdfb, 0x38850f56, 0xd5ae3d1e, 0x392d3627, 0xd90f0a64, 0xa65c6821, 0x545b9bd1, 0x2e36243a, 0x670a0cb1, 0xe757930f, 0x96eeb4d2, 0x919b1b9e, 0xc5c0804f, 0x20dc61a2, 0x4b775a69, 0x1a121c16, 0xba93e20a, 0x2aa0c0e5, 0xe0223c43, 0x171b121d, 0x0d090e0b, 0xc78bf2ad, 0xa8b62db9, 0xa91e14c8, 0x19f15785, 0x0775af4c, 0xdd99eebb, 0x607fa3fd, 0x2601f79f, 0xf5725cbc, 0x3b6644c5, 0x7efb5b34, 0x29438b76, 0xc623cbdc, 0xfcedb668, 0xf1e4b863, 0xdc31d7ca, 0x85634210, 0x22971340, 0x11c68420, 0x244a857d, 0x3dbbd2f8, 0x32f9ae11, 0xa129c76d, 0x2f9e1d4b, 0x30b2dcf3, 0x52860dec, 0xe3c177d0, 0x16b32b6c, 0xb970a999, 0x489411fa, 0x64e94722, 0x8cfca8c4, 0x3ff0a01a, 0x2c7d56d8, 0x903322ef, 0x4e4987c7, 0xd138d9c1, 0xa2ca8cfe, 0x0bd49836, 0x81f5a6cf, 0xde7aa528, 0x8eb7da26, 0xbfad3fa4, 0x9d3a2ce4, 0x9278500d, 0xcc5f6a9b, 0x467e5462, 0x138df6c2, 0xb8d890e8, 0xf7392e5e, 0xafc382f5, 0x805d9fbe, 0x93d0697c, 0x2dd56fa9, 0x1225cfb3, 0x99acc83b, 0x7d1810a7, 0x639ce86e, 0xbb3bdb7b, 0x7826cd09, 0x18596ef4, 0xb79aec01, 0x9a4f83a8, 0x6e95e665, 0xe6ffaa7e, 0xcfbc2108, 0xe815efe6, 0x9be7bad9, 0x366f4ace, 0x099fead4, 0x7cb029d6, 0xb2a431af, 0x233f2a31, 0x94a5c630, 0x66a235c0, 0xbc4e7437, 0xca82fca6, 0xd090e0b0, 0xd8a73315, 0x9804f14a, 0xdaec41f7, 0x50cd7f0e, 0xf691172f, 0xd64d768d, 0xb0ef434d, 0x4daacc54, 0x0496e4df, 0xb5d19ee3, 0x886a4c1b, 0x1f2cc1b8, 0x5165467f, 0xea5e9d04, 0x358c015d, 0x7487fa73, 0x410bfb2e, 0x1d67b35a, 0xd2db9252, 0x5610e933, 0x47d66d13, 0x61d79a8c, 0x0ca1377a, 0x14f8598e, 0x3c13eb89, 0x27a9ceee, 0xc961b735, 0xe51ce1ed, 0xb1477a3c, 0xdfd29c59, 0x73f2553f, 0xce141879, 0x37c773bf, 0xcdf753ea, 0xaafd5f5b, 0x6f3ddf14, 0xdb447886, 0xf3afca81, 0xc468b93e, 0x3424382c, 0x40a3c25f, 0xc31d1672, 0x25e2bc0c, 0x493c288b, 0x950dff41, 0x01a83971, 0xb30c08de, 0xe4b4d89c, 0xc1566490, 0x84cb7b61, 0xb632d570, 0x5c6c4874, 0x57b8d042 }, { 0xf45150a7, 0x417e5365, 0x171ac3a4, 0x273a965e, 0xab3bcb6b, 0x9d1ff145, 0xfaacab58, 0xe34b9303, 0x302055fa, 0x76adf66d, 0xcc889176, 0x02f5254c, 0xe54ffcd7, 0x2ac5d7cb, 0x35268044, 0x62b58fa3, 0xb1de495a, 0xba25671b, 0xea45980e, 0xfe5de1c0, 0x2fc30275, 0x4c8112f0, 0x468da397, 0xd36bc6f9, 0x8f03e75f, 0x9215959c, 0x6dbfeb7a, 0x5295da59, 0xbed42d83, 0x7458d321, 0xe0492969, 0xc98e44c8, 0xc2756a89, 0x8ef47879, 0x58996b3e, 0xb927dd71, 0xe1beb64f, 0x88f017ad, 0x20c966ac, 0xce7db43a, 0xdf63184a, 0x1ae58231, 0x51976033, 0x5362457f, 0x64b1e077, 0x6bbb84ae, 0x81fe1ca0, 0x08f9942b, 0x48705868, 0x458f19fd, 0xde94876c, 0x7b52b7f8, 0x73ab23d3, 0x4b72e202, 0x1fe3578f, 0x55662aab, 0xebb20728, 0xb52f03c2, 0xc5869a7b, 0x37d3a508, 0x2830f287, 0xbf23b2a5, 0x0302ba6a, 0x16ed5c82, 0xcf8a2b1c, 0x79a792b4, 0x07f3f0f2, 0x694ea1e2, 0xda65cdf4, 0x0506d5be, 0x34d11f62, 0xa6c48afe, 0x2e349d53, 0xf3a2a055, 0x8a0532e1, 0xf6a475eb, 0x830b39ec, 0x6040aaef, 0x715e069f, 0x6ebd5110, 0x213ef98a, 0xdd963d06, 0x3eddae05, 0xe64d46bd, 0x5491b58d, 0xc471055d, 0x06046fd4, 0x5060ff15, 0x981924fb, 0xbdd697e9, 0x4089cc43, 0xd967779e, 0xe8b0bd42, 0x8907888b, 0x19e7385b, 0xc879dbee, 0x7ca1470a, 0x427ce90f, 0x84f8c91e, 0x00000000, 0x80098386, 0x2b3248ed, 0x111eac70, 0x5a6c4e72, 0x0efdfbff, 0x850f5638, 0xae3d1ed5, 0x2d362739, 0x0f0a64d9, 0x5c6821a6, 0x5b9bd154, 0x36243a2e, 0x0a0cb167, 0x57930fe7, 0xeeb4d296, 0x9b1b9e91, 0xc0804fc5, 0xdc61a220, 0x775a694b, 0x121c161a, 0x93e20aba, 0xa0c0e52a, 0x223c43e0, 0x1b121d17, 0x090e0b0d, 0x8bf2adc7, 0xb62db9a8, 0x1e14c8a9, 0xf1578519, 0x75af4c07, 0x99eebbdd, 0x7fa3fd60, 0x01f79f26, 0x725cbcf5, 0x6644c53b, 0xfb5b347e, 0x438b7629, 0x23cbdcc6, 0xedb668fc, 0xe4b863f1, 0x31d7cadc, 0x63421085, 0x97134022, 0xc6842011, 0x4a857d24, 0xbbd2f83d, 0xf9ae1132, 0x29c76da1, 0x9e1d4b2f, 0xb2dcf330, 0x860dec52, 0xc177d0e3, 0xb32b6c16, 0x70a999b9, 0x9411fa48, 0xe9472264, 0xfca8c48c, 0xf0a01a3f, 0x7d56d82c, 0x3322ef90, 0x4987c74e, 0x38d9c1d1, 0xca8cfea2, 0xd498360b, 0xf5a6cf81, 0x7aa528de, 0xb7da268e, 0xad3fa4bf, 0x3a2ce49d, 0x78500d92, 0x5f6a9bcc, 0x7e546246, 0x8df6c213, 0xd890e8b8, 0x392e5ef7, 0xc382f5af, 0x5d9fbe80, 0xd0697c93, 0xd56fa92d, 0x25cfb312, 0xacc83b99, 0x1810a77d, 0x9ce86e63, 0x3bdb7bbb, 0x26cd0978, 0x596ef418, 0x9aec01b7, 0x4f83a89a, 0x95e6656e, 0xffaa7ee6, 0xbc2108cf, 0x15efe6e8, 0xe7bad99b, 0x6f4ace36, 0x9fead409, 0xb029d67c, 0xa431afb2, 0x3f2a3123, 0xa5c63094, 0xa235c066, 0x4e7437bc, 0x82fca6ca, 0x90e0b0d0, 0xa73315d8, 0x04f14a98, 0xec41f7da, 0xcd7f0e50, 0x91172ff6, 0x4d768dd6, 0xef434db0, 0xaacc544d, 0x96e4df04, 0xd19ee3b5, 0x6a4c1b88, 0x2cc1b81f, 0x65467f51, 0x5e9d04ea, 0x8c015d35, 0x87fa7374, 0x0bfb2e41, 0x67b35a1d, 0xdb9252d2, 0x10e93356, 0xd66d1347, 0xd79a8c61, 0xa1377a0c, 0xf8598e14, 0x13eb893c, 0xa9ceee27, 0x61b735c9, 0x1ce1ede5, 0x477a3cb1, 0xd29c59df, 0xf2553f73, 0x141879ce, 0xc773bf37, 0xf753eacd, 0xfd5f5baa, 0x3ddf146f, 0x447886db, 0xafca81f3, 0x68b93ec4, 0x24382c34, 0xa3c25f40, 0x1d1672c3, 0xe2bc0c25, 0x3c288b49, 0x0dff4195, 0xa8397101, 0x0c08deb3, 0xb4d89ce4, 0x566490c1, 0xcb7b6184, 0x32d570b6, 0x6c48745c, 0xb8d04257 }, { 0x5150a7f4, 0x7e536541, 0x1ac3a417, 0x3a965e27, 0x3bcb6bab, 0x1ff1459d, 0xacab58fa, 0x4b9303e3, 0x2055fa30, 0xadf66d76, 0x889176cc, 0xf5254c02, 0x4ffcd7e5, 0xc5d7cb2a, 0x26804435, 0xb58fa362, 0xde495ab1, 0x25671bba, 0x45980eea, 0x5de1c0fe, 0xc302752f, 0x8112f04c, 0x8da39746, 0x6bc6f9d3, 0x03e75f8f, 0x15959c92, 0xbfeb7a6d, 0x95da5952, 0xd42d83be, 0x58d32174, 0x492969e0, 0x8e44c8c9, 0x756a89c2, 0xf478798e, 0x996b3e58, 0x27dd71b9, 0xbeb64fe1, 0xf017ad88, 0xc966ac20, 0x7db43ace, 0x63184adf, 0xe582311a, 0x97603351, 0x62457f53, 0xb1e07764, 0xbb84ae6b, 0xfe1ca081, 0xf9942b08, 0x70586848, 0x8f19fd45, 0x94876cde, 0x52b7f87b, 0xab23d373, 0x72e2024b, 0xe3578f1f, 0x662aab55, 0xb20728eb, 0x2f03c2b5, 0x869a7bc5, 0xd3a50837, 0x30f28728, 0x23b2a5bf, 0x02ba6a03, 0xed5c8216, 0x8a2b1ccf, 0xa792b479, 0xf3f0f207, 0x4ea1e269, 0x65cdf4da, 0x06d5be05, 0xd11f6234, 0xc48afea6, 0x349d532e, 0xa2a055f3, 0x0532e18a, 0xa475ebf6, 0x0b39ec83, 0x40aaef60, 0x5e069f71, 0xbd51106e, 0x3ef98a21, 0x963d06dd, 0xddae053e, 0x4d46bde6, 0x91b58d54, 0x71055dc4, 0x046fd406, 0x60ff1550, 0x1924fb98, 0xd697e9bd, 0x89cc4340, 0x67779ed9, 0xb0bd42e8, 0x07888b89, 0xe7385b19, 0x79dbeec8, 0xa1470a7c, 0x7ce90f42, 0xf8c91e84, 0x00000000, 0x09838680, 0x3248ed2b, 0x1eac7011, 0x6c4e725a, 0xfdfbff0e, 0x0f563885, 0x3d1ed5ae, 0x3627392d, 0x0a64d90f, 0x6821a65c, 0x9bd1545b, 0x243a2e36, 0x0cb1670a, 0x930fe757, 0xb4d296ee, 0x1b9e919b, 0x804fc5c0, 0x61a220dc, 0x5a694b77, 0x1c161a12, 0xe20aba93, 0xc0e52aa0, 0x3c43e022, 0x121d171b, 0x0e0b0d09, 0xf2adc78b, 0x2db9a8b6, 0x14c8a91e, 0x578519f1, 0xaf4c0775, 0xeebbdd99, 0xa3fd607f, 0xf79f2601, 0x5cbcf572, 0x44c53b66, 0x5b347efb, 0x8b762943, 0xcbdcc623, 0xb668fced, 0xb863f1e4, 0xd7cadc31, 0x42108563, 0x13402297, 0x842011c6, 0x857d244a, 0xd2f83dbb, 0xae1132f9, 0xc76da129, 0x1d4b2f9e, 0xdcf330b2, 0x0dec5286, 0x77d0e3c1, 0x2b6c16b3, 0xa999b970, 0x11fa4894, 0x472264e9, 0xa8c48cfc, 0xa01a3ff0, 0x56d82c7d, 0x22ef9033, 0x87c74e49, 0xd9c1d138, 0x8cfea2ca, 0x98360bd4, 0xa6cf81f5, 0xa528de7a, 0xda268eb7, 0x3fa4bfad, 0x2ce49d3a, 0x500d9278, 0x6a9bcc5f, 0x5462467e, 0xf6c2138d, 0x90e8b8d8, 0x2e5ef739, 0x82f5afc3, 0x9fbe805d, 0x697c93d0, 0x6fa92dd5, 0xcfb31225, 0xc83b99ac, 0x10a77d18, 0xe86e639c, 0xdb7bbb3b, 0xcd097826, 0x6ef41859, 0xec01b79a, 0x83a89a4f, 0xe6656e95, 0xaa7ee6ff, 0x2108cfbc, 0xefe6e815, 0xbad99be7, 0x4ace366f, 0xead4099f, 0x29d67cb0, 0x31afb2a4, 0x2a31233f, 0xc63094a5, 0x35c066a2, 0x7437bc4e, 0xfca6ca82, 0xe0b0d090, 0x3315d8a7, 0xf14a9804, 0x41f7daec, 0x7f0e50cd, 0x172ff691, 0x768dd64d, 0x434db0ef, 0xcc544daa, 0xe4df0496, 0x9ee3b5d1, 0x4c1b886a, 0xc1b81f2c, 0x467f5165, 0x9d04ea5e, 0x015d358c, 0xfa737487, 0xfb2e410b, 0xb35a1d67, 0x9252d2db, 0xe9335610, 0x6d1347d6, 0x9a8c61d7, 0x377a0ca1, 0x598e14f8, 0xeb893c13, 0xceee27a9, 0xb735c961, 0xe1ede51c, 0x7a3cb147, 0x9c59dfd2, 0x553f73f2, 0x1879ce14, 0x73bf37c7, 0x53eacdf7, 0x5f5baafd, 0xdf146f3d, 0x7886db44, 0xca81f3af, 0xb93ec468, 0x382c3424, 0xc25f40a3, 0x1672c31d, 0xbc0c25e2, 0x288b493c, 0xff41950d, 0x397101a8, 0x08deb30c, 0xd89ce4b4, 0x6490c156, 0x7b6184cb, 0xd570b632, 0x48745c6c, 0xd04257b8 }, { 0x52525252, 0x09090909, 0x6a6a6a6a, 0xd5d5d5d5, 0x30303030, 0x36363636, 0xa5a5a5a5, 0x38383838, 0xbfbfbfbf, 0x40404040, 0xa3a3a3a3, 0x9e9e9e9e, 0x81818181, 0xf3f3f3f3, 0xd7d7d7d7, 0xfbfbfbfb, 0x7c7c7c7c, 0xe3e3e3e3, 0x39393939, 0x82828282, 0x9b9b9b9b, 0x2f2f2f2f, 0xffffffff, 0x87878787, 0x34343434, 0x8e8e8e8e, 0x43434343, 0x44444444, 0xc4c4c4c4, 0xdededede, 0xe9e9e9e9, 0xcbcbcbcb, 0x54545454, 0x7b7b7b7b, 0x94949494, 0x32323232, 0xa6a6a6a6, 0xc2c2c2c2, 0x23232323, 0x3d3d3d3d, 0xeeeeeeee, 0x4c4c4c4c, 0x95959595, 0x0b0b0b0b, 0x42424242, 0xfafafafa, 0xc3c3c3c3, 0x4e4e4e4e, 0x08080808, 0x2e2e2e2e, 0xa1a1a1a1, 0x66666666, 0x28282828, 0xd9d9d9d9, 0x24242424, 0xb2b2b2b2, 0x76767676, 0x5b5b5b5b, 0xa2a2a2a2, 0x49494949, 0x6d6d6d6d, 0x8b8b8b8b, 0xd1d1d1d1, 0x25252525, 0x72727272, 0xf8f8f8f8, 0xf6f6f6f6, 0x64646464, 0x86868686, 0x68686868, 0x98989898, 0x16161616, 0xd4d4d4d4, 0xa4a4a4a4, 0x5c5c5c5c, 0xcccccccc, 0x5d5d5d5d, 0x65656565, 0xb6b6b6b6, 0x92929292, 0x6c6c6c6c, 0x70707070, 0x48484848, 0x50505050, 0xfdfdfdfd, 0xedededed, 0xb9b9b9b9, 0xdadadada, 0x5e5e5e5e, 0x15151515, 0x46464646, 0x57575757, 0xa7a7a7a7, 0x8d8d8d8d, 0x9d9d9d9d, 0x84848484, 0x90909090, 0xd8d8d8d8, 0xabababab, 0x00000000, 0x8c8c8c8c, 0xbcbcbcbc, 0xd3d3d3d3, 0x0a0a0a0a, 0xf7f7f7f7, 0xe4e4e4e4, 0x58585858, 0x05050505, 0xb8b8b8b8, 0xb3b3b3b3, 0x45454545, 0x06060606, 0xd0d0d0d0, 0x2c2c2c2c, 0x1e1e1e1e, 0x8f8f8f8f, 0xcacacaca, 0x3f3f3f3f, 0x0f0f0f0f, 0x02020202, 0xc1c1c1c1, 0xafafafaf, 0xbdbdbdbd, 0x03030303, 0x01010101, 0x13131313, 0x8a8a8a8a, 0x6b6b6b6b, 0x3a3a3a3a, 0x91919191, 0x11111111, 0x41414141, 0x4f4f4f4f, 0x67676767, 0xdcdcdcdc, 0xeaeaeaea, 0x97979797, 0xf2f2f2f2, 0xcfcfcfcf, 0xcececece, 0xf0f0f0f0, 0xb4b4b4b4, 0xe6e6e6e6, 0x73737373, 0x96969696, 0xacacacac, 0x74747474, 0x22222222, 0xe7e7e7e7, 0xadadadad, 0x35353535, 0x85858585, 0xe2e2e2e2, 0xf9f9f9f9, 0x37373737, 0xe8e8e8e8, 0x1c1c1c1c, 0x75757575, 0xdfdfdfdf, 0x6e6e6e6e, 0x47474747, 0xf1f1f1f1, 0x1a1a1a1a, 0x71717171, 0x1d1d1d1d, 0x29292929, 0xc5c5c5c5, 0x89898989, 0x6f6f6f6f, 0xb7b7b7b7, 0x62626262, 0x0e0e0e0e, 0xaaaaaaaa, 0x18181818, 0xbebebebe, 0x1b1b1b1b, 0xfcfcfcfc, 0x56565656, 0x3e3e3e3e, 0x4b4b4b4b, 0xc6c6c6c6, 0xd2d2d2d2, 0x79797979, 0x20202020, 0x9a9a9a9a, 0xdbdbdbdb, 0xc0c0c0c0, 0xfefefefe, 0x78787878, 0xcdcdcdcd, 0x5a5a5a5a, 0xf4f4f4f4, 0x1f1f1f1f, 0xdddddddd, 0xa8a8a8a8, 0x33333333, 0x88888888, 0x07070707, 0xc7c7c7c7, 0x31313131, 0xb1b1b1b1, 0x12121212, 0x10101010, 0x59595959, 0x27272727, 0x80808080, 0xecececec, 0x5f5f5f5f, 0x60606060, 0x51515151, 0x7f7f7f7f, 0xa9a9a9a9, 0x19191919, 0xb5b5b5b5, 0x4a4a4a4a, 0x0d0d0d0d, 0x2d2d2d2d, 0xe5e5e5e5, 0x7a7a7a7a, 0x9f9f9f9f, 0x93939393, 0xc9c9c9c9, 0x9c9c9c9c, 0xefefefef, 0xa0a0a0a0, 0xe0e0e0e0, 0x3b3b3b3b, 0x4d4d4d4d, 0xaeaeaeae, 0x2a2a2a2a, 0xf5f5f5f5, 0xb0b0b0b0, 0xc8c8c8c8, 0xebebebeb, 0xbbbbbbbb, 0x3c3c3c3c, 0x83838383, 0x53535353, 0x99999999, 0x61616161, 0x17171717, 0x2b2b2b2b, 0x04040404, 0x7e7e7e7e, 0xbabababa, 0x77777777, 0xd6d6d6d6, 0x26262626, 0xe1e1e1e1, 0x69696969, 0x14141414, 0x63636363, 0x55555555, 0x21212121, 0x0c0c0c0c, 0x7d7d7d7d } }; #define _ad0 _aes_dec.t0 #define _ad1 _aes_dec.t1 #define _ad2 _aes_dec.t2 #define _ad3 _aes_dec.t3 #define _ad4 _aes_dec.t4 static const uint32_t _arc[] = { 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x0000001b, 0x00000036 }; #if defined(OPTIMIZE_MMX) && (defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)) # define etfs(i) \ i0 = _mm_cvtsi64_si32(s0); \ i1 = _mm_cvtsi64_si32(s1); \ i2 = _mm_cvtsi64_si32(s2); \ i3 = _mm_cvtsi64_si32(s3); \ t0 = _mm_xor_si64( \ _mm_xor_si64( \ _mm_xor_si64(_ae0[(i0 ) & 0xff], \ _ae1[(i1 >> 8) & 0xff]), \ _mm_xor_si64(_ae2[(i2 >> 16) & 0xff], \ _ae3[(i3 >> 24) ]) \ ), _mm_cvtsi32_si64(rk[i+0])); \ t1 = _mm_xor_si64( \ _mm_xor_si64( \ _mm_xor_si64(_ae0[(i1 ) & 0xff], \ _ae1[(i2 >> 8) & 0xff]), \ _mm_xor_si64(_ae2[(i3 >> 16) & 0xff], \ _ae3[(i0 >> 24) ]) \ ), _mm_cvtsi32_si64(rk[i+1])); \ t2 = _mm_xor_si64( \ _mm_xor_si64( \ _mm_xor_si64(_ae0[(i2 ) & 0xff], \ _ae1[(i3 >> 8) & 0xff]), \ _mm_xor_si64(_ae2[(i0 >> 16) & 0xff], \ _ae3[(i1 >> 24) ]) \ ), _mm_cvtsi32_si64(rk[i+2])); \ t3 = _mm_xor_si64( \ _mm_xor_si64( \ _mm_xor_si64(_ae0[(i3 ) & 0xff], \ _ae1[(i0 >> 8) & 0xff]), \ _mm_xor_si64(_ae2[(i1 >> 16) & 0xff], \ _ae3[(i2 >> 24) ]) \ ), _mm_cvtsi32_si64(rk[i+3])); #else # define etfs(i) \ t0 = \ _ae0[(s0 ) & 0xff] ^ \ _ae1[(s1 >> 8) & 0xff] ^ \ _ae2[(s2 >> 16) & 0xff] ^ \ _ae3[(s3 >> 24) ] ^ \ rk[i+0]; \ t1 = \ _ae0[(s1 ) & 0xff] ^ \ _ae1[(s2 >> 8) & 0xff] ^ \ _ae2[(s3 >> 16) & 0xff] ^ \ _ae3[(s0 >> 24) ] ^ \ rk[i+1]; \ t2 = \ _ae0[(s2 ) & 0xff] ^ \ _ae1[(s3 >> 8) & 0xff] ^ \ _ae2[(s0 >> 16) & 0xff] ^ \ _ae3[(s1 >> 24) ] ^ \ rk[i+2]; \ t3 = \ _ae0[(s3 ) & 0xff] ^ \ _ae1[(s0 >> 8) & 0xff] ^ \ _ae2[(s1 >> 16) & 0xff] ^ \ _ae3[(s2 >> 24) ] ^ \ rk[i+3]; #endif #if defined(OPTIMIZE_MMX) && (defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)) # define esft(i) \ i0 = _mm_cvtsi64_si32(t0); \ i1 = _mm_cvtsi64_si32(t1); \ i2 = _mm_cvtsi64_si32(t2); \ i3 = _mm_cvtsi64_si32(t3); \ s0 = _mm_xor_si64( \ _mm_xor_si64( \ _mm_xor_si64(_ae0[(i0 ) & 0xff], \ _ae1[(i1 >> 8) & 0xff]), \ _mm_xor_si64(_ae2[(i2 >> 16) & 0xff], \ _ae3[(i3 >> 24) ]) \ ), _mm_cvtsi32_si64(rk[i+0])); \ s1 = _mm_xor_si64( \ _mm_xor_si64( \ _mm_xor_si64(_ae0[(i1 ) & 0xff], \ _ae1[(i2 >> 8) & 0xff]), \ _mm_xor_si64(_ae2[(i3 >> 16) & 0xff], \ _ae3[(i0 >> 24) ]) \ ), _mm_cvtsi32_si64(rk[i+1])); \ s2 = _mm_xor_si64( \ _mm_xor_si64( \ _mm_xor_si64(_ae0[(i2 ) & 0xff], \ _ae1[(i3 >> 8) & 0xff]), \ _mm_xor_si64(_ae2[(i0 >> 16) & 0xff], \ _ae3[(i1 >> 24) ]) \ ), _mm_cvtsi32_si64(rk[i+2])); \ s3 = _mm_xor_si64( \ _mm_xor_si64( \ _mm_xor_si64(_ae0[(i3 ) & 0xff], \ _ae1[(i0 >> 8) & 0xff]), \ _mm_xor_si64(_ae2[(i1 >> 16) & 0xff], \ _ae3[(i2 >> 24) ]) \ ), _mm_cvtsi32_si64(rk[i+3])); #else # define esft(i) \ s0 = \ _ae0[(t0 ) & 0xff] ^ \ _ae1[(t1 >> 8) & 0xff] ^ \ _ae2[(t2 >> 16) & 0xff] ^ \ _ae3[(t3 >> 24) ] ^ \ rk[i+0]; \ s1 = \ _ae0[(t1 ) & 0xff] ^ \ _ae1[(t2 >> 8) & 0xff] ^ \ _ae2[(t3 >> 16) & 0xff] ^ \ _ae3[(t0 >> 24) ] ^ \ rk[i+1]; \ s2 = \ _ae0[(t2 ) & 0xff] ^ \ _ae1[(t3 >> 8) & 0xff] ^ \ _ae2[(t0 >> 16) & 0xff] ^ \ _ae3[(t1 >> 24) ] ^ \ rk[i+2]; \ s3 = \ _ae0[(t3 ) & 0xff] ^ \ _ae1[(t0 >> 8) & 0xff] ^ \ _ae2[(t1 >> 16) & 0xff] ^ \ _ae3[(t2 >> 24) ] ^ \ rk[i+3]; #endif #if defined(OPTIMIZE_MMX) && (defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)) # define elr() \ i0 = _mm_cvtsi64_si32(t0); \ i1 = _mm_cvtsi64_si32(t1); \ i2 = _mm_cvtsi64_si32(t2); \ i3 = _mm_cvtsi64_si32(t3); \ s0 = _mm_cvtsi32_si64( \ (_ae4[(i0 ) & 0xff] & _aes_mask[0]) ^ \ (_ae4[(i1 >> 8) & 0xff] & _aes_mask[1]) ^ \ (_ae4[(i2 >> 16) & 0xff] & _aes_mask[2]) ^ \ (_ae4[(i3 >> 24) ] & _aes_mask[3]) ^ \ rk[0]); \ s1 = _mm_cvtsi32_si64( \ (_ae4[(i1 ) & 0xff] & _aes_mask[0]) ^ \ (_ae4[(i2 >> 8) & 0xff] & _aes_mask[1]) ^ \ (_ae4[(i3 >> 16) & 0xff] & _aes_mask[2]) ^ \ (_ae4[(i0 >> 24) ] & _aes_mask[3]) ^ \ rk[1]); \ s2 = _mm_cvtsi32_si64( \ (_ae4[(i2 ) & 0xff] & _aes_mask[0]) ^ \ (_ae4[(i3 >> 8) & 0xff] & _aes_mask[1]) ^ \ (_ae4[(i0 >> 16) & 0xff] & _aes_mask[2]) ^ \ (_ae4[(i1 >> 24) ] & _aes_mask[3]) ^ \ rk[2]); \ s3 = _mm_cvtsi32_si64( \ (_ae4[(i3 ) & 0xff] & _aes_mask[0]) ^ \ (_ae4[(i0 >> 8) & 0xff] & _aes_mask[1]) ^ \ (_ae4[(i1 >> 16) & 0xff] & _aes_mask[2]) ^ \ (_ae4[(i2 >> 24) ] & _aes_mask[3]) ^ \ rk[3]); #else # define elr() \ s0 = \ (_ae4[(t0 ) & 0xff] & _aes_mask[0]) ^ \ (_ae4[(t1 >> 8) & 0xff] & _aes_mask[1]) ^ \ (_ae4[(t2 >> 16) & 0xff] & _aes_mask[2]) ^ \ (_ae4[(t3 >> 24) ] & _aes_mask[3]) ^ \ rk[0]; \ s1 = \ (_ae4[(t1 ) & 0xff] & _aes_mask[0]) ^ \ (_ae4[(t2 >> 8) & 0xff] & _aes_mask[1]) ^ \ (_ae4[(t3 >> 16) & 0xff] & _aes_mask[2]) ^ \ (_ae4[(t0 >> 24) ] & _aes_mask[3]) ^ \ rk[1]; \ s2 = \ (_ae4[(t2 ) & 0xff] & _aes_mask[0]) ^ \ (_ae4[(t3 >> 8) & 0xff] & _aes_mask[1]) ^ \ (_ae4[(t0 >> 16) & 0xff] & _aes_mask[2]) ^ \ (_ae4[(t1 >> 24) ] & _aes_mask[3]) ^ \ rk[2]; \ s3 = \ (_ae4[(t3 ) & 0xff] & _aes_mask[0]) ^ \ (_ae4[(t0 >> 8) & 0xff] & _aes_mask[1]) ^ \ (_ae4[(t1 >> 16) & 0xff] & _aes_mask[2]) ^ \ (_ae4[(t2 >> 24) ] & _aes_mask[3]) ^ \ rk[3]; #endif #define dtfs(i) \ t0 = \ _ad0[(s0 ) & 0xff] ^ \ _ad1[(s3 >> 8) & 0xff] ^ \ _ad2[(s2 >> 16) & 0xff] ^ \ _ad3[(s1 >> 24) ] ^ \ rk[i+0]; \ t1 = \ _ad0[(s1 ) & 0xff] ^ \ _ad1[(s0 >> 8) & 0xff] ^ \ _ad2[(s3 >> 16) & 0xff] ^ \ _ad3[(s2 >> 24) ] ^ \ rk[i+1]; \ t2 = \ _ad0[(s2 ) & 0xff] ^ \ _ad1[(s1 >> 8) & 0xff] ^ \ _ad2[(s0 >> 16) & 0xff] ^ \ _ad3[(s3 >> 24) ] ^ \ rk[i+2]; \ t3 = \ _ad0[(s3 ) & 0xff] ^ \ _ad1[(s2 >> 8) & 0xff] ^ \ _ad2[(s1 >> 16) & 0xff] ^ \ _ad3[(s0 >> 24) ] ^ \ rk[i+3]; #define dsft(i) \ s0 = \ _ad0[(t0 ) & 0xff] ^ \ _ad1[(t3 >> 8) & 0xff] ^ \ _ad2[(t2 >> 16) & 0xff] ^ \ _ad3[(t1 >> 24) ] ^ \ rk[i+0]; \ s1 = \ _ad0[(t1 ) & 0xff] ^ \ _ad1[(t0 >> 8) & 0xff] ^ \ _ad2[(t3 >> 16) & 0xff] ^ \ _ad3[(t2 >> 24) ] ^ \ rk[i+1]; \ s2 = \ _ad0[(t2 ) & 0xff] ^ \ _ad1[(t1 >> 8) & 0xff] ^ \ _ad2[(t0 >> 16) & 0xff] ^ \ _ad3[(t3 >> 24) ] ^ \ rk[i+2]; \ s3 = \ _ad0[(t3 ) & 0xff] ^ \ _ad1[(t2 >> 8) & 0xff] ^ \ _ad2[(t1 >> 16) & 0xff] ^ \ _ad3[(t0 >> 24) ] ^ \ rk[i+3]; #define dlr() \ s0 = \ (_ad4[(t0 ) & 0xff] & 0x000000ff) ^ \ (_ad4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ad4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ad4[(t1 >> 24) ] & 0xff000000) ^ \ rk[0]; \ s1 = \ (_ad4[(t1 ) & 0xff] & 0x000000ff) ^ \ (_ad4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ad4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ad4[(t2 >> 24) ] & 0xff000000) ^ \ rk[1]; \ s2 = \ (_ad4[(t2 ) & 0xff] & 0x000000ff) ^ \ (_ad4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ad4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ad4[(t3 >> 24) ] & 0xff000000) ^ \ rk[2]; \ s3 = \ (_ad4[(t3 ) & 0xff] & 0x000000ff) ^ \ (_ad4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ad4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ad4[(t0 >> 24) ] & 0xff000000) ^ \ rk[3]; beecrypt-4.2.1/include/beecrypt/dlpk.h0000644000175000001440000000322211216147022014606 00000000000000/* * Copyright (c) 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dlpk.h * \brief Discrete Logarithm public key, headers. * \author Bob Deblier * \ingroup DL_m */ #ifndef _DLPK_H #define _DLPK_H #include "beecrypt/dldp.h" /*!\ingroup DL_m */ #ifdef __cplusplus struct BEECRYPTAPI dlpk_p #else struct _dlpk_p #endif { dldp_p param; mpnumber y; #ifdef __cplusplus dlpk_p(); dlpk_p(const dlpk_p&); ~dlpk_p(); #endif }; #ifndef __cplusplus typedef struct _dlpk_p dlpk_p; #endif #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int dlpk_pInit(dlpk_p*); BEECRYPTAPI int dlpk_pFree(dlpk_p*); BEECRYPTAPI int dlpk_pCopy(dlpk_p*, const dlpk_p*); BEECRYPTAPI int dlpk_pEqual(const dlpk_p*, const dlpk_p*); BEECRYPTAPI int dlpk_pgoqValidate(const dlpk_p*, randomGeneratorContext*, int cofactor); BEECRYPTAPI int dlpk_pgonValidate(const dlpk_p*, randomGeneratorContext*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/sha1.h0000644000175000001440000000610211216147022014510 00000000000000/* * Copyright (c) 1997, 1998, 1999, 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha1.h * \brief SHA-1 hash function, headers. * \author Bob Deblier * \ingroup HASH_m HASH_sha1_m */ #ifndef _SHA1_H #define _SHA1_H #include "beecrypt/beecrypt.h" #include "beecrypt/sha1opt.h" /*!\brief Holds all the parameters necessary for the SHA-1 algorithm. * \ingroup HASH_sha1_m */ #ifdef __cplusplus struct BEECRYPTAPI sha1Param #else struct _sha1Param #endif { /*!\var h */ uint32_t h[5]; /*!\var data */ uint32_t data[80]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[1]; #elif (MP_WBITS == 32) mpw length[2]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint32_t offset; }; #ifndef __cplusplus typedef struct _sha1Param sha1Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var sha1 * \brief Holds the full API description of the SHA-1 algorithm. */ extern BEECRYPTAPI const hashFunction sha1; /*!\fn void sha1Process(sha1Param* sp) * \brief This function performs the core of the SHA-1 hash algorithm; it * processes a block of 64 bytes. * \param sp The hash function's parameter block. */ BEECRYPTAPI void sha1Process(sha1Param* sp); /*!\fn int sha1Reset(sha1Param* sp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param sp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int sha1Reset (sha1Param* sp); /*!\fn int sha1Update(sha1Param* sp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param sp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int sha1Update (sha1Param* sp, const byte* data, size_t size); /*!\fn int sha1Digest(sha1Param* sp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param sp The hash function's parameter block. * \param digest The place to store the 20-byte digest. * \retval 0 on success. */ BEECRYPTAPI int sha1Digest (sha1Param* sp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/sha384.h0000644000175000001440000000611111216147022014666 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha384.h * \brief SHA-384 hash function, headers. * \author Bob Deblier * \ingroup HASH_m HASH_sha384_m */ #ifndef _SHA384_H #define _SHA384_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the SHA-384 algorithm. * \ingroup HASH_sha384_m */ #ifdef __cplusplus struct BEECRYPTAPI sha384Param #else struct _sha384Param #endif { /*!\var h */ uint64_t h[8]; /*!\var data */ uint64_t data[80]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[2]; #elif (MP_WBITS == 32) mpw length[4]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint64_t offset; }; #ifndef __cplusplus typedef struct _sha384Param sha384Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var sha384 * \brief Holds the full API description of the SHA-384 algorithm. */ extern BEECRYPTAPI const hashFunction sha384; /*!\fn void sha384Process(sha384Param* sp) * \brief This function performs the core of the SHA-384 hash algorithm; it * processes a block of 128 bytes. * \param sp The hash function's parameter block. */ BEECRYPTAPI void sha384Process(sha384Param* sp); /*!\fn int sha384Reset(sha384Param* sp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param sp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int sha384Reset (sha384Param* sp); /*!\fn int sha384Update(sha384Param* sp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param sp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int sha384Update (sha384Param* sp, const byte* data, size_t size); /*!\fn int sha384Digest(sha384Param* sp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param sp The hash function's parameter block. * \param digest The place to store the 64-byte digest. * \retval 0 on success. */ BEECRYPTAPI int sha384Digest (sha384Param* sp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/hmac.h0000644000175000001440000000310311216147022014562 00000000000000/* * Copyright (c) 1999, 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmac.h * \brief HMAC algorithm, headers. * \author Bob Deblier * \ingroup HMAC_m */ #ifndef _HMAC_H #define _HMAC_H #include "beecrypt/beecrypt.h" /*!\ingroup HMAC_m */ #ifdef __cplusplus extern "C" { #endif /* not used directly as keyed hash function, but instead used as generic methods */ BEECRYPTAPI int hmacSetup ( byte*, byte*, const hashFunction*, hashFunctionParam*, const byte*, size_t); BEECRYPTAPI int hmacReset (const byte*, const hashFunction*, hashFunctionParam*); BEECRYPTAPI int hmacUpdate( const hashFunction*, hashFunctionParam*, const byte*, size_t); BEECRYPTAPI int hmacDigest( const byte*, const hashFunction*, hashFunctionParam*, byte*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/timestamp.h0000644000175000001440000000260711216147022015665 00000000000000/* * Copyright (c) 1999, 2000 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _TIMESTAMP_H #define _TIMESTAMP_H #include "beecrypt/beecrypt.h" #if HAVE_LONG_LONG && !defined(__cplusplus) /* C++ doesn't like LL constants */ # define ONE_SECOND 1000LL # define ONE_MINUTE 60000LL # define ONE_HOUR 3600000LL # define ONE_DAY 86400000LL # define ONE_WEEK 604800000LL # define ONE_YEAR 31536000000LL #else # define ONE_SECOND 1000L # define ONE_MINUTE 60000L # define ONE_HOUR 3600000L # define ONE_DAY 86400000L # define ONE_WEEK 604800000L # define ONE_YEAR 31536000000L #endif #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI jlong timestamp(void); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/fips186.h0000644000175000001440000000372511216147022015064 00000000000000/* * Copyright (c) 1998, 1999, 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file fips186.h * \brief FIPS-186 pseudo-random number generator, headers. * \author Bob Deblier * \ingroup PRNG_m PRNG_fips186_m */ #ifndef _FIPS186_H #define _FIPS186_H #include "beecrypt/beecrypt.h" #ifdef _REENTRANT # if WIN32 # include # include # endif #endif #include "beecrypt.h" #include "sha1.h" #if (MP_WBITS == 64) # define FIPS186_STATE_SIZE 8 #elif (MP_WBITS == 32) # define FIPS186_STATE_SIZE 16 #else # error #endif /*!\ingroup PRNG_fips186_m */ #ifdef __cplusplus struct BEECRYPTAPI fips186Param #else struct _fips186Param #endif { #ifdef _REENTRANT bc_mutex_t lock; #endif sha1Param param; mpw state[FIPS186_STATE_SIZE]; byte digest[20]; unsigned char digestremain; }; #ifndef __cplusplus typedef struct _fips186Param fips186Param; #endif #ifdef __cplusplus extern "C" { #endif extern BEECRYPTAPI const randomGenerator fips186prng; BEECRYPTAPI int fips186Setup (fips186Param*); BEECRYPTAPI int fips186Seed (fips186Param*, const byte*, size_t); BEECRYPTAPI int fips186Next (fips186Param*, byte*, size_t); BEECRYPTAPI int fips186Cleanup(fips186Param*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/ripemd128.h0000644000175000001440000000624011223566203015376 00000000000000/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file ripemd128.h * \brief RIPEMD-1128 hash function, headers. * \author Jeff Johnson * \author Bob Deblier * \ingroup HASH_m HASH_rmd128_m */ #ifndef _RIPEMD128_H #define _RIPEMD128_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the RIPEMD-128 algorithm. * \ingroup HASH_rmd128_m */ #ifdef __cplusplus struct BEECRYPTAPI ripemd128Param #else struct _ripemd128Param #endif { /*!\var h */ uint32_t h[4]; /*!\var data */ uint32_t data[16]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[1]; #elif (MP_WBITS == 32) mpw length[2]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint32_t offset; }; #ifndef __cplusplus typedef struct _ripemd128Param ripemd128Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var ripemd128 * \brief Holds the full API description of the RIPEMD-128 algorithm. */ extern BEECRYPTAPI const hashFunction ripemd128; /*!\fn void ripemd128Process(ripemd128Param* mp) * \brief This function performs the core of the RIPEMD-128 hash algorithm; it * processes a block of 64 bytes. * \param mp The hash function's parameter block. */ BEECRYPTAPI void ripemd128Process(ripemd128Param* mp); /*!\fn int ripemd128Reset(ripemd128Param* mp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param mp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int ripemd128Reset (ripemd128Param* mp); /*!\fn int ripemd128Update(ripemd128Param* mp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param mp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int ripemd128Update (ripemd128Param* mp, const byte* data, size_t size); /*!\fn int ripemd128Digest(ripemd128Param* mp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param mp The hash function's parameter block. * \param digest The place to store the 20-byte digest. * \retval 0 on success. */ BEECRYPTAPI int ripemd128Digest (ripemd128Param* mp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/python/0000777000175000001440000000000010502516257015120 500000000000000beecrypt-4.2.1/include/beecrypt/python/CVS/0000777000175000001440000000000010502516654015554 500000000000000beecrypt-4.2.1/include/beecrypt/python/CVS/Repository0000664000175000001440000000004110502516257017566 00000000000000beecrypt/include/beecrypt/python beecrypt-4.2.1/include/beecrypt/python/CVS/Root0000664000175000001440000000007310502516257016337 00000000000000:ext:upuaut@beecrypt.cvs.sourceforge.net:/cvsroot/beecrypt beecrypt-4.2.1/include/beecrypt/python/CVS/Entries0000664000175000001440000000012410502516654017023 00000000000000/mpw-py.h/1.1/Sun Jun 20 11:08:45 2004// /rng-py.h/1.1/Sun Jun 20 11:08:55 2004// D beecrypt-4.2.1/include/beecrypt/python/mpw-py.h0000664000175000001440000000127610065270075016445 00000000000000#ifndef H_MPW_PY #define H_MPW_PY /** \ingroup py_c * \file python/mpw-py.h */ #include "beecrypt/mp.h" /** */ typedef struct mpwObject_s { PyObject_HEAD int ob_size; mpw data[1]; } mpwObject; /** */ /*@unchecked@*/ extern PyTypeObject mpw_Type; #define mpw_Check(_o) PyObject_TypeCheck((_o), &mpw_Type) #define mpw_CheckExact(_o) ((_o)->ob_type == &mpw_Type) #define MP_ROUND_B2W(_b) MP_BITS_TO_WORDS((_b) + MP_WBITS - 1) #define MPW_SIZE(_a) (size_t)((_a)->ob_size < 0 ? -(_a)->ob_size : (_a)->ob_size) #define MPW_DATA(_a) ((_a)->data) /** */ mpwObject * mpw_New(int ob_size) /*@*/; /** */ mpwObject * mpw_FromMPW(size_t size, mpw* data, int normalize) /*@*/; #endif beecrypt-4.2.1/include/beecrypt/python/rng-py.h0000664000175000001440000000066110065270107016421 00000000000000#ifndef H_RNG_PY #define H_RNG_PY /** \ingroup py_c * \file python/rng-py.h */ #include "beecrypt/beecrypt.h" #include "beecrypt/mpprime.h" /** */ typedef struct rngObject_s { PyObject_HEAD PyObject *md_dict; /*!< to look like PyModuleObject */ randomGeneratorContext rngc; mpbarrett b; } rngObject; /** */ /*@unchecked@*/ extern PyTypeObject rng_Type; #define is_rng(o) ((o)->ob_type == &rng_Type) #endif beecrypt-4.2.1/include/beecrypt/gnu.h0000644000175000001440000000333711226307220014453 00000000000000/* * Copyright (c) 2003, 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _BEECRYPT_GNU_H #define _BEECRYPT_GNU_H #if __MINGW32__ # define _REENTRANT # if !defined(_WIN32_WINNT) # define _WIN32_WINNT 0x0400 # endif # include #endif #include #include #include #include #include #include #include #include #include #include typedef pthread_cond_t bc_cond_t; typedef pthread_mutex_t bc_mutex_t; typedef pthread_t bc_thread_t; typedef pthread_t bc_threadid_t; #if defined(__GNUC__) # if !defined(__GNUC_PREREQ__) # define __GNUC_PREREQ__(maj, min) (__GNUC__ > (maj) || __GNUC__ == (maj) && __GNUC_MINOR__ >= (min)) # endif #else # define __GNUC__ 0 # define __GNUC_PREREQ__(maj, min) 0 #endif /* WARNING: overriding this value is dangerous; some assembler routines * make assumptions about the size set by the configure script */ #if !defined(MP_WBITS) # define MP_WBITS 64U #endif #endif beecrypt-4.2.1/include/beecrypt/pkcs12.h0000644000175000001440000000245711216147022014770 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file pkcs12.h * \brief PKCS#12 utility routines * \ingroup PKCS12_m * \author Bob Deblier */ #ifndef _PKCS12_H #define _PKCS12_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus extern "C" { #endif #define PKCS12_ID_CIPHER 0x1 #define PKCS12_ID_IV 0x2 #define PKCS12_ID_MAC 0x3 BEECRYPTAPI int pkcs12_derive_key(const hashFunction* h, byte id, const byte* pdata, size_t psize, const byte* sdata, size_t ssize, size_t iterationcount, byte* ndata, size_t nsize); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/aesopt.h0000644000175000001440000000303110532272121015144 00000000000000/* * Copyright (c) 2002 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file aesopt.h * \brief AES block cipher, assembler-optimized routines, headers. * \author Bob Deblier * \ingroup BC_aes_m */ #ifndef _AESOPT_H #define _AESOPT_H #include "beecrypt/beecrypt.h" #include "beecrypt/aes.h" #ifdef __cplusplus extern "C" { #endif #if WIN32 # if defined(_MSC_VER) && defined(_M_IX86) /* this space intentionally left blank */ # elif __INTEL__ && __MWERKS__ # endif #endif #if defined(__GNUC__) # if defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686) # endif #endif #if defined(__INTEL_COMPILER) # if defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686) # endif #endif #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* this space intentionally left blank */ #endif #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/dsa.h0000644000175000001440000000734611216147022014436 00000000000000/* * Copyright (c) 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dsa.h * \brief Digital Signature Algorithm, as specified by NIST FIPS 186. * * FIPS 186 specifies the DSA algorithm as having a large prime \f$p\f$, * a cofactor \f$q\f$ and a generator \f$g\f$ of a subgroup of * \f$\mathds{Z}^{*}_p\f$ with order \f$q\f$. The private and public key * values are \f$x\f$ and \f$y\f$ respectively. * * \author Bob Deblier * \ingroup DL_dsa_m */ #ifndef _DSA_H #define _DSA_H #include "beecrypt/dlkp.h" typedef dldp_p dsaparam; typedef dlpk_p dsapub; typedef dlkp_p dsakp; #ifdef __cplusplus extern "C" { #endif /*!\fn int dsasign(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnumber* r, mpnumber* s) * \brief This function performs a raw DSA signature. * * Signing equations: * * \li \f$r=(g^{k}\ \textrm{mod}\ p)\ \textrm{mod}\ q\f$ * \li \f$s=k^{-1}(h(m)+xr)\ \textrm{mod}\ q\f$ * * \param p The prime. * \param q The cofactor. * \param g The generator. * \param rgc The pseudo-random generator context. * \param hm The hash to be signed. * \param x The private key value. * \param r The signature's \e r value. * \param s The signature's \e s value. * \retval 0 on success. * \retval -1 on failure. */ BEECRYPTAPI int dsasign(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, randomGeneratorContext*, const mpnumber* hm, const mpnumber* x, mpnumber* r, mpnumber* s); /*!\fn int dsavrfy(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, const mpnumber* hm, const mpnumber* y, const mpnumber* r, const mpnumber* s) * \brief This function performs a raw DSA verification. * * Verifying equations: * \li Check \f$0= 512 and <= 1024, and be a multiple of 64. * \retval 0 on success. * \retval -1 on failure. */ BEECRYPTAPI int dsaparamMake(dsaparam*, randomGeneratorContext*, size_t); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/sha2k32.h0000644000175000001440000000220111216102377015031 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha2k32.h * \brief SHA-256 and SHA-224 shared constants, headers. * \author Bob Deblier * \ingroup HASH_sha256_m HASH_sha224_m */ #ifndef _SHA2K32_H #define _SHA2K32_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus extern "C" { #endif extern BEECRYPTAPI const uint32_t SHA2_32BIT_K[64]; #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/aes_be.h0000664000175000001440000011100510257775447015121 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ typedef struct { const uint32_t t0[256]; const uint32_t t1[256]; const uint32_t t2[256]; const uint32_t t3[256]; const uint32_t t4[256]; } _table; const _table _aes_enc = { { 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a }, { 0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616 }, { 0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16 }, { 0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c }, { 0x63636363, 0x7c7c7c7c, 0x77777777, 0x7b7b7b7b, 0xf2f2f2f2, 0x6b6b6b6b, 0x6f6f6f6f, 0xc5c5c5c5, 0x30303030, 0x01010101, 0x67676767, 0x2b2b2b2b, 0xfefefefe, 0xd7d7d7d7, 0xabababab, 0x76767676, 0xcacacaca, 0x82828282, 0xc9c9c9c9, 0x7d7d7d7d, 0xfafafafa, 0x59595959, 0x47474747, 0xf0f0f0f0, 0xadadadad, 0xd4d4d4d4, 0xa2a2a2a2, 0xafafafaf, 0x9c9c9c9c, 0xa4a4a4a4, 0x72727272, 0xc0c0c0c0, 0xb7b7b7b7, 0xfdfdfdfd, 0x93939393, 0x26262626, 0x36363636, 0x3f3f3f3f, 0xf7f7f7f7, 0xcccccccc, 0x34343434, 0xa5a5a5a5, 0xe5e5e5e5, 0xf1f1f1f1, 0x71717171, 0xd8d8d8d8, 0x31313131, 0x15151515, 0x04040404, 0xc7c7c7c7, 0x23232323, 0xc3c3c3c3, 0x18181818, 0x96969696, 0x05050505, 0x9a9a9a9a, 0x07070707, 0x12121212, 0x80808080, 0xe2e2e2e2, 0xebebebeb, 0x27272727, 0xb2b2b2b2, 0x75757575, 0x09090909, 0x83838383, 0x2c2c2c2c, 0x1a1a1a1a, 0x1b1b1b1b, 0x6e6e6e6e, 0x5a5a5a5a, 0xa0a0a0a0, 0x52525252, 0x3b3b3b3b, 0xd6d6d6d6, 0xb3b3b3b3, 0x29292929, 0xe3e3e3e3, 0x2f2f2f2f, 0x84848484, 0x53535353, 0xd1d1d1d1, 0x00000000, 0xedededed, 0x20202020, 0xfcfcfcfc, 0xb1b1b1b1, 0x5b5b5b5b, 0x6a6a6a6a, 0xcbcbcbcb, 0xbebebebe, 0x39393939, 0x4a4a4a4a, 0x4c4c4c4c, 0x58585858, 0xcfcfcfcf, 0xd0d0d0d0, 0xefefefef, 0xaaaaaaaa, 0xfbfbfbfb, 0x43434343, 0x4d4d4d4d, 0x33333333, 0x85858585, 0x45454545, 0xf9f9f9f9, 0x02020202, 0x7f7f7f7f, 0x50505050, 0x3c3c3c3c, 0x9f9f9f9f, 0xa8a8a8a8, 0x51515151, 0xa3a3a3a3, 0x40404040, 0x8f8f8f8f, 0x92929292, 0x9d9d9d9d, 0x38383838, 0xf5f5f5f5, 0xbcbcbcbc, 0xb6b6b6b6, 0xdadadada, 0x21212121, 0x10101010, 0xffffffff, 0xf3f3f3f3, 0xd2d2d2d2, 0xcdcdcdcd, 0x0c0c0c0c, 0x13131313, 0xecececec, 0x5f5f5f5f, 0x97979797, 0x44444444, 0x17171717, 0xc4c4c4c4, 0xa7a7a7a7, 0x7e7e7e7e, 0x3d3d3d3d, 0x64646464, 0x5d5d5d5d, 0x19191919, 0x73737373, 0x60606060, 0x81818181, 0x4f4f4f4f, 0xdcdcdcdc, 0x22222222, 0x2a2a2a2a, 0x90909090, 0x88888888, 0x46464646, 0xeeeeeeee, 0xb8b8b8b8, 0x14141414, 0xdededede, 0x5e5e5e5e, 0x0b0b0b0b, 0xdbdbdbdb, 0xe0e0e0e0, 0x32323232, 0x3a3a3a3a, 0x0a0a0a0a, 0x49494949, 0x06060606, 0x24242424, 0x5c5c5c5c, 0xc2c2c2c2, 0xd3d3d3d3, 0xacacacac, 0x62626262, 0x91919191, 0x95959595, 0xe4e4e4e4, 0x79797979, 0xe7e7e7e7, 0xc8c8c8c8, 0x37373737, 0x6d6d6d6d, 0x8d8d8d8d, 0xd5d5d5d5, 0x4e4e4e4e, 0xa9a9a9a9, 0x6c6c6c6c, 0x56565656, 0xf4f4f4f4, 0xeaeaeaea, 0x65656565, 0x7a7a7a7a, 0xaeaeaeae, 0x08080808, 0xbabababa, 0x78787878, 0x25252525, 0x2e2e2e2e, 0x1c1c1c1c, 0xa6a6a6a6, 0xb4b4b4b4, 0xc6c6c6c6, 0xe8e8e8e8, 0xdddddddd, 0x74747474, 0x1f1f1f1f, 0x4b4b4b4b, 0xbdbdbdbd, 0x8b8b8b8b, 0x8a8a8a8a, 0x70707070, 0x3e3e3e3e, 0xb5b5b5b5, 0x66666666, 0x48484848, 0x03030303, 0xf6f6f6f6, 0x0e0e0e0e, 0x61616161, 0x35353535, 0x57575757, 0xb9b9b9b9, 0x86868686, 0xc1c1c1c1, 0x1d1d1d1d, 0x9e9e9e9e, 0xe1e1e1e1, 0xf8f8f8f8, 0x98989898, 0x11111111, 0x69696969, 0xd9d9d9d9, 0x8e8e8e8e, 0x94949494, 0x9b9b9b9b, 0x1e1e1e1e, 0x87878787, 0xe9e9e9e9, 0xcececece, 0x55555555, 0x28282828, 0xdfdfdfdf, 0x8c8c8c8c, 0xa1a1a1a1, 0x89898989, 0x0d0d0d0d, 0xbfbfbfbf, 0xe6e6e6e6, 0x42424242, 0x68686868, 0x41414141, 0x99999999, 0x2d2d2d2d, 0x0f0f0f0f, 0xb0b0b0b0, 0x54545454, 0xbbbbbbbb, 0x16161616 } }; #define _ae0 _aes_enc.t0 #define _ae1 _aes_enc.t1 #define _ae2 _aes_enc.t2 #define _ae3 _aes_enc.t3 #define _ae4 _aes_enc.t4 const _table _aes_dec = { { 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742 }, { 0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857 }, { 0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8 }, { 0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0 }, { 0x52525252, 0x09090909, 0x6a6a6a6a, 0xd5d5d5d5, 0x30303030, 0x36363636, 0xa5a5a5a5, 0x38383838, 0xbfbfbfbf, 0x40404040, 0xa3a3a3a3, 0x9e9e9e9e, 0x81818181, 0xf3f3f3f3, 0xd7d7d7d7, 0xfbfbfbfb, 0x7c7c7c7c, 0xe3e3e3e3, 0x39393939, 0x82828282, 0x9b9b9b9b, 0x2f2f2f2f, 0xffffffff, 0x87878787, 0x34343434, 0x8e8e8e8e, 0x43434343, 0x44444444, 0xc4c4c4c4, 0xdededede, 0xe9e9e9e9, 0xcbcbcbcb, 0x54545454, 0x7b7b7b7b, 0x94949494, 0x32323232, 0xa6a6a6a6, 0xc2c2c2c2, 0x23232323, 0x3d3d3d3d, 0xeeeeeeee, 0x4c4c4c4c, 0x95959595, 0x0b0b0b0b, 0x42424242, 0xfafafafa, 0xc3c3c3c3, 0x4e4e4e4e, 0x08080808, 0x2e2e2e2e, 0xa1a1a1a1, 0x66666666, 0x28282828, 0xd9d9d9d9, 0x24242424, 0xb2b2b2b2, 0x76767676, 0x5b5b5b5b, 0xa2a2a2a2, 0x49494949, 0x6d6d6d6d, 0x8b8b8b8b, 0xd1d1d1d1, 0x25252525, 0x72727272, 0xf8f8f8f8, 0xf6f6f6f6, 0x64646464, 0x86868686, 0x68686868, 0x98989898, 0x16161616, 0xd4d4d4d4, 0xa4a4a4a4, 0x5c5c5c5c, 0xcccccccc, 0x5d5d5d5d, 0x65656565, 0xb6b6b6b6, 0x92929292, 0x6c6c6c6c, 0x70707070, 0x48484848, 0x50505050, 0xfdfdfdfd, 0xedededed, 0xb9b9b9b9, 0xdadadada, 0x5e5e5e5e, 0x15151515, 0x46464646, 0x57575757, 0xa7a7a7a7, 0x8d8d8d8d, 0x9d9d9d9d, 0x84848484, 0x90909090, 0xd8d8d8d8, 0xabababab, 0x00000000, 0x8c8c8c8c, 0xbcbcbcbc, 0xd3d3d3d3, 0x0a0a0a0a, 0xf7f7f7f7, 0xe4e4e4e4, 0x58585858, 0x05050505, 0xb8b8b8b8, 0xb3b3b3b3, 0x45454545, 0x06060606, 0xd0d0d0d0, 0x2c2c2c2c, 0x1e1e1e1e, 0x8f8f8f8f, 0xcacacaca, 0x3f3f3f3f, 0x0f0f0f0f, 0x02020202, 0xc1c1c1c1, 0xafafafaf, 0xbdbdbdbd, 0x03030303, 0x01010101, 0x13131313, 0x8a8a8a8a, 0x6b6b6b6b, 0x3a3a3a3a, 0x91919191, 0x11111111, 0x41414141, 0x4f4f4f4f, 0x67676767, 0xdcdcdcdc, 0xeaeaeaea, 0x97979797, 0xf2f2f2f2, 0xcfcfcfcf, 0xcececece, 0xf0f0f0f0, 0xb4b4b4b4, 0xe6e6e6e6, 0x73737373, 0x96969696, 0xacacacac, 0x74747474, 0x22222222, 0xe7e7e7e7, 0xadadadad, 0x35353535, 0x85858585, 0xe2e2e2e2, 0xf9f9f9f9, 0x37373737, 0xe8e8e8e8, 0x1c1c1c1c, 0x75757575, 0xdfdfdfdf, 0x6e6e6e6e, 0x47474747, 0xf1f1f1f1, 0x1a1a1a1a, 0x71717171, 0x1d1d1d1d, 0x29292929, 0xc5c5c5c5, 0x89898989, 0x6f6f6f6f, 0xb7b7b7b7, 0x62626262, 0x0e0e0e0e, 0xaaaaaaaa, 0x18181818, 0xbebebebe, 0x1b1b1b1b, 0xfcfcfcfc, 0x56565656, 0x3e3e3e3e, 0x4b4b4b4b, 0xc6c6c6c6, 0xd2d2d2d2, 0x79797979, 0x20202020, 0x9a9a9a9a, 0xdbdbdbdb, 0xc0c0c0c0, 0xfefefefe, 0x78787878, 0xcdcdcdcd, 0x5a5a5a5a, 0xf4f4f4f4, 0x1f1f1f1f, 0xdddddddd, 0xa8a8a8a8, 0x33333333, 0x88888888, 0x07070707, 0xc7c7c7c7, 0x31313131, 0xb1b1b1b1, 0x12121212, 0x10101010, 0x59595959, 0x27272727, 0x80808080, 0xecececec, 0x5f5f5f5f, 0x60606060, 0x51515151, 0x7f7f7f7f, 0xa9a9a9a9, 0x19191919, 0xb5b5b5b5, 0x4a4a4a4a, 0x0d0d0d0d, 0x2d2d2d2d, 0xe5e5e5e5, 0x7a7a7a7a, 0x9f9f9f9f, 0x93939393, 0xc9c9c9c9, 0x9c9c9c9c, 0xefefefef, 0xa0a0a0a0, 0xe0e0e0e0, 0x3b3b3b3b, 0x4d4d4d4d, 0xaeaeaeae, 0x2a2a2a2a, 0xf5f5f5f5, 0xb0b0b0b0, 0xc8c8c8c8, 0xebebebeb, 0xbbbbbbbb, 0x3c3c3c3c, 0x83838383, 0x53535353, 0x99999999, 0x61616161, 0x17171717, 0x2b2b2b2b, 0x04040404, 0x7e7e7e7e, 0xbabababa, 0x77777777, 0xd6d6d6d6, 0x26262626, 0xe1e1e1e1, 0x69696969, 0x14141414, 0x63636363, 0x55555555, 0x21212121, 0x0c0c0c0c, 0x7d7d7d7d } }; #define _ad0 _aes_dec.t0 #define _ad1 _aes_dec.t1 #define _ad2 _aes_dec.t2 #define _ad3 _aes_dec.t3 #define _ad4 _aes_dec.t4 static const uint32_t _arc[] = { 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x1b000000, 0x36000000 }; #define etfs(i) \ t0 = \ _ae0[(s0 >> 24) ] ^ \ _ae1[(s1 >> 16) & 0xff] ^ \ _ae2[(s2 >> 8) & 0xff] ^ \ _ae3[(s3 ) & 0xff] ^ \ rk[i+0]; \ t1 = \ _ae0[(s1 >> 24) ] ^ \ _ae1[(s2 >> 16) & 0xff] ^ \ _ae2[(s3 >> 8) & 0xff] ^ \ _ae3[(s0 ) & 0xff] ^ \ rk[i+1]; \ t2 = \ _ae0[(s2 >> 24) ] ^ \ _ae1[(s3 >> 16) & 0xff] ^ \ _ae2[(s0 >> 8) & 0xff] ^ \ _ae3[(s1 ) & 0xff] ^ \ rk[i+2]; \ t3 = \ _ae0[(s3 >> 24) ] ^ \ _ae1[(s0 >> 16) & 0xff] ^ \ _ae2[(s1 >> 8) & 0xff] ^ \ _ae3[(s2 ) & 0xff] ^ \ rk[i+3]; #define esft(i) \ s0 = \ _ae0[(t0 >> 24) ] ^ \ _ae1[(t1 >> 16) & 0xff] ^ \ _ae2[(t2 >> 8) & 0xff] ^ \ _ae3[(t3 ) & 0xff] ^ \ rk[i+0]; \ s1 = \ _ae0[(t1 >> 24) ] ^ \ _ae1[(t2 >> 16) & 0xff] ^ \ _ae2[(t3 >> 8) & 0xff] ^ \ _ae3[(t0 ) & 0xff] ^ \ rk[i+1]; \ s2 = \ _ae0[(t2 >> 24) ] ^ \ _ae1[(t3 >> 16) & 0xff] ^ \ _ae2[(t0 >> 8) & 0xff] ^ \ _ae3[(t1 ) & 0xff] ^ \ rk[i+2]; \ s3 = \ _ae0[(t3 >> 24) ] ^ \ _ae1[(t0 >> 16) & 0xff] ^ \ _ae2[(t1 >> 8) & 0xff] ^ \ _ae3[(t2 ) & 0xff] ^ \ rk[i+3]; #define elr() \ s0 = \ (_ae4[(t0 >> 24) ] & 0xff000000) ^ \ (_ae4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ae4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ae4[(t3 ) & 0xff] & 0x000000ff) ^ \ rk[0]; \ s1 = \ (_ae4[(t1 >> 24) ] & 0xff000000) ^ \ (_ae4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ae4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ae4[(t0 ) & 0xff] & 0x000000ff) ^ \ rk[1]; \ s2 = \ (_ae4[(t2 >> 24) ] & 0xff000000) ^ \ (_ae4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ae4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ae4[(t1 ) & 0xff] & 0x000000ff) ^ \ rk[2]; \ s3 = \ (_ae4[(t3 >> 24) ] & 0xff000000) ^ \ (_ae4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ae4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ae4[(t2 ) & 0xff] & 0x000000ff) ^ \ rk[3]; #define dtfs(i) \ t0 = \ _ad0[(s0 >> 24) ] ^ \ _ad1[(s3 >> 16) & 0xff] ^ \ _ad2[(s2 >> 8) & 0xff] ^ \ _ad3[(s1 ) & 0xff] ^ \ rk[i+0]; \ t1 = \ _ad0[(s1 >> 24) ] ^ \ _ad1[(s0 >> 16) & 0xff] ^ \ _ad2[(s3 >> 8) & 0xff] ^ \ _ad3[(s2 ) & 0xff] ^ \ rk[i+1]; \ t2 = \ _ad0[(s2 >> 24) ] ^ \ _ad1[(s1 >> 16) & 0xff] ^ \ _ad2[(s0 >> 8) & 0xff] ^ \ _ad3[(s3 ) & 0xff] ^ \ rk[i+2]; \ t3 = \ _ad0[(s3 >> 24) ] ^ \ _ad1[(s2 >> 16) & 0xff] ^ \ _ad2[(s1 >> 8) & 0xff] ^ \ _ad3[(s0 ) & 0xff] ^ \ rk[i+3]; #define dsft(i) \ s0 = \ _ad0[(t0 >> 24) ] ^ \ _ad1[(t3 >> 16) & 0xff] ^ \ _ad2[(t2 >> 8) & 0xff] ^ \ _ad3[(t1 ) & 0xff] ^ \ rk[i+0]; \ s1 = \ _ad0[(t1 >> 24) ] ^ \ _ad1[(t0 >> 16) & 0xff] ^ \ _ad2[(t3 >> 8) & 0xff] ^ \ _ad3[(t2 ) & 0xff] ^ \ rk[i+1]; \ s2 = \ _ad0[(t2 >> 24) ] ^ \ _ad1[(t1 >> 16) & 0xff] ^ \ _ad2[(t0 >> 8) & 0xff] ^ \ _ad3[(t3 ) & 0xff] ^ \ rk[i+2]; \ s3 = \ _ad0[(t3 >> 24) ] ^ \ _ad1[(t2 >> 16) & 0xff] ^ \ _ad2[(t1 >> 8) & 0xff] ^ \ _ad3[(t0 ) & 0xff] ^ \ rk[i+3]; #define dlr() \ s0 = \ (_ad4[(t0 >> 24) ] & 0xff000000) ^ \ (_ad4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ad4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ad4[(t1 ) & 0xff] & 0x000000ff) ^ \ rk[0]; \ s1 = \ (_ad4[(t1 >> 24) ] & 0xff000000) ^ \ (_ad4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ad4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ad4[(t2 ) & 0xff] & 0x000000ff) ^ \ rk[1]; \ s2 = \ (_ad4[(t2 >> 24) ] & 0xff000000) ^ \ (_ad4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ad4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ad4[(t3 ) & 0xff] & 0x000000ff) ^ \ rk[2]; \ s3 = \ (_ad4[(t3 >> 24) ] & 0xff000000) ^ \ (_ad4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ \ (_ad4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ \ (_ad4[(t0 ) & 0xff] & 0x000000ff) ^ \ rk[3]; beecrypt-4.2.1/include/beecrypt/mpnumber.h0000664000175000001440000000451410254472206015516 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mpnumber.h * \brief Multi-precision numbers, headers. * \author Bob Deblier * \ingroup MP_m */ #ifndef _MPNUMBER_H #define _MPNUMBER_H #include "beecrypt/mp.h" #ifdef __cplusplus # include #endif #ifdef __cplusplus struct BEECRYPTAPI mpnumber #else struct _mpnumber #endif { size_t size; mpw* data; #ifdef __cplusplus static const mpnumber ZERO; static const mpnumber ONE; mpnumber(); mpnumber(unsigned int); mpnumber(size_t, const mpw*); mpnumber(const mpnumber&); ~mpnumber(); const mpnumber& operator=(const mpnumber&); void wipe(); size_t bitlength() const; #endif }; #ifndef __cplusplus typedef struct _mpnumber mpnumber; #else BEECRYPTAPI std::ostream& operator<<(std::ostream&, const mpnumber&); #endif #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI void mpnzero(mpnumber*); BEECRYPTAPI void mpnsize(mpnumber*, size_t); BEECRYPTAPI void mpninit(mpnumber*, size_t, const mpw*); BEECRYPTAPI void mpnfree(mpnumber*); BEECRYPTAPI void mpncopy(mpnumber*, const mpnumber*); BEECRYPTAPI void mpnwipe(mpnumber*); BEECRYPTAPI void mpnset (mpnumber*, size_t, const mpw*); BEECRYPTAPI void mpnsetw (mpnumber*, mpw); BEECRYPTAPI int mpnsetbin(mpnumber*, const byte*, size_t); BEECRYPTAPI int mpnsethex(mpnumber*, const char*); BEECRYPTAPI int mpninv(mpnumber*, const mpnumber*, const mpnumber*); /*!\brief Truncate the mpnumber to the specified number of (least significant) bits. */ BEECRYPTAPI size_t mpntrbits(mpnumber*, size_t); BEECRYPTAPI size_t mpnbits(const mpnumber*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/hmacsha256.h0000644000175000001440000000305311216147022015517 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha256.h * \brief HMAC-SHA-256 message authentication code, headers. * \author Bob Deblier * \ingroup HMAC_m HMAC_sha256_m */ #ifndef _HMACSHA256_H #define _HMACSHA256_H #include "beecrypt/hmac.h" #include "beecrypt/sha256.h" /*!\ingroup HMAC_sha256_m */ typedef struct { sha256Param sparam; byte kxi[64]; byte kxo[64]; } hmacsha256Param; #ifdef __cplusplus extern "C" { #endif extern BEECRYPTAPI const keyedHashFunction hmacsha256; BEECRYPTAPI int hmacsha256Setup (hmacsha256Param*, const byte*, size_t); BEECRYPTAPI int hmacsha256Reset (hmacsha256Param*); BEECRYPTAPI int hmacsha256Update(hmacsha256Param*, const byte*, size_t); BEECRYPTAPI int hmacsha256Digest(hmacsha256Param*, byte*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/aes.h0000664000175000001440000000762010261221252014431 00000000000000/* * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file aes.h * \brief AES block cipher, as specified by NIST FIPS 197. * \author Bob Deblier * \ingroup BC_m BC_aes_m */ #ifndef _AES_H #define _AES_H #include "beecrypt/beecrypt.h" #include "beecrypt/aesopt.h" /*!\brief Holds all the parameters necessary for the AES cipher. * \ingroup BC_aes_m */ #ifdef __cplusplus struct BEECRYPTAPI aesParam #else struct _aesParam #endif { /*!\var k * \brief Holds the key expansion. */ uint32_t k[64]; /*!\var nr * \brief Number of rounds to be used in encryption/decryption. */ uint32_t nr; /*!\var fdback * \brief Buffer to be used by block chaining or feedback modes. */ uint32_t fdback[4]; }; #ifndef __cplusplus typedef struct _aesParam aesParam; #endif #ifdef __cplusplus extern "C" { #endif /*!\var aes * \brief Holds the full API description of the AES algorithm. */ extern const BEECRYPTAPI blockCipher aes; /*!\fn int aesSetup(aesParam* ap, const byte* key, size_t keybits, cipherOperation op) * \brief This function performs the cipher's key expansion. * \param ap The cipher's parameter block. * \param key The key value. * \param keybits The number of bits in the key; legal values are: * 128, 192 and 256. * \param op ENCRYPT or DECRYPT. * \retval 0 on success. * \retval -1 on failure. */ BEECRYPTAPI int aesSetup (aesParam* ap, const byte* key, size_t keybits, cipherOperation op); /*!\fn int aesSetIV(aesParam* ap, const byte* iv) * \brief This function sets the Initialization Vector. * \note This function is only useful in block chaining or feedback modes. * \param ap The cipher's parameter block. * \param iv The initialization vector; may be null. * \retval 0 on success. */ BEECRYPTAPI int aesSetIV (aesParam* ap, const byte* iv); /*!\fn int aesSetCTR(aesParam* ap, const byte* nivz, size_t counter) * \brief This function sets the CTR mode counter. * \note This function is only useful in CTR modes. * \param ap The cipher's parameter block. * \param nivz The concatenation of Nonce, IV, and padding Zeroes. * \param counter The counter. * \retval 0 on success. */ BEECRYPTAPI int aesSetCTR (aesParam* ap, const byte* nivz, size_t counter); /*!\fn aesEncrypt(aesParam* ap, uint32_t* dst, const uint32_t* src) * \brief This function performs the raw AES encryption; it encrypts one block * of 128 bits. * \param ap The cipher's parameter block. * \param dst The ciphertext; should be aligned on 32-bit boundary. * \param src The cleartext; should be aligned on 32-bit boundary. * \retval 0 on success. */ BEECRYPTAPI int aesEncrypt (aesParam* ap, uint32_t* dst, const uint32_t* src); /*!\fn aesDecrypt(aesParam* ap, uint32_t* dst, const uint32_t* src) * \brief This function performs the raw AES decryption; it decrypts one block * of 128 bits. * \param ap The cipher's parameter block. * \param dst The cleartext; should be aligned on 32-bit boundary. * \param src The ciphertext; should be aligned on 32-bit boundary. * \retval 0 on success. */ BEECRYPTAPI int aesDecrypt (aesParam* ap, uint32_t* dst, const uint32_t* src); BEECRYPTAPI uint32_t* aesFeedback(aesParam* ap); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/mp.h0000664000175000001440000006310710261220332014275 00000000000000/* * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mp.h * \brief Multi-precision integer routines. * * The routines declared here are all low-level operations, most of them * suitable to be implemented in assembler. Prime candidates are in order * of importance (according to gprof): *
    *
  • mpaddmul *
  • mpsetmul *
  • mpaddsqrtrc *
  • mpsub *
  • mpadd *
* * With some smart use of available assembler instructions, it's possible * to speed these routines up by a factor of 2 to 4. * * \author Bob Deblier * \ingroup MP_m */ #ifndef _MP_H #define _MP_H #include "beecrypt/api.h" #include "beecrypt/mpopt.h" #define MP_HWBITS (MP_WBITS >> 1) #define MP_WBYTES (MP_WBITS >> 3) #define MP_WNIBBLES (MP_WBITS >> 2) #if (MP_WBITS == 64) # define MP_WORDS_TO_BITS(x) ((x) << 6) # define MP_WORDS_TO_NIBBLES(x) ((x) << 4) # define MP_WORDS_TO_BYTES(x) ((x) << 3) # define MP_BITS_TO_WORDS(x) ((x) >> 6) # define MP_NIBBLES_TO_WORDS(x) ((x) >> 4) # define MP_BYTES_TO_WORDS(x) ((x) >> 3) #elif (MP_WBITS == 32) # define MP_WORDS_TO_BITS(x) ((x) << 5) # define MP_WORDS_TO_NIBBLES(x) ((x) << 3) # define MP_WORDS_TO_BYTES(x) ((x) << 2) # define MP_BITS_TO_WORDS(x) ((x) >> 5) # define MP_NIBBLES_TO_WORDS(x) ((x) >> 3) # define MP_BYTES_TO_WORDS(x) ((x) >> 2) #else # error #endif #define MP_MSBMASK (((mpw) 0x1) << (MP_WBITS-1)) #define MP_LSBMASK ((mpw) 0x1) #define MP_ALLMASK ~((mpw) 0x0) #ifdef __cplusplus extern "C" { #endif #ifndef ASM_MPCOPY # define mpcopy(size, dst, src) memcpy(dst, src, MP_WORDS_TO_BYTES(size)) #else BEECRYPTAPI void mpcopy(size_t size, mpw* dest, const mpw* src); #endif #ifndef ASM_MPMOVE # define mpmove(size, dst, src) memmove(dst, src, MP_WORDS_TO_BYTES(size)) #else BEECRYPTAPI void mpmove(size_t size, mpw* dest, const mpw* src); #endif /*!\fn void mpzero(size_t size, mpw* data) * \brief This function zeroes a multi-precision integer of a given size. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. */ BEECRYPTAPI void mpzero(size_t size, mpw* data); /*!\fn void mpfill(size_t size, mpw* data, mpw fill) * \brief This function fills each word of a multi-precision integer with a * given value. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \param fill The value fill the data with. */ BEECRYPTAPI void mpfill(size_t size, mpw* data, mpw fill); /*!\fn int mpodd(size_t size, const mpw* data) * \brief This functions tests if a multi-precision integer is odd. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \retval 1 if odd * \retval 0 if even */ BEECRYPTAPI int mpodd (size_t size, const mpw* data); /*!\fn int mpeven(size_t size, const mpw* data) * \brief This function tests if a multi-precision integer is even. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \retval 1 if even * \retval 0 if odd */ BEECRYPTAPI int mpeven(size_t size, const mpw* data); /*!\fn int mpz(size_t size, const mpw* data) * \brief This function tests if a multi-precision integer is zero. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \retval 1 if zero * \retval 0 if not zero */ BEECRYPTAPI int mpz (size_t size, const mpw* data); /*!\fn int mpnz(size_t size, const mpw* data) * \brief This function tests if a multi-precision integer is not zero. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \retval 1 if not zero * \retval 0 if zero */ BEECRYPTAPI int mpnz (size_t size, const mpw* data); /*!\fn int mpeq(size_t size, const mpw* xdata, const mpw* ydata) * \brief This function tests if two multi-precision integers of the same size * are equal. * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if equal * \retval 0 if not equal */ BEECRYPTAPI int mpeq (size_t size, const mpw* xdata, const mpw* ydata); /*!\fn int mpne(size_t size, const mpw* xdata, const mpw* ydata) * \brief This function tests if two multi-precision integers of the same size * differ. * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if not equal * \retval 0 if equal */ BEECRYPTAPI int mpne (size_t size, const mpw* xdata, const mpw* ydata); /*!\fn int mpgt(size_t size, const mpw* xdata, const mpw* ydata) * \brief This function tests if the first of two multi-precision integers * of the same size is greater than the second. * \note The comparison treats the arguments as unsigned. * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if greater * \retval 0 if less or equal */ BEECRYPTAPI int mpgt (size_t size, const mpw* xdata, const mpw* ydata); /*!\fn int mplt(size_t size, const mpw* xdata, const mpw* ydata) * \brief This function tests if the first of two multi-precision integers * of the same size is less than the second. * \note The comparison treats the arguments as unsigned. * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if less * \retval 0 if greater or equal */ BEECRYPTAPI int mplt (size_t size, const mpw* xdata, const mpw* ydata); /*!\fn int mpge(size_t size, const mpw* xdata, const mpw* ydata) * \brief This function tests if the first of two multi-precision integers * of the same size is greater than or equal to the second. * \note The comparison treats the arguments as unsigned. * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if greater or equal * \retval 0 if less */ BEECRYPTAPI int mpge (size_t size, const mpw* xdata, const mpw* ydata); /*!\fn int mple(size_t size, const mpw* xdata, const mpw* ydata) * \brief This function tests if the first of two multi-precision integers * of the same size is less than or equal to the second. * \note The comparison treats the arguments as unsigned. * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if less or equal * \retval 0 if greater */ BEECRYPTAPI int mple (size_t size, const mpw* xdata, const mpw* ydata); /*!\fn int mpcmp(size_t size, const mpw* xdata, const mpw* ydata) * \brief This function performs a comparison of two multi-precision * integers of the same size. * \note The comparison treats the arguments as unsigned. * \retval -1 if x < y * \retval 0 if x == y * \retval 1 if x > y */ BEECRYPTAPI int mpcmp(size_t size, const mpw* xdata, const mpw* ydata); /*!\fn int mpeqx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function tests if two multi-precision integers of different * size are equal. * \param xsize The size of the first multi-precision integer. * \param xdata The first multi-precision integer. * \param ysize The size of the first multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if equal * \retval 0 if not equal */ BEECRYPTAPI int mpeqx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn int mpnex(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function tests if two multi-precision integers of different * size are equal. * \param xsize The size of the first multi-precision integer. * \param xdata The first multi-precision integer. * \param ysize The size of the first multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if equal * \retval 0 if not equal */ BEECRYPTAPI int mpnex(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn int mpgtx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function tests if the first of two multi-precision integers * of different size is greater than the second. * \note The comparison treats the arguments as unsigned. * \param xsize The size of the first multi-precision integer. * \param xdata The first multi-precision integer. * \param ysize The size of the second multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if greater * \retval 0 if less or equal */ BEECRYPTAPI int mpgtx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn int mpltx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function tests if the first of two multi-precision integers * of different size is less than the second. * \note The comparison treats the arguments as unsigned. * \param xsize The size of the first multi-precision integer. * \param xdata The first multi-precision integer. * \param ysize The size of the second multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if less * \retval 0 if greater or equal */ BEECRYPTAPI int mpltx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn int mpgex(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function tests if the first of two multi-precision integers * of different size is greater than or equal to the second. * \note The comparison treats the arguments as unsigned. * \param xsize The size of the first multi-precision integer. * \param xdata The first multi-precision integer. * \param ysize The size of the second multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if greater or equal * \retval 0 if less */ BEECRYPTAPI int mpgex(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn int mplex(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function tests if the first of two multi-precision integers * of different size is less than or equal to the second. * \note The comparison treats the arguments as unsigned. * \param xsize The size of the first multi-precision integer. * \param xdata The first multi-precision integer. * \param ysize The size of the second multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if less or equal * \retval 0 if greater */ BEECRYPTAPI int mplex(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn int mpcmpx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function performs a comparison of two multi-precision * integers of the different size. * \note The comparison treats the arguments as unsigned. * \retval -1 if x < y * \retval 0 if x == y * \retval 1 if x > y */ BEECRYPTAPI int mpcmpx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn int mpisone(size_t size, const mpw* data) * \brief This functions tests if the value of a multi-precision integer is * equal to one. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \retval 1 if one * \retval 0 if not one */ BEECRYPTAPI int mpisone(size_t size, const mpw* data); /*!\fn int mpistwo(size_t size, const mpw* data) * \brief This function tests if the value of a multi-precision integer is * equal to two. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \retval 1 if two * \retval 0 if not two */ BEECRYPTAPI int mpistwo(size_t size, const mpw* data); /*!\fn int mpleone(size_t size, const mpw* data); * \brief This function tests if the value of a multi-precision integer is * less than or equal to one. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \retval 1 if less than or equal to one. * \retval 0 if greater than one. */ BEECRYPTAPI int mpleone(size_t size, const mpw* data); /*!\fn int mpeqmone(size_t size, const mpw* xdata, const mpw* ydata); * \brief This function tests if multi-precision integer x is equal to y * minus one. * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param ydata The second multi-precision integer. * \retval 1 if less than or equal to one. * \retval 0 if greater than one. */ BEECRYPTAPI int mpeqmone(size_t size, const mpw* xdata, const mpw* ydata); /*!\fn int mpmsbset(size_t size, const mpw* data) * \brief This function tests if the most significant bit of a multi-precision * integer is set. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \retval 1 if set * \retval 0 if not set */ BEECRYPTAPI int mpmsbset(size_t size, const mpw* data); /*!\fn int mplsbset(size_t size, const mpw* data) * \brief This function tests if the leiast significant bit of a multi-precision * integer is set. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. * \retval 1 if set * \retval 0 if not set */ BEECRYPTAPI int mplsbset(size_t size, const mpw* data); /*!\fn void mpsetmsb(size_t size, mpw* data) * \brief This function sets the most significant bit of a multi-precision * integer. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. */ BEECRYPTAPI void mpsetmsb(size_t size, mpw* data); /*!\fn void mpsetlsb(size_t size, mpw* data) * \brief This function sets the least significant bit of a multi-precision * integer. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. */ BEECRYPTAPI void mpsetlsb(size_t size, mpw* data); /*!\fn void mpclrmsb(size_t size, mpw* data) * \brief This function clears the most significant bit of a multi-precision * integer. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. */ BEECRYPTAPI void mpclrmsb(size_t size, mpw* data); /*!\fn void mpclrlsb(size_t size, mpw* data) * \brief This function clears the least significant bit of a multi-precision * integer. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. */ BEECRYPTAPI void mpclrlsb(size_t size, mpw* data); /*!\fn mpand(size_t size, mpw* xdata, const mpw* ydata) * \brief This function computes the bit-wise AND of two multi-precision * integers. Modifies xdata. * \param size The size of the multi-precision integers. * \param xdata The multi-precision integer data. * \param ydata The multi-precision integer data. */ BEECRYPTAPI void mpand(size_t size, mpw* xdata, const mpw* ydata); /*!\fn void mpor(size_t size, mpw* xdata, const mpw* ydata) * \brief This function computes the bit-wise OR of two multi-precision * integers. Modifies xdata. * \param size The size of the multi-precision integer. * \param xdata The multi-precision integer data. * \param ydata The multi-precision integer data. */ BEECRYPTAPI void mpor(size_t size, mpw* xdata, const mpw* ydata); /*!\fn void mpxor(size_t size, mpw* xdata, const mpw* ydata) * \brief This function computes the bit-wise XOR of two multi-precision * integers. Modifies xdata. * \param size The size of the multi-precision integer. * \param xdata The multi-precision integer data. * \param ydata The multi-precision integer data. */ BEECRYPTAPI void mpxor(size_t size, mpw* xdata, const mpw* ydata); /*!\fn mpnot(size_t size, mpw* data) * \brief This function flips all bits of a multi-precision integer. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. */ BEECRYPTAPI void mpnot(size_t size, mpw* data); /*!\fn void mpsetw(size_t size, mpw* xdata, mpw y) * \brief This function sets the value of a multi-precision integer to the * given word. The given value is copied into the least significant word, * while the most significant words are zeroed. * \param size The size of the multi-precision integer. * \param xdata The multi-precision integer data. * \param y The value to be assigned. */ BEECRYPTAPI void mpsetw(size_t size, mpw* xdata, mpw y); /*!\fn void mpsetws(size_t size, mpw* xdata, size_t y) * \brief This function sets the value of a multi-precision integer to the * given word. The given value is copied into the least significant word(s), * while the most significant words are zeroed. * \param size The size of the multi-precision integer. * \param xdata The multi-precision integer data. * \param y The value. */ BEECRYPTAPI void mpsetws(size_t size, mpw* xdata, size_t y); /*!\fn void mpsetx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function set the value of the first multi-precision integer * to the second, truncating the most significant words if ysize > xsize, or * zeroing the most significant words if ysize < xsize. * \param xsize The size of the first multi-precision integer. * \param xdata The first multi-precision integer. * \param ysize The size of the second multi-precision integer. * \param ydata The second multi-precision integer. */ BEECRYPTAPI void mpsetx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn int mpaddw(size_t size, mpw* xdata, mpw y) * \brief This function adds one word to a multi-precision integer. * The performed operation is in pseudocode: x += y. * \param size The size of the multi-precision integer. * \param xdata The first multi-precision integer. * \param y The multi-precision word. * \return The carry-over value of the operation; this value is either 0 or 1. */ BEECRYPTAPI int mpaddw(size_t size, mpw* xdata, mpw y); /*!\fn int mpadd(size_t size, mpw* xdata, const mpw* ydata) * \brief This function adds two multi-precision integers of equal size. * The performed operation is in pseudocode: x += y. * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param ydata The second multi-precision integer. * \return The carry-over value of the operation; this value is either 0 or 1. */ BEECRYPTAPI int mpadd (size_t size, mpw* xdata, const mpw* ydata); /*!\fn int mpaddx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function adds two multi-precision integers of different size. * The performed operation in pseudocode: x += y. * \param xsize The size of the first multi-precision integer. * \param xdata The first multi-precision integer. * \param ysize The size of the second multi-precision integer. * \param ydata The second multi-precision integer. * \return The carry-over value of the operation; this value is either 0 or 1. */ BEECRYPTAPI int mpaddx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn int mpsubw(size_t size, mpw* xdata, mpw y) * \brief This function subtracts one word to a multi-precision integer. * The performed operation in pseudocode: x -= y * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param y The multi-precision word. * \return The carry-over value of the operation; this value is either 0 or 1. */ BEECRYPTAPI int mpsubw(size_t size, mpw* xdata, mpw y); /*!\fn int mpsub(size_t size, mpw* xdata, const mpw* ydata) * \brief This function subtracts two multi-precision integers of equal size. * The performed operation in pseudocode: x -= y * \param size The size of the multi-precision integers. * \param xdata The first multi-precision integer. * \param ydata The second multi-precision integer. * \return The carry-over value of the operation; this value is either 0 or 1. */ BEECRYPTAPI int mpsub (size_t size, mpw* xdata, const mpw* ydata); /*!\fn int mpsubx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function subtracts two multi-precision integers of different * size. The performed operation in pseudocode: x -= y. * \param xsize The size of the first multi-precision integer. * \param xdata The first multi-precision integer. * \param ysize The size of the second multi-precision integer. * \param ydata The second multi-precision integer. * \return The carry-over value of the operation; this value is either 0 or 1. */ BEECRYPTAPI int mpsubx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata); BEECRYPTAPI int mpmultwo(size_t size, mpw* data); /*!\fn void mpneg(size_t size, mpw* data) * \brief This function negates a multi-precision integer. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. */ BEECRYPTAPI void mpneg(size_t size, mpw* data); /*!\fn size_t mpsize(size_t size, const mpw* data) * \brief This function returns the true size of a multi-precision * integer, after stripping leading zero words. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. */ BEECRYPTAPI size_t mpsize(size_t size, const mpw* data); /*!\fn size_t mpbits(size_t size, const mpw* data) * \brief This function returns the number of significant bits * in a multi-precision integer. * \param size The size of the multi-precision integer. * \param data The multi-precision integer data. */ BEECRYPTAPI size_t mpbits(size_t size, const mpw* data); BEECRYPTAPI size_t mpmszcnt(size_t size, const mpw* data); BEECRYPTAPI size_t mplszcnt(size_t size, const mpw* data); BEECRYPTAPI void mplshift(size_t size, mpw* data, size_t count); BEECRYPTAPI void mprshift(size_t size, mpw* data, size_t count); BEECRYPTAPI size_t mprshiftlsz(size_t size, mpw* data); BEECRYPTAPI size_t mpnorm(size_t size, mpw* data); BEECRYPTAPI void mpdivtwo (size_t size, mpw* data); BEECRYPTAPI void mpsdivtwo(size_t size, mpw* data); /*!\fn mpw mpsetmul(size_t size, mpw* result, const mpw* data, mpw y) * \brief This function performs a multi-precision multiply-setup. * * This function is used in the computation of a full multi-precision * multiplication. By using it we can shave off a few cycles; otherwise we'd * have to zero the least significant half of the result first and use * another call to the slightly slower mpaddmul function. * * \param size The size of multi-precision integer multiplier. * \param result The place where result will be accumulated. * \param data The multi-precision integer multiplier. * \param y The multiplicand. * \return The carry-over multi-precision word. */ BEECRYPTAPI mpw mpsetmul (size_t size, mpw* result, const mpw* data, mpw y); /*!\fn mpw mpaddmul(size_t size, mpw* result, const mpw* data, mpw y) * \brief This function performs a mult-precision multiply-accumulate. * * This function is used in the computation of a full multi-precision * multiplication. It computes the product-by-one-word and accumulates it with * the previous result. * * \param size The size of multi-precision integer multiplier. * \param result The place where result will be accumulated. * \param data The multi-precision integer multiplier. * \param y The multiplicand. * \retval The carry-over multi-precision word. */ BEECRYPTAPI mpw mpaddmul (size_t size, mpw* result, const mpw* data, mpw y); /*!\fn void mpaddsqrtrc(size_t size, mpw* result, const mpw* data) * \brief This function is used in the calculation of a multi-precision * squaring. */ BEECRYPTAPI void mpaddsqrtrc(size_t size, mpw* result, const mpw* data); /*!\fn void mpmul(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) * \brief This function computes a full multi-precision product. */ BEECRYPTAPI void mpmul(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata); /*!\fn void mpsqr(mpw* result, size_t size, const mpw* data) * \brief This function computes a full multi-precision square. */ BEECRYPTAPI void mpsqr(mpw* result, size_t size, const mpw* data); BEECRYPTAPI void mpgcd_w(size_t size, const mpw* xdata, const mpw* ydata, mpw* result, mpw* wksp); BEECRYPTAPI int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ydata, mpw* result, mpw* wksp); BEECRYPTAPI mpw mppndiv(mpw xhi, mpw xlo, mpw y); BEECRYPTAPI void mpmod (mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const mpw*ydata, mpw* wksp); BEECRYPTAPI void mpndivmod(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, mpw* wksp); /* * Output Routines */ BEECRYPTAPI void mpprint(size_t size, const mpw* data); BEECRYPTAPI void mpprintln(size_t size, const mpw* data); BEECRYPTAPI void mpfprint(FILE* f, size_t size, const mpw* data); BEECRYPTAPI void mpfprintln(FILE* f, size_t size, const mpw* data); /* * Conversion Routines */ BEECRYPTAPI int i2osp(byte* osdata, size_t ossize, const mpw* idata, size_t isize); BEECRYPTAPI int os2ip(mpw* idata, size_t isize, const byte* osdata, size_t ossize); BEECRYPTAPI int hs2ip(mpw* idata, size_t isize, const char* hsdata, size_t hssize); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/entropy.h0000644000175000001440000000335211216147022015360 00000000000000/* * Copyright (c) 1998, 1999, 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file entropy.h * \brief Entropy sources, headers. * \author Bob Deblier * \ingroup ES_m ES_audio_m ES_dsp_m ES_random_m ES_urandom_m ES_tty_m */ #ifndef _ENTROPY_H #define _ENTROPY_H #include "beecrypt/beecrypt.h" #if WIN32 #include #endif #ifdef __cplusplus extern "C" { #endif #if WIN32 BEECRYPTAPI int entropy_provider_setup(HINSTANCE); BEECRYPTAPI int entropy_provider_cleanup(); BEECRYPTAPI int entropy_wavein(byte*, size_t); BEECRYPTAPI int entropy_console(byte*, size_t); BEECRYPTAPI int entropy_wincrypt(byte*, size_t); #else #if HAVE_DEV_AUDIO int entropy_dev_audio (byte*, size_t); #endif #if HAVE_DEV_DSP int entropy_dev_dsp (byte*, size_t); #endif #if HAVE_DEV_RANDOM int entropy_dev_random (byte*, size_t); #endif #if HAVE_DEV_URANDOM int entropy_dev_urandom(byte*, size_t); #endif #if HAVE_DEV_TTY int entropy_dev_tty (byte*, size_t); #endif #endif #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/mtprng.h0000644000175000001440000000347611216147022015176 00000000000000/* * Copyright (c) 1998, 1999, 2000, 2003 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mtprng.h * \brief Mersenne Twister pseudo-random number generator, headers. * \author Bob Deblier * \ingroup PRNG_m */ #ifndef _MTPRNG_H #define _MTPRNG_H #include "beecrypt/beecrypt.h" #ifdef _REENTRANT # if WIN32 # include # include # endif #endif #define N 624 #define M 397 #define K 0x9908B0DFU /* */ #ifdef __cplusplus struct BEECRYPTAPI mtprngParam #else struct _mtprngParam #endif { #ifdef _REENTRANT bc_mutex_t lock; #endif uint32_t state[N+1]; uint32_t left; uint32_t* nextw; }; #ifndef __cplusplus typedef struct _mtprngParam mtprngParam; #endif #ifdef __cplusplus extern "C" { #endif /* */ extern BEECRYPTAPI const randomGenerator mtprng; /* */ BEECRYPTAPI int mtprngSetup (mtprngParam* mp); /* */ BEECRYPTAPI int mtprngSeed (mtprngParam* mp, const byte* data, size_t size); /* */ BEECRYPTAPI int mtprngNext (mtprngParam* mp, byte* data, size_t size); /* */ BEECRYPTAPI int mtprngCleanup(mtprngParam* mp); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/endianness.h0000644000175000001440000000574711216147022016021 00000000000000/* * Copyright (c) 1998, 1999, 2000, 2001, 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _ENDIANNESS_H #define _ENDIANNESS_H #include "beecrypt/beecrypt.h" #if defined(__cplusplus) || HAVE_INLINE static inline int16_t _swap16(int16_t n) { return ( ((n & 0xff) << 8) | ((n & 0xff00) >> 8) ); } # define swap16(n) _swap16(n) static inline uint16_t _swapu16(uint16_t n) { return ( ((n & 0xffU) << 8) | ((n & 0xff00U) >> 8) ); } # define swapu16(n) _swap16(n) # ifdef __arch__swab32 # define swap32(n) __arch__swab32(n) # define swapu32(n) __arch__swab32(n) # else static inline int32_t _swap32(int32_t n) { return ( ((n & 0xff) << 24) | ((n & 0xff00) << 8) | ((n & 0xff0000) >> 8) | ((n & 0xff000000) >> 24) ); } # define swap32(n) _swap32(n) static inline uint32_t _swapu32(uint32_t n) { return ( ((n & 0xffU) << 24) | ((n & 0xff00U) << 8) | ((n & 0xff0000U) >> 8) | ((n & 0xff000000U) >> 24) ); } # define swapu32(n) _swapu32(n) # endif # ifdef __arch__swab64 # define swap64(n) __arch__swab64(n) # define swapu64(n) __arch__swab64(n) # else static inline int64_t _swap64(int64_t n) { return ( ((n & ((int64_t) 0xff) ) << 56) | ((n & ((int64_t) 0xff) << 8) << 40) | ((n & ((int64_t) 0xff) << 16) << 24) | ((n & ((int64_t) 0xff) << 24) << 8) | ((n & ((int64_t) 0xff) << 32) >> 8) | ((n & ((int64_t) 0xff) << 40) >> 24) | ((n & ((int64_t) 0xff) << 48) >> 40) | ((n & ((int64_t) 0xff) << 56) >> 56) ); } # define swap64(n) _swap64(n) static inline uint64_t _swapu64(uint64_t n) { return ( ((n & ((uint64_t) 0xff) ) << 56) | ((n & ((uint64_t) 0xff) << 8) << 40) | ((n & ((uint64_t) 0xff) << 16) << 24) | ((n & ((uint64_t) 0xff) << 24) << 8) | ((n & ((uint64_t) 0xff) << 32) >> 8) | ((n & ((uint64_t) 0xff) << 40) >> 24) | ((n & ((uint64_t) 0xff) << 48) >> 40) | ((n & ((uint64_t) 0xff) << 56) >> 56) ); } # define swapu64(n) _swapu64(n) # endif #else BEECRYPTAPI int16_t swap16 (int16_t); BEECRYPTAPI uint16_t swapu16(uint16_t); BEECRYPTAPI int32_t swap32 (int32_t); BEECRYPTAPI uint32_t swapu32(uint32_t); BEECRYPTAPI int64_t swap64 (int64_t); BEECRYPTAPI uint64_t swapu64(uint64_t); #endif #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/rsapk.h0000644000175000001440000000261511216147022015001 00000000000000/* * Copyright (c) 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file rsapk.h * \brief RSA public key, headers. * \author Bob Deblier * \ingroup IF_m IF_rsa_m */ #ifndef _RSAPK_H #define _RSAPK_H #include "beecrypt/mpbarrett.h" #ifdef __cplusplus struct BEECRYPTAPI rsapk #else struct _rsapk #endif { mpbarrett n; mpnumber e; #ifdef __cplusplus rsapk(); rsapk(const rsapk&); ~rsapk(); #endif }; #ifndef __cplusplus typedef struct _rsapk rsapk; #endif #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int rsapkInit(rsapk*); BEECRYPTAPI int rsapkFree(rsapk*); BEECRYPTAPI int rsapkCopy(rsapk*, const rsapk*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/hmacsha1.h0000644000175000001440000000301511216147022015341 00000000000000/* * Copyright (c) 1999, 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha1.h * \brief HMAC-SHA-1 message authentication code, headers. * \author Bob Deblier * \ingroup HMAC_m HMAC_sha1_m */ #ifndef _HMACSHA1_H #define _HMACSHA1_H #include "beecrypt/hmac.h" #include "beecrypt/sha1.h" /*!\ingroup HMAC_sha1_m */ typedef struct { sha1Param sparam; byte kxi[64]; byte kxo[64]; } hmacsha1Param; #ifdef __cplusplus extern "C" { #endif extern BEECRYPTAPI const keyedHashFunction hmacsha1; BEECRYPTAPI int hmacsha1Setup (hmacsha1Param*, const byte*, size_t); BEECRYPTAPI int hmacsha1Reset (hmacsha1Param*); BEECRYPTAPI int hmacsha1Update(hmacsha1Param*, const byte*, size_t); BEECRYPTAPI int hmacsha1Digest(hmacsha1Param*, byte*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/sha224.h0000644000175000001440000000610411223566203014665 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha224.h * \brief SHA-224 hash function, headers. * \author Bob Deblier * \ingroup HASH_m HASH_sha224_m */ #ifndef _SHA224_H #define _SHA224_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the SHA-224 algorithm. * \ingroup HASH_sha224_m */ #ifdef __cplusplus struct BEECRYPTAPI sha224Param #else struct _sha224Param #endif { /*!\var h */ uint32_t h[8]; /*!\var data */ uint32_t data[64]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[1]; #elif (MP_WBITS == 32) mpw length[2]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint32_t offset; }; #ifndef __cplusplus typedef struct _sha224Param sha224Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var sha224 * \brief Holds the full API description of the SHA-224 algorithm. */ extern BEECRYPTAPI const hashFunction sha224; /*!\fn void sha224Process(sha224Param* sp) * \brief This function performs the core of the SHA-224 hash algorithm; it * processes a block of 64 bytes. * \param sp The hash function's parameter block. */ BEECRYPTAPI void sha224Process(sha224Param* sp); /*!\fn int sha224Reset(sha224Param* sp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param sp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int sha224Reset (sha224Param* sp); /*!\fn int sha224Update(sha224Param* sp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param sp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int sha224Update (sha224Param* sp, const byte* data, size_t size); /*!\fn int sha224Digest(sha224Param* sp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param sp The hash function's parameter block. * \param digest The place to store the 32-byte digest. * \retval 0 on success. */ BEECRYPTAPI int sha224Digest (sha224Param* sp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/hmacsha384.h0000644000175000001440000000304111216147022015516 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha384.h * \brief HMAC-SHA-384 message authentication code, headers. * \author Bob Deblier * \ingroup HMAC_m HMAC_sha384_m */ #ifndef _HMACSHA384_H #define _HMACSHA384_H #include "beecrypt/hmac.h" #include "beecrypt/sha384.h" /*!\ingroup HMAC_sha384_m */ typedef struct { sha384Param sparam; byte kxi[128]; byte kxo[128]; } hmacsha384Param; #ifdef __cplusplus extern "C" { #endif extern BEECRYPTAPI const keyedHashFunction hmacsha384; BEECRYPTAPI int hmacsha384Setup (hmacsha384Param*, const byte*, size_t); BEECRYPTAPI int hmacsha384Reset (hmacsha384Param*); BEECRYPTAPI int hmacsha384Update(hmacsha384Param*, const byte*, size_t); BEECRYPTAPI int hmacsha384Digest(hmacsha384Param*, byte*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/blockpad.h0000644000175000001440000000244311216147022015437 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file blockpad.h * \brief Blockcipher padding algorithms. * \author Bob Deblier * \ingroup BC_m */ #ifndef _BLOCKPAD_H #define _BLOCKPAD_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI memchunk* pkcs5Pad (size_t, memchunk*); BEECRYPTAPI memchunk* pkcs5Unpad(size_t, memchunk*); BEECRYPTAPI memchunk* pkcs5PadCopy (size_t, const memchunk*); BEECRYPTAPI memchunk* pkcs5UnpadCopy(size_t, const memchunk*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/dhies.h0000644000175000001440000000526111216147022014755 00000000000000/* * Copyright (c) 2000, 2001, 2002, 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dhies.h * \brief DHIES (formerly known as DHAES or DHES) encryption scheme. * * This code implements the encryption scheme from the paper: * * "DHIES: An Encryption Scheme Based on the Diffie-Hellman Problem" * Michel Abdalla, Mihir Bellare, Phillip Rogaway * September 18, 2001 * * \author Bob Deblier * \ingroup DL_m DL_dh_m */ #ifndef _DHIES_H #define _DHIES_H #include "beecrypt/beecrypt.h" #include "beecrypt/dldp.h" #ifdef __cplusplus struct BEECRYPTAPI dhies_pParameters #else struct _dhies_pParameters #endif { const dldp_p* param; const hashFunction* hash; const blockCipher* cipher; const keyedHashFunction* mac; size_t cipherkeybits; size_t mackeybits; }; #ifndef __cplusplus typedef struct _dhies_pParameters dhies_pParameters; #endif #ifdef __cplusplus struct BEECRYPTAPI dhies_pContext #else struct _dhies_pContext #endif { dldp_p param; mpnumber pub; mpnumber pri; hashFunctionContext hash; blockCipherContext cipher; keyedHashFunctionContext mac; size_t cipherkeybits; size_t mackeybits; }; #ifndef __cplusplus typedef struct _dhies_pContext dhies_pContext; #endif #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int dhies_pUsable(const dhies_pParameters*); BEECRYPTAPI int dhies_pContextInit (dhies_pContext*, const dhies_pParameters*); BEECRYPTAPI int dhies_pContextInitDecrypt(dhies_pContext*, const dhies_pParameters*, const mpnumber*); BEECRYPTAPI int dhies_pContextInitEncrypt(dhies_pContext*, const dhies_pParameters*, const mpnumber*); BEECRYPTAPI int dhies_pContextFree (dhies_pContext*); BEECRYPTAPI memchunk* dhies_pContextEncrypt(dhies_pContext*, mpnumber*, mpnumber*, const memchunk*, randomGeneratorContext*); BEECRYPTAPI memchunk* dhies_pContextDecrypt(dhies_pContext*, const mpnumber*, const mpnumber*, const memchunk*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/Doxyheader0000644000175000001440000001500611223566203015531 00000000000000/*!\mainpage BeeCrypt API Documentation * * \section intro_sec Introduction * * BeeCrypt started its life when the need for a portable and fast cryptography * library arose at Virtual Unlimited in 1997. I'm still trying to make it * faster, easier to use and more portable, in addition to providing better * documentation. * * \section license_sec License * * BeeCrypt is released under the following license: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Legal disclaimer: note that depending on where you are, the use of * cryptography may be limited or forbidden by law. Before using this library, * make sure you are legally entitled to do so. * * \section features_sec Features * * Included in the library are: *
    *
  • entropy sources for initializing pseudo-random generators *
  • pseudo-random generators *
      *
    • FIPS-186 *
    *
  • block ciphers *
      *
    • AES *
    • Blowfish *
    *
  • hash functions *
      *
    • MD5 *
    • RIPEMD-128 *
    • RIPEMD-160 *
    • RIPEMD-256 *
    • RIPEMD-320 *
    • SHA-1 *
    • SHA-224 *
    • SHA-256 *
    • SHA-384 *
    • SHA-512 *
    *
  • keyed hash functions (a.k.a. message authentication codes) *
      *
    • HMAC-MD5 *
    • HMAC-SHA-1 *
    • HMAC-SHA-224 *
    • HMAC-SHA-256 *
    • HMAC-SHA-384 *
    • HMAC-SHA-512 *
    *
  • multi-precision integer library, with assembler-optimized routines * for a range of processors; optimized to perform well on both 32-bit * and 64-bit machines; uses Barrett modular reduction instead of the * more common usual Montgomery algorithm; also implements sliding * windows *
  • probabilistic primality testing, with optimized small prime trial * division *
  • discrete logarithm parameter generation over a prime field *
  • Diffie-Hellman key agreement *
  • DHAES encryption scheme *
  • DSA signature scheme *
  • ElGamal signature scheme (two variants) *
  • RSA keypair generation with chinese remainder theorem variables *
  • RSA public & private key operations
  • OpenMP support *
* * \section testing_sec Testing * * The library has been tested on the following platforms: *
    *
  • Cygwin *
  • Darwin/MacOS X *
  • Linux glibc 2.x alpha *
  • Linux glibc 2.x arm *
  • Linux glibc 2.x ia64 *
  • Linux glibc 2.x m68k *
  • Linux glibc 2.x ppc *
  • Linux glibc 2.x s390 *
  • Linux glibc 2.x s390x *
  • Linux glibc 2.x sparc *
  • Linux glibc 2.x x86 *
  • Linux glibc 2.x x86_64/amd64 *
  • Solaris 2.[6789] sparc (with Forte or GNU compilers) *
  • Solaris 2.[78] x86 (with Forte or GNU compilers) *
  • Tru64 Unix alpha *
  • Win32 (Windows 95, 98, NT 4.0, 2000, XP) *
* * \section porting_sec Porting * * The library is currently in the process of being ported to: *
    *
  • MinGW *
  • AIX (shared libraries don't seem to work in 64-bit mode) *
* * The structures in the library are geared towards exchange with Java * and its security and cryptography classes. This library can also be * accessed from Java by installing BeeCrypt for Java, a JCE 1.2 crypto * provider and the counterpart of this library. * * \section future_sec The Future * *
    *
  • compliance with and compliance statements for IEEE P1363 *
  • switch from OSS to ALSA for entropy gathering *
  • experiments with CUDA (AES, MD6?) *
  • more blockciphers (Twofish, ... ) *
  • more hash functions (SHA-3 candidates, MD2, MD4, Tiger) *
  • more hash functions (MD2, MD4, Tiger, ...) *
  • Elliptic Curves (ECDSA, ... ) *
  • RSA signatures as specified by RFC-2440. *
* * Let us know which one you'd prefer to see added first. */ /*!\defgroup ES_m Entropy sources */ /*!\defgroup ES_audio_m Entropy sources: /dev/audio */ /*!\defgroup ES_dsp_m Entropy sources: /dev/dsp */ /*!\defgroup ES_random_m Entropy sources: /dev/random */ /*!\defgroup ES_urandom_m Entropy sources: /dev/urandom */ /*!\defgroup ES_tty_m Entropy sources: /dev/tty */ /*!\defgroup PRNG_m Pseudo-Random Number Generators */ /*!\defgroup PRNG_fips186_m Pseudo-Random Number Generators: FIPS-186 */ /*!\defgroup PRNG_mt_m Pseudo-Random Number Generators: Mersenne Twister */ /*!\defgroup HASH_m Hash Functions */ /*!\defgroup HASH_md5_m Hash Functions: MD5 */ /*!\defgroup HASH_rmd128_m Hash Functions: RIPEMD-128 */ /*!\defgroup HASH_rmd160_m Hash Functions: RIPEMD-160 */ /*!\defgroup HASH_rmd256_m Hash Functions: RIPEMD-256 */ /*!\defgroup HASH_rmd320_m Hash Functions: RIPEMD-320 */ /*!\defgroup HASH_sha1_m Hash Functions: SHA-1 */ /*!\defgroup HASH_sha224_m Hash Functions: SHA-224 */ /*!\defgroup HASH_sha256_m Hash Functions: SHA-256 */ /*!\defgroup HASH_sha384_m Hash Functions: SHA-384 */ /*!\defgroup HASH_sha512_m Hash Functions: SHA-512 */ /*!\defgroup HMAC_m Keyed Hash Functions, a.k.a. Message Authentication Codes */ /*!\defgroup HMAC_md5_m Keyed Hash Functions: HMAC-MD5 */ /*!\defgroup HMAC_sha1_m Keyed Hash Functions: HMAC-SHA-1 */ /*!\defgroup HMAC_sha256_m Keyed Hash Functions: HMAC-SHA-256 */ /*!\defgroup HMAC_sha384_m Keyed Hash Functions: HMAC-SHA-384 */ /*!\defgroup HMAC_sha512_m Keyed Hash Functions: HMAC-SHA-512 */ /*!\defgroup BC_m Block ciphers */ /*!\defgroup BC_aes_m Block ciphers: AES */ /*!\defgroup BC_blowfish_m Block ciphers: Blowfish */ /*!\defgroup MP_m Multiple Precision Integer Arithmetic */ /*!\defgroup DL_m Discrete Logarithm Primitives */ /*!\defgroup DL_dh_m Discrete Logarithm Primitives: Diffie-Hellman */ /*!\defgroup DL_dsa_m Discrete Logarithm Primitives: DSA */ /*!\defgroup DL_elgamal_m Discrete Logarithm Primitives: ElGamal */ /*!\defgroup IF_m Integer Factorization Primitives */ /*!\defgroup IF_rsa_m Integer Factorization Primitives: RSA */ /*!\defgroup PKCS1_m PKCS#1 */ /*!\defgroup PKCS12_m PKCS#12 */ beecrypt-4.2.1/include/beecrypt/Doxyfile.in0000644000175000001440000012536111223574571015642 00000000000000# Doxyfile 1.3.4 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = BeeCrypt # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = @top_srcdir@/docs # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, # Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en # (Japanese with English messages), Korean, Norwegian, Polish, Portuguese, # Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # This tag can be used to specify the encoding used in the generated output. # The encoding is not always determined by the language that is chosen, # but also whether or not the output is meant for Windows or non-Windows users. # In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES # forces the Windows encoding (this is the default for the Windows binary), # whereas setting the tag to NO uses a Unix-style encoding (the default for # all platforms other than Windows). USE_WINDOWS_ENCODING = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited # members of a class in the documentation of that class as if those members were # ordinary class members. Constructors, destructors and assignment operators of # the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. It is allowed to use relative paths in the argument list. STRIP_FROM_PATH = @top_srcdir@/ # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explict @brief command for a brief description. JAVADOC_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # reimplements. INHERIT_DOCS = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources # only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = YES # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. WARN_FORMAT = # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @top_srcdir@/include/beecrypt/Doxyheader \ @top_srcdir@/include/beecrypt # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc FILE_PATTERNS = *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories # that are symbolic links (a Unix filesystem feature) are excluded from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. EXCLUDE_PATTERNS = *config*.h # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = @top_srcdir@/docs # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. INPUT_FILTER = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output dir. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = dsfont # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimised for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assigments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_PREDEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. PREDEFINED = __cplusplus BEECRYPTAPI= MP_WBITS=@MP_WBITS@ # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse the # parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::addtions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or # super classes. Setting the tag to NO turns the diagrams off. Note that this # option is superceded by the HAVE_DOT option below. This is only a fallback. It is # recommended to install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similiar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found on the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes that # lay further from the root node will be omitted. Note that setting this option to # 1 or 2 may greatly reduce the computation time needed for large code bases. Also # note that a graph may be further truncated if the graph's image dimensions are # not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). # If 0 is used for the depth value (the default), the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::addtions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO beecrypt-4.2.1/include/beecrypt/elgamal.h0000644000175000001440000001153111216147022015260 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file elgamal.h * \brief ElGamal algorithm. * * For more information on this algorithm, see: * "Handbook of Applied Cryptography", * 11.5.2: "The ElGamal signature scheme", p. 454-459 * * Two of the signature variants in Note 11.70 are implemented. * * \todo Implement ElGamal encryption and decryption. * * \todo Explore the possibility of using simultaneous multiple exponentiation, * as described in HAC, 14.87 (iii). * * \author Bob Deblier * \ingroup DL_m DL_elgamal_m */ #ifndef _ELGAMAL_H #define _ELGAMAL_H #include "beecrypt/mpbarrett.h" #ifdef __cplusplus extern "C" { #endif /*!\fn int elgv1sign(const mpbarrett* p, const mpbarrett* n, const mpnumber* g, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnumber* r, mpnumber* s) * \brief This function performs raw ElGamal signing, variant 1. * * Signing equations: * * \li \f$r=g^{k}\ \textrm{mod}\ p\f$ * \li \f$s=k^{-1}(h(m)-xr)\ \textrm{mod}\ (p-1)\f$ * * \param p The prime. * \param n The reducer mod (p-1). * \param g The generator. * \param rgc The pseudo-random generat * \param hm The hash to be signed. * \param x The private key value. * \param r The signature's \e r value. * \param s The signature's \e s value. * \retval 0 on success. * \retval -1 on failure. */ BEECRYPTAPI int elgv1sign(const mpbarrett* p, const mpbarrett* n, const mpnumber* g, randomGeneratorContext*, const mpnumber* hm, const mpnumber* x, mpnumber* r, mpnumber* s); /*!\fn int elgv1vrfy(const mpbarrett* p, const mpbarrett* n, const mpnumber* g, const mpnumber* hm, const mpnumber* y, const mpnumber* r, const mpnumber* s) * \brief This function performs raw ElGamal verification, variant 1. * * Verifying equations: * * \li Check \f$0 * \ingroup HASH_m HASH_sha256_m */ #ifndef _SHA256_H #define _SHA256_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the SHA-256 algorithm. * \ingroup HASH_sha256_m */ #ifdef __cplusplus struct BEECRYPTAPI sha256Param #else struct _sha256Param #endif { /*!\var h */ uint32_t h[8]; /*!\var data */ uint32_t data[64]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[1]; #elif (MP_WBITS == 32) mpw length[2]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint32_t offset; }; #ifndef __cplusplus typedef struct _sha256Param sha256Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var sha256 * \brief Holds the full API description of the SHA-256 algorithm. */ extern BEECRYPTAPI const hashFunction sha256; /*!\fn void sha256Process(sha256Param* sp) * \brief This function performs the core of the SHA-256 hash algorithm; it * processes a block of 64 bytes. * \param sp The hash function's parameter block. */ BEECRYPTAPI void sha256Process(sha256Param* sp); /*!\fn int sha256Reset(sha256Param* sp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param sp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int sha256Reset (sha256Param* sp); /*!\fn int sha256Update(sha256Param* sp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param sp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int sha256Update (sha256Param* sp, const byte* data, size_t size); /*!\fn int sha256Digest(sha256Param* sp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param sp The hash function's parameter block. * \param digest The place to store the 32-byte digest. * \retval 0 on success. */ BEECRYPTAPI int sha256Digest (sha256Param* sp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/blockmode.h0000644000175000001440000000774111216147022015625 00000000000000/* * Copyright (c) 2000, 2002, 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file blockmode.h * \brief Blockcipher operation modes. * \todo Additional modes, such as CFB and OFB. * \author Bob Deblier * \ingroup BC_m */ #ifndef _BLOCKMODE_H #define _BLOCKMODE_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus extern "C" { #endif /*!\fn int blockEncryptECB(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) * \brief This function encrypts a number of data blocks in Electronic Code * Book mode. * \param bc The blockcipher. * \param bp The cipher's parameter block. * \param dst The ciphertext data; should be aligned on a 32-bit boundary. * \param src The cleartext data; should be aligned on a 32-bit boundary. * \param nblocks The number of blocks to be encrypted. * \retval 0 on success. */ BEECRYPTAPI int blockEncryptECB(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks); /*!\fn int blockDecryptECB(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) * \brief This function decrypts a number of data blocks in Electronic Code * Book mode. * \param bc The blockcipher. * \param bp The cipher's parameter block. * \param dst The cleartext data; should be aligned on a 32-bit boundary. * \param src The ciphertext data; should be aligned on a 32-bit boundary. * \param nblocks The number of blocks to be decrypted. * \retval 0 on success. */ BEECRYPTAPI int blockDecryptECB(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks); /*!\fn int blockEncryptCBC(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) * \brief This function encrypts a number of data blocks in Cipher Block * Chaining mode. * \param bc The blockcipher. * \param bp The cipher's parameter block. * \param dst The ciphertext data; should be aligned on a 32-bit boundary. * \param src The cleartext data; should be aligned on a 32-bit boundary. * \param nblocks The number of blocks to be encrypted. * \retval 0 on success. */ BEECRYPTAPI int blockEncryptCBC(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks); /*!\fn int blockDecryptCBC(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) * \brief This function decrypts a number of data blocks in Cipher Block * Chaining mode. * \param bc The blockcipher. * \param bp The cipher's parameter block. * \param dst The cleartext data; should be aligned on a 32-bit boundary. * \param src The ciphertext data; should be aligned on a 32-bit boundary. * \param nblocks The number of blocks to be decrypted. * \retval 0 on success. */ BEECRYPTAPI int blockDecryptCBC(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks); BEECRYPTAPI int blockEncryptCTR(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks); BEECRYPTAPI int blockDecryptCTR(const blockCipher* bc, blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/mpopt.h0000664000175000001440000001104210254472206015022 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mpopt.h * \brief Multi-precision integer optimization definitions. * \author Bob Deblier * \ingroup MP_m */ #ifndef _MPOPT_H #define _MPOPT_H #if WIN32 # if __MWERKS__ && __INTEL__ # elif defined(_MSC_VER) && defined(_M_IX86) # define ASM_MPZERO # define ASM_MPFILL # define ASM_MPEVEN # define ASM_MPODD # define ASM_MPADDW # define ASM_MPSUBW # define ASM_MPADD # define ASM_MPSUB # define ASM_MPMULTWO # define ASM_MPDIVTWO # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # endif #endif #if defined(__DECC) # if defined(OPTIMIZE_ALPHA) # define ASM_MPADD # define ASM_MPSUB # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # endif #endif #if defined(__GNUC__) # if defined(OPTIMIZE_ALPHA) # define ASM_MPADD # define ASM_MPSUB # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # elif defined(OPTIMIZE_ARM) # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # elif defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686) # define ASM_MPZERO # define ASM_MPFILL # define ASM_MPEVEN # define ASM_MPODD # define ASM_MPADD # define ASM_MPADDW # define ASM_MPSUB # define ASM_MPSUBW # define ASM_MPMULTWO # define ASM_MPDIVTWO # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # define ASM_MPPNDIV # elif defined(OPTIMIZE_IA64) # define ASM_MPZERO # define ASM_MPCOPY # define ASM_MPADD # define ASM_MPSUB # define ASM_MPMULTWO # define ASM_MPSETMUL # define ASM_MPADDMUL # elif defined(OPTIMIZE_M68K) # define ASM_MPADD # define ASM_MPSUB # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # elif defined(OPTIMIZE_POWERPC) || defined(OPTIMIZE_POWERPC64) # define ASM_MPSETMUL # define ASM_MPADD # define ASM_MPADDW # define ASM_MPSUB # define ASM_MPSUBW # define ASM_MPMULTWO # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # elif defined(OPTIMIZE_S390X) # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # elif defined(OPTIMIZE_SPARCV8) # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # elif defined(OPTIMIZE_SPARCV8PLUS) # define ASM_MPADDW # define ASM_MPSUBW # define ASM_MPADD # define ASM_MPSUB # define ASM_MPMULTWO # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # elif defined(OPTIMIZE_X86_64) # define ASM_MPZERO # define ASM_MPFILL # define ASM_MPEVEN # define ASM_MPODD # define ASM_MPADD # define ASM_MPADDW # define ASM_MPSUB # define ASM_MPSUBW # define ASM_MPDIVTWO # define ASM_MPMULTWO # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # endif #endif #if defined(__IBMC__) # if defined(OPTIMIZE_POWERPC) || defined(OPTIMIZE_POWERPC64) # define ASM_MPSETMUL # define ASM_MPADDW # define ASM_MPSUBW # define ASM_MPADD # define ASM_MPSUB # define ASM_MPMULTWO # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # endif #endif #if defined(__INTEL_COMPILER) # if defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686) # define ASM_MPZERO # define ASM_MPFILL # define ASM_MPEVEN # define ASM_MPODD # define ASM_MPADDW # define ASM_MPSUBW # define ASM_MPADD # define ASM_MPSUB # define ASM_MPMULTWO # define ASM_MPDIVTWO # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # define ASM_MPPNDIV # endif #endif #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) # if defined(OPTIMIZE_SPARCV8) # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # elif defined(OPTIMIZE_SPARCV8PLUS) # define ASM_MPADDW # define ASM_MPSUBW # define ASM_MPADD # define ASM_MPSUB # define ASM_MPMULTWO # define ASM_MPSETMUL # define ASM_MPADDMUL # define ASM_MPADDSQRTRC # endif #endif #endif beecrypt-4.2.1/include/beecrypt/beecrypt.h0000644000175000001440000005553711216147022015511 00000000000000/* * Copyright (c) 1999, 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file beecrypt.h * \brief BeeCrypt API, headers. * * These API functions provide an abstract way for using most of * the various algorithms implemented by the library. * * \author Bob Deblier * \ingroup ES_m PRNG_m HASH_m HMAC_m BC_m */ #ifndef _BEECRYPT_H #define _BEECRYPT_H #include "beecrypt/api.h" #include "beecrypt/memchunk.h" #include "beecrypt/mpnumber.h" /* * Entropy Sources */ /*!\typedef entropyNext * \brief Prototype definition for an entropy-generating function. * \ingroup ES_m */ typedef int (*entropyNext)(byte*, size_t); /*!\brief This struct holds information and pointers to code specific to each * source of entropy. * \ingroup ES_m */ #ifdef __cplusplus struct BEECRYPTAPI entropySource #else struct _entropySource #endif { /*!\var name * \brief The entropy source's name. */ const char* name; /*!\var next * \brief Points to the function which produces the entropy. */ const entropyNext next; }; #ifndef __cplusplus typedef struct _entropySource entropySource; #endif #ifdef __cplusplus extern "C" { #endif /*!\fn int entropySourceCount() * \brief This function returns the number of entropy sources implemented by * the library. * \return The number of implemented entropy sources. */ BEECRYPTAPI int entropySourceCount(void); /*!\fn const entropySource* entropySourceGet(int n) * \brief This function returns the \a n -th entropy source implemented by * the library. * \param n Index of the requested entropy source; legal values are 0 * through entropySourceCount() - 1. * \return A pointer to an entropy source or null, if the index was out of * range. */ BEECRYPTAPI const entropySource* entropySourceGet(int n); /*!\fn const entropySource* entropySourceFind(const char* name) * \brief This function returns the entropy source specified by the given name. * \param name Name of the requested entropy source. * \return A pointer to an entropy source or null, if the name wasn't found. */ BEECRYPTAPI const entropySource* entropySourceFind(const char* name); /*!\fn const entropySource* entropySourceDefault() * \brief This functions returns the default entropy source; the default value * can be specified by setting environment variable BEECRYPT_ENTROPY. * \return A pointer to an entropy source or null, in case an error occured. */ BEECRYPTAPI const entropySource* entropySourceDefault(void); /*!\fn int entropyGatherNext(byte* data, size_t size) * \brief This function gathers \a size bytes of entropy into \a data. * * Unless environment variable BEECRYPT_ENTROPY is set, this function will * try each successive entropy source to gather up the requested amount. * * \param data Points to where the entropy should be stored. * \param size Indicates how many bytes of entropy should be gathered. * \retval 0 On success. * \retval -1 On failure. */ BEECRYPTAPI int entropyGatherNext(byte*, size_t); #ifdef __cplusplus } #endif /* * Pseudo-random Number Generators */ typedef void randomGeneratorParam; typedef int (*randomGeneratorSetup )(randomGeneratorParam*); typedef int (*randomGeneratorSeed )(randomGeneratorParam*, const byte*, size_t); typedef int (*randomGeneratorNext )(randomGeneratorParam*, byte*, size_t); typedef int (*randomGeneratorCleanup)(randomGeneratorParam*); /* * The struct 'randomGenerator' holds information and pointers to code specific * to each random generator. Each specific random generator MUST be written to * be multithread safe. * * WARNING: each randomGenerator, when used in cryptographic applications, MUST * be guaranteed to be of suitable quality and strength (i.e. don't use the * random() function found in most UN*X-es). * * Multiple instances of each randomGenerator can be used (even concurrently), * provided they each use their own randomGeneratorParam parameters, a chunk * of memory which must be at least as large as indicated by the paramsize * field. * */ /*!\brief This struct holds information and pointers to code specific to each * pseudo-random number generator. * \ingroup PRNG_m */ #ifdef __cplusplus struct BEECRYPTAPI randomGenerator #else struct _randomGenerator #endif { /*!\var name * \brief The random generator's name. */ const char* name; /*!\var paramsize * \brief The size of the random generator's parameters. * \note The implementor should set this by using sizeof(). */ const size_t paramsize; /*!\var setup * \brief Points to the setup function. */ const randomGeneratorSetup setup; /*!\var seed * \brief Points to the seeding function. */ const randomGeneratorSeed seed; /*!\var seed * \brief Points to the function which generates the random data. */ const randomGeneratorNext next; /*!\var seed * \brief Points to the cleanup function. */ const randomGeneratorCleanup cleanup; }; #ifndef __cplusplus typedef struct _randomGenerator randomGenerator; #endif /* * You can use the following functions to find random generators implemented by * the library: * * randomGeneratorCount returns the number of generators available. * * randomGeneratorGet returns the random generator with a given index (starting * at zero, up to randomGeneratorCount() - 1), or NULL if the index was out of * bounds. * * randomGeneratorFind returns the random generator with the given name, or * NULL if no random generator exists with that name. */ #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int randomGeneratorCount(void); BEECRYPTAPI const randomGenerator* randomGeneratorGet(int); BEECRYPTAPI const randomGenerator* randomGeneratorFind(const char*); BEECRYPTAPI const randomGenerator* randomGeneratorDefault(void); #ifdef __cplusplus } #endif /* * The struct 'randomGeneratorContext' is used to contain both the functional * part (the randomGenerator), and its parameters. */ #ifdef __cplusplus struct BEECRYPTAPI randomGeneratorContext #else struct _randomGeneratorContext #endif { const randomGenerator* rng; randomGeneratorParam* param; #ifdef __cplusplus randomGeneratorContext(); randomGeneratorContext(const randomGenerator*); ~randomGeneratorContext(); #endif }; #ifndef __cplusplus typedef struct _randomGeneratorContext randomGeneratorContext; #endif /* * The following functions can be used to initialize and free a * randomGeneratorContext. Initializing will allocate a buffer of the size * required by the randomGenerator, freeing will deallocate that buffer. */ #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int randomGeneratorContextInit(randomGeneratorContext*, const randomGenerator*); BEECRYPTAPI int randomGeneratorContextFree(randomGeneratorContext*); BEECRYPTAPI int randomGeneratorContextNext(randomGeneratorContext*, byte*, size_t); BEECRYPTAPI int randomGeneratorContextSeed(randomGeneratorContext*, const byte*, size_t); #ifdef __cplusplus } #endif /* * Hash Functions */ /*!typedef void hashFunctionParam * \ingroup HASH_m */ typedef void hashFunctionParam; typedef int (*hashFunctionReset )(hashFunctionParam*); typedef int (*hashFunctionUpdate)(hashFunctionParam*, const byte*, size_t); typedef int (*hashFunctionDigest)(hashFunctionParam*, byte*); /* * The struct 'hashFunction' holds information and pointers to code specific * to each hash function. Specific hash functions MAY be written to be * multithread-safe. * * NOTE: data MUST have a size (in bytes) of at least 'digestsize' as described * in the hashFunction struct. * NOTE: for safety reasons, after calling digest, each specific implementation * MUST reset itself so that previous values in the parameters are erased. */ #ifdef __cplusplus struct BEECRYPTAPI hashFunction #else struct _hashFunction #endif { const char* name; const size_t paramsize; /* in bytes */ const size_t blocksize; /* in bytes */ const size_t digestsize; /* in bytes */ const hashFunctionReset reset; const hashFunctionUpdate update; const hashFunctionDigest digest; }; #ifndef __cplusplus typedef struct _hashFunction hashFunction; #endif /* * You can use the following functions to find hash functions implemented by * the library: * * hashFunctionCount returns the number of hash functions available. * * hashFunctionGet returns the hash function with a given index (starting * at zero, up to hashFunctionCount() - 1), or NULL if the index was out of * bounds. * * hashFunctionFind returns the hash function with the given name, or * NULL if no hash function exists with that name. */ #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int hashFunctionCount(void); BEECRYPTAPI const hashFunction* hashFunctionGet(int); BEECRYPTAPI const hashFunction* hashFunctionFind(const char*); BEECRYPTAPI const hashFunction* hashFunctionDefault(void); #ifdef __cplusplus } #endif /* * The struct 'hashFunctionContext' is used to contain both the functional * part (the hashFunction), and its parameters. */ #ifdef __cplusplus struct BEECRYPTAPI hashFunctionContext #else struct _hashFunctionContext #endif { const hashFunction* algo; hashFunctionParam* param; #ifdef __cplusplus hashFunctionContext(); hashFunctionContext(const hashFunction*); ~hashFunctionContext(); #endif }; #ifndef __cplusplus typedef struct _hashFunctionContext hashFunctionContext; #endif /* * The following functions can be used to initialize and free a * hashFunctionContext. Initializing will allocate a buffer of the size * required by the hashFunction, freeing will deallocate that buffer. */ #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int hashFunctionContextInit(hashFunctionContext*, const hashFunction*); BEECRYPTAPI int hashFunctionContextFree(hashFunctionContext*); BEECRYPTAPI int hashFunctionContextReset(hashFunctionContext*); BEECRYPTAPI int hashFunctionContextUpdate(hashFunctionContext*, const byte*, size_t); BEECRYPTAPI int hashFunctionContextUpdateMC(hashFunctionContext*, const memchunk*); BEECRYPTAPI int hashFunctionContextUpdateMP(hashFunctionContext*, const mpnumber*); BEECRYPTAPI int hashFunctionContextDigest(hashFunctionContext*, byte*); BEECRYPTAPI int hashFunctionContextDigestMP(hashFunctionContext*, mpnumber*); BEECRYPTAPI int hashFunctionContextDigestMatch(hashFunctionContext*, const mpnumber*); #ifdef __cplusplus } #endif /* * Keyed Hash Functions, a.k.a. Message Authentication Codes */ /*!\typedef void keyedHashFunctionParam * \ingroup HMAC_m */ typedef void keyedHashFunctionParam; typedef int (*keyedHashFunctionSetup )(keyedHashFunctionParam*, const byte*, size_t); typedef int (*keyedHashFunctionReset )(keyedHashFunctionParam*); typedef int (*keyedHashFunctionUpdate )(keyedHashFunctionParam*, const byte*, size_t); typedef int (*keyedHashFunctionDigest )(keyedHashFunctionParam*, byte*); /* * The struct 'keyedHashFunction' holds information and pointers to code * specific to each keyed hash function. Specific keyed hash functions MAY be * written to be multithread-safe. * * The struct field 'keybitsmin' contains the minimum number of bits a key * must contains, 'keybitsmax' the maximum number of bits a key may contain, * 'keybitsinc', the increment in bits that may be used between min and max. * * NOTE: data must be at least have a bytesize of 'digestsize' as described * in the keyedHashFunction struct. * NOTE: for safety reasons, after calling digest, each specific implementation * MUST reset itself so that previous values in the parameters are erased. */ #ifdef __cplusplus struct BEECRYPTAPI keyedHashFunction #else struct _keyedHashFunction #endif { const char* name; const size_t paramsize; /* in bytes */ const size_t blocksize; /* in bytes */ const size_t digestsize; /* in bytes */ const size_t keybitsmin; /* in bits */ const size_t keybitsmax; /* in bits */ const size_t keybitsinc; /* in bits */ const keyedHashFunctionSetup setup; const keyedHashFunctionReset reset; const keyedHashFunctionUpdate update; const keyedHashFunctionDigest digest; }; #ifndef __cplusplus typedef struct _keyedHashFunction keyedHashFunction; #endif /* * You can use the following functions to find keyed hash functions implemented * by the library: * * keyedHashFunctionCount returns the number of keyed hash functions available. * * keyedHashFunctionGet returns the keyed hash function with a given index * (starting at zero, up to keyedHashFunctionCount() - 1), or NULL if the index * was out of bounds. * * keyedHashFunctionFind returns the keyed hash function with the given name, * or NULL if no keyed hash function exists with that name. */ #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int keyedHashFunctionCount(void); BEECRYPTAPI const keyedHashFunction* keyedHashFunctionGet(int); BEECRYPTAPI const keyedHashFunction* keyedHashFunctionFind(const char*); BEECRYPTAPI const keyedHashFunction* keyedHashFunctionDefault(void); #ifdef __cplusplus } #endif /* * The struct 'keyedHashFunctionContext' is used to contain both the functional * part (the keyedHashFunction), and its parameters. */ #ifdef __cplusplus struct BEECRYPTAPI keyedHashFunctionContext #else struct _keyedHashFunctionContext #endif { const keyedHashFunction* algo; keyedHashFunctionParam* param; #ifdef __cplusplus keyedHashFunctionContext(); keyedHashFunctionContext(const keyedHashFunction*); ~keyedHashFunctionContext(); #endif }; #ifndef __cplusplus typedef struct _keyedHashFunctionContext keyedHashFunctionContext; #endif /* * The following functions can be used to initialize and free a * keyedHashFunctionContext. Initializing will allocate a buffer of the size * required by the keyedHashFunction, freeing will deallocate that buffer. */ #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int keyedHashFunctionContextInit(keyedHashFunctionContext*, const keyedHashFunction*); BEECRYPTAPI int keyedHashFunctionContextFree(keyedHashFunctionContext*); BEECRYPTAPI int keyedHashFunctionContextSetup(keyedHashFunctionContext*, const byte*, size_t); BEECRYPTAPI int keyedHashFunctionContextReset(keyedHashFunctionContext*); BEECRYPTAPI int keyedHashFunctionContextUpdate(keyedHashFunctionContext*, const byte*, size_t); BEECRYPTAPI int keyedHashFunctionContextUpdateMC(keyedHashFunctionContext*, const memchunk*); BEECRYPTAPI int keyedHashFunctionContextUpdateMP(keyedHashFunctionContext*, const mpnumber*); BEECRYPTAPI int keyedHashFunctionContextDigest(keyedHashFunctionContext*, byte*); BEECRYPTAPI int keyedHashFunctionContextDigestMP(keyedHashFunctionContext*, mpnumber*); BEECRYPTAPI int keyedHashFunctionContextDigestMatch(keyedHashFunctionContext*, const mpnumber*); #ifdef __cplusplus } #endif /* * Block ciphers */ /*!\enum cipherOperation * \brief Specifies whether to perform encryption or decryption. * \ingroup BC_m */ typedef enum { NOCRYPT, ENCRYPT, DECRYPT } cipherOperation; /*!\typedef void blockCipherParam * \brief Placeholder type definition for blockcipher parameters. * \sa aesParam, blowfishParam. * \ingroup BC_m */ typedef void blockCipherParam; /*!\brief Prototype definition for a setup function. * \ingroup BC_m */ typedef int (*blockCipherSetup )(blockCipherParam*, const byte*, size_t, cipherOperation); /*!\typedef int (*blockCipherSetIV)(blockCipherParam* bp, const byte* iv) * \brief Prototype definition for an initialization vector setup function. * \param bp The blockcipher's parameters. * \param iv The blockciphers' IV value. * \note iv length must be equal to the cipher's block size. * \retval 0 on success. * \retval -1 on failure. * \ingroup BC_m */ typedef int (*blockCipherSetIV )(blockCipherParam*, const byte*); /*!\typedef int (*blockCipherSetCTR)(blockCipherParam* bp, const byte* nivz, size_t counter) * \brief Prototype definition for an initialization vector setup function. * \param bp The blockcipher's parameters. * \param nivz The concatenation of the Nonce, IV and padding Zero bytes. * \param counter The blockciphers' counter value. * \note nivz length must be equal to the cipher's block size. * \retval 0 on success. * \retval -1 on failure. * \ingroup BC_m */ typedef int (*blockCipherSetCTR )(blockCipherParam*, const byte*, size_t); /*!\typedef int (*blockCipherRawcrypt)(blockCipherParam* bp, uint32_t* dst, const uint32_t* src) * \brief Prototype for a \e raw encryption or decryption function. * \param bp The blockcipher's parameters. * \param dst The ciphertext address; must be aligned on 32-bit boundary. * \param src The cleartext address; must be aligned on 32-bit boundary. * \retval 0 on success. * \retval -1 on failure. * \ingroup BC_m */ typedef int (*blockCipherRawcrypt)(blockCipherParam*, uint32_t*, const uint32_t*); /*!\typedef int (*blockCipherModcrypt)(blockCipherParam* bp, uint32_t* dst, const uint32_t* src, unsigned int nblocks) * \brief Prototype for a \e encryption or decryption function which operates * on multiple blocks in a certain mode. * \param bp The blockcipher's parameters. * \param dst The ciphertext address; must be aligned on 32-bit boundary. * \param src The cleartext address; must be aligned on 32-bit boundary. * \param nblocks The number of blocks to process. * \retval 0 on success. * \retval -1 on failure. * \ingroup BC_m */ typedef int (*blockCipherModcrypt)(blockCipherParam*, uint32_t*, const uint32_t*, unsigned int); typedef uint32_t* (*blockCipherFeedback)(blockCipherParam*); typedef struct { const blockCipherRawcrypt encrypt; const blockCipherRawcrypt decrypt; } blockCipherRaw; typedef struct { const blockCipherModcrypt encrypt; const blockCipherModcrypt decrypt; } blockCipherMode; /*!\brief Holds information and pointers to code specific to each cipher. * * Specific block ciphers \e may be written to be multithread-safe. * * \ingroup BC_m */ #ifdef __cplusplus struct BEECRYPTAPI blockCipher #else struct _blockCipher #endif { /*!\var name * \brief The blockcipher's name. */ const char* name; /*!\var paramsize * \brief The size of the parameters required by this cipher, in bytes. */ const size_t paramsize; /*!\var blocksize * \brief The size of one block of data, in bytes. */ const size_t blocksize; /*!\var keybitsmin * \brief The minimum number of key bits. */ const size_t keybitsmin; /*!\var keybitsmax * \brief The maximum number of key bits. */ const size_t keybitsmax; /*!\var keybitsinc * \brief The allowed increment in key bits between min and max. * \see keybitsmin and keybitsmax. */ const size_t keybitsinc; /*!\var setup * \brief Pointer to the cipher's setup function. */ const blockCipherSetup setup; /*!\var setiv * \brief Pointer to the cipher's initialization vector setup function. */ const blockCipherSetIV setiv; /*!\var setctr * \brief Pointer to the cipher's ctr setup function. */ const blockCipherSetCTR setctr; /*!\var getfb * \brief Pointer to the cipher's feedback-returning function. */ const blockCipherFeedback getfb; /*!\var raw * \brief The cipher's raw functions. */ const blockCipherRaw raw; /*!\var ecb * \brief The cipher's ECB functions. */ const blockCipherMode ecb; /*!\var cbc * \brief The cipher's CBC functions. */ const blockCipherMode cbc; /*!\var ctr * \brief The cipher's CTR functions. */ const blockCipherMode ctr; }; #ifndef __cplusplus typedef struct _blockCipher blockCipher; #endif #ifdef __cplusplus extern "C" { #endif /*!\fn int blockCipherCount() * \brief This function returns the number of blockciphers implemented * by the library. * \return The number of implemented blockciphers. */ BEECRYPTAPI int blockCipherCount(void); /*!\fn const blockCipher* blockCipherGet(int n) * \brief This function returns the \a n -th blockcipher implemented by * the library. * \param n Index of the requested blockcipher; legal values are 0 * through blockCipherCount() - 1. * \return A pointer to a blockcipher or null, if the index was out of * range. */ BEECRYPTAPI const blockCipher* blockCipherGet(int); /*!\fn const blockCipher* blockCipherFind(const char* name) * \brief This function returns the blockcipher specified by the given name. * \param name Name of the requested blockcipher. * \return A pointer to a blockcipher or null, if the name wasn't found. */ BEECRYPTAPI const blockCipher* blockCipherFind(const char*); /*!\fn const blockCipher* blockCipherDefault() * \brief This functions returns the default blockcipher; the default value * can be specified by setting environment variable BEECRYPT_CIPHER. * \return A pointer to a blockcipher or null, in case an error occured. */ BEECRYPTAPI const blockCipher* blockCipherDefault(void); #ifdef __cplusplus } #endif /*!\brief Holds a pointer to a blockcipher as well as its parameters. * \warning A context can be used by only one thread at the same time. * \ingroup BC_m */ #ifdef __cplusplus struct BEECRYPTAPI blockCipherContext #else struct _blockCipherContext #endif { /*!\var algo * \brief Pointer to a blockCipher. */ const blockCipher* algo; /*!\var param * \brief Pointer to the parameters used by algo. */ blockCipherParam* param; /*!\var op */ cipherOperation op; #ifdef __cplusplus blockCipherContext(); blockCipherContext(const blockCipher*); ~blockCipherContext(); #endif }; #ifndef __cplusplus typedef struct _blockCipherContext blockCipherContext; #endif /* * The following functions can be used to initialize and free a * blockCipherContext. Initializing will allocate a buffer of the size * required by the blockCipher, freeing will deallocate that buffer. */ #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int blockCipherContextInit(blockCipherContext*, const blockCipher*); BEECRYPTAPI int blockCipherContextSetup(blockCipherContext*, const byte*, size_t, cipherOperation); BEECRYPTAPI int blockCipherContextSetIV(blockCipherContext*, const byte*); BEECRYPTAPI int blockCipherContextSetCTR(blockCipherContext*, const byte*, size_t); BEECRYPTAPI int blockCipherContextFree(blockCipherContext*); BEECRYPTAPI int blockCipherContextECB(blockCipherContext*, uint32_t*, const uint32_t*, int); BEECRYPTAPI int blockCipherContextCBC(blockCipherContext*, uint32_t*, const uint32_t*, int); BEECRYPTAPI int blockCipherContextCTR(blockCipherContext*, uint32_t*, const uint32_t*, int); BEECRYPTAPI int blockCipherContextValidKeylen(blockCipherContext*, size_t); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/0000777000175000001440000000000011226307271014516 500000000000000beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_MD5.h0000664000175000001440000000331310213550027020773 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_MD5 */ #ifndef _Included_beecrypt_provider_MD5 #define _Included_beecrypt_provider_MD5 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_MD5 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_MD5_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_MD5 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_MD5_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_MD5 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_MD5_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_MD5 * Method: digest * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_MD5_digest__J (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_MD5 * Method: digest * Signature: (J[BII)I */ JNIEXPORT jint JNICALL Java_beecrypt_provider_MD5_digest__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); /* * Class: beecrypt_provider_MD5 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_MD5_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_MD5 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_MD5_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_MD5 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_MD5_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_SHA384.h0000664000175000001440000000340410213550027021261 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_SHA384 */ #ifndef _Included_beecrypt_provider_SHA384 #define _Included_beecrypt_provider_SHA384 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_SHA384 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA384_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_SHA384 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA384_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA384 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA384_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA384 * Method: digest * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_SHA384_digest__J (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA384 * Method: digest * Signature: (J[BII)I */ JNIEXPORT jint JNICALL Java_beecrypt_provider_SHA384_digest__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); /* * Class: beecrypt_provider_SHA384 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA384_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA384 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA384_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_SHA384 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA384_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_SHA224.h0000644000175000001440000000340411225174504021256 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_SHA224 */ #ifndef _Included_beecrypt_provider_SHA224 #define _Included_beecrypt_provider_SHA224 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_SHA224 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA224_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_SHA224 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA224_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA224 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA224_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA224 * Method: digest * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_SHA224_digest__J (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA224 * Method: digest * Signature: (J[BII)I */ JNIEXPORT jint JNICALL Java_beecrypt_provider_SHA224_digest__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); /* * Class: beecrypt_provider_SHA224 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA224_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA224 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA224_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_SHA224 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA224_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_MD4.h0000644000175000001440000000331311225174357021004 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_MD4 */ #ifndef _Included_beecrypt_provider_MD4 #define _Included_beecrypt_provider_MD4 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_MD4 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_MD4_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_MD4 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_MD4_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_MD4 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_MD4_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_MD4 * Method: digest * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_MD4_digest__J (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_MD4 * Method: digest * Signature: (J[BII)I */ JNIEXPORT jint JNICALL Java_beecrypt_provider_MD4_digest__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); /* * Class: beecrypt_provider_MD4 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_MD4_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_MD4 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_MD4_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_MD4 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_MD4_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_HMACSHA256.h0000664000175000001440000000346510213550027021717 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_HMACSHA256 */ #ifndef _Included_beecrypt_provider_HMACSHA256 #define _Included_beecrypt_provider_HMACSHA256 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_HMACSHA256 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACSHA256_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_HMACSHA256 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACSHA256_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA256 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA256_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA256 * Method: doFinal * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_HMACSHA256_doFinal (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA256 * Method: init * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA256_init (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: beecrypt_provider_HMACSHA256 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA256_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA256 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA256_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_HMACSHA256 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA256_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_SHA512.h0000664000175000001440000000340410213550027021252 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_SHA512 */ #ifndef _Included_beecrypt_provider_SHA512 #define _Included_beecrypt_provider_SHA512 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_SHA512 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA512_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_SHA512 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA512_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA512 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA512_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA512 * Method: digest * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_SHA512_digest__J (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA512 * Method: digest * Signature: (J[BII)I */ JNIEXPORT jint JNICALL Java_beecrypt_provider_SHA512_digest__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); /* * Class: beecrypt_provider_SHA512 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA512_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA512 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA512_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_SHA512 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA512_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_HMACMD5.h0000664000175000001440000000337410213550027021433 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_HMACMD5 */ #ifndef _Included_beecrypt_provider_HMACMD5 #define _Included_beecrypt_provider_HMACMD5 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_HMACMD5 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACMD5_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_HMACMD5 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACMD5_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACMD5 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACMD5_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACMD5 * Method: doFinal * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_HMACMD5_doFinal (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACMD5 * Method: init * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACMD5_init (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: beecrypt_provider_HMACMD5 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACMD5_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACMD5 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACMD5_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_HMACMD5 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACMD5_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_SHA256.h0000664000175000001440000000340410213550027021257 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_SHA256 */ #ifndef _Included_beecrypt_provider_SHA256 #define _Included_beecrypt_provider_SHA256 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_SHA256 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA256_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_SHA256 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA256_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA256 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA256_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA256 * Method: digest * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_SHA256_digest__J (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA256 * Method: digest * Signature: (J[BII)I */ JNIEXPORT jint JNICALL Java_beecrypt_provider_SHA256_digest__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); /* * Class: beecrypt_provider_SHA256 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA256_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA256 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA256_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_SHA256 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA256_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_HMACSHA384.h0000664000175000001440000000346510213550027021721 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_HMACSHA384 */ #ifndef _Included_beecrypt_provider_HMACSHA384 #define _Included_beecrypt_provider_HMACSHA384 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_HMACSHA384 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACSHA384_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_HMACSHA384 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACSHA384_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA384 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA384_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA384 * Method: doFinal * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_HMACSHA384_doFinal (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA384 * Method: init * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA384_init (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: beecrypt_provider_HMACSHA384 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA384_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA384 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA384_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_HMACSHA384 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA384_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_RSAKeyPairGenerator.h0000664000175000001440000000100610213550027024164 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_RSAKeyPairGenerator */ #ifndef _Included_beecrypt_provider_RSAKeyPairGenerator #define _Included_beecrypt_provider_RSAKeyPairGenerator #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_RSAKeyPairGenerator * Method: generate * Signature: ()V */ JNIEXPORT void JNICALL Java_beecrypt_provider_RSAKeyPairGenerator_generate (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_HMACSHA1.h0000664000175000001440000000341710213550027021540 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_HMACSHA1 */ #ifndef _Included_beecrypt_provider_HMACSHA1 #define _Included_beecrypt_provider_HMACSHA1 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_HMACSHA1 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACSHA1_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_HMACSHA1 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACSHA1_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA1 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA1_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA1 * Method: doFinal * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_HMACSHA1_doFinal (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA1 * Method: init * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA1_init (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: beecrypt_provider_HMACSHA1 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA1_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA1 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA1_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_HMACSHA1 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA1_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_SHA1.h0000664000175000001440000000333610213550027021107 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_SHA1 */ #ifndef _Included_beecrypt_provider_SHA1 #define _Included_beecrypt_provider_SHA1 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_SHA1 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA1_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_SHA1 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_SHA1_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA1 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA1_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA1 * Method: digest * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_SHA1_digest__J (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA1 * Method: digest * Signature: (J[BII)I */ JNIEXPORT jint JNICALL Java_beecrypt_provider_SHA1_digest__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); /* * Class: beecrypt_provider_SHA1 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA1_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_SHA1 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA1_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_SHA1 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_SHA1_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_DHKeyPairGenerator.h0000664000175000001440000000100110210575620024030 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_DHKeyPairGenerator */ #ifndef _Included_beecrypt_provider_DHKeyPairGenerator #define _Included_beecrypt_provider_DHKeyPairGenerator #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_DHKeyPairGenerator * Method: generate * Signature: ()V */ JNIEXPORT void JNICALL Java_beecrypt_provider_DHKeyPairGenerator_generate (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_AES.h0000664000175000001440000000266210262751325021034 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_AES */ #ifndef _Included_beecrypt_provider_AES #define _Included_beecrypt_provider_AES #ifdef __cplusplus extern "C" { #endif #undef beecrypt_provider_AES_MODE_ECB #define beecrypt_provider_AES_MODE_ECB 0L #undef beecrypt_provider_AES_MODE_CBC #define beecrypt_provider_AES_MODE_CBC 1L #undef beecrypt_provider_AES_MODE_CTR #define beecrypt_provider_AES_MODE_CTR 2L #undef beecrypt_provider_AES_PADDING_NONE #define beecrypt_provider_AES_PADDING_NONE 0L #undef beecrypt_provider_AES_PADDING_PKCS5 #define beecrypt_provider_AES_PADDING_PKCS5 1L /* * Class: beecrypt_provider_AES * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_AES_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_AES * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_AES_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_AES * Method: init * Signature: (JI[B[B)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_AES_init (JNIEnv *, jclass, jlong, jint, jbyteArray, jbyteArray); /* * Class: beecrypt_provider_AES * Method: process * Signature: (J[BII[BI)I */ JNIEXPORT jint JNICALL Java_beecrypt_provider_AES_process (JNIEnv *, jclass, jlong, jbyteArray, jint, jint, jbyteArray, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_provider_HMACSHA512.h0000664000175000001440000000346510213550027021712 00000000000000/* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class beecrypt_provider_HMACSHA512 */ #ifndef _Included_beecrypt_provider_HMACSHA512 #define _Included_beecrypt_provider_HMACSHA512 #ifdef __cplusplus extern "C" { #endif /* * Class: beecrypt_provider_HMACSHA512 * Method: allocParam * Signature: ()J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACSHA512_allocParam (JNIEnv *, jclass); /* * Class: beecrypt_provider_HMACSHA512 * Method: cloneParam * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_beecrypt_provider_HMACSHA512_cloneParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA512 * Method: freeParam * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA512_freeParam (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA512 * Method: doFinal * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL Java_beecrypt_provider_HMACSHA512_doFinal (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA512 * Method: init * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA512_init (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: beecrypt_provider_HMACSHA512 * Method: reset * Signature: (J)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA512_reset (JNIEnv *, jclass, jlong); /* * Class: beecrypt_provider_HMACSHA512 * Method: update * Signature: (JB)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA512_update__JB (JNIEnv *, jclass, jlong, jbyte); /* * Class: beecrypt_provider_HMACSHA512 * Method: update * Signature: (J[BII)V */ JNIEXPORT void JNICALL Java_beecrypt_provider_HMACSHA512_update__J_3BII (JNIEnv *, jclass, jlong, jbyteArray, jint, jint); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/java/beecrypt_tools.h0000664000175000001440000000060110214042344017630 00000000000000#ifndef _BEECRYPT_JAVA_TOOLS_H #define _BEECRYPT_JAVA_TOOLS_H #include "beecrypt/api.h" #include "beecrypt/mpbarrett.h" #ifdef __cplusplus extern "C" { #endif jbyteArray mp_to_bigint(JNIEnv* env, size_t size, mpw* data); void mpnsetbigint(mpnumber* n, JNIEnv* env, jbyteArray val); void mpbsetbigint(mpbarrett* b, JNIEnv* env, jbyteArray val); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/memchunk.h0000644000175000001440000000242611216147022015470 00000000000000/* * Copyright (c) 2001 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file memchunk.h * \author Bob Deblier */ #ifndef _MEMCHUNK_H #define _MEMCHUNK_H #include "beecrypt/api.h" typedef struct { size_t size; byte* data; } memchunk; #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI memchunk* memchunkAlloc(size_t); BEECRYPTAPI void memchunkWipe(memchunk*); BEECRYPTAPI void memchunkFree(memchunk*); BEECRYPTAPI memchunk* memchunkResize(memchunk*, size_t); BEECRYPTAPI memchunk* memchunkClone(const memchunk*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/rsa.h0000644000175000001440000000734411216676016014464 00000000000000/* * Copyright (c) 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file rsa.h * \brief RSA algorithm. * \author Bob Deblier * \ingroup IF_m IF_rsa_m */ #ifndef _RSA_H #define _RSA_H #include "beecrypt/rsakp.h" #ifdef __cplusplus extern "C" { #endif /*!\fn int rsapub(const mpbarrett* n, const mpnumber* e, const mpnumber* m, mpnumber* c) * \brief This function performs a raw RSA public key operation. * * This function can be used for encryption and verifying. * * It performs the following operation: * \li \f$c=m^{e}\ \textrm{mod}\ n\f$ * * \param n The RSA modulus. * \param e The RSA public exponent. * \param m The message. * \param c The ciphertext. * \retval 0 on success. * \retval -1 on failure. */ BEECRYPTAPI int rsapub(const mpbarrett* n, const mpnumber* e, const mpnumber* m, mpnumber* c); /*!\fn int rsapri(const mpbarrett* n, const mpnumber* d, const mpnumber* c, mpnumber* m) * \brief This function performs a raw RSA private key operation. * * This function can be used for decryption and signing. * * It performs the operation: * \li \f$m=c^{d}\ \textrm{mod}\ n\f$ * * \param n The modulus. * \param d The private exponent. * \param c The ciphertext. * \param m The message. * \retval 0 on success. * \retval -1 on failure. */ BEECRYPTAPI int rsapri(const mpbarrett* n, const mpnumber* d, const mpnumber* c, mpnumber* m); /*!\fn int rsapricrt(const mpbarrett* n, const mpbarrett* p, const mpbarrett* q, const mpnumber* dp, const mpnumber* dq, const mpnumber* qi, const mpnumber* c, mpnumber* m) * * \brief This function performs a raw RSA private key operation, with * application of the Chinese Remainder Theorem. * * It performs the operation: * \li \f$j_1=c^{dp}\ \textrm{mod}\ p\f$ * \li \f$j_2=c^{dq}\ \textrm{mod}\ q\f$ * \li \f$h=qi \cdot (j_1-j_2)\ \textrm{mod}\ p\f$ * \li \f$m=j_2+hq\f$ * * \param n The modulus. * \param p The first prime factor. * \param q The second prime factor. * \param dp The private exponent d mod (p-1). * \param dq The private exponent d (q-1). * \param qi The inverse of q mod p. * \param c The ciphertext. * \param m The message. * \retval 0 on success. * \retval -1 on failure. */ BEECRYPTAPI int rsapricrt(const mpbarrett* n, const mpbarrett* p, const mpbarrett* q, const mpnumber* dp, const mpnumber* dq, const mpnumber* qi, const mpnumber* c, mpnumber* m); /*!\fn int rsavrfy(const mpbarrett* n, const mpnumber* e, const mpnumber* m, const mpnumber* c) * \brief This function performs a raw RSA verification. * * It verifies if ciphertext \a c was encrypted from cleartext \a m * with the private key matching the given public key \a (n, e). * * \param n The modulus. * \param e The public exponent. * \param m The cleartext message. * \param c The ciphertext message. * \retval 1 on success. * \retval 0 on failure. */ BEECRYPTAPI int rsavrfy(const mpbarrett* n, const mpnumber* e, const mpnumber* m, const mpnumber* c); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/win.h0000644000175000001440000000652211216515003014455 00000000000000/* * Copyright (c) 2000, 2001, 2002, 2005 X-Way Rights BV * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file win.h * \brief BeeCrypt API, windows headers. * \author Bob Deblier */ #ifndef _BEECRYPT_WIN_H #define _BEECRYPT_WIN_H #define _REENTRANT #if !defined(_WIN32_WINNT) # define _WIN32_WINNT 0x0400 #endif #include #define WORDS_BIGENDIAN 0 #if __MWERKS__ # if __INTEL__ # else # error Unknown CPU type in MetroWerks CodeWarrior # endif #elif defined(_MSC_VER) # if defined(_M_IX86) # define ROTL32(x, s) _rotl(x, s) # define ROTR32(x, s) _rotr(x, s) # else # error Unknown CPU type in Microsoft Visual C # endif #else # error Unknown compiler for WIN32 #endif #if defined(_MSC_VER) || __MWERKS__ # include # include # include # define HAVE_ASSERT_H 1 # define HAVE_ERRNO_H 1 # define HAVE_CTYPE_H 1 # define HAVE_FCNTL_H 1 # define HAVE_TIME_H 1 # define HAVE_SYS_TYPES_H 0 # define HAVE_SYS_TIME_H 0 # define HAVE_THREAD_H 0 # define HAVE_SYNCH_H 0 # define HAVE_PTHREAD_H 0 # define HAVE_SEMAPHORE_H 0 # define HAVE_TERMIO_H 0 # define HAVE_SYS_AUDIOIO_H 0 # define HAVE_SYS_IOCTL_H 0 # define HAVE_SYS_SOUNDCARD_H 0 # define HAVE_GETTIMEOFDAY 0 # define HAVE_GETHRTIME 0 # define HAVE_DEV_TTY 0 # define HAVE_DEV_AUDIO 0 # define HAVE_DEV_DSP 0 # define HAVE_DEV_RANDOM 0 # define HAVE_DEV_URANDOM 0 # define HAVE_DEV_TTY 0 #else # error Not set up for this compiler #endif #if __MWERKS__ # define HAVE_SYS_STAT_H 0 # define HAVE_LONG_LONG 1 # define HAVE_UNSIGNED_LONG_LONG 1 # define HAVE_64_BIT_INT 1 # define HAVE_64_BIT_UINT 1 # define SIZEOF_SIZE_T 4 /* not sure about this one */ # define SIZEOF_UNSIGNED_LONG 4 typedef char int8_t; typedef short int16_t; typedef long int32_t; typedef long long int64_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned long uint32_t; typedef unsigned long long uint64_t; #elif defined(_MSC_VER) # define HAVE_SYS_STAT_H 1 # define HAVE_LONG_LONG 0 # define HAVE_UNSIGNED_LONG_LONG 0 # define HAVE_64_BIT_INT 1 # define HAVE_64_BIT_UINT 1 # define SIZEOF_SIZE_T 4 # define SIZEOF_UNSIGNED_LONG 4 typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; typedef signed __int64 int64_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned __int64 uint64_t; typedef long off_t; #endif #define MP_WBITS 32U typedef HANDLE bc_cond_t; typedef HANDLE bc_mutex_t; typedef HANDLE bc_thread_t; typedef DWORD bc_threadid_t; #endif beecrypt-4.2.1/include/beecrypt/ripemd160.h0000644000175000001440000000623711223566203015400 00000000000000/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file ripemd160.h * \brief RIPEMD-160 hash function, headers. * \author Jeff Johnson * \author Bob Deblier * \ingroup HASH_m HASH_rmd160_m */ #ifndef _RIPEMD160_H #define _RIPEMD160_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the RIPEMD-160 algorithm. * \ingroup HASH_rmd160_m */ #ifdef __cplusplus struct BEECRYPTAPI ripemd160Param #else struct _ripemd160Param #endif { /*!\var h */ uint32_t h[5]; /*!\var data */ uint32_t data[16]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[1]; #elif (MP_WBITS == 32) mpw length[2]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint32_t offset; }; #ifndef __cplusplus typedef struct _ripemd160Param ripemd160Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var ripemd160 * \brief Holds the full API description of the RIPEMD-160 algorithm. */ extern BEECRYPTAPI const hashFunction ripemd160; /*!\fn void ripemd160Process(ripemd160Param* mp) * \brief This function performs the core of the RIPEMD-160 hash algorithm; it * processes a block of 64 bytes. * \param mp The hash function's parameter block. */ BEECRYPTAPI void ripemd160Process(ripemd160Param* mp); /*!\fn int ripemd160Reset(ripemd160Param* mp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param mp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int ripemd160Reset (ripemd160Param* mp); /*!\fn int ripemd160Update(ripemd160Param* mp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param mp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int ripemd160Update (ripemd160Param* mp, const byte* data, size_t size); /*!\fn int ripemd160Digest(ripemd160Param* mp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param mp The hash function's parameter block. * \param digest The place to store the 20-byte digest. * \retval 0 on success. */ BEECRYPTAPI int ripemd160Digest (ripemd160Param* mp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/dldp.h0000644000175000001440000000761211223566203014612 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dldp.h * \brief Discrete Logarithm domain parameters, headers. * \author Bob Deblier * \ingroup DL_m */ #ifndef _DLDP_H #define _DLDP_H #include "beecrypt/mpbarrett.h" /* * Discrete Logarithm Domain Parameters - Prime * * Standard definition where p = qr+1; in case where p=2q+1, r=2 * * In IEEE P1363 naming is p = rk+1 * * Hence, IEEE prime r = q and cofactor k = r * * Make sure q is large enough to foil Pohlig-Hellman attacks * See: "Handbook of Applied Cryptography", Chapter 3.6.4 * * g is either a generator of a subgroup of order q, or a generator of order * n = (p-1) */ /*!\brief Discrete Logarithm Domain Parameters over a prime field. * * For the variables in this structure \f$p=qr+1\f$; if \f$p=2q+1\f$ then \f$r=2\f$. * * \ingroup DL_m */ #ifdef __cplusplus struct BEECRYPTAPI dldp_p #else struct _dldp_p #endif { /*!\var p * \brief The prime. * */ mpbarrett p; /*!\var q * \brief The cofactor. * * \f$q\f$ is a prime divisor of \f$p-1\f$. */ mpbarrett q; /*!\var r * * \f$p=qr+1\f$ */ mpnumber r; /*!\var g * \brief The generator. * * \f$g\f$ is either a generator of \f$\mathds{Z}^{*}_p\f$, or a generator * of a cyclic subgroup \f$G\f$ of \f$\mathds{Z}^{*}_p\f$ of order \f$q\f$. */ mpnumber g; /*!\var n * * \f$n=p-1=qr\f$ */ mpbarrett n; #ifdef __cplusplus dldp_p(); dldp_p(const dldp_p&); ~dldp_p(); #endif }; #ifndef __cplusplus typedef struct _dldp_p dldp_p; #endif #ifdef __cplusplus extern "C" { #endif /* * Functions for setting up and copying */ BEECRYPTAPI int dldp_pInit(dldp_p*); BEECRYPTAPI int dldp_pFree(dldp_p*); BEECRYPTAPI int dldp_pCopy(dldp_p*, const dldp_p*); /* * Functions for generating keys */ BEECRYPTAPI int dldp_pPrivate (const dldp_p*, randomGeneratorContext*, mpnumber*); BEECRYPTAPI int dldp_pPrivate_s(const dldp_p*, randomGeneratorContext*, mpnumber*, size_t); BEECRYPTAPI int dldp_pPublic (const dldp_p*, const mpnumber*, mpnumber*); BEECRYPTAPI int dldp_pPair (const dldp_p*, randomGeneratorContext*, mpnumber* x, mpnumber* y); BEECRYPTAPI int dldp_pPair_s (const dldp_p*, randomGeneratorContext*, mpnumber* x, mpnumber* y, size_t); /* * Function for comparing domain parameters */ BEECRYPTAPI int dldp_pEqual (const dldp_p*, const dldp_p*); /* * Functions for generating and validating dldp_pgoq variant domain parameters */ BEECRYPTAPI int dldp_pgoqMake (dldp_p*, randomGeneratorContext*, size_t, size_t, int); BEECRYPTAPI int dldp_pgoqMakeSafe (dldp_p*, randomGeneratorContext*, size_t); BEECRYPTAPI int dldp_pgoqGenerator(dldp_p*, randomGeneratorContext*); BEECRYPTAPI int dldp_pgoqValidate (const dldp_p*, randomGeneratorContext*, int); /* * Functions for generating and validating dldp_pgon variant domain parameters */ BEECRYPTAPI int dldp_pgonMake (dldp_p*, randomGeneratorContext*, size_t, size_t); BEECRYPTAPI int dldp_pgonMakeSafe (dldp_p*, randomGeneratorContext*, size_t); BEECRYPTAPI int dldp_pgonGenerator(dldp_p*, randomGeneratorContext*); BEECRYPTAPI int dldp_pgonValidate (const dldp_p*, randomGeneratorContext*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/hmacmd5.h0000644000175000001440000000276411216147022015204 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacmd5.h * \brief HMAC-MD5 message authentication code, headers. * \author Bob Deblier * \ingroup HMAC_m HMAC_md5_m */ #ifndef _HMACMD5_H #define _HMACMD5_H #include "beecrypt/hmac.h" #include "beecrypt/md5.h" /*!\ingroup HMAC_md5_m */ typedef struct { md5Param mparam; byte kxi[64]; byte kxo[64]; } hmacmd5Param; #ifdef __cplusplus extern "C" { #endif extern BEECRYPTAPI const keyedHashFunction hmacmd5; BEECRYPTAPI int hmacmd5Setup (hmacmd5Param*, const byte*, size_t); BEECRYPTAPI int hmacmd5Reset (hmacmd5Param*); BEECRYPTAPI int hmacmd5Update(hmacmd5Param*, const byte*, size_t); BEECRYPTAPI int hmacmd5Digest(hmacmd5Param*, byte*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/md5.h0000644000175000001440000000576611223574571014373 00000000000000/* * Copyright (c) 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file md5.h * \brief MD5 hash function. * \author Bob Deblier * \ingroup HASH_m HASH_md5_m */ #ifndef _MD5_H #define _MD5_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the MD5 algorithm. * \ingroup HASH_md5_h */ #ifdef __cplusplus struct BEECRYPTAPI md5Param #else struct _md5Param #endif { /*!\var h */ uint32_t h[4]; /*!\var data */ uint32_t data[16]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[1]; #elif (MP_WBITS == 32) mpw length[2]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint32_t offset; }; #ifndef __cplusplus typedef struct _md5Param md5Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var md5 * \brief Holds the full API description of the MD5 algorithm. */ extern BEECRYPTAPI const hashFunction md5; /*!\fn int md5Reset(md5Param* mp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param mp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI void md5Process(md5Param* mp); /*!\fn int md5Reset(md5Param* mp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param mp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int md5Reset (md5Param* mp); /*!\fn int md5Update(md5Param* mp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param mp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int md5Update (md5Param* mp, const byte* data, size_t size); /*!\fn int md5Digest(md5Param* mp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param mp The hash function's parameter block. * \param digest The place to store the 16-byte digest. * \retval 0 on success. */ BEECRYPTAPI int md5Digest (md5Param* mp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/api.h0000644000175000001440000000446211216515021014432 00000000000000/* * Copyright (c) 2001, 2002, 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file api.h * \brief BeeCrypt API, portability headers. * \author Bob Deblier */ #ifndef _BEECRYPT_API_H #define _BEECRYPT_API_H #if defined(_WIN32) && !defined(WIN32) # define WIN32 1 #endif #if WIN32 # if !__CYGWIN32__ && !__MINGW32__ # include "beecrypt/win.h" # else # include "beecrypt/gnu.h" # endif # ifdef BEECRYPT_DLL_EXPORT # define BEECRYPTAPI __declspec(dllexport) # else # define BEECRYPTAPI __declspec(dllimport) # endif # ifdef BEECRYPT_CXX_DLL_EXPORT # define BEECRYPTCXXAPI __declspec(dllexport) # define BEECRYPTCXXTEMPLATE # else # define BEECRYPTCXXAPI __declspec(dllimport) # define BEECRYPTCXXTEMPLATE extern # endif #else # include "beecrypt/gnu.h" # define BEECRYPTAPI # define BEECRYPTCXXAPI #endif #if HAVE_ASSERT_H # include #else # define assert(x) #endif #ifndef ROTL32 # define ROTL32(x, s) (((x) << (s)) | ((x) >> (32 - (s)))) #endif #ifndef ROTR32 # define ROTR32(x, s) (((x) >> (s)) | ((x) << (32 - (s)))) #endif #ifndef ROTR64 # define ROTR64(x, s) (((x) >> (s)) | ((x) << (64 - (s)))) #endif typedef uint8_t byte; #if JAVAGLUE # include #else typedef int8_t jbyte; typedef int16_t jshort; typedef int32_t jint; typedef int64_t jlong; typedef uint16_t jchar; typedef float jfloat; typedef double jdouble; #endif #if (MP_WBITS == 64) typedef uint64_t mpw; typedef uint32_t mphw; #elif (MP_WBITS == 32) # if HAVE_UINT64_T # define HAVE_MPDW 1 typedef uint64_t mpdw; # endif typedef uint32_t mpw; typedef uint16_t mphw; #else # error #endif #endif beecrypt-4.2.1/include/beecrypt/base64.h0000644000175000001440000000453511216147022014750 00000000000000/* * Copyright (c) 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file base64.h * \brief Base64 encoding and decoding, headers. * \author Bob Deblier */ #ifndef _BASE64_H #define _BASE64_H #include "beecrypt/beecrypt.h" /*!\ * Decode white space character set (default). */ extern const char* b64decode_whitespace; #define B64DECODE_WHITESPACE " \f\n\r\t\v" /*!\ * Encode 72 characters per line (default). */ extern int b64encode_chars_per_line; #define B64ENCODE_CHARS_PER_LINE 72 /*!\ * Encode end-of-line string (default). */ extern const char* b64encode_eolstr; #define B64ENCODE_EOLSTR "\n" #ifdef __cplusplus extern "C" { #endif /*! * Encode chunks of 3 bytes of binary input into 4 bytes of base64 output. * \param data binary data * \param ns no. bytes of data (0 uses strlen(data)) * \return (malloc'd) base64 string */ BEECRYPTAPI char* b64encode(const void* data, size_t ns); /*! * Encode crc of binary input data into 5 bytes of base64 output. * \param data binary data * \param ns no. bytes of binary data * \return (malloc'd) base64 string */ BEECRYPTAPI char* b64crc(const unsigned char* data, size_t ns); /*! * Decode chunks of 4 bytes of base64 input into 3 bytes of binary output. * \param s base64 string * \retval datap address of (malloc'd) binary data * \retval lenp address of no. bytes of binary data * \return 0 on success, 1: s == NULL, 2: bad length, 3: bad char */ BEECRYPTAPI int b64decode(const char* s, void** datap, size_t* lenp); /*! */ BEECRYPTAPI char* b64enc(const memchunk*); /*! */ BEECRYPTAPI memchunk* b64dec(const char*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/md4.h0000644000175000001440000000614411223573012014346 00000000000000/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file md4.h * \brief MD4 hash function. * \author Jeff Johnson * \author Bob Deblier * \ingroup HASH_m HASH_md4_m */ #ifndef _MD4_H #define _MD4_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the MD4 algorithm. * \ingroup HASH_md4_h */ #ifdef __cplusplus struct BEECRYPTAPI md4Param #else struct _md4Param #endif { /*!\var h */ uint32_t h[4]; /*!\var data */ uint32_t data[16]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[1]; #elif (MP_WBITS == 32) mpw length[2]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint32_t offset; }; #ifndef __cplusplus typedef struct _md4Param md4Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var md4 * \brief Holds the full API description of the MD4 algorithm. */ /*@unchecked@*/ /*@observer@*/ extern BEECRYPTAPI const hashFunction md4; /*!\fn int md4Reset(md4Param* mp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param mp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI void md4Process(md4Param* mp) /*@modifies mp @*/; /*!\fn int md4Reset(md4Param* mp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param mp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int md4Reset (md4Param* mp) /*@modifies mp @*/; /*!\fn int md4Update(md4Param* mp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param mp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int md4Update (md4Param* mp, const byte* data, size_t size) /*@modifies mp @*/; /*!\fn int md4Digest(md4Param* mp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param mp The hash function's parameter block. * \param digest The place to store the 16-byte digest. * \retval 0 on success. */ BEECRYPTAPI int md4Digest (md4Param* mp, byte* digest) /*@modifies mp digest @*/; #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/blowfishopt.h0000644000175000001440000000371711216147022016225 00000000000000/* * Copyright (c) 2000, 2002, 2003 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file blowfishopt.h * \brief Blowfish block cipher, assembler-optimized routines, headers. * \author Bob Deblier * \ingroup BC_blowfish_m */ #ifndef _BLOWFISHOPT_H #define _BLOWFISHOPT_H #include "beecrypt/beecrypt.h" #include "beecrypt/blowfish.h" #ifdef __cplusplus extern "C" { #endif #if WIN32 # if defined(_MSC_VER) && defined(_M_IX86) # define ASM_BLOWFISHENCRYPT # define ASM_BLOWFISHDECRYPT # elif __INTEL__ && __MWERKS__ # define ASM_BLOWFISHENCRYPT # define ASM_BLOWFISHDECRYPT # endif #endif #if defined(__GNUC__) # if defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686) # define ASM_BLOWFISHENCRYPT # define ASM_BLOWFISHDECRYPT # endif # if defined(OPTIMIZE_POWERPC) # define ASM_BLOWFISHENCRYPT # define ASM_BLOWFISHDECRYPT # endif #endif #if defined(__IBMC__) # if defined(OPTIMIZE_POWERPC) # define ASM_BLOWFISHENCRYPT # define ASM_BLOWFISHDECRYPT # endif #endif #if defined(__INTEL_COMPILER) # if defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686) # define ASM_BLOWFISHENCRYPT # define ASM_BLOWFISHDECRYPT # endif #endif #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* nothing here yet */ #endif #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/pkcs1.h0000644000175000001440000000246011216147022014700 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file pkcs1.h * \brief PKCS#1 utility routines * \author Bob Deblier * \ingroup PKCS1_m */ #ifndef _PKCS1_H #define _PKCS1_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus extern "C" { #endif /*!\brief This function computes the digest, and encodes it it according to PKCS#1 for signing * \param ctxt The hash function context * \param emdata * \param emsize */ BEECRYPTAPI int pkcs1_emsa_encode_digest(hashFunctionContext* ctxt, byte* emdata, size_t emsize); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/sha2k64.h0000644000175000001440000000220511216102377015042 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha2k64.h * \brief SHA-512 and SHA-384 shared constants, headers. * \author Bob Deblier * \ingroup HASH_sha512_m HASH_sha384_m */ #ifndef _SHA2K64_H #define _SHA2K64_H #include "beecrypt/beecrypt.h" #ifdef __cplusplus extern "C" { #endif extern BEECRYPTAPI const uint64_t SHA2_64BIT_K[80]; #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/rsakp.h0000644000175000001440000000420511216147022014776 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file rsakp.h * \brief RSA keypair, headers. * \author Bob Deblier * \ingroup IF_m IF_rsa_m */ #ifndef _RSAKP_H #define _RSAKP_H #include "beecrypt/rsapk.h" /*!\brief RSA keypair. * \ingroup IF_rsa_m */ #ifdef __cplusplus struct BEECRYPTAPI rsakp #else struct _rsakp #endif { /*!\var n * \brief The modulus. * * \f$n=pq\f$ */ mpbarrett n; /*!\var e * \brief The public exponent. */ mpnumber e; /*!\var d * \brief The private exponent. */ mpnumber d; /*!\var p * \brief The first prime factor of the modulus. */ mpbarrett p; /*!\var q * \brief The second prime factor of the modulus. */ mpbarrett q; /*!\var dp * \brief the first prime coefficient. * \f$dp=d\ \textrm{mod}\ (p-1)\f$ */ mpnumber dp; /*!\var dq * \brief the second prime coefficient. * \f$dq=d\ \textrm{mod}\ (q-1)\f$ */ mpnumber dq; /*!\var qi * \brief the crt coefficient. * \f$qi=q^{-1}\ \textrm{mod}\ p\f$ */ mpnumber qi; #ifdef __cplusplus rsakp(); rsakp(const rsakp&); ~rsakp(); #endif }; #ifndef __cplusplus typedef struct _rsakp rsakp; #endif #ifdef __cplusplus extern "C" { #endif BEECRYPTAPI int rsakpMake(rsakp*, randomGeneratorContext*, size_t); BEECRYPTAPI int rsakpInit(rsakp*); BEECRYPTAPI int rsakpFree(rsakp*); BEECRYPTAPI int rsakpCopy(rsakp*, const rsakp*); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/beecrypt/ripemd320.h0000644000175000001440000000624011223566203015370 00000000000000/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file ripemd320.h * \brief RIPEMD-320 hash function, headers. * \author Jeff Johnson * \author Bob Deblier * \ingroup HASH_m HASH_rmd320_m */ #ifndef _RIPEMD320_H #define _RIPEMD320_H #include "beecrypt/beecrypt.h" /*!\brief Holds all the parameters necessary for the RIPEMD-160 algorithm. * \ingroup HASH_rmd320_m */ #ifdef __cplusplus struct BEECRYPTAPI ripemd320Param #else struct _ripemd320Param #endif { /*!\var h */ uint32_t h[10]; /*!\var data */ uint32_t data[16]; /*!\var length * \brief Multi-precision integer counter for the bits that have been * processed so far. */ #if (MP_WBITS == 64) mpw length[1]; #elif (MP_WBITS == 32) mpw length[2]; #else # error #endif /*!\var offset * \brief Offset into \a data; points to the place where new data will be * copied before it is processed. */ uint32_t offset; }; #ifndef __cplusplus typedef struct _ripemd320Param ripemd320Param; #endif #ifdef __cplusplus extern "C" { #endif /*!\var ripemd320 * \brief Holds the full API description of the RIPEMD-160 algorithm. */ extern BEECRYPTAPI const hashFunction ripemd320; /*!\fn void ripemd320Process(ripemd320Param* mp) * \brief This function performs the core of the RIPEMD-160 hash algorithm; it * processes a block of 64 bytes. * \param mp The hash function's parameter block. */ BEECRYPTAPI void ripemd320Process(ripemd320Param* mp); /*!\fn int ripemd320Reset(ripemd320Param* mp) * \brief This function resets the parameter block so that it's ready for a * new hash. * \param mp The hash function's parameter block. * \retval 0 on success. */ BEECRYPTAPI int ripemd320Reset (ripemd320Param* mp); /*!\fn int ripemd320Update(ripemd320Param* mp, const byte* data, size_t size) * \brief This function should be used to pass successive blocks of data * to be hashed. * \param mp The hash function's parameter block. * \param data * \param size * \retval 0 on success. */ BEECRYPTAPI int ripemd320Update (ripemd320Param* mp, const byte* data, size_t size); /*!\fn int ripemd320Digest(ripemd320Param* mp, byte* digest) * \brief This function finishes the current hash computation and copies * the digest value into \a digest. * \param mp The hash function's parameter block. * \param digest The place to store the 20-byte digest. * \retval 0 on success. */ BEECRYPTAPI int ripemd320Digest (ripemd320Param* mp, byte* digest); #ifdef __cplusplus } #endif #endif beecrypt-4.2.1/include/Makefile.am0000644000175000001440000002776111226133164013743 00000000000000nobase_include_HEADERS = \ beecrypt/aes.h \ beecrypt/aesopt.h \ beecrypt/api.h \ beecrypt/base64.h \ beecrypt/beecrypt.h \ beecrypt/blockmode.h \ beecrypt/blockpad.h \ beecrypt/blowfish.h \ beecrypt/blowfishopt.h \ beecrypt/dhies.h \ beecrypt/dldp.h \ beecrypt/dlkp.h \ beecrypt/dlpk.h \ beecrypt/dlsvdp-dh.h \ beecrypt/dsa.h \ beecrypt/elgamal.h \ beecrypt/endianness.h \ beecrypt/entropy.h \ beecrypt/fips186.h \ beecrypt/gnu.h \ beecrypt/hmac.h \ beecrypt/hmacmd5.h \ beecrypt/hmacsha1.h \ beecrypt/hmacsha224.h \ beecrypt/hmacsha256.h \ beecrypt/hmacsha384.h \ beecrypt/hmacsha512.h \ beecrypt/md4.h \ beecrypt/md5.h \ beecrypt/memchunk.h \ beecrypt/mpbarrett.h \ beecrypt/mp.h \ beecrypt/mpnumber.h \ beecrypt/mpopt.h \ beecrypt/mpprime.h \ beecrypt/mtprng.h \ beecrypt/pkcs12.h \ beecrypt/pkcs1.h \ beecrypt/ripemd128.h \ beecrypt/ripemd160.h \ beecrypt/ripemd256.h \ beecrypt/ripemd320.h \ beecrypt/rsa.h \ beecrypt/rsakp.h \ beecrypt/rsapk.h \ beecrypt/sha1.h \ beecrypt/sha1opt.h \ beecrypt/sha224.h \ beecrypt/sha256.h \ beecrypt/sha384.h \ beecrypt/sha512.h \ beecrypt/sha2k32.h \ beecrypt/sha2k64.h \ beecrypt/timestamp.h \ beecrypt/win.h if WITH_CPLUSPLUS nobase_include_HEADERS += \ beecrypt/c++/array.h \ beecrypt/c++/mutex.h \ \ beecrypt/c++/beeyond/AnyEncodedKeySpec.h \ beecrypt/c++/beeyond/BeeCertificate.h \ beecrypt/c++/beeyond/BeeCertPath.h \ beecrypt/c++/beeyond/BeeCertPathParameters.h \ beecrypt/c++/beeyond/BeeCertPathValidatorResult.h \ beecrypt/c++/beeyond/BeeEncodedKeySpec.h \ beecrypt/c++/beeyond/BeeInputStream.h \ beecrypt/c++/beeyond/BeeOutputStream.h \ beecrypt/c++/beeyond/DHIESDecryptParameterSpec.h \ beecrypt/c++/beeyond/DHIESParameterSpec.h \ beecrypt/c++/beeyond/PKCS12PBEKey.h \ \ beecrypt/c++/crypto/BadPaddingException.h \ beecrypt/c++/crypto/Cipher.h \ beecrypt/c++/crypto/CipherSpi.h \ beecrypt/c++/crypto/IllegalBlockSizeException.h \ beecrypt/c++/crypto/KeyAgreement.h \ beecrypt/c++/crypto/KeyAgreementSpi.h \ beecrypt/c++/crypto/Mac.h \ beecrypt/c++/crypto/MacInputStream.h \ beecrypt/c++/crypto/MacOutputStream.h \ beecrypt/c++/crypto/MacSpi.h \ beecrypt/c++/crypto/NoSuchPaddingException.h \ beecrypt/c++/crypto/NullCipher.h \ beecrypt/c++/crypto/SecretKeyFactory.h \ beecrypt/c++/crypto/SecretKeyFactorySpi.h \ beecrypt/c++/crypto/SecretKey.h \ \ beecrypt/c++/crypto/interfaces/DHKey.h \ beecrypt/c++/crypto/interfaces/DHParams.h \ beecrypt/c++/crypto/interfaces/DHPrivateKey.h \ beecrypt/c++/crypto/interfaces/DHPublicKey.h \ beecrypt/c++/crypto/interfaces/PBEKey.h \ \ beecrypt/c++/crypto/spec/DHParameterSpec.h \ beecrypt/c++/crypto/spec/DHPrivateKeySpec.h \ beecrypt/c++/crypto/spec/DHPublicKeySpec.h \ beecrypt/c++/crypto/spec/IvParameterSpec.h \ beecrypt/c++/crypto/spec/PBEKeySpec.h \ beecrypt/c++/crypto/spec/SecretKeySpec.h \ \ beecrypt/c++/io/ByteArrayInputStream.h \ beecrypt/c++/io/ByteArrayOutputStream.h \ beecrypt/c++/io/Closeable.h \ beecrypt/c++/io/DataInput.h \ beecrypt/c++/io/DataInputStream.h \ beecrypt/c++/io/DataOutput.h \ beecrypt/c++/io/DataOutputStream.h \ beecrypt/c++/io/EOFException.h \ beecrypt/c++/io/FileInputStream.h \ beecrypt/c++/io/FileOutputStream.h \ beecrypt/c++/io/FilterInputStream.h \ beecrypt/c++/io/FilterOutputStream.h \ beecrypt/c++/io/Flushable.h \ beecrypt/c++/io/InputStream.h \ beecrypt/c++/io/IOException.h \ beecrypt/c++/io/OutputStream.h \ beecrypt/c++/io/PrintStream.h \ beecrypt/c++/io/PushbackInputStream.h \ beecrypt/c++/io/Writer.h \ \ beecrypt/c++/lang/Appendable.h \ beecrypt/c++/lang/ArithmeticException.h \ beecrypt/c++/lang/Character.h \ beecrypt/c++/lang/CharSequence.h \ beecrypt/c++/lang/ClassCastException.h \ beecrypt/c++/lang/Cloneable.h \ beecrypt/c++/lang/CloneNotSupportedException.h \ beecrypt/c++/lang/Comparable.h \ beecrypt/c++/lang/Error.h \ beecrypt/c++/lang/Exception.h \ beecrypt/c++/lang/IllegalArgumentException.h \ beecrypt/c++/lang/IllegalMonitorStateException.h \ beecrypt/c++/lang/IllegalStateException.h \ beecrypt/c++/lang/IllegalThreadStateException.h \ beecrypt/c++/lang/IndexOutOfBoundsException.h \ beecrypt/c++/lang/Integer.h \ beecrypt/c++/lang/InterruptedException.h \ beecrypt/c++/lang/Long.h \ beecrypt/c++/lang/NullPointerException.h \ beecrypt/c++/lang/Number.h \ beecrypt/c++/lang/NumberFormatException.h \ beecrypt/c++/lang/Object.h \ beecrypt/c++/lang/OutOfMemoryError.h \ beecrypt/c++/lang/Runnable.h \ beecrypt/c++/lang/RuntimeException.h \ beecrypt/c++/lang/StringBuffer.h \ beecrypt/c++/lang/StringBuilder.h \ beecrypt/c++/lang/String.h \ beecrypt/c++/lang/System.h \ beecrypt/c++/lang/Thread.h \ beecrypt/c++/lang/Throwable.h \ beecrypt/c++/lang/UnsupportedOperationException.h \ \ beecrypt/c++/math/BigInteger.h \ \ beecrypt/c++/nio/Buffer.h \ beecrypt/c++/nio/ByteBuffer.h \ beecrypt/c++/nio/ByteOrder.h \ beecrypt/c++/nio/InvalidMarkException.h \ beecrypt/c++/nio/ReadOnlyBufferException.h \ \ beecrypt/c++/security/AlgorithmParameterGenerator.h \ beecrypt/c++/security/AlgorithmParameterGeneratorSpi.h \ beecrypt/c++/security/AlgorithmParameters.h \ beecrypt/c++/security/AlgorithmParametersSpi.h \ beecrypt/c++/security/DigestInputStream.h \ beecrypt/c++/security/DigestOutputStream.h \ beecrypt/c++/security/GeneralSecurityException.h \ beecrypt/c++/security/InvalidAlgorithmParameterException.h \ beecrypt/c++/security/InvalidKeyException.h \ beecrypt/c++/security/InvalidParameterException.h \ beecrypt/c++/security/KeyException.h \ beecrypt/c++/security/KeyFactory.h \ beecrypt/c++/security/KeyFactorySpi.h \ beecrypt/c++/security/Key.h \ beecrypt/c++/security/KeyPairGenerator.h \ beecrypt/c++/security/KeyPairGeneratorSpi.h \ beecrypt/c++/security/KeyPair.h \ beecrypt/c++/security/KeyStoreException.h \ beecrypt/c++/security/KeyStore.h \ beecrypt/c++/security/KeyStoreSpi.h \ beecrypt/c++/security/MessageDigest.h \ beecrypt/c++/security/MessageDigestSpi.h \ beecrypt/c++/security/NoSuchAlgorithmException.h \ beecrypt/c++/security/NoSuchProviderException.h \ beecrypt/c++/security/PrivateKey.h \ beecrypt/c++/security/ProviderException.h \ beecrypt/c++/security/Provider.h \ beecrypt/c++/security/PublicKey.h \ beecrypt/c++/security/SecureRandom.h \ beecrypt/c++/security/SecureRandomSpi.h \ beecrypt/c++/security/Security.h \ beecrypt/c++/security/ShortBufferException.h \ beecrypt/c++/security/SignatureException.h \ beecrypt/c++/security/Signature.h \ beecrypt/c++/security/SignatureSpi.h \ \ beecrypt/c++/security/auth/Destroyable.h \ beecrypt/c++/security/auth/DestroyFailedException.h \ \ beecrypt/c++/security/cert/CertificateEncodingException.h \ beecrypt/c++/security/cert/CertificateException.h \ beecrypt/c++/security/cert/CertificateExpiredException.h \ beecrypt/c++/security/cert/CertificateFactory.h \ beecrypt/c++/security/cert/CertificateFactorySpi.h \ beecrypt/c++/security/cert/Certificate.h \ beecrypt/c++/security/cert/CertificateNotYetValidException.h \ beecrypt/c++/security/cert/CertPath.h \ beecrypt/c++/security/cert/CertPathParameters.h \ beecrypt/c++/security/cert/CertPathValidatorException.h \ beecrypt/c++/security/cert/CertPathValidator.h \ beecrypt/c++/security/cert/CertPathValidatorResult.h \ beecrypt/c++/security/cert/CertPathValidatorSpi.h \ \ beecrypt/c++/security/interfaces/DSAKey.h \ beecrypt/c++/security/interfaces/DSAParams.h \ beecrypt/c++/security/interfaces/DSAPrivateKey.h \ beecrypt/c++/security/interfaces/DSAPublicKey.h \ beecrypt/c++/security/interfaces/ECKey.h \ beecrypt/c++/security/interfaces/ECPrivateKey.h \ beecrypt/c++/security/interfaces/ECPublicKey.h \ beecrypt/c++/security/interfaces/RSAKey.h \ beecrypt/c++/security/interfaces/RSAPrivateCrtKey.h \ beecrypt/c++/security/interfaces/RSAPrivateKey.h \ beecrypt/c++/security/interfaces/RSAPublicKey.h \ \ beecrypt/c++/security/spec/AlgorithmParameterSpec.h \ beecrypt/c++/security/spec/DSAParameterSpec.h \ beecrypt/c++/security/spec/DSAPrivateKeySpec.h \ beecrypt/c++/security/spec/DSAPublicKeySpec.h \ beecrypt/c++/security/spec/EncodedKeySpec.h \ beecrypt/c++/security/spec/InvalidKeySpecException.h \ beecrypt/c++/security/spec/InvalidParameterSpecException.h \ beecrypt/c++/security/spec/KeySpec.h \ beecrypt/c++/security/spec/RSAKeyGenParameterSpec.h \ beecrypt/c++/security/spec/RSAPrivateCrtKeySpec.h \ beecrypt/c++/security/spec/RSAPrivateKeySpec.h \ beecrypt/c++/security/spec/RSAPublicKeySpec.h \ beecrypt/c++/security/UnrecoverableKeyException.h \ \ beecrypt/c++/util/AbstractCollection.h \ beecrypt/c++/util/AbstractList.h \ beecrypt/c++/util/AbstractMap.h \ beecrypt/c++/util/AbstractSet.h \ beecrypt/c++/util/ArrayList.h \ beecrypt/c++/util/Collection.h \ beecrypt/c++/util/ConcurrentModificationException.h \ beecrypt/c++/util/Date.h \ beecrypt/c++/util/Enumeration.h \ beecrypt/c++/util/Hashtable.h \ beecrypt/c++/util/Iterable.h \ beecrypt/c++/util/Iterator.h \ beecrypt/c++/util/List.h \ beecrypt/c++/util/ListIterator.h \ beecrypt/c++/util/Map.h \ beecrypt/c++/util/NoSuchElementException.h \ beecrypt/c++/util/Properties.h \ beecrypt/c++/util/Queue.h \ beecrypt/c++/util/RandomAccess.h \ beecrypt/c++/util/Set.h \ \ beecrypt/c++/util/concurrent/Callable.h \ \ beecrypt/c++/util/concurrent/locks/Condition.h \ beecrypt/c++/util/concurrent/locks/Lock.h \ beecrypt/c++/util/concurrent/locks/ReentrantLock.h endif noinst_HEADERS = \ beecrypt/aes_be.h \ beecrypt/aes_le.h \ \ beecrypt/c++/adapter.h \ beecrypt/c++/posix.h \ beecrypt/c++/resource.h \ \ beecrypt/c++/provider/AESCipher.h \ beecrypt/c++/provider/BaseProvider.h \ beecrypt/c++/provider/BeeCertificateFactory.h \ beecrypt/c++/provider/BeeCertPathValidator.h \ beecrypt/c++/provider/BeeKeyFactory.h \ beecrypt/c++/provider/BeeKeyStore.h \ beecrypt/c++/provider/BeeSecureRandom.h \ beecrypt/c++/provider/BlockCipher.h \ beecrypt/c++/provider/BlowfishCipher.h \ beecrypt/c++/provider/DHIESCipher.h \ beecrypt/c++/provider/DHIESParameters.h \ beecrypt/c++/provider/DHKeyAgreement.h \ beecrypt/c++/provider/DHKeyFactory.h \ beecrypt/c++/provider/DHKeyPairGenerator.h \ beecrypt/c++/provider/DHParameterGenerator.h \ beecrypt/c++/provider/DHParameters.h \ beecrypt/c++/provider/DHPrivateKeyImpl.h \ beecrypt/c++/provider/DHPublicKeyImpl.h \ beecrypt/c++/provider/DSAKeyFactory.h \ beecrypt/c++/provider/DSAKeyPairGenerator.h \ beecrypt/c++/provider/DSAParameterGenerator.h \ beecrypt/c++/provider/DSAParameters.h \ beecrypt/c++/provider/DSAPrivateKeyImpl.h \ beecrypt/c++/provider/DSAPublicKeyImpl.h \ beecrypt/c++/provider/HMAC.h \ beecrypt/c++/provider/HMACMD5.h \ beecrypt/c++/provider/HMACSHA1.h \ beecrypt/c++/provider/HMACSHA256.h \ beecrypt/c++/provider/HMACSHA384.h \ beecrypt/c++/provider/HMACSHA512.h \ beecrypt/c++/provider/KeyProtector.h \ beecrypt/c++/provider/MD5Digest.h \ beecrypt/c++/provider/MD5withRSASignature.h \ beecrypt/c++/provider/PKCS12KeyFactory.h \ beecrypt/c++/provider/PKCS1RSASignature.h \ beecrypt/c++/provider/RSAKeyFactory.h \ beecrypt/c++/provider/RSAKeyPairGenerator.h \ beecrypt/c++/provider/RSAPrivateCrtKeyImpl.h \ beecrypt/c++/provider/RSAPrivateKeyImpl.h \ beecrypt/c++/provider/RSAPublicKeyImpl.h \ beecrypt/c++/provider/SHA1Digest.h \ beecrypt/c++/provider/SHA1withDSASignature.h \ beecrypt/c++/provider/SHA1withRSASignature.h \ beecrypt/c++/provider/SHA256Digest.h \ beecrypt/c++/provider/SHA224Digest.h \ beecrypt/c++/provider/SHA256withRSASignature.h \ beecrypt/c++/provider/SHA384Digest.h \ beecrypt/c++/provider/SHA384withRSASignature.h \ beecrypt/c++/provider/SHA512Digest.h \ beecrypt/c++/provider/SHA512withRSASignature.h \ \ beecrypt/java/beecrypt_provider_AES.h \ beecrypt/java/beecrypt_provider_DHKeyPairGenerator.h \ beecrypt/java/beecrypt_provider_HMACMD5.h \ beecrypt/java/beecrypt_provider_HMACSHA1.h \ beecrypt/java/beecrypt_provider_HMACSHA256.h \ beecrypt/java/beecrypt_provider_HMACSHA384.h \ beecrypt/java/beecrypt_provider_HMACSHA512.h \ beecrypt/java/beecrypt_provider_MD4.h \ beecrypt/java/beecrypt_provider_MD5.h \ beecrypt/java/beecrypt_provider_RSAKeyPairGenerator.h \ beecrypt/java/beecrypt_provider_SHA1.h \ beecrypt/java/beecrypt_provider_SHA224.h \ beecrypt/java/beecrypt_provider_SHA256.h \ beecrypt/java/beecrypt_provider_SHA384.h \ beecrypt/java/beecrypt_provider_SHA512.h \ beecrypt/java/beecrypt_tools.h \ \ beecrypt/python \ beecrypt/python/mpw-py.h \ beecrypt/python/rng-py.h EXTRA_DIST = beecrypt/Doxyheader beecrypt/c++/Doxyheader beecrypt-4.2.1/hmacsha1.c0000644000175000001440000000365511216147021012105 00000000000000/* * Copyright (c) 1999, 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha1.c * \brief HMAC-SHA-1 message authentication code. * * \see RFC2202 - Test Cases for HMAC-MD5 and HMAC-SHA-1. * P. Cheng, R. Glenn. * * \author Bob Deblier * \ingroup HMAC_m HMAC_sha1_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha1.h" /*!\addtogroup HMAC_sha1_m * \{ */ const keyedHashFunction hmacsha1 = { "HMAC-SHA-1", sizeof(hmacsha1Param), 64, 20, 64, 512, 32, (keyedHashFunctionSetup) hmacsha1Setup, (keyedHashFunctionReset) hmacsha1Reset, (keyedHashFunctionUpdate) hmacsha1Update, (keyedHashFunctionDigest) hmacsha1Digest }; int hmacsha1Setup (hmacsha1Param* sp, const byte* key, size_t keybits) { return hmacSetup(sp->kxi, sp->kxo, &sha1, &sp->sparam, key, keybits); } int hmacsha1Reset (hmacsha1Param* sp) { return hmacReset(sp->kxi, &sha1, &sp->sparam); } int hmacsha1Update(hmacsha1Param* sp, const byte* data, size_t size) { return hmacUpdate(&sha1, &sp->sparam, data, size); } int hmacsha1Digest(hmacsha1Param* sp, byte* data) { return hmacDigest(sp->kxo, &sha1, &sp->sparam, data); } /*!\} */ beecrypt-4.2.1/CONTRIBUTORS0000644000175000001440000000262611217165466012147 00000000000000I would like to thank the following people (in alphabetical order): - Seth Arnold, for contributing to the documentation. - Daniel Black, (former) maintainer of the Gentoo GNU/Linux BeeCrypt package. - Jan-Rudolph Bührmann, for helping me get started on the 64-bit multi- precision integer library. - Luca Filipozzi, (former) maintainer/packager of BeeCrypt for Debian GNU/Linux. - Jeff Johnson, the guy behind RedHat's Package Manager, who has inspired and contributed to many of the changes for version 3.0.0. He also provided the new hash functions for version 4.2.0. 73 de Bob. - Anibal Monsalve Salazar, (current) maintainer/packager of BeeCrypt for Debian GNU/Linux. - Jon Sturgeon, bug hunter extraordinaire. Further thanks go to: - AMD, for donating a copy of "AMD x86-64 Architecture Programmer's Manual". - ARM Ltd, for donating a copy of "ARM Architecture Reference Manual". - HP/Compaq, for their testdrive program, which gave me the opportunity to test and BeeCrypt on many new platforms. - FSF France, for providing me with access to the GCC Compile Farm. - SourceForge, for their excellent open source development platform. Last but not least: thanks to everyone who provided bits of information, reported bugs, provided feedback, or works on including BeeCrypt in any other distros. If I've missed anyone, it's due to oversight. Drop me a line and I'll rectify the situation as quickly as possible. beecrypt-4.2.1/config.guess0000755000175000001440000013274111225166714012605 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2009-02-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown if [ "${UNAME_SYSTEM}" = "Linux" ] ; then eval $set_cc_for_build cat << EOF > $dummy.c #include #ifdef __UCLIBC__ # ifdef __UCLIBC_CONFIG_VERSION__ LIBC=uclibc __UCLIBC_CONFIG_VERSION__ # else LIBC=uclibc # endif #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'` fi # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd | genuineintel) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo cris-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo frv-unknown-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld" exit ;; esac # This should get integrated into the C code below, but now we hack if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: beecrypt-4.2.1/Makefile.in0000644000175000001440000010074411226307162012323 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am contains the top-level automake definitions # # Copyright (c) 2001, 2002, 2004 X-Way Rights BV # Copyright (c) 2009 Bob Deblier # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # 1. No interfaces changes (good): Increment REVISION # # 2. Interfaces added, none removed (good): Increment CURRENT, increment AGE and REVISION to 0. # # 3. Interfaces removed (bad): Increment CURRENT, set AGE and REVISION to 0. # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @WITH_CPLUSPLUS_TRUE@am__append_1 = c++ @WITH_JAVA_TRUE@am__append_2 = java @WITH_PYTHON_TRUE@am__append_3 = python subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/config.m4.in $(srcdir)/gnu.h.in \ $(top_srcdir)/configure \ $(top_srcdir)/include/beecrypt/Doxyfile.in \ $(top_srcdir)/include/beecrypt/c++/Doxyfile.in AUTHORS COPYING \ COPYING.LIB ChangeLog INSTALL NEWS config.guess config.sub \ depcomp install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = config.m4 include/beecrypt/Doxyfile \ include/beecrypt/c++/Doxyfile gnu.h CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = am_libbeecrypt_la_OBJECTS = aes.lo base64.lo beecrypt.lo blockmode.lo \ blockpad.lo blowfish.lo dhies.lo dldp.lo dlkp.lo dlpk.lo \ dlsvdp-dh.lo dsa.lo elgamal.lo endianness.lo entropy.lo \ fips186.lo hmac.lo hmacmd5.lo hmacsha1.lo hmacsha224.lo \ hmacsha256.lo md4.lo md5.lo hmacsha384.lo hmacsha512.lo \ memchunk.lo mp.lo mpbarrett.lo mpnumber.lo mpprime.lo \ mtprng.lo pkcs1.lo pkcs12.lo ripemd128.lo ripemd160.lo \ ripemd256.lo ripemd320.lo rsa.lo rsakp.lo rsapk.lo sha1.lo \ sha224.lo sha256.lo sha384.lo sha512.lo sha2k32.lo sha2k64.lo \ timestamp.lo cppglue.lo libbeecrypt_la_OBJECTS = $(am_libbeecrypt_la_OBJECTS) libbeecrypt_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(libbeecrypt_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libbeecrypt_la_SOURCES) DIST_SOURCES = $(libbeecrypt_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = . include tests docs gas masm c++ java python DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBBEECRYPT_LT_CURRENT = 7 LIBBEECRYPT_LT_AGE = 0 LIBBEECRYPT_LT_REVISION = 0 AUTOMAKE_OPTIONS = gnu check-news no-dependencies SUBDIRS = . include $(MAYBE_SUB) tests docs gas masm $(am__append_1) \ $(am__append_2) $(am__append_3) SUFFIXES = .s AM_CFLAGS = $(OPENMP_CFLAGS) INCLUDES = -I$(top_srcdir)/include BEECRYPT_OBJECTS = aes.lo base64.lo beecrypt.lo blockmode.lo blockpad.lo blowfish.lo blowfishopt.lo dhies.lo dldp.lo dlkp.lo dlpk.lo dlsvdp-dh.lo dsa.lo elgamal.lo endianness.lo entropy.lo fips186.lo hmac.lo hmacmd5.lo hmacsha1.lo hmacsha224.lo hmacsha256.lo md4.lo md5.lo memchunk.lo mp.lo mpopt.lo mpbarrett.lo mpnumber.lo mpprime.lo mtprng.lo pkcs1.lo pkcs12.lo ripemd128.lo ripemd160.lo ripemd256.lo ripemd320.lo rsa.lo rsakp.lo rsapk.lo sha1.lo sha1opt.lo sha256.lo sha384.lo sha512.lo sha2k32.lo sha2k64.lo timestamp.lo lib_LTLIBRARIES = libbeecrypt.la libbeecrypt_la_SOURCES = aes.c base64.c beecrypt.c blockmode.c blockpad.c blowfish.c dhies.c dldp.c dlkp.c dlpk.c dlsvdp-dh.c dsa.c elgamal.c endianness.c entropy.c fips186.c hmac.c hmacmd5.c hmacsha1.c hmacsha224.c hmacsha256.c md4.c md5.c hmacsha384.c hmacsha512.c memchunk.c mp.c mpbarrett.c mpnumber.c mpprime.c mtprng.c pkcs1.c pkcs12.c ripemd128.c ripemd160.c ripemd256.c ripemd320.c rsa.c rsakp.c rsapk.c sha1.c sha224.c sha256.c sha384.c sha512.c sha2k32.c sha2k64.c timestamp.c cppglue.cxx libbeecrypt_la_DEPENDENCIES = $(BEECRYPT_OBJECTS) libbeecrypt_la_LIBADD = blowfishopt.lo mpopt.lo sha1opt.lo $(OPENMP_LIBS) libbeecrypt_la_LDFLAGS = -no-undefined -version-info $(LIBBEECRYPT_LT_CURRENT):$(LIBBEECRYPT_LT_REVISION):$(LIBBEECRYPT_LT_AGE) EXTRA_DIST = BENCHMARKS BUGS CONTRIBUTORS README.WIN32 autogen.sh DISTCLEANFILES = mpopt.s blowfishopt.s sha1opt.s all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .s .c .cxx .lo .o .obj am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 config.m4: $(top_builddir)/config.status $(srcdir)/config.m4.in cd $(top_builddir) && $(SHELL) ./config.status $@ include/beecrypt/Doxyfile: $(top_builddir)/config.status $(top_srcdir)/include/beecrypt/Doxyfile.in cd $(top_builddir) && $(SHELL) ./config.status $@ include/beecrypt/c++/Doxyfile: $(top_builddir)/config.status $(top_srcdir)/include/beecrypt/c++/Doxyfile.in cd $(top_builddir) && $(SHELL) ./config.status $@ gnu.h: $(top_builddir)/config.status $(srcdir)/gnu.h.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libbeecrypt.la: $(libbeecrypt_la_OBJECTS) $(libbeecrypt_la_DEPENDENCIES) $(libbeecrypt_la_LINK) -rpath $(libdir) $(libbeecrypt_la_OBJECTS) $(libbeecrypt_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c .c.o: $(COMPILE) -c $< .c.obj: $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: $(LTCOMPILE) -c -o $@ $< .cxx.o: $(CXXCOMPILE) -c -o $@ $< .cxx.obj: $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @case `sed 15q $(srcdir)/NEWS` in \ *"$(VERSION)"*) : ;; \ *) \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1;; \ esac $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags ctags-recursive dist \ dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-libLTLIBRARIES \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ uninstall-libLTLIBRARIES .s.lo: $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< bench: (cd tests && $(MAKE) $(AM_MAKEFLAGS) bench) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/hmacmd5.c0000644000175000001440000000361611216147021011733 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacmd5.c * \brief HMAC-MD5 message authentication code. * * \see RFC2202 - Test Cases for HMAC-MD5 and HMAC-SHA-1. * P. Cheng, R. Glenn. * * \author Bob Deblier * \ingroup HMAC_m HMAC_md5_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacmd5.h" /*!\addtogroup HMAC_md5_m * \{ */ const keyedHashFunction hmacmd5 = { "HMAC-MD5", sizeof(hmacmd5Param), 64, 16, 64, 512, 32, (keyedHashFunctionSetup) hmacmd5Setup, (keyedHashFunctionReset) hmacmd5Reset, (keyedHashFunctionUpdate) hmacmd5Update, (keyedHashFunctionDigest) hmacmd5Digest }; int hmacmd5Setup (hmacmd5Param* sp, const byte* key, size_t keybits) { return hmacSetup(sp->kxi, sp->kxo, &md5, &sp->mparam, key, keybits); } int hmacmd5Reset (hmacmd5Param* sp) { return hmacReset(sp->kxi, &md5, &sp->mparam); } int hmacmd5Update(hmacmd5Param* sp, const byte* data, size_t size) { return hmacUpdate(&md5, &sp->mparam, data, size); } int hmacmd5Digest(hmacmd5Param* sp, byte* data) { return hmacDigest(sp->kxo, &md5, &sp->mparam, data); } /*!\} */ beecrypt-4.2.1/sha224.c0000644000175000001440000002013611216402362011416 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha224.c * \brief SHA-224 hash function, as specified by IETF RFC-3874. * \author Bob Deblier * \ingroup HASH_m HASH_sha224_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha224.h" #include "beecrypt/sha2k32.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_sha224_m * \{ */ static const uint32_t hinit[8] = { 0xc1059ed8U, 0x367cd507U, 0x3070dd17U, 0xf70e5939U, 0xffc00b31U, 0x68581511U, 0x64f98fa7U, 0xbefa4fa4U }; const hashFunction sha224 = { .name = "SHA-224", .paramsize = sizeof(sha224Param), .blocksize = 64, .digestsize = 24, .reset = (hashFunctionReset) sha224Reset, .update = (hashFunctionUpdate) sha224Update, .digest = (hashFunctionDigest) sha224Digest }; int sha224Reset(register sha224Param* sp) { memcpy(sp->h, hinit, 8 * sizeof(uint32_t)); memset(sp->data, 0, 64 * sizeof(uint32_t)); #if (MP_WBITS == 64) mpzero(1, sp->length); #elif (MP_WBITS == 32) mpzero(2, sp->length); #else # error #endif sp->offset = 0; return 0; } #define R(x,s) ((x) >> (s)) #define S(x,s) ROTR32(x, s) #define CH(x,y,z) ((x&(y^z))^z) #define MAJ(x,y,z) (((x|y)&z)|(x&y)) #define SIG0(x) (S(x,2) ^ S(x,13) ^ S(x,22)) #define SIG1(x) (S(x,6) ^ S(x,11) ^ S(x,25)) #define sig0(x) (S(x,7) ^ S(x,18) ^ R(x,3)) #define sig1(x) (S(x,17) ^ S(x,19) ^ R(x,10)) #define ROUND(a,b,c,d,e,f,g,h,w,k) \ temp = h + SIG1(e) + CH(e,f,g) + k + w; \ h = temp + SIG0(a) + MAJ(a,b,c); \ d += temp #ifndef ASM_SHA224PROCESS void sha224Process(register sha224Param* sp) { register uint32_t a, b, c, d, e, f, g, h, temp; register uint32_t *w; register const uint32_t *k; register byte t; #if WORDS_BIGENDIAN w = sp->data + 16; #else w = sp->data; t = 16; while (t--) { temp = swapu32(*w); *(w++) = temp; } #endif t = 48; while (t--) { temp = sig1(w[-2]) + w[-7] + sig0(w[-15]) + w[-16]; *(w++) = temp; } w = sp->data; a = sp->h[0]; b = sp->h[1]; c = sp->h[2]; d = sp->h[3]; e = sp->h[4]; f = sp->h[5]; g = sp->h[6]; h = sp->h[7]; k = SHA2_32BIT_K; ROUND(a,b,c,d,e,f,g,h,w[ 0],k[ 0]); ROUND(h,a,b,c,d,e,f,g,w[ 1],k[ 1]); ROUND(g,h,a,b,c,d,e,f,w[ 2],k[ 2]); ROUND(f,g,h,a,b,c,d,e,w[ 3],k[ 3]); ROUND(e,f,g,h,a,b,c,d,w[ 4],k[ 4]); ROUND(d,e,f,g,h,a,b,c,w[ 5],k[ 5]); ROUND(c,d,e,f,g,h,a,b,w[ 6],k[ 6]); ROUND(b,c,d,e,f,g,h,a,w[ 7],k[ 7]); ROUND(a,b,c,d,e,f,g,h,w[ 8],k[ 8]); ROUND(h,a,b,c,d,e,f,g,w[ 9],k[ 9]); ROUND(g,h,a,b,c,d,e,f,w[10],k[10]); ROUND(f,g,h,a,b,c,d,e,w[11],k[11]); ROUND(e,f,g,h,a,b,c,d,w[12],k[12]); ROUND(d,e,f,g,h,a,b,c,w[13],k[13]); ROUND(c,d,e,f,g,h,a,b,w[14],k[14]); ROUND(b,c,d,e,f,g,h,a,w[15],k[15]); ROUND(a,b,c,d,e,f,g,h,w[16],k[16]); ROUND(h,a,b,c,d,e,f,g,w[17],k[17]); ROUND(g,h,a,b,c,d,e,f,w[18],k[18]); ROUND(f,g,h,a,b,c,d,e,w[19],k[19]); ROUND(e,f,g,h,a,b,c,d,w[20],k[20]); ROUND(d,e,f,g,h,a,b,c,w[21],k[21]); ROUND(c,d,e,f,g,h,a,b,w[22],k[22]); ROUND(b,c,d,e,f,g,h,a,w[23],k[23]); ROUND(a,b,c,d,e,f,g,h,w[24],k[24]); ROUND(h,a,b,c,d,e,f,g,w[25],k[25]); ROUND(g,h,a,b,c,d,e,f,w[26],k[26]); ROUND(f,g,h,a,b,c,d,e,w[27],k[27]); ROUND(e,f,g,h,a,b,c,d,w[28],k[28]); ROUND(d,e,f,g,h,a,b,c,w[29],k[29]); ROUND(c,d,e,f,g,h,a,b,w[30],k[30]); ROUND(b,c,d,e,f,g,h,a,w[31],k[31]); ROUND(a,b,c,d,e,f,g,h,w[32],k[32]); ROUND(h,a,b,c,d,e,f,g,w[33],k[33]); ROUND(g,h,a,b,c,d,e,f,w[34],k[34]); ROUND(f,g,h,a,b,c,d,e,w[35],k[35]); ROUND(e,f,g,h,a,b,c,d,w[36],k[36]); ROUND(d,e,f,g,h,a,b,c,w[37],k[37]); ROUND(c,d,e,f,g,h,a,b,w[38],k[38]); ROUND(b,c,d,e,f,g,h,a,w[39],k[39]); ROUND(a,b,c,d,e,f,g,h,w[40],k[40]); ROUND(h,a,b,c,d,e,f,g,w[41],k[41]); ROUND(g,h,a,b,c,d,e,f,w[42],k[42]); ROUND(f,g,h,a,b,c,d,e,w[43],k[43]); ROUND(e,f,g,h,a,b,c,d,w[44],k[44]); ROUND(d,e,f,g,h,a,b,c,w[45],k[45]); ROUND(c,d,e,f,g,h,a,b,w[46],k[46]); ROUND(b,c,d,e,f,g,h,a,w[47],k[47]); ROUND(a,b,c,d,e,f,g,h,w[48],k[48]); ROUND(h,a,b,c,d,e,f,g,w[49],k[49]); ROUND(g,h,a,b,c,d,e,f,w[50],k[50]); ROUND(f,g,h,a,b,c,d,e,w[51],k[51]); ROUND(e,f,g,h,a,b,c,d,w[52],k[52]); ROUND(d,e,f,g,h,a,b,c,w[53],k[53]); ROUND(c,d,e,f,g,h,a,b,w[54],k[54]); ROUND(b,c,d,e,f,g,h,a,w[55],k[55]); ROUND(a,b,c,d,e,f,g,h,w[56],k[56]); ROUND(h,a,b,c,d,e,f,g,w[57],k[57]); ROUND(g,h,a,b,c,d,e,f,w[58],k[58]); ROUND(f,g,h,a,b,c,d,e,w[59],k[59]); ROUND(e,f,g,h,a,b,c,d,w[60],k[60]); ROUND(d,e,f,g,h,a,b,c,w[61],k[61]); ROUND(c,d,e,f,g,h,a,b,w[62],k[62]); ROUND(b,c,d,e,f,g,h,a,w[63],k[63]); sp->h[0] += a; sp->h[1] += b; sp->h[2] += c; sp->h[3] += d; sp->h[4] += e; sp->h[5] += f; sp->h[6] += g; sp->h[7] += h; } #endif int sha224Update(register sha224Param* sp, const byte* data, size_t size) { register uint32_t proclength; #if (MP_WBITS == 64) mpw add[1]; mpsetw(1, add, size); mplshift(1, add, 3); mpadd(1, sp->length, add); #elif (MP_WBITS == 32) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); mpadd(2, sp->length, add); #else # error #endif while (size > 0) { proclength = ((sp->offset + size) > 64U) ? (64U - sp->offset) : size; memcpy(((byte *) sp->data) + sp->offset, data, proclength); size -= proclength; data += proclength; sp->offset += proclength; if (sp->offset == 64U) { sha224Process(sp); sp->offset = 0; } } return 0; } static void sha224Finish(register sha224Param* sp) { register byte *ptr = ((byte *) sp->data) + sp->offset++; *(ptr++) = 0x80; if (sp->offset > 56) { while (sp->offset++ < 64) *(ptr++) = 0; sha224Process(sp); sp->offset = 0; } ptr = ((byte *) sp->data) + sp->offset; while (sp->offset++ < 56) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[0] = (byte)(sp->length[0] >> 56); ptr[1] = (byte)(sp->length[0] >> 48); ptr[2] = (byte)(sp->length[0] >> 40); ptr[3] = (byte)(sp->length[0] >> 32); ptr[4] = (byte)(sp->length[0] >> 24); ptr[5] = (byte)(sp->length[0] >> 16); ptr[6] = (byte)(sp->length[0] >> 8); ptr[7] = (byte)(sp->length[0] ); #elif (MP_WBITS == 32) ptr[0] = (byte)(sp->length[0] >> 24); ptr[1] = (byte)(sp->length[0] >> 16); ptr[2] = (byte)(sp->length[0] >> 8); ptr[3] = (byte)(sp->length[0] ); ptr[4] = (byte)(sp->length[1] >> 24); ptr[5] = (byte)(sp->length[1] >> 16); ptr[6] = (byte)(sp->length[1] >> 8); ptr[7] = (byte)(sp->length[1] ); #else # error #endif sha224Process(sp); sp->offset = 0; } int sha224Digest(register sha224Param* sp, byte* data) { sha224Finish(sp); /* encode 8 integers big-endian style */ data[ 0] = (byte)(sp->h[0] >> 24); data[ 1] = (byte)(sp->h[0] >> 16); data[ 2] = (byte)(sp->h[0] >> 8); data[ 3] = (byte)(sp->h[0] >> 0); data[ 4] = (byte)(sp->h[1] >> 24); data[ 5] = (byte)(sp->h[1] >> 16); data[ 6] = (byte)(sp->h[1] >> 8); data[ 7] = (byte)(sp->h[1] >> 0); data[ 8] = (byte)(sp->h[2] >> 24); data[ 9] = (byte)(sp->h[2] >> 16); data[10] = (byte)(sp->h[2] >> 8); data[11] = (byte)(sp->h[2] >> 0); data[12] = (byte)(sp->h[3] >> 24); data[13] = (byte)(sp->h[3] >> 16); data[14] = (byte)(sp->h[3] >> 8); data[15] = (byte)(sp->h[3] >> 0); data[16] = (byte)(sp->h[4] >> 24); data[17] = (byte)(sp->h[4] >> 16); data[18] = (byte)(sp->h[4] >> 8); data[19] = (byte)(sp->h[4] >> 0); data[20] = (byte)(sp->h[5] >> 24); data[21] = (byte)(sp->h[5] >> 16); data[22] = (byte)(sp->h[5] >> 8); data[23] = (byte)(sp->h[5] >> 0); data[24] = (byte)(sp->h[6] >> 24); data[25] = (byte)(sp->h[6] >> 16); data[26] = (byte)(sp->h[6] >> 8); data[27] = (byte)(sp->h[6] >> 0); sha224Reset(sp); return 0; } /*!\} */ beecrypt-4.2.1/configure0000775000175000001440000345243311226307163012200 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for beecrypt 4.2.1. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac ECHO=${lt_ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF $* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='beecrypt' PACKAGE_TARNAME='beecrypt' PACKAGE_VERSION='4.2.1' PACKAGE_STRING='beecrypt 4.2.1' PACKAGE_BUGREPORT='bob.deblier@telenet.be' ac_unique_file="include/beecrypt/beecrypt.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS MP_WBITS TYPEDEF_UINT64_T TYPEDEF_UINT32_T TYPEDEF_UINT16_T TYPEDEF_UINT8_T TYPEDEF_INT64_T TYPEDEF_INT32_T TYPEDEF_INT16_T TYPEDEF_INT8_T INCLUDE_STDINT_H INCLUDE_INTTYPES_H TYPEDEF_SIZE_T ASM_ALIGN ASM_LSYM_PREFIX ASM_GSYM_PREFIX ASM_GLOBL ASM_TEXTSEG ASM_GNU_STACK ASM_BIGENDIAN ASM_ARCH ASM_CPU ASM_OS PYTHONLIB PYTHONINC WITH_PYTHON_FALSE WITH_PYTHON_TRUE PYTHON WITH_JAVA_FALSE WITH_JAVA_TRUE ac_cv_have_javah ac_cv_have_javac ac_cv_have_java javac ac_cv_have_gcjh ac_cv_have_gcj WITH_CPLUSPLUS_FALSE WITH_CPLUSPLUS_TRUE LIBOBJS TYPEDEF_BC_THREADID_T TYPEDEF_BC_THREAD_T TYPEDEF_BC_MUTEX_T TYPEDEF_BC_COND_T INCLUDE_SCHED_H INCLUDE_SEMAPHORE_H INCLUDE_PTHREAD_H INCLUDE_THREAD_H INCLUDE_SYNCH_H INCLUDE_DLFCN_H INCLUDE_UNISTD_H INCLUDE_STRING_H INCLUDE_MALLOC_H INCLUDE_STDLIB_H INCLUDE_STDIO_H OPENMP_LIBS OPENMP_CXXFLAGS OPENMP_CFLAGS OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL lt_ECHO RANLIB AR OBJDUMP NM ac_ct_DUMPBIN DUMPBIN LIBTOOL LN_S LD FGREP SED am__fastdepCCAS_FALSE am__fastdepCCAS_TRUE CCASDEPMODE CCASFLAGS CCAS CXXCPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_expert_mode enable_debug with_cpu with_arch enable_threads enable_aio with_mtmalloc with_cplusplus with_java with_python enable_dependency_tracking with_gnu_ld enable_shared enable_static with_pic enable_fast_install enable_libtool_lock enable_openmp ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC CXXCPP CCAS CCASFLAGS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { $as_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { $as_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { $as_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures beecrypt 4.2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/beecrypt] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of beecrypt 4.2.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-expert-mode follow user-defined CFLAGS settings [default=no] --enable-debug creates debugging code [default=no] --enable-threads enables multithread support [default=yes] --enable-aio enables asynchronous i/o for entropy gathering [default=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-openmp do not use OpenMP Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-cpu optimize for specific cpu --with-arch optimize for specific architecture (may not run on other cpus of same family) --with-mtmalloc links against the mtmalloc library [default=no] --with-cplusplus creates the C++ API code [default=yes] --with-java creates the Java glue code [default=yes] --with-python[=ARG] creates the Python module [default=yes]; you can optionally specify the python executable --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor CCAS assembler compiler command (defaults to CC) CCASFLAGS assembler compiler flags (defaults to CFLAGS) Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF beecrypt configure 4.2.1 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by beecrypt $as_me 4.2.1, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 $as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 $as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; then $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 $as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 $as_echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:$LINENO: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; then $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 $as_echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:$LINENO: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if test "${ac_cv_target+set}" = set; then $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 $as_echo "$as_me: error: invalid value of canonical target" >&2;} { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- ac_config_headers="$ac_config_headers config.h" am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) { { $as_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5 $as_echo "$as_me: error: unsafe absolute working directory name" >&2;} { (exit 1); exit 1; }; };; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5 $as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;} { (exit 1); exit 1; }; };; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 $as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 $as_echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 $as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='beecrypt' VERSION='4.2.1' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # Checks for AWK - used by expert mode for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done # Checks for package options # Check whether --enable-expert-mode was given. if test "${enable_expert_mode+set}" = set; then enableval=$enable_expert_mode; ac_enable_expert_mode=yes else if test "X$CFLAGS" != "X"; then echo "enabling expert mode" ac_enable_expert_mode=yes else ac_enable_expert_mode=no fi fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; if test "$ac_enable_expert_mode" = yes; then { { $as_echo "$as_me:$LINENO: error: --enable-debug cannot be used in conjunction with --enable-expert-mode" >&5 $as_echo "$as_me: error: --enable-debug cannot be used in conjunction with --enable-expert-mode" >&2;} { (exit 1); exit 1; }; } fi ac_enable_debug=yes else ac_enable_debug=no fi # Check whether --with-cpu was given. if test "${with_cpu+set}" = set; then withval=$with_cpu; A if test "$ac_enable_expert_mode" = yes; then { { $as_echo "$as_me:$LINENO: error: --with-cpu cannot be used in conjunction with --enable-expert-mode" >&5 $as_echo "$as_me: error: --with-cpu cannot be used in conjunction with --enable-expert-mode" >&2;} { (exit 1); exit 1; }; } fi ac_with_cpu=yes bc_target_cpu=$withval case $target_cpu in i[3456]86) case $withval in i[3456]86 | \ pentium | pentium-m | pentium-mmx | pentiumpro | pentium[234] | \ athlon | athlon-tbird | athlon-4 | athlon-xp | athlon-mp | athlon-fx | athlon64 | k8) ;; *) { $as_echo "$as_me:$LINENO: WARNING: invalid cpu type" >&5 $as_echo "$as_me: WARNING: invalid cpu type" >&2;} bc_target_cpu=$target_cpu ;; esac ;; powerpc | powerpc64) case $withval in 403 | 505 | \ 60[1234] | 60[34]e | 6[23]0 | \ 7[45]0 | 74[05]0 | \ 801 | 82[13] | 860 | \ power | power2 | powerpc | powerpc64) ;; *) { $as_echo "$as_me:$LINENO: WARNING: invalid cpu type" >&5 $as_echo "$as_me: WARNING: invalid cpu type" >&2;} bc_target_cpu=$target_cpu ;; esac ;; sparc | sparc64) case $withval in sparcv8 | sparcv8plus | sparcv8plusa | sparcv9 | sparcv9a) ;; *) { $as_echo "$as_me:$LINENO: WARNING: invalid cpu type" >&5 $as_echo "$as_me: WARNING: invalid cpu type" >&2;} bc_target_cpu=$target_cpu ;; esac ;; x86) # QNX Neutrino doesn't list the exact cpu type case $withval in i[3456]86) ;; *) { $as_echo "$as_me:$LINENO: WARNING: unsupported or invalid cpu type" >&5 $as_echo "$as_me: WARNING: unsupported or invalid cpu type" >&2;} bc_target_cpu=$target_cpu ;; esac ;; *) { $as_echo "$as_me:$LINENO: WARNING: unsupported or invalid cpu type" >&5 $as_echo "$as_me: WARNING: unsupported or invalid cpu type" >&2;} bc_target_cpu=$target_cpu ;; esac else ac_with_cpu=no bc_target_cpu=$target_cpu fi # Check whether --with-arch was given. if test "${with_arch+set}" = set; then withval=$with_arch; if test "$ac_enable_expert_mode" = yes; then { { $as_echo "$as_me:$LINENO: error: --with-arch cannot be used in conjunction with --enable-expert-mode" >&5 $as_echo "$as_me: error: --with-arch cannot be used in conjunction with --enable-expert-mode" >&2;} { (exit 1); exit 1; }; } fi ac_with_arch=yes bc_target_arch=$withval case $target_cpu in i[3456]86) case $withval in em64t | \ i[3456]86 | \ pentium | pentium-m | pentium-mmx | pentiumpro | pentium[234] | \ athlon | athlon-tbird | athlon-4 | athlon-xp | athlon-mp | athlon64 | k8) if test "$ac_with_cpu" != yes; then bc_target_arch=$withval fi ;; esac ;; powerpc*) case $withval in powerpc) ;; powerpc64) ;; *) { $as_echo "$as_me:$LINENO: WARNING: unsupported on invalid arch type" >&5 $as_echo "$as_me: WARNING: unsupported on invalid arch type" >&2;} bc_target_arch=powerpc ;; esac ;; esac else # if bc_target_arch hasn't been set (i.e. by expert mode) if test "X$bc_target_arch" = "X"; then ac_with_arch=no case $target_cpu in alpha*) bc_target_arch=alpha ;; arm*) bc_target_arch=arm ;; i[3456]86) bc_target_arch=i386 ;; ia64) bc_target_arch=ia64 ;; m68k) bc_target_arch=m68k ;; powerpc) bc_target_arch=powerpc ;; powerpc64) bc_target_arch=powerpc64 ;; s390x) bc_target_arch=s390x ;; sparc*) bc_target_arch=sparc ;; x86_64) bc_target_arch=x86_64 ;; esac fi fi # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then enableval=$enable_threads; if test "$enableval" = no; then ac_enable_threads=no else ac_enable_threads=yes fi else ac_enable_threads=yes fi # Check whether --enable-aio was given. if test "${enable_aio+set}" = set; then enableval=$enable_aio; if test "$enableval" = no; then ac_enable_aio=no else ac_enable_aio=yes fi else ac_enable_aio=yes fi # Check whether --with-mtmalloc was given. if test "${with_mtmalloc+set}" = set; then withval=$with_mtmalloc; if test "$withval" = no; then ac_with_mtmalloc=no else ac_with_mtmalloc=yes fi else ac_with_mtmalloc=no fi # Check whether --with-cplusplus was given. if test "${with_cplusplus+set}" = set; then withval=$with_cplusplus; if test "$withval" = no; then ac_with_cplusplus=no else ac_with_cplusplus=yes fi else ac_with_cplusplus=yes fi # Check whether --with-java was given. if test "${with_java+set}" = set; then withval=$with_java; if test "$withval" = no; then ac_with_java=no else ac_with_java=yes fi else ac_with_java=yes fi # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; if test "$withval" = no; then ac_with_python=no else ac_with_python=yes ac_with_python_val=$withval fi else ac_with_python_val=`which python` if test "X$ac_with_python_val" = "X"; then ac_with_python=no else ac_with_python=yes fi fi # Check for expert mode if test "$ac_enable_expert_mode" = yes; then # try to get the architecture from CFLAGS bc_target_arch=`echo $CFLAGS | awk '{for (i=1; i<=NF; i++) if (substr($i,0,7)=="-march=") print substr($i,8)}'` # examine the other flags for flag in `echo $CFLAGS` do case $flag in -mmmx) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_MMX" ;; -msse) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SSE" ;; -msse2) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SSE2" ;; -msse3) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SSE3" ;; esac done fi # Check for aggressive optimization if test "$CFLAGS" = ""; then bc_cv_c_aggressive_opt=yes else bc_cv_c_aggressive_opt=no fi if test "$CXXFLAGS" = ""; then bc_cv_cxx_aggressive_opt=yes else bc_cv_cxx_aggressive_opt=no fi # Check for Unix variants DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:$LINENO: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { $as_echo "$as_me:$LINENO: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 $as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi fi fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "${ac_cv_header_minix_config_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 $as_echo_n "checking for minix/config.h... " >&6; } if test "${ac_cv_header_minix_config_h+set}" = set; then $as_echo_n "(cached) " >&6 fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 $as_echo "$ac_cv_header_minix_config_h" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5 $as_echo_n "checking minix/config.h usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5 $as_echo_n "checking minix/config.h presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to bob.deblier@telenet.be ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 $as_echo_n "checking for minix/config.h... " >&6; } if test "${ac_cv_header_minix_config_h+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_header_minix_config_h=$ac_header_preproc fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 $as_echo "$ac_cv_header_minix_config_h" >&6; } fi if test "x$ac_cv_header_minix_config_h" = x""yes; then MINIX=yes else MINIX= fi if test "$MINIX" = yes; then cat >>confdefs.h <<\_ACEOF #define _POSIX_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_1_SOURCE 2 _ACEOF cat >>confdefs.h <<\_ACEOF #define _MINIX 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if test "${ac_cv_safe_to_define___extensions__+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_safe_to_define___extensions__=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && cat >>confdefs.h <<\_ACEOF #define __EXTENSIONS__ 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _GNU_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _TANDEM_SOURCE 1 _ACEOF # Checks for C compiler and preprocessor ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:$LINENO: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:$LINENO: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # By default we simply use the C compiler to build assembly code. test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS depcc="$CCAS" am_compiler_list= { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CCAS_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CCAS_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CCAS_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CCAS_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_CCAS_dependencies_compiler_type" >&5 $as_echo "$am_cv_CCAS_dependencies_compiler_type" >&6; } CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then am__fastdepCCAS_TRUE= am__fastdepCCAS_FALSE='#' else am__fastdepCCAS_TRUE='#' am__fastdepCCAS_FALSE= fi { $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if test "${ac_cv_path_SED+set}" = set; then $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed $as_unset ac_script || ac_script= if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5 $as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:$LINENO: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if test "${ac_cv_path_FGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if test "${lt_cv_path_LD+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 $as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' case `pwd` in *\ * | *\ *) { $as_echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.2.6' macro_revision='1.3012' ltmain="$ac_aux_dir/ltmain.sh" { $as_echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test "${lt_cv_path_NM+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$ac_tool_prefix"; then for ac_prog in "dumpbin -symbols" "link -dump -symbols" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DUMPBIN+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:$LINENO: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in "dumpbin -symbols" "link -dump -symbols" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if test "${lt_cv_nm_interface+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:7709: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:7712: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:7715: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } # find the maximum length of command line arguments { $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if test "${lt_cv_sys_max_cmd_len+set}" = set; then $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:$LINENO: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:$LINENO: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if test "${lt_cv_ld_reload_flag+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OBJDUMP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:$LINENO: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if test "${lt_cv_deplibs_check_method+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AR+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:$LINENO: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_AR+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:$LINENO: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:$LINENO: result: ok" >&5 $as_echo "ok" >&6; } fi # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 8909 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if test "${lt_cv_cc_needs_belf+set}" = set; then $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then lt_cv_cc_needs_belf=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DSYMUTIL+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:$LINENO: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_NMEDIT+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:$LINENO: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_LIPO+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:$LINENO: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OTOOL+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:$LINENO: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OTOOL64+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:$LINENO: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:$LINENO: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if test "${lt_cv_apple_cc_single_mod+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if test "${lt_cv_ld_exported_symbols_list+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then lt_cv_ld_exported_symbols_list=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_ld_exported_symbols_list=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac for ac_header in dlfcn.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:$LINENO: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:$LINENO: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} _lt_caught_CXX_error=yes; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:$LINENO: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if test "${lt_cv_objdir+set}" = set; then $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:$LINENO: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:11012: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:11016: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= { $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 $as_echo "$lt_prog_compiler_pic" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if test "${lt_cv_prog_compiler_pic_works+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:11351: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:11355: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test "${lt_cv_prog_compiler_static_works+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:11456: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:11460: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:11511: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:11515: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:$LINENO: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat >conftest.$ac_ext <<_ACEOF int foo(void) {} _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 $as_echo "$archive_cmds_need_lc" >&6; } ;; esac fi ;; esac { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi # Handle Gentoo/FreeBSD as it was Linux case $host_vendor in gentoo) version_type=linux ;; *) version_type=freebsd-$objformat ;; esac case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; linux) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' need_lib_prefix=no need_version=no ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then shlibpath_overrides_runpath=yes fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_dl_dlopen=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = x""yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) { $as_echo "$as_me:$LINENO: checking for shl_load" >&5 $as_echo_n "checking for shl_load... " >&6; } if test "${ac_cv_func_shl_load+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_shl_load || defined __stub___shl_load choke me #endif int main () { return shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_shl_load=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 $as_echo "$ac_cv_func_shl_load" >&6; } if test "x$ac_cv_func_shl_load" = x""yes; then lt_cv_dlopen="shl_load" else { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if test "${ac_cv_lib_dld_shl_load+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_dld_shl_load=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = x""yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else { $as_echo "$as_me:$LINENO: checking for dlopen" >&5 $as_echo_n "checking for dlopen... " >&6; } if test "${ac_cv_func_dlopen+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_dlopen || defined __stub___dlopen choke me #endif int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_dlopen=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 $as_echo "$ac_cv_func_dlopen" >&6; } if test "x$ac_cv_func_dlopen" = x""yes; then lt_cv_dlopen="dlopen" else { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_dl_dlopen=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = x""yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if test "${ac_cv_lib_svld_dlopen+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_svld_dlopen=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = x""yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if test "${ac_cv_lib_dld_dld_link+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_dld_dld_link=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = x""yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if test "${lt_cv_dlopen_self+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line 14324 "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if test "${lt_cv_dlopen_self_static+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line 14420 "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:$LINENO: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if test "${lt_cv_path_LD+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 $as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec_CXX='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared # libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes allow_undefined_flag_CXX="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" if test "$lt_cv_apple_cc_single_mod" != "yes"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else ld_shlibs_CXX=no fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5]* | *pgcpp\ [1-5]*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 will use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; xl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=echo else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= { $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC*) # IBM XL 8.0 on PPC lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 $as_echo "$lt_prog_compiler_pic_CXX" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16440: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:16444: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16539: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:16543: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16591: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:16595: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:$LINENO: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' { $as_echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 $as_echo "$archive_cmds_need_lc_CXX" >&6; } ;; esac fi ;; esac { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi # Handle Gentoo/FreeBSD as it was Linux case $host_vendor in gentoo) version_type=linux ;; *) version_type=freebsd-$objformat ;; esac case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; linux) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' need_lib_prefix=no need_version=no ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then shlibpath_overrides_runpath=yes fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test "$hardcode_action_CXX" = relink || test "$inherit_rpath_CXX" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_commands="$ac_config_commands libtool" # Only expand once: # Checks for OpenMP support ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu OPENMP_CFLAGS= # Check whether --enable-openmp was given. if test "${enable_openmp+set}" = set; then enableval=$enable_openmp; fi if test "$enable_openmp" != no; then { $as_echo "$as_me:$LINENO: checking for $CC option to support OpenMP" >&5 $as_echo_n "checking for $CC option to support OpenMP... " >&6; } if test "${ac_cv_prog_c_openmp+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF #ifndef _OPENMP choke me #endif #include int main () { return omp_get_num_threads (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_prog_c_openmp='none needed' else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_c_openmp='unsupported' for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $ac_option" cat >conftest.$ac_ext <<_ACEOF #ifndef _OPENMP choke me #endif #include int main () { return omp_get_num_threads (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_prog_c_openmp=$ac_option else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$ac_save_CFLAGS if test "$ac_cv_prog_c_openmp" != unsupported; then break fi done fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_c_openmp" >&5 $as_echo "$ac_cv_prog_c_openmp" >&6; } case $ac_cv_prog_c_openmp in #( "none needed" | unsupported) ;; #( *) OPENMP_CFLAGS=$ac_cv_prog_c_openmp ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu OPENMP_CXXFLAGS= # Check whether --enable-openmp was given. if test "${enable_openmp+set}" = set; then enableval=$enable_openmp; fi if test "$enable_openmp" != no; then { $as_echo "$as_me:$LINENO: checking for $CC option to support OpenMP" >&5 $as_echo_n "checking for $CC option to support OpenMP... " >&6; } if test "${ac_cv_prog_cxx_openmp+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF #ifndef _OPENMP choke me #endif #include int main () { return omp_get_num_threads (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_prog_cxx_openmp='none needed' else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_openmp='unsupported' for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ac_option" cat >conftest.$ac_ext <<_ACEOF #ifndef _OPENMP choke me #endif #include int main () { return omp_get_num_threads (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_prog_cxx_openmp=$ac_option else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext CXXFLAGS=$ac_save_CXXFLAGS if test "$ac_cv_prog_cxx_openmp" != unsupported; then break fi done fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_openmp" >&5 $as_echo "$ac_cv_prog_cxx_openmp" >&6; } case $ac_cv_prog_cxx_openmp in #( "none needed" | unsupported) ;; #( *) OPENMP_CXXFLAGS=$ac_cv_prog_cxx_openmp ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Checks for compiler characteristics and flags if test "$ac_enable_expert_mode" = no; then # set flags for large file support case $target_os in linux* | solaris*) CPPFLAGS="$CPPFLAGS `getconf LFS_CFLAGS`" LDFLAGS="$LDFLAGS `getconf LFS_LDFLAGS`" ;; esac if test "$ac_cv_c_compiler_gnu" = yes; then # Intel's icc can be mistakenly identified as gcc case $target_os in linux*) { $as_echo "$as_me:$LINENO: checking whether we are using Intel C" >&5 $as_echo_n "checking whether we are using Intel C... " >&6; } if test "${bc_cv_prog_INTEL_CC+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __INTEL_COMPILER yes; #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then bc_cv_prog_INTEL_CC=yes else bc_cv_prog_INTEL_CC=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $bc_cv_prog_INTEL_CC" >&5 $as_echo "$bc_cv_prog_INTEL_CC" >&6; } if test "$bc_cv_prog_INTEL_CC" = yes; then if test "$ac_enable_debug" != yes; then if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-g"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in i586 | pentium | pentium-mmx) CFLAGS="$CFLAGS -mcpu=pentium" ;; i686 | pentiumpro | pentium[23]) CFLAGS="$CFLAGS -mcpu=pentiumpro" ;; pentium4 | pentium-m) CFLAGS="$CFLAGS -mcpu=pentium4" ;; esac case $bc_target_arch in i586 | pentium | pentium-mmx) CFLAGS="$CFLAGS -tpp5" ;; i686 | pentiumpro) CFLAGS="$CFLAGS -tpp6 -march=pentiumpro" ;; pentium2) CFLAGS="$CFLAGS -tpp6 -march=pentiumii" ;; pentium3) CFLAGS="$CFLAGS -tpp6 -march=pentiumiii" ;; pentium4 | pentium-m) CFLAGS="$CFLAGS -tpp7 -march=pentium4" ;; esac fi fi { $as_echo "$as_me:$LINENO: checking for _rotl" >&5 $as_echo_n "checking for _rotl... " >&6; } if test "${ac_cv_func__rotl+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define _rotl to an innocuous variant, in case declares _rotl. For example, HP-UX 11i declares gettimeofday. */ #define _rotl innocuous__rotl /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _rotl (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef _rotl /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _rotl (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub__rotl || defined __stub____rotl choke me #endif int main () { return _rotl (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func__rotl=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__rotl=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func__rotl" >&5 $as_echo "$ac_cv_func__rotl" >&6; } { $as_echo "$as_me:$LINENO: checking for _rotr" >&5 $as_echo_n "checking for _rotr... " >&6; } if test "${ac_cv_func__rotr+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define _rotr to an innocuous variant, in case declares _rotr. For example, HP-UX 11i declares gettimeofday. */ #define _rotr innocuous__rotr /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _rotr (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef _rotr /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _rotr (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub__rotr || defined __stub____rotr choke me #endif int main () { return _rotr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func__rotr=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__rotr=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func__rotr" >&5 $as_echo "$ac_cv_func__rotr" >&6; } if test "$OPENMP_CFLAGS" != ""; then OPENMP_LIBS="-liomp5" fi fi ;; esac if test "$bc_cv_prog_INTEL_CC" != yes; then if test "$OPENMP_CFLAGS" != ""; then OPENMP_LIBS="-lgomp" fi case $bc_target_arch in x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona) CC="$CC -m64" ;; i[3456]86 | \ pentium* | \ athlon*) CC="$CC -m32" CCAS="$CCAS -m32" ;; ia64) case $target_os in # HP/UX on Itanium needs to be told that a long is 64-bit! hpux*) CFLAGS="$CFLAGS -mlp64" ;; esac ;; # PowerPC needs a signed char powerpc) CFLAGS="$CFLAGS -fsigned-char" ;; powerpc64) CFLAGS="$CFLAGS -fsigned-char" case $target_os in aix*) CC="$CC -maix64" ;; linux*) CC="$CC -m64" ;; esac ;; sparc | sparcv8*) CC="$CC -m32" ;; sparc64 | sparcv9*) CC="$CC -m64" ;; esac # Certain platforms needs special flags for multi-threaded code if test "$ac_enable_threads" = yes; then case $target_os in freebsd*) CFLAGS="$CFLAGS -pthread" CPPFLAGS="$CPPFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ;; osf*) CFLAGS="$CFLAGS -pthread" CPPFLAGS="$CPPFLAGS -pthread" ;; esac fi if test "$ac_enable_debug" = yes; then if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-O2"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi CFLAGS="$CFLAGS -Wall -pedantic" else case $bc_target_arch in i[3456]86 | \ pentium | pentium-m | pentium-mmx | pentiumpro | pentium[234] | \ athlon | athlon-tbird | athlon-4 | athlon-xp | athlon-mp) { $as_echo "$as_me:$LINENO: checking if gcc supports -mtune option" >&5 $as_echo_n "checking if gcc supports -mtune option... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int x; _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then bc_cv_gcc_mtune=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 bc_cv_gcc_mtune=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: result: $bc_cv_gcc_mtune" >&5 $as_echo "$bc_cv_gcc_mtune" >&6; } ;; esac # Generic optimizations, including cpu tuning if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-g"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi CFLAGS="$CFLAGS -DNDEBUG" if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in athlon64 | athlon-fx | k8 | opteron) # CFLAGS="$CFLAGS -mtune=k8" # -O3 degrades performance # -mcpu=athlon64 degrades performance ;; alpha*) if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-O2"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi CFLAGS="$CFLAGS -O3" ;; athlon*) if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-O2"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_gcc_mtune" = yes; then CFLAGS="$CFLAGS -O3 -mtune=pentiumpro" else CFLAGS="$CFLAGS -O3 -mcpu=pentiumpro" fi ;; i586) if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-O2"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_gcc_mtune" = yes; then CFLAGS="$CFLAGS -O3 -mtune=pentium" else CFLAGS="$CFLAGS -O3 -mcpu=pentium" fi ;; i686) if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-O2"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_gcc_mtune" = yes; then CFLAGS="$CFLAGS -O3 -mtune=pentiumpro" else CFLAGS="$CFLAGS -O3 -mcpu=pentiumpro" fi ;; ia64) # no -mcpu=... option on ia64 ;; pentium*) if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-O2"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_gcc_mtune" = yes; then CFLAGS="$CFLAGS -O3 -mtune=$bc_target_arch" else CFLAGS="$CFLAGS -O3 -mcpu=$bc_target_arch" fi ;; powerpc*) ;; esac # Architecture-specific optimizations case $bc_target_arch in athlon64) CFLAGS="$CFLAGS -march=k8" # -march=athlon64 degrades performance # -msse2 also doesn't help ;; athlon*) CFLAGS="$CFLAGS -march=$bc_target_arch -mmmx" ;; em64t) CFLAGS="$CFLAGS -march=em64t" ;; i586 | pentium) CFLAGS="$CFLAGS -march=pentium" ;; i686 | pentiumpro) CFLAGS="$CFLAGS -march=pentiumpro" ;; pentium-m) CFLAGS="$CFLAGS -march=pentium-m -msse2" ;; pentium-mmx) CFLAGS="$CFLAGS -march=pentium-mmx -mmmx" ;; pentium2) CFLAGS="$CFLAGS -march=pentium2 -mmmx" ;; pentium3) CFLAGS="$CFLAGS -march=pentium3 -msse" ;; pentium4) CFLAGS="$CFLAGS -march=pentium4 -msse2" ;; powerpc | powerpc64) CFLAGS="$CFLAGS -mcpu=$bc_target_arch" ;; sparcv8) CFLAGS="$CFLAGS -mcpu=v8" ;; sparcv8plus) CFLAGS="$CFLAGS -mcpu=v9" ;; sparcv8plusa | sparcv9 | sparcv9a) CFLAGS="$CFLAGS -mcpu=ultrasparc" ;; esac fi fi fi else case $target_os in aix*) { $as_echo "$as_me:$LINENO: checking whether we are using IBM C" >&5 $as_echo_n "checking whether we are using IBM C... " >&6; } if test "${bc_cv_prog_IBM_CC+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __IBMC__ yes; #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then bc_cv_prog_IBM_CC=yes else bc_cv_prog_IBM_CC=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $bc_cv_prog_IBM_CC" >&5 $as_echo "$bc_cv_prog_IBM_CC" >&6; } if test "$bc_cv_prog_IBM_CC" = yes; then case $bc_target_arch in powerpc) CC="$CC -q32 -qarch=ppc" ;; powerpc64) CC="$CC -q64 -qarch=ppc64" ;; esac if test "$ac_enable_debug" != yes; then if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-g"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_c_aggressive_opt" = yes; then if test "$ac_with_arch" = yes; then CFLAGS="$CFLAGS -O5" else CFLAGS="$CFLAGS -O3" fi fi fi # Version 5.0 doesn't have this, but 6.0 does { $as_echo "$as_me:$LINENO: checking for __rotatel4" >&5 $as_echo_n "checking for __rotatel4... " >&6; } if test "${ac_cv_func___rotatel4+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define __rotatel4 to an innocuous variant, in case declares __rotatel4. For example, HP-UX 11i declares gettimeofday. */ #define __rotatel4 innocuous___rotatel4 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char __rotatel4 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef __rotatel4 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char __rotatel4 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub___rotatel4 || defined __stub_____rotatel4 choke me #endif int main () { return __rotatel4 (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func___rotatel4=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func___rotatel4=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func___rotatel4" >&5 $as_echo "$ac_cv_func___rotatel4" >&6; } fi ;; hpux*) if test "$ac_enable_debug" != yes; then if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-g"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_c_aggressive_opt" = yes; then CFLAGS="$CFLAGS -fast" fi fi ;; linux*) { $as_echo "$as_me:$LINENO: checking whether we are using Intel C" >&5 $as_echo_n "checking whether we are using Intel C... " >&6; } if test "${bc_cv_prog_INTEL_CC+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __INTEL_COMPILER yes; #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then bc_cv_prog_INTEL_CC=yes else bc_cv_prog_INTEL_CC=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $bc_cv_prog_INTEL_CC" >&5 $as_echo "$bc_cv_prog_INTEL_CC" >&6; } if test "$bc_cv_prog_INTEL_CC" = yes; then if test "$ac_enable_debug" != yes; then if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-g"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in i586 | pentium | pentium-mmx) CFLAGS="$CFLAGS -mcpu=pentium" ;; i686 | pentiumpro | pentium[23]) CFLAGS="$CFLAGS -mcpu=pentiumpro" ;; pentium4 | pentium-m) CFLAGS="$CFLAGS -mcpu=pentium4" ;; esac case $bc_target_arch in i586 | pentium | pentium-mmx) CFLAGS="$CFLAGS -tpp5" ;; i686 | pentiumpro) CFLAGS="$CFLAGS -tpp6 -march=pentiumpro" ;; pentium2) CFLAGS="$CFLAGS -tpp6 -march=pentiumii" ;; pentium3) CFLAGS="$CFLAGS -tpp6 -march=pentiumiii" ;; pentium4 | pentium-m) CFLAGS="$CFLAGS -tpp7 -march=pentium4" ;; esac fi fi { $as_echo "$as_me:$LINENO: checking for _rotl" >&5 $as_echo_n "checking for _rotl... " >&6; } if test "${ac_cv_func__rotl+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define _rotl to an innocuous variant, in case declares _rotl. For example, HP-UX 11i declares gettimeofday. */ #define _rotl innocuous__rotl /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _rotl (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef _rotl /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _rotl (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub__rotl || defined __stub____rotl choke me #endif int main () { return _rotl (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func__rotl=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__rotl=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func__rotl" >&5 $as_echo "$ac_cv_func__rotl" >&6; } { $as_echo "$as_me:$LINENO: checking for _rotr" >&5 $as_echo_n "checking for _rotr... " >&6; } if test "${ac_cv_func__rotr+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define _rotr to an innocuous variant, in case declares _rotr. For example, HP-UX 11i declares gettimeofday. */ #define _rotr innocuous__rotr /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _rotr (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef _rotr /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _rotr (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub__rotr || defined __stub____rotr choke me #endif int main () { return _rotr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func__rotr=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__rotr=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func__rotr" >&5 $as_echo "$ac_cv_func__rotr" >&6; } if test "$OPENMP_CFLAGS" != ""; then OPENMP_LIBS="-liomp5" fi fi ;; solaris*) { $as_echo "$as_me:$LINENO: checking whether we are using Sun Forte C" >&5 $as_echo_n "checking whether we are using Sun Forte C... " >&6; } if test "${bc_cv_prog_SUN_FORTE_CC+set}" = set; then $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifdef __SUNPRO_C return 0; #else return 1; #endif ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bc_cv_prog_SUN_FORTE_CC=yes else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) bc_cv_prog_SUN_FORTE_CC=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $bc_cv_prog_SUN_FORTE_CC" >&5 $as_echo "$bc_cv_prog_SUN_FORTE_CC" >&6; } if test "$bc_cv_prog_SUN_FORTE_CC" = yes; then if test "$ac_enable_threads" = yes; then CFLAGS="$CFLAGS -mt" fi if test "$ac_enable_debug" != yes; then if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-g"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_c_aggressive_opt" = yes; then CFLAGS="$CFLAGS -fast" case $bc_target_arch in sparc) CFLAGS="$CFLAGS -m32 -xarch=generic" ;; sparcv8) CFLAGS="$CFLAGS -m32 -xarch=v8" ;; sparcv8plus*) CFLAGS="$CFLAGS -m32 -xarch=v8plus" ;; sparcv9*) CFLAGS="$CFLAGS -m64 -xarch=generic" ;; esac fi fi fi ;; osf*) { $as_echo "$as_me:$LINENO: checking whether we are using Compaq's C compiler" >&5 $as_echo_n "checking whether we are using Compaq's C compiler... " >&6; } if test "${bc_cv_prog_COMPAQ_CC+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __DECC yes; #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then bc_cv_prog_COMPAQ_CC=yes else bc_cv_prog_COMPAQ_CC=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $bc_cv_prog_COMPAQ_CC" >&5 $as_echo "$bc_cv_prog_COMPAQ_CC" >&6; } if test "$bc_cv_prog_COMPAQ_CC" = yes; then if test "$ac_enable_threads" = yes; then CFLAGS="$CFLAGS -pthread" CPPFLAGS="$CPPFLAGS -pthread" fi if test "$ac_enable_debug" != yes; then if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-g"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_c_aggressive_opt" = yes; then CFLAGS="$CFLAGS -fast" fi fi fi ;; esac fi if test "$ac_cv_cxx_compiler_gnu" = yes; then # Intel's icc can be mistakenly identified as gcc case $target_os in linux*) { $as_echo "$as_me:$LINENO: checking whether we are using Intel C++" >&5 $as_echo_n "checking whether we are using Intel C++... " >&6; } if test "${bc_cv_prog_INTEL_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __INTEL_COMPILER yes; #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then bc_cv_prog_INTEL_CXX=yes else bc_cv_prog_INTEL_CXX=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $bc_cv_prog_INTEL_CXX" >&5 $as_echo "$bc_cv_prog_INTEL_CXX" >&6; } if test "$bc_cv_prog_INTEL_CXX" = yes; then if test "$ac_enable_debug" != yes; then if test "$CXXFLAGS" != ""; then CXXFLAGS_save="" for flag in $CXXFLAGS do if test "$flag" != "-g"; then CXXFLAGS_save="$CXXFLAGS_save $flag" fi done CXXFLAGS="$CXXFLAGS_save" fi if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in i586 | pentium | pentium-mmx) CXXFLAGS="$CXXFLAGS -mcpu=pentium" ;; i686 | pentiumpro | pentium[23]) CXXFLAGS="$CXXFLAGS -mcpu=pentiumpro" ;; pentium4 | pentium-m) CXXFLAGS="$CXXFLAGS -mcpu=pentium4" ;; esac case $bc_target_arch in i586 | pentium | pentium-mmx) CXXFLAGS="$CXXFLAGS -tpp5" ;; i686 | pentiumpro) CXXFLAGS="$CXXFLAGS -tpp6 -march=pentiumpro" ;; pentium2) CXXFLAGS="$CXXFLAGS -tpp6 -march=pentiumii" ;; pentium3) CXXFLAGS="$CXXFLAGS -tpp6 -march=pentiumiii" ;; pentium4) CXXFLAGS="$CXXFLAGS -tpp7 -march=pentium4" ;; esac fi fi fi ;; esac if test "$bc_cv_prog_INTEL_CXX" != yes; then case $bc_target_arch in x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona | core2) CXX="$CXX -m64" ;; i[3456]86 | \ pentium* | \ athlon*) CXX="$CXX -m32" ;; ia64) case $target_os in # HP/UX on Itanium needs to be told that a long is 64-bit! hpux*) CXXFLAGS="$CXXFLAGS -mlp64" ;; esac ;; # PowerPC needs a signed char powerpc) CXXFLAGS="$CXXFLAGS -fsigned-char" ;; powerpc64) CXXFLAGS="$CXXFLAGS -fsigned-char" case $target_os in aix*) CXX="$CXX -maix64" ;; linux*) CXX="$CXX -m64" ;; esac ;; sparc | sparcv8*) CXX="$CXX -m32" ;; sparc64 | sparcv9*) CXX="$CXX -m64" ;; esac # Certain platforms needs special flags for multi-threaded code if test "$ac_enable_threads" = yes; then case $target_os in freebsd*) CXXFLAGS="$CXXFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ;; osf*) CXXFLAGS="$CXXFLAGS -pthread" ;; esac fi if test "$ac_enable_debug" = yes; then if test "$CXXFLAGS" != ""; then CXXFLAGS_save="" for flag in $CXXFLAGS do if test "$flag" != "-O2"; then CXXFLAGS_save="$CXXFLAGS_save $flag" fi done CXXFLAGS="$CXXFLAGS_save" fi CXXFLAGS="$CXXFLAGS -Wall -pedantic" else # Generic optimizations, including cpu tuning case $bc_target_arch in em64t | \ i[3456]86 | \ pentium | pentium-m | pentium-mmx | pentiumpro | pentium[234] | \ athlon | athlon-tbird | athlon-4 | athlon-xp | athlon-mp | athlon64 | k8) { $as_echo "$as_me:$LINENO: checking if g++ supports -mtune option" >&5 $as_echo_n "checking if g++ supports -mtune option... " >&6; } ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int x; _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then bc_cv_gxx_mtune=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 bc_cv_gxx_mtune=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ;; esac if test "$CXXFLAGS" != ""; then CXXFLAGS_save="" for flag in $CXXFLAGS do if test "$flag" != "-g"; then CXXFLAGS_save="$CXXFLAGS_save $flag" fi done CXXFLAGS="$CXXFLAGS_save" fi CXXFLAGS="$CXXFLAGS -DNDEBUG" if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in athlon*) CXXFLAGS="$CXXFLAGS -mcpu=pentiumpro"; ;; i586) CXXFLAGS="$CXXFLAGS -mcpu=pentium" ;; i686) CXXFLAGS="$CXXFLAGS -mcpu=pentiumpro" ;; ia64) # no -mcpu=... option on ia64 ;; pentium*) CXXFLAGS="$CXXFLAGS -mcpu=$bc_target_arch" ;; esac # Architecture-specific optimizations case $bc_target_arch in athlon*) CXXFLAGS="$CXXFLAGS -march=$bc_target_arch" ;; i586) CXXFLAGS="$CXXFLAGS -march=pentium" ;; i686) CXXFLAGS="$CXXFLAGS -march=pentiumpro" ;; pentium*) CXXFLAGS="$CXXFLAGS -march=$bc_target_arch" ;; powerpc | powerpc64) CXXFLAGS="$CXXFLAGS -mcpu=$bc_target_arch" ;; sparcv8) CXXFLAGS="$CXXFLAGS -mcpu=v8" ;; sparcv8plus) CXXFLAGS="$CXXFLAGS -mcpu=v9" ;; esac fi fi fi else case $target_os in aix*) ;; hpux*) BEE_HPUX_CXX ;; linux*) { $as_echo "$as_me:$LINENO: checking whether we are using Intel C++" >&5 $as_echo_n "checking whether we are using Intel C++... " >&6; } if test "${bc_cv_prog_INTEL_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __INTEL_COMPILER yes; #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then bc_cv_prog_INTEL_CXX=yes else bc_cv_prog_INTEL_CXX=no fi rm -f conftest* fi { $as_echo "$as_me:$LINENO: result: $bc_cv_prog_INTEL_CXX" >&5 $as_echo "$bc_cv_prog_INTEL_CXX" >&6; } if test "$bc_cv_prog_INTEL_CXX" = yes; then if test "$ac_enable_debug" != yes; then if test "$CXXFLAGS" != ""; then CXXFLAGS_save="" for flag in $CXXFLAGS do if test "$flag" != "-g"; then CXXFLAGS_save="$CXXFLAGS_save $flag" fi done CXXFLAGS="$CXXFLAGS_save" fi if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in i586 | pentium | pentium-mmx) CXXFLAGS="$CXXFLAGS -mcpu=pentium" ;; i686 | pentiumpro | pentium[23]) CXXFLAGS="$CXXFLAGS -mcpu=pentiumpro" ;; pentium4 | pentium-m) CXXFLAGS="$CXXFLAGS -mcpu=pentium4" ;; esac case $bc_target_arch in i586 | pentium | pentium-mmx) CXXFLAGS="$CXXFLAGS -tpp5" ;; i686 | pentiumpro) CXXFLAGS="$CXXFLAGS -tpp6 -march=pentiumpro" ;; pentium2) CXXFLAGS="$CXXFLAGS -tpp6 -march=pentiumii" ;; pentium3) CXXFLAGS="$CXXFLAGS -tpp6 -march=pentiumiii" ;; pentium4) CXXFLAGS="$CXXFLAGS -tpp7 -march=pentium4" ;; esac fi fi fi ;; solaris*) { $as_echo "$as_me:$LINENO: checking whether we are using Sun Forte C++" >&5 $as_echo_n "checking whether we are using Sun Forte C++... " >&6; } if test "${bc_cv_prog_SUN_FORTE_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test "$cross_compiling" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifdef __SUNPRO_CC return 0; #else return 1; #endif ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bc_cv_prog_SUN_FORTE_CXX=yes else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) bc_cv_prog_SUN_FORTE_CXX=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $bc_cv_prog_SUN_FORTE_CXX" >&5 $as_echo "$bc_cv_prog_SUN_FORTE_CXX" >&6; } if test "$bc_cv_prog_SUN_FORTE_CXX" = yes; then if test "$ac_enable_threads" = yes; then CXXFLAGS="$CXXFLAGS -mt" fi if test "$ac_enable_debug" != yes; then if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "-g"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi if test "$bc_cv_c_aggressive_opt" = yes; then CXXFLAGS="$CXXFLAGS -fast" case $bc_target_arch in sparc) CXXFLAGS="$CXXFLAGS -m32 -xarch=generic" ;; sparcv8) CXXFLAGS="$CXXFLAGS -m32 -xarch=v8" ;; sparcv8plus*) CXXFLAGS="$CXXFLAGS -m32 -xarch=v8plus" ;; sparcv9*) CXXFLAGS="$CXXFLAGS -m64 -xarch=generic" ;; esac fi fi fi ;; osf*) ;; esac fi fi # Check for stack protection { $as_echo "$as_me:$LINENO: checking whether we can use noexecstack flag in C" >&5 $as_echo_n "checking whether we can use noexecstack flag in C... " >&6; } if test "${bc_cv_cc_noexecstack+set}" = set; then $as_echo_n "(cached) " >&6 else CFLAGS_save=$CFLAGS if test "$bc_cv_prog_INTEL_CC" = yes; then CFLAGS="$CFLAGS -Qoption,asm,--noexecstack" else CFLAGS="$CFLAGS -Wa,--noexecstack" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # first try to compile it cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int x = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # did compile $CC -S $CFLAGS conftest.$ac_ext > /dev/null 2>&1 $CC -o conftest$ac_exeext $CFLAGS conftest.s > /dev/null 2>&1 if test $? -eq 0; then # did assemble bc_cv_cc_noexecstack=yes bc_gnu_stack=`$EGREP -e '\.section.*GNU-stack' conftest.s` else # didn't assemble CFLAGS=$CFLAGS_save bc_cv_cc_noexecstack=no bc_gnu_stack='' fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # didn't compile CFLAGS=$CFLAGS_save bc_cv_cc_noexecstack=no bc_gnu_stack='' fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $bc_cv_cc_noexecstack" >&5 $as_echo "$bc_cv_cc_noexecstack" >&6; } { $as_echo "$as_me:$LINENO: checking whether we can use noexecstack flag in C++" >&5 $as_echo_n "checking whether we can use noexecstack flag in C++... " >&6; } if test "${bc_cv_cxx_noexecstack+set}" = set; then $as_echo_n "(cached) " >&6 else CXXFLAGS_save=$CXXFLAGS if test "$bc_cv_prog_INTEL_CXX" = yes; then CXXFLAGS="$CXXFLAGS -Qoption,asm,--noexecstack" else CXXFLAGS="$CXXFLAGS -Wa,--noexecstack" fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # first try to compile it cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { int x = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # did compile $CXX -S $CXXFLAGS conftest.$ac_ext > /dev/null 2>&1 $CXX -o conftest$ac_exeext $CXXFLAGS conftest.s > /dev/null 2>&1 if test $? -eq 0; then # did assemble bc_cv_cxx_noexecstack=yes bc_gnu_stack=`$EGREP -e '\.section.*GNU-stack' conftest.s` else # didn't assemble CXXFLAGS=$CXXFLAGS_save bc_cv_cxx_noexecstack=no fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # didn't compile CXXFLAGS=$CXXFLAGS_save bc_cv_cxx_noexecstack=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $bc_cv_cxx_noexecstack" >&5 $as_echo "$bc_cv_cxx_noexecstack" >&6; } # Checks for program flags needed by libtool case $target_os in aix*) case $bc_target_arch in powerpc64) AR="ar -X64" NM="/usr/bin/nm -B -X64" ;; esac ;; solaris*) case $bc_target_arch in sparcv9*) LD="/usr/ccs/bin/ld" LDFLAGS="$LDFLAGS -Wl,-64" ;; esac ;; esac # Predefines for autoheader case $target_os in aix*) cat >>confdefs.h <<\_ACEOF #define AIX 1 _ACEOF ;; cygwin*) cat >>confdefs.h <<\_ACEOF #define CYGWIN 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define WIN32 1 _ACEOF ;; darwin*) cat >>confdefs.h <<\_ACEOF #define DARWIN 1 _ACEOF ;; freebsd*) cat >>confdefs.h <<\_ACEOF #define FREEBSD 1 _ACEOF ;; hpux*) cat >>confdefs.h <<\_ACEOF #define HPUX 1 _ACEOF ;; linux*) cat >>confdefs.h <<\_ACEOF #define LINUX 1 _ACEOF ;; mingw*) cat >>confdefs.h <<\_ACEOF #define MINGW 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define WIN32 1 _ACEOF ;; netbsd*) cat >>confdefs.h <<\_ACEOF #define NETBSD 1 _ACEOF ;; openbsd*) cat >>confdefs.h <<\_ACEOF #define OPENBSD 1 _ACEOF ;; osf*) cat >>confdefs.h <<\_ACEOF #define OSF 1 _ACEOF ;; *qnx) cat >>confdefs.h <<\_ACEOF #define QNX 1 _ACEOF ;; solaris*) cat >>confdefs.h <<\_ACEOF #define SOLARIS 1 _ACEOF ;; sysv*uv*) cat >>confdefs.h <<\_ACEOF #define SCO_UNIX 1 _ACEOF ;; *) { $as_echo "$as_me:$LINENO: WARNING: Operating system type $target_os currently not supported and/or tested" >&5 $as_echo "$as_me: WARNING: Operating system type $target_os currently not supported and/or tested" >&2;} ;; esac # Checks for header files. { $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_header in time.h sys/time.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to bob.deblier@telenet.be ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_time=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi for ac_header in assert.h ctype.h errno.h fcntl.h malloc.h stdio.h termio.h termios.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to bob.deblier@telenet.be ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/ioctl.h sys/mman.h sys/audioio.h sys/soundcard.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to bob.deblier@telenet.be ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in endian.h sys/endian.h asm/byteorder.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to bob.deblier@telenet.be ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done bc_include_stdio_h= bc_include_stdlib_h= bc_include_malloc_h= bc_include_string_h= bc_include_unistd_h= bc_include_dlfcn_h= if test "$ac_cv_header_stdio_h" = yes; then bc_include_stdio_h="#include " fi if test "$ac_cv_header_stdlib_h" = yes; then bc_include_stdlib_h="#include " elif test "$ac_cv_header_malloc_h" = yes; then bc_include_malloc_h="#include " fi if test "$ac_with_mtmalloc" = yes; then for ac_header in mtmalloc.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to bob.deblier@telenet.be ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_mtmalloc_h" = yes; then bc_include_stdlib_h= bc_include_malloc_h="#include " fi fi if test "$ac_cv_header_string_h" = yes; then bc_include_string_h="#include " fi if test "$ac_cv_header_unistd_h" = yes; then bc_include_unistd_h="#include " fi if test "$ac_cv_header_dlfcn_h" = yes; then bc_include_dlfcn_h="#include " fi INCLUDE_STDIO_H=$bc_include_stdio_h INCLUDE_STDLIB_H=$bc_include_stdlib_h INCLUDE_MALLOC_H=$bc_include_malloc_h INCLUDE_STRING_H=$bc_include_string_h INCLUDE_UNISTD_H=$bc_include_unistd_h INCLUDE_DLFCN_H=$bc_include_dlfcn_h for ac_header in dlfcn.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to bob.deblier@telenet.be ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_dlfcn_h" = yes; then { $as_echo "$as_me:$LINENO: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } if test "${ac_cv_search_dlopen+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF for ac_lib in '' dl dld; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_dlopen=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_dlopen+set}" = set; then break fi done if test "${ac_cv_search_dlopen+set}" = set; then : else ac_cv_search_dlopen=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_dlopen" >&5 $as_echo "$ac_cv_search_dlopen" >&6; } ac_res=$ac_cv_search_dlopen if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi if test "$ac_enable_threads" = yes; then for ac_header in synch.h thread.h pthread.h semaphore.h sched.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to bob.deblier@telenet.be ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi bc_include_synch_h= bc_include_thread_h= bc_include_pthread_h= bc_include_semaphore_h= bc_include_sched_h= bc_typedef_bc_cond_t= bc_typedef_bc_mutex_t= bc_typedef_bc_sema_t= bc_typedef_bc_thread_t= bc_typedef_bc_threadid_t= if test "$ac_enable_threads" = yes; then if test "$ac_cv_header_thread_h" = yes -a "$ac_cv_header_synch_h" = yes; then bc_include_synch_h="#include " bc_include_thread_h="#include " bc_typedef_bc_cond_t="typedef cond_t bc_cond_t;" bc_typedef_bc_mutex_t="typedef mutex_t bc_mutex_t;" bc_typedef_bc_sema_t="typedef sema_t bc_sema_t;" bc_typedef_bc_thread_t="typedef thread_t bc_thread_t;" bc_typedef_bc_threadid_t="typedef thread_t bc_threadid_t;" { $as_echo "$as_me:$LINENO: checking for library containing mutex_lock" >&5 $as_echo_n "checking for library containing mutex_lock... " >&6; } if test "${ac_cv_search_mutex_lock+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char mutex_lock (); int main () { return mutex_lock (); ; return 0; } _ACEOF for ac_lib in '' thread; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_mutex_lock=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_mutex_lock+set}" = set; then break fi done if test "${ac_cv_search_mutex_lock+set}" = set; then : else ac_cv_search_mutex_lock=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_mutex_lock" >&5 $as_echo "$ac_cv_search_mutex_lock" >&6; } ac_res=$ac_cv_search_mutex_lock if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" cat >>confdefs.h <<\_ACEOF #define ENABLE_THREADS 1 _ACEOF fi else if test "$ac_cv_header_semaphore_h" = yes; then bc_include_semaphore_h="#include " bc_typedef_bc_sema_t="typedef sem_t bc_sema_t;" fi if test "$ac_cv_header_sched_h" = yes; then bc_include_sched_h="#include " fi if test "$ac_cv_header_pthread_h" = yes; then bc_include_pthread_h="#include " bc_typedef_bc_cond_t="typedef pthread_cond_t bc_cond_t;" bc_typedef_bc_mutex_t="typedef pthread_mutex_t bc_mutex_t;" bc_typedef_bc_thread_t="typedef pthread_t bc_thread_t;" bc_typedef_bc_threadid_t="typedef pthread_t bc_threadid_t;" # On most systems this tests will say 'none required', but that doesn't # mean that the linked code will work correctly! case $target_os in linux* | solaris* ) cat >>confdefs.h <<\_ACEOF #define ENABLE_THREADS 1 _ACEOF LIBS="-lpthread $LIBS" ;; osf*) cat >>confdefs.h <<\_ACEOF #define ENABLE_THREADS 1 _ACEOF LIBS="-lpthread -lmach -lexc $LIBS" ;; *) { $as_echo "$as_me:$LINENO: checking for library containing pthread_mutex_lock" >&5 $as_echo_n "checking for library containing pthread_mutex_lock... " >&6; } if test "${ac_cv_search_pthread_mutex_lock+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_mutex_lock (); int main () { return pthread_mutex_lock (); ; return 0; } _ACEOF for ac_lib in '' pthread; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_pthread_mutex_lock=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_pthread_mutex_lock+set}" = set; then break fi done if test "${ac_cv_search_pthread_mutex_lock+set}" = set; then : else ac_cv_search_pthread_mutex_lock=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_pthread_mutex_lock" >&5 $as_echo "$ac_cv_search_pthread_mutex_lock" >&6; } ac_res=$ac_cv_search_pthread_mutex_lock if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" cat >>confdefs.h <<\_ACEOF #define ENABLE_THREADS 1 _ACEOF fi ;; esac else case $target_os in mingw*) bc_typedef_bc_cond_t="typedef HANDLE bc_cond_t;" bc_typedef_bc_mutex_t="typedef HANDLE bc_mutex_t;" bc_typedef_bc_thread_t="typedef HANDLE bc_thread_t;" bc_typedef_bc_threadid_t="typedef DWORD bc_threadid_t;" ;; *) { $as_echo "$as_me:$LINENO: WARNING: Don't know which thread library to check for" >&5 $as_echo "$as_me: WARNING: Don't know which thread library to check for" >&2;} ;; esac fi fi fi INCLUDE_SYNCH_H=$bc_include_synch_h INCLUDE_THREAD_H=$bc_include_thread_h INCLUDE_PTHREAD_H=$bc_include_pthread_h INCLUDE_SEMAPHORE_H=$bc_include_semaphore_h INCLUDE_SCHED_H=$bc_include_sched_h TYPEDEF_BC_COND_T=$bc_typedef_bc_cond_t TYPEDEF_BC_MUTEX_T=$bc_typedef_bc_mutex_t TYPEDEF_BC_THREAD_T=$bc_typedef_bc_thread_t TYPEDEF_BC_THREADID_T=$bc_typedef_bc_threadid_t if test "$ac_enable_threads" = yes; then { $as_echo "$as_me:$LINENO: checking if your compiler supports thread-local-storage" >&5 $as_echo_n "checking if your compiler supports thread-local-storage... " >&6; } cat >conftest.$ac_ext <<_ACEOF __thread int a = 0; _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >>confdefs.h <<\_ACEOF #define ENABLE_THREAD_LOCAL_STORAGE 1 _ACEOF { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF #define ENABLE_THREAD_LOCAL_STORAGE 0 _ACEOF { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >>confdefs.h <<\_ACEOF #define ENABLE_THREAD_LOCAL_STORAGE 0 _ACEOF fi # Checks for libraries. if test "$ac_enable_aio" = yes; then for ac_header in aio.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## ## Report this to bob.deblier@telenet.be ## ## ------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_aio_h" = yes; then { $as_echo "$as_me:$LINENO: checking for library containing aio_read" >&5 $as_echo_n "checking for library containing aio_read... " >&6; } if test "${ac_cv_search_aio_read+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char aio_read (); int main () { return aio_read (); ; return 0; } _ACEOF for ac_lib in '' c rt aio posix4; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_aio_read=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_aio_read+set}" = set; then break fi done if test "${ac_cv_search_aio_read+set}" = set; then : else ac_cv_search_aio_read=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_aio_read" >&5 $as_echo "$ac_cv_search_aio_read" >&6; } ac_res=$ac_cv_search_aio_read if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" { $as_echo "$as_me:$LINENO: checking whether aio works" >&5 $as_echo_n "checking whether aio works... " >&6; } if test "${bc_cv_working_aio+set}" = set; then $as_echo_n "(cached) " >&6 else cat > conftest.aio << EOF The quick brown fox jumps over the lazy dog. EOF ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes; then case $target_os in linux* | solaris*) bc_cv_working_aio=yes ;; *) bc_cv_working_aio=no ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if HAVE_ERRNO_H # include #endif #if HAVE_FCNTL_H # include #endif #if HAVE_STRING_H # include #endif #if HAVE_UNISTD_H # include #endif #include #include int main () { struct aiocb a; const struct aiocb* a_list = &a; struct timespec a_timeout; char buffer[32]; int i, rc, fd = open("conftest.aio", O_RDONLY); if (fd < 0) exit(1); memset(&a, 0, sizeof(struct aiocb)); a.aio_fildes = fd; a.aio_offset = 0; a.aio_reqprio = 0; a.aio_buf = buffer; a.aio_nbytes = sizeof(buffer); a.aio_sigevent.sigev_notify = SIGEV_NONE; a_timeout.tv_sec = 1; a_timeout.tv_nsec = 0; if (aio_read(&a) < 0) { perror("aio_read"); exit(1); } if (aio_suspend(&a_list, 1, &a_timeout) < 0) { #if HAVE_ERRNO_H /* some linux systems don't await timeout and return instantly */ if (errno == EAGAIN) { nanosleep(&a_timeout, (struct timespec*) 0); if (aio_suspend(&a_list, 1, &a_timeout) < 0) { perror("aio_suspend"); exit(1); } } else { perror("aio_suspend"); exit(1); } #else exit(1); #endif } if (aio_error(&a) < 0) exit(1); if (aio_return(&a) < 0) exit(1); exit(0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then bc_cv_working_aio=yes else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) bc_cv_working_aio=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $bc_cv_working_aio" >&5 $as_echo "$bc_cv_working_aio" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi rm -fr conftest.aio fi if test "$bc_cv_aio_works" = yes; then cat >>confdefs.h <<\_ACEOF #define ENABLE_AIO 1 _ACEOF fi fi if test "$ac_with_mtmalloc" = yes; then if test "$ac_cv_have_mtmalloc_h" = yes; then { $as_echo "$as_me:$LINENO: checking for main in -lmtmalloc" >&5 $as_echo_n "checking for main in -lmtmalloc... " >&6; } if test "${ac_cv_lib_mtmalloc_main+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmtmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_mtmalloc_main=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_mtmalloc_main=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mtmalloc_main" >&5 $as_echo "$ac_cv_lib_mtmalloc_main" >&6; } if test "x$ac_cv_lib_mtmalloc_main" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBMTMALLOC 1 _ACEOF LIBS="-lmtmalloc $LIBS" fi ac_cv_lib_mtmalloc=ac_cv_lib_mtmalloc_main fi fi case $target_os in cygwin* | mingw*) { $as_echo "$as_me:$LINENO: checking for main in -lwinmm" >&5 $as_echo_n "checking for main in -lwinmm... " >&6; } if test "${ac_cv_lib_winmm_main+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lwinmm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_winmm_main=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_winmm_main=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_winmm_main" >&5 $as_echo "$ac_cv_lib_winmm_main" >&6; } if test "x$ac_cv_lib_winmm_main" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBWINMM 1 _ACEOF LIBS="-lwinmm $LIBS" fi ac_cv_lib_winmm=ac_cv_lib_winmm_main ;; esac # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if test "${ac_cv_c_bigendian+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # Check for potential -arch flags. It is not universal unless # there are some -arch flags. Note that *ppc* also matches # ppc64. This check is also rather less than ideal. case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #( *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;; esac else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to _BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then # Try to guess by grepping values from an object file. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; #( no) ;; #( universal) cat >>confdefs.h <<\_ACEOF #define AC_APPLE_UNIVERSAL_BUILD 1 _ACEOF ;; #( *) { { $as_echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 $as_echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac { $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const /**/ _ACEOF fi { $as_echo "$as_me:$LINENO: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if test "${ac_cv_c_inline+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_inline=$ac_kw else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac if test "$ac_cv_c_inline" != no; then cat >>confdefs.h <<\_ACEOF #define HAVE_INLINE 1 _ACEOF fi # Checks for library functions. if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if test "${ac_cv_prog_gcc_traditional+set}" = set; then $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { $as_echo "$as_me:$LINENO: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if test "${ac_cv_func_memcmp_working+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_func_memcmp_working=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_memcmp_working=yes else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_memcmp_working=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac { $as_echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 $as_echo_n "checking whether lstat dereferences a symlink specified with a trailing slash... " >&6; } if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then ac_cv_func_lstat_dereferences_slashed_symlink=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_lstat_dereferences_slashed_symlink=yes else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { $as_echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_func_stat_empty_string_bug=yes else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_stat_empty_string_bug=no else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_stat_empty_string_bug=yes fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi for ac_func in memset memcmp memmove strcspn strerror strspn do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "$ac_cv_header_sys_time_h" = yes; then for ac_func in nanosleep do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in gethrtime do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # gettimeofday detection fails on HP/UX! { $as_echo "$as_me:$LINENO: checking for gettimeofday" >&5 $as_echo_n "checking for gettimeofday... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { struct timeval dummy; gettimeofday(&dummy, (void*) 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_GETTIMEOFDAY 1 _ACEOF ac_cv_func_gettimeofday=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_GETTIMEOFDAY 0 _ACEOF ac_cv_func_gettimeofday=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi # Predefines and checks for C++ API support if test "$ac_with_cplusplus" = yes; then { $as_echo "$as_me:$LINENO: checking for IBM's ICU library version >= 2.8" >&5 $as_echo_n "checking for IBM's ICU library version >= 2.8... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if U_ICU_VERSION_MAJOR_NUM < 2 exit(1); #elif U_ICU_VERSION_MAJOR_NUM == 2 # if U_ICU_VERSION_MINOR_NUM < 8 exit(1); # else exit(0); # endif #else exit(0); #endif ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:$LINENO: WARNING: disabling cplusplus" >&5 $as_echo "$as_me: WARNING: disabling cplusplus" >&2;} ac_with_cplusplus=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi if test "$ac_with_cplusplus" = yes; then WITH_CPLUSPLUS_TRUE= WITH_CPLUSPLUS_FALSE='#' else WITH_CPLUSPLUS_TRUE='#' WITH_CPLUSPLUS_FALSE= fi if test "$ac_with_cplusplus" = yes ; then cat >>confdefs.h <<\_ACEOF #define CPPGLUE 1 _ACEOF fi # Predefines and checks for Java API support if test "$ac_with_java" = yes ; then # Extract the first word of "gcj", so it can be a program name with args. set dummy gcj; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_cv_have_gcj+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_cv_have_gcj"; then ac_cv_prog_ac_cv_have_gcj="$ac_cv_have_gcj" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_cv_have_gcj="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ac_cv_have_gcj" && ac_cv_prog_ac_cv_have_gcj="no" fi fi ac_cv_have_gcj=$ac_cv_prog_ac_cv_have_gcj if test -n "$ac_cv_have_gcj"; then { $as_echo "$as_me:$LINENO: result: $ac_cv_have_gcj" >&5 $as_echo "$ac_cv_have_gcj" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "gcjh", so it can be a program name with args. set dummy gcjh; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_cv_have_gcjh+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_cv_have_gcjh"; then ac_cv_prog_ac_cv_have_gcjh="$ac_cv_have_gcjh" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_cv_have_gcjh="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ac_cv_have_gcjh" && ac_cv_prog_ac_cv_have_gcjh="no" fi fi ac_cv_have_gcjh=$ac_cv_prog_ac_cv_have_gcjh if test -n "$ac_cv_have_gcjh"; then { $as_echo "$as_me:$LINENO: result: $ac_cv_have_gcjh" >&5 $as_echo "$ac_cv_have_gcjh" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$ac_cv_have_gcj" = yes; then javac=gcj { $as_echo "$as_me:$LINENO: checking for java native interface headers" >&5 $as_echo_n "checking for java native interface headers... " >&6; } if test "${ac_cv_java_include+set}" = set; then $as_echo_n "(cached) " >&6 else cat > conftest.java << EOF public class conftest { public static void main(String[] argv) { System.out.println(System.getProperty("java.home")); } } EOF java_home="`gcj --main=conftest -o conftest conftest.java; ./conftest`" if test X"$java_home" = X; then java_home=/usr fi if test -d "$java_home" -a -d "$java_home/include"; then ac_cv_java_headers=yes ac_cv_java_include="-I$java_home/include" gcjpath="$java_home/lib/gcc-lib/`gcj -dumpmachine`/`gcj -dumpversion`" if test -d "$gcjpath" -a -d "$gcjpath/include"; then ac_cv_java_include="$ac_cv_java_include -I$gcjpath/include" fi else # we have a non-working gcj ac_cv_have_gcj=no fi rm -fr conftest* fi { $as_echo "$as_me:$LINENO: result: $ac_cv_java_include" >&5 $as_echo "$ac_cv_java_include" >&6; } fi # gcj may have failed; in this case we want to try for a real java if test "$ac_cv_have_gcj" != yes; then # Extract the first word of "java", so it can be a program name with args. set dummy java; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_cv_have_java+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_cv_have_java"; then ac_cv_prog_ac_cv_have_java="$ac_cv_have_java" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_cv_have_java="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ac_cv_have_java" && ac_cv_prog_ac_cv_have_java="no" fi fi ac_cv_have_java=$ac_cv_prog_ac_cv_have_java if test -n "$ac_cv_have_java"; then { $as_echo "$as_me:$LINENO: result: $ac_cv_have_java" >&5 $as_echo "$ac_cv_have_java" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$ac_cv_have_java" = yes; then # Extract the first word of "javac", so it can be a program name with args. set dummy javac; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_cv_have_javac+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_cv_have_javac"; then ac_cv_prog_ac_cv_have_javac="$ac_cv_have_javac" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_cv_have_javac="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ac_cv_have_javac" && ac_cv_prog_ac_cv_have_javac="no" fi fi ac_cv_have_javac=$ac_cv_prog_ac_cv_have_javac if test -n "$ac_cv_have_javac"; then { $as_echo "$as_me:$LINENO: result: $ac_cv_have_javac" >&5 $as_echo "$ac_cv_have_javac" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "javah", so it can be a program name with args. set dummy javah; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_cv_have_javah+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_cv_have_javah"; then ac_cv_prog_ac_cv_have_javah="$ac_cv_have_javah" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_cv_have_javah="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ac_cv_have_javah" && ac_cv_prog_ac_cv_have_javah="no" fi fi ac_cv_have_javah=$ac_cv_prog_ac_cv_have_javah if test -n "$ac_cv_have_javah"; then { $as_echo "$as_me:$LINENO: result: $ac_cv_have_javah" >&5 $as_echo "$ac_cv_have_javah" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$ac_cv_have_javac" = yes; then javac=javac { $as_echo "$as_me:$LINENO: checking for java native interface headers" >&5 $as_echo_n "checking for java native interface headers... " >&6; } if test "${ac_cv_java_include+set}" = set; then $as_echo_n "(cached) " >&6 else cat > conftest.java << EOF public class conftest { public static void main(String[] argv) { System.out.println(System.getProperty("java.home")); } } EOF java_home=`javac conftest.java; java -classpath . conftest` case $target_os in cygwin*) java_home=`cygpath -u -p "$java_home"` ;; esac if test -d "$java_home"; then case $target_os in darwin*) java_include="$java_home/../../../Headers" ;; *) java_include="$java_home"/../include ;; esac if test -d "$java_include"; then ac_cv_java_headers=yes ac_cv_java_include="-I$java_include" case $target_os in aix*) ac_cv_java_include="-I$java_include -I$java_include/aix" ;; cygwin*) ac_cv_java_include="-I$java_include -I$java_include/win32" ;; darwin*) ;; hpux*) ac_cv_java_include="-I$java_include -I$java_include/hpux" ;; linux*) ac_cv_java_include="-I$java_include -I$java_include/linux" ;; osf*) ac_cv_java_include="-I$java_include -I$java_include/osf" ;; solaris*) ac_cv_java_include="-I$java_include -I$java_include/solaris" ;; *) { $as_echo "$as_me:$LINENO: WARNING: please add appropriate -I$java_include/ flag" >&5 $as_echo "$as_me: WARNING: please add appropriate -I$java_include/ flag" >&2;} ac_cv_java_include="-I$java_include" ;; esac else { $as_echo "$as_me:$LINENO: WARNING: java headers not found, disabling java" >&5 $as_echo "$as_me: WARNING: java headers not found, disabling java" >&2;} ac_cv_java_headers=no ac_cv_java_include= ac_with_java=no fi fi rm -fr conftest* fi { $as_echo "$as_me:$LINENO: result: $ac_cv_java_include" >&5 $as_echo "$ac_cv_java_include" >&6; } else { $as_echo "$as_me:$LINENO: WARNING: javac not found, disabling java" >&5 $as_echo "$as_me: WARNING: javac not found, disabling java" >&2;} ac_cv_java_headers=no ac_cv_java_include= ac_with_java=no fi else { $as_echo "$as_me:$LINENO: WARNING: java not found, disabling java" >&5 $as_echo "$as_me: WARNING: java not found, disabling java" >&2;} ac_cv_java_headers=no ac_with_java=no fi fi fi if test "$ac_with_java" = yes; then WITH_JAVA_TRUE= WITH_JAVA_FALSE='#' else WITH_JAVA_TRUE='#' WITH_JAVA_FALSE= fi if test "$ac_with_java" = yes ; then cat >>confdefs.h <<\_ACEOF #define JAVAGLUE 1 _ACEOF CPPFLAGS="$CPPFLAGS $ac_cv_java_include" fi # Predefines and checks for Python API support if test "$ac_with_python" = yes ; then # Extract the first word of "`basename $ac_with_python_val`", so it can be a program name with args. set dummy `basename $ac_with_python_val`; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_dummy="`$as_dirname -- "$ac_with_python_val" || $as_expr X"$ac_with_python_val" : 'X\(.*^/\)//*^/^/*/*$' \| \ X"$ac_with_python_val" : 'X\(//\)^/' \| \ X"$ac_with_python_val" : 'X\(//\)$' \| \ X"$ac_with_python_val" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_with_python_val" | sed '/^X\(.*^/\)\/\/*^/^/*\/*$/{ s//\1/ q } /^X\(\/\/\)^/.*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`" for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="no" ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:$LINENO: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "$PYTHON" = no; then ac_with_python=no else { $as_echo "$as_me:$LINENO: checking for python headers" >&5 $as_echo_n "checking for python headers... " >&6; } if test "${ac_cv_python_include+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_python_include="-I`$PYTHON -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_inc()'`" fi { $as_echo "$as_me:$LINENO: result: $ac_cv_python_include" >&5 $as_echo "$ac_cv_python_include" >&6; } { $as_echo "$as_me:$LINENO: checking where to install python libraries" >&5 $as_echo_n "checking where to install python libraries... " >&6; } if test "${ac_cv_python_libdir+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_python_libdir=`$PYTHON -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()'` fi { $as_echo "$as_me:$LINENO: result: $ac_cv_python_libdir" >&5 $as_echo "$ac_cv_python_libdir" >&6; } fi fi if test "$ac_with_python" = yes; then WITH_PYTHON_TRUE= WITH_PYTHON_FALSE='#' else WITH_PYTHON_TRUE='#' WITH_PYTHON_FALSE= fi if test "$ac_with_python" = yes; then cat >>confdefs.h <<\_ACEOF #define PYTHONGLUE 1 _ACEOF PYTHONINC=$ac_cv_python_include PYTHONLIB=$ac_cv_python_libdir fi # Checks for entropy sources. { $as_echo "$as_me:$LINENO: checking for platform-specific entropy devices" >&5 $as_echo_n "checking for platform-specific entropy devices... " >&6; } { $as_echo "$as_me:$LINENO: result: " >&5 $as_echo "" >&6; } case $target_os in cygwin* | mingw*) { $as_echo "$as_me:$LINENO: checking for wavein" >&5 $as_echo_n "checking for wavein... " >&6; } { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:$LINENO: checking for wincrypt" >&5 $as_echo_n "checking for wincrypt... " >&6; } { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:$LINENO: checking for console" >&5 $as_echo_n "checking for console... " >&6; } { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } ;; linux*) { $as_echo "$as_me:$LINENO: checking for /dev/dsp" >&5 $as_echo_n "checking for /dev/dsp... " >&6; } if test "${ac_cv_have_dev_dsp+set}" = set; then $as_echo_n "(cached) " >&6 else if test -r /dev/dsp; then ac_cv_have_dev_dsp=yes else ac_cv_have_dev_dsp=no fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_dev_dsp" >&5 $as_echo "$ac_cv_have_dev_dsp" >&6; } if test "$ac_cv_have_dev_dsp" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_DSP 1 _ACEOF fi ;; solaris*) { $as_echo "$as_me:$LINENO: checking for /dev/audio" >&5 $as_echo_n "checking for /dev/audio... " >&6; } if test "${ac_cv_have_dev_audio+set}" = set; then $as_echo_n "(cached) " >&6 else if test -r /dev/audio; then ac_cv_have_dev_audio=yes else ac_cv_have_dev_audio=no fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_dev_audio" >&5 $as_echo "$ac_cv_have_dev_audio" >&6; } if test "$ac_cv_have_dev_audio" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_AUDIO 1 _ACEOF fi ;; *) { $as_echo "$as_me:$LINENO: WARNING: no specific entropy devices present" >&5 $as_echo "$as_me: WARNING: no specific entropy devices present" >&2;} ;; esac case $target_os in cygwin* | mingw*) ;; *) { $as_echo "$as_me:$LINENO: checking for generic entropy devices" >&5 $as_echo_n "checking for generic entropy devices... " >&6; } { $as_echo "$as_me:$LINENO: result: " >&5 $as_echo "" >&6; } { $as_echo "$as_me:$LINENO: checking for /dev/random" >&5 $as_echo_n "checking for /dev/random... " >&6; } if test "${ac_cv_have_dev_random+set}" = set; then $as_echo_n "(cached) " >&6 else if test -r /dev/random; then ac_cv_have_dev_random=yes else ac_cv_have_dev_random=no fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_dev_random" >&5 $as_echo "$ac_cv_have_dev_random" >&6; } { $as_echo "$as_me:$LINENO: checking for /dev/urandom" >&5 $as_echo_n "checking for /dev/urandom... " >&6; } if test "${ac_cv_have_dev_urandom+set}" = set; then $as_echo_n "(cached) " >&6 else if test -r /dev/urandom; then ac_cv_have_dev_urandom=yes else ac_cv_have_dev_urandom=no fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_dev_urandom" >&5 $as_echo "$ac_cv_have_dev_urandom" >&6; } { $as_echo "$as_me:$LINENO: checking for /dev/tty" >&5 $as_echo_n "checking for /dev/tty... " >&6; } if test "${ac_cv_have_dev_tty+set}" = set; then $as_echo_n "(cached) " >&6 else if test -r /dev/tty; then ac_cv_have_dev_tty=yes else ac_cv_have_dev_tty=no fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_dev_tty" >&5 $as_echo "$ac_cv_have_dev_tty" >&6; } ;; esac if test "$ac_cv_have_dev_random" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_RANDOM 1 _ACEOF fi if test "$ac_cv_have_dev_urandom" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_URANDOM 1 _ACEOF fi if test "$ac_cv_have_dev_tty" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_TTY 1 _ACEOF fi # Figure out extra flags if test "$ac_enable_debug" != yes; then case $bc_target_arch in alpha*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_ALPHA" ;; arm*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_ARM" ;; x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_X86_64" ;; athlon*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX" ;; i386) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I386" ;; i486) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I486" ;; i586) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I586" ;; i686) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686" ;; ia64) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_IA64" ;; m68k) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_M68K" ;; pentium) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I586" ;; pentium-m) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX -DOPTIMIZE_SSE -DOPTIMIZE_SSE2" ;; pentium-mmx) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I586 -DOPTIMIZE_MMX" ;; pentiumpro) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686" ;; pentium2) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX" ;; pentium3) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX -DOPTIMIZE_SSE" ;; pentium4) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX -DOPTIMIZE_SSE -DOPTIMIZE_SSE2" ;; powerpc) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_POWERPC" ;; powerpc64) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_POWERPC64" ;; s390x) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_S390X" ;; sparcv8) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SPARCV8" ;; sparcv8plus*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SPARCV8PLUS" ;; sparcv9*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SPARCV9" ;; esac fi if test "$ac_enable_debug" != yes; then # find out how to use assembler ASM_OS=$target_os ASM_CPU=$bc_target_cpu ASM_ARCH=$bc_target_arch ASM_BIGENDIAN=$ac_cv_c_bigendian ASM_GNU_STACK=$bc_gnu_stack { $as_echo "$as_me:$LINENO: checking how to switch to text segment" >&5 $as_echo_n "checking how to switch to text segment... " >&6; } if test "${bc_cv_asm_textseg+set}" = set; then $as_echo_n "(cached) " >&6 else case $target_os in aix*) bc_cv_asm_textseg=".csect .text[PR]" ;; hpux*) if test "$bc_target_arch" = ia64; then bc_cv_asm_textseg=".section .text" else bc_cv_asm_textseg=".code" fi ;; *) bc_cv_asm_textseg=".text" ;; esac fi { $as_echo "$as_me:$LINENO: result: $bc_cv_asm_textseg" >&5 $as_echo "$bc_cv_asm_textseg" >&6; } ASM_TEXTSEG=$bc_cv_asm_textseg { $as_echo "$as_me:$LINENO: checking how to declare a global symbol" >&5 $as_echo_n "checking how to declare a global symbol... " >&6; } if test "${bc_cv_asm_globl+set}" = set; then $as_echo_n "(cached) " >&6 else case $target_os in hpux*) bc_cv_asm_globl=".export" ;; *) bc_cv_asm_globl=".globl" ;; esac fi { $as_echo "$as_me:$LINENO: result: $bc_cv_asm_globl" >&5 $as_echo "$bc_cv_asm_globl" >&6; } ASM_GLOBL=$bc_cv_asm_globl { $as_echo "$as_me:$LINENO: checking if global symbols need leading underscore" >&5 $as_echo_n "checking if global symbols need leading underscore... " >&6; } if test "${bc_cv_asm_gsym_prefix+set}" = set; then $as_echo_n "(cached) " >&6 else case $target_os in cygwin* | mingw* | darwin*) bc_cv_asm_gsym_prefix="_" ;; *) bc_cv_asm_gsym_prefix="" ;; esac fi { $as_echo "$as_me:$LINENO: result: $bc_cv_asm_gsym_prefix" >&5 $as_echo "$bc_cv_asm_gsym_prefix" >&6; } ASM_GSYM_PREFIX=$bc_cv_asm_gsym_prefix { $as_echo "$as_me:$LINENO: checking how to declare a local symbol" >&5 $as_echo_n "checking how to declare a local symbol... " >&6; } if test "${bc_cv_asm_lsym_prefix+set}" = set; then $as_echo_n "(cached) " >&6 else case $target_os in aix* | darwin*) bc_cv_asm_lsym_prefix="L" ;; hpux* | osf*) bc_cv_asm_lsym_prefix="$" ;; linux*) case $target_cpu in alpha*) bc_cv_asm_lsym_prefix="$" ;; *) bc_cv_asm_lsym_prefix=".L" ;; esac ;; *) bc_cv_asm_lsym_prefix=".L" ;; esac fi { $as_echo "$as_me:$LINENO: result: $bc_cv_asm_lsym_prefix" >&5 $as_echo "$bc_cv_asm_lsym_prefix" >&6; } ASM_LSYM_PREFIX=$bc_cv_asm_lsym_prefix { $as_echo "$as_me:$LINENO: checking how to align symbols" >&5 $as_echo_n "checking how to align symbols... " >&6; } if test "${bc_cv_asm_align+set}" = set; then $as_echo_n "(cached) " >&6 else case $target_cpu in alpha*) bc_cv_asm_align=".align 5" ;; x86_64 | athlon64 | em64t | k8) bc_cv_asm_align=".align 16" ;; i[3456]86 | athlon*) bc_cv_asm_align=".align 4" ;; ia64) bc_cv_asm_align=".align 16" ;; powerpc*) bc_cv_asm_align=".align 2" ;; s390x) bc_cv_asm_align=".align 4" ;; sparc*) bc_cv_asm_align=".align 4" ;; esac fi { $as_echo "$as_me:$LINENO: result: $bc_cv_asm_align" >&5 $as_echo "$bc_cv_asm_align" >&6; } ASM_ALIGN=$bc_cv_asm_align fi # generate assembler source files from m4 files echo > mpopt.s echo > blowfishopt.s echo > sha1opt.s if test "$ac_enable_debug" != yes; then case $bc_target_arch in arm) ac_config_commands="$ac_config_commands mpopt.arm" ;; alpha*) ac_config_commands="$ac_config_commands mpopt.alpha" ;; x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona | core2) ac_config_commands="$ac_config_commands mpopt.x86_64" ;; i[3456]86 | pentium* | \ athlon*) ac_config_commands="$ac_config_commands mpopt.x86" ac_config_commands="$ac_config_commands sha1opt.x86" ;; ia64) ac_config_commands="$ac_config_commands mpopt.ia64" ;; m68k) ac_config_commands="$ac_config_commands mpopt.m68k" ;; powerpc) ac_config_commands="$ac_config_commands mpopt.ppc" ;; powerpc64) ac_config_commands="$ac_config_commands mpopt.ppc64" ;; s390x) ac_config_commands="$ac_config_commands mpopt.s390x" ;; sparcv8) ac_config_commands="$ac_config_commands mpopt.sparcv8" ;; sparcv8plus) ac_config_commands="$ac_config_commands mpopt.sparcv8plus" ;; esac case $bc_target_arch in x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona | core2) ;; i[56]86 | pentium* | athlon*) ac_config_commands="$ac_config_commands blowfishopt.i586" ;; powerpc) ac_config_commands="$ac_config_commands blowfishopt.ppc" ;; esac fi # Check for standard types and integers of specific sizes { $as_echo "$as_me:$LINENO: checking for size_t" >&5 $as_echo_n "checking for size_t... " >&6; } if test "${ac_cv_type_size_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_size_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((size_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 $as_echo "$ac_cv_type_size_t" >&6; } if test "x$ac_cv_type_size_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi bc_typedef_size_t= if test $ac_cv_type_size_t != yes; then bc_typedef_size_t="typedef unsigned size_t;" else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } if test "${ac_cv_sizeof_size_t+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_size_t=$ac_lo;; '') if test "$ac_cv_type_size_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_size_t=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (size_t)); } static unsigned long int ulongval () { return (long int) (sizeof (size_t)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (size_t))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (size_t)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (size_t)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_size_t=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_size_t" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_size_t=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 $as_echo "$ac_cv_sizeof_size_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SIZE_T $ac_cv_sizeof_size_t _ACEOF fi TYPEDEF_SIZE_T=$bc_typedef_size_t if test $ac_cv_header_inttypes_h = yes; then INCLUDE_INTTYPES_H="#include " else INCLUDE_INTTYPES_H= fi if test $ac_cv_header_stdint_h = yes; then INCLUDE_STDINT_H="#include " else INCLUDE_STDINT_H= fi bc_typedef_int8_t= { $as_echo "$as_me:$LINENO: checking for int8_t" >&5 $as_echo_n "checking for int8_t... " >&6; } if test "${ac_cv_type_int8_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_int8_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (int8_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((int8_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int8_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_int8_t" >&5 $as_echo "$ac_cv_type_int8_t" >&6; } if test "x$ac_cv_type_int8_t" = x""yes; then : else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of signed char" >&5 $as_echo_n "checking size of signed char... " >&6; } if test "${ac_cv_sizeof_signed_char+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (signed char))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (signed char))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (signed char))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (signed char))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (signed char))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_signed_char=$ac_lo;; '') if test "$ac_cv_type_signed_char" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (signed char) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (signed char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_signed_char=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (signed char)); } static unsigned long int ulongval () { return (long int) (sizeof (signed char)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (signed char))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (signed char)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (signed char)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_signed_char=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_signed_char" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (signed char) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (signed char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_signed_char=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_signed_char" >&5 $as_echo "$ac_cv_sizeof_signed_char" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SIGNED_CHAR $ac_cv_sizeof_signed_char _ACEOF if test $ac_cv_sizeof_signed_char -eq 1; then bc_typedef_int8_t="typedef signed char int8_t;" fi fi TYPEDEF_INT8_T=$bc_typedef_int8_t bc_typedef_int16_t= { $as_echo "$as_me:$LINENO: checking for int16_t" >&5 $as_echo_n "checking for int16_t... " >&6; } if test "${ac_cv_type_int16_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_int16_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (int16_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((int16_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int16_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5 $as_echo "$ac_cv_type_int16_t" >&6; } if test "x$ac_cv_type_int16_t" = x""yes; then : else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } if test "${ac_cv_sizeof_short+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; '') if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_short=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (short)); } static unsigned long int ulongval () { return (long int) (sizeof (short)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (short))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (short)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (short)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_short=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 $as_echo "$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF if test $ac_cv_sizeof_short -eq 2; then bc_typedef_int16_t="typedef short int16_t;" fi fi TYPEDEF_INT16_T=$bc_typedef_int16_t bc_typedef_int32_t= { $as_echo "$as_me:$LINENO: checking for int32_t" >&5 $as_echo_n "checking for int32_t... " >&6; } if test "${ac_cv_type_int32_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_int32_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (int32_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((int32_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int32_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 $as_echo "$ac_cv_type_int32_t" >&6; } if test "x$ac_cv_type_int32_t" = x""yes; then : else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if test "${ac_cv_sizeof_int+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_int=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (int)); } static unsigned long int ulongval () { return (long int) (sizeof (int)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (int))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (int)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (int)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_int=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF if test $ac_cv_sizeof_int -eq 4; then bc_typedef_int32_t="typedef int int32_t;" fi fi TYPEDEF_INT32_T=$bc_typedef_int32_t bc_typedef_int64_t= { $as_echo "$as_me:$LINENO: checking for int64_t" >&5 $as_echo_n "checking for int64_t... " >&6; } if test "${ac_cv_type_int64_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_int64_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (int64_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((int64_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int64_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_int64_t" >&5 $as_echo "$ac_cv_type_int64_t" >&6; } if test "x$ac_cv_type_int64_t" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_INT64_T 1 _ACEOF else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if test "${ac_cv_sizeof_long+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (long)); } static unsigned long int ulongval () { return (long int) (sizeof (long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (long))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (long)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (long)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF if test $ac_cv_sizeof_long -eq 8; then bc_typedef_int64_t="typedef long int64_t;" else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if test "${ac_cv_sizeof_long_long+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; '') if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (long long)); } static unsigned long int ulongval () { return (long int) (sizeof (long long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (long long))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (long long)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (long long)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_long_long=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF if test $ac_cv_sizeof_long_long -eq 8; then cat >>confdefs.h <<\_ACEOF #define HAVE_INT64_T 1 _ACEOF bc_typedef_int64_t="typedef long long int64_t;" fi fi fi TYPEDEF_INT64_T=$bc_typedef_int64_t bc_typedef_uint8_t= { $as_echo "$as_me:$LINENO: checking for uint8_t" >&5 $as_echo_n "checking for uint8_t... " >&6; } if test "${ac_cv_type_uint8_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_uint8_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (uint8_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((uint8_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_uint8_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint8_t" >&5 $as_echo "$ac_cv_type_uint8_t" >&6; } if test "x$ac_cv_type_uint8_t" = x""yes; then : else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of unsigned char" >&5 $as_echo_n "checking size of unsigned char... " >&6; } if test "${ac_cv_sizeof_unsigned_char+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned char))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned char))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned char))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned char))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned char))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_unsigned_char=$ac_lo;; '') if test "$ac_cv_type_unsigned_char" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned char) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_char=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (unsigned char)); } static unsigned long int ulongval () { return (long int) (sizeof (unsigned char)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (unsigned char))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (unsigned char)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (unsigned char)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_unsigned_char=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_unsigned_char" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned char) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_char=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_char" >&5 $as_echo "$ac_cv_sizeof_unsigned_char" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_CHAR $ac_cv_sizeof_unsigned_char _ACEOF if test $ac_cv_sizeof_unsigned_char -eq 1; then bc_typedef_uint8_t="typedef unsigned char uint8_t;" fi fi TYPEDEF_UINT8_T=$bc_typedef_uint8_t bc_typedef_uint16_t= { $as_echo "$as_me:$LINENO: checking for uint16_t" >&5 $as_echo_n "checking for uint16_t... " >&6; } if test "${ac_cv_type_uint16_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_uint16_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (uint16_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((uint16_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_uint16_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5 $as_echo "$ac_cv_type_uint16_t" >&6; } if test "x$ac_cv_type_uint16_t" = x""yes; then : else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of unsigned short" >&5 $as_echo_n "checking size of unsigned short... " >&6; } if test "${ac_cv_sizeof_unsigned_short+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned short))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned short))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned short))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_unsigned_short=$ac_lo;; '') if test "$ac_cv_type_unsigned_short" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_short=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (unsigned short)); } static unsigned long int ulongval () { return (long int) (sizeof (unsigned short)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (unsigned short))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (unsigned short)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (unsigned short)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_unsigned_short=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_unsigned_short" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_short=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_short" >&5 $as_echo "$ac_cv_sizeof_unsigned_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_SHORT $ac_cv_sizeof_unsigned_short _ACEOF if test $ac_cv_sizeof_unsigned_short -eq 2; then bc_typedef_uint16_t="typedef unsigned short uint16_t;" fi fi TYPEDEF_UINT16_T=$bc_typedef_uint16_t bc_typedef_uint32_t= { $as_echo "$as_me:$LINENO: checking for uint32_t" >&5 $as_echo_n "checking for uint32_t... " >&6; } if test "${ac_cv_type_uint32_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_uint32_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (uint32_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((uint32_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_uint32_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 $as_echo "$ac_cv_type_uint32_t" >&6; } if test "x$ac_cv_type_uint32_t" = x""yes; then : else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of unsigned int" >&5 $as_echo_n "checking size of unsigned int... " >&6; } if test "${ac_cv_sizeof_unsigned_int+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned int))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned int))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned int))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_unsigned_int=$ac_lo;; '') if test "$ac_cv_type_unsigned_int" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_int=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (unsigned int)); } static unsigned long int ulongval () { return (long int) (sizeof (unsigned int)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (unsigned int))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (unsigned int)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (unsigned int)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_unsigned_int=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_unsigned_int" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_int=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_int" >&5 $as_echo "$ac_cv_sizeof_unsigned_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int _ACEOF if test $ac_cv_sizeof_unsigned_int -eq 4; then bc_typedef_uint32_t="typedef unsigned int uint32_t;" fi fi TYPEDEF_UINT32_T=$bc_typedef_uint32_t bc_typedef_uint64_t= { $as_echo "$as_me:$LINENO: checking for uint64_t" >&5 $as_echo_n "checking for uint64_t... " >&6; } if test "${ac_cv_type_uint64_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_uint64_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (uint64_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((uint64_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_uint64_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 $as_echo "$ac_cv_type_uint64_t" >&6; } if test "x$ac_cv_type_uint64_t" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_UINT64_T 1 _ACEOF else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of unsigned long" >&5 $as_echo_n "checking size of unsigned long... " >&6; } if test "${ac_cv_sizeof_unsigned_long+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_unsigned_long=$ac_lo;; '') if test "$ac_cv_type_unsigned_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (unsigned long)); } static unsigned long int ulongval () { return (long int) (sizeof (unsigned long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (unsigned long))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (unsigned long)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (unsigned long)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_unsigned_long=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_unsigned_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_long=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long" >&5 $as_echo "$ac_cv_sizeof_unsigned_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long _ACEOF if test $ac_cv_sizeof_unsigned_long -eq 8; then bc_typedef_uint64_t="typedef unsigned long uint64_t;" else # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of unsigned long long" >&5 $as_echo_n "checking size of unsigned long long... " >&6; } if test "${ac_cv_sizeof_unsigned_long_long+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_unsigned_long_long=$ac_lo;; '') if test "$ac_cv_type_unsigned_long_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_long_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (unsigned long long)); } static unsigned long int ulongval () { return (long int) (sizeof (unsigned long long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (unsigned long long))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (unsigned long long)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (unsigned long long)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_unsigned_long_long=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_unsigned_long_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_long_long=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long_long" >&5 $as_echo "$ac_cv_sizeof_unsigned_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long _ACEOF if test $ac_cv_sizeof_unsigned_long_long -eq 8; then cat >>confdefs.h <<\_ACEOF #define HAVE_UINT64_T 1 _ACEOF bc_typedef_uint64_t="typedef unsigned long long uint64_t;" fi fi fi TYPEDEF_UINT64_T=$bc_typedef_uint64_t { $as_echo "$as_me:$LINENO: checking for long long" >&5 $as_echo_n "checking for long long... " >&6; } if test "${ac_cv_type_long_long+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_long_long=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (long long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((long long))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 $as_echo "$ac_cv_type_long_long" >&6; } if test "x$ac_cv_type_long_long" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LONG_LONG 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define HAVE_LONG_LONG 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for unsigned long long" >&5 $as_echo_n "checking for unsigned long long... " >&6; } if test "${ac_cv_type_unsigned_long_long+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_unsigned_long_long=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (unsigned long long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((unsigned long long))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_unsigned_long_long=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 $as_echo "$ac_cv_type_unsigned_long_long" >&6; } if test "x$ac_cv_type_unsigned_long_long" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_UNSIGNED_LONG_LONG 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define HAVE_UNSIGNED_LONG_LONG 0 _ACEOF fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:$LINENO: checking size of unsigned long" >&5 $as_echo_n "checking size of unsigned long... " >&6; } if test "${ac_cv_sizeof_unsigned_long+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_unsigned_long=$ac_lo;; '') if test "$ac_cv_type_unsigned_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default static long int longval () { return (long int) (sizeof (unsigned long)); } static unsigned long int ulongval () { return (long int) (sizeof (unsigned long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (unsigned long))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (unsigned long)))) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (unsigned long)))) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_unsigned_long=`cat conftest.val` else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_unsigned_long" = yes; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } else ac_cv_sizeof_unsigned_long=0 fi fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long" >&5 $as_echo "$ac_cv_sizeof_unsigned_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long _ACEOF if test $ac_cv_sizeof_unsigned_long -eq 8; then MP_WBITS=64U elif test $ac_cv_sizeof_unsigned_long -eq 4; then MP_WBITS=32U else { { $as_echo "$as_me:$LINENO: error: Illegal CPU word size" >&5 $as_echo "$as_me: error: Illegal CPU word size" >&2;} { (exit 1); exit 1; }; } fi # Generate output files. ac_config_files="$ac_config_files Makefile config.m4 include/Makefile include/beecrypt/Doxyfile include/beecrypt/c++/Doxyfile c++/Makefile c++/beeyond/Makefile c++/crypto/Makefile c++/crypto/spec/Makefile c++/io/Makefile c++/lang/Makefile c++/math/Makefile c++/nio/Makefile c++/provider/Makefile c++/security/Makefile c++/security/auth/Makefile c++/security/cert/Makefile c++/security/spec/Makefile c++/util/Makefile c++/util/concurrent/Makefile c++/util/concurrent/locks/Makefile docs/Makefile gas/Makefile java/Makefile java/build.xml masm/Makefile python/Makefile python/test/Makefile tests/Makefile" ac_config_files="$ac_config_files gnu.h" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${WITH_CPLUSPLUS_TRUE}" && test -z "${WITH_CPLUSPLUS_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_CPLUSPLUS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"WITH_CPLUSPLUS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${WITH_JAVA_TRUE}" && test -z "${WITH_JAVA_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_JAVA\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"WITH_JAVA\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${WITH_PYTHON_TRUE}" && test -z "${WITH_PYTHON_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_PYTHON\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"WITH_PYTHON\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by beecrypt $as_me 4.2.1, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ beecrypt config.status 4.2.1 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { $as_echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { $as_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "X$compiler_lib_search_dirs" | $Xsed -e "$delay_single_quote_subst"`' predep_objects='`$ECHO "X$predep_objects" | $Xsed -e "$delay_single_quote_subst"`' postdep_objects='`$ECHO "X$postdep_objects" | $Xsed -e "$delay_single_quote_subst"`' predeps='`$ECHO "X$predeps" | $Xsed -e "$delay_single_quote_subst"`' postdeps='`$ECHO "X$postdeps" | $Xsed -e "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "X$compiler_lib_search_path" | $Xsed -e "$delay_single_quote_subst"`' LD_CXX='`$ECHO "X$LD_CXX" | $Xsed -e "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "X$old_archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "X$compiler_CXX" | $Xsed -e "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "X$GCC_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "X$lt_prog_compiler_no_builtin_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "X$lt_prog_compiler_wl_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "X$lt_prog_compiler_pic_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "X$lt_prog_compiler_static_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "X$lt_cv_prog_compiler_c_o_CXX" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "X$archive_cmds_need_lc_CXX" | $Xsed -e "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "X$enable_shared_with_static_runtimes_CXX" | $Xsed -e "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "X$export_dynamic_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "X$whole_archive_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "X$compiler_needs_object_CXX" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "X$old_archive_from_new_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "X$old_archive_from_expsyms_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "X$archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "X$archive_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "X$module_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "X$module_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "X$with_gnu_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "X$allow_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "X$no_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "X$hardcode_libdir_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld_CXX='`$ECHO "X$hardcode_libdir_flag_spec_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "X$hardcode_libdir_separator_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "X$hardcode_direct_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "X$hardcode_direct_absolute_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "X$hardcode_minus_L_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "X$hardcode_shlibpath_var_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "X$hardcode_automatic_CXX" | $Xsed -e "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "X$inherit_rpath_CXX" | $Xsed -e "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "X$link_all_deplibs_CXX" | $Xsed -e "$delay_single_quote_subst"`' fix_srcfile_path_CXX='`$ECHO "X$fix_srcfile_path_CXX" | $Xsed -e "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "X$always_export_symbols_CXX" | $Xsed -e "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "X$export_symbols_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "X$exclude_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "X$include_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "X$prelink_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "X$file_list_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "X$hardcode_action_CXX" | $Xsed -e "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "X$compiler_lib_search_dirs_CXX" | $Xsed -e "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "X$predep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "X$postdep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "X$predeps_CXX" | $Xsed -e "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "X$postdeps_CXX" | $Xsed -e "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "X$compiler_lib_search_path_CXX" | $Xsed -e "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ AR \ AR_FLAGS \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ SHELL \ ECHO \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ fix_srcfile_path \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ fix_srcfile_path_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX; do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` ;; esac ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "mpopt.arm") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.arm" ;; "mpopt.alpha") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.alpha" ;; "mpopt.x86_64") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.x86_64" ;; "mpopt.x86") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.x86" ;; "sha1opt.x86") CONFIG_COMMANDS="$CONFIG_COMMANDS sha1opt.x86" ;; "mpopt.ia64") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.ia64" ;; "mpopt.m68k") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.m68k" ;; "mpopt.ppc") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.ppc" ;; "mpopt.ppc64") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.ppc64" ;; "mpopt.s390x") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.s390x" ;; "mpopt.sparcv8") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.sparcv8" ;; "mpopt.sparcv8plus") CONFIG_COMMANDS="$CONFIG_COMMANDS mpopt.sparcv8plus" ;; "blowfishopt.i586") CONFIG_COMMANDS="$CONFIG_COMMANDS blowfishopt.i586" ;; "blowfishopt.ppc") CONFIG_COMMANDS="$CONFIG_COMMANDS blowfishopt.ppc" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "config.m4") CONFIG_FILES="$CONFIG_FILES config.m4" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "include/beecrypt/Doxyfile") CONFIG_FILES="$CONFIG_FILES include/beecrypt/Doxyfile" ;; "include/beecrypt/c++/Doxyfile") CONFIG_FILES="$CONFIG_FILES include/beecrypt/c++/Doxyfile" ;; "c++/Makefile") CONFIG_FILES="$CONFIG_FILES c++/Makefile" ;; "c++/beeyond/Makefile") CONFIG_FILES="$CONFIG_FILES c++/beeyond/Makefile" ;; "c++/crypto/Makefile") CONFIG_FILES="$CONFIG_FILES c++/crypto/Makefile" ;; "c++/crypto/spec/Makefile") CONFIG_FILES="$CONFIG_FILES c++/crypto/spec/Makefile" ;; "c++/io/Makefile") CONFIG_FILES="$CONFIG_FILES c++/io/Makefile" ;; "c++/lang/Makefile") CONFIG_FILES="$CONFIG_FILES c++/lang/Makefile" ;; "c++/math/Makefile") CONFIG_FILES="$CONFIG_FILES c++/math/Makefile" ;; "c++/nio/Makefile") CONFIG_FILES="$CONFIG_FILES c++/nio/Makefile" ;; "c++/provider/Makefile") CONFIG_FILES="$CONFIG_FILES c++/provider/Makefile" ;; "c++/security/Makefile") CONFIG_FILES="$CONFIG_FILES c++/security/Makefile" ;; "c++/security/auth/Makefile") CONFIG_FILES="$CONFIG_FILES c++/security/auth/Makefile" ;; "c++/security/cert/Makefile") CONFIG_FILES="$CONFIG_FILES c++/security/cert/Makefile" ;; "c++/security/spec/Makefile") CONFIG_FILES="$CONFIG_FILES c++/security/spec/Makefile" ;; "c++/util/Makefile") CONFIG_FILES="$CONFIG_FILES c++/util/Makefile" ;; "c++/util/concurrent/Makefile") CONFIG_FILES="$CONFIG_FILES c++/util/concurrent/Makefile" ;; "c++/util/concurrent/locks/Makefile") CONFIG_FILES="$CONFIG_FILES c++/util/concurrent/locks/Makefile" ;; "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; "gas/Makefile") CONFIG_FILES="$CONFIG_FILES gas/Makefile" ;; "java/Makefile") CONFIG_FILES="$CONFIG_FILES java/Makefile" ;; "java/build.xml") CONFIG_FILES="$CONFIG_FILES java/build.xml" ;; "masm/Makefile") CONFIG_FILES="$CONFIG_FILES masm/Makefile" ;; "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;; "python/test/Makefile") CONFIG_FILES="$CONFIG_FILES python/test/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "gnu.h") CONFIG_FILES="$CONFIG_FILES gnu.h" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 $as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 $as_echo "$as_me: error: could not setup config headers machinery" >&2;} { (exit 1); exit 1; }; } fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 $as_echo "$as_me: error: could not create -" >&2;} { (exit 1); exit 1; }; } fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="CXX " # ### BEGIN LIBTOOL CONFIG # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == "file_magic". file_magic_cmd=$lt_file_magic_cmd # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name of the directory that contains temporary libtool files. objdir=$objdir # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that does not interpret backslashes. ECHO=$lt_ECHO # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $* )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[^=]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$@"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$1+=\$2" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$1=\$$1\$2" } _LT_EOF ;; esac sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; "mpopt.arm":C) m4 $srcdir/gas/mpopt.arm.m4 > mpopt.s ;; "mpopt.alpha":C) m4 $srcdir/gas/mpopt.alpha.m4 > mpopt.s ;; "mpopt.x86_64":C) m4 $srcdir/gas/mpopt.x86_64.m4 > mpopt.s ;; "mpopt.x86":C) m4 $srcdir/gas/mpopt.x86.m4 > mpopt.s ;; "sha1opt.x86":C) m4 $srcdir/gas/sha1opt.x86.m4 > sha1opt.s ;; "mpopt.ia64":C) m4 $srcdir/gas/mpopt.ia64.m4 > mpopt.s ;; "mpopt.m68k":C) m4 $srcdir/gas/mpopt.m68k.m4 > mpopt.s ;; "mpopt.ppc":C) m4 $srcdir/gas/mpopt.ppc.m4 > mpopt.s ;; "mpopt.ppc64":C) m4 $srcdir/gas/mpopt.ppc64.m4 > mpopt.s ;; "mpopt.s390x":C) m4 $srcdir/gas/mpopt.s390x.m4 > mpopt.s ;; "mpopt.sparcv8":C) m4 $srcdir/gas/mpopt.sparcv8.m4 > mpopt.s ;; "mpopt.sparcv8plus":C) m4 $srcdir/gas/mpopt.sparcv8plus.m4 > mpopt.s ;; "blowfishopt.i586":C) m4 $srcdir/gas/blowfishopt.i586.m4 > blowfishopt.s ;; "blowfishopt.ppc":C) m4 $srcdir/gas/blowfishopt.ppc.m4 > blowfishopt.s ;; "gnu.h":F) cp gnu.h $ac_top_srcdir/include/beecrypt/gnu.h ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi beecrypt-4.2.1/python/0000777000175000001440000000000011226307274011661 500000000000000beecrypt-4.2.1/python/rng-py.c0000664000175000001440000001647610065270163013171 00000000000000/** \ingroup py_c * \file python/rng-py.c */ #define _REENTRANT 1 /* XXX config.h collides with pyconfig.h */ #include "config.h" #include "Python.h" #ifdef __LCLINT__ #undef PyObject_HEAD #define PyObject_HEAD int _PyObjectHead; #endif #include "beecrypt/python/rng-py.h" #include "debug-py.c" /*@unchecked@*/ static int _rng_debug = 0; /*@unchecked@*/ /*@observer@*/ static const char initialiser_name[] = "_bc.rng"; /* ---------- */ static void rng_dealloc(rngObject * s) /*@modifies s @*/ { if (_rng_debug < -1) fprintf(stderr, "*** rng_dealloc(%p)\n", s); /*@-modobserver@*/ randomGeneratorContextFree(&s->rngc); /*@=modobserver@*/ mpbfree(&s->b); PyObject_Del(s); } static int rng_print(rngObject * s, FILE * fp, /*@unused@*/ int flags) /*@globals fileSystem @*/ /*@modifies fileSystem @*/ { if (_rng_debug < -1) fprintf(stderr, "*** rng_print(%p)\n", s); return 0; } /** \ingroup py_c */ static int rng_init(rngObject * s, PyObject *args, PyObject *kwds) /*@modifies s @*/ { PyObject * o = NULL; const randomGenerator* rng = NULL; if (!PyArg_ParseTuple(args, "|O:Cvt", &o)) return -1; if (o) { /* XXX "FIPS 186" or "Mersenne Twister" */ if (PyString_Check(o)) rng = randomGeneratorFind(PyString_AsString(o)); } if (rng == NULL) rng = randomGeneratorDefault(); /*@-modobserver@*/ if (randomGeneratorContextInit(&s->rngc, rng) != 0) return -1; /*@=modobserver@*/ mpbzero(&s->b); if (_rng_debug) fprintf(stderr, "*** rng_init(%p[%s],%p[%s],%p[%s])\n", s, lbl(s), args, lbl(args), kwds, lbl(kwds)); return 0; } /** \ingroup py_c */ static void rng_free(/*@only@*/ rngObject * s) /*@modifies s @*/ { if (_rng_debug) fprintf(stderr, "*** rng_free(%p[%s])\n", s, lbl(s)); /*@-modobserver@*/ randomGeneratorContextFree(&s->rngc); /*@=modobserver@*/ mpbfree(&s->b); PyObject_Del(s); } /** \ingroup py_c */ static PyObject * rng_alloc(PyTypeObject * subtype, int nitems) /*@*/ { PyObject * ns = PyType_GenericAlloc(subtype, nitems); if (_rng_debug) fprintf(stderr, "*** rng_alloc(%p[%s},%d) ret %p[%s]\n", subtype, lbl(subtype), nitems, ns, lbl(ns)); return (PyObject *) ns; } static PyObject * rng_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds) /*@*/ { PyObject * ns = (PyObject *) PyObject_New(rngObject, &rng_Type); if (_rng_debug < -1) fprintf(stderr, "*** rng_new(%p[%s],%p[%s],%p[%s]) ret %p[%s]\n", subtype, lbl(subtype), args, lbl(args), kwds, lbl(kwds), ns, lbl(ns)); return ns; } static rngObject * rng_New(void) { rngObject * ns = PyObject_New(rngObject, &rng_Type); return ns; } /* ---------- */ /** \ingroup py_c */ static PyObject * rng_Debug(/*@unused@*/ rngObject * s, PyObject * args) /*@globals _Py_NoneStruct @*/ /*@modifies _Py_NoneStruct @*/ { if (!PyArg_ParseTuple(args, "i:Debug", &_rng_debug)) return NULL; if (_rng_debug < 0) fprintf(stderr, "*** rng_Debug(%p)\n", s); Py_INCREF(Py_None); return Py_None; } /** \ingroup py_c */ static PyObject * rng_Seed(rngObject * s, PyObject * args) /*@globals _Py_NoneStruct @*/ /*@modifies _Py_NoneStruct @*/ { PyObject * o; randomGeneratorContext* rc = &s->rngc; mpwObject *z; if (!PyArg_ParseTuple(args, "O:Seed", &o)) return NULL; if (!mpw_Check(o) || MPW_SIZE(z = (mpwObject*)o) > 0) return NULL; rc->rng->seed(rc->param, (byte*) MPW_DATA(z), MPW_SIZE(z)); if (_rng_debug < 0) fprintf(stderr, "*** rng_Seed(%p)\n", s); Py_INCREF(Py_None); return Py_None; } /** \ingroup py_c */ static PyObject * rng_Next(rngObject * s, PyObject * args) /*@*/ { PyObject * o = NULL; randomGeneratorContext* rc = &s->rngc; mpbarrett* b = &s->b; mpwObject *z; if (!PyArg_ParseTuple(args, "|O:Next", &o)) return NULL; if (o) { if (mpw_Check(o) && MPW_SIZE(z = (mpwObject*)o) > 0) { b = alloca(sizeof(*b)); mpbzero(b); /* XXX z probably needs normalization here. */ mpbset(b, MPW_SIZE(z), MPW_DATA(z)); } else ; /* XXX error? */ } if (b == NULL || b->size == 0 || b->modl == NULL) { z = mpw_New(1); rc->rng->next(rc->param, (byte*) MPW_DATA(z), sizeof(*MPW_DATA(z))); } else { mpw* wksp = alloca(b->size * sizeof(*wksp)); z = mpw_New(b->size); mpbrnd_w(b, rc, MPW_DATA(z), wksp); } if (_rng_debug) fprintf(stderr, "*** rng_Next(%p) %p[%d]\t", s, MPW_DATA(z), MPW_SIZE(z)), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z)); return (PyObject *)z; } /** \ingroup py_c */ static PyObject * rng_Prime(rngObject * s, PyObject * args) /*@*/ { randomGeneratorContext* rc = &s->rngc; unsigned pbits = 160; int trials = -1; size_t psize; mpbarrett* b; mpw *temp; mpwObject *z; if (!PyArg_ParseTuple(args, "|ii:Prime", &pbits, &trials)) return NULL; psize = MP_ROUND_B2W(pbits); temp = alloca((8*psize+2) * sizeof(*temp)); b = alloca(sizeof(*b)); mpbzero(b); if (trials <= 2) trials = mpptrials(pbits); #if 1 mpprnd_w(b, rc, pbits, trials, (const mpnumber*) 0, temp); #else mpprndsafe_w(b, rc, pbits, trials, temp); #endif z = mpw_FromMPW(b->size, b->modl, 1); if (z != NULL && _rng_debug) fprintf(stderr, "*** rng_Prime(%p) %p[%d]\t", s, MPW_DATA(z), MPW_SIZE(z)), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z)); return (PyObject *)z; } /*@-fullinitblock@*/ /*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rng_methods[] = { {"Debug", (PyCFunction)rng_Debug, METH_VARARGS, NULL}, {"seed", (PyCFunction)rng_Seed, METH_VARARGS, NULL}, {"next", (PyCFunction)rng_Next, METH_VARARGS, NULL}, {"prime", (PyCFunction)rng_Prime, METH_VARARGS, NULL}, {NULL, NULL} /* sentinel */ }; /*@=fullinitblock@*/ static PyObject * rng_getattro(PyObject * o, PyObject * n) /*@*/ { return PyObject_GenericGetAttr(o, n); } static int rng_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { return PyObject_GenericSetAttr(o, n, v); } /* ---------- */ /** */ /*@unchecked@*/ /*@observer@*/ static char rng_doc[] = ""; /*@-fullinitblock@*/ PyTypeObject rng_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "_bc.rng", /* tp_name */ sizeof(rngObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor) rng_dealloc, /* tp_dealloc */ (printfunc) rng_print, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ (cmpfunc)0, /* tp_compare */ (reprfunc)0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)0, /* tp_str */ (getattrofunc) rng_getattro, /* tp_getattro */ (setattrofunc) rng_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rng_doc, /* tp_doc */ #if Py_TPFLAGS_HAVE_ITER 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)0, /* tp_iter */ (iternextfunc)0, /* tp_iternext */ rng_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc) rng_init, /* tp_init */ (allocfunc) rng_alloc, /* tp_alloc */ (newfunc) rng_new, /* tp_new */ (destructor) rng_free, /* tp_free */ 0, /* tp_is_gc */ #endif }; /*@=fullinitblock@*/ /* ---------- */ beecrypt-4.2.1/python/mpw-py.c0000644000175000001440000017503211223574571013205 00000000000000/** \ingroup py_c * \file python/mpw-py.c */ #define _REENTRANT 1 /* XXX config.h collides with pyconfig.h */ #include "config.h" #include "Python.h" #include "longintrepr.h" #ifdef __LCLINT__ #undef PyObject_HEAD #define PyObject_HEAD int _PyObjectHead; #endif #include "beecrypt/python/mpw-py.h" #include "beecrypt/python/rng-py.h" #include "debug-py.c" #define ABS(_x) ((_x) < 0 ? -(_x) : (_x)) #if !defined(MAX) #define MAX(x, y) ((x) < (y) ? (y) : (x)) #endif #if !defined(MIN) #define MIN(x, y) ((x) > (y) ? (y) : (x)) #endif #define MPBITCNT(_s, _d) (MP_WORDS_TO_BITS(_s) - mpmszcnt((_s), (_d))) #define BITS_TO_DIGITS(_b) (((_b) + SHIFT - 1)/SHIFT) #define DIGITS_TO_BITS(_d) ((_d) * SHIFT) /*@unchecked@*/ static int _ie = 0x44332211; /*@unchecked@*/ static union _dendian { /*@unused@*/ int i; char b[4]; } *_endian = (union _dendian *)&_ie; #define IS_BIG_ENDIAN() (_endian->b[0] == '\x44') #define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11') /*@unchecked@*/ static int _mpw_debug = 0; /*@unchecked@*/ /*@observer@*/ static const char *initialiser_name = ""; /*@unchecked@*/ /*@observer@*/ static const struct { /* Number of digits in the conversion base that always fits in an mp_limb_t. For example, for base 10 on a machine where a mp_limb_t has 32 bits this is 9, since 10**9 is the largest number that fits into a mp_limb_t. */ int chars_per_limb; /* log(2)/log(conversion_base) */ double chars_per_bit_exactly; /* base**chars_per_limb, i.e. the biggest number that fits a word, built by factors of base. Exception: For 2, 4, 8, etc, big_base is log2(base), i.e. the number of bits used to represent each digit in the base. */ unsigned int big_base; /* A BITS_PER_MP_LIMB bit approximation to 1/big_base, represented as a fixed-point number. Instead of dividing by big_base an application can choose to multiply by big_base_inverted. */ unsigned int big_base_inverted; } mp_bases[257] = { /* 0 */ {0, 0.0, 0, 0}, /* 1 */ {0, 1e37, 0, 0}, /* 2 */ {32, 1.0000000000000000, 0x1, 0x0}, /* 3 */ {20, 0.6309297535714574, 0xcfd41b91, 0x3b563c24}, /* 4 */ {16, 0.5000000000000000, 0x2, 0x0}, /* 5 */ {13, 0.4306765580733931, 0x48c27395, 0xc25c2684}, /* 6 */ {12, 0.3868528072345416, 0x81bf1000, 0xf91bd1b6}, /* 7 */ {11, 0.3562071871080222, 0x75db9c97, 0x1607a2cb}, /* 8 */ {10, 0.3333333333333333, 0x3, 0x0}, /* 9 */ {10, 0.3154648767857287, 0xcfd41b91, 0x3b563c24}, /* 10 */ {9, 0.3010299956639812, 0x3b9aca00, 0x12e0be82}, /* 11 */ {9, 0.2890648263178878, 0x8c8b6d2b, 0xd24cde04}, /* 12 */ {8, 0.2789429456511298, 0x19a10000, 0x3fa39ab5}, /* 13 */ {8, 0.2702381544273197, 0x309f1021, 0x50f8ac5f}, /* 14 */ {8, 0.2626495350371935, 0x57f6c100, 0x74843b1e}, /* 15 */ {8, 0.2559580248098155, 0x98c29b81, 0xad0326c2}, /* 16 */ {8, 0.2500000000000000, 0x4, 0x0}, /* 17 */ {7, 0.2446505421182260, 0x18754571, 0x4ef0b6bd}, /* 18 */ {7, 0.2398124665681314, 0x247dbc80, 0xc0fc48a1}, /* 19 */ {7, 0.2354089133666382, 0x3547667b, 0x33838942}, /* 20 */ {7, 0.2313782131597592, 0x4c4b4000, 0xad7f29ab}, /* 21 */ {7, 0.2276702486969530, 0x6b5a6e1d, 0x313c3d15}, /* 22 */ {7, 0.2242438242175754, 0x94ace180, 0xb8cca9e0}, /* 23 */ {7, 0.2210647294575037, 0xcaf18367, 0x42ed6de9}, /* 24 */ {6, 0.2181042919855316, 0xb640000, 0x67980e0b}, /* 25 */ {6, 0.2153382790366965, 0xe8d4a51, 0x19799812}, /* 26 */ {6, 0.2127460535533632, 0x1269ae40, 0xbce85396}, /* 27 */ {6, 0.2103099178571525, 0x17179149, 0x62c103a9}, /* 28 */ {6, 0.2080145976765095, 0x1cb91000, 0x1d353d43}, /* 29 */ {6, 0.2058468324604344, 0x23744899, 0xce1decea}, /* 30 */ {6, 0.2037950470905062, 0x2b73a840, 0x790fc511}, /* 31 */ {6, 0.2018490865820999, 0x34e63b41, 0x35b865a0}, /* 32 */ {6, 0.2000000000000000, 0x5, 0x0}, /* 33 */ {6, 0.1982398631705605, 0x4cfa3cc1, 0xa9aed1b3}, /* 34 */ {6, 0.1965616322328226, 0x5c13d840, 0x63dfc229}, /* 35 */ {6, 0.1949590218937863, 0x6d91b519, 0x2b0fee30}, /* 36 */ {6, 0.1934264036172708, 0x81bf1000, 0xf91bd1b6}, /* 37 */ {6, 0.1919587200065601, 0x98ede0c9, 0xac89c3a9}, /* 38 */ {6, 0.1905514124267734, 0xb3773e40, 0x6d2c32fe}, /* 39 */ {6, 0.1892003595168700, 0xd1bbc4d1, 0x387907c9}, /* 40 */ {6, 0.1879018247091076, 0xf4240000, 0xc6f7a0b}, /* 41 */ {5, 0.1866524112389434, 0x6e7d349, 0x28928154}, /* 42 */ {5, 0.1854490234153689, 0x7ca30a0, 0x6e8629d}, /* 43 */ {5, 0.1842888331487062, 0x8c32bbb, 0xd373dca0}, /* 44 */ {5, 0.1831692509136336, 0x9d46c00, 0xa0b17895}, /* 45 */ {5, 0.1820879004699383, 0xaffacfd, 0x746811a5}, /* 46 */ {5, 0.1810425967800402, 0xc46bee0, 0x4da6500f}, /* 47 */ {5, 0.1800313266566926, 0xdab86ef, 0x2ba23582}, /* 48 */ {5, 0.1790522317510414, 0xf300000, 0xdb20a88}, /* 49 */ {5, 0.1781035935540111, 0x10d63af1, 0xe68d5ce4}, /* 50 */ {5, 0.1771838201355579, 0x12a05f20, 0xb7cdfd9d}, /* 51 */ {5, 0.1762914343888821, 0x1490aae3, 0x8e583933}, /* 52 */ {5, 0.1754250635819545, 0x16a97400, 0x697cc3ea}, /* 53 */ {5, 0.1745834300480449, 0x18ed2825, 0x48a5ca6c}, /* 54 */ {5, 0.1737653428714400, 0x1b5e4d60, 0x2b52db16}, /* 55 */ {5, 0.1729696904450771, 0x1dff8297, 0x111586a6}, /* 56 */ {5, 0.1721954337940981, 0x20d38000, 0xf31d2b36}, /* 57 */ {5, 0.1714416005739134, 0x23dd1799, 0xc8d76d19}, /* 58 */ {5, 0.1707072796637201, 0x271f35a0, 0xa2cb1eb4}, /* 59 */ {5, 0.1699916162869140, 0x2a9ce10b, 0x807c3ec3}, /* 60 */ {5, 0.1692938075987814, 0x2e593c00, 0x617ec8bf}, /* 61 */ {5, 0.1686130986895011, 0x3257844d, 0x45746cbe}, /* 62 */ {5, 0.1679487789570419, 0x369b13e0, 0x2c0aa273}, /* 63 */ {5, 0.1673001788101741, 0x3b27613f, 0x14f90805}, /* 64 */ {5, 0.1666666666666667, 0x6, 0x0}, /* 65 */ {5, 0.1660476462159378, 0x4528a141, 0xd9cf0829}, /* 66 */ {5, 0.1654425539190583, 0x4aa51420, 0xb6fc4841}, /* 67 */ {5, 0.1648508567221603, 0x50794633, 0x973054cb}, /* 68 */ {5, 0.1642720499620502, 0x56a94400, 0x7a1dbe4b}, /* 69 */ {5, 0.1637056554452156, 0x5d393975, 0x5f7fcd7f}, /* 70 */ {5, 0.1631512196835108, 0x642d7260, 0x47196c84}, /* 71 */ {5, 0.1626083122716342, 0x6b8a5ae7, 0x30b43635}, /* 72 */ {5, 0.1620765243931223, 0x73548000, 0x1c1fa5f6}, /* 73 */ {5, 0.1615554674429964, 0x7b908fe9, 0x930634a}, /* 74 */ {5, 0.1610447717564444, 0x84435aa0, 0xef7f4a3c}, /* 75 */ {5, 0.1605440854340214, 0x8d71d25b, 0xcf5552d2}, /* 76 */ {5, 0.1600530732548213, 0x97210c00, 0xb1a47c8e}, /* 77 */ {5, 0.1595714156699382, 0xa1563f9d, 0x9634b43e}, /* 78 */ {5, 0.1590988078692941, 0xac16c8e0, 0x7cd3817d}, /* 79 */ {5, 0.1586349589155960, 0xb768278f, 0x65536761}, /* 80 */ {5, 0.1581795909397823, 0xc3500000, 0x4f8b588e}, /* 81 */ {5, 0.1577324383928644, 0xcfd41b91, 0x3b563c24}, /* 82 */ {5, 0.1572932473495469, 0xdcfa6920, 0x28928154}, /* 83 */ {5, 0.1568617748594410, 0xeac8fd83, 0x1721bfb0}, /* 84 */ {5, 0.1564377883420715, 0xf9461400, 0x6e8629d}, /* 85 */ {4, 0.1560210650222250, 0x31c84b1, 0x491cc17c}, /* 86 */ {4, 0.1556113914024939, 0x342ab10, 0x3a11d83b}, /* 87 */ {4, 0.1552085627701551, 0x36a2c21, 0x2be074cd}, /* 88 */ {4, 0.1548123827357682, 0x3931000, 0x1e7a02e7}, /* 89 */ {4, 0.1544226628011101, 0x3bd5ee1, 0x11d10edd}, /* 90 */ {4, 0.1540392219542636, 0x3e92110, 0x5d92c68}, /* 91 */ {4, 0.1536618862898642, 0x4165ef1, 0xf50dbfb2}, /* 92 */ {4, 0.1532904886526781, 0x4452100, 0xdf9f1316}, /* 93 */ {4, 0.1529248683028321, 0x4756fd1, 0xcb52a684}, /* 94 */ {4, 0.1525648706011593, 0x4a75410, 0xb8163e97}, /* 95 */ {4, 0.1522103467132434, 0x4dad681, 0xa5d8f269}, /* 96 */ {4, 0.1518611533308632, 0x5100000, 0x948b0fcd}, /* 97 */ {4, 0.1515171524096389, 0x546d981, 0x841e0215}, /* 98 */ {4, 0.1511782109217764, 0x57f6c10, 0x74843b1e}, /* 99 */ {4, 0.1508442006228941, 0x5b9c0d1, 0x65b11e6e}, /* 100 */ {4, 0.1505149978319906, 0x5f5e100, 0x5798ee23}, /* 101 */ {4, 0.1501904832236880, 0x633d5f1, 0x4a30b99b}, /* 102 */ {4, 0.1498705416319474, 0x673a910, 0x3d6e4d94}, /* 103 */ {4, 0.1495550618645152, 0x6b563e1, 0x314825b0}, /* 104 */ {4, 0.1492439365274121, 0x6f91000, 0x25b55f2e}, /* 105 */ {4, 0.1489370618588283, 0x73eb721, 0x1aadaccb}, /* 106 */ {4, 0.1486343375718350, 0x7866310, 0x10294ba2}, /* 107 */ {4, 0.1483356667053617, 0x7d01db1, 0x620f8f6}, /* 108 */ {4, 0.1480409554829326, 0x81bf100, 0xf91bd1b6}, /* 109 */ {4, 0.1477501131786861, 0x869e711, 0xe6d37b2a}, /* 110 */ {4, 0.1474630519902391, 0x8ba0a10, 0xd55cff6e}, /* 111 */ {4, 0.1471796869179852, 0x90c6441, 0xc4ad2db2}, /* 112 */ {4, 0.1468999356504447, 0x9610000, 0xb4b985cf}, /* 113 */ {4, 0.1466237184553111, 0x9b7e7c1, 0xa5782bef}, /* 114 */ {4, 0.1463509580758620, 0xa112610, 0x96dfdd2a}, /* 115 */ {4, 0.1460815796324244, 0xa6cc591, 0x88e7e509}, /* 116 */ {4, 0.1458155105286054, 0xacad100, 0x7b8813d3}, /* 117 */ {4, 0.1455526803620167, 0xb2b5331, 0x6eb8b595}, /* 118 */ {4, 0.1452930208392429, 0xb8e5710, 0x627289db}, /* 119 */ {4, 0.1450364656948130, 0xbf3e7a1, 0x56aebc07}, /* 120 */ {4, 0.1447829506139581, 0xc5c1000, 0x4b66dc33}, /* 121 */ {4, 0.1445324131589439, 0xcc6db61, 0x4094d8a3}, /* 122 */ {4, 0.1442847926987864, 0xd345510, 0x3632f7a5}, /* 123 */ {4, 0.1440400303421672, 0xda48871, 0x2c3bd1f0}, /* 124 */ {4, 0.1437980688733776, 0xe178100, 0x22aa4d5f}, /* 125 */ {4, 0.1435588526911310, 0xe8d4a51, 0x19799812}, /* 126 */ {4, 0.1433223277500932, 0xf05f010, 0x10a523e5}, /* 127 */ {4, 0.1430884415049874, 0xf817e01, 0x828a237}, /* 128 */ {4, 0.1428571428571428, 0x7, 0x0}, /* 129 */ {4, 0.1426283821033600, 0x10818201, 0xf04ec452}, /* 130 */ {4, 0.1424021108869747, 0x11061010, 0xe136444a}, /* 131 */ {4, 0.1421782821510107, 0x118db651, 0xd2af9589}, /* 132 */ {4, 0.1419568500933153, 0x12188100, 0xc4b42a83}, /* 133 */ {4, 0.1417377701235801, 0x12a67c71, 0xb73dccf5}, /* 134 */ {4, 0.1415209988221527, 0x1337b510, 0xaa4698c5}, /* 135 */ {4, 0.1413064939005528, 0x13cc3761, 0x9dc8f729}, /* 136 */ {4, 0.1410942141636095, 0x14641000, 0x91bf9a30}, /* 137 */ {4, 0.1408841194731412, 0x14ff4ba1, 0x86257887}, /* 138 */ {4, 0.1406761707131039, 0x159df710, 0x7af5c98c}, /* 139 */ {4, 0.1404703297561400, 0x16401f31, 0x702c01a0}, /* 140 */ {4, 0.1402665594314587, 0x16e5d100, 0x65c3ceb1}, /* 141 */ {4, 0.1400648234939879, 0x178f1991, 0x5bb91502}, /* 142 */ {4, 0.1398650865947379, 0x183c0610, 0x5207ec23}, /* 143 */ {4, 0.1396673142523192, 0x18eca3c1, 0x48ac9c19}, /* 144 */ {4, 0.1394714728255649, 0x19a10000, 0x3fa39ab5}, /* 145 */ {4, 0.1392775294872041, 0x1a592841, 0x36e98912}, /* 146 */ {4, 0.1390854521985406, 0x1b152a10, 0x2e7b3140}, /* 147 */ {4, 0.1388952096850913, 0x1bd51311, 0x2655840b}, /* 148 */ {4, 0.1387067714131417, 0x1c98f100, 0x1e7596ea}, /* 149 */ {4, 0.1385201075671774, 0x1d60d1b1, 0x16d8a20d}, /* 150 */ {4, 0.1383351890281539, 0x1e2cc310, 0xf7bfe87}, /* 151 */ {4, 0.1381519873525671, 0x1efcd321, 0x85d2492}, /* 152 */ {4, 0.1379704747522905, 0x1fd11000, 0x179a9f4}, /* 153 */ {4, 0.1377906240751463, 0x20a987e1, 0xf59e80eb}, /* 154 */ {4, 0.1376124087861776, 0x21864910, 0xe8b768db}, /* 155 */ {4, 0.1374358029495937, 0x226761f1, 0xdc39d6d5}, /* 156 */ {4, 0.1372607812113589, 0x234ce100, 0xd021c5d1}, /* 157 */ {4, 0.1370873187823978, 0x2436d4d1, 0xc46b5e37}, /* 158 */ {4, 0.1369153914223921, 0x25254c10, 0xb912f39c}, /* 159 */ {4, 0.1367449754241439, 0x26185581, 0xae150294}, /* 160 */ {4, 0.1365760475984821, 0x27100000, 0xa36e2eb1}, /* 161 */ {4, 0.1364085852596902, 0x280c5a81, 0x991b4094}, /* 162 */ {4, 0.1362425662114337, 0x290d7410, 0x8f19241e}, /* 163 */ {4, 0.1360779687331669, 0x2a135bd1, 0x8564e6b7}, /* 164 */ {4, 0.1359147715670014, 0x2b1e2100, 0x7bfbb5b4}, /* 165 */ {4, 0.1357529539050150, 0x2c2dd2f1, 0x72dadcc8}, /* 166 */ {4, 0.1355924953769864, 0x2d428110, 0x69ffc498}, /* 167 */ {4, 0.1354333760385373, 0x2e5c3ae1, 0x6167f154}, /* 168 */ {4, 0.1352755763596663, 0x2f7b1000, 0x5911016e}, /* 169 */ {4, 0.1351190772136599, 0x309f1021, 0x50f8ac5f}, /* 170 */ {4, 0.1349638598663645, 0x31c84b10, 0x491cc17c}, /* 171 */ {4, 0.1348099059658080, 0x32f6d0b1, 0x417b26d8}, /* 172 */ {4, 0.1346571975321549, 0x342ab100, 0x3a11d83b}, /* 173 */ {4, 0.1345057169479844, 0x3563fc11, 0x32dee622}, /* 174 */ {4, 0.1343554469488779, 0x36a2c210, 0x2be074cd}, /* 175 */ {4, 0.1342063706143054, 0x37e71341, 0x2514bb58}, /* 176 */ {4, 0.1340584713587979, 0x39310000, 0x1e7a02e7}, /* 177 */ {4, 0.1339117329233981, 0x3a8098c1, 0x180ea5d0}, /* 178 */ {4, 0.1337661393673756, 0x3bd5ee10, 0x11d10edd}, /* 179 */ {4, 0.1336216750601996, 0x3d311091, 0xbbfb88e}, /* 180 */ {4, 0.1334783246737591, 0x3e921100, 0x5d92c68}, /* 181 */ {4, 0.1333360731748201, 0x3ff90031, 0x1c024c}, /* 182 */ {4, 0.1331949058177136, 0x4165ef10, 0xf50dbfb2}, /* 183 */ {4, 0.1330548081372441, 0x42d8eea1, 0xea30efa3}, /* 184 */ {4, 0.1329157659418126, 0x44521000, 0xdf9f1316}, /* 185 */ {4, 0.1327777653067443, 0x45d16461, 0xd555c0c9}, /* 186 */ {4, 0.1326407925678156, 0x4756fd10, 0xcb52a684}, /* 187 */ {4, 0.1325048343149731, 0x48e2eb71, 0xc193881f}, /* 188 */ {4, 0.1323698773862368, 0x4a754100, 0xb8163e97}, /* 189 */ {4, 0.1322359088617821, 0x4c0e0f51, 0xaed8b724}, /* 190 */ {4, 0.1321029160581950, 0x4dad6810, 0xa5d8f269}, /* 191 */ {4, 0.1319708865228925, 0x4f535d01, 0x9d15039d}, /* 192 */ {4, 0.1318398080287045, 0x51000000, 0x948b0fcd}, /* 193 */ {4, 0.1317096685686114, 0x52b36301, 0x8c394d1d}, /* 194 */ {4, 0.1315804563506306, 0x546d9810, 0x841e0215}, /* 195 */ {4, 0.1314521597928493, 0x562eb151, 0x7c3784f8}, /* 196 */ {4, 0.1313247675185968, 0x57f6c100, 0x74843b1e}, /* 197 */ {4, 0.1311982683517524, 0x59c5d971, 0x6d02985d}, /* 198 */ {4, 0.1310726513121843, 0x5b9c0d10, 0x65b11e6e}, /* 199 */ {4, 0.1309479056113158, 0x5d796e61, 0x5e8e5c64}, /* 200 */ {4, 0.1308240206478128, 0x5f5e1000, 0x5798ee23}, /* 201 */ {4, 0.1307009860033912, 0x614a04a1, 0x50cf7bde}, /* 202 */ {4, 0.1305787914387386, 0x633d5f10, 0x4a30b99b}, /* 203 */ {4, 0.1304574268895465, 0x65383231, 0x43bb66bd}, /* 204 */ {4, 0.1303368824626505, 0x673a9100, 0x3d6e4d94}, /* 205 */ {4, 0.1302171484322746, 0x69448e91, 0x374842ee}, /* 206 */ {4, 0.1300982152363760, 0x6b563e10, 0x314825b0}, /* 207 */ {4, 0.1299800734730872, 0x6d6fb2c1, 0x2b6cde75}, /* 208 */ {4, 0.1298627138972530, 0x6f910000, 0x25b55f2e}, /* 209 */ {4, 0.1297461274170591, 0x71ba3941, 0x2020a2c5}, /* 210 */ {4, 0.1296303050907487, 0x73eb7210, 0x1aadaccb}, /* 211 */ {4, 0.1295152381234257, 0x7624be11, 0x155b891f}, /* 212 */ {4, 0.1294009178639407, 0x78663100, 0x10294ba2}, /* 213 */ {4, 0.1292873358018581, 0x7aafdeb1, 0xb160fe9}, /* 214 */ {4, 0.1291744835645007, 0x7d01db10, 0x620f8f6}, /* 215 */ {4, 0.1290623529140715, 0x7f5c3a21, 0x14930ef}, /* 216 */ {4, 0.1289509357448472, 0x81bf1000, 0xf91bd1b6}, /* 217 */ {4, 0.1288402240804449, 0x842a70e1, 0xefdcb0c7}, /* 218 */ {4, 0.1287302100711566, 0x869e7110, 0xe6d37b2a}, /* 219 */ {4, 0.1286208859913518, 0x891b24f1, 0xddfeb94a}, /* 220 */ {4, 0.1285122442369443, 0x8ba0a100, 0xd55cff6e}, /* 221 */ {4, 0.1284042773229231, 0x8e2ef9d1, 0xcceced50}, /* 222 */ {4, 0.1282969778809442, 0x90c64410, 0xc4ad2db2}, /* 223 */ {4, 0.1281903386569819, 0x93669481, 0xbc9c75f9}, /* 224 */ {4, 0.1280843525090381, 0x96100000, 0xb4b985cf}, /* 225 */ {4, 0.1279790124049077, 0x98c29b81, 0xad0326c2}, /* 226 */ {4, 0.1278743114199984, 0x9b7e7c10, 0xa5782bef}, /* 227 */ {4, 0.1277702427352035, 0x9e43b6d1, 0x9e1771a9}, /* 228 */ {4, 0.1276667996348261, 0xa1126100, 0x96dfdd2a}, /* 229 */ {4, 0.1275639755045533, 0xa3ea8ff1, 0x8fd05c41}, /* 230 */ {4, 0.1274617638294791, 0xa6cc5910, 0x88e7e509}, /* 231 */ {4, 0.1273601581921740, 0xa9b7d1e1, 0x8225759d}, /* 232 */ {4, 0.1272591522708010, 0xacad1000, 0x7b8813d3}, /* 233 */ {4, 0.1271587398372755, 0xafac2921, 0x750eccf9}, /* 234 */ {4, 0.1270589147554692, 0xb2b53310, 0x6eb8b595}, /* 235 */ {4, 0.1269596709794558, 0xb5c843b1, 0x6884e923}, /* 236 */ {4, 0.1268610025517973, 0xb8e57100, 0x627289db}, /* 237 */ {4, 0.1267629036018709, 0xbc0cd111, 0x5c80c07b}, /* 238 */ {4, 0.1266653683442337, 0xbf3e7a10, 0x56aebc07}, /* 239 */ {4, 0.1265683910770258, 0xc27a8241, 0x50fbb19b}, /* 240 */ {4, 0.1264719661804097, 0xc5c10000, 0x4b66dc33}, /* 241 */ {4, 0.1263760881150453, 0xc91209c1, 0x45ef7c7c}, /* 242 */ {4, 0.1262807514205999, 0xcc6db610, 0x4094d8a3}, /* 243 */ {4, 0.1261859507142915, 0xcfd41b91, 0x3b563c24}, /* 244 */ {4, 0.1260916806894653, 0xd3455100, 0x3632f7a5}, /* 245 */ {4, 0.1259979361142023, 0xd6c16d31, 0x312a60c3}, /* 246 */ {4, 0.1259047118299582, 0xda488710, 0x2c3bd1f0}, /* 247 */ {4, 0.1258120027502338, 0xdddab5a1, 0x2766aa45}, /* 248 */ {4, 0.1257198038592741, 0xe1781000, 0x22aa4d5f}, /* 249 */ {4, 0.1256281102107963, 0xe520ad61, 0x1e06233c}, /* 250 */ {4, 0.1255369169267456, 0xe8d4a510, 0x19799812}, /* 251 */ {4, 0.1254462191960791, 0xec940e71, 0x15041c33}, /* 252 */ {4, 0.1253560122735751, 0xf05f0100, 0x10a523e5}, /* 253 */ {4, 0.1252662914786691, 0xf4359451, 0xc5c2749}, /* 254 */ {4, 0.1251770521943144, 0xf817e010, 0x828a237}, /* 255 */ {4, 0.1250882898658681, 0xfc05fc01, 0x40a1423}, /* 256 */ {4, 0.1250000000000000, 0x8, 0x0}, }; static void prtmpw(const char * msg, mpwObject * x) /*@global stderr, fileSystem @*/ /*@modifies stderr, fileSystem @*/ { fprintf(stderr, "%5.5s %p[%d]:\t", msg, MPW_DATA(x), MPW_SIZE(x)), mpfprintln(stderr, MPW_SIZE(x), MPW_DATA(x)); } static size_t mpsizeinbase(size_t xsize, mpw* xdata, size_t base) /*@*/ { size_t nbits; size_t res; if (xsize == 0) return 1; /* XXX assumes positive integer. */ nbits = MP_WORDS_TO_BITS(xsize) - mpmszcnt(xsize, xdata); if ((base & (base-1)) == 0) { /* exact power of 2 */ size_t lbits = mp_bases[base].big_base; res = (nbits + (lbits - 1)) / lbits; } else { res = (nbits * mp_bases[base].chars_per_bit_exactly) + 1; } if (_mpw_debug < -1) fprintf(stderr, "*** mpsizeinbase(%p[%d], %d) res %u\n", xdata, xsize, base, (unsigned)res); return res; } #ifdef DYING /*@-boundswrite@*/ static void myndivmod(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, register mpw* workspace) { /* result must be xsize+1 in length */ /* workspace must be ysize+1 in length */ /* expect ydata to be normalized */ mpw q; mpw msw = *ydata; size_t qsize = xsize-ysize; *result = (mpge(ysize, xdata, ydata) ? 1 : 0); mpcopy(xsize, result+1, xdata); if (*result) (void) mpsub(ysize, result+1, ydata); result++; while (qsize--) { q = mppndiv(result[0], result[1], msw); /*@-evalorder@*/ *workspace = mpsetmul(ysize, workspace+1, ydata, q); /*@=evalorder@*/ while (mplt(ysize+1, result, workspace)) { (void) mpsubx(ysize+1, workspace, ysize, ydata); q--; } (void) mpsub(ysize+1, result, workspace); *(result++) = q; } } /*@=boundswrite@*/ #endif static char * mpstr(char * t, size_t nt, size_t size, mpw* data, mpw base) /*@modifies t @*/ { static char bchars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; size_t asize = size + 1; mpw* adata = alloca(asize * sizeof(*adata)); size_t anorm; mpw* zdata = alloca((asize+1) * sizeof(*zdata)); mpw* wksp = alloca((1+1) * sizeof(*wksp)); size_t result; if (_mpw_debug < -1) fprintf(stderr, "*** mpstr(%p[%d], %p[%d], %d):\t", t, nt, data, size, base), mpfprintln(stderr, size, data); mpsetx(asize, adata, size, data); t[nt] = '\0'; while (nt--) { mpndivmod(zdata, asize, adata, 1, &base, wksp); if (_mpw_debug < -1) { fprintf(stderr, " a %p[%d]:\t", adata, asize), mpfprintln(stderr, asize, adata); fprintf(stderr, " z %p[%d]:\t", zdata, asize+1), mpfprintln(stderr, asize+1, zdata); } result = zdata[asize]; t[nt] = bchars[result]; if (mpz(asize, zdata)) break; anorm = asize - mpsize(asize, zdata); if (anorm < asize) asize -= anorm; mpsetx(asize+1, adata, asize, zdata+anorm); asize++; } /* XXX Fill leading zeroes (if any). */ while (nt--) t[nt] = '0'; return t; } static PyObject * mpw_format(mpwObject * z, size_t base, int addL) /*@modifies t @*/ { size_t zsize = MPW_SIZE(z); mpw* zdata = MPW_DATA(z); PyStringObject * so; size_t i; size_t nt; size_t size; mpw* data; char * t, * te; char prefix[5]; char * tcp = prefix; int sign; if (z == NULL || !mpw_Check(z)) { PyErr_BadInternalCall(); return NULL; } if (_mpw_debug < -1) fprintf(stderr, "*** mpw_format(%p,%d,%d):\t", z, base, addL), mpfprintln(stderr, zsize, zdata); assert(base >= 2 && base <= 36); i = 0; if (addL && initialiser_name != NULL) i = strlen(initialiser_name) + 2; /* e.g. 'mpw(' + ')' */ sign = z->ob_size; nt = MPBITCNT(zsize, zdata); if (nt == 0) { base = 10; /* '0' in every base, right */ nt = 1; size = 1; data = alloca(size * sizeof(*data)); *data = 0; } else if (sign < 0) { *tcp++ = '-'; i += 1; /* space to hold '-' */ size = MP_ROUND_B2W(nt); data = zdata + (zsize - size); } else { size = MP_ROUND_B2W(nt); data = zdata + (zsize - size); } if (addL && size > 1) i++; /* space for 'L' suffix */ nt = mpsizeinbase(size, data, base); i += nt; if (base == 16) { *tcp++ = '0'; *tcp++ = 'x'; i += 2; /* space to hold '0x' */ } else if (base == 8) { *tcp++ = '0'; i += 1; /* space to hold the extra '0' */ } else if (base > 10) { *tcp++ = '0' + base / 10; *tcp++ = '0' + base % 10; *tcp++ = '#'; i += 3; /* space to hold e.g. '12#' */ } else if (base < 10) { *tcp++ = '0' + base; *tcp++ = '#'; i += 2; /* space to hold e.g. '6#' */ } so = (PyStringObject *)PyString_FromStringAndSize((char *)0, i); if (so == NULL) return NULL; /* get the beginning of the string memory and start copying things */ te = PyString_AS_STRING(so); if (addL && initialiser_name != NULL && *initialiser_name != '\0') { te = stpcpy(te, initialiser_name); *te++ = '('; /*')'*/ } /* copy the already prepared prefix; e.g. sign and base indicator */ *tcp = '\0'; t = te = stpcpy(te, prefix); (void) mpstr(te, nt, size, data, base); /* Nuke leading zeroes. */ nt = 0; while (t[nt] == '0') nt++; if (t[nt] == '\0') /* all zeroes special case. */ nt--; if (nt > 0) do { *t = t[nt]; } while (*t++ != '\0'); te += strlen(te); if (addL) { if (size > 1) *te++ = 'L'; if (initialiser_name != NULL && *initialiser_name != '\0') *te++ = /*'('*/ ')'; } *te = '\0'; assert(te - PyString_AS_STRING(so) <= i); if (te - PyString_AS_STRING(so) != i) so->ob_size -= i - (te - PyString_AS_STRING(so)); return (PyObject *)so; } /** * Precomputes the sliding window table for computing powers of x. * * Sliding Window Exponentiation, Algorithm 14.85 in "Handbook of Applied Cryptography". * * First of all, the table with the powers of g can be reduced by * about half; the even powers don't need to be accessed or stored. * * Get up to K bits starting with a one, if we have that many still available. * * Do the number of squarings of A in the first column, then multiply by * the value in column two, and finally do the number of squarings in * column three. * * This table can be used for K=2,3,4 and can be extended. * * \verbatim 0 : - | - | - 1 : 1 | g1 @ 0 | 0 10 : 1 | g1 @ 0 | 1 11 : 2 | g3 @ 1 | 0 100 : 1 | g1 @ 0 | 2 101 : 3 | g5 @ 2 | 0 110 : 2 | g3 @ 1 | 1 111 : 3 | g7 @ 3 | 0 1000 : 1 | g1 @ 0 | 3 1001 : 4 | g9 @ 4 | 0 1010 : 3 | g5 @ 2 | 1 1011 : 4 | g11 @ 5 | 0 1100 : 2 | g3 @ 1 | 2 1101 : 4 | g13 @ 6 | 0 1110 : 3 | g7 @ 3 | 1 1111 : 4 | g15 @ 7 | 0 \endverbatim * */ static void mpslide(size_t xsize, const mpw* xdata, size_t size, /*@out@*/ mpw* slide) /*@modifies slide @*/ { size_t rsize = (xsize > size ? xsize : size); mpw* result = alloca(2 * rsize * sizeof(*result)); mpsqr(result, xsize, xdata); /* x^2 temp */ mpsetx(size, slide, xsize+xsize, result); if (_mpw_debug < 0) fprintf(stderr, "\t x^2:\t"), mpfprintln(stderr, size, slide); mpmul(result, xsize, xdata, size, slide); /* x^3 */ mpsetx(size, slide+size, xsize+size, result); if (_mpw_debug < 0) fprintf(stderr, "\t x^3:\t"), mpfprintln(stderr, size, slide+size); mpmul(result, size, slide, size, slide+size); /* x^5 */ mpsetx(size, slide+2*size, size+size, result); if (_mpw_debug < 0) fprintf(stderr, "\t x^5:\t"), mpfprintln(stderr, size, slide+2*size); mpmul(result, size, slide, size, slide+2*size); /* x^7 */ mpsetx(size, slide+3*size, size+size, result); if (_mpw_debug < 0) fprintf(stderr, "\t x^7:\t"), mpfprintln(stderr, size, slide+3*size); mpmul(result, size, slide, size, slide+3*size); /* x^9 */ mpsetx(size, slide+4*size, size+size, result); if (_mpw_debug < 0) fprintf(stderr, "\t x^9:\t"), mpfprintln(stderr, size, slide+4*size); mpmul(result, size, slide, size, slide+4*size); /* x^11 */ mpsetx(size, slide+5*size, size+size, result); if (_mpw_debug < 0) fprintf(stderr, "\t x^11:\t"), mpfprintln(stderr, size, slide+5*size); mpmul(result, size, slide, size, slide+5*size); /* x^13 */ mpsetx(size, slide+6*size, size+size, result); if (_mpw_debug < 0) fprintf(stderr, "\t x^13:\t"), mpfprintln(stderr, size, slide+6*size); mpmul(result, size, slide, size, slide+6*size); /* x^15 */ mpsetx(size, slide+7*size, size+size, result); if (_mpw_debug < 0) fprintf(stderr, "\t x^15:\t"), mpfprintln(stderr, size, slide+7*size); mpsetx(size, slide, xsize, xdata); /* x^1 */ if (_mpw_debug < 0) fprintf(stderr, "\t x^1:\t"), mpfprintln(stderr, size, slide); } /*@observer@*/ /*@unchecked@*/ static byte mpslide_presq[16] = { 0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 4, 2, 4, 3, 4 }; /*@observer@*/ /*@unchecked@*/ static byte mpslide_mulg[16] = { 0, 0, 0, 1, 0, 2, 1, 3, 0, 4, 2, 5, 1, 6, 3, 7 }; /*@observer@*/ /*@unchecked@*/ static byte mpslide_postsq[16] = { 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 }; /** * Exponentiation with precomputed sliding window table. */ /*@-boundsread@*/ static void mpnpowsld_w(mpnumber* n, size_t size, const mpw* slide, size_t psize, const mpw* pdata) /*@modifies n @*/ { size_t rsize = (n->size > size ? n->size : size); mpw* rdata = alloca(2 * rsize * sizeof(*rdata)); short lbits = 0; short kbits = 0; byte s; mpw temp; short count; if (_mpw_debug < 0) fprintf(stderr, "npowsld: p\t"), mpfprintln(stderr, psize, pdata); /* 2. A = 1, i = t. */ mpzero(n->size, n->data); n->data[n->size-1] = 1; /* Find first bit set in exponent. */ temp = *pdata; count = 8 * sizeof(temp); while (count != 0) { if (temp & MP_MSBMASK) break; temp <<= 1; count--; } while (psize) { while (count != 0) { /* Shift next bit of exponent into sliding window. */ kbits <<= 1; if (temp & MP_MSBMASK) kbits++; /* On 1st non-zero in window, try to collect K bits. */ if (kbits != 0) { if (lbits != 0) lbits++; else if (temp & MP_MSBMASK) lbits = 1; else {}; /* If window is full, then compute and clear window. */ if (lbits == 4) { if (_mpw_debug < 0) fprintf(stderr, "*** #1 lbits %d kbits %d\n", lbits, kbits); for (s = mpslide_presq[kbits]; s > 0; s--) { mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) fprintf(stderr, "\t pre1:\t"), mpfprintln(stderr, n->size, n->data); } mpmul(rdata, n->size, n->data, size, slide+mpslide_mulg[kbits]*size); mpsetx(n->size, n->data, n->size+size, rdata); if (_mpw_debug < 0) fprintf(stderr, "\t mul1:\t"), mpfprintln(stderr, n->size, n->data); for (s = mpslide_postsq[kbits]; s > 0; s--) { mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) fprintf(stderr, "\tpost1:\t"), mpfprintln(stderr, n->size, n->data); } lbits = kbits = 0; } } else { mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) fprintf(stderr, "\t sqr:\t"), mpfprintln(stderr, n->size, n->data); } temp <<= 1; count--; } if (--psize) { count = 8 * sizeof(temp); temp = *(pdata++); } } if (kbits != 0) { if (_mpw_debug < 0) fprintf(stderr, "*** #1 lbits %d kbits %d\n", lbits, kbits); for (s = mpslide_presq[kbits]; s > 0; s--) { mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) fprintf(stderr, "\t pre2:\t"), mpfprintln(stderr, n->size, n->data); } mpmul(rdata, n->size, n->data, size, slide+mpslide_mulg[kbits]*size); mpsetx(n->size, n->data, n->size+size, rdata); if (_mpw_debug < 0) fprintf(stderr, "\t mul2:\t"), mpfprintln(stderr, n->size, n->data); for (s = mpslide_postsq[kbits]; s > 0; s--) { mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) fprintf(stderr, "\tpost2:\t"), mpfprintln(stderr, n->size, n->data); } } } /*@=boundsread@*/ /** * mpnpow_w * * Uses sliding window exponentiation; needs extra storage: * if K=3, needs 4*size, if K=4, needs 8*size */ /*@-boundsread@*/ static void mpnpow_w(mpnumber* n, size_t xsize, const mpw* xdata, size_t psize, const mpw* pdata) /*@modifies n @*/ { size_t xbits = MPBITCNT(xsize, xdata); size_t pbits = MPBITCNT(psize, pdata); size_t nbits; mpw *slide; size_t nsize; size_t size; /* Special case: 0**P and X**(-P) */ if (xbits == 0 || (psize > 0 && mpmsbset(psize, pdata))) { mpnsetw(n, 0); return; } /* Special case: X**0 and 1**P */ if (pbits == 0 || mpisone(xsize, xdata)) { mpnsetw(n, 1); return; } /* Normalize (to mpw boundary) exponent. */ pdata += psize - MP_ROUND_B2W(pbits); psize -= MP_BITS_TO_WORDS(pbits); /* Calculate size of result. */ if (xbits == 0) xbits = 1; nbits = (*pdata) * xbits; nsize = MP_ROUND_B2W(nbits); /* XXX Add 1 word to carry sign bit */ if (!mpmsbset(xsize, xdata) && (nbits & (MP_WBITS - 1)) == 0) nsize++; size = MP_ROUND_B2W(15 * xbits); if (_mpw_debug < 0) fprintf(stderr, "*** pbits %d xbits %d nsize %d size %d\n", pbits, xbits, nsize, size); mpnsize(n, nsize); /* 1. Precompute odd powers of x (up to 2**K). */ slide = (mpw*) alloca( (8*size) * sizeof(mpw)); mpslide(xsize, xdata, size, slide); /*@-internalglobs -mods@*/ /* noisy */ mpnpowsld_w(n, size, slide, psize, pdata); /*@=internalglobs =mods@*/ } /*@=boundsread@*/ /* ---------- */ mpwObject * mpw_New(int ob_size) /*@*/ { size_t size = ABS(ob_size); mpwObject * z; /* XXX Make sure that 0 has allocated space. */ if (size == 0) size++; z = PyObject_NEW_VAR(mpwObject, &mpw_Type, size); if (z == NULL) return NULL; z->ob_size = ob_size; if (size > 0) memset(&z->data, 0, size * sizeof(*z->data)); return z; } static mpwObject * mpw_Copy(mpwObject *a) /*@*/ { mpwObject * z; z = mpw_FromMPW(MPW_SIZE(a), MPW_DATA(a), 1); if (z != NULL) z->ob_size = a->ob_size; return z; } static mpwObject * mpw_FromLong(long ival) /*@*/ { mpwObject * z = mpw_New(1); if (z == NULL) return NULL; if (ival < 0) { z->ob_size = -z->ob_size; ival = -ival; } z->data[0] = (mpw) ival; return z; } static mpwObject * mpw_FromDouble(double dval) { mpwObject * z = mpw_New(1); if (z == NULL) return NULL; if (dval < 0) { z->ob_size = -z->ob_size; dval = -dval; } z->data[0] = (mpw) dval; return z; } #ifdef NOTYET static mpwObject * mpw_FromString(const char * str, char ** sep, int base) /*@*/ { const char * s = str, * se; mpwObject * z = NULL; mpw zbase, zval; int sign = 1; int ndigits; if ((base != 0 && base < 2) || base > 36) { PyErr_SetString(PyExc_ValueError, "mpw() arg 2 must be >= 2 and <= 36"); return NULL; } while (*s != '\0' && isspace(Py_CHARMASK(*s))) s++; if (*s == '+') ++s; else if (*s == '-') { ++s; sign = -1; } while (*s != '\0' && isspace(Py_CHARMASK(*s))) s++; if (base == 0) { if (s[0] != '0') base = 10; else if (s[1] == 'x' || s[1] == 'X') base = 16; else base = 8; } if (base == 16 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) s += 2; /* Validate characters as digits of base. */ for (se = s; *se != '\0'; se++) { int k; if (*se <= '9') k = *se - '0'; else if (*se >= 'a') k = *se - 'a' + 10; else if (*se >= 'A') k = *se - 'A' + 10; else k = -1; if (k < 0 || k >= base) break; } if (se == s) goto onError; ndigits = (se - s); if (*se == 'L' || *se == 'l') se++; while (*se && isspace(Py_CHARMASK(*se))) se++; if (sep) *sep = se; if (*se != '\0') goto onError; /* Allocate mpw. */ /* Convert digit string. */ zbase = base; for (se = s; *se != '\0'; se++) { if (*se <= '9') zval = *se - '0'; else if (*se >= 'a') zval = *se - 'a' + 10; else if (*se >= 'A') zval = *se - 'A' + 10; } if (sign < 0 && z != NULL && z->ob_size != 0) z->ob_size = -(z->ob_size); return z; onError: PyErr_Format(PyExc_ValueError, "invalid literal for mpw(): %.200s", str); Py_XDECREF(z); return NULL; } #endif static mpwObject * mpw_FromHEX(const char * hex) /*@*/ { size_t len = strlen(hex); size_t size = MP_NIBBLES_TO_WORDS(len + MP_WNIBBLES - 1); mpwObject * z = mpw_New(size); if (z != NULL && size > 0) hs2ip(MPW_DATA(z), size, hex, len); return z; } mpwObject * mpw_FromMPW(size_t size, mpw* data, int normalize) { mpwObject * z; if (normalize) { size_t norm = size - MP_ROUND_B2W(MPBITCNT(size, data)); if (norm > 0 && norm < size) { size -= norm; data += norm; } } z = mpw_New(size); if (z == NULL) return NULL; if (size > 0) memcpy(&z->data, data, size * sizeof(*z->data)); return z; } static mpwObject * mpw_FromLongObject(PyLongObject *lo) /*@*/ { mpwObject * z; int lsize = ABS(lo->ob_size); int lbits = DIGITS_TO_BITS(lsize); size_t zsize = MP_BITS_TO_WORDS(lbits) + 1; mpw* zdata; unsigned char * zb; size_t nzb; int is_littleendian = 0; int is_signed = 0; lsize = zsize; if (lo->ob_size < 0) lsize = -lsize; z = mpw_New(lsize); if (z == NULL) return NULL; zdata = MPW_DATA(z); zb = (unsigned char *) zdata; nzb = MP_WORDS_TO_BYTES(zsize); /* Grab long as big-endian unsigned octets. */ if (_PyLong_AsByteArray(lo, zb, nzb, is_littleendian, is_signed)) { Py_DECREF(z); return NULL; } /* Endian swap zdata's mpw elements. */ if (IS_LITTLE_ENDIAN()) { mpw w = 0; int zx = 0; while (nzb) { w <<= 8; w |= *zb++; nzb--; if ((nzb % MP_WBYTES) == 0) { zdata[zx++] = w; w = 0; } } } return z; } /* ---------- */ static void mpw_dealloc(/*@only@*/mpwObject * s) /*@modifies s @*/ { if (_mpw_debug < -1) fprintf(stderr, "*** mpw_dealloc(%p[%s])\n", s, lbl(s)); PyObject_Del(s); } static int mpw_compare(mpwObject * a, mpwObject * b) /*@*/ { size_t asize = MPW_SIZE(a); mpw* adata = MPW_DATA(a); size_t bsize = MPW_SIZE(b); mpw* bdata = MPW_DATA(b); int ret; if (mpeqx(asize, adata, bsize, bdata)) ret = 0; else if (mpgtx(asize, adata, bsize, bdata)) ret = 1; else ret = -1; if (_mpw_debug) fprintf(stderr, "*** mpw_compare(%p[%s],%p[%s]) ret %d\n", a, lbl(a), b, lbl(b), ret); return ret; } static PyObject * mpw_repr(mpwObject * a) /*@*/ { PyObject * so = mpw_format(a, 10, 1); if (_mpw_debug && so != NULL) fprintf(stderr, "*** mpw_repr(%p): \"%s\"\n", a, PyString_AS_STRING(so)); return so; } /** \ingroup py_c */ static PyObject * mpw_str(mpwObject * a) /*@*/ { PyObject * so = mpw_format(a, 10, 0); if (so != NULL && _mpw_debug < -1) fprintf(stderr, "*** mpw_str(%p): \"%s\"\n", a, PyString_AS_STRING(so)); return so; } #ifdef DYING /** \ingroup py_c */ static int mpw_init(mpwObject * z, PyObject *args, PyObject *kwds) /*@modifies s @*/ { PyObject * o = NULL; long l = 0; if (!PyArg_ParseTuple(args, "|O:Cvt", &o)) return -1; if (o == NULL) { mpnsetw(&z->n, l); } else if (PyInt_Check(o)) { l = PyInt_AsLong(o); mpnsetw(&z->n, l); } else if (PyLong_Check(o)) { PyLongObject *lo = (PyLongObject *)o; int lsize = ABS(lo->ob_size); int lbits = DIGITS_TO_BITS(lsize); size_t zsize = MP_BITS_TO_WORDS(lbits) + 1; mpw* zdata = alloca(zsize * sizeof(*zdata)); unsigned char * zb = (unsigned char *) zdata; size_t nzb = MP_WORDS_TO_BYTES(zsize); int is_littleendian = 0; int is_signed = 1; /* Grab long as big-endian signed octets. */ if (_PyLong_AsByteArray(lo, zb, nzb, is_littleendian, is_signed)) return -1; /* Endian swap zdata's mpw elements. */ if (IS_LITTLE_ENDIAN()) { mpw w = 0; int zx = 0; while (nzb) { w <<= 8; w |= *zb++; nzb--; if ((nzb % MP_WBYTES) == 0) { zdata[zx++] = w; w = 0; } } } mpnset(&z->n, zsize, zdata); } else if (PyFloat_Check(o)) { double d = PyFloat_AsDouble(o); /* XXX TODO: check for overflow/underflow. */ l = (long) (d + 0.5); mpnsetw(&z->n, l); } else if (PyString_Check(o)) { const unsigned char * hex = PyString_AsString(o); /* XXX TODO: check for hex. */ mpnsethex(&z->n, hex); } else if (mpw_Check(o)) { mpwObject *a = (mpwObject *)o; mpncopy(&z->n, &a->n); } else { PyErr_SetString(PyExc_TypeError, "non-numeric coercion failed (mpw_init)"); return -1; } if (_mpw_debug) fprintf(stderr, "*** mpw_init(%p[%s],%p[%s],%p[%s]):\t", z, lbl(z), args, lbl(args), kwds, lbl(kwds)), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z)); return 0; } #endif /** \ingroup py_c */ static void mpw_free(/*@only@*/ mpwObject * s) /*@modifies s @*/ { if (_mpw_debug) fprintf(stderr, "*** mpw_free(%p[%s])\n", s, lbl(s)); PyObject_Del(s); } /** \ingroup py_c * Convert integer to mpw. */ static mpwObject * mpw_i2mpw(PyObject * o) /*@modifies o @*/ { if (mpw_Check(o)) { Py_INCREF(o); return (mpwObject *)o; } if (PyInt_Check(o)) return mpw_FromLong(PyInt_AsLong(o)); else if (PyLong_Check(o)) return mpw_FromLongObject((PyLongObject *)o); else if (PyFloat_Check(o)) return mpw_FromDouble(PyFloat_AsDouble(o)); else if (PyString_Check(o)) return mpw_FromHEX(PyString_AS_STRING(o)); PyErr_SetString(PyExc_TypeError, "number coercion (to mpwObject) failed"); return NULL; } static PyObject * mpw_new(PyTypeObject *type, PyObject *args, PyObject *kwds) /*@*/ { mpwObject *z; if (type != &mpw_Type) { mpwObject *tz; size_t size; assert(PyType_IsSubtype(type, &mpw_Type)); tz = (mpwObject *)mpw_new(&mpw_Type, args, kwds); if (tz == NULL) return NULL; size = ABS(tz->ob_size); z = (mpwObject *) type->tp_alloc(type, size); if (z == NULL) return NULL; z->ob_size = tz->ob_size; if (size > 0) memcpy(&z->data, &tz->data, size * sizeof(*z->data)); Py_DECREF(tz); } else { PyObject * x = NULL; int base = -909; static char *kwlist[] = {"x", "base", 0}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oi:mpw", kwlist, &x, &base)) return NULL; if (x != NULL) { /* XXX make sure new instance, not old reference. */ if (mpw_Check(x)) { mpwObject *zo = (mpwObject *)x; z = mpw_Copy(zo); } else z = mpw_i2mpw(x); } else z = mpw_FromLong(0); } if (_mpw_debug < -1) fprintf(stderr, "*** mpw_new(%p[%s],%p[%s],%p[%s])\t", type, lbl(type), args, lbl(args), kwds, lbl(kwds)), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z)); return (PyObject *)z; } /** \ingroup py_c * Compute 2 argument operations. */ static PyObject * mpw_ops2(const char *fname, char op, mpwObject *x, mpwObject *m) /*@*/ { mpwObject * z = NULL; size_t xsize; mpw* xdata; size_t msize; mpw* mdata; size_t mnorm; size_t asize; mpw* adata; size_t bsize; mpw* bdata; size_t shift; size_t zsize; mpw* zdata; mpw* wksp; mpbarrett b; int carry; int zsign = 0; mpbzero(&b); if (x == NULL || m == NULL) goto exit; xsize = MPW_SIZE(x); xdata = MPW_DATA(x); msize = MPW_SIZE(m); mdata = MPW_DATA(m); mnorm = msize - mpsize(msize, mdata); if (mnorm > 0 && mnorm < msize) { msize -= mnorm; mdata += mnorm; } if (_mpw_debug < 0) { prtmpw("a", x); prtmpw("b", m); } switch (op) { default: goto exit; /*@notreached@*/ break; case '+': zsize = MAX(xsize, msize) + 1; zdata = alloca(zsize * sizeof(*zdata)); mpsetx(zsize, zdata, xsize, xdata); if (x->ob_size < 0) { zsign = 1; if (m->ob_size < 0) { carry = mpaddx(zsize-1, zdata+1, msize, mdata); if (carry) { if (_mpw_debug) fprintf(stderr, "add --: carry\n"); *zdata = 1; } } else { carry = mpsubx(zsize-1, zdata+1, msize, mdata); if (carry) { if (_mpw_debug) fprintf(stderr, "add -+: borrow\n"); *zdata = MP_ALLMASK; mpneg(zsize, zdata); zsign = 0; } } } else { zsign = 0; if (m->ob_size < 0) { carry = mpsubx(zsize-1, zdata+1, msize, mdata); if (carry) { if (_mpw_debug) fprintf(stderr, "add +-: borrow\n"); *zdata = MP_ALLMASK; mpneg(zsize, zdata); zsign = 1; } } else { carry = mpaddx(zsize-1, zdata+1, msize, mdata); if (carry) { if (_mpw_debug) fprintf(stderr, "add ++: carry\n"); *zdata = 1; } } } z = mpw_FromMPW(zsize, zdata, 1); if (zsign) z->ob_size = -z->ob_size; break; case '-': zsize = MAX(xsize, msize) + 1; zdata = alloca(zsize * sizeof(*zdata)); mpsetx(zsize, zdata, xsize, xdata); if (x->ob_size < 0) { zsign = 1; if (m->ob_size < 0) { carry = mpsubx(zsize-1, zdata+1, msize, mdata); if (carry) { if (_mpw_debug) fprintf(stderr, "sub --: borrow\n"); *zdata = MP_ALLMASK; mpneg(zsize, zdata); zsign = 0; } } else { carry = mpaddx(zsize-1, zdata+1, msize, mdata); if (carry) { if (_mpw_debug) fprintf(stderr, "sub -+: carry\n"); *zdata = 1; } } } else { zsign = 0; if (m->ob_size < 0) { carry = mpaddx(zsize-1, zdata+1, msize, mdata); if (carry) { if (_mpw_debug) fprintf(stderr, "sub +-: carry\n"); *zdata = 1; } } else { carry = mpsubx(zsize-1, zdata+1, msize, mdata); if (carry) { if (_mpw_debug) fprintf(stderr, "sub ++: borrow\n"); *zdata = MP_ALLMASK; mpneg(zsize, zdata); zsign = 1; } } } z = mpw_FromMPW(zsize-1, zdata+1, 1); if (zsign) z->ob_size = -z->ob_size; break; case '*': zsize = xsize + msize; zdata = alloca(zsize * sizeof(*zdata)); zsign = x->ob_size * m->ob_size; mpmul(zdata, xsize, xdata, msize, mdata); z = mpw_FromMPW(zsize, zdata, 1); if (zsign < 0) z->ob_size = -z->ob_size; break; case '/': asize = xsize+1; adata = alloca(asize * sizeof(*adata)); mpsetx(asize, adata, xsize, xdata); bsize = msize; bdata = alloca(bsize * sizeof(*bdata)); mpsetx(bsize, bdata, msize, mdata); zsize = asize + 1; zdata = alloca(zsize * sizeof(*zdata)); zsign = x->ob_size * m->ob_size; wksp = alloca((bsize+1) * sizeof(*wksp)); shift = mpnorm(bsize, bdata); mplshift(asize, adata, shift); mpndivmod(zdata, asize, adata, bsize, bdata, wksp); zsize -= bsize; if (zsign < 0) (void) mpaddw(zsize, zdata, (mpw)1); z = mpw_FromMPW(zsize, zdata, 1); if (zsign < 0) z->ob_size = -z->ob_size; break; case '%': asize = xsize+1; adata = alloca(asize * sizeof(*adata)); mpsetx(asize, adata, xsize, xdata); bsize = msize; bdata = mdata; zsize = asize; zdata = alloca(zsize * sizeof(*zdata)); zsign = x->ob_size * m->ob_size; wksp = alloca((2*bsize+1) * sizeof(*wksp)); mpmod(zdata, asize, adata, bsize, bdata, wksp); if (zsign < 0) { if (m->ob_size < 0) { (void) mpsubx(zsize, zdata, bsize, bdata); mpneg(zsize, zdata); } else { zsign = 0; mpneg(zsize, zdata); (void) mpaddx(zsize, zdata, bsize, bdata); } } z = mpw_FromMPW(zsize, zdata, 1); if (zsign < 0) { z->ob_size = -z->ob_size; } else if (zsign > 0) { if (x->ob_size < 0) z->ob_size = -z->ob_size; } break; case '<': /* XXX FIXME: enlarge? negative count? sign?. */ shift = (size_t) (msize == 1 ? mdata[0] : 0); z = mpw_FromMPW(xsize, xdata, 0); if (shift > 0) mplshift(MPW_SIZE(z), MPW_DATA(z), shift); break; case '>': /* XXX FIXME: enlarge? negative count? sign?. */ shift = (size_t) (msize == 1 ? mdata[0] : 0); z = mpw_FromMPW(xsize, xdata, 0); if (shift > 0) mprshift(MPW_SIZE(z), MPW_DATA(z), shift); break; case '&': /* XXX reset to original size for now. */ msize = MPW_SIZE(m); mdata = MPW_DATA(m); if (xsize <= msize) { z = mpw_FromMPW(xsize, xdata, 0); mpand(MPW_SIZE(z), MPW_DATA(z), mdata + (msize - xsize)); } else { z = mpw_FromMPW(msize, mdata, 0); mpand(MPW_SIZE(z), MPW_DATA(z), xdata + (xsize - msize)); } break; case '|': /* XXX reset to original size for now. */ msize = MPW_SIZE(m); mdata = MPW_DATA(m); if (xsize <= msize) { z = mpw_FromMPW(xsize, xdata, 0); mpor(MPW_SIZE(z), MPW_DATA(z), mdata + (msize - xsize)); } else { z = mpw_FromMPW(msize, mdata, 0); mpor(MPW_SIZE(z), MPW_DATA(z), xdata + (xsize - msize)); } break; case '^': /* XXX reset to original size for now. */ msize = MPW_SIZE(m); mdata = MPW_DATA(m); if (xsize <= msize) { z = mpw_FromMPW(xsize, xdata, 0); mpxor(MPW_SIZE(z), MPW_DATA(z), mdata + (msize - xsize)); } else { z = mpw_FromMPW(msize, mdata, 0); mpxor(MPW_SIZE(z), MPW_DATA(z), xdata + (xsize - msize)); } break; case 'P': { mpnumber zn; mpnzero(&zn); if (msize == 0 || (msize == 1 && *mdata == 0)) mpnsetw(&zn, 1); else if (mpz(xsize, xdata) || m->ob_size < 0) mpnsetw(&zn, 0); else { zsign = (x->ob_size > 0 || mpeven(msize, mdata)) ? 1 : -1; mpnpow_w(&zn, xsize, xdata, msize, mdata); } z = mpw_FromMPW(zn.size, zn.data, 1); mpnfree(&zn); if (zsign < 0) z->ob_size = -z->ob_size; } break; case 'G': wksp = alloca((xsize) * sizeof(*wksp)); z = mpw_New(msize); mpgcd_w(xsize, xdata, mdata, MPW_DATA(z), wksp); break; case 'I': wksp = alloca((7*msize+6)*sizeof(*wksp)); z = mpw_New(msize); (void) mpextgcd_w(msize, wksp, mdata, MPW_DATA(z), wksp+msize); break; #ifdef DYING case 'R': { rngObject * r = ((rngObject *)x); wksp = alloca(msize*sizeof(*wksp)); mpbset(&b, msize, mdata); z = mpw_New(msize); mpbrnd_w(&b, &r->rngc, MPW_DATA(z), wksp); } break; #endif case 'S': wksp = alloca((4*msize+2)*sizeof(*wksp)); mpbset(&b, msize, mdata); z = mpw_New(msize); mpbsqrmod_w(&b, xsize, xdata, MPW_DATA(z), wksp); break; } if (_mpw_debug) fprintf(stderr, "*** mpw_%s %p[%d]\t", fname, MPW_DATA(z), MPW_SIZE(z)), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z)); exit: mpbfree(&b); Py_XDECREF(x); Py_XDECREF(m); return (PyObject *)z; } /** \ingroup py_c * Compute 3 argument operations. */ static PyObject * mpw_ops3(const char *fname, char op, mpwObject *x, mpwObject *y, mpwObject *m) /*@*/ { mpwObject * z = NULL; size_t xsize; mpw* xdata; size_t ysize; mpw* ydata; size_t msize; mpw* mdata; size_t zsize; mpw* zdata; mpbarrett b; mpw* wksp; mpbzero(&b); if (x == NULL || y == NULL || m == NULL) goto exit; if (_mpw_debug < 0) { prtmpw("a", x); prtmpw("b", y); prtmpw("c", m); } xsize = MPW_SIZE(x); xdata = MPW_DATA(x); ysize = MPW_SIZE(y); ydata = MPW_DATA(y); msize = MPW_SIZE(m); mdata = MPW_DATA(m); mpbset(&b, msize, mdata); zsize = b.size; zdata = alloca(zsize * sizeof(*zdata)); wksp = alloca((4*zsize+2)*sizeof(*wksp)); switch (op) { case '/': case '%': default: goto exit; /*@notreached@*/ break; case '+': fname = "Addm"; mpbaddmod_w(&b, xsize, xdata, ysize, ydata, zdata, wksp); break; case '-': fname = "Subm"; mpbsubmod_w(&b, xsize, xdata, ysize, ydata, zdata, wksp); break; case '*': fname = "Mulm"; mpbmulmod_w(&b, xsize, xdata, ysize, ydata, zdata, wksp); break; case 'P': fname = "Powm"; mpbpowmod_w(&b, xsize, xdata, ysize, ydata, zdata, wksp); break; } z = mpw_FromMPW(zsize, zdata, 1); if (_mpw_debug < 0) fprintf(stderr, "*** mpw_%s %p[%d]\t", fname, MPW_DATA(z), MPW_SIZE(z)), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z)); exit: mpbfree(&b); Py_XDECREF(x); Py_XDECREF(y); Py_XDECREF(m); return (PyObject *)z; } /* ---------- */ /** \ingroup py_c */ static PyObject * mpw_Debug(/*@unused@*/ mpwObject * s, PyObject * args) /*@globals _Py_NoneStruct @*/ /*@modifies _Py_NoneStruct @*/ { if (!PyArg_ParseTuple(args, "i:Debug", &_mpw_debug)) return NULL; Py_INCREF(Py_None); return Py_None; } /** \ingroup py_c * Compute gcd(x, y). */ static PyObject * mpw_Gcd(mpwObject * s, PyObject * args) /*@*/ { PyObject * xo, * mo; if (!PyArg_ParseTuple(args, "OO:Gcd", &xo, &mo)) return NULL; return mpw_ops2("Gcd", 'G', mpw_i2mpw(xo), mpw_i2mpw(mo)); } /** \ingroup py_c * Compute inverse (modulo m) of x. */ static PyObject * mpw_Invm(/*@unused@*/ mpwObject * s, PyObject * args) /*@*/ { PyObject * xo, * mo; if (!PyArg_ParseTuple(args, "OO:Invm", &xo, &mo)) return NULL; return mpw_ops2("Invm", 'I', mpw_i2mpw(xo), mpw_i2mpw(mo)); } /** \ingroup py_c * Compute x*x (modulo m). */ static PyObject * mpw_Sqrm(mpwObject * s, PyObject * args) /*@*/ { PyObject * xo, * mo; if (!PyArg_ParseTuple(args, "OO:Sqrm", &xo, &mo)) return NULL; return mpw_ops2("Sqrm", 'S', mpw_i2mpw(xo), mpw_i2mpw(mo)); } /** \ingroup py_c * Compute x+y (modulo m). */ static PyObject * mpw_Addm(mpwObject * s, PyObject * args) /*@*/ { PyObject * xo, * yo, * mo; if (!PyArg_ParseTuple(args, "OOO:Addm", &xo, &yo, &mo)) return NULL; return mpw_ops3("Addm", '+', mpw_i2mpw(xo), mpw_i2mpw(yo), mpw_i2mpw(mo)); } /** \ingroup py_c * Compute x-y (modulo m). */ static PyObject * mpw_Subm(mpwObject * s, PyObject * args) /*@*/ { PyObject * xo, * yo, * mo; if (!PyArg_ParseTuple(args, "OOO:Subm", &xo, &yo, &mo)) return NULL; return mpw_ops3("Subm", '-', mpw_i2mpw(xo), mpw_i2mpw(yo), mpw_i2mpw(mo)); } /** \ingroup py_c * Compute x*y (modulo m). */ static PyObject * mpw_Mulm(mpwObject * s, PyObject * args) /*@*/ { PyObject * xo, * yo, * mo; if (!PyArg_ParseTuple(args, "OOO:Mulm", &xo, &yo, &mo)) return NULL; return mpw_ops3("Mulm", '*', mpw_i2mpw(xo), mpw_i2mpw(yo), mpw_i2mpw(mo)); } /** \ingroup py_c * Compute x**y (modulo m). */ static PyObject * mpw_Powm(mpwObject * s, PyObject * args) /*@*/ { PyObject * xo, * yo, * mo; if (!PyArg_ParseTuple(args, "OOO:Powm", &xo, &yo, &mo)) return NULL; return mpw_ops3("Powm", 'P', mpw_i2mpw(xo), mpw_i2mpw(yo), mpw_i2mpw(mo)); } #ifdef DYNING /** \ingroup py_c * Return random number 1 < r < b-1. */ static PyObject * mpw_Rndm(mpwObject * s, PyObject * args) /*@*/ { PyObject * xo, * mo; if (!PyArg_ParseTuple(args, "OO:Rndm", &mo, &xo)) return NULL; if (!is_rng(xo)) { PyErr_SetString(PyExc_TypeError, "mpw.rndm() requires rng_Type argument"); return NULL; } return mpw_ops2("Rndm", 'R', (mpwObject*)xo, mpw_i2mpw(mo)); } #endif /*@-fullinitblock@*/ /*@unchecked@*/ /*@observer@*/ static struct PyMethodDef mpw_methods[] = { {"Debug", (PyCFunction)mpw_Debug, METH_VARARGS, NULL}, {"gcd", (PyCFunction)mpw_Gcd, METH_VARARGS, NULL}, {"invm", (PyCFunction)mpw_Invm, METH_VARARGS, NULL}, {"sqrm", (PyCFunction)mpw_Sqrm, METH_VARARGS, NULL}, {"addm", (PyCFunction)mpw_Addm, METH_VARARGS, NULL}, {"subm", (PyCFunction)mpw_Subm, METH_VARARGS, NULL}, {"mulm", (PyCFunction)mpw_Mulm, METH_VARARGS, NULL}, {"powm", (PyCFunction)mpw_Powm, METH_VARARGS, NULL}, #ifdef DYING {"rndm", (PyCFunction)mpw_Rndm, METH_VARARGS, NULL}, #endif {NULL, NULL} /* sentinel */ }; /*@=fullinitblock@*/ static PyObject * mpw_getattro(PyObject * o, PyObject * n) /*@*/ { return PyObject_GenericGetAttr(o, n); } static int mpw_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { return PyObject_GenericSetAttr(o, n, v); } /* ---------- */ static PyObject * mpw_add(PyObject * a, PyObject * b) /*@*/ { return mpw_ops2("add", '+', mpw_i2mpw(a), mpw_i2mpw(b)); } static PyObject * mpw_sub(PyObject * a, PyObject * b) /*@*/ { return mpw_ops2("sub", '-', mpw_i2mpw(a), mpw_i2mpw(b)); } static PyObject * mpw_mul(PyObject * a, PyObject * b) /*@*/ { return mpw_ops2("mul", '*', mpw_i2mpw(a), mpw_i2mpw(b)); } static PyObject * mpw_div(PyObject * a, PyObject * w) /*@*/ { mpwObject * b = mpw_i2mpw(w); if (mpz(MPW_SIZE(b), MPW_DATA(b))) { Py_DECREF(b); PyErr_SetString(PyExc_ZeroDivisionError, "mpw_divide by zero"); return NULL; } return mpw_ops2("div", '/', mpw_i2mpw(a), b); } static PyObject * mpw_classic_div(PyObject * a, PyObject * b) /*@*/ { if (Py_DivisionWarningFlag && PyErr_Warn(PyExc_DeprecationWarning, "classic long division") < 0) return NULL; return mpw_div(a, b); } static PyObject * mpw_mod(PyObject * a, PyObject * b) /*@*/ { return mpw_ops2("rem", '%', mpw_i2mpw(a), mpw_i2mpw(b)); } static PyObject * mpw_divmod(PyObject * v, PyObject * w) /*@*/ { PyObject * z = NULL; mpwObject * q = NULL; mpwObject * r = NULL; mpwObject * a = mpw_i2mpw(v); size_t asize; mpw* adata; size_t anorm; mpwObject * b = mpw_i2mpw(w); size_t bsize; mpw* bdata; size_t bnorm; size_t zsize; mpw* zdata; mpw* wksp; int qsign = 0; if (a == NULL || b == NULL) goto exit; asize = MPW_SIZE(a); adata = MPW_DATA(a); anorm = mpsize(asize, adata); bsize = MPW_SIZE(b); bdata = MPW_DATA(b); bnorm = mpsize(bsize, bdata); if (mpz(bsize, bdata)) { PyErr_SetString(PyExc_ZeroDivisionError, "mpw_divmod by zero"); goto exit; } if (anorm < asize) { asize -= anorm; adata += anorm; } zsize = asize + 1; zdata = alloca(zsize * sizeof(*zdata)); if (bnorm < bsize) { bsize -= bnorm; bdata += bnorm; } qsign = a->ob_size * b->ob_size; wksp = alloca((bsize+1) * sizeof(*wksp)); mpndivmod(zdata, asize, adata, bsize, bdata, wksp); if (_mpw_debug < 0) { fprintf(stderr, " a %p[%d]:\t", adata, asize), mpfprintln(stderr, asize, adata); fprintf(stderr, " b %p[%d]:\t", bdata, bsize), mpfprintln(stderr, bsize, bdata); fprintf(stderr, " z %p[%d]:\t", zdata, zsize), mpfprintln(stderr, zsize, zdata); } zsize -= bsize; r = mpw_FromMPW(bsize, zdata+zsize, 1); if (r == NULL) goto exit; if (qsign < 0) { if (b->ob_size < 0) { (void) mpsubx(MPW_SIZE(r), MPW_DATA(r), bsize, bdata); mpneg(MPW_SIZE(r), MPW_DATA(r)); } else { mpneg(MPW_SIZE(r), MPW_DATA(r)); (void) mpaddx(MPW_SIZE(r), MPW_DATA(r), bsize, bdata); } (void) mpaddw(zsize, zdata, (mpw)1); } if (b->ob_size < 0) r->ob_size = -r->ob_size; q = mpw_FromMPW(zsize, zdata, 1); if (q == NULL) { Py_DECREF(r); goto exit; } if (qsign < 0) q->ob_size = -q->ob_size; if (_mpw_debug) { prtmpw("q", q); prtmpw("r", r); fprintf(stderr, "*** mpw_divmod(%p,%p)\n", a, b); } if ((z = PyTuple_New(2)) == NULL) { Py_DECREF(q); Py_DECREF(r); goto exit; } (void) PyTuple_SetItem(z, 0, (PyObject *)q); (void) PyTuple_SetItem(z, 1, (PyObject *)r); exit: Py_XDECREF(a); Py_XDECREF(b); return (PyObject *)z; } static PyObject * mpw_pow(PyObject * a, PyObject * b, PyObject * c) /*@*/ { if (c != Py_None) return mpw_ops3("Powm", 'P', mpw_i2mpw(a), mpw_i2mpw(b), mpw_i2mpw(c)); else return mpw_ops2("pow", 'P', mpw_i2mpw(a), mpw_i2mpw(b)); } static PyObject * mpw_neg(mpwObject * a) /*@*/ { mpwObject *z; if (a->ob_size == 0 && mpw_CheckExact(a)) { /* -0 == 0 */ Py_INCREF(a); z = a; } else { z = mpw_Copy(a); if (z != NULL) z->ob_size = -(a->ob_size); } if (z != NULL && _mpw_debug) fprintf(stderr, "*** mpw_neg %p[%d]\t", MPW_DATA(z), MPW_SIZE(z)), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z)); return (PyObject *)z; } static PyObject * mpw_pos(mpwObject * a) /*@*/ { mpwObject *z; if (mpw_CheckExact(a)) { Py_INCREF(a); z = a; } else z = mpw_Copy(a); if (z != NULL && _mpw_debug) fprintf(stderr, "*** mpw_pos %p[%d]\t", MPW_DATA(z), MPW_SIZE(z)), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z)); return (PyObject *)z; } static PyObject * mpw_abs(mpwObject * a) /*@*/ { mpwObject * z; if (a->ob_size < 0) z = (mpwObject *)mpw_neg(a); else z = (mpwObject *)mpw_pos(a); if (z != NULL && _mpw_debug) fprintf(stderr, "*** mpw_abs %p[%d]\t", MPW_DATA(z), MPW_SIZE(z)), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z)); return (PyObject *)z; } static int mpw_nonzero(mpwObject * a) /*@*/ { return ABS(a->ob_size) != 0; } static PyObject * mpw_invert(mpwObject * a) /*@*/ { /* Implement ~z as -(z+1) */ mpwObject * z = mpw_Copy(a); if (z != NULL) { mpw val = 1; int carry; carry = mpaddx(MPW_SIZE(z), MPW_DATA(z), 1, &val); z->ob_size = -(a->ob_size); } return (PyObject *)z; } static PyObject * mpw_lshift(PyObject * a, PyObject * b) /*@*/ { return mpw_ops2("lshift", '<', mpw_i2mpw(a), mpw_i2mpw(b)); } static PyObject * mpw_rshift(PyObject * a, PyObject * b) /*@*/ { return mpw_ops2("rshift", '>', mpw_i2mpw(a), mpw_i2mpw(b)); } static PyObject * mpw_and(PyObject * a, PyObject * b) /*@*/ { return mpw_ops2("and", '&', mpw_i2mpw(a), mpw_i2mpw(b)); } static PyObject * mpw_xor(PyObject * a, PyObject * b) /*@*/ { return mpw_ops2("xor", '^', mpw_i2mpw(a), mpw_i2mpw(b)); } static PyObject * mpw_or(PyObject * a, PyObject * b) /*@*/ { return mpw_ops2("or", '|', mpw_i2mpw(a), mpw_i2mpw(b)); } static int mpw_coerce(PyObject ** pv, PyObject ** pw) /*@modifies *pv, *pw @*/ { if (_mpw_debug) fprintf(stderr, "*** mpw_coerce(%p[%s],%p[%s])\n", pv, lbl(*pv), pw, lbl(*pw)); if (mpw_Check(*pw)) Py_INCREF(*pw); else if (PyInt_Check(*pw)) *pw = (PyObject *) mpw_FromLong(PyInt_AsLong(*pw)); else if (PyLong_Check(*pw)) *pw = (PyObject *) mpw_FromLongObject((PyLongObject *)(*pw)); else if (PyFloat_Check(*pw)) *pw = (PyObject *) mpw_FromDouble(PyFloat_AsDouble(*pw)); else if (PyString_Check(*pw)) *pw = (PyObject *) mpw_FromHEX(PyString_AS_STRING(*pw)); else { PyErr_SetString(PyExc_TypeError, "non-numeric coercion failed (mpw_coerce)"); return 1; } Py_INCREF(*pv); return 0; } static PyObject * mpw_int(mpwObject * a) /*@*/ { size_t anorm = MPW_SIZE(a) - MP_ROUND_B2W(MPBITCNT(MPW_SIZE(a), MPW_DATA(a))); size_t asize = MPW_SIZE(a) - anorm; mpw* adata = MPW_DATA(a) + anorm; long ival = 0; if (asize > 1) { PyErr_SetString(PyExc_ValueError, "mpw_int: arg too long to convert"); return NULL; } if (asize == 1) ival = adata[0]; if (a->ob_size < 0) ival = -ival; return Py_BuildValue("i", ival); } static PyObject * mpw_long(mpwObject * a) /*@*/ { size_t abits = MPBITCNT(MPW_SIZE(a), MPW_DATA(a)); size_t anorm = MPW_SIZE(a) - MP_ROUND_B2W(abits); size_t asize = MPW_SIZE(a) - anorm; mpw* adata = MPW_DATA(a) + anorm; size_t zsize = asize; mpw* zdata = alloca(zsize * sizeof(*zdata)); int lsize = BITS_TO_DIGITS(abits); PyLongObject *lo = _PyLong_New(lsize); int digx; if (lo == NULL) return NULL; mpcopy(asize, zdata, adata); for (digx = 0; digx < lsize; digx++) { lo->ob_digit[digx] = zdata[zsize - 1] & MASK; mprshift(zsize, zdata, SHIFT); } while (digx > 0 && lo->ob_digit[digx-1] == 0) digx--; lo->ob_size = (a->ob_size >= 0 ? digx : -digx); return (PyObject *)lo; } static PyObject * mpw_float(mpwObject * a) /*@*/ { PyObject * so = mpw_format(a, 10, 0); char * s, * se; double d; if (so == NULL) return NULL; s = PyString_AS_STRING(so); se = NULL; d = strtod(s, &se); if (_mpw_debug) fprintf(stderr, "*** mpw_float(%p): s %p \"%s\" se %p d %g\n", a, s, s, se, d); Py_DECREF(so); return Py_BuildValue("d", d); } static PyObject * mpw_oct(mpwObject * a) /*@*/ { return mpw_format(a, 8, 1); } static PyObject * mpw_hex(mpwObject * a) /*@*/ { return mpw_format(a, 16, 1); } static PyNumberMethods mpw_as_number = { (binaryfunc) mpw_add, /* nb_add */ (binaryfunc) mpw_sub, /* nb_subtract */ (binaryfunc) mpw_mul, /* nb_multiply */ (binaryfunc) mpw_classic_div, /* nb_divide */ (binaryfunc) mpw_mod, /* nb_remainder */ (binaryfunc) mpw_divmod, /* nb_divmod */ (ternaryfunc) mpw_pow, /* nb_power */ (unaryfunc) mpw_neg, /* nb_negative */ (unaryfunc) mpw_pos, /* nb_positive */ (unaryfunc) mpw_abs, /* nb_absolute */ (inquiry) mpw_nonzero, /* nb_nonzero */ (unaryfunc) mpw_invert, /* nb_invert */ (binaryfunc) mpw_lshift, /* nb_lshift */ (binaryfunc) mpw_rshift, /* nb_rshift */ (binaryfunc) mpw_and, /* nb_and */ (binaryfunc) mpw_xor, /* nb_xor */ (binaryfunc) mpw_or, /* nb_or */ (coercion) mpw_coerce, /* nb_coerce */ (unaryfunc) mpw_int, /* nb_int */ (unaryfunc) mpw_long, /* nb_long */ (unaryfunc) mpw_float, /* nb_float */ (unaryfunc) mpw_oct, /* nb_oct */ (unaryfunc) mpw_hex, /* nb_hex */ /* Added in release 2.0 */ (binaryfunc) 0, /* nb_inplace_add */ (binaryfunc) 0, /* nb_inplace_subtract */ (binaryfunc) 0, /* nb_inplace_multiply */ (binaryfunc) 0, /* nb_inplace_divide */ (binaryfunc) 0, /* nb_inplace_remainder */ (ternaryfunc)0, /* nb_inplace_power */ (binaryfunc) 0, /* nb_inplace_lshift */ (binaryfunc) 0, /* nb_inplace_rshift */ (binaryfunc) 0, /* nb_inplace_and */ (binaryfunc) 0, /* nb_inplace_xor */ (binaryfunc) 0, /* nb_inplace_or */ /* Added in release 2.2 */ /* The following require the Py_TPFLAGS_HAVE_CLASS flag */ (binaryfunc) mpw_div, /* nb_floor_divide */ (binaryfunc) 0, /* nb_true_divide */ (binaryfunc) 0, /* nb_inplace_floor_divide */ (binaryfunc) 0 /* nb_inplace_true_divide */ }; /* ---------- */ /** */ /*@unchecked@*/ /*@observer@*/ static char mpw_doc[] = ""; /*@-fullinitblock@*/ PyTypeObject mpw_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "_bc.mpw", /* tp_name */ sizeof(mpwObject) - sizeof(mpw),/* tp_basicsize */ sizeof(mpw), /* tp_itemsize */ /* methods */ (destructor) mpw_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc) mpw_compare, /* tp_compare */ (reprfunc) mpw_repr, /* tp_repr */ &mpw_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ 0, /* tp_call */ (reprfunc) mpw_str, /* tp_str */ (getattrofunc) mpw_getattro, /* tp_getattro */ (setattrofunc) mpw_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ mpw_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ mpw_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ (newfunc) mpw_new, /* tp_new */ (destructor) mpw_free, /* tp_free */ 0, /* tp_is_gc */ }; /*@=fullinitblock@*/ /* ---------- */ beecrypt-4.2.1/python/Makefile.in0000644000175000001440000005446011226307162013647 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Makefile for rpm library. VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = python DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pythondir)" LTLIBRARIES = $(python_LTLIBRARIES) _bc_la_DEPENDENCIES = $(mylibs) am__bc_la_OBJECTS = _bc-py.lo mpw-py.lo rng-py.lo _bc_la_OBJECTS = $(am__bc_la_OBJECTS) _bc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(_bc_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(_bc_la_SOURCES) DIST_SOURCES = $(_bc_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.4 foreign no-dependencies LINT = splint SUBDIRS = test EXTRA_DIST = debug-py.c INCLUDES = -I. \ -I$(top_srcdir)/include @PYTHONINC@ mylibs = $(top_builddir)/libbeecrypt.la LDADD = pythondir = @PYTHONLIB@ python_LTLIBRARIES = _bc.la _bc_la_SOURCES = _bc-py.c mpw-py.c rng-py.c _bc_la_LDFLAGS = -avoid-version -module _bc_la_LIBADD = $(mylibs) splint_srcs = _bc-py.c $(libbc_la_sources) all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign python/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign python/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pythonLTLIBRARIES: $(python_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pythondir)" || $(MKDIR_P) "$(DESTDIR)$(pythondir)" @list='$(python_LTLIBRARIES)'; test -n "$(pythondir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pythondir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pythondir)"; \ } uninstall-pythonLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(python_LTLIBRARIES)'; test -n "$(pythondir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pythondir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pythondir)/$$f"; \ done clean-pythonLTLIBRARIES: -test -z "$(python_LTLIBRARIES)" || rm -f $(python_LTLIBRARIES) @list='$(python_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done _bc.la: $(_bc_la_OBJECTS) $(_bc_la_DEPENDENCIES) $(_bc_la_LINK) -rpath $(pythondir) $(_bc_la_OBJECTS) $(_bc_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c .c.o: $(COMPILE) -c $< .c.obj: $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pythondir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-pythonLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-pythonLTLIBRARIES install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-pythonLTLIBRARIES .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic clean-libtool \ clean-pythonLTLIBRARIES ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-pythonLTLIBRARIES install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am \ uninstall-pythonLTLIBRARIES .PHONY: lint lint: $(LINT) $(DEFS) $(INCLUDES) $(splint_srcs) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/python/Makefile.am0000664000175000001440000000077510504311264013634 00000000000000# Makefile for rpm library. AUTOMAKE_OPTIONS = 1.4 foreign no-dependencies LINT = splint SUBDIRS = test EXTRA_DIST = debug-py.c INCLUDES = -I. \ -I$(top_srcdir)/include @PYTHONINC@ mylibs = $(top_builddir)/libbeecrypt.la LDADD = pythondir = @PYTHONLIB@ python_LTLIBRARIES = _bc.la _bc_la_SOURCES = _bc-py.c mpw-py.c rng-py.c _bc_la_LDFLAGS = -avoid-version -module _bc_la_LIBADD = $(mylibs) splint_srcs = _bc-py.c $(libbc_la_sources) .PHONY: lint lint: $(LINT) $(DEFS) $(INCLUDES) $(splint_srcs) beecrypt-4.2.1/python/_bc-py.c0000664000175000001440000000412210065270130013101 00000000000000/** \ingroup py_c * \file python/_bc-py.c */ #define _REENTRANT 1 /* XXX config.h collides with pyconfig.h */ #include "config.h" #include "Python.h" #ifdef __LCLINT__ #undef PyObject_HEAD #define PyObject_HEAD int _PyObjectHead; #endif #include "beecrypt/python/mpw-py.h" #include "beecrypt/python/rng-py.h" #ifdef __LCLINT__ #undef PyObject_HEAD #define PyObject_HEAD int _PyObjectHead #endif /** */ PyObject * py_bcError; /** */ static PyMethodDef _bcModuleMethods[] = { { NULL } } ; /** */ static char _bc__doc__[] = ""; void init_bc(void); /* XXX eliminate gcc warning */ /** */ void init_bc(void) { PyObject *d, *m; #ifdef NOTYET PyObject *o, *dict; int i; #endif if (PyType_Ready(&mpw_Type) < 0) return; if (PyType_Ready(&rng_Type) < 0) return; m = Py_InitModule3("_bc", _bcModuleMethods, _bc__doc__); if (m == NULL) return; d = PyModule_GetDict(m); py_bcError = PyErr_NewException("_bc.error", NULL, NULL); if (py_bcError != NULL) PyDict_SetItemString(d, "error", py_bcError); Py_INCREF(&mpw_Type); PyModule_AddObject(m, "mpw", (PyObject *) &mpw_Type); Py_INCREF(&rng_Type); PyModule_AddObject(m, "rng", (PyObject *) &rng_Type); #ifdef NOTYET dict = PyDict_New(); for (i = 0; i < _bcTagTableSize; i++) { tag = PyInt_FromLong(_bcTagTable[i].val); PyDict_SetItemString(d, (char *) _bcTagTable[i].name, tag); Py_DECREF(tag); PyDict_SetItem(dict, tag, o=PyString_FromString(_bcTagTable[i].name + 7)); Py_DECREF(o); } while (extensions->name) { if (extensions->type == HEADER_EXT_TAG) { (const struct headerSprintfExtension *) ext = extensions; PyDict_SetItemString(d, (char *) extensions->name, o=PyCObject_FromVoidPtr(ext, NULL)); Py_DECREF(o); PyDict_SetItem(dict, tag, o=PyString_FromString(ext->name + 7)); Py_DECREF(o); } extensions++; } PyDict_SetItemString(d, "tagnames", dict); Py_DECREF(dict); #define REGISTER_ENUM(val) \ PyDict_SetItemString(d, #val, o=PyInt_FromLong( val )); \ Py_DECREF(o); #endif } beecrypt-4.2.1/python/test/0000777000175000001440000000000011226307274012640 500000000000000beecrypt-4.2.1/python/test/test_methods.py0000664000175000001440000002272610101116375015632 00000000000000""" Basic TestCases for BTree and hash DBs, with and without a DBEnv, with various DB flags, etc. """ import unittest from _bc import mpw from test_all import verbose DASH = '-' Methods = ( '__add__', '__sub__', '__mul__', '__div__', '__mod__', '__lshift__', '__rshift__', '__and__', '__xor__', '__or__') class Factory(object): def __init__(self, false_self, method_name): self.false_self = false_self self.method_name = method_name def __call__(self, val): xself = long(self.false_self) yself = int(self.false_self) xm = long.__getattribute__(xself, self.method_name) ym = mpw.__getattribute__(yself, self.method_name) xa = xm(long(val)) ya = ym(int(val)) print " Comparing", xa, ya assert xa == ya return xa class Long(long): def __getattribute__(self, name): print "__getattribute__ ~%s~" % name if name not in ('__add__', '__sub__'): return long.getattr(self, name) return Factory(self, name) #a1 = Bar(1) #a2 = Bar(2) #print a1.__add__(a2) #print "Done" #print a1 + a2 #---------------------------------------------------------------------- class BasicTestCase(unittest.TestCase): a = 0x0000000987654321L b = 0x0000000000000010L c = 0x0fedcba000000000L lo = 2 hi = 200 t = 10 def setUp(self): mpw().Debug(0) pass def tearDown(self): mpw().Debug(0) pass #---------------------------------------- def test01_SimpleMethods(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_SimpleMethods..." % \ self.__class__.__name__ print "\ta:\t%s\t%s\t0x%x" % (type(self.a), self.a, self.a) print "\tb:\t%s\t%s\t0x%x" % (type(self.b), self.b, self.b) print "\tc:\t%s\t%s\t0x%x" % (type(self.c), self.c, self.c) wa = mpw(self.a) wb = mpw(self.b) wc = mpw(self.c) # xa - Long(self.a) # xb = Long(self.b) # xc = Long(self.c) za = long(self.a) zb = long(self.b) zc = long(self.c) print "__int__:\t", int(wb), "\t", int(zb) assert int(wb) == int(zb) print "__long__:\t", long(wa), "\t", long(za) assert long(wb) == long(zb) print "__float__:\t", float(wa), "\t", float(za) assert float(wb) == float(zb) zs = hex(za) print "__hex__:\t", hex(wa), "\t", zs # assert hex(wa) == zs # fails because of missing trailing L zs = oct(za) print "__oct__:\t", oct(wa), "\t", zs # assert oct(wa) == zs # fails because of missing trailing L print "__neg__:\t", (-wa), "\t", long(-za) print "__pos__:\t", (+wa), "\t", long(+za) print "__abs__:\t", abs(wa), "\t", long(abs(za)) print "__invert__:\t", (~wa), "\t", long(~za) print "__add__:\t", (wa + wb), "\t", long(za + zb) print "__sub__:\t", (wa - wb), "\t", long(za - zb) print "__mul__:\t", (wa * wb), "\t", long(za * zb) print "__div__:\t", (wa / wb), "\t", long(za / zb) print "__mod__:\t", (wa % wb), "\t", long(za % zb) wq, wr = divmod(wa, wb) zq, zr = divmod(za, zb) print "__divmod__ q:\t", wq, "\t", long(zq) print "__divmod__ r:\t", wr, "\t", long(zr) print "__pow__:\t", (wb ** wb), "\t", long(zb ** zb) print "__lshift__:\t", (wa << wb), "\t", long(za << zb) print "__rshift__:\t", (wa >> wb), "\t", long(za >> zb) print "__and__:\t", (wa & wc), "\t", long(za & zc) print "__xor__:\t", (wa ^ wa), "\t", long(za ^ za) print "__or__:\t", (wa | wc), "\t", long(za | zc) # print mpw.__complex__(b) # print mpw.__coerce__(b, i) del wa del wb del wc del za del zb del zc pass #---------------------------------------- def test02_CarryBorrow(self): if verbose: print '\n', '-=' * 30 print "Running %s.test02_CarryBorrow..." % \ self.__class__.__name__ a = 0x7fffffff wa = -mpw(a); wa = wa+wa za = -long(a); za = za+za wb = -mpw(1) zb = -long(1) wc = mpw(1) zc = long(1) wd = mpw(a); wd = wd+wd zd = long(a); zd = zd+zd print "add --:\t", (wa+wa), "\t", (za+za) print "add -+:\t", (wb+wd), "\t", (zb+zd) print "add +-:\t", (wc+wa), "\t", (zc+za) print "add ++:\t", (wd+wd), "\t", (zd+zd) print "sub --:\t", (wb-wa), "\t", (zb-za) # print "sub -+:\t", (wb-wd), "\t", (zb-zd) # print "sub +-:\t", (wc-wa), "\t", (zc-za) print "sub ++:\t", (wc-wd), "\t", (zc-zd) pass #---------------------------------------- def test03_Signs(self): if verbose: print '\n', '-=' * 30 print "Running %s.test03_Signs..." % \ self.__class__.__name__ wpa = mpw(13) wma = -wpa wpb = wpa - 3 wmb = -wpb zpa = long(13) zma = -zpa zpb = zpa - 3 zmb = -zpb print "add --:\t", (wma+wmb), "\t", (zma+zmb) print "add -+:\t", (wma+wpb), "\t", (zma+zpb) print "add +-:\t", (wpa+wmb), "\t", (zpa+zmb) print "add ++:\t", (wpa+wpb), "\t", (zpa+zpb) print "sub --:\t", (wma-wmb), "\t", (zma-zmb) print "sub -+:\t", (wma-wpb), "\t", (zma-zpb) print "sub +-:\t", (wpa-wmb), "\t", (zpa-zmb) print "sub ++:\t", (wpa-wpb), "\t", (zpa-zpb) print "sub --:\t", (wmb-wma), "\t", (zmb-zma) print "sub -+:\t", (wmb-wpa), "\t", (zmb-zpa) print "sub +-:\t", (wpb-wma), "\t", (zpb-zma) print "sub ++:\t", (wpb-wpa), "\t", (zpb-zpa) print "mul --:\t", (wma*wmb), "\t", (zma*zmb) print "mul -+:\t", (wma*wpb), "\t", (zma*zpb) print "mul +-:\t", (wpa*wmb), "\t", (zpa*zmb) print "mul ++:\t", (wpa*wpb), "\t", (zpa*zpb) print "div --:\t", (wma/wmb), "\t", (zma/zmb) print "div -+:\t", (wma/wpb), "\t", (zma/zpb) print "div +-:\t", (wpa/wmb), "\t", (zpa/zmb) print "div ++:\t", (wpa/wpb), "\t", (zpa/zpb) print "div --:\t", (wmb/wma), "\t", (zmb/zma) print "div -+:\t", (wmb/wpa), "\t", (zmb/zpa) print "div +-:\t", (wpb/wma), "\t", (zpb/zma) print "div ++:\t", (wpb/wpa), "\t", (zpb/zpa) print "pow --:\t", (wma**wmb), "\t", (zma**zmb) print "pow -+:\t", (wma**wpb), "\t", (zma**zpb) print "pow +-:\t", (wpa**wmb), "\t", (zpa**zmb) print "pow ++:\t", (wpa**wpb), "\t", (zpa**zpb) print "pow --:\t", (wmb**wma), "\t", (zmb**zma) print "pow -+:\t", (wmb**wpa), "\t", (zmb**zpa) print "pow +-:\t", (wpb**wma), "\t", (zpb**zma) print "pow ++:\t", (wpb**wpa), "\t", (zpb**zpa) # wpa = mpw(13) # wma = -wpa # wpb = wpa - 3 # wmb = -wpb # zpa = long(13) # zma = -zpa # zpb = zpa - 3 # zmb = -zpb print "mod --:\t", (wma%wmb), "\t", (zma%zmb) print "mod -+:\t", (wma%wpb), "\t", (zma%zpb) print "mod +-:\t", (wpa%wmb), "\t", (zpa%zmb) print "mod ++:\t", (wpa%wpb), "\t", (zpa%zpb) print "mod --:\t", (wmb%wma), "\t", (zmb%zma) print "mod -+:\t", (wmb%wpa), "\t", (zmb%zpa) print "mod +-:\t", (wpb%wma), "\t", (zpb%zma) print "mod ++:\t", (wpb%wpa), "\t", (zpb%zpa) print "rem --:\t", divmod(wma, wmb), "\t", divmod(zma, zmb) print "rem -+:\t", divmod(wma, wpb), "\t", divmod(zma, zpb) print "rem +-:\t", divmod(wpa, wmb), "\t", divmod(zpa, zmb) print "rem ++:\t", divmod(wpa, wpb), "\t", divmod(zpa, zpb) print "rem --:\t", divmod(wmb, wma), "\t", divmod(zmb, zma) print "rem -+:\t", divmod(wmb, wpa), "\t", divmod(zmb, zpa) print "rem +-:\t", divmod(wpb, wma), "\t", divmod(zpb, zma) print "rem ++:\t", divmod(wpb, wpa), "\t", divmod(zpb, zpa) pass #---------------------------------------- def test04_KnuthPoly(self): self.t = 8 tfmt = "%o" if verbose: print '\n', '-=' * 30 print "Running %s.test04_KnuthPoly..." % \ self.__class__.__name__ print "\t(%d**m - 1) * (%d**n - 1), m,n in [%d,%d)" % (self.t,self.t,self.lo,self.hi) tm1 = tfmt % (self.t - 1) tm2 = tfmt % (self.t - 2) for m in range(self.lo,self.hi): for n in range(m+1,self.hi+1): wt = mpw(self.t) wa = (wt**m - 1) * (wt**n - 1) ws = tfmt % long(wa) zs = tm1 * (m - 1) + tm2 + tm1 * (n - m) + "0" * (m - 1) + "1" if ws != zs: print "(%d**%d - 1) * (%d**%d - 1)\t%s" % (self.t,m,self.t,n,ws) assert ws == zs self.t = 10 tfmt = "%d" if verbose: print "\t(%d**m - 1) * (%d**n - 1), m,n in [%d,%d)" % (self.t,self.t,self.lo,self.hi) tm1 = tfmt % (self.t - 1) tm2 = tfmt % (self.t - 2) for m in range(self.lo,self.hi): for n in range(m+1,self.hi+1): wt = mpw(self.t) wa = (wt**m - 1) * (wt**n - 1) ws = tfmt % long(wa) zs = tm1 * (m - 1) + tm2 + tm1 * (n - m) + "0" * (m - 1) + "1" if ws != zs: print "(%d**%d - 1) * (%d**%d - 1)\t%s" % (self.t,m,self.t,n,ws) assert ws == zs self.t = 16 tfmt = "%x" if verbose: print "\t(%d**m - 1) * (%d**n - 1), m,n in [%d,%d)" % (self.t,self.t,self.lo,self.hi) tm1 = tfmt % (self.t - 1) tm2 = tfmt % (self.t - 2) for m in range(self.lo,self.hi): for n in range(m+1,self.hi+1): wt = mpw(self.t) wa = (wt**m - 1) * (wt**n - 1) ws = tfmt % long(wa) zs = tm1 * (m - 1) + tm2 + tm1 * (n - m) + "0" * (m - 1) + "1" if ws != zs: print "(%d**%d - 1) * (%d**%d - 1)\t%s" % (self.t,m,self.t,n,ws) assert ws == zs pass #---------------------------------------- def test05_IterativePowers(self): if verbose: print '\n', '-=' * 30 print "Running %s.test05_IterativePowers..." % \ self.__class__.__name__ print "\t(m**n)/(m**(n-1)) == m for m,n in [%d,%d)" % (self.lo,self.hi) for m in range(self.lo,self.hi): wa = mpw(m) wd = wa for n in range(self.lo,self.hi): wc = wa**n we = wc/wd if we != m: print m, '^', n, '=', we assert we == m if wc != 0: wd = wc pass #---------------------------------------------------------------------- #---------------------------------------------------------------------- def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(BasicTestCase)) return suite if __name__ == '__main__': unittest.main(defaultTest='test_suite') beecrypt-4.2.1/python/test/Makefile.in0000644000175000001440000002633011226307162014621 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Makefile for rpm library. VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = python/test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.4 foreign VALGRIND = # valgrind --verbose --leak-check=yes EXTRA_DIST = \ test_all.py test_methods.py \ unittest.py all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign python/test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign python/test/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am all: check: $(VALGRIND) PYTHONPATH="..:../.libs/" python test_all.py verbose # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/python/test/Makefile.am0000644000175000001440000000037211216147024014604 00000000000000# Makefile for rpm library. AUTOMAKE_OPTIONS = 1.4 foreign VALGRIND = # valgrind --verbose --leak-check=yes EXTRA_DIST = \ test_all.py test_methods.py \ unittest.py all: check: $(VALGRIND) PYTHONPATH="..:../.libs/" python test_all.py verbose beecrypt-4.2.1/python/test/unittest.py0000664000175000001440000006450110063036154015007 00000000000000#!/usr/bin/env python ''' Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework. This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests and reporting the results (TextTestRunner). Simple usage: import unittest class IntegerArithmenticTestCase(unittest.TestCase): def testAdd(self): ## test method names begin 'test*' self.assertEquals((1 + 2), 3) self.assertEquals(0 + 1, 1) def testMultiply(self): self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40) if __name__ == '__main__': unittest.main() Further information is available in the bundled documentation, and from http://pyunit.sourceforge.net/ Copyright (c) 1999, 2000, 2001 Steve Purcell This module is free software, and you may redistribute it and/or modify it under the same terms as Python itself, so long as this copyright message and disclaimer are retained in their original form. IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ''' __author__ = "Steve Purcell" __email__ = "stephen_purcell at yahoo dot com" __version__ = "#Revision: 1.46 $"[11:-2] import time import sys import traceback import string import os import types ############################################################################## # Test framework core ############################################################################## # All classes defined herein are 'new-style' classes, allowing use of 'super()' __metaclass__ = type def _strclass(cls): return "%s.%s" % (cls.__module__, cls.__name__) class TestResult: """Holder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred. """ def __init__(self): self.failures = [] self.errors = [] self.testsRun = 0 self.shouldStop = 0 def startTest(self, test): "Called when the given test is about to be run" self.testsRun = self.testsRun + 1 def stopTest(self, test): "Called when the given test has been run" pass def addError(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). """ self.errors.append((test, self._exc_info_to_string(err))) def addFailure(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().""" self.failures.append((test, self._exc_info_to_string(err))) def addSuccess(self, test): "Called when a test has completed successfully" pass def wasSuccessful(self): "Tells whether or not this result was a success" return len(self.failures) == len(self.errors) == 0 def stop(self): "Indicates that the tests should be aborted" self.shouldStop = 1 def _exc_info_to_string(self, err): """Converts a sys.exc_info()-style tuple of values into a string.""" return string.join(traceback.format_exception(*err), '') def __repr__(self): return "<%s run=%i errors=%i failures=%i>" % \ (_strclass(self.__class__), self.testsRun, len(self.errors), len(self.failures)) class TestCase: """A class whose instances are single test cases. By default, the test code itself should be placed in a method named 'runTest'. If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute. Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively. If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run. """ # This attribute determines which exception will be raised when # the instance's assertion methods fail; test methods raising this # exception will be deemed to have 'failed' rather than 'errored' failureException = AssertionError def __init__(self, methodName='runTest'): """Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name. """ try: self.__testMethodName = methodName testMethod = getattr(self, methodName) self.__testMethodDoc = testMethod.__doc__ except AttributeError: raise ValueError, "no such test method in %s: %s" % \ (self.__class__, methodName) def setUp(self): "Hook method for setting up the test fixture before exercising it." pass def tearDown(self): "Hook method for deconstructing the test fixture after testing it." pass def countTestCases(self): return 1 def defaultTestResult(self): return TestResult() def shortDescription(self): """Returns a one-line description of the test, or None if no description has been provided. The default implementation of this method returns the first line of the specified test method's docstring. """ doc = self.__testMethodDoc return doc and string.strip(string.split(doc, "\n")[0]) or None def id(self): return "%s.%s" % (_strclass(self.__class__), self.__testMethodName) def __str__(self): return "%s (%s)" % (self.__testMethodName, _strclass(self.__class__)) def __repr__(self): return "<%s testMethod=%s>" % \ (_strclass(self.__class__), self.__testMethodName) def run(self, result=None): return self(result) def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except KeyboardInterrupt: raise except: result.addError(self, self.__exc_info()) return ok = 0 try: testMethod() ok = 1 except self.failureException, e: result.addFailure(self, self.__exc_info()) except KeyboardInterrupt: raise except: result.addError(self, self.__exc_info()) try: self.tearDown() except KeyboardInterrupt: raise except: result.addError(self, self.__exc_info()) ok = 0 if ok: result.addSuccess(self) finally: result.stopTest(self) def debug(self): """Run the test without collecting errors in a TestResult""" self.setUp() getattr(self, self.__testMethodName)() self.tearDown() def __exc_info(self): """Return a version of sys.exc_info() with the traceback frame minimised; usually the top level of the traceback frame is not needed. """ exctype, excvalue, tb = sys.exc_info() if sys.platform[:4] == 'java': ## tracebacks look different in Jython return (exctype, excvalue, tb) newtb = tb.tb_next if newtb is None: return (exctype, excvalue, tb) return (exctype, excvalue, newtb) def fail(self, msg=None): """Fail immediately, with the given message.""" raise self.failureException, msg def failIf(self, expr, msg=None): "Fail the test if the expression is true." if expr: raise self.failureException, msg def failUnless(self, expr, msg=None): """Fail the test unless the expression is true.""" if not expr: raise self.failureException, msg def failUnlessRaises(self, excClass, callableObj, *args, **kwargs): """Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception. """ try: callableObj(*args, **kwargs) except excClass: return else: if hasattr(excClass,'__name__'): excName = excClass.__name__ else: excName = str(excClass) raise self.failureException, excName def failUnlessEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ if not first == second: raise self.failureException, \ (msg or '%s != %s' % (`first`, `second`)) def failIfEqual(self, first, second, msg=None): """Fail if the two objects are equal as determined by the '==' operator. """ if first == second: raise self.failureException, \ (msg or '%s == %s' % (`first`, `second`)) def failUnlessAlmostEqual(self, first, second, places=7, msg=None): """Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. Note that decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit). """ if round(second-first, places) != 0: raise self.failureException, \ (msg or '%s != %s within %s places' % (`first`, `second`, `places` )) def failIfAlmostEqual(self, first, second, places=7, msg=None): """Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. Note that decimal places (from zero) is usually not the same as significant digits (measured from the most signficant digit). """ if round(second-first, places) == 0: raise self.failureException, \ (msg or '%s == %s within %s places' % (`first`, `second`, `places`)) assertEqual = assertEquals = failUnlessEqual assertNotEqual = assertNotEquals = failIfEqual assertAlmostEqual = assertAlmostEquals = failUnlessAlmostEqual assertNotAlmostEqual = assertNotAlmostEquals = failIfAlmostEqual assertRaises = failUnlessRaises assert_ = failUnless class TestSuite: """A test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. """ def __init__(self, tests=()): self._tests = [] self.addTests(tests) def __repr__(self): return "<%s tests=%s>" % (_strclass(self.__class__), self._tests) __str__ = __repr__ def countTestCases(self): cases = 0 for test in self._tests: cases = cases + test.countTestCases() return cases def addTest(self, test): self._tests.append(test) def addTests(self, tests): for test in tests: self.addTest(test) def run(self, result): return self(result) def __call__(self, result): for test in self._tests: if result.shouldStop: break test(result) return result def debug(self): """Run the tests without collecting errors in a TestResult""" for test in self._tests: test.debug() class FunctionTestCase(TestCase): """A test case that wraps a test function. This is useful for slipping pre-existing test functions into the PyUnit framework. Optionally, set-up and tidy-up functions can be supplied. As with TestCase, the tidy-up ('tearDown') function will always be called if the set-up ('setUp') function ran successfully. """ def __init__(self, testFunc, setUp=None, tearDown=None, description=None): TestCase.__init__(self) self.__setUpFunc = setUp self.__tearDownFunc = tearDown self.__testFunc = testFunc self.__description = description def setUp(self): if self.__setUpFunc is not None: self.__setUpFunc() def tearDown(self): if self.__tearDownFunc is not None: self.__tearDownFunc() def runTest(self): self.__testFunc() def id(self): return self.__testFunc.__name__ def __str__(self): return "%s (%s)" % (_strclass(self.__class__), self.__testFunc.__name__) def __repr__(self): return "<%s testFunc=%s>" % (_strclass(self.__class__), self.__testFunc) def shortDescription(self): if self.__description is not None: return self.__description doc = self.__testFunc.__doc__ return doc and string.strip(string.split(doc, "\n")[0]) or None ############################################################################## # Locating and loading tests ############################################################################## class TestLoader: """This class is responsible for loading tests according to various criteria and returning them wrapped in a Test """ testMethodPrefix = 'test' sortTestMethodsUsing = cmp suiteClass = TestSuite def loadTestsFromTestCase(self, testCaseClass): """Return a suite of all tests cases contained in testCaseClass""" return self.suiteClass(map(testCaseClass, self.getTestCaseNames(testCaseClass))) def loadTestsFromModule(self, module): """Return a suite of all tests cases contained in the given module""" tests = [] for name in dir(module): obj = getattr(module, name) if (isinstance(obj, (type, types.ClassType)) and issubclass(obj, TestCase)): tests.append(self.loadTestsFromTestCase(obj)) return self.suiteClass(tests) def loadTestsFromName(self, name, module=None): """Return a suite of all tests cases given a string specifier. The name may resolve either to a module, a test case class, a test method within a test case class, or a callable object which returns a TestCase or TestSuite instance. The method optionally resolves the names relative to a given module. """ parts = string.split(name, '.') if module is None: if not parts: raise ValueError, "incomplete test name: %s" % name else: parts_copy = parts[:] while parts_copy: try: module = __import__(string.join(parts_copy,'.')) break except ImportError: del parts_copy[-1] if not parts_copy: raise parts = parts[1:] obj = module for part in parts: obj = getattr(obj, part) import unittest if type(obj) == types.ModuleType: return self.loadTestsFromModule(obj) elif (isinstance(obj, (type, types.ClassType)) and issubclass(obj, unittest.TestCase)): return self.loadTestsFromTestCase(obj) elif type(obj) == types.UnboundMethodType: return obj.im_class(obj.__name__) elif callable(obj): test = obj() if not isinstance(test, unittest.TestCase) and \ not isinstance(test, unittest.TestSuite): raise ValueError, \ "calling %s returned %s, not a test" % (obj,test) return test else: raise ValueError, "don't know how to make test from: %s" % obj def loadTestsFromNames(self, names, module=None): """Return a suite of all tests cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. """ suites = [] for name in names: suites.append(self.loadTestsFromName(name, module)) return self.suiteClass(suites) def getTestCaseNames(self, testCaseClass): """Return a sorted sequence of method names found within testCaseClass """ testFnNames = filter(lambda n,p=self.testMethodPrefix: n[:len(p)] == p, dir(testCaseClass)) for baseclass in testCaseClass.__bases__: for testFnName in self.getTestCaseNames(baseclass): if testFnName not in testFnNames: # handle overridden methods testFnNames.append(testFnName) if self.sortTestMethodsUsing: testFnNames.sort(self.sortTestMethodsUsing) return testFnNames defaultTestLoader = TestLoader() ############################################################################## # Patches for old functions: these functions should be considered obsolete ############################################################################## def _makeLoader(prefix, sortUsing, suiteClass=None): loader = TestLoader() loader.sortTestMethodsUsing = sortUsing loader.testMethodPrefix = prefix if suiteClass: loader.suiteClass = suiteClass return loader def getTestCaseNames(testCaseClass, prefix, sortUsing=cmp): return _makeLoader(prefix, sortUsing).getTestCaseNames(testCaseClass) def makeSuite(testCaseClass, prefix='test', sortUsing=cmp, suiteClass=TestSuite): return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase(testCaseClass) def findTestCases(module, prefix='test', sortUsing=cmp, suiteClass=TestSuite): return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromModule(module) ############################################################################## # Text UI ############################################################################## class _WritelnDecorator: """Used to decorate file-like objects with a handy 'writeln' method""" def __init__(self,stream): self.stream = stream def __getattr__(self, attr): return getattr(self.stream,attr) def writeln(self, *args): if args: self.write(*args) self.write('\n') # text-mode streams translate to \r\n if needed class _TextTestResult(TestResult): """A test result class that can print formatted text results to a stream. Used by TextTestRunner. """ separator1 = '=' * 70 separator2 = '-' * 70 def __init__(self, stream, descriptions, verbosity): TestResult.__init__(self) self.stream = stream self.showAll = verbosity > 1 self.dots = verbosity == 1 self.descriptions = descriptions def getDescription(self, test): if self.descriptions: return test.shortDescription() or str(test) else: return str(test) def startTest(self, test): TestResult.startTest(self, test) if self.showAll: self.stream.write(self.getDescription(test)) self.stream.write(" ... ") def addSuccess(self, test): TestResult.addSuccess(self, test) if self.showAll: self.stream.writeln("ok") elif self.dots: self.stream.write('.') def addError(self, test, err): TestResult.addError(self, test, err) if self.showAll: self.stream.writeln("ERROR") elif self.dots: self.stream.write('E') def addFailure(self, test, err): TestResult.addFailure(self, test, err) if self.showAll: self.stream.writeln("FAIL") elif self.dots: self.stream.write('F') def printErrors(self): if self.dots or self.showAll: self.stream.writeln() self.printErrorList('ERROR', self.errors) self.printErrorList('FAIL', self.failures) def printErrorList(self, flavour, errors): for test, err in errors: self.stream.writeln(self.separator1) self.stream.writeln("%s: %s" % (flavour,self.getDescription(test))) self.stream.writeln(self.separator2) self.stream.writeln("%s" % err) class TextTestRunner: """A test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. """ def __init__(self, stream=sys.stderr, descriptions=1, verbosity=1): self.stream = _WritelnDecorator(stream) self.descriptions = descriptions self.verbosity = verbosity def _makeResult(self): return _TextTestResult(self.stream, self.descriptions, self.verbosity) def run(self, test): "Run the given test case or test suite." result = self._makeResult() startTime = time.time() test(result) stopTime = time.time() timeTaken = float(stopTime - startTime) result.printErrors() self.stream.writeln(result.separator2) run = result.testsRun self.stream.writeln("Ran %d test%s in %.3fs" % (run, run != 1 and "s" or "", timeTaken)) self.stream.writeln() if not result.wasSuccessful(): self.stream.write("FAILED (") failed, errored = map(len, (result.failures, result.errors)) if failed: self.stream.write("failures=%d" % failed) if errored: if failed: self.stream.write(", ") self.stream.write("errors=%d" % errored) self.stream.writeln(")") else: self.stream.writeln("OK") return result ############################################################################## # Facilities for running tests from the command line ############################################################################## class TestProgram: """A command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. """ USAGE = """\ Usage: %(progName)s [options] [test] [...] Options: -h, --help Show this message -v, --verbose Verbose output -q, --quiet Minimal output Examples: %(progName)s - run default set of tests %(progName)s MyTestSuite - run suite 'MyTestSuite' %(progName)s MyTestCase.testSomething - run MyTestCase.testSomething %(progName)s MyTestCase - run all 'test*' test methods in MyTestCase """ def __init__(self, module='__main__', defaultTest=None, argv=None, testRunner=None, testLoader=defaultTestLoader): if type(module) == type(''): self.module = __import__(module) for part in string.split(module,'.')[1:]: self.module = getattr(self.module, part) else: self.module = module if argv is None: argv = sys.argv self.verbosity = 1 self.defaultTest = defaultTest self.testRunner = testRunner self.testLoader = testLoader self.progName = os.path.basename(argv[0]) self.parseArgs(argv) self.runTests() def usageExit(self, msg=None): if msg: print msg print self.USAGE % self.__dict__ sys.exit(2) def parseArgs(self, argv): import getopt try: options, args = getopt.getopt(argv[1:], 'hHvq', ['help','verbose','quiet']) for opt, value in options: if opt in ('-h','-H','--help'): self.usageExit() if opt in ('-q','--quiet'): self.verbosity = 0 if opt in ('-v','--verbose'): self.verbosity = 2 if len(args) == 0 and self.defaultTest is None: self.test = self.testLoader.loadTestsFromModule(self.module) return if len(args) > 0: self.testNames = args else: self.testNames = (self.defaultTest,) self.createTests() except getopt.error, msg: self.usageExit(msg) def createTests(self): self.test = self.testLoader.loadTestsFromNames(self.testNames, self.module) def runTests(self): if self.testRunner is None: self.testRunner = TextTestRunner(verbosity=self.verbosity) result = self.testRunner.run(self.test) sys.exit(not result.wasSuccessful()) main = TestProgram ############################################################################## # Executing this module from the command line ############################################################################## if __name__ == "__main__": main(module=None) beecrypt-4.2.1/python/test/test_all.py0000664000175000001440000000234510063036152014733 00000000000000"""Run all test cases. """ import sys import os import unittest verbose = 0 if 'verbose' in sys.argv: verbose = 1 sys.argv.remove('verbose') if 'silent' in sys.argv: # take care of old flag, just in case verbose = 0 sys.argv.remove('silent') def print_versions(): from _bc import mpw print print '-=' * 38 print 'python version: %s' % sys.version print 'My pid: %s' % os.getpid() print '-=' * 38 class PrintInfoFakeTest(unittest.TestCase): def testPrintVersions(self): print_versions() # This little hack is for when this module is run as main and all the # other modules import it so they will still be able to get the right # verbose setting. It's confusing but it works. import test_all test_all.verbose = verbose def suite(): test_modules = [ 'test_methods', ] alltests = unittest.TestSuite() for name in test_modules: module = __import__(name) alltests.addTest(module.test_suite()) return alltests def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(PrintInfoFakeTest)) return suite if __name__ == '__main__': print_versions() unittest.main(defaultTest='suite') beecrypt-4.2.1/python/debug-py.c0000664000175000001440000000434310245656062013465 00000000000000#include "compile.h" #include "frameobject.h" #include "beecrypt/python/mpw-py.h" /* XXX debug only */ #include "beecrypt/python/rng-py.h" /* XXX debug only */ /** */ static const char * lbl(void * s) /*@*/ { PyObject * o = s; if (o == NULL) return "null"; if (o == Py_None) return "None"; if (o->ob_type == &PyType_Type) return o->ob_type->tp_name; if (o->ob_type == &PyBaseObject_Type) return "BaseObj"; if (o->ob_type == &PyBuffer_Type) return "Buffer"; if (o->ob_type == &PyCFunction_Type) return "CFunction"; if (o->ob_type == &PyCObject_Type) return "CObject"; if (o->ob_type == &PyCell_Type) return "Cell"; if (o->ob_type == &PyClass_Type) return "Class"; if (o->ob_type == &PyClassMethod_Type) return "ClassMethod"; if (o->ob_type == &PyStaticMethod_Type) return "StaticMethod"; if (o->ob_type == &PyCode_Type) return "Code"; if (o->ob_type == &PyComplex_Type) return "Complex"; if (o->ob_type == &PyDict_Type) return "Dict"; if (o->ob_type == &PyFile_Type) return "File"; if (o->ob_type == &PyFloat_Type) return "Float"; if (o->ob_type == &PyFrame_Type) return "Frame"; if (o->ob_type == &PyFunction_Type) return "Function"; if (o->ob_type == &PyInstance_Type) return "Instance"; if (o->ob_type == &PyInt_Type) return "Int"; if (o->ob_type == &PyList_Type) return "List"; if (o->ob_type == &PyLong_Type) return "Long"; if (o->ob_type == &PyMethod_Type) return "Method"; if (o->ob_type == &PyWrapperDescr_Type) return "WrapperDescr"; if (o->ob_type == &PyProperty_Type) return "Property"; if (o->ob_type == &PyModule_Type) return "Module"; if (o->ob_type == &PyRange_Type) return "Range"; if (o->ob_type == &PySeqIter_Type) return "SeqIter"; if (o->ob_type == &PyCallIter_Type) return "CallIter"; if (o->ob_type == &PySlice_Type) return "Slice"; if (o->ob_type == &PyString_Type) return "String"; if (o->ob_type == &PySuper_Type) return "Super"; if (o->ob_type == &PyTuple_Type) return "Tuple"; if (o->ob_type == &PyType_Type) return "Type"; if (o->ob_type == &PyUnicode_Type) return "Unicode"; if (o->ob_type == &mpw_Type) return "mpw"; if (o->ob_type == &rng_Type) return "rng"; return "Unknown"; } beecrypt-4.2.1/sha384.c0000644000175000001440000003055411216402573011436 00000000000000/* * Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha384.c * \brief SHA-384 hash function, as specified by NIST FIPS 180-2. * \author Bob Deblier * \ingroup HASH_m HASH_sha384_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #ifdef OPTIMIZE_SSE2 # include #endif #if HAVE_ENDIAN_H && HAVE_ASM_BYTEORDER_H # include #endif #include "beecrypt/sha384.h" #include "beecrypt/sha2k64.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_sha384_m * \{ */ static const uint64_t hinit[8] = { #if (SIZEOF_UNSIGNED_LONG == 8) || !HAVE_UNSIGNED_LONG_LONG 0xcbbb9d5dc1059ed8UL, 0x629a292a367cd507UL, 0x9159015a3070dd17UL, 0x152fecd8f70e5939UL, 0x67332667ffc00b31UL, 0x8eb44a8768581511UL, 0xdb0c2e0d64f98fa7UL, 0x47b5481dbefa4fa4UL #else 0xcbbb9d5dc1059ed8ULL, 0x629a292a367cd507ULL, 0x9159015a3070dd17ULL, 0x152fecd8f70e5939ULL, 0x67332667ffc00b31ULL, 0x8eb44a8768581511ULL, 0xdb0c2e0d64f98fa7ULL, 0x47b5481dbefa4fa4ULL #endif }; const hashFunction sha384 = { .name = "SHA-384", .paramsize = sizeof(sha384Param), .blocksize = 128, .digestsize = 48, .reset = (hashFunctionReset) sha384Reset, .update = (hashFunctionUpdate) sha384Update, .digest = (hashFunctionDigest) sha384Digest }; int sha384Reset(register sha384Param* sp) { memcpy(sp->h, hinit, 8 * sizeof(uint64_t)); memset(sp->data, 0, 80 * sizeof(uint64_t)); #if (MP_WBITS == 64) mpzero(2, sp->length); #elif (MP_WBITS == 32) mpzero(4, sp->length); #else # error #endif sp->offset = 0; return 0; } #ifdef OPTIMIZE_SSE2 # define R(x,s) _mm_srli_si64(x,s) # define S(x,s) _m_pxor(_mm_srli_si64(x,s),_mm_slli_si64(x,64-(s))) # define CH(x,y,z) _m_pxor(_m_pand(x,_m_pxor(y,z)),z) # define MAJ(x,y,z) _m_por(_m_pand(_m_por(x,y),z),_m_pand(x,y)) # define SIG0(x) _m_pxor(_m_pxor(S(x,28),S(x,34)),S(x,39)) # define SIG1(x) _m_pxor(_m_pxor(S(x,14),S(x,18)),S(x,41)) # define sig0(x) _m_pxor(_m_pxor(S(x,1),S(x,8)),R(x,7)) # define sig1(x) _m_pxor(_m_pxor(S(x,19),S(x,61)),R(x,6)) # define ROUND(a,b,c,d,e,f,g,h,w,k) \ temp = _mm_add_si64(h, _mm_add_si64(_mm_add_si64(SIG1(e), CH(e,f,g)), _mm_add_si64(k, w))); \ h = _mm_add_si64(temp, _mm_add_si64(SIG0(a), MAJ(a,b,c))); \ d = _mm_add_si64(d, temp) #else # define R(x,s) ((x) >> (s)) # define S(x,s) ROTR64(x, s) # define CH(x,y,z) ((x&(y^z))^z) # define MAJ(x,y,z) (((x|y)&z)|(x&y)) # define SIG0(x) (S(x,28) ^ S(x,34) ^ S(x,39)) # define SIG1(x) (S(x,14) ^ S(x,18) ^ S(x,41)) # define sig0(x) (S(x,1) ^ S(x,8) ^ R(x,7)) # define sig1(x) (S(x,19) ^ S(x,61) ^ R(x,6)) # define ROUND(a,b,c,d,e,f,g,h,w,k) \ temp = h + SIG1(e) + CH(e,f,g) + k + w; \ h = temp + SIG0(a) + MAJ(a,b,c); \ d += temp #endif #ifndef ASM_SHA384PROCESS void sha384Process(register sha384Param* sp) { #ifdef OPTIMIZE_SSE2 # if defined(_MSC_VER) || defined (__INTEL_COMPILER) static const __m64 MASK = { 0x00FF00FF00FF00FF00 }; # elif defined(__GNUC__) static const __m64 MASK = { 0x00FF00FF, 0x00FF00FF }; # else # error # endif __m64 a, b, c, d, e, f, g, h, temp; register __m64 *w; register const __m64 *k; register byte t; w = (__m64*) sp->data; t = 16; while (t--) { temp = *w; *(w++) = _m_pxor( _mm_slli_si64(_m_pshufw(_m_pand(temp, MASK), 27), 8), _m_pshufw(_m_pand(_mm_srli_si64(temp, 8), MASK), 27) ); } t = 64; while (t--) { temp = _mm_add_si64(_mm_add_si64(sig1(w[-2]), w[-7]), _mm_add_si64(sig0(w[-15]), w[-16])); *(w++) = temp; } w = (__m64*) sp->h; a = w[0]; b = w[1]; c = w[2]; d = w[3]; e = w[4]; f = w[5]; g = w[6]; h = w[7]; w = (__m64*) sp->data; k = (__m64*) SHA2_64BIT_K; #else register uint64_t a, b, c, d, e, f, g, h, temp; register uint64_t *w; register const uint64_t *k; register byte t; # if WORDS_BIGENDIAN w = sp->data + 16; # else w = sp->data; t = 16; while (t--) { temp = swapu64(*w); *(w++) = temp; } # endif t = 64; while (t--) { temp = sig1(w[-2]) + w[-7] + sig0(w[-15]) + w[-16]; *(w++) = temp; } w = sp->data; a = sp->h[0]; b = sp->h[1]; c = sp->h[2]; d = sp->h[3]; e = sp->h[4]; f = sp->h[5]; g = sp->h[6]; h = sp->h[7]; k = SHA2_64BIT_K; #endif ROUND(a,b,c,d,e,f,g,h,w[ 0],k[ 0]); ROUND(h,a,b,c,d,e,f,g,w[ 1],k[ 1]); ROUND(g,h,a,b,c,d,e,f,w[ 2],k[ 2]); ROUND(f,g,h,a,b,c,d,e,w[ 3],k[ 3]); ROUND(e,f,g,h,a,b,c,d,w[ 4],k[ 4]); ROUND(d,e,f,g,h,a,b,c,w[ 5],k[ 5]); ROUND(c,d,e,f,g,h,a,b,w[ 6],k[ 6]); ROUND(b,c,d,e,f,g,h,a,w[ 7],k[ 7]); ROUND(a,b,c,d,e,f,g,h,w[ 8],k[ 8]); ROUND(h,a,b,c,d,e,f,g,w[ 9],k[ 9]); ROUND(g,h,a,b,c,d,e,f,w[10],k[10]); ROUND(f,g,h,a,b,c,d,e,w[11],k[11]); ROUND(e,f,g,h,a,b,c,d,w[12],k[12]); ROUND(d,e,f,g,h,a,b,c,w[13],k[13]); ROUND(c,d,e,f,g,h,a,b,w[14],k[14]); ROUND(b,c,d,e,f,g,h,a,w[15],k[15]); ROUND(a,b,c,d,e,f,g,h,w[16],k[16]); ROUND(h,a,b,c,d,e,f,g,w[17],k[17]); ROUND(g,h,a,b,c,d,e,f,w[18],k[18]); ROUND(f,g,h,a,b,c,d,e,w[19],k[19]); ROUND(e,f,g,h,a,b,c,d,w[20],k[20]); ROUND(d,e,f,g,h,a,b,c,w[21],k[21]); ROUND(c,d,e,f,g,h,a,b,w[22],k[22]); ROUND(b,c,d,e,f,g,h,a,w[23],k[23]); ROUND(a,b,c,d,e,f,g,h,w[24],k[24]); ROUND(h,a,b,c,d,e,f,g,w[25],k[25]); ROUND(g,h,a,b,c,d,e,f,w[26],k[26]); ROUND(f,g,h,a,b,c,d,e,w[27],k[27]); ROUND(e,f,g,h,a,b,c,d,w[28],k[28]); ROUND(d,e,f,g,h,a,b,c,w[29],k[29]); ROUND(c,d,e,f,g,h,a,b,w[30],k[30]); ROUND(b,c,d,e,f,g,h,a,w[31],k[31]); ROUND(a,b,c,d,e,f,g,h,w[32],k[32]); ROUND(h,a,b,c,d,e,f,g,w[33],k[33]); ROUND(g,h,a,b,c,d,e,f,w[34],k[34]); ROUND(f,g,h,a,b,c,d,e,w[35],k[35]); ROUND(e,f,g,h,a,b,c,d,w[36],k[36]); ROUND(d,e,f,g,h,a,b,c,w[37],k[37]); ROUND(c,d,e,f,g,h,a,b,w[38],k[38]); ROUND(b,c,d,e,f,g,h,a,w[39],k[39]); ROUND(a,b,c,d,e,f,g,h,w[40],k[40]); ROUND(h,a,b,c,d,e,f,g,w[41],k[41]); ROUND(g,h,a,b,c,d,e,f,w[42],k[42]); ROUND(f,g,h,a,b,c,d,e,w[43],k[43]); ROUND(e,f,g,h,a,b,c,d,w[44],k[44]); ROUND(d,e,f,g,h,a,b,c,w[45],k[45]); ROUND(c,d,e,f,g,h,a,b,w[46],k[46]); ROUND(b,c,d,e,f,g,h,a,w[47],k[47]); ROUND(a,b,c,d,e,f,g,h,w[48],k[48]); ROUND(h,a,b,c,d,e,f,g,w[49],k[49]); ROUND(g,h,a,b,c,d,e,f,w[50],k[50]); ROUND(f,g,h,a,b,c,d,e,w[51],k[51]); ROUND(e,f,g,h,a,b,c,d,w[52],k[52]); ROUND(d,e,f,g,h,a,b,c,w[53],k[53]); ROUND(c,d,e,f,g,h,a,b,w[54],k[54]); ROUND(b,c,d,e,f,g,h,a,w[55],k[55]); ROUND(a,b,c,d,e,f,g,h,w[56],k[56]); ROUND(h,a,b,c,d,e,f,g,w[57],k[57]); ROUND(g,h,a,b,c,d,e,f,w[58],k[58]); ROUND(f,g,h,a,b,c,d,e,w[59],k[59]); ROUND(e,f,g,h,a,b,c,d,w[60],k[60]); ROUND(d,e,f,g,h,a,b,c,w[61],k[61]); ROUND(c,d,e,f,g,h,a,b,w[62],k[62]); ROUND(b,c,d,e,f,g,h,a,w[63],k[63]); ROUND(a,b,c,d,e,f,g,h,w[64],k[64]); ROUND(h,a,b,c,d,e,f,g,w[65],k[65]); ROUND(g,h,a,b,c,d,e,f,w[66],k[66]); ROUND(f,g,h,a,b,c,d,e,w[67],k[67]); ROUND(e,f,g,h,a,b,c,d,w[68],k[68]); ROUND(d,e,f,g,h,a,b,c,w[69],k[69]); ROUND(c,d,e,f,g,h,a,b,w[70],k[70]); ROUND(b,c,d,e,f,g,h,a,w[71],k[71]); ROUND(a,b,c,d,e,f,g,h,w[72],k[72]); ROUND(h,a,b,c,d,e,f,g,w[73],k[73]); ROUND(g,h,a,b,c,d,e,f,w[74],k[74]); ROUND(f,g,h,a,b,c,d,e,w[75],k[75]); ROUND(e,f,g,h,a,b,c,d,w[76],k[76]); ROUND(d,e,f,g,h,a,b,c,w[77],k[77]); ROUND(c,d,e,f,g,h,a,b,w[78],k[78]); ROUND(b,c,d,e,f,g,h,a,w[79],k[79]); #ifdef OPTIMIZE_SSE2 w = (__m64*) sp->h; w[0] = _mm_add_si64(w[0], a); w[1] = _mm_add_si64(w[1], b); w[2] = _mm_add_si64(w[2], c); w[3] = _mm_add_si64(w[3], d); w[4] = _mm_add_si64(w[4], e); w[5] = _mm_add_si64(w[5], f); w[6] = _mm_add_si64(w[6], g); w[7] = _mm_add_si64(w[7], h); _mm_empty(); #else sp->h[0] += a; sp->h[1] += b; sp->h[2] += c; sp->h[3] += d; sp->h[4] += e; sp->h[5] += f; sp->h[6] += g; sp->h[7] += h; #endif } #endif int sha384Update(register sha384Param* sp, const byte* data, size_t size) { register size_t proclength; #if (MP_WBITS == 64) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); mpadd(2, sp->length, add); #elif (MP_WBITS == 32) mpw add[4]; mpsetws(4, add, size); mplshift(4, add, 3); mpadd(4, sp->length, add); #else # error #endif while (size > 0) { proclength = ((sp->offset + size) > 128U) ? (128U - sp->offset) : size; memcpy(((byte *) sp->data) + sp->offset, data, proclength); size -= proclength; data += proclength; sp->offset += proclength; if (sp->offset == 128U) { sha384Process(sp); sp->offset = 0; } } return 0; } static void sha384Finish(register sha384Param* sp) { register byte *ptr = ((byte *) sp->data) + sp->offset++; *(ptr++) = 0x80; if (sp->offset > 112) { while (sp->offset++ < 128) *(ptr++) = 0; sha384Process(sp); sp->offset = 0; } ptr = ((byte *) sp->data) + sp->offset; while (sp->offset++ < 112) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[ 0] = (byte)(sp->length[0] >> 56); ptr[ 1] = (byte)(sp->length[0] >> 48); ptr[ 2] = (byte)(sp->length[0] >> 40); ptr[ 3] = (byte)(sp->length[0] >> 32); ptr[ 4] = (byte)(sp->length[0] >> 24); ptr[ 5] = (byte)(sp->length[0] >> 16); ptr[ 6] = (byte)(sp->length[0] >> 8); ptr[ 7] = (byte)(sp->length[0] ); ptr[ 8] = (byte)(sp->length[1] >> 56); ptr[ 9] = (byte)(sp->length[1] >> 48); ptr[10] = (byte)(sp->length[1] >> 40); ptr[11] = (byte)(sp->length[1] >> 32); ptr[12] = (byte)(sp->length[1] >> 24); ptr[13] = (byte)(sp->length[1] >> 16); ptr[14] = (byte)(sp->length[1] >> 8); ptr[15] = (byte)(sp->length[1] ); #elif (MP_WBITS == 32) ptr[ 0] = (byte)(sp->length[0] >> 24); ptr[ 1] = (byte)(sp->length[0] >> 16); ptr[ 2] = (byte)(sp->length[0] >> 8); ptr[ 3] = (byte)(sp->length[0] ); ptr[ 4] = (byte)(sp->length[1] >> 24); ptr[ 5] = (byte)(sp->length[1] >> 16); ptr[ 6] = (byte)(sp->length[1] >> 8); ptr[ 7] = (byte)(sp->length[1] ); ptr[ 8] = (byte)(sp->length[2] >> 24); ptr[ 9] = (byte)(sp->length[2] >> 16); ptr[10] = (byte)(sp->length[2] >> 8); ptr[11] = (byte)(sp->length[2] ); ptr[12] = (byte)(sp->length[3] >> 24); ptr[13] = (byte)(sp->length[3] >> 16); ptr[14] = (byte)(sp->length[3] >> 8); ptr[15] = (byte)(sp->length[3] ); #else # error #endif sha384Process(sp); sp->offset = 0; } int sha384Digest(register sha384Param* sp, byte* data) { sha384Finish(sp); /* encode 8 integers big-endian style */ data[ 0] = (byte)(sp->h[0] >> 56); data[ 1] = (byte)(sp->h[0] >> 48); data[ 2] = (byte)(sp->h[0] >> 40); data[ 3] = (byte)(sp->h[0] >> 32); data[ 4] = (byte)(sp->h[0] >> 24); data[ 5] = (byte)(sp->h[0] >> 16); data[ 6] = (byte)(sp->h[0] >> 8); data[ 7] = (byte)(sp->h[0] >> 0); data[ 8] = (byte)(sp->h[1] >> 56); data[ 9] = (byte)(sp->h[1] >> 48); data[10] = (byte)(sp->h[1] >> 40); data[11] = (byte)(sp->h[1] >> 32); data[12] = (byte)(sp->h[1] >> 24); data[13] = (byte)(sp->h[1] >> 16); data[14] = (byte)(sp->h[1] >> 8); data[15] = (byte)(sp->h[1] >> 0); data[16] = (byte)(sp->h[2] >> 56); data[17] = (byte)(sp->h[2] >> 48); data[18] = (byte)(sp->h[2] >> 40); data[19] = (byte)(sp->h[2] >> 32); data[20] = (byte)(sp->h[2] >> 24); data[21] = (byte)(sp->h[2] >> 16); data[22] = (byte)(sp->h[2] >> 8); data[23] = (byte)(sp->h[2] >> 0); data[24] = (byte)(sp->h[3] >> 56); data[25] = (byte)(sp->h[3] >> 48); data[26] = (byte)(sp->h[3] >> 40); data[27] = (byte)(sp->h[3] >> 32); data[28] = (byte)(sp->h[3] >> 24); data[29] = (byte)(sp->h[3] >> 16); data[30] = (byte)(sp->h[3] >> 8); data[31] = (byte)(sp->h[3] >> 0); data[32] = (byte)(sp->h[4] >> 56); data[33] = (byte)(sp->h[4] >> 48); data[34] = (byte)(sp->h[4] >> 40); data[35] = (byte)(sp->h[4] >> 32); data[36] = (byte)(sp->h[4] >> 24); data[37] = (byte)(sp->h[4] >> 16); data[38] = (byte)(sp->h[4] >> 8); data[39] = (byte)(sp->h[4] >> 0); data[40] = (byte)(sp->h[5] >> 56); data[41] = (byte)(sp->h[5] >> 48); data[42] = (byte)(sp->h[5] >> 40); data[43] = (byte)(sp->h[5] >> 32); data[44] = (byte)(sp->h[5] >> 24); data[45] = (byte)(sp->h[5] >> 16); data[46] = (byte)(sp->h[5] >> 8); data[47] = (byte)(sp->h[5] >> 0); sha384Reset(sp); return 0; } /*!\} */ beecrypt-4.2.1/pkcs1.c0000664000175000001440000000434410254472207011447 00000000000000#define BEECRYPT_DLL_EXPORT #include "beecrypt/pkcs1.h" const byte EMSA_MD2_DIGESTINFO[18] = { 0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00, 0x04,0x10 }; const byte EMSA_MD5_DIGESTINFO[18] = { 0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00, 0x04,0x10 }; const byte EMSA_SHA1_DIGESTINFO[15] = { 0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1a,0x05,0x00,0x04,0x14 }; const byte EMSA_SHA256_DIGESTINFO[19] = { 0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05, 0x00,0x04,0x20 }; const byte EMSA_SHA384_DIGESTINFO[19] = { 0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05, 0x00,0x04,0x30 }; const byte EMSA_SHA512_DIGESTINFO[19] = { 0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05, 0x00,0x04,0x40 }; int pkcs1_emsa_encode_digest(hashFunctionContext* ctxt, byte* emdata, size_t emlen) { int rc = -1; const byte* tinfo; size_t tlen, digestsize = ctxt->algo->digestsize; if (strcmp(ctxt->algo->name, "MD5") == 0) { /* tlen is 18 bytes for EMSA_MD5_DIGESTINFO plus digestsize */ tinfo = EMSA_MD5_DIGESTINFO; tlen = 18; } else if (strcmp(ctxt->algo->name, "SHA-1") == 0) { /* tlen is 15 bytes for EMSA_SHA1_DIGESTINFO plus digestsize */ tinfo = EMSA_SHA1_DIGESTINFO; tlen = 15; } else if (strcmp(ctxt->algo->name, "SHA-256") == 0) { /* tlen is 19 bytes for EMSA_SHA256_DIGESTINFO plus digestsize */ tinfo = EMSA_SHA256_DIGESTINFO; tlen = 19; } else if (strcmp(ctxt->algo->name, "SHA-384") == 0) { /* tlen is 19 bytes for EMSA_SHA384_DIGESTINFO plus digestsize */ tinfo = EMSA_SHA384_DIGESTINFO; tlen = 19; } else if (strcmp(ctxt->algo->name, "SHA-512") == 0) { /* tlen is 19 bytes for EMSA_SHA512_DIGESTINFO plus digestsize */ tinfo = EMSA_SHA512_DIGESTINFO; tlen = 19; } else goto cleanup; tlen += digestsize; /* fill emdata with 0x00 0x01 0xff .... 0xff 0x00 EMSA_x_DIGESTINFO DIGEST */ emdata[0] = 0x00; emdata[1] = 0x01; memset(emdata+2, 0xff, emlen-tlen-3); emdata[emlen-tlen-1] = 0x00; memcpy(emdata+emlen-tlen, tinfo, tlen-digestsize); hashFunctionContextDigest(ctxt, emdata+emlen-digestsize); rc = 0; cleanup: return rc; } beecrypt-4.2.1/endianness.c0000644000175000001440000000471011216147021012540 00000000000000/* * Copyright (c) 1998, 1999, 2000, 2001 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file endianness.c * \brief Endian-dependant encoding/decoding. * \author Bob Deblier */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #if HAVE_ENDIAN_H && HAVE_ASM_BYTEORDER_H # include #endif #include "beecrypt/endianness.h" #undef swap16 #undef swapu16 #undef swap32 #undef swapu32 #undef swap64 #undef swapu64 int16_t swap16(int16_t n) { return ( ((n & 0xff) << 8) | ((n & 0xff00) >> 8) ); } uint16_t swapu16(uint16_t n) { return ( ((n & 0xffU) << 8) | ((n & 0xff00U) >> 8) ); } int32_t swap32(int32_t n) { return ( ((n & 0xff) << 24) | ((n & 0xff00) << 8) | ((n & 0xff0000) >> 8) | ((n & 0xff000000) >> 24) ); } uint32_t swapu32(uint32_t n) { return ( ((n & 0xffU) << 24) | ((n & 0xff00U) << 8) | ((n & 0xff0000U) >> 8) | ((n & 0xff000000U) >> 24) ); } int64_t swap64(int64_t n) { return ( ((n & (((int64_t) 0xff) )) << 56) | ((n & (((int64_t) 0xff) << 8)) << 40) | ((n & (((int64_t) 0xff) << 16)) << 24) | ((n & (((int64_t) 0xff) << 24)) << 8) | ((n & (((int64_t) 0xff) << 32)) >> 8) | ((n & (((int64_t) 0xff) << 40)) >> 24) | ((n & (((int64_t) 0xff) << 48)) >> 40) | ((n & (((int64_t) 0xff) << 56)) >> 56) ); } uint64_t swapu64(uint64_t n) { return ( ((n & (((uint64_t) 0xff) )) << 56) | ((n & (((uint64_t) 0xff) << 8)) << 40) | ((n & (((uint64_t) 0xff) << 16)) << 24) | ((n & (((uint64_t) 0xff) << 24)) << 8) | ((n & (((uint64_t) 0xff) << 32)) >> 8) | ((n & (((uint64_t) 0xff) << 40)) >> 24) | ((n & (((uint64_t) 0xff) << 48)) >> 40) | ((n & (((uint64_t) 0xff) << 56)) >> 56) ); } beecrypt-4.2.1/Makefile.am0000644000175000001440000000601711225165722012313 00000000000000# # Makefile.am contains the top-level automake definitions # # Copyright (c) 2001, 2002, 2004 X-Way Rights BV # Copyright (c) 2009 Bob Deblier # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # 1. No interfaces changes (good): Increment REVISION # # 2. Interfaces added, none removed (good): Increment CURRENT, increment AGE and REVISION to 0. # # 3. Interfaces removed (bad): Increment CURRENT, set AGE and REVISION to 0. # LIBBEECRYPT_LT_CURRENT = 7 LIBBEECRYPT_LT_AGE = 0 LIBBEECRYPT_LT_REVISION = 0 AUTOMAKE_OPTIONS = gnu check-news no-dependencies SUBDIRS = . include $(MAYBE_SUB) tests docs gas masm if WITH_CPLUSPLUS SUBDIRS += c++ endif if WITH_JAVA SUBDIRS += java endif if WITH_PYTHON SUBDIRS += python endif SUFFIXES = .s AM_CFLAGS = $(OPENMP_CFLAGS) INCLUDES = -I$(top_srcdir)/include .s.lo: $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< BEECRYPT_OBJECTS = aes.lo base64.lo beecrypt.lo blockmode.lo blockpad.lo blowfish.lo blowfishopt.lo dhies.lo dldp.lo dlkp.lo dlpk.lo dlsvdp-dh.lo dsa.lo elgamal.lo endianness.lo entropy.lo fips186.lo hmac.lo hmacmd5.lo hmacsha1.lo hmacsha224.lo hmacsha256.lo md4.lo md5.lo memchunk.lo mp.lo mpopt.lo mpbarrett.lo mpnumber.lo mpprime.lo mtprng.lo pkcs1.lo pkcs12.lo ripemd128.lo ripemd160.lo ripemd256.lo ripemd320.lo rsa.lo rsakp.lo rsapk.lo sha1.lo sha1opt.lo sha256.lo sha384.lo sha512.lo sha2k32.lo sha2k64.lo timestamp.lo lib_LTLIBRARIES = libbeecrypt.la libbeecrypt_la_SOURCES = aes.c base64.c beecrypt.c blockmode.c blockpad.c blowfish.c dhies.c dldp.c dlkp.c dlpk.c dlsvdp-dh.c dsa.c elgamal.c endianness.c entropy.c fips186.c hmac.c hmacmd5.c hmacsha1.c hmacsha224.c hmacsha256.c md4.c md5.c hmacsha384.c hmacsha512.c memchunk.c mp.c mpbarrett.c mpnumber.c mpprime.c mtprng.c pkcs1.c pkcs12.c ripemd128.c ripemd160.c ripemd256.c ripemd320.c rsa.c rsakp.c rsapk.c sha1.c sha224.c sha256.c sha384.c sha512.c sha2k32.c sha2k64.c timestamp.c cppglue.cxx libbeecrypt_la_DEPENDENCIES = $(BEECRYPT_OBJECTS) libbeecrypt_la_LIBADD = blowfishopt.lo mpopt.lo sha1opt.lo $(OPENMP_LIBS) libbeecrypt_la_LDFLAGS = -no-undefined -version-info $(LIBBEECRYPT_LT_CURRENT):$(LIBBEECRYPT_LT_REVISION):$(LIBBEECRYPT_LT_AGE) EXTRA_DIST = BENCHMARKS BUGS CONTRIBUTORS README.WIN32 autogen.sh DISTCLEANFILES = mpopt.s blowfishopt.s sha1opt.s bench: (cd tests && $(MAKE) $(AM_MAKEFLAGS) bench) beecrypt-4.2.1/mpprime.c0000664000175000001440000010453110254472207012076 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mpprime.c * \brief Multi-precision primes. * \author Bob Deblier * \ingroup MP_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/mpprime.h" /* * A word of explanation here on what this table accomplishes: * * For fast checking whether a candidate prime can be divided by small primes, we use this table, * which contains the products of all small primes starting at 3, up to a word size equal to the size * of the candidate tested. * * Instead of trying each small prime in successive divisions, we compute one gcd with a product of small * primes from this table. * If the gcd result is not 1, the candidate is divisable by at least one of the small primes(*). If the gcd * result is 1, then we can subject the candidate to a probabilistic test. * * (*) Note: the candidate prime could also be one of the small primes, in which is it IS prime, * but too small to be of cryptographic interest. Hence, use only for candidate primes that are large enough. */ #if (MP_WBITS == 64) static mpw spp_01[] = /* primes 3 to 53 */ { 0xe221f97c30e94e1dU }; static mpw spp_02[] = /* primes 3 to 101 */ { 0x5797d47c51681549U, 0xd734e4fc4c3eaf7fU }; static mpw spp_03[] = /* primes 3 to 149 */ { 0x1e6d8e2a0ffceafbU, 0xbcbfc14a4c3bc1e1U, 0x009c6a22a0a7adf5U }; static mpw spp_04[] = /* primes 3 to 193 */ { 0xdbf05b6f5654b3c0U, 0xf524355143958688U, 0x9f155887819aed2aU, 0xc05b93352be98677U }; static mpw spp_05[] = /* primes 3 to 239 */ { 0x3faa5dadb695ce58U, 0x4a579328eab20f1fU, 0xef00fe27ffc36456U, 0x0a65723e27d8884aU, 0xd59da0a992f77529U }; static mpw spp_06[] = /* primes 3 to 281 */ { 0x501201cc51a492a5U, 0x44d3900ad4f8b32aU, 0x203c858406a4457cU, 0xab0b4f805ab18ac6U, 0xeb9572ac6e9394faU, 0x522bffb6f44af2f3U }; static mpw spp_07[] = /* primes 3 to 331 */ { 0x0120eb4d70279230U, 0x9ed122fce0488be4U, 0x1d0c99f5d8c039adU, 0x058c90b4780500feU, 0xf39c05cc09817a27U, 0xc3e1776a246b6af2U, 0x946a10d66eafaedfU }; static mpw spp_08[] = /* primes 3 to 379 */ { 0x106aa9fb7646fa6eU, 0xb0813c28c5d5f09fU, 0x077ec3ba238bfb99U, 0xc1b631a203e81187U, 0x233db117cbc38405U, 0x6ef04659a4a11de4U, 0x9f7ecb29bada8f98U, 0x0decece92e30c48fU }; static mpw spp_09[] = /* primes 3 to 421 */ { 0x0185dbeb2b8b11d3U, 0x7633e9dc1eec5415U, 0x65c6ce8431d227eeU, 0x28f0328a60c90118U, 0xae031cc5a781c824U, 0xd1f16d25f4f0cccfU, 0xf35e974579072ec8U, 0xcaf1ac8eefd5566fU, 0xa15fb94fe34f5d37U }; static mpw spp_10[] = /* primes 3 to 463 */ { 0x833a505cf9922beeU, 0xc80265a6d50e1cceU, 0xa22f6fec2eb84450U, 0xcec64a3c0e10d472U, 0xdd653b9b51d81d0eU, 0x3a3142ea49b91e3aU, 0x5e21023267bda426U, 0x738730cfb8e6e2aeU, 0xc08c9d4bd2420066U, 0xdccf95ef49a560b7U }; static mpw spp_11[] = /* primes 3 to 509 */ { 0x309d024bd5380319U, 0x2ca334690bafb43aU, 0x0abd5840fbeb24d1U, 0xf49b633047902baeU, 0x581ca4cba778fdb1U, 0x6dc0a6afef960687U, 0x16855d9593746604U, 0x201f1919b725fcb7U, 0x8ffd0db8e8fa61a1U, 0x6e1c0970beb81adcU, 0xf49c82dff960d36fU }; static mpw spp_12[] = /* primes 3 to 569 */ { 0x25eac89f8d4da338U, 0x337b49850d2d1489U, 0x2663177b4010af3dU, 0xd23eeb0b228f3832U, 0xffcee2e5cbd1acc9U, 0x8f47f251873380aeU, 0x10f0ffdd8e602ffaU, 0x210f41f669a1570aU, 0x93c158c1a9a8227fU, 0xf81a90c5630e9c44U, 0x845c755c7df35a7dU, 0x430c679a11575655U }; static mpw spp_13[] = /* primes 3 to 607 */ { 0x3383219d26454f06U, 0xe2789b7f9c3b940eU, 0x03be2105798e3ff7U, 0x945bd325997bc262U, 0x025598f88577748eU, 0xc7155ff88a1ff4c9U, 0x2ce95bd8b015101fU, 0x19b73b1481627f9aU, 0x6f83da3a03259fbdU, 0x41f92a6e85ac6efaU, 0xde195be86e66ba89U, 0xb0ab042d3276976cU, 0x3dbeb3d7413ea96dU }; static mpw spp_14[] = /* primes 3 to 647 */ { 0x6e02645460adbd18U, 0xcd52ce1a1beab1c0U, 0x36e468e9f350d69bU, 0x1d357d083a59f778U, 0xc2cc262b4a29ce52U, 0x509bcf97349ba2bfU, 0x22402d716b32517eU, 0x1941e18ace76cbd8U, 0x5809701e70eaef96U, 0x9aac365c8a9fea5eU, 0xc74d951db361f061U, 0xc4d14f000d806db4U, 0xcd939110c7cab492U, 0x2f3ea4c4852ca469U }; static mpw spp_15[] = /* primes 3 to 683 */ { 0x008723131f66758aU, 0x414bbebb2f8670bfU, 0x01dc959d74468901U, 0x57c57f40e210c9c2U, 0x74f544697c71cc1dU, 0xe2be67a203d8d56fU, 0x6c363fca0a78676aU, 0x2b9777896ea2db50U, 0xdb31b73751992f73U, 0x0def293ebc028877U, 0xdf95ac1b4d0c0128U, 0x9a0b05e00e6c0bc8U, 0xe61b766ec0943254U, 0x1cd70f0fd5a0ce6bU, 0x8ab998fb8ab36e0dU }; static mpw spp_16[] = /* primes 3 to 739 */ { 0x02c85ff870f24be8U, 0x0f62b1ba6c20bd72U, 0xb837efdf121206d8U, 0x7db56b7d69fa4c02U, 0x1c107c3ca206fe8fU, 0xa7080ef576effc82U, 0xf9b10f5750656b77U, 0x94b16afd70996e91U, 0xaef6e0ad15e91b07U, 0x1ac9b24d98b233adU, 0x86ee055518e58e56U, 0x638ef18bac5c74cbU, 0x35bbb6e5dae2783dU, 0xd1c0ce7dec4fc70eU, 0x5186d411df36368fU, 0x061aa36011f30179U }; static mpw spp_17[] = /* primes 3 to 787 */ { 0x16af5c18a2bef8efU, 0xf2278332182d0fbfU, 0x0038cc205148b83dU, 0x06e3d7d932828b18U, 0xe11e094028c7eaedU, 0xa3395017e07d8ae9U, 0xb594060451d05f93U, 0x084cb481663c94c6U, 0xff980ddeccdb42adU, 0x37097f41a7837fc9U, 0x5afe3f18ad76f234U, 0x83ae942e0f0c0bc6U, 0xe40016123189872bU, 0xe58f6dfc239ca28fU, 0xb0cfbf964c8f27ceU, 0x05d6c77a01f9d332U, 0x36c9d442ad69ed33U }; static mpw spp_18[] = /* primes 3 to 827 */ { 0x005bfd2583ab7a44U, 0x13d4df0f537c686cU, 0xa8e6b583e491130eU, 0x96dfcc1c05ba298fU, 0x8701314b45bf6ff4U, 0xecf372ffe78bccdfU, 0xfc18365a6ae5ca41U, 0x2794281fbcc762f1U, 0x8ca1eb11fc8efe0bU, 0x6bb5a7a09954e758U, 0x074256ad443a8e4bU, 0xaa2675154c43d626U, 0x464119446e683d08U, 0xd4683db5757d1199U, 0x9513a9cbe3e67e3aU, 0xe501c1c522aa8ba9U, 0xf955789589161febU, 0xc69941a147aa9685U }; static mpw spp_19[] = /* primes 3 to 877 */ { 0x06706918e8355b7fU, 0xfd3f024da6b012e2U, 0xbb7338f30d51a968U, 0x0f3d912035ed70e0U, 0x2d38d422e41812d4U, 0xe29d637b318ce6f4U, 0xea117321ce8b712dU, 0xcca9345fd03ccaf5U, 0x2e75dafcda909cd4U, 0xb41a9f8753c8df3dU, 0x284198bcb759d059U, 0x941360572b7ab25fU, 0x396b9fa37ae0a200U, 0xd998ea09167edc30U, 0xf9d2c45c7e487029U, 0x927500983f7fb4e8U, 0xe85d8e9434a37006U, 0x8cebc96060ab2f87U, 0x81efeb182d0e724bU }; static mpw spp_20[] = /* primes 3 to 929 */ { 0xa9e9591f7815617eU, 0xcabe352fa13445c4U, 0xf8e319ba63042e1cU, 0xb0a017d0e729a699U, 0x5480da4e5091cab4U, 0x12910cf47bb0f24eU, 0x5e1db41264b9f96aU, 0x2b327e901d9d0a39U, 0x12659a52d3792d52U, 0x991bfa964fe7d212U, 0x60374c24a04de69dU, 0xf5d4e46b249cafc7U, 0x347c6181bd6dc6b8U, 0x13a29dc6d4f785acU, 0x7806635513530cd5U, 0xdb94de4858c157f0U, 0x30b96bfb6475393bU, 0x5f43a549d95c5619U, 0x7e274850ad1a6d18U, 0xb5eaa41dd42fda55U }; static mpw spp_21[] = /* primes 3 to 971 */ { 0x06e1d136cb78cac5U, 0x4da4bfcb6f2c4a24U, 0xfcf3796b77719c31U, 0xd27915860001f03eU, 0x4347621bf62577e0U, 0x280ebfdb77b4f1e9U, 0x0f954ecafd198609U, 0x68629be91424c37aU, 0x8f320a34444953d5U, 0x2c278d6485238798U, 0x709d0063e3fa8623U, 0xea24bf2a2c5278e7U, 0x4460d05a0a708bd9U, 0xc019d632e39e7300U, 0x22b9dbb913df73cfU, 0xb959dffe348f9623U, 0xf697a822f4a11320U, 0xbd044ecc74878f53U, 0x0d57d0f076647b0aU, 0xb191f543dc08c392U, 0x3167e5ee56c66847U }; static mpw spp_22[] = /* primes 3 to 1013 */ { 0x005ca1a92edd0e81U, 0x9619289e1ecfe2d7U, 0xf3949eaf363a5fe8U, 0xf6fee01ccd480490U, 0x30a1346ab83c4967U, 0x8c7d58826caf81caU, 0x1d02473bea8ad400U, 0xd1ce270a5743c3cdU, 0x892c3bd93b84525dU, 0x8a42071a508fdb8fU, 0x32952aaa2384cf5dU, 0xf23ed81d10ac0031U, 0xd85d0e95e3c5bb51U, 0x71a0e3f12b671f8fU, 0xb07965cc353a784bU, 0x78f719681326c790U, 0x6e2b7f7b0782848eU, 0xeb1aea5bab10b80eU, 0x5b7138fc36f7989cU, 0xe85b07c2d4d59d42U, 0x1541c765f6c2111dU, 0xb82eca06b437f757U }; static mpw spp_23[] = /* primes 3 to 1051 */ { 0x18e5b310229f618dU, 0xe0f54782f57fff33U, 0x10546ba8efc0a69cU, 0xac4b573b749cc43dU, 0xd3ba4df61fe2800dU, 0x733f4eb719a6ea7fU, 0xa88aebf2d35b26c8U, 0x6e89fe0b27e198deU, 0xe12a14da03cef215U, 0xe6651c60be9cf337U, 0x3620f4aba453eeb9U, 0xeb439ba079201376U, 0x0e3cc7f8722f09a4U, 0x685a5556b4efd158U, 0xb27a6b79b15f161fU, 0xecf3fd802767da7aU, 0x37ceb764bebfcc2bU, 0x2d833be00b21bb68U, 0xeab326b9ebb20cc2U, 0xd76273edefa152adU, 0x531bccbf17e3c78dU, 0x5c43d8f6866ad640U, 0xfdbbba0fe997b27bU }; static mpw spp_24[] = /* primes 3 to 1093 */ { 0x021bf9497091b8c3U, 0x68cc7c8e00c1990cU, 0x6027481b79215ac8U, 0xa7517749a2151377U, 0x9a993d2958fcb49aU, 0x7368029268527994U, 0xc6cc1928add41295U, 0x96765f4cc3141a04U, 0x4eb1d61578881667U, 0x57d8618781813062U, 0x032267987df0d471U, 0x9cd38f1b7085fca5U, 0x334be3a6003a3ce7U, 0xe19aba553e80cc5aU, 0xe4060eff6e180666U, 0x1da5eeb7d142d3b2U, 0xe40739f1443dee3aU, 0x198637f03c062845U, 0xeaff3ff27ea38d93U, 0x44d8a90222472df0U, 0x7dfb5c9c8ada77cdU, 0x0d5b94eff021e02eU, 0x307d08010312d57cU, 0xb5d975764697842dU }; static mpw spp_25[] = /* primes 3 to 1151 */ { 0xfa1bd62baae1e767U, 0x47535af3830fc07dU, 0xebcf3ef7e5a8e46bU, 0x8937c4afe02aef0aU, 0xce420c7b2c3f2facU, 0xb9dc94e5100a7191U, 0xb47cf523520f613bU, 0xee8e095a7b06d781U, 0xb6204bde1648e17fU, 0x0f1bd4aba00f7e90U, 0xd8fc2a05f5f1e832U, 0x6e88a4a67e73cae1U, 0xc4a93d89ad6b301bU, 0x1f185b130246ab44U, 0x5cadc384931189b5U, 0x566b3ed9dafba4e6U, 0x59f5446e5a70c8d1U, 0x4626b66d0f1ccfbfU, 0xd4238b6884af7dd3U, 0xa91d2063ceb2c2f7U, 0xf273b1da4cb542eaU, 0x62c624cf4fcb0486U, 0x138b42a3c1d9593cU, 0xe1254fb3214d2b08U, 0x52532bc528bc6467U }; static mpw spp_26[] = /* primes 3 to 1193 */ { 0x239afcd438799705U, 0xab8a0cda4802bc8fU, 0xb0e87f44a568f618U, 0x7c604708dfb79072U, 0xe24b49cb8b2ac531U, 0x005cf2982437b16eU, 0x027fa01414e3dbf5U, 0xbf76681166e276ffU, 0xcf6768550bc1cd9aU, 0x1b387ebaaa8550aeU, 0xfc10c69c372a0254U, 0xb84666ff35044b9aU, 0xa34fcf7c817b33f3U, 0x7088a289a17891a7U, 0xe66f88e8ec2ba784U, 0xb2a09a9102609726U, 0x17a3dbea8463439dU, 0x47972d09b0e63752U, 0xbac58d339b402dc1U, 0xa09915543360cd68U, 0x4df24e437487571dU, 0xfaf68f4fe0a93546U, 0x66aa84bf84d4448dU, 0x2119029166db27bdU, 0x515599cdcd147810U, 0x3acf73e7fe62aed9U }; static mpw spp_27[] = /* primes 3 to 1231 */ { 0x0654f0d4cdacb307U, 0x5419612fae3cf746U, 0xfbab751fd0887955U, 0x28adc68d26f32877U, 0xeb1b772db48e49f6U, 0xcb445987c4966560U, 0xdff8473702bb0fd4U, 0xf8b68b5ce2d496a6U, 0x0dc7d7e43c3cb0bfU, 0x72665c6e4c86a7ceU, 0xb78c9da40f4d90a8U, 0xf5dfe2a4dc559b8aU, 0xba10a63a0ca25d3aU, 0xdec2c4198b688d80U, 0x71c05d3b694f19deU, 0xda32955f77fbb577U, 0x27eb652140495e56U, 0x2f4a13e8b648daf2U, 0x13d1da75e3f04bb0U, 0x43fedcd2b2a0cd30U, 0xa4339e3a03b7f3a0U, 0xe02a31c28394368cU, 0x7f73bbf32712e69eU, 0x7ac58373e5f7c7e7U, 0x55e0d645628c5475U, 0x6217c0bdf119900bU, 0x05ea71dd714fd2c9U }; static mpw spp_28[] = /* primes 3 to 1283 */ { 0x01662c66dab7a4faU, 0xdba4265ac2075912U, 0x59e9c885e1330cb6U, 0xc91bee92f1b334ffU, 0x384f827cc8057aa7U, 0xc3b65fc6de53dcacU, 0x2db6d7903febbe07U, 0xcc4012326b128eb7U, 0x1afd3136a9e7f786U, 0x14648da17b4f50c7U, 0xbd4129ca746dab21U, 0x09583797fc1c2ecdU, 0x4c0768a81892bd16U, 0xdfea8227bcb2b8bfU, 0x168a1452370b0863U, 0xb299d0888434c213U, 0x2383a6c7b6b4bf20U, 0x5addc8da76d2b172U, 0xb416f5b0b9a38d87U, 0x738c1cca3fe33dd2U, 0xf9b7570e3f663f8bU, 0x3416907651b1dd42U, 0x2192331d9436304aU, 0x0303422f4d420389U, 0x4548a05562ed1c09U, 0x1a63309bf1a9df8bU, 0xf0c59af912a62c22U, 0xe1e1f49bb0115c17U }; static mpw spp_29[] = /* primes 3 to 1307 */ { 0x005cda0c54b07f4fU, 0xff0caca07cc89b95U, 0x1c021191164be693U, 0x6665357ebb2f689cU, 0x7157ea4f98037ce1U, 0x5aca14ca3cf1a386U, 0xb03e831ee09a8d5cU, 0x48d51f5e6646ed8aU, 0x7ec2b955216587f0U, 0x7f3c42ee06ae3844U, 0x4c776b8c3ef32747U, 0x97cd2ac1c7cce7ecU, 0xe75bb0290f5b5a0eU, 0x2c96c4600c678a21U, 0x0d992d36d441b1fdU, 0x682adf0ef289947eU, 0x6d3de1a2af0ca945U, 0x859aa1f2b2bb793dU, 0x351dbebfe05144eeU, 0xfe9c752d75ec602cU, 0x0e0344ddcfcb642bU, 0x6cfc872219d69873U, 0xb8c4ace3ffd460e9U, 0x43d903b45de9d402U, 0x958a41fb5e008a94U, 0xc93610814e5e2811U, 0xd052c10abfc67bf6U, 0x915d44352688091bU, 0x1eb1c7117c91eae5U }; static mpw spp_30[] = /* primes 3 to 1381 */ { 0xa0604bc54c251adeU, 0xcf22bf075a150bb1U, 0x2a67d65a5045c183U, 0x172466270d72a8c6U, 0x3e2dd1c46694a251U, 0xf55bca5e7d834c87U, 0x2a8d10e5ea91ba4dU, 0xcce166f16b1be0efU, 0xba025bf362f29284U, 0xa36db51675c7d25eU, 0xac7519925560c7a1U, 0xc70470938bdf2818U, 0xed42d04253130befU, 0x0d92e596844e073bU, 0xdd40bd156f433f09U, 0xbdfd3e38769a485cU, 0xf29380b79c18989cU, 0xed0e6ec43bcc7b73U, 0x087e1fb94e8cf2d3U, 0x475c77605c707f6bU, 0x31f7217c4c628da2U, 0xe3263e30a83c1066U, 0x1378f41533ca7d71U, 0x5d4e2b87c0e142baU, 0x462e6ffb506e09f9U, 0x7850c73e4b3f7a24U, 0xca98bda05c0c6ac6U, 0x666daad014d2ff3fU, 0x7138fa68ddd5e9f0U, 0xe92edcaa62b56483U }; static mpw spp_31[] = /* primes 3 to 1433 */ { 0x4742fdaff7e8231aU, 0xded6827758493423U, 0x12b13d2f5925c539U, 0x82d876ef7ff69e7fU, 0x5b4ff04e8454faeaU, 0x620dc9600c65fd57U, 0x2aecce4c9656588fU, 0x79dfb5dfd7f99148U, 0x196c24df6d8c704bU, 0xd6ffb8d9cedb8ee8U, 0x448d4352d834cef7U, 0xfce9b92907eeca6aU, 0xcc107008fa118ff7U, 0xedcc0b84207c3eefU, 0xdb5ea3ef89c684d8U, 0x89c4187a10775358U, 0xc429d4d2a76bb2c3U, 0x9f406fdc49dcf4b6U, 0xed773586770e4651U, 0xcb63c78354d2a578U, 0x5f52816b14d29d62U, 0x06d952ca4428030eU, 0x2e793590f75f1d07U, 0x79363fa6047f0c64U, 0xf3ed6a912dbc4437U, 0x673d418400d005caU, 0x9ca42ff6841c84ddU, 0xaaff5fb087f85954U, 0x177c5dc0fbfbb491U, 0xa1e5e03e5715875cU, 0xa02a0fa41fde7abdU }; static mpw spp_32[] = /* primes 3 to 1471 */ { 0x2465a7bd85011e1cU, 0x9e0527929fff268cU, 0x82ef7efa416863baU, 0xa5acdb0971dba0ccU, 0xac3ee4999345029fU, 0x2cf810b99e406aacU, 0x5fce5dd69d1c717dU, 0xaea5d18ab913f456U, 0x505679bc91c57d46U, 0xd9888857862b36e2U, 0xede2e473c1f0ab35U, 0x9da25271affe15ffU, 0x240e299d0b04f4cdU, 0x0e4d7c0e47b1a7baU, 0x007de89aae848fd5U, 0xbdcd7f9815564eb0U, 0x60ae14f19cb50c29U, 0x1f0bbd8ed1c4c7f8U, 0xfc5fba5166200193U, 0x9b532d92dac844a8U, 0x431d400c832d039fU, 0x5f900b278a75219cU, 0x2986140c79045d77U, 0x59540854c31504dcU, 0x56f1df5eebe7bee4U, 0x47658b917bf696d6U, 0x927f2e2428fbeb34U, 0x0e515cb9835d6387U, 0x1be8bbe09cf13445U, 0x799f2e6778815157U, 0x1a93b4c1eee55d1bU, 0x9072e0b2f5c4607fU }; #elif (MP_WBITS == 32) static mpw spp_01[] = /* primes 3 to 29 */ { 0xc0cfd797U }; static mpw spp_02[] = /* primes 3 to 53 */ { 0xe221f97cU, 0x30e94e1dU }; static mpw spp_03[] = /* primes 3 to 73 */ { 0x41cd66acU, 0xc237b226U, 0x81a18067U }; static mpw spp_04[] = /* primes 3 to 101 */ { 0x5797d47cU, 0x51681549U, 0xd734e4fcU, 0x4c3eaf7fU }; static mpw spp_05[] = /* primes 3 to 113 */ { 0x02c4b8d0U, 0xd2e0d937U, 0x3935200fU, 0xb49be231U, 0x5ce1a307U }; static mpw spp_06[] = /* primes 3 to 149 */ { 0x1e6d8e2aU, 0x0ffceafbU, 0xbcbfc14aU, 0x4c3bc1e1U, 0x009c6a22U, 0xa0a7adf5U }; static mpw spp_07[] = /* primes 3 to 167 */ { 0x049265d3U, 0x574cefd0U, 0x4229bfd6U, 0x62a4a46fU, 0x8611ed02U, 0x26c655f0U, 0x76ebade3U }; static mpw spp_08[] = /* primes 3 to 193 */ { 0xdbf05b6fU, 0x5654b3c0U, 0xf5243551U, 0x43958688U, 0x9f155887U, 0x819aed2aU, 0xc05b9335U, 0x2be98677U }; static mpw spp_09[] = /* primes 3 to 223 */ { 0x5e75cec8U, 0xb5de5ea1U, 0x5da8302aU, 0x2f28b4adU, 0x2735bdc3U, 0x9344c52eU, 0x67570925U, 0x6feb71efU, 0x6811d741U }; static mpw spp_10[] = /* primes 3 to 239 */ { 0x3faa5dadU, 0xb695ce58U, 0x4a579328U, 0xeab20f1fU, 0xef00fe27U, 0xffc36456U, 0x0a65723eU, 0x27d8884aU, 0xd59da0a9U, 0x92f77529U }; static mpw spp_11[] = /* primes 3 to 263 */ { 0x3c9b6e49U, 0xb7cf685bU, 0xe7f3a239U, 0xfb4084cbU, 0x166885e3U, 0x9d4f65b4U, 0x0bb0e51cU, 0x0a5d36feU, 0x98c32069U, 0xfd5c441cU, 0x6d82f115U }; static mpw spp_12[] = /* primes 3 to 281 */ { 0x501201ccU, 0x51a492a5U, 0x44d3900aU, 0xd4f8b32aU, 0x203c8584U, 0x06a4457cU, 0xab0b4f80U, 0x5ab18ac6U, 0xeb9572acU, 0x6e9394faU, 0x522bffb6U, 0xf44af2f3U }; static mpw spp_13[] = /* primes 3 to 311 */ { 0x9397b5b4U, 0x414dc331U, 0x04561364U, 0x79958cc8U, 0xfd5ea01fU, 0x5d5e9f61U, 0xbd0f1cb6U, 0x24af7e6aU, 0x3284dbb2U, 0x9857622bU, 0x8be980a6U, 0x5456a5c1U, 0xed928009U }; static mpw spp_14[] = /* primes 3 to 331 */ { 0x0120eb4dU, 0x70279230U, 0x9ed122fcU, 0xe0488be4U, 0x1d0c99f5U, 0xd8c039adU, 0x058c90b4U, 0x780500feU, 0xf39c05ccU, 0x09817a27U, 0xc3e1776aU, 0x246b6af2U, 0x946a10d6U, 0x6eafaedfU }; static mpw spp_15[] = /* primes 3 to 353 */ { 0x03c91dd1U, 0x2e893191U, 0x94095649U, 0x874b41d6U, 0x05810c06U, 0x195d70ebU, 0xbd54a862U, 0x50c52733U, 0x06dc6648U, 0x1c251ca4U, 0xa02c9a04U, 0x78c96f0dU, 0x02f0db0bU, 0x39d624caU, 0x0b0441c1U }; static mpw spp_16[] = /* primes 3 to 379 */ { 0x106aa9fbU, 0x7646fa6eU, 0xb0813c28U, 0xc5d5f09fU, 0x077ec3baU, 0x238bfb99U, 0xc1b631a2U, 0x03e81187U, 0x233db117U, 0xcbc38405U, 0x6ef04659U, 0xa4a11de4U, 0x9f7ecb29U, 0xbada8f98U, 0x0decece9U, 0x2e30c48fU }; static mpw spp_17[] = /* primes 3 to 401 */ { 0x5aa88d8cU, 0x594bb372U, 0xc4bc813fU, 0x4a87a266U, 0x1f984840U, 0xdab15692U, 0x2c2a177dU, 0x95843665U, 0x6f36d41aU, 0x11c35cccU, 0x2904b7e9U, 0xc424eb61U, 0x3b3536a4U, 0x0b2745bdU, 0xadf1a6c9U, 0x7b23e85aU, 0xdc6695c1U }; static mpw spp_18[] = /* primes 3 to 421 */ { 0x0185dbebU, 0x2b8b11d3U, 0x7633e9dcU, 0x1eec5415U, 0x65c6ce84U, 0x31d227eeU, 0x28f0328aU, 0x60c90118U, 0xae031cc5U, 0xa781c824U, 0xd1f16d25U, 0xf4f0cccfU, 0xf35e9745U, 0x79072ec8U, 0xcaf1ac8eU, 0xefd5566fU, 0xa15fb94fU, 0xe34f5d37U }; static mpw spp_19[] = /* primes 3 to 443 */ { 0x0cde6fd1U, 0xcf108066U, 0xcc548df9U, 0x070e102cU, 0x2c651b88U, 0x5f24f503U, 0xaaffe276U, 0xfeb57311U, 0x0c1e4592U, 0xa35890d7U, 0x678aaeeeU, 0x9f44800fU, 0xc43f999dU, 0x5d06b89fU, 0xcb22e533U, 0x5a9287bcU, 0x6d75a3e9U, 0x1e53906dU, 0x413163d5U }; static mpw spp_20[] = /* primes 3 to 463 */ { 0x833a505cU, 0xf9922beeU, 0xc80265a6U, 0xd50e1cceU, 0xa22f6fecU, 0x2eb84450U, 0xcec64a3cU, 0x0e10d472U, 0xdd653b9bU, 0x51d81d0eU, 0x3a3142eaU, 0x49b91e3aU, 0x5e210232U, 0x67bda426U, 0x738730cfU, 0xb8e6e2aeU, 0xc08c9d4bU, 0xd2420066U, 0xdccf95efU, 0x49a560b7U }; static mpw spp_21[] = /* primes 3 to 487 */ { 0x035417f1U, 0xe321c06cU, 0xbe32ffceU, 0xae752cc9U, 0xa9fe11a6U, 0x3d94c946U, 0x456edd7dU, 0x5a060de1U, 0x84a826a6U, 0xf0740c13U, 0x48fa1038U, 0x911d771dU, 0xb3773e87U, 0x52300c29U, 0xc82c3012U, 0x131673bbU, 0x491cbd61U, 0x55e565afU, 0x4a9f4331U, 0x0adbb0d7U, 0x06e86f6dU }; static mpw spp_22[] = /* primes 3 to 509 */ { 0x309d024bU, 0xd5380319U, 0x2ca33469U, 0x0bafb43aU, 0x0abd5840U, 0xfbeb24d1U, 0xf49b6330U, 0x47902baeU, 0x581ca4cbU, 0xa778fdb1U, 0x6dc0a6afU, 0xef960687U, 0x16855d95U, 0x93746604U, 0x201f1919U, 0xb725fcb7U, 0x8ffd0db8U, 0xe8fa61a1U, 0x6e1c0970U, 0xbeb81adcU, 0xf49c82dfU, 0xf960d36fU }; static mpw spp_23[] = /* primes 3 to 541 */ { 0x01ab244aU, 0x33bc047eU, 0x804590b4U, 0xc3207237U, 0xea503fa0U, 0x7541b251U, 0x57cfd03fU, 0xf602c9d0U, 0x3dcd12baU, 0xa4947ae6U, 0xc6ee61beU, 0xedf6c716U, 0xfa45377dU, 0x5b3c84faU, 0x5fb78b41U, 0x395251ebU, 0xb6a5129cU, 0x7699fb5cU, 0xccec6d45U, 0x56c9b8eaU, 0xfa05897cU, 0xb8c5cf72U, 0xb77603d9U }; static mpw spp_24[] = /* primes 3 to 569 */ { 0x25eac89fU, 0x8d4da338U, 0x337b4985U, 0x0d2d1489U, 0x2663177bU, 0x4010af3dU, 0xd23eeb0bU, 0x228f3832U, 0xffcee2e5U, 0xcbd1acc9U, 0x8f47f251U, 0x873380aeU, 0x10f0ffddU, 0x8e602ffaU, 0x210f41f6U, 0x69a1570aU, 0x93c158c1U, 0xa9a8227fU, 0xf81a90c5U, 0x630e9c44U, 0x845c755cU, 0x7df35a7dU, 0x430c679aU, 0x11575655U }; static mpw spp_25[] = /* primes 3 to 587 */ { 0x01b515a8U, 0xdca3d6e4U, 0x69090373U, 0x84febfe8U, 0xf32e06cfU, 0x9bde8c89U, 0x6b3f992fU, 0x2ff23508U, 0xe1c01024U, 0x3b8ad0c4U, 0xac54e7c7U, 0x3f4081d8U, 0xe495d54dU, 0x74ed01e8U, 0x9dfcbddeU, 0x1fe7e61aU, 0x839bd902U, 0xf43bf273U, 0x2441f0aeU, 0xb4211c70U, 0x6b3faafcU, 0x0f200b35U, 0x7485ce4aU, 0x2f08f148U, 0xcce6887dU }; static mpw spp_26[] = /* primes 3 to 607 */ { 0x3383219dU, 0x26454f06U, 0xe2789b7fU, 0x9c3b940eU, 0x03be2105U, 0x798e3ff7U, 0x945bd325U, 0x997bc262U, 0x025598f8U, 0x8577748eU, 0xc7155ff8U, 0x8a1ff4c9U, 0x2ce95bd8U, 0xb015101fU, 0x19b73b14U, 0x81627f9aU, 0x6f83da3aU, 0x03259fbdU, 0x41f92a6eU, 0x85ac6efaU, 0xde195be8U, 0x6e66ba89U, 0xb0ab042dU, 0x3276976cU, 0x3dbeb3d7U, 0x413ea96dU }; static mpw spp_27[] = /* primes 3 to 619 */ { 0x02ced4b7U, 0xf15179e8U, 0x7fcba6daU, 0x7b07a6f3U, 0xf9311218U, 0xa7b88985U, 0xac74b503U, 0xbf745330U, 0x6d0a23f5U, 0x27a1fa9aU, 0xc2b85f1aU, 0x26152470U, 0x6ac242f3U, 0x518cc497U, 0x09a23d74U, 0xff28da52U, 0xe7bbf7f7U, 0xa63c1c88U, 0x6f684195U, 0x65e472ceU, 0x80751585U, 0xc70e20c2U, 0x2d15d3feU, 0xc1b40c7fU, 0x8e25dd07U, 0xdb09dd86U, 0x791aa9e3U }; static mpw spp_28[] = /* primes 3 to 647 */ { 0x6e026454U, 0x60adbd18U, 0xcd52ce1aU, 0x1beab1c0U, 0x36e468e9U, 0xf350d69bU, 0x1d357d08U, 0x3a59f778U, 0xc2cc262bU, 0x4a29ce52U, 0x509bcf97U, 0x349ba2bfU, 0x22402d71U, 0x6b32517eU, 0x1941e18aU, 0xce76cbd8U, 0x5809701eU, 0x70eaef96U, 0x9aac365cU, 0x8a9fea5eU, 0xc74d951dU, 0xb361f061U, 0xc4d14f00U, 0x0d806db4U, 0xcd939110U, 0xc7cab492U, 0x2f3ea4c4U, 0x852ca469U }; static mpw spp_29[] = /* primes 3 to 661 */ { 0x074921f7U, 0x6a76cec3U, 0xaeb05f74U, 0x60b21f16U, 0x49dece2fU, 0x21bb3ed9U, 0xe4cb4ebcU, 0x05d6f408U, 0xed3d408aU, 0xdee16505U, 0xdc657c6dU, 0x93877982U, 0xf2d11ce6U, 0xcb5b0bb0U, 0x579b3189U, 0xb339c2ccU, 0xcf81d846U, 0xa9fbde0cU, 0x723afbc7U, 0x36655d41U, 0x0018d768U, 0x21779cf3U, 0x52642f1bU, 0x2d17165dU, 0xc7001c45U, 0x4a84a45dU, 0x66007591U, 0x27e85693U, 0x2288d0fbU }; static mpw spp_30[] = /* primes 3 to 683 */ { 0x00872313U, 0x1f66758aU, 0x414bbebbU, 0x2f8670bfU, 0x01dc959dU, 0x74468901U, 0x57c57f40U, 0xe210c9c2U, 0x74f54469U, 0x7c71cc1dU, 0xe2be67a2U, 0x03d8d56fU, 0x6c363fcaU, 0x0a78676aU, 0x2b977789U, 0x6ea2db50U, 0xdb31b737U, 0x51992f73U, 0x0def293eU, 0xbc028877U, 0xdf95ac1bU, 0x4d0c0128U, 0x9a0b05e0U, 0x0e6c0bc8U, 0xe61b766eU, 0xc0943254U, 0x1cd70f0fU, 0xd5a0ce6bU, 0x8ab998fbU, 0x8ab36e0dU }; static mpw spp_31[] = /* primes 3 to 719 */ { 0x1e595df4U, 0x3064a8c9U, 0xd61ae17bU, 0xde1938f0U, 0x22ee6357U, 0x35f4caddU, 0x3d39f473U, 0xafed7df5U, 0x92ae0fd3U, 0xfe910508U, 0x9ad9e939U, 0x988b0227U, 0x60dec749U, 0xae7ee54fU, 0xeb0572acU, 0x0aed266dU, 0x92daafd8U, 0x6135f7a3U, 0xe4e8bf05U, 0x0124c928U, 0xb0d719d5U, 0x2181aec8U, 0x0f79820fU, 0xcb158642U, 0x20969ec0U, 0x1a480d31U, 0x331b3252U, 0x01b36fabU, 0x3d5b415bU, 0x1a4567e7U, 0x3baf6389U }; static mpw spp_32[] = /* primes 3 to 739 */ { 0x02c85ff8U, 0x70f24be8U, 0x0f62b1baU, 0x6c20bd72U, 0xb837efdfU, 0x121206d8U, 0x7db56b7dU, 0x69fa4c02U, 0x1c107c3cU, 0xa206fe8fU, 0xa7080ef5U, 0x76effc82U, 0xf9b10f57U, 0x50656b77U, 0x94b16afdU, 0x70996e91U, 0xaef6e0adU, 0x15e91b07U, 0x1ac9b24dU, 0x98b233adU, 0x86ee0555U, 0x18e58e56U, 0x638ef18bU, 0xac5c74cbU, 0x35bbb6e5U, 0xdae2783dU, 0xd1c0ce7dU, 0xec4fc70eU, 0x5186d411U, 0xdf36368fU, 0x061aa360U, 0x11f30179U }; #else # error #endif mpw* mpspprod[SMALL_PRIMES_PRODUCT_MAX] = { spp_01, spp_02, spp_03, spp_04, spp_05, spp_06, spp_07, spp_08, spp_09, spp_10, spp_11, spp_12, spp_13, spp_14, spp_15, spp_16, spp_17, spp_18, spp_19, spp_20, spp_21, spp_22, spp_23, spp_24, spp_25, spp_26, spp_27, spp_28, spp_29, spp_30, spp_31, spp_32 }; int mpptrials(size_t bits) { if (bits >= 1854) return 2; if (bits >= 1223) return 3; if (bits >= 927) return 4; if (bits >= 747) return 5; if (bits >= 627) return 6; if (bits >= 543) return 7; if (bits >= 480) return 8; if (bits >= 431) return 9; if (bits >= 393) return 10; if (bits >= 361) return 11; if (bits >= 335) return 12; if (bits >= 314) return 13; if (bits >= 295) return 14; if (bits >= 279) return 15; if (bits >= 265) return 16; if (bits >= 253) return 17; if (bits >= 242) return 18; if (bits >= 232) return 19; if (bits >= 223) return 20; if (bits >= 216) return 21; if (bits >= 209) return 22; if (bits >= 202) return 23; if (bits >= 196) return 24; if (bits >= 191) return 25; if (bits >= 186) return 26; if (bits >= 182) return 27; if (bits >= 178) return 28; if (bits >= 174) return 29; if (bits >= 170) return 30; if (bits >= 167) return 31; if (bits >= 164) return 32; if (bits >= 161) return 33; if (bits >= 160) return 34; return 35; } /* * needs workspace of (size*2) words */ static void mpprndbits(mpbarrett* p, size_t bits, size_t lsbset, const mpnumber* min, const mpnumber* max, randomGeneratorContext* rc, mpw* wksp) { register size_t size = p->size; register size_t msbclr = MP_WORDS_TO_BITS(size) - bits; /* assume that mpbits(max) == bits */ /* calculate k=max-min; generate q such that 0 <= q <= k; then set p = q + min */ /* for the second step, set the appropriate number of bits */ if (max) { mpsetx(size, wksp, max->size, max->data); } else { mpfill(size, wksp, MP_ALLMASK); wksp[0] &= (MP_ALLMASK >> msbclr); } if (min) { mpsetx(size, wksp+size, min->size, min->data); } else { mpzero(size, wksp+size); wksp[size] |= (MP_MSBMASK >> msbclr); } mpsub(size, wksp, wksp+size); rc->rng->next(rc->param, (byte*) p->modl, MP_WORDS_TO_BYTES(size)); p->modl[0] &= (MP_ALLMASK >> msbclr); while (mpgt(size, p->modl, wksp)) mpsub(size, p->modl, wksp); mpadd(size, p->modl, wksp+size); if (lsbset) p->modl[size-1] |= (MP_ALLMASK >> (MP_WBITS - lsbset)); } /* * mppsppdiv_w * needs workspace of (3*size) words */ int mppsppdiv_w(const mpbarrett* p, mpw* wksp) { /* small prime product trial division test */ register size_t size = p->size; if (size > SMALL_PRIMES_PRODUCT_MAX) { mpsetx(size, wksp+size, SMALL_PRIMES_PRODUCT_MAX, mpspprod[SMALL_PRIMES_PRODUCT_MAX-1]); mpgcd_w(size, p->modl, wksp+size, wksp, wksp+2*size); } else { mpgcd_w(size, p->modl, mpspprod[size-1], wksp, wksp+2*size); } return mpisone(size, wksp); } /* * needs workspace of (5*size+2) */ int mppmilrabtwo_w(const mpbarrett* p, size_t s, const mpw* rdata, const mpw* ndata, mpw* wksp) { register size_t size = p->size; register size_t j = 0; mpbtwopowmod_w(p, size, rdata, wksp, wksp+size); while (1) { if (mpisone(size, wksp)) return (j == 0); if (mpeq(size, wksp, ndata)) return 1; if (++j < s) mpbsqrmod_w(p, size, wksp, wksp, wksp+size); else return 0; } } /* * needs workspace of (5*size+2) words */ int mppmilraba_w(const mpbarrett* p, const mpw* adata, size_t s, const mpw* rdata, const mpw* ndata, mpw* wksp) { register size_t size = p->size; register size_t j = 0; mpbpowmod_w(p, size, adata, size, rdata, wksp, wksp+size); while (1) { if (mpisone(size, wksp)) return (j == 0); if (mpeq(size, wksp, ndata)) return 1; if (++j < s) mpbsqrmod_w(p, size, wksp, wksp, wksp+size); else return 0; } } /* * needs workspace of (8*size+2) words */ int mppmilrab_w(const mpbarrett* p, randomGeneratorContext* rc, int t, mpw* wksp) { /* * Miller-Rabin probabilistic primality test, with modification * * For more information, see: * "Handbook of Applied Cryptography" * Chapter 4.24 * * Modification to the standard algorithm: * The first value of a is not obtained randomly, but set to two */ /* this routine uses (size*3) storage, and calls mpbpowmod, which needs (size*4+2) */ /* (size) for a, (size) for r, (size) for n-1 */ register size_t size = p->size; register mpw* ndata = wksp; register mpw* rdata = ndata+size; register mpw* adata = rdata+size; size_t s; mpcopy(size, ndata, p->modl); mpsubw(size, ndata, 1); mpcopy(size, rdata, ndata); s = mprshiftlsz(size, rdata); /* we've split p-1 into (2^s)*r */ /* should do an assert that s != 0 */ /* do at least one test, with a = 2 */ if (t == 0) t++; if (!mppmilrabtwo_w(p, s, rdata, ndata, wksp+3*size)) return 0; while (t-- > 0) { /* generate a random 'a' into b->data */ mpbrnd_w(p, rc, adata, wksp); if (!mppmilraba_w(p, adata, s, rdata, ndata, wksp+3*size)) return 0; } return 1; } /* * needs workspace of (8*size+2) words */ int mpprnd_w(mpbarrett* p, randomGeneratorContext* rc, size_t bits, int t, const mpnumber* f, mpw* wksp) { return mpprndr_w(p, rc, bits, t, (const mpnumber*) 0, (const mpnumber*) 0, f, wksp); } /* * implements IEEE P1363 A.15.6 * * f, min, max are optional */ int mpprndr_w(mpbarrett* p, randomGeneratorContext* rc, size_t bits, int t, const mpnumber* min, const mpnumber* max, const mpnumber* f, mpw* wksp) { /* * Generate a prime into p with the requested number of bits * * Conditions: size(f) <= size(p) * * Optional input min: if min is not null, then search p so that min <= p * Optional input max: if max is not null, then search p so that p <= max * Optional input f: if f is not null, then search p so that GCD(p-1,f) = 1 */ size_t size = MP_BITS_TO_WORDS(bits + MP_WBITS - 1); /* if min has more bits than what was requested for p, bail out */ if (min && (mpbits(min->size, min->data) > bits)) return -1; /* if max has a different number of bits than what was requested for p, bail out */ if (max && (mpbits(max->size, max->data) != bits)) return -1; /* if min is not less than max, bail out */ if (min && max && mpgex(min->size, min->data, max->size, max->data)) return -1; mpbinit(p, size); if (p->modl) { while (1) { /* * Generate a random appropriate candidate prime, and test * it with small prime divisor test BEFORE computing mu */ mpprndbits(p, bits, 1, min, max, rc, wksp); /* do a small prime product trial division test on p */ if (!mppsppdiv_w(p, wksp)) continue; /* if we have an f, do the congruence test */ if (f != (mpnumber*) 0) { mpcopy(size, wksp, p->modl); mpsubw(size, wksp, 1); mpsetx(size, wksp+size, f->size, f->data); mpgcd_w(size, wksp, wksp+size, wksp+2*size, wksp+3*size); if (!mpisone(size, wksp+2*size)) continue; } /* candidate has passed so far, now we do the probabilistic test */ mpbmu_w(p, wksp); if (mppmilrab_w(p, rc, t, wksp)) return 0; } } return -1; } /* * needs workspace of (8*size+2) words */ void mpprndconone_w(mpbarrett* p, randomGeneratorContext* rc, size_t bits, int t, const mpbarrett* q, const mpnumber* f, mpnumber* r, int cofactor, mpw* wksp) { /* * Generate a prime p with n bits such that p mod q = 1, and p = qr+1 where r = 2s * * Conditions: q > 2 and size(q) < size(p) and size(f) <= size(p) * * Conditions: r must be chosen so that r is even, otherwise p will be even! * * if cofactor == 0, then s will be chosen randomly * if cofactor == 1, then make sure that q does not divide r, i.e.: * q cannot be equal to r, since r is even, and q > 2; hence if q <= r make sure that GCD(q,r) == 1 * if cofactor == 2, then make sure that s is prime * * Optional input f: if f is not null, then search p so that GCD(p-1,f) = 1 */ mpbinit(p, MP_BITS_TO_WORDS(bits + MP_WBITS - 1)); if (p->modl != (mpw*) 0) { size_t sbits = bits - mpbits(q->size, q->modl) - 1; mpbarrett s; mpbzero(&s); mpbinit(&s, MP_BITS_TO_WORDS(sbits + MP_WBITS - 1)); while (1) { mpprndbits(&s, sbits, 0, (mpnumber*) 0, (mpnumber*) 0, rc, wksp); if (cofactor == 1) { mpsetlsb(s.size, s.modl); /* if (q <= s) check if GCD(q,s) != 1 */ if (mplex(q->size, q->modl, s.size, s.modl)) { /* we can find adequate storage for computing the gcd in s->wksp */ mpsetx(s.size, wksp, q->size, q->modl); mpgcd_w(s.size, s.modl, wksp, wksp+s.size, wksp+2*s.size); if (!mpisone(s.size, wksp+s.size)) continue; } } else if (cofactor == 2) { mpsetlsb(s.size, s.modl); } if (cofactor == 2) { /* do a small prime product trial division test on r */ if (!mppsppdiv_w(&s, wksp)) continue; } /* multiply q*s */ mpmul(wksp, s.size, s.modl, q->size, q->modl); /* s.size + q.size may be greater than p.size by 1, but the product will fit exactly into p */ mpsetx(p->size, p->modl, s.size+q->size, wksp); /* multiply by two and add 1 */ mpmultwo(p->size, p->modl); mpaddw(p->size, p->modl, 1); /* test if the product actually contains enough bits */ if (mpbits(p->size, p->modl) < bits) continue; /* do a small prime product trial division test on p */ if (!mppsppdiv_w(p, wksp)) continue; /* if we have an f, do the congruence test */ if (f != (mpnumber*) 0) { mpcopy(p->size, wksp, p->modl); mpsubw(p->size, wksp, 1); mpsetx(p->size, wksp, f->size, f->data); mpgcd_w(p->size, wksp, wksp+p->size, wksp+2*p->size, wksp+3*p->size); if (!mpisone(p->size, wksp+2*p->size)) continue; } /* if cofactor is two, test if s is prime */ if (cofactor == 2) { mpbmu_w(&s, wksp); if (!mppmilrab_w(&s, rc, mpptrials(sbits), wksp)) continue; } /* candidate has passed so far, now we do the probabilistic test on p */ mpbmu_w(p, wksp); if (!mppmilrab_w(p, rc, t, wksp)) continue; mpnset(r, s.size, s.modl); mpmultwo(r->size, r->data); mpbfree(&s); return; } } } void mpprndsafe_w(mpbarrett* p, randomGeneratorContext* rc, size_t bits, int t, mpw* wksp) { /* * Initialize with a probable safe prime of 'size' words, with probability factor t * * A safe prime p has the property that p = 2q+1, where q is also prime * Use for ElGamal type schemes, where a generator of order (p-1) is required */ size_t size = MP_BITS_TO_WORDS(bits + MP_WBITS - 1); mpbinit(p, size); if (p->modl != (mpw*) 0) { mpbarrett q; mpbzero(&q); mpbinit(&q, size); while (1) { /* * Generate a random appropriate candidate prime, and test * it with small prime divisor test BEFORE computing mu */ mpprndbits(p, bits, 2, (mpnumber*) 0, (mpnumber*) 0, rc, wksp); mpcopy(size, q.modl, p->modl); mpdivtwo(size, q.modl); /* do a small prime product trial division on q */ if (!mppsppdiv_w(&q, wksp)) continue; /* do a small prime product trial division on p */ if (!mppsppdiv_w(p, wksp)) continue; /* candidate prime has passed small prime division test for p and q */ mpbmu_w(&q, wksp); if (!mppmilrab_w(&q, rc, t, wksp)) continue; mpbmu_w(p, wksp); if (!mppmilrab_w(p, rc, t, wksp)) continue; mpbfree(&q); return; } } } beecrypt-4.2.1/mtprng.c0000644000175000001440000001211211216147021011713 00000000000000/* * Copyright (c) 1998, 1999, 2000, 2001 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\mtprng.c * \brief Mersenne Twister pseudo-random number generator. * * Developed by Makoto Matsumoto and Takuji Nishimura. For more information, * see: http://www.math.keio.ac.jp/~matumoto/emt.html * * Adapted from optimized code by Shawn J. Cokus * * \warning This generator has a very long period, passes statistical test and * is very fast, but is not recommended for use in cryptography. * * \author Bob Deblier * \ingroup PRNG_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/mtprng.h" #define hiBit(a) ((a) & 0x80000000U) #define loBit(a) ((a) & 0x1U) #define loBits(a) ((a) & 0x7FFFFFFFU) #define mixBits(a, b) (hiBit(a) | loBits(b)) const randomGenerator mtprng = { "Mersenne Twister", sizeof(mtprngParam), (randomGeneratorSetup) mtprngSetup, (randomGeneratorSeed) mtprngSeed, (randomGeneratorNext) mtprngNext, (randomGeneratorCleanup) mtprngCleanup }; static void mtprngReload(mtprngParam* mp) { register uint32_t *p0 = mp->state; register uint32_t *p2 = p0+2, *pM = p0+M, s0, s1; register int j; for (s0=mp->state[0], s1=mp->state[1], j=N-M+1; --j; s0=s1, s1=*(p2++)) *(p0++) = *(pM++) ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0); for (pM=mp->state, j=M; --j; s0=s1, s1=*(p2++)) *(p0++) = *(pM++) ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0); s1 = mp->state[0], *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0); mp->left = N; mp->nextw = mp->state; } int mtprngSetup(mtprngParam* mp) { if (mp) { #ifdef _REENTRANT # if WIN32 if (!(mp->lock = CreateMutex(NULL, FALSE, NULL))) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_init(&mp->lock, USYNC_THREAD, (void *) 0)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_init(&mp->lock, (pthread_mutexattr_t *) 0)) return -1; # endif # endif #endif mp->left = 0; return entropyGatherNext((byte*) mp->state, (N+1) * sizeof(uint32_t)); } return -1; } int mtprngSeed(mtprngParam* mp, const byte* data, size_t size) { if (mp) { size_t needed = (N+1) * sizeof(uint32_t); byte* dest = (byte*) mp->state; #ifdef _REENTRANT # if WIN32 if (WaitForSingleObject(mp->lock, INFINITE) != WAIT_OBJECT_0) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_lock(&mp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_lock(&mp->lock)) return -1; # endif # endif #endif while (size < needed) { memcpy(dest, data, size); dest += size; needed -= size; } memcpy(dest, data, needed); #ifdef _REENTRANT # if WIN32 if (!ReleaseMutex(mp->lock)) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_unlock(&mp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_unlock(&mp->lock)) return -1; # endif # endif #endif return 0; } return -1; } int mtprngNext(mtprngParam* mp, byte* data, size_t size) { if (mp) { uint32_t tmp; #ifdef _REENTRANT # if WIN32 if (WaitForSingleObject(mp->lock, INFINITE) != WAIT_OBJECT_0) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_lock(&mp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_lock(&mp->lock)) return -1; # endif # endif #endif while (size > 0) { if (mp->left == 0) mtprngReload(mp); tmp = *(mp->nextw++); tmp ^= (tmp >> 11); tmp ^= (tmp << 7) & 0x9D2C5680U; tmp ^= (tmp << 15) & 0xEFC60000U; tmp ^= (tmp >> 18); mp->left--; if (size >= 4) { memcpy(data, &tmp, 4); size -= 4; } else { memcpy(data, &tmp, size); size = 0; } } #ifdef _REENTRANT # if WIN32 if (!ReleaseMutex(mp->lock)) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_unlock(&mp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_unlock(&mp->lock)) return -1; # endif # endif #endif return 0; } return -1; } int mtprngCleanup(mtprngParam* mp) { if (mp) { #ifdef _REENTRANT # if WIN32 if (!CloseHandle(mp->lock)) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_destroy(&mp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_destroy(&mp->lock)) return -1; # endif # endif #endif return 0; } return -1; } beecrypt-4.2.1/hmac.c0000644000175000001440000000544111216147021011323 00000000000000/* * Copyright (c) 1999, 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmac.c * \brief HMAC algorithm. * * \see RFC2104 HMAC: Keyed-Hashing for Message Authentication. * H. Krawczyk, M. Bellare, R. Canetti. * * \author Bob Deblier * \ingroup HMAC_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmac.h" /*!\addtogroup HMAC_m * \{ */ #define HMAC_IPAD 0x36 #define HMAC_OPAD 0x5c int hmacSetup(byte* kxi, byte* kxo, const hashFunction* hash, hashFunctionParam* param, const byte* key, size_t keybits) { register unsigned int i; size_t keybytes = keybits >> 3; /* if the key is too large, hash it first */ if (keybytes > hash->blocksize) { /* if the hash digest is too large, this doesn't help; this is really a sanity check */ if (hash->digestsize > hash->blocksize) return -1; if (hash->reset(param)) return -1; if (hash->update(param, key, keybytes)) return -1; if (hash->digest(param, kxi)) return -1; memcpy(kxo, kxi, keybytes = hash->digestsize); } else if (keybytes > 0) { memcpy(kxi, key, keybytes); memcpy(kxo, key, keybytes); } else return -1; for (i = 0; i < keybytes; i++) { kxi[i] ^= HMAC_IPAD; kxo[i] ^= HMAC_OPAD; } for (i = keybytes; i < hash->blocksize; i++) { kxi[i] = HMAC_IPAD; kxo[i] = HMAC_OPAD; } return hmacReset(kxi, hash, param); } int hmacReset(const byte* kxi, const hashFunction* hash, hashFunctionParam* param) { if (hash->reset(param)) return -1; if (hash->update(param, kxi, hash->blocksize)) return -1; return 0; } int hmacUpdate(const hashFunction* hash, hashFunctionParam* param, const byte* data, size_t size) { return hash->update(param, data, size); } int hmacDigest(const byte* kxo, const hashFunction* hash, hashFunctionParam* param, byte* data) { if (hash->digest(param, data)) return -1; if (hash->update(param, kxo, hash->blocksize)) return -1; if (hash->update(param, data, hash->digestsize)) return -1; if (hash->digest(param, data)) return -1; return 0; } /*!\} */ beecrypt-4.2.1/NEWS0000644000175000001440000002516011226307114010750 000000000000004.2.1: - Cleaned up old autotools cruft (thanks to Anìbal Monsalve Salazar). - Different automake approach to compiling separate components. - Fixed C++ header installation problem. 4.2.0: - Added OpenMP support (initially for RSA CRT). - Added SHA-224 and HMAC-SHA-224. - Added RIPEMD-128/160/256/320 (thanks to Jeff Johnson). - Added MD4 (thanks to Jeff Johnson). - Applied RedHat/Debian/Gentoo patches for 4.1.2. - Improved gcc compilation flags for sparc. - Started work on MinGW compatibility. - Major overhaul of the C++ API; be warned that the code is still tricky in certain places. - Added synchronization methods to Object class; there's also a macro allowing the use of synchronized (...) { }. - Added Runnable interface and Thread class; the latter provides basic support conform to the Java API. - Added collections. 4.1.2: - Fixed Cygwin DLL missing symbols problem. - Fixed GNU-stack assembler section on some platforms (Debian-ARM). - Fixed problem cause by include of . - Fixed SHA-384 and SHA-512 code Visual C++ compatibility. - Improved detection of IBM ICU library version; has to be >= 2.8. 4.1.1: - Fixed shared library version info. 4.1.0: - Added SHA-384 and SHA-512 algorithms. - Added HMAC-SHA-384 and HMAC-SHA-512 algorithms. - Added generic SSE2 optimization for the above algorithms. - Added more digest algorithms for PKCS#1 EMSA. - Optimized swap32 and swap64 routines on Linux. - Fixed missing definition in mpopt.h for s390x. - Fixed nostackexec configuration bug. - Fixed problem in Date::toString. - Fixed deadlock problem which occured in certain cases where security or crypto SPI constructor called getInstance for another security or crypto SPI. - Fixed a bug in the generic CBC encryption code; when called with nblocks == 1, the feedback was set incorrectly. - Fixed a bug in mpbsubmod; sometimes it takes multiple additions of the modulus to get a positive number. - Fixed PowerPC 64-bit configuration problem on Linux. 4.0.0: - Added a C++ API interface, modeled after Java's security & crypto API. - Added the new GNU noexecstack feature. - Added more x86_64 and s390x assembler routines. - Modified i2osp, so that it only requires as many octets as there are significant bytes in the multi-precision integers. - Fixed a bug in the creation of rsa keypairs; code was not correctly migrated to new calling sequence. The code now implements the method described in IEEE P.1363. - Fixed another bug in mpextgcd_w which sometimes returned incorrect results. - Fixed a bug in mprshiftlsz, which didn't work correctly when size = 1. - Fixed a configuration problem on Tru64 Unix. 3.1.0: - Added wiping of private key components of keypairs before freeing. - Fixed bug in mpextgcd_w which sometimes returned incorrect result. - Fixed error in PowerPC 64-bit assembler symbol definitions. 3.0.0: - Cleaned up installed header files. - Modified the API so that all keys can be passed as arrays of bytes. - Modified the API so that all key sizes are given in bits. - Modified the multi-precision integer library to work better on 64-bit machines. - Modified the assembly source generation mechanism, employing the m4 macro processor. - Added multi-precision integer vectorized assembler routines for Itanium. - Added multi-precision integer assembler routines for PowerPC 64-bit. - Added multi-precision integer assembler routines for Alpha. - Added multi-precision integer assembler routines for Opteron. - Added multi-precision integer assembler routines for IBM zSeries 64-bit. - Added multi-precision integer assembler routines for M68K. - Added Jeff Johnson's python bindings. - Added new unit tests. - Added new benchmarking programs. 2.3.0pre: - Modified the header files so that the library now uses self-contained autoconf-generated configuration files; a program employing BeeCrypt can now use the symbols already tested and defined instead of having to regenerate them (thus also eliminating the risk of inconsistencies). - Added the AES algorithm, with assembler routines for i586 and powerpc. - Added the DSA signature algorithm. - Added PowerPC assembler routines for blowfish. - Added Pentium4 SSE2 assembler multiplication routines. - Fixed the RSA CRT algorithm. - Fixed the gas/i386 mp32even and mp32odd routines. - Fixed a bug in modular inverse computation; thanks to Jeff Johnson of RedHat for pointing this out. - Fixed a bug in testing the result of a gcd operation in the mp32prndconone routine. - Fixed an ugly bug in base64 decoding. - Fixed compatibility with the latest automake & autoconf versions. - Replaces CPU optimization mechanism in configure script. 2.1.0: - Added support for automake, autoheader and libtool, which should make compiling the library even easier. - Changed DHAES API to conform to IEEE P.1363 submission and to allow for uneven key splitting. - Improved PKCS#5 padding routines. - Added a hash reset to the hashFunctionContextInit function. This was pointed out by Marko Kreen. - Fixed problem with configuring on i486-pc-linux-gnu. This was pointed out Steve O'Neill. - Fixed problem in the C version of mp32sub where carry would sometimes be missed. This was pointed out by Jon Sturgeon. - Revised entropy gathering system to do timeouts & asynchronous I/O where possible, to avoid hangs in case there's no noise on the audio device (i.e. digital silence), or when no data is available on devices such as /dev/random. - Changed mp32opt i386 assembler routines for slight performance improvement. - Changed mp32opt powerpc assembler routines for slight performance improvement. - Changed mp32opt sparcv9 assembler routines for slight performance improvement. - Added sparcv8 assembler routines for multi-precision integer multiplication. - Added arm assembler routines for multi-precision integer multiplication. - Added prototype 64-bit ia64 assembler routines for multi-precision integer operations. - Started writing the long-awaited documentation. 2.0.0: - Changed mp32barrett struct and operations to be multithread-safe; this required a change in API. - Changed hashFunction struct to incorporate internal block size parameter. - Changed HMAC algorithm and file names to match names in RFC 2104. - Changed SHA-1 C code for slightly faster results. - Changed detection of entropy devices. - Changed most void-returning functions to return int for error conditions. - Changed beecrypt-java class names in javaglue. - Added RSA keypair generation. - Added RSA private & public key operations. - Added SHA-256 hash function. - Added HMAC-MD5 and HMAC-SHA-256 keyed hash functions. - Added PKCS#5 padding. - Added DHAES encryption scheme. - Added Microsoft Visual C support, added Makefile.mak for this purpose. - Added Solaris/Sparc Forte C 64 bit support. - Added configure --disable-optimized option (disables assembler & processor-specific optimizations). - Fixed bug in SHA-1 assembler code for Pentium, where local variables were used below the current stack pointer; this could cause a problem if the routine was interrupted. This was pointed out by Richard Clayton. - Fixed bug in (certain cases of) modular inverse computation. - Fixed buffer overrun in base64 encoding. This was pointed out by Jon Sturgeon. - Fixed various minor bugs. - Renamed text files to match automake conventions. 1.1.2: - Fixed bugs in discrete logarithm domain parameter generator. The code to make a generator of order q and (p-1) was wrong. This was pointed out by Susumu Yamamoto. - Added MD5 hash function. 1.1.1: - Changed autoconfig script for easier porting. - Changed sources for easier compilation on Microsoft Visual C++; no assembler-optimization on this platform yet. - Fixed bug in javaglue when passing null IV to blockcipher. - Shared library is now linked dynamically, with shared object name and version. - Tested on Alpha Linux. - Tested on Alpha FreeBSD. - Added support for Compaq Alpha Tru64 Unix. - Added initial support for QNX. 1.1.0: - Added glue for interfacing from BeeCrypt Java Cryptography Provider. - Changed blockcipher struct to support interfacing with Java. - Added better blockcipher IV handling. - Multi-pass block processing is now possible with blockEncrypt/blockDecrypt. - Updated config.sub and config.guess to latest version from sources.redhat.com - Changed opening of entropy devices to blocking read-only mode instead of non-blocking read-write. - Added win32 'wincrypt' entropy source. - Added win32 'console' entropy source. - Added FreeBSD support. - Added PowerPC assembler optimized multiprecision subtraction routines. - Added initial ia64 support. - Added initial Darwin support (everything compiles, but the shared library doesn't build yet). 1.0.2: - Fixed Windows 2000 entropy bug; instead of using the first waveIn device, entropy now uses WAVE_MAPPER. - Added sparcv9 mp32addsqrtrc GNU assembler routine. - Added more hashFunctionContext and keyedHashFunctionContext functions. 1.0.1: - Added a sliding window modular exponentiation, about 30% faster than left-to-right exponentiation. - Fixed bugs in fips180opt.gas.i586.s (Linux SHA-1 assembler code for Pentium/Pentium Pro) - the Windows/Metrowerks version was okay. 1.0.0: - Added Win32 support; compiled as DLL with MetroWerks CodeWarrior Pro 5, it runs fine on Windows 95, 98, NT 4.0 (if you have a soundcard with a microphone port). Note that there is a know issue on Windows 2000, see BUGS. - Global code overhaul to support Win32 - Added more assembler routines, including SHA-1 for Pentium Pro (60% faster) - Added cleanup function to randomGenerator - Added missing functions in endianness.c - Fixed bug in entropy.c where devices might stay open - Eliminated mutex.h include file; it was more clear to do everything conditionally than to expand the macros in this file to encompass the Win32 API calls. 0.9.5: - Added PowerPC assembler optimization for multiprecision integers, 80% faster on our PowerMac 7200/90 - Fixed /dev/random entropy provider - Changed name SHA1 to SHA-1 in fips180 for consistency 0.9.4a: - Added missing file 'blowfishopt.o' 0.9.4: - Changes to configure script, to distinguish between different processors of the x86 family - Changes to blowfish code, 586/686 assembler optimization added, 30% faster on Pentium/PentiumPro - Changes to blowfish code, eliminated static blowfishSetupEncrypt; incorporated into regular encrypt - Changes to Makefile to selectively use blowfish assember code, depending on cpu type - Added missing routines 'mp32bzero' and 'mp32bnpowmod' to mp32barrett.c - Fixed 'const register' to 'register const' in mp32.c - Minor fixes in included header files 0.9.3: - Initial public release beecrypt-4.2.1/gnu.h.in0000644000175000001440000000357411216515751011634 00000000000000/* * Copyright (c) 2003, 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _BEECRYPT_GNU_H #define _BEECRYPT_GNU_H #if __MINGW32__ # define _REENTRANT # if !defined(_WIN32_WINNT) # define _WIN32_WINNT 0x0400 # endif # include #endif @INCLUDE_INTTYPES_H@ @INCLUDE_STDINT_H@ @INCLUDE_SYNCH_H@ @INCLUDE_THREAD_H@ @INCLUDE_PTHREAD_H@ @INCLUDE_SEMAPHORE_H@ @INCLUDE_SCHED_H@ @INCLUDE_STDIO_H@ @INCLUDE_STDLIB_H@ @INCLUDE_MALLOC_H@ @INCLUDE_STRING_H@ @INCLUDE_UNISTD_H@ @INCLUDE_DLFCN_H@ @TYPEDEF_BC_COND_T@ @TYPEDEF_BC_MUTEX_T@ @TYPEDEF_BC_THREAD_T@ @TYPEDEF_BC_THREADID_T@ @TYPEDEF_SIZE_T@ @TYPEDEF_INT8_T@ @TYPEDEF_INT16_T@ @TYPEDEF_INT32_T@ @TYPEDEF_INT64_T@ @TYPEDEF_UINT8_T@ @TYPEDEF_UINT16_T@ @TYPEDEF_UINT32_T@ @TYPEDEF_UINT64_T@ #if defined(__GNUC__) # if !defined(__GNUC_PREREQ__) # define __GNUC_PREREQ__(maj, min) (__GNUC__ > (maj) || __GNUC__ == (maj) && __GNUC_MINOR__ >= (min)) # endif #else # define __GNUC__ 0 # define __GNUC_PREREQ__(maj, min) 0 #endif /* WARNING: overriding this value is dangerous; some assembler routines * make assumptions about the size set by the configure script */ #if !defined(MP_WBITS) # define MP_WBITS @MP_WBITS@ #endif #endif beecrypt-4.2.1/sha2k32.c0000644000175000001440000000371411216102377011576 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha2k32.c * \brief SHA-256 and SHA-224 hash function constants, as specified by NIST FIPS 180-2 and IETF RFC 3874. * \author Bob Deblier * \ingroup HASH_sha256_m HASH_sha_224_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha2k32.h" const uint32_t SHA2_32BIT_K[64] = { 0x428a2f98U, 0x71374491U, 0xb5c0fbcfU, 0xe9b5dba5U, 0x3956c25bU, 0x59f111f1U, 0x923f82a4U, 0xab1c5ed5U, 0xd807aa98U, 0x12835b01U, 0x243185beU, 0x550c7dc3U, 0x72be5d74U, 0x80deb1feU, 0x9bdc06a7U, 0xc19bf174U, 0xe49b69c1U, 0xefbe4786U, 0x0fc19dc6U, 0x240ca1ccU, 0x2de92c6fU, 0x4a7484aaU, 0x5cb0a9dcU, 0x76f988daU, 0x983e5152U, 0xa831c66dU, 0xb00327c8U, 0xbf597fc7U, 0xc6e00bf3U, 0xd5a79147U, 0x06ca6351U, 0x14292967U, 0x27b70a85U, 0x2e1b2138U, 0x4d2c6dfcU, 0x53380d13U, 0x650a7354U, 0x766a0abbU, 0x81c2c92eU, 0x92722c85U, 0xa2bfe8a1U, 0xa81a664bU, 0xc24b8b70U, 0xc76c51a3U, 0xd192e819U, 0xd6990624U, 0xf40e3585U, 0x106aa070U, 0x19a4c116U, 0x1e376c08U, 0x2748774cU, 0x34b0bcb5U, 0x391c0cb3U, 0x4ed8aa4aU, 0x5b9cca4fU, 0x682e6ff3U, 0x748f82eeU, 0x78a5636fU, 0x84c87814U, 0x8cc70208U, 0x90befffaU, 0xa4506cebU, 0xbef9a3f7U, 0xc67178f2U }; beecrypt-4.2.1/dlsvdp-dh.c0000644000175000001440000000333011216147021012273 00000000000000/* * Copyright (c) 1999, 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dlsvdp-dh.c * \brief Diffie-Hellman algorithm. * * The IEEE P.1363 designation is: * Discrete Logarithm Secret Value Derivation Primitive, Diffie-Hellman style. * * \author Bob Deblier * \ingroup DL_m DL_dh_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/dlsvdp-dh.h" /*!\addtogroup DL_dh_m * \{ */ /*!\fn dlsvdp_pDHSecret(const dhparam* dp, const mpnumber* x, const mpnumber* y, mpnumber* s) * \brief Computes the shared secret. * * Equation: * * \li \f$s=y^{x}\ \textrm{mod}\ p\f$ * * \param dp The domain parameters. * \param x The private value. * \param y The public value (of the peer). * \param s The computed secret value. * * \retval 0 on success. * \retval -1 on failure. */ int dlsvdp_pDHSecret(const dhparam* dp, const mpnumber* x, const mpnumber* y, mpnumber* s) { mpbnpowmod(&dp->p, y, x, s); return 0; } /*!\} */ beecrypt-4.2.1/timestamp.c0000644000175000001440000000300011216147021012403 00000000000000/* * Copyright (c) 1999, 2000, 2002, 2003 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file timestamp.c * \brief Java compatible 64-bit timestamp. * \author Bob Deblier */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/timestamp.h" #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # elif HAVE_TIME_H # include # endif #endif jlong timestamp() { jlong tmp; #if HAVE_SYS_TIME_H # if HAVE_GETTIMEOFDAY struct timeval now; gettimeofday(&now, 0); tmp = ((jlong) now.tv_sec) * 1000 + (now.tv_usec / 1000); # else # error # endif #elif HAVE_TIME_H tmp = ((jlong) time(0)) * 1000; #else # error implement other time function #endif return tmp; } beecrypt-4.2.1/hmacsha512.c0000644000175000001440000000355711216147021012255 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha512.c * \brief HMAC-SHA-512 message digest algorithm. * \author Bob Deblier * \ingroup HMAC_m HMAC_sha512_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha512.h" /*!\addtogroup HMAC_sha512_m * \{ */ const keyedHashFunction hmacsha512 = { "HMAC-SHA-512", sizeof(hmacsha512Param), 128, 64, 64, 512, 32, (keyedHashFunctionSetup) hmacsha512Setup, (keyedHashFunctionReset) hmacsha512Reset, (keyedHashFunctionUpdate) hmacsha512Update, (keyedHashFunctionDigest) hmacsha512Digest }; int hmacsha512Setup (hmacsha512Param* sp, const byte* key, size_t keybits) { return hmacSetup(sp->kxi, sp->kxo, &sha512, &sp->sparam, key, keybits); } int hmacsha512Reset (hmacsha512Param* sp) { return hmacReset(sp->kxi, &sha512, &sp->sparam); } int hmacsha512Update(hmacsha512Param* sp, const byte* data, size_t size) { return hmacUpdate(&sha512, &sp->sparam, data, size); } int hmacsha512Digest(hmacsha512Param* sp, byte* data) { return hmacDigest(sp->kxo, &sha512, &sp->sparam, data); } /*!\} */ beecrypt-4.2.1/dsa.c0000644000175000001440000001055011216147021011157 00000000000000/* * Copyright (c) 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dsa.c * \brief Digital Signature Algorithm. * \ingroup DL_m DL_dsa_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/dsa.h" #include "beecrypt/dldp.h" int dsasign(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnumber* r, mpnumber* s) { register size_t psize = p->size; register size_t qsize = q->size; register mpw* ptemp; register mpw* qtemp; register mpw* pwksp; register mpw* qwksp; register int rc = -1; ptemp = (mpw*) malloc((5*psize+2)*sizeof(mpw)); if (ptemp == (mpw*) 0) return rc; qtemp = (mpw*) malloc((9*qsize+6)*sizeof(mpw)); if (qtemp == (mpw*) 0) { free(ptemp); return rc; } pwksp = ptemp+psize; qwksp = qtemp+3*qsize; /* allocate r */ mpnfree(r); mpnsize(r, qsize); /* get a random k, invertible modulo q; store k @ qtemp, inv(k) @ qtemp+qsize */ mpbrndinv_w(q, rgc, qtemp, qtemp+qsize, qwksp); /* g^k mod p */ mpbpowmod_w(p, g->size, g->data, qsize, qtemp, ptemp, pwksp); /* (g^k mod p) mod q - simple modulo */ mpmod(qtemp+2*qsize, psize, ptemp, qsize, q->modl, pwksp); mpcopy(qsize, r->data, qtemp+psize+qsize); /* allocate s */ mpnfree(s); mpnsize(s, qsize); /* x*r mod q */ mpbmulmod_w(q, x->size, x->data, r->size, r->data, qtemp, qwksp); /* add h(m) mod q */ mpbaddmod_w(q, qsize, qtemp, hm->size, hm->data, qtemp+2*qsize, qwksp); /* multiply inv(k) mod q */ mpbmulmod_w(q, qsize, qtemp+qsize, qsize, qtemp+2*qsize, s->data, qwksp); rc = 0; free(qtemp); free(ptemp); return rc; } int dsavrfy(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, const mpnumber* hm, const mpnumber* y, const mpnumber* r, const mpnumber* s) { register size_t psize = p->size; register size_t qsize = q->size; register mpw* ptemp; register mpw* qtemp; register mpw* pwksp; register mpw* qwksp; register int rc = 0; /* h(m) shouldn't contain more bits than q */ if (mpbits(hm->size, hm->data) > mpbits(q->size, q->modl)) return rc; /* check 0 < r < q */ if (mpz(r->size, r->data)) return rc; if (mpgex(r->size, r->data, qsize, q->modl)) return rc; /* check 0 < s < q */ if (mpz(s->size, s->data)) return rc; if (mpgex(s->size, s->data, qsize, q->modl)) return rc; ptemp = (mpw*) malloc((6*psize+2)*sizeof(mpw)); if (ptemp == (mpw*) 0) return rc; qtemp = (mpw*) malloc((8*qsize+6)*sizeof(mpw)); if (qtemp == (mpw*) 0) { free(ptemp); return rc; } pwksp = ptemp+2*psize; qwksp = qtemp+2*qsize; mpsetx(qsize, qtemp+qsize, s->size, s->data); /* compute w = inv(s) mod q */ if (mpextgcd_w(qsize, q->modl, qtemp+qsize, qtemp, qwksp)) { /* compute u1 = h(m)*w mod q */ mpbmulmod_w(q, hm->size, hm->data, qsize, qtemp, qtemp+qsize, qwksp); /* compute u2 = r*w mod q */ mpbmulmod_w(q, r->size, r->data, qsize, qtemp, qtemp, qwksp); /* compute g^u1 mod p */ mpbpowmod_w(p, g->size, g->data, qsize, qtemp+qsize, ptemp, pwksp); /* compute y^u2 mod p */ mpbpowmod_w(p, y->size, y->data, qsize, qtemp, ptemp+psize, pwksp); /* multiply mod p */ mpbmulmod_w(p, psize, ptemp, psize, ptemp+psize, ptemp, pwksp); /* modulo q */ mpmod(ptemp+psize, psize, ptemp, qsize, q->modl, pwksp); rc = mpeqx(r->size, r->data, psize, ptemp+psize); } free(qtemp); free(ptemp); return rc; } int dsaparamMake(dsaparam* dp, randomGeneratorContext* rgc, size_t psize) { /* psize must be >= 512 and <= 1024 */ if ((psize < 512) || (psize > 1024)) return -1; /* psize must be a multiple of 64 */ if ((psize & 0x3f) != 0) return -1; return dldp_pgoqMake(dp, rgc, psize, 160, 1); } beecrypt-4.2.1/hmacsha224.c0000644000175000001440000000353611216102377012257 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file hmacsha224.c * \brief HMAC-SHA-224 message digest algorithm. * \author Bob Deblier * \ingroup HMAC_m HMAC_sha224_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha224.h" /*!\addtogroup HMAC_sha224_m * \{ */ const keyedHashFunction hmacsha224 = { "HMAC-SHA-224", sizeof(hmacsha224Param), 64, 28, 64, 512, 32, (keyedHashFunctionSetup) hmacsha224Setup, (keyedHashFunctionReset) hmacsha224Reset, (keyedHashFunctionUpdate) hmacsha224Update, (keyedHashFunctionDigest) hmacsha224Digest }; int hmacsha224Setup (hmacsha224Param* sp, const byte* key, size_t keybits) { return hmacSetup(sp->kxi, sp->kxo, &sha224, &sp->sparam, key, keybits); } int hmacsha224Reset (hmacsha224Param* sp) { return hmacReset(sp->kxi, &sha224, &sp->sparam); } int hmacsha224Update(hmacsha224Param* sp, const byte* data, size_t size) { return hmacUpdate(&sha224, &sp->sparam, data, size); } int hmacsha224Digest(hmacsha224Param* sp, byte* data) { return hmacDigest(sp->kxo, &sha224, &sp->sparam, data); } /*!\} */ beecrypt-4.2.1/ripemd256.c0000644000175000001440000003200711216403214012125 00000000000000/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file ripemd256.c * \brief RIPEMD-256 hash function. * \author Jeff Johnson * \author Bob Deblier * \ingroup HASH_m HASH_ripemd256_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/ripemd256.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_ripemd256_m * \{ */ /*@unchecked@*/ /*@observer@*/ static uint32_t ripemd256hinit[8] = { 0x67452301U, 0xefcdab89U, 0x98badcfeU, 0x10325476U, 0x76543210U, 0xfedcba98U, 0x89abcdefU, 0x01234567U }; /*@-sizeoftype@*/ /*@unchecked@*/ /*@observer@*/ const hashFunction ripemd256 = { .name = "RIPEMD-256", .paramsize = sizeof(ripemd256Param), .blocksize = 64, .digestsize = 32, .reset = (hashFunctionReset) ripemd256Reset, .update = (hashFunctionUpdate) ripemd256Update, .digest = (hashFunctionDigest) ripemd256Digest }; /*@=sizeoftype@*/ int ripemd256Reset(register ripemd256Param* mp) { /*@-sizeoftype@*/ memcpy(mp->h, ripemd256hinit, 8 * sizeof(uint32_t)); memset(mp->data, 0, 16 * sizeof(uint32_t)); /*@=sizeoftype@*/ #if (MP_WBITS == 64) mpzero(1, mp->length); #elif (MP_WBITS == 32) mpzero(2, mp->length); #else # error #endif mp->offset = 0; return 0; } #define LSR1(a, b, c, d, x, s) \ a = ROTL32((b^c^d) + a + x, s); #define LSR2(a, b, c, d, x, s) \ a = ROTL32(((b&c)|(~b&d)) + a + x + 0x5a827999U, s); #define LSR3(a, b, c, d, x, s) \ a = ROTL32(((b|~c)^d) + a + x + 0x6ed9eba1U, s); #define LSR4(a, b, c, d, x, s) \ a = ROTL32(((b&d)|(c&~d)) + a + x + 0x8f1bbcdcU, s); #define RSR4(a, b, c, d, x, s) \ a = ROTL32((b^c^d) + a + x, s); #define RSR3(a, b, c, d, x, s) \ a = ROTL32(((b&c)|(~b&d)) + a + x + 0x6d703ef3U, s); #define RSR2(a, b, c, d, x, s) \ a = ROTL32(((b|~c)^d) + a + x + 0x5c4dd124U, s); #define RSR1(a, b, c, d, x, s) \ a = ROTL32(((b&d)|(c&~d)) + a + x + 0x50a28be6U, s); #ifndef ASM_RIPEMD256PROCESS void ripemd256Process(ripemd256Param* mp) { register uint32_t la, lb, lc, ld; register uint32_t ra, rb, rc, rd; register uint32_t temp; register uint32_t* x; #ifdef WORDS_BIGENDIAN register byte t; #endif x = mp->data; #ifdef WORDS_BIGENDIAN t = 16; while (t--) { temp = swapu32(*x); *(x++) = temp; } x = mp->data; #endif la = mp->h[0]; lb = mp->h[1]; lc = mp->h[2]; ld = mp->h[3]; ra = mp->h[4]; rb = mp->h[5]; rc = mp->h[6]; rd = mp->h[7]; /* In theory OpenMP would allows us to do the 'left' and 'right' sections in parallel, * but in practice the overhead make the code much slower */ /* left round 1 */ LSR1(la, lb, lc, ld, x[ 0], 11); LSR1(ld, la, lb, lc, x[ 1], 14); LSR1(lc, ld, la, lb, x[ 2], 15); LSR1(lb, lc, ld, la, x[ 3], 12); LSR1(la, lb, lc, ld, x[ 4], 5); LSR1(ld, la, lb, lc, x[ 5], 8); LSR1(lc, ld, la, lb, x[ 6], 7); LSR1(lb, lc, ld, la, x[ 7], 9); LSR1(la, lb, lc, ld, x[ 8], 11); LSR1(ld, la, lb, lc, x[ 9], 13); LSR1(lc, ld, la, lb, x[10], 14); LSR1(lb, lc, ld, la, x[11], 15); LSR1(la, lb, lc, ld, x[12], 6); LSR1(ld, la, lb, lc, x[13], 7); LSR1(lc, ld, la, lb, x[14], 9); LSR1(lb, lc, ld, la, x[15], 8); /* right round 1 */ RSR1(ra, rb, rc, rd, x[ 5], 8); RSR1(rd, ra, rb, rc, x[14], 9); RSR1(rc, rd, ra, rb, x[ 7], 9); RSR1(rb, rc, rd, ra, x[ 0], 11); RSR1(ra, rb, rc, rd, x[ 9], 13); RSR1(rd, ra, rb, rc, x[ 2], 15); RSR1(rc, rd, ra, rb, x[11], 15); RSR1(rb, rc, rd, ra, x[ 4], 5); RSR1(ra, rb, rc, rd, x[13], 7); RSR1(rd, ra, rb, rc, x[ 6], 7); RSR1(rc, rd, ra, rb, x[15], 8); RSR1(rb, rc, rd, ra, x[ 8], 11); RSR1(ra, rb, rc, rd, x[ 1], 14); RSR1(rd, ra, rb, rc, x[10], 14); RSR1(rc, rd, ra, rb, x[ 3], 12); RSR1(rb, rc, rd, ra, x[12], 6); temp = la; la = ra; ra = temp; /* left round 2 */ LSR2(la, lb, lc, ld, x[ 7], 7); LSR2(ld, la, lb, lc, x[ 4], 6); LSR2(lc, ld, la, lb, x[13], 8); LSR2(lb, lc, ld, la, x[ 1], 13); LSR2(la, lb, lc, ld, x[10], 11); LSR2(ld, la, lb, lc, x[ 6], 9); LSR2(lc, ld, la, lb, x[15], 7); LSR2(lb, lc, ld, la, x[ 3], 15); LSR2(la, lb, lc, ld, x[12], 7); LSR2(ld, la, lb, lc, x[ 0], 12); LSR2(lc, ld, la, lb, x[ 9], 15); LSR2(lb, lc, ld, la, x[ 5], 9); LSR2(la, lb, lc, ld, x[ 2], 11); LSR2(ld, la, lb, lc, x[14], 7); LSR2(lc, ld, la, lb, x[11], 13); LSR2(lb, lc, ld, la, x[ 8], 12); /* right round 2 */ RSR2(ra, rb, rc, rd, x[ 6], 9); RSR2(rd, ra, rb, rc, x[11], 13); RSR2(rc, rd, ra, rb, x[ 3], 15); RSR2(rb, rc, rd, ra, x[ 7], 7); RSR2(ra, rb, rc, rd, x[ 0], 12); RSR2(rd, ra, rb, rc, x[13], 8); RSR2(rc, rd, ra, rb, x[ 5], 9); RSR2(rb, rc, rd, ra, x[10], 11); RSR2(ra, rb, rc, rd, x[14], 7); RSR2(rd, ra, rb, rc, x[15], 7); RSR2(rc, rd, ra, rb, x[ 8], 12); RSR2(rb, rc, rd, ra, x[12], 7); RSR2(ra, rb, rc, rd, x[ 4], 6); RSR2(rd, ra, rb, rc, x[ 9], 15); RSR2(rc, rd, ra, rb, x[ 1], 13); RSR2(rb, rc, rd, ra, x[ 2], 11); temp = lb; lb = rb; rb = temp; /* left round 3 */ LSR3(la, lb, lc, ld, x[ 3], 11); LSR3(ld, la, lb, lc, x[10], 13); LSR3(lc, ld, la, lb, x[14], 6); LSR3(lb, lc, ld, la, x[ 4], 7); LSR3(la, lb, lc, ld, x[ 9], 14); LSR3(ld, la, lb, lc, x[15], 9); LSR3(lc, ld, la, lb, x[ 8], 13); LSR3(lb, lc, ld, la, x[ 1], 15); LSR3(la, lb, lc, ld, x[ 2], 14); LSR3(ld, la, lb, lc, x[ 7], 8); LSR3(lc, ld, la, lb, x[ 0], 13); LSR3(lb, lc, ld, la, x[ 6], 6); LSR3(la, lb, lc, ld, x[13], 5); LSR3(ld, la, lb, lc, x[11], 12); LSR3(lc, ld, la, lb, x[ 5], 7); LSR3(lb, lc, ld, la, x[12], 5); /* right round 3 */ RSR3(ra, rb, rc, rd, x[15], 9); RSR3(rd, ra, rb, rc, x[ 5], 7); RSR3(rc, rd, ra, rb, x[ 1], 15); RSR3(rb, rc, rd, ra, x[ 3], 11); RSR3(ra, rb, rc, rd, x[ 7], 8); RSR3(rd, ra, rb, rc, x[14], 6); RSR3(rc, rd, ra, rb, x[ 6], 6); RSR3(rb, rc, rd, ra, x[ 9], 14); RSR3(ra, rb, rc, rd, x[11], 12); RSR3(rd, ra, rb, rc, x[ 8], 13); RSR3(rc, rd, ra, rb, x[12], 5); RSR3(rb, rc, rd, ra, x[ 2], 14); RSR3(ra, rb, rc, rd, x[10], 13); RSR3(rd, ra, rb, rc, x[ 0], 13); RSR3(rc, rd, ra, rb, x[ 4], 7); RSR3(rb, rc, rd, ra, x[13], 5); temp = lc; lc = rc; rc = temp; /* left round 4 */ LSR4(la, lb, lc, ld, x[ 1], 11); LSR4(ld, la, lb, lc, x[ 9], 12); LSR4(lc, ld, la, lb, x[11], 14); LSR4(lb, lc, ld, la, x[10], 15); LSR4(la, lb, lc, ld, x[ 0], 14); LSR4(ld, la, lb, lc, x[ 8], 15); LSR4(lc, ld, la, lb, x[12], 9); LSR4(lb, lc, ld, la, x[ 4], 8); LSR4(la, lb, lc, ld, x[13], 9); LSR4(ld, la, lb, lc, x[ 3], 14); LSR4(lc, ld, la, lb, x[ 7], 5); LSR4(lb, lc, ld, la, x[15], 6); LSR4(la, lb, lc, ld, x[14], 8); LSR4(ld, la, lb, lc, x[ 5], 6); LSR4(lc, ld, la, lb, x[ 6], 5); LSR4(lb, lc, ld, la, x[ 2], 12); /* right round 4 */ RSR4(ra, rb, rc, rd, x[ 8], 15); RSR4(rd, ra, rb, rc, x[ 6], 5); RSR4(rc, rd, ra, rb, x[ 4], 8); RSR4(rb, rc, rd, ra, x[ 1], 11); RSR4(ra, rb, rc, rd, x[ 3], 14); RSR4(rd, ra, rb, rc, x[11], 14); RSR4(rc, rd, ra, rb, x[15], 6); RSR4(rb, rc, rd, ra, x[ 0], 14); RSR4(ra, rb, rc, rd, x[ 5], 6); RSR4(rd, ra, rb, rc, x[12], 9); RSR4(rc, rd, ra, rb, x[ 2], 12); RSR4(rb, rc, rd, ra, x[13], 9); RSR4(ra, rb, rc, rd, x[ 9], 12); RSR4(rd, ra, rb, rc, x[ 7], 5); RSR4(rc, rd, ra, rb, x[10], 15); RSR4(rb, rc, rd, ra, x[14], 8); temp = ld; ld = rd; rd = temp; /* combine results */ mp->h[0] += la; mp->h[1] += lb; mp->h[2] += lc; mp->h[3] += ld; mp->h[4] += ra; mp->h[5] += rb; mp->h[6] += rc; mp->h[7] += rd; } #endif int ripemd256Update(ripemd256Param* mp, const byte* data, size_t size) { register uint32_t proclength; #if (MP_WBITS == 64) mpw add[1]; mpsetw(1, add, size); mplshift(1, add, 3); mpadd(1, mp->length, add); #elif (MP_WBITS == 32) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); (void) mpadd(2, mp->length, add); #else # error #endif while (size > 0) { proclength = ((mp->offset + size) > 64U) ? (64U - mp->offset) : size; /*@-mayaliasunique@*/ memcpy(((byte *) mp->data) + mp->offset, data, proclength); /*@=mayaliasunique@*/ size -= proclength; data += proclength; mp->offset += proclength; if (mp->offset == 64U) { ripemd256Process(mp); mp->offset = 0; } } return 0; } static void ripemd256Finish(ripemd256Param* mp) /*@modifies mp @*/ { register byte *ptr = ((byte *) mp->data) + mp->offset++; *(ptr++) = 0x80; if (mp->offset > 56) { while (mp->offset++ < 64) *(ptr++) = 0; ripemd256Process(mp); mp->offset = 0; } ptr = ((byte *) mp->data) + mp->offset; while (mp->offset++ < 56) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[0] = (byte)(mp->length[0] ); ptr[1] = (byte)(mp->length[0] >> 8); ptr[2] = (byte)(mp->length[0] >> 16); ptr[3] = (byte)(mp->length[0] >> 24); ptr[4] = (byte)(mp->length[0] >> 32); ptr[5] = (byte)(mp->length[0] >> 40); ptr[6] = (byte)(mp->length[0] >> 48); ptr[7] = (byte)(mp->length[0] >> 56); #elif (MP_WBITS == 32) ptr[0] = (byte)(mp->length[1] ); ptr[1] = (byte)(mp->length[1] >> 8); ptr[2] = (byte)(mp->length[1] >> 16); ptr[3] = (byte)(mp->length[1] >> 24); ptr[4] = (byte)(mp->length[0] ); ptr[5] = (byte)(mp->length[0] >> 8); ptr[6] = (byte)(mp->length[0] >> 16); ptr[7] = (byte)(mp->length[0] >> 24); #else # error #endif ripemd256Process(mp); mp->offset = 0; } /*@-protoparammatch@*/ int ripemd256Digest(ripemd256Param* mp, byte* data) { ripemd256Finish(mp); /* encode 8 integers little-endian style */ data[ 0] = (byte)(mp->h[0] ); data[ 1] = (byte)(mp->h[0] >> 8); data[ 2] = (byte)(mp->h[0] >> 16); data[ 3] = (byte)(mp->h[0] >> 24); data[ 4] = (byte)(mp->h[1] ); data[ 5] = (byte)(mp->h[1] >> 8); data[ 6] = (byte)(mp->h[1] >> 16); data[ 7] = (byte)(mp->h[1] >> 24); data[ 8] = (byte)(mp->h[2] ); data[ 9] = (byte)(mp->h[2] >> 8); data[10] = (byte)(mp->h[2] >> 16); data[11] = (byte)(mp->h[2] >> 24); data[12] = (byte)(mp->h[3] ); data[13] = (byte)(mp->h[3] >> 8); data[14] = (byte)(mp->h[3] >> 16); data[15] = (byte)(mp->h[3] >> 24); data[16] = (byte)(mp->h[4] ); data[17] = (byte)(mp->h[4] >> 8); data[18] = (byte)(mp->h[4] >> 16); data[19] = (byte)(mp->h[4] >> 24); data[20] = (byte)(mp->h[5] ); data[21] = (byte)(mp->h[5] >> 8); data[22] = (byte)(mp->h[5] >> 16); data[23] = (byte)(mp->h[5] >> 24); data[24] = (byte)(mp->h[6] ); data[25] = (byte)(mp->h[6] >> 8); data[26] = (byte)(mp->h[6] >> 16); data[27] = (byte)(mp->h[6] >> 24); data[28] = (byte)(mp->h[7] ); data[29] = (byte)(mp->h[7] >> 8); data[30] = (byte)(mp->h[7] >> 16); data[31] = (byte)(mp->h[7] >> 24); (void) ripemd256Reset(mp); return 0; } /*@=protoparammatch@*/ /*!\} */ beecrypt-4.2.1/fips186.c0000644000175000001440000001415511216147021011615 00000000000000/* * Copyright (c) 1998, 1999, 2000, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file fips186.c * \brief FIPS 186 pseudo-random number generator. * \author Bob Deblier * \ingroup PRNG_m PRNG_fips186_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/fips186.h" /*!\addtogroup PRNG_fips186_m * \{ */ static uint32_t fips186hinit[5] = { 0xefcdab89U, 0x98badcfeU, 0x10325476U, 0xc3d2e1f0U, 0x67452301U }; const randomGenerator fips186prng = { "FIPS 186", sizeof(fips186Param), (randomGeneratorSetup) fips186Setup, (randomGeneratorSeed) fips186Seed, (randomGeneratorNext) fips186Next, (randomGeneratorCleanup) fips186Cleanup }; static int fips186init(register sha1Param* p) { memcpy(p->h, fips186hinit, 5 * sizeof(uint32_t)); return 0; } int fips186Setup(fips186Param* fp) { if (fp) { #ifdef _REENTRANT # if WIN32 if (!(fp->lock = CreateMutex(NULL, FALSE, NULL))) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_init(&fp->lock, USYNC_THREAD, (void *) 0)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_init(&fp->lock, (pthread_mutexattr_t *) 0)) return -1; # endif # endif #endif fp->digestremain = 0; return entropyGatherNext((byte*) fp->state, MP_WORDS_TO_BYTES(FIPS186_STATE_SIZE)); } return -1; } int fips186Seed(fips186Param* fp, const byte* data, size_t size) { if (fp) { #ifdef _REENTRANT # if WIN32 if (WaitForSingleObject(fp->lock, INFINITE) != WAIT_OBJECT_0) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_lock(&fp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_lock(&fp->lock)) return -1; # endif # endif #endif if (data) { mpw seed[FIPS186_STATE_SIZE]; /* if there's too much data, cut off at what we can deal with */ if (size > MP_WORDS_TO_BYTES(FIPS186_STATE_SIZE)) size = MP_WORDS_TO_BYTES(FIPS186_STATE_SIZE); /* convert to multi-precision integer, and add to the state */ if (os2ip(seed, FIPS186_STATE_SIZE, data, size) == 0) mpadd(FIPS186_STATE_SIZE, fp->state, seed); } #ifdef _REENTRANT # if WIN32 if (!ReleaseMutex(fp->lock)) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_unlock(&fp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_unlock(&fp->lock)) return -1; # endif # endif #endif return 0; } return -1; } int fips186Next(fips186Param* fp, byte* data, size_t size) { if (fp) { mpw dig[FIPS186_STATE_SIZE]; #ifdef _REENTRANT # if WIN32 if (WaitForSingleObject(fp->lock, INFINITE) != WAIT_OBJECT_0) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_lock(&fp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_lock(&fp->lock)) return -1; # endif # endif #endif while (size > 0) { register size_t copy; if (fp->digestremain == 0) { fips186init(&fp->param); /* copy the 512 bits of state data into the sha1Param */ memcpy(fp->param.data, fp->state, MP_WORDS_TO_BYTES(FIPS186_STATE_SIZE)); /* process the data */ sha1Process(&fp->param); #if WORDS_BIGENDIAN memcpy(fp->digest, fp->param.h, 20); #else /* encode 5 integers big-endian style */ fp->digest[ 0] = (byte)(fp->param.h[0] >> 24); fp->digest[ 1] = (byte)(fp->param.h[0] >> 16); fp->digest[ 2] = (byte)(fp->param.h[0] >> 8); fp->digest[ 3] = (byte)(fp->param.h[0] >> 0); fp->digest[ 4] = (byte)(fp->param.h[1] >> 24); fp->digest[ 5] = (byte)(fp->param.h[1] >> 16); fp->digest[ 6] = (byte)(fp->param.h[1] >> 8); fp->digest[ 7] = (byte)(fp->param.h[1] >> 0); fp->digest[ 8] = (byte)(fp->param.h[2] >> 24); fp->digest[ 9] = (byte)(fp->param.h[2] >> 16); fp->digest[10] = (byte)(fp->param.h[2] >> 8); fp->digest[11] = (byte)(fp->param.h[2] >> 0); fp->digest[12] = (byte)(fp->param.h[3] >> 24); fp->digest[13] = (byte)(fp->param.h[3] >> 16); fp->digest[14] = (byte)(fp->param.h[3] >> 8); fp->digest[15] = (byte)(fp->param.h[3] >> 0); fp->digest[16] = (byte)(fp->param.h[4] >> 24); fp->digest[17] = (byte)(fp->param.h[4] >> 16); fp->digest[18] = (byte)(fp->param.h[4] >> 8); fp->digest[19] = (byte)(fp->param.h[4] >> 0); #endif if (os2ip(dig, FIPS186_STATE_SIZE, fp->digest, 20) == 0) { /* set state to state + digest + 1 mod 2^512 */ mpadd (FIPS186_STATE_SIZE, fp->state, dig); mpaddw(FIPS186_STATE_SIZE, fp->state, 1); } /* else shouldn't occur */ /* we now have 5 words of pseudo-random data */ fp->digestremain = 20; } copy = (size > fp->digestremain) ? fp->digestremain : size; memcpy(data, fp->digest+20-fp->digestremain, copy); fp->digestremain -= copy; size -= copy; data += copy; } #ifdef _REENTRANT # if WIN32 if (!ReleaseMutex(fp->lock)) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_unlock(&fp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_unlock(&fp->lock)) return -1; # endif # endif #endif return 0; } return -1; } int fips186Cleanup(fips186Param* fp) { if (fp) { #ifdef _REENTRANT # if WIN32 if (!CloseHandle(fp->lock)) return -1; # else # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_destroy(&fp->lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_destroy(&fp->lock)) return -1; # endif # endif #endif return 0; } return -1; } /*!\} */ beecrypt-4.2.1/mpnumber.c0000664000175000001440000001120510254472207012245 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mpnumber.c * \brief Multi-precision numbers. * \author Bob Deblier * \ingroup MP_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/mpnumber.h" void mpnzero(mpnumber* n) { n->size = 0; n->data = (mpw*) 0; } void mpnsize(mpnumber* n, size_t size) { if (size) { if (n->data) { if (n->size != size) { if (size < n->size) { register size_t offset = n->size - size; memmove(n->data, n->data + offset, offset * sizeof(mpw)); } n->data = (mpw*) realloc(n->data, size * sizeof(mpw)); } } else n->data = (mpw*) malloc(size * sizeof(mpw)); if (n->data == (mpw*) 0) n->size = 0; else n->size = size; } else if (n->data) { free(n->data); n->data = (mpw*) 0; n->size = 0; } } void mpninit(mpnumber* n, size_t size, const mpw* data) { n->size = size; n->data = (mpw*) malloc(size * sizeof(mpw)); if (n->data) mpcopy(size, n->data, data); } void mpnfree(mpnumber* n) { if (n->data) { free(n->data); n->data = (mpw*) 0; } n->size = 0; } void mpncopy(mpnumber* n, const mpnumber* copy) { mpnset(n, copy->size, copy->data); } void mpnwipe(mpnumber* n) { if (n->data != (mpw*) 0) mpzero(n->size, n->data); } void mpnset(mpnumber* n, size_t size, const mpw* data) { if (size) { if (n->data) { if (n->size != size) n->data = (mpw*) realloc(n->data, size * sizeof(mpw)); } else n->data = (mpw*) malloc(size * sizeof(mpw)); if (n->data) mpcopy(n->size = size, n->data, data); else n->size = 0; } else if (n->data) { free(n->data); n->data = (mpw*) 0; n->size = 0; } } void mpnsetw(mpnumber* n, mpw val) { if (n->data) { if (n->size != 1) n->data = (mpw*) realloc(n->data, sizeof(mpw)); } else n->data = (mpw*) malloc(sizeof(mpw)); if (n->data) { n->size = 1; n->data[0] = val; } else n->size = 0; } int mpnsetbin(mpnumber* n, const byte* osdata, size_t ossize) { int rc = -1; size_t size; /* skip zero bytes */ while ((*osdata == 0) && ossize) { osdata++; ossize--; } size = MP_BYTES_TO_WORDS(ossize + MP_WBYTES - 1); if (n->data) { if (n->size != size) n->data = (mpw*) realloc(n->data, size * sizeof(mpw)); } else n->data = (mpw*) malloc(size * sizeof(mpw)); if (n->data) { n->size = size; rc = os2ip(n->data, size, osdata, ossize); } else n->size = 0; return rc; } int mpnsethex(mpnumber* n, const char* hex) { int rc = -1; size_t len = strlen(hex); size_t size = MP_NIBBLES_TO_WORDS(len + MP_WNIBBLES - 1); if (n->data) { if (n->size != size) n->data = (mpw*) realloc(n->data, size * sizeof(mpw)); } else n->data = (mpw*) malloc(size * sizeof(mpw)); if (n->data) { n->size = size; rc = hs2ip(n->data, size, hex, len); } else n->size = 0; return rc; } int mpninv(mpnumber* inv, const mpnumber* k, const mpnumber* mod) { int rc = 0; size_t size = mod->size; mpw* wksp = (mpw*) malloc((7*size+6) * sizeof(mpw)); if (wksp) { mpnsize(inv, size); mpsetx(size, wksp, k->size, k->data); rc = mpextgcd_w(size, mod->data, wksp, inv->data, wksp+size); free(wksp); } return rc; } size_t mpntrbits(mpnumber* n, size_t bits) { size_t sigbits = mpbits(n->size, n->data); size_t offset = 0; if (sigbits < bits) { /* no need to truncate */ return sigbits; } else { size_t allbits = MP_BITS_TO_WORDS(n->size + MP_WBITS - 1); while ((allbits - bits) > MP_WBITS) { /* zero a word */ n->data[offset++] = 0; allbits -= MP_WBITS; } if ((allbits - bits)) { /* mask the next word */ n->data[offset] &= (MP_ALLMASK >> (MP_WBITS - bits)); /* resize the number */ mpnsize(n, n->size - offset); /* finally return the number of remaining bits */ return bits; } else { /* nothing remains */ mpnsetw(n, 0); return 0; } } } size_t mpnbits(const mpnumber* n) { return mpbits(n->size, n->data); } beecrypt-4.2.1/masm/0000777000175000001440000000000011226307272011273 500000000000000beecrypt-4.2.1/masm/Makefile.in0000644000175000001440000002774411226307162013270 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am's purpose is to add the Microsoft assembler files to the dist # # Copyright (c) 2001, 2002 Virtual Unlimited B.V. # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = masm DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = depcomp = am__depfiles_maybe = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu no-dependencies EXTRA_DIST = aesopt.i586.asm blowfishopt.i586.asm mpopt.x86.asm sha1opt.i586.asm all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu masm/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu masm/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/masm/aesopt.i586.asm0000664000175000001440000003220510063036172013676 00000000000000; ; aesopt.i586.asm ; ; Assembler optimized AES routines for Intel Pentium processors ; ; Compile target is Microsoft Macro Assembler ; ; Copyright (c) 2002 Bob Deblier ; ; This library is free software; you can redistribute it and/or ; modify it under the terms of the GNU Lesser General Public ; License as published by the Free Software Foundation; either ; version 2.1 of the License, or (at your option) any later version. ; ; This library is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; Lesser General Public License for more details. ; ; You should have received a copy of the GNU Lesser General Public ; License along with this library; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; .586 .model flat,C EXTRN _ae0:DWORD EXTRN _ae1:DWORD EXTRN _ae2:DWORD EXTRN _ae3:DWORD EXTRN _ae4:DWORD EXTRN _ad0:DWORD EXTRN _ad1:DWORD EXTRN _ad2:DWORD EXTRN _ad3:DWORD EXTRN _ad4:DWORD .code ; esp points to s and t (on stack; 32 bytes altogether) ; ebp points to rk ; edi points to dst ; esi points to src sxrk macro ; compute swap(src) xor rk mov eax,dword ptr [esi ] mov ebx,dword ptr [esi+ 4] mov ecx,dword ptr [esi+ 8] mov edx,dword ptr [esi+12] bswap eax bswap ebx bswap ecx bswap edx xor eax,dword ptr [ebp ] xor ebx,dword ptr [ebp+ 4] xor ecx,dword ptr [ebp+ 8] xor edx,dword ptr [ebp+12] mov dword ptr [esp ],eax mov dword ptr [esp+ 4],ebx mov dword ptr [esp+ 8],ecx mov dword ptr [esp+12],edx endm etfs macro offset ; compute t0 and t1 mov ecx,[ebp+offset ] mov edx,[ebp+offset+4] movzx eax,byte ptr [esp+ 3] movzx ebx,byte ptr [esp+ 7] xor ecx,dword ptr [eax*4+_ae0] xor edx,dword ptr [ebx*4+_ae0] movzx eax,byte ptr [esp+ 6] movzx ebx,byte ptr [esp+10] xor ecx,dword ptr [eax*4+_ae1] xor edx,dword ptr [ebx*4+_ae1] movzx eax,byte ptr [esp+ 9] movzx ebx,byte ptr [esp+13] xor ecx,dword ptr [eax*4+_ae2] xor edx,dword ptr [ebx*4+_ae2] movzx eax,byte ptr [esp+12] movzx ebx,byte ptr [esp ] xor ecx,dword ptr [eax*4+_ae3] xor edx,dword ptr [ebx*4+_ae3] mov dword ptr [esp+16],ecx mov dword ptr [esp+20],edx ; compute t2 and t3 mov ecx,dword ptr [ebp+offset+ 8] mov edx,dword ptr [ebp+offset+12] movzx eax,byte ptr [esp+11] movzx ebx,byte ptr [esp+15] xor ecx,dword ptr [eax*4+_ae0] xor edx,dword ptr [ebx*4+_ae0] movzx eax,byte ptr [esp+14] movzx ebx,byte ptr [esp+ 2] xor ecx,dword ptr [eax*4+_ae1] xor edx,dword ptr [ebx*4+_ae1] movzx eax,byte ptr [esp+ 1] movzx ebx,byte ptr [esp+ 5] xor ecx,dword ptr [eax*4+_ae2] xor edx,dword ptr [ebx*4+_ae2] movzx eax,byte ptr [esp+ 4] movzx ebx,byte ptr [esp+ 8] xor ecx,dword ptr [eax*4+_ae3] xor edx,dword ptr [ebx*4+_ae3] mov dword ptr [esp+24],ecx mov dword ptr [esp+28],edx endm esft macro offset ; compute s0 and s1 mov ecx,[ebp+offset ] mov edx,[ebp+offset+4] movzx eax,byte ptr [esp+19] movzx ebx,byte ptr [esp+23] xor ecx,dword ptr [eax*4+_ae0] xor edx,dword ptr [ebx*4+_ae0] movzx eax,byte ptr [esp+22] movzx ebx,byte ptr [esp+26] xor ecx,dword ptr [eax*4+_ae1] xor edx,dword ptr [ebx*4+_ae1] movzx eax,byte ptr [esp+25] movzx ebx,byte ptr [esp+29] xor ecx,dword ptr [eax*4+_ae2] xor edx,dword ptr [ebx*4+_ae2] movzx eax,byte ptr [esp+28] movzx ebx,byte ptr [esp+16] xor ecx,dword ptr [eax*4+_ae3] xor edx,dword ptr [ebx*4+_ae3] mov dword ptr [esp ],ecx mov dword ptr [esp+ 4],edx ; compute s2 and s3 mov ecx,dword ptr [ebp+offset+ 8] mov edx,dword ptr [ebp+offset+12] movzx eax,byte ptr [esp+27] movzx ebx,byte ptr [esp+31] xor ecx,dword ptr [eax*4+_ae0] xor edx,dword ptr [ebx*4+_ae0] movzx eax,byte ptr [esp+30] movzx ebx,byte ptr [esp+18] xor ecx,dword ptr [eax*4+_ae1] xor edx,dword ptr [ebx*4+_ae1] movzx eax,byte ptr [esp+17] movzx ebx,byte ptr [esp+21] xor ecx,dword ptr [eax*4+_ae2] xor edx,dword ptr [ebx*4+_ae2] movzx eax,byte ptr [esp+20] movzx ebx,byte ptr [esp+24] xor ecx,dword ptr [eax*4+_ae3] xor edx,dword ptr [ebx*4+_ae3] mov dword ptr [esp+ 8],ecx mov dword ptr [esp+12],edx endm elr macro mov ecx,dword ptr [ebp+ 0] mov edx,dword ptr [ebp+ 4] movzx eax,byte ptr [esp+19] movzx ebx,byte ptr [esp+23] mov eax,dword ptr [eax*4+_ae4] mov ebx,dword ptr [ebx*4+_ae4] and eax,0ff000000h and ebx,0ff000000h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+22] movzx ebx,byte ptr [esp+26] mov eax,dword ptr [eax*4+_ae4] mov ebx,dword ptr [ebx*4+_ae4] and eax,0ff0000h and ebx,0ff0000h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+25] movzx ebx,byte ptr [esp+29] mov eax,dword ptr [eax*4+_ae4] mov ebx,dword ptr [ebx*4+_ae4] and eax,0ff00h and ebx,0ff00h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+28] movzx ebx,byte ptr [esp+16] mov eax,dword ptr [eax*4+_ae4] mov ebx,dword ptr [ebx*4+_ae4] and eax,0ffh and ebx,0ffh xor ecx,eax xor edx,ebx mov dword ptr [esp+ 0],ecx mov dword ptr [esp+ 4],edx mov ecx,dword ptr [ebp+ 8] mov edx,dword ptr [ebp+12] movzx eax,byte ptr [esp+27] movzx ebx,byte ptr [esp+31] mov eax,dword ptr [eax*4+_ae4] mov ebx,dword ptr [ebx*4+_ae4] and eax,0ff000000h and ebx,0ff000000h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+30] movzx ebx,byte ptr [esp+18] mov eax,dword ptr [eax*4+_ae4] mov ebx,dword ptr [ebx*4+_ae4] and eax,0ff0000h and ebx,0ff0000h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+17] movzx ebx,byte ptr [esp+21] mov eax,dword ptr [eax*4+_ae4] mov ebx,dword ptr [ebx*4+_ae4] and eax,0ff00h and ebx,0ff00h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+20] movzx ebx,byte ptr [esp+24] mov eax,dword ptr [eax*4+_ae4] mov ebx,dword ptr [ebx*4+_ae4] and eax,0ffh and ebx,0ffh xor ecx,eax xor edx,ebx mov dword ptr [esp+ 8],ecx mov dword ptr [esp+12],edx endm eblock macro label ; load initial values for s0 thru s3 sxrk ; do 9 rounds etfs 16 esft 32 etfs 48 esft 64 etfs 80 esft 96 etfs 112 esft 128 etfs 144 ; test if we had to do 10 rounds, if yes jump to last round mov eax,dword ptr [ebp+256] cmp eax,10 je @label ; do two more rounds esft 160 etfs 176 ; test if we had to do 12 rounds, if yes jump to last round mov eax,dword ptr [ebp+256] cmp eax,12 je @label ; do two more rounds esft 192 etfs 208 ; prepare for last round mov eax,dword ptr [ebp+256] @label: ; add 16 times the number of rounds to ebp sal eax,4 add ebp,eax ; do last round elr endm eblockc macro label ; encrypt block in cbc mode sxrfxrk ; do 9 rounds etfs 16 esft 32 etfs 48 esft 64 etfs 80 esft 96 etfs 112 esft 128 etfs 144 ; test if we had to do 10 rounds, if yes jump to last round mov eax,dword ptr [ebp+256] cmp eax,10 je @label ; do two more rounds esft 160 etfs 176 ; test if we had to do 12 rounds, if yes jump to last round mov eax,dword ptr [ebp+256] cmp eax,12 je @label ; do two more rounds esft 192 etfs 208 ; prepare for last round mov eax,dword ptr [ebp+256] @label: ; add 16 times the number of rounds to ebp sal eax,4 add ebp,eax ; do last round elr endm dtfs macro offset ; compute t0 and t1 mov ecx,[ebp+offset ] mov edx,[ebp+offset+4] movzx eax,byte ptr [esp+ 3] movzx ebx,byte ptr [esp+ 7] xor ecx,dword ptr [eax*4+_ad0] xor edx,dword ptr [ebx*4+_ad0] movzx eax,byte ptr [esp+14] movzx ebx,byte ptr [esp+ 2] xor ecx,dword ptr [eax*4+_ad1] xor edx,dword ptr [ebx*4+_ad1] movzx eax,byte ptr [esp+ 9] movzx ebx,byte ptr [esp+13] xor ecx,dword ptr [eax*4+_ad2] xor edx,dword ptr [ebx*4+_ad2] movzx eax,byte ptr [esp+ 4] movzx ebx,byte ptr [esp+ 8] xor ecx,dword ptr [eax*4+_ad3] xor edx,dword ptr [ebx*4+_ad3] mov dword ptr [esp+16],ecx mov dword ptr [esp+20],edx ; compute t2 and t3 mov ecx,dword ptr [ebp+offset+ 8] mov edx,dword ptr [ebp+offset+12] movzx eax,byte ptr [esp+11] movzx ebx,byte ptr [esp+15] xor ecx,dword ptr [eax*4+_ad0] xor edx,dword ptr [ebx*4+_ad0] movzx eax,byte ptr [esp+ 6] movzx ebx,byte ptr [esp+10] xor ecx,dword ptr [eax*4+_ad1] xor edx,dword ptr [ebx*4+_ad1] movzx eax,byte ptr [esp+ 1] movzx ebx,byte ptr [esp+ 5] xor ecx,dword ptr [eax*4+_ad2] xor edx,dword ptr [ebx*4+_ad2] movzx eax,byte ptr [esp+12] movzx ebx,byte ptr [esp ] xor ecx,dword ptr [eax*4+_ad3] xor edx,dword ptr [ebx*4+_ad3] mov dword ptr [esp+24],ecx mov dword ptr [esp+28],edx endm dsft macro offset ; compute s0 and s1 mov ecx,[ebp+offset ] mov edx,[ebp+offset+4] movzx eax,byte ptr [esp+19] movzx ebx,byte ptr [esp+23] xor ecx,dword ptr [eax*4+_ad0] xor edx,dword ptr [ebx*4+_ad0] movzx eax,byte ptr [esp+30] movzx ebx,byte ptr [esp+18] xor ecx,dword ptr [eax*4+_ad1] xor edx,dword ptr [ebx*4+_ad1] movzx eax,byte ptr [esp+25] movzx ebx,byte ptr [esp+29] xor ecx,dword ptr [eax*4+_ad2] xor edx,dword ptr [ebx*4+_ad2] movzx eax,byte ptr [esp+20] movzx ebx,byte ptr [esp+24] xor ecx,dword ptr [eax*4+_ad3] xor edx,dword ptr [ebx*4+_ad3] mov dword ptr [esp ],ecx mov dword ptr [esp+ 4],edx ; compute s2 and s3 mov ecx,dword ptr [ebp+offset+ 8] mov edx,dword ptr [ebp+offset+12] movzx eax,byte ptr [esp+27] movzx ebx,byte ptr [esp+31] xor ecx,dword ptr [eax*4+_ad0] xor edx,dword ptr [ebx*4+_ad0] movzx eax,byte ptr [esp+22] movzx ebx,byte ptr [esp+26] xor ecx,dword ptr [eax*4+_ad1] xor edx,dword ptr [ebx*4+_ad1] movzx eax,byte ptr [esp+17] movzx ebx,byte ptr [esp+21] xor ecx,dword ptr [eax*4+_ad2] xor edx,dword ptr [ebx*4+_ad2] movzx eax,byte ptr [esp+28] movzx ebx,byte ptr [esp+16] xor ecx,dword ptr [eax*4+_ad3] xor edx,dword ptr [ebx*4+_ad3] mov dword ptr [esp+ 8],ecx mov dword ptr [esp+12],edx endm dlr macro mov ecx,dword ptr [ebp+ 0] mov edx,dword ptr [ebp+ 4] movzx eax,byte ptr [esp+19] movzx ebx,byte ptr [esp+23] mov eax,dword ptr [eax*4+_ad4] mov ebx,dword ptr [ebx*4+_ad4] and eax,0ff000000h and ebx,0ff000000h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+30] movzx ebx,byte ptr [esp+18] mov eax,dword ptr [eax*4+_ad4] mov ebx,dword ptr [ebx*4+_ad4] and eax,0ff0000h and ebx,0ff0000h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+25] movzx ebx,byte ptr [esp+29] mov eax,dword ptr [eax*4+_ad4] mov ebx,dword ptr [ebx*4+_ad4] and eax,0ff00h and ebx,0ff00h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+20] movzx ebx,byte ptr [esp+24] mov eax,dword ptr [eax*4+_ad4] mov ebx,dword ptr [ebx*4+_ad4] and eax,0ffh and ebx,0ffh xor ecx,eax xor edx,ebx mov dword ptr [esp+ 0],ecx mov dword ptr [esp+ 4],edx mov ecx,dword ptr [ebp+ 8] mov edx,dword ptr [ebp+12] movzx eax,byte ptr [esp+27] movzx ebx,byte ptr [esp+31] mov eax,dword ptr [eax*4+_ad4] mov ebx,dword ptr [ebx*4+_ad4] and eax,0ff000000h and ebx,0ff000000h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+22] movzx ebx,byte ptr [esp+26] mov eax,dword ptr [eax*4+_ad4] mov ebx,dword ptr [ebx*4+_ad4] and eax,0ff0000h and ebx,0ff0000h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+17] movzx ebx,byte ptr [esp+21] mov eax,dword ptr [eax*4+_ad4] mov ebx,dword ptr [ebx*4+_ad4] and eax,0ff00h and ebx,0ff00h xor ecx,eax xor edx,ebx movzx eax,byte ptr [esp+28] movzx ebx,byte ptr [esp+16] mov eax,dword ptr [eax*4+_ad4] mov ebx,dword ptr [ebx*4+_ad4] and eax,0ffh and ebx,0ffh xor ecx,eax xor edx,ebx mov dword ptr [esp+ 8],ecx mov dword ptr [esp+12],edx endm dblock macro label ; load initial values for s0 thru s3 sxrk ; do 9 rounds dtfs 16 dsft 32 dtfs 48 dsft 64 dtfs 80 dsft 96 dtfs 112 dsft 128 dtfs 144 ; test if we had to do 10 rounds, if yes jump to last round mov eax,dword ptr [ebp+256] cmp eax,10 je @label ; do two more rounds dsft 160 dtfs 176 ; test if we had to do 12 rounds, if yes jump to last round mov eax,dword ptr [ebp+256] cmp eax,12 je @label ; do two more rounds dsft 192 dtfs 208 ; prepare for last round mov eax,dword ptr [ebp+256] @label: ; add 16 times the number of rounds to ebp sal eax,4 add ebp,eax ; do last round dlr endm aesEncrypt proc c export push edi push esi push ebp push ebx ; set pointers mov ebp,dword ptr [esp+20] ; rk mov edi,dword ptr [esp+24] ; dst mov esi,dword ptr [esp+28] ; src ; add local storage for s and t variables, 32 bytes total sub esp,32 eblock e ; save stuff back mov eax,dword ptr [esp+ 0] mov ebx,dword ptr [esp+ 4] mov ecx,dword ptr [esp+ 8] mov edx,dword ptr [esp+12] bswap eax bswap ebx bswap ecx bswap edx mov dword ptr [edi ],eax mov dword ptr [edi+ 4],ebx mov dword ptr [edi+ 8],ecx mov dword ptr [edi+12],edx ; remove local storage add esp,32 xor eax,eax pop ebx pop ebp pop esi pop edi ret aesEncrypt endp aesDecrypt proc c export push edi push esi push ebp push ebx ; set pointers mov ebp,dword ptr [esp+20] ; rk mov edi,dword ptr [esp+24] ; dst mov esi,dword ptr [esp+28] ; src ; add local storage for s and t variables, 32 bytes total sub esp,32 dblock d ; save stuff back mov eax,dword ptr [esp+ 0] mov ebx,dword ptr [esp+ 4] mov ecx,dword ptr [esp+ 8] mov edx,dword ptr [esp+12] bswap eax bswap ebx bswap ecx bswap edx mov dword ptr [edi ],eax mov dword ptr [edi+ 4],ebx mov dword ptr [edi+ 8],ecx mov dword ptr [edi+12],edx ; remove local storage add esp,32 xor eax,eax pop ebx pop ebp pop esi pop edi ret aesDecrypt endp end beecrypt-4.2.1/masm/Makefile.am0000664000175000001440000000200410070245200013225 00000000000000# # Makefile.am's purpose is to add the Microsoft assembler files to the dist # # Copyright (c) 2001, 2002 Virtual Unlimited B.V. # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # AUTOMAKE_OPTIONS = gnu no-dependencies EXTRA_DIST = aesopt.i586.asm blowfishopt.i586.asm mpopt.x86.asm sha1opt.i586.asm beecrypt-4.2.1/masm/sha1opt.i586.asm0000664000175000001440000002647610063036172013777 00000000000000; ; sha1.i586.asm ; ; Assembler optimized SHA-1 routines for Intel Pentium processors ; ; Compile target is Microsoft Macro Assembler ; ; Copyright (c) 2000 Virtual Unlimited B.V. ; ; Author: Bob Deblier ; ; This library is free software; you can redistribute it and/or ; modify it under the terms of the GNU Lesser General Public ; License as published by the Free Software Foundation; either ; version 2.1 of the License, or (at your option) any later version. ; ; This library is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; Lesser General Public License for more details. ; ; You should have received a copy of the GNU Lesser General Public ; License along with this library; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; .586 .model flat,C K00 equ 5a827999h K20 equ 6ed9eba1h K40 equ 8f1bbcdch K60 equ 0ca62c1d6h PARAM_H equ 0 PARAM_DATA equ 20 .code subround1 macro b,c,d,e,w mov ecx,c mov ebx,b mov edx,d rol eax,5 xor ecx,edx add eax,e and ecx,ebx add eax,K00 ror ebx,2 add eax,w xor ecx,edx mov b,ebx add eax,ecx mov e,eax endm subround2 macro b,c,d,e,w mov ecx,c mov ebx,b rol eax,5 xor ecx,ebx add eax,e xor ecx,d add eax,K20 ror ebx,2 add eax,w mov b,ebx add eax,ecx mov e,eax endm subround3 macro b,c,d,e,w mov ecx,c rol eax,5 mov ebx,b mov edx,ecx add eax,e or ecx,ebx and edx,ebx and ecx,d add eax,K40 or ecx,edx add eax,w ror ebx,2 add eax,ecx mov b,ebx mov e,eax endm subround4 macro b,c,d,e,w mov ecx,c mov ebx,b rol eax,5 xor ecx,ebx add eax,e xor ecx,d add eax,K60 ror ebx,2 add eax,w mov b,ebx add eax,ecx mov e,eax endm align 8 sha1Process proc push edi push esi push ebx push ebp ; allocate local variables mov esi,dword ptr [esp+20] ; esi now points to param sub esp,20 ; esp now points below the local variables lea edi,dword ptr [esi+PARAM_DATA] mov ebp,esp ; ebp now points to the local variables mov ecx,4 @loads: mov edx,dword ptr [esi+ecx*4] mov dword ptr [ebp+ecx*4],edx dec ecx jns @loads mov ecx,15 xor eax,eax align 4 @swaps: mov edx,dword ptr [edi+ecx*4] bswap edx mov dword ptr [edi+ecx*4],edx dec ecx jns @swaps lea edi,dword ptr [esi+PARAM_DATA] mov ecx,16 align 4 @xors: mov eax,dword ptr [edi+52] mov ebx,dword ptr [edi+56] xor eax,dword ptr [edi+32] xor ebx,dword ptr [edi+36] xor eax,dword ptr [edi+ 8] xor ebx,dword ptr [edi+12] xor eax,dword ptr [edi ] xor ebx,dword ptr [edi+ 4] rol eax,1 rol ebx,1 mov dword ptr [edi+64],eax mov dword ptr [edi+68],ebx mov eax,dword ptr [edi+60] mov ebx,dword ptr [edi+64] xor eax,dword ptr [edi+40] xor ebx,dword ptr [edi+44] xor eax,dword ptr [edi+16] xor ebx,dword ptr [edi+20] xor eax,dword ptr [edi+ 8] xor ebx,dword ptr [edi+12] rol eax,1 rol ebx,1 mov dword ptr [edi+72],eax mov dword ptr [edi+76],ebx add edi,16 dec ecx jnz @xors mov edi,PARAM_DATA ; to optimize further, use esi only, and store the add constant into edi ; will make code smaller and faster @round01to20: mov eax,dword ptr [ebp] subround1 dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround1 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround1 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround1 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround1 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround1 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround1 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround1 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround1 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround1 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround1 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround1 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround1 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround1 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround1 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround1 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround1 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround1 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround1 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround1 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 @round21to40: subround2 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround2 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround2 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround2 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround2 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround2 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround2 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround2 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround2 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround2 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround2 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround2 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround2 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround2 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround2 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround2 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround2 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround2 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround2 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround2 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 @round41to60: subround3 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround3 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround3 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround3 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround3 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround3 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround3 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround3 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround3 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround3 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround3 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround3 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround3 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround3 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround3 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround3 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround3 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround3 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround3 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround3 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 @round61to80: subround4 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround4 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround4 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround4 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround4 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround4 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround4 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround4 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround4 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround4 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround4 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround4 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround4 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround4 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround4 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] add edi,20 subround4 dword ptr [ebp+4 ], ebx, dword ptr [ebp+12], dword ptr [ebp+16], dword ptr [esi+edi] subround4 dword ptr [ebp ], ebx, dword ptr [ebp+8 ], dword ptr [ebp+12], dword ptr [esi+edi+4 ] subround4 dword ptr [ebp+16], ebx, dword ptr [ebp+4 ], dword ptr [ebp+8 ], dword ptr [esi+edi+8 ] subround4 dword ptr [ebp+12], ebx, dword ptr [ebp ], dword ptr [ebp+4 ], dword ptr [esi+edi+12] subround4 dword ptr [ebp+8 ], ebx, dword ptr [ebp+16], dword ptr [ebp ], dword ptr [esi+edi+16] ; add edi,20 mov ecx,4 @adds: mov eax,dword ptr [ebp+ecx*4] add dword ptr [esi+ecx*4],eax dec ecx jns @adds add esp,20 pop ebp pop ebx pop esi pop edi ret sha1Process endp end beecrypt-4.2.1/masm/blowfishopt.i586.asm0000664000175000001440000000640710063036172014750 00000000000000; ; blowfishopt.i586.asm ; ; Assembler optimized blowfish routines for Intel Pentium processors ; ; Compile target is Microsoft Macro Assembler ; ; Copyright (c) 2000 Virtual Unlimited B.V. ; ; Author: Bob Deblier ; ; This library is free software; you can redistribute it and/or ; modify it under the terms of the GNU Lesser General Public ; License as published by the Free Software Foundation; either ; version 2.1 of the License, or (at your option) any later version. ; ; This library is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; Lesser General Public License for more details. ; ; You should have received a copy of the GNU Lesser General Public ; License along with this library; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; .586 .model flat,C .code etworounds macro offset xor ecx,dword ptr [esi+offset] rol ecx,16 mov al,ch mov bl,cl rol ecx,16 mov edi,dword ptr [esi+eax*4+72+0000h] add edi,dword ptr [esi+ebx*4+72+0400h] mov al,ch mov bl,cl xor edi,dword ptr [esi+eax*4+72+0800h] add edi,dword ptr [esi+ebx*4+72+0C00h] xor edx,edi xor edx,dword ptr [esi+offset+4] rol edx,16 mov al,dh mov bl,dl rol edx,16 mov edi,dword ptr [esi+eax*4+72+0000h] add edi,dword ptr [esi+ebx*4+72+0400h] mov al,dh mov bl,dl xor edi,dword ptr [esi+eax*4+72+0800h] add edi,dword ptr [esi+ebx*4+72+0C00h] xor ecx,edi endm dtworounds macro offset xor ecx,dword ptr [esi+offset+4] rol ecx,16 mov al,ch mov bl,cl rol ecx,16 mov edi,dword ptr [esi+eax*4+72+0000h] add edi,dword ptr [esi+ebx*4+72+0400h] mov al,ch mov bl,cl xor edi,dword ptr [esi+eax*4+72+0800h] add edi,dword ptr [esi+ebx*4+72+0C00h] xor edx,edi xor edx,dword ptr [esi+offset] rol edx,16 mov al,dh mov bl,dl rol edx,16 mov edi,dword ptr [esi+eax*4+72+0000h] add edi,dword ptr [esi+ebx*4+72+0400h] mov al,dh mov bl,dl xor edi,dword ptr [esi+eax*4+72+0800h] add edi,dword ptr [esi+ebx*4+72+0C00h] xor ecx,edi endm align 8 blowfishEncrypt proc c export push edi push esi push ebx mov esi,dword ptr [esp+16] mov edi,dword ptr [esp+24] xor eax,eax xor ebx,ebx mov ecx,dword ptr [edi] mov edx,dword ptr [edi+4] bswap ecx bswap edx etworounds 0 etworounds 8 etworounds 16 etworounds 24 etworounds 32 etworounds 40 etworounds 48 etworounds 56 mov edi,dword ptr [esp+20] xor ecx,dword ptr [esi+64] xor edx,dword ptr [esi+68] bswap ecx bswap edx mov dword ptr [edi+4],ecx mov dword ptr [edi],edx xor eax,eax pop ebx pop esi pop edi ret blowfishEncrypt endp align 8 blowfishDecrypt proc c export push edi push esi push ebx mov esi,dword ptr [esp+16] mov edi,dword ptr [esp+24] xor eax,eax xor ebx,ebx mov ecx,dword ptr [edi] mov edx,dword ptr [edi+4] bswap ecx bswap edx dtworounds 64 dtworounds 56 dtworounds 48 dtworounds 40 dtworounds 32 dtworounds 24 dtworounds 16 dtworounds 8 mov edi,dword ptr [esp+20] xor ecx,dword ptr [esi+4] xor edx,dword ptr [esi] bswap ecx bswap edx mov dword ptr [edi+4],ecx mov dword ptr [edi],edx xor eax,eax pop ebx pop esi pop edi ret blowfishDecrypt endp end beecrypt-4.2.1/masm/mpopt.x86.asm0000664000175000001440000001421210154270617013477 00000000000000; ; mpopt.x86.asm ; ; Assembler optimized multiprecision integer routines for Intel x86 processors ; ; Copyright (c) 2003 Bob Deblier ; ; Author: Bob Deblier ; ; This library is free software; you can redistribute it and/or ; modify it under the terms of the GNU Lesser General Public ; License as published by the Free Software Foundation; either ; version 2.1 of the License, or (at your option) any later version. ; ; This library is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; Lesser General Public License for more details. ; ; You should have received a copy of the GNU Lesser General Public ; License along with this library; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; .586 .model flat,C .xmm .code align 8 mpzero proc c export push edi mov ecx,dword ptr [esp+8] mov edi,dword ptr [esp+12] xor eax,eax rep stosd pop edi ret mpzero endp align 8 mpfill proc c export push edi mov ecx,dword ptr [esp+8] mov edi,dword ptr [esp+12] mov eax,dword ptr [esp+16] rep stosd pop edi ret mpfill endp align 8 mpodd proc c export mov ecx,dword ptr [esp+4] mov eax,dword ptr [esp+8] mov eax,dword ptr [eax+ecx*4-4] and eax,1 ret mpodd endp align 8 mpeven proc c export mov ecx,dword ptr [esp+4] mov eax,dword ptr [esp+8] mov eax,dword ptr [eax+ecx*4-4] not eax and eax,1 ret mpeven endp align 8 mpaddw proc c export push edi mov ecx,dword ptr [esp+8] mov edi,dword ptr [esp+12] mov eax,dword ptr [esp+16] xor edx,edx lea edi,dword ptr [edi+ecx*4-4] add dword ptr [edi],eax dec ecx jz @mpaddw_end lea edi, dword ptr[edi-4] align 4 @mpaddw_loop: adc dword ptr [edi],edx lea edi, dword ptr[edi-4] dec ecx jnz @mpaddw_loop @mpaddw_end: sbb eax,eax neg eax pop edi ret mpaddw endp align 8 mpsubw proc c export push edi mov ecx,dword ptr [esp+8] mov edi,dword ptr [esp+12] mov eax,dword ptr [esp+16] xor edx,edx lea edi,dword ptr [edi+ecx*4-4] sub dword ptr [edi],eax dec ecx jz @mpsubw_end lea edi,dword ptr [edi-4] align 4 @mpsubw_loop: sbb dword ptr [edi],edx lea edi,dword ptr [edi-4] dec ecx jnz @mpsubw_loop @mpsubw_end: sbb eax,eax neg eax pop edi ret mpsubw endp align 8 mpadd proc c export push edi push esi mov ecx,dword ptr [esp+12] mov edi,dword ptr [esp+16] mov esi,dword ptr [esp+20] xor edx,edx dec ecx align 4 @mpadd_loop: mov eax,dword ptr [esi+ecx*4] mov edx,dword ptr [edi+ecx*4] adc edx,eax mov dword ptr [edi+ecx*4],edx dec ecx jns @mpadd_loop sbb eax,eax neg eax pop esi pop edi ret mpadd endp align 8 mpsub proc c export push edi push esi mov ecx,dword ptr [esp+12] mov edi,dword ptr [esp+16] mov esi,dword ptr [esp+20] xor edx,edx dec ecx align 4 @mpsub_loop: mov eax,dword ptr [esi+ecx*4] mov edx,dword ptr [edi+ecx*4] sbb edx,eax mov dword ptr [edi+ecx*4],edx dec ecx jns @mpsub_loop sbb eax,eax neg eax pop esi pop edi ret mpsub endp align 8 mpdivtwo proc c export push edi mov ecx,dword ptr [esp+8] mov edi,dword ptr [esp+12] lea edi,dword ptr [edi+ecx*4] neg ecx clc @mpdivtwo_loop: rcr dword ptr [edi+ecx*4],1 inc ecx jnz @mpdivtwo_loop pop edi ret mpdivtwo endp align 8 mpmultwo proc c export push edi mov ecx,dword ptr [esp+8] mov edi,dword ptr [esp+12] dec ecx clc align 4 @mpmultwo_loop: mov eax,dword ptr [edi+ecx*4] adc eax,eax mov dword ptr [edi+ecx*4],eax dec ecx jns @mpmultwo_loop sbb eax,eax neg eax pop edi ret mpmultwo endp align 8 mpsetmul proc c export push edi push esi ifdef USE_SSE2 mov ecx,dword ptr [esp+12] mov edi,dword ptr [esp+16] mov esi,dword ptr [esp+20] movd mm1,dword ptr [esp+24] pxor mm0,mm0 dec ecx align 4 @mpsetmul_loop: movd mm2,dword ptr [esi+ecx*4] pmuludq mm2,mm1 paddq mm0,mm2 movd dword ptr [edi+ecx*4],mm0 dec ecx psrlq mm0,32 jns @mpsetmul_loop movd eax,mm0 emms else push ebx push ebp mov ecx,dword ptr [esp+20] mov edi,dword ptr [esp+24] mov esi,dword ptr [esp+28] mov ebp,dword ptr [esp+32] xor edx,edx dec ecx align 4 @mpsetmul_loop: mov ebx,edx mov eax,dword ptr [esi+ecx*4] mul ebp add eax,ebx adc edx,0 mov dword ptr [edi+ecx*4],eax dec ecx jns @mpsetmul_loop mov eax,edx pop ebp pop ebx endif pop esi pop edi ret mpsetmul endp align 8 mpaddmul proc c export push edi push esi ifdef USE_SSE2 mov ecx,dword ptr [esp+12] mov edi,dword ptr [esp+16] mov esi,dword ptr [esp+20] movd mm1,dword ptr [esp+24] pxor mm0,mm0 dec ecx @mpaddmul_loop: movd mm2,dword ptr [esi+ecx*4] pmuludq mm2,mm1 movd mm3,dword ptr [edi+ecx*4] paddq mm3,mm2 paddq mm0,mm3 movd dword ptr [edi+ecx*4],mm0 dec ecx psrlq mm0,32 jns @mpaddmul_loop movd eax,mm0 emms else push ebx push ebp mov ecx,dword ptr [esp+20] mov edi,dword ptr [esp+24] mov esi,dword ptr [esp+28] mov ebp,dword ptr [esp+32] xor edx,edx dec ecx align 4 @mpaddmul_loop: mov ebx,edx mov eax,dword ptr [esi+ecx*4] mul ebp add eax,ebx adc edx,0 add dword ptr [edi+ecx*4],eax adc edx,0 dec ecx jns @mpaddmul_loop mov eax,edx pop ebp pop ebx endif pop esi pop edi ret mpaddmul endp align 8 mpaddsqrtrc proc c export push edi push esi ifdef USE_SSE2 mov ecx,dword ptr [esp+12] mov edi,dword ptr [esp+16] mov esi,dword ptr [esp+20] pxor mm0,mm0 dec ecx align 4 @mpaddsqrtrc_loop: movd mm2,dword ptr [esi+ecx*4] pmuludq mm2,mm2 movd mm3,dword ptr [edi+ecx*8+4] paddq mm3,mm2 movd mm4,dword ptr [edi+ecx*8+0] paddq mm0,mm3 movd dword ptr [edi+ecx*8+4],mm0 psrlq mm0,32 paddq mm0,mm4 movd dword ptr [edi+ecx*8+0],mm0 psrlq mm0,32 dec ecx jns @mpaddsqrtrc_loop movd eax,mm0 emms else push ebx mov ecx,dword ptr [esp+16] mov edi,dword ptr [esp+20] mov esi,dword ptr [esp+24] xor ebx,ebx dec ecx align 4 @mpaddsqrtrc_loop: mov eax,dword ptr [esi+ecx*4] mul eax add eax,ebx adc edx,0 add dword ptr [edi+ecx*8+4],eax adc dword ptr [edi+ecx*8+0],edx sbb ebx,ebx neg ebx dec ecx jns @mpaddsqrtrc_loop mov eax,ebx pop ebx endif pop esi pop edi ret mpaddsqrtrc endp end beecrypt-4.2.1/memchunk.c0000644000175000001440000000374011216147021012222 00000000000000/* * Copyright (c) 2001 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file memchunk.c * \author Bob Deblier */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/memchunk.h" memchunk* memchunkAlloc(size_t size) { memchunk* tmp = (memchunk*) calloc(1, sizeof(memchunk)); if (tmp) { tmp->size = size; tmp->data = (byte*) malloc(size); if (tmp->data == (byte*) 0) { free(tmp); tmp = 0; } } return tmp; } void memchunkInit(memchunk* m) { m->data = (byte*) 0; m->size = 0; } void memchunkWipe(memchunk* m) { if (m) { if (m->data) { memset(m->data, 0, m->size); } } } void memchunkFree(memchunk* m) { if (m) { if (m->data) { free(m->data); m->size = 0; m->data = (byte*) 0; } free(m); } } memchunk* memchunkResize(memchunk* m, size_t size) { if (m) { if (m->data) m->data = (byte*) realloc(m->data, size); else m->data = (byte*) malloc(size); if (m->data == (byte*) 0) { free(m); m = (memchunk*) 0; } else m->size = size; } return m; } memchunk* memchunkClone(const memchunk* m) { if (m) { memchunk* tmp = memchunkAlloc(m->size); if (tmp) memcpy(tmp->data, m->data, m->size); return tmp; } return (memchunk*) 0; } beecrypt-4.2.1/cppglue.cxx0000664000175000001440000001103510210606764012437 00000000000000/* * Copyright (c) 2004 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/beecrypt.h" #include "beecrypt/mpnumber.h" #include "beecrypt/mpbarrett.h" #include "beecrypt/dldp.h" #include "beecrypt/dlkp.h" #include "beecrypt/dlpk.h" #include "beecrypt/rsakp.h" #include "beecrypt/rsapk.h" #include const mpnumber mpnumber::ZERO; const mpnumber mpnumber::ONE(1); mpnumber::mpnumber() { mpnzero(this); } mpnumber::mpnumber(unsigned int value) { mpnsize(this, 1); mpnsetw(this, value); } mpnumber::mpnumber(size_t size, const mpw* data) { mpninit(this, size, data); } mpnumber::mpnumber(const mpnumber& copy) { mpnzero(this); mpncopy(this, ©); } mpnumber::~mpnumber() { mpnfree(this); } const mpnumber& mpnumber::operator=(const mpnumber& copy) { mpncopy(this, ©); return *this; } void mpnumber::wipe() { mpnwipe(this); } size_t mpnumber::bitlength() const { return mpbits(size, data); } std::ostream& operator<<(std::ostream& stream, const mpnumber& n) { if (n.size) { stream << std::hex << std::setfill('0') << n.data[0]; for (size_t i = 1; i < n.size; i++) stream << std::setw(MP_WNIBBLES) << n.data[i]; } return stream; } mpbarrett::mpbarrett() { mpbzero(this); } mpbarrett::mpbarrett(const mpbarrett& copy) { mpbzero(this); mpbcopy(this, ©); } mpbarrett::~mpbarrett() { mpbfree(this); } const mpbarrett& mpbarrett::operator=(const mpbarrett& copy) { mpbcopy(this, ©); return *this; } void mpbarrett::wipe() { mpbwipe(this); } size_t mpbarrett::bitlength() const { return mpbits(size, modl); } std::ostream& operator<<(std::ostream& stream, const mpbarrett& b) { stream << std::hex << std::setfill('0'); for (size_t i = 0; i < b.size; i++) stream << std::setw(MP_WNIBBLES) << b.modl[i]; return stream; } dldp_p::dldp_p() { dldp_pInit(this); } dldp_p::dldp_p(const dldp_p& copy) { dldp_pInit(this); dldp_pCopy(this, ©); } dldp_p::~dldp_p() { dldp_pFree(this); } dlkp_p::dlkp_p() { dlkp_pInit(this); } dlkp_p::dlkp_p(const dlkp_p& copy) { dlkp_pInit(this); dlkp_pCopy(this, ©); } dlkp_p::~dlkp_p() { dlkp_pFree(this); } dlpk_p::dlpk_p() { dlpk_pInit(this); } dlpk_p::dlpk_p(const dlpk_p& copy) { dlpk_pInit(this); dlpk_pCopy(this, ©); } dlpk_p::~dlpk_p() { dlpk_pFree(this); } rsakp::rsakp() { rsakpInit(this); } rsakp::rsakp(const rsakp& copy) { rsakpInit(this); rsakpCopy(this, ©); } rsakp::~rsakp() { rsakpFree(this); } rsapk::rsapk() { rsapkInit(this); } rsapk::rsapk(const rsapk& copy) { rsapkInit(this); rsapkCopy(this, ©); } rsapk::~rsapk() { rsapkFree(this); } blockCipherContext::blockCipherContext() { blockCipherContextInit(this, blockCipherDefault()); } blockCipherContext::blockCipherContext(const blockCipher* b) { blockCipherContextInit(this, b); } blockCipherContext::~blockCipherContext() { blockCipherContextFree(this); } hashFunctionContext::hashFunctionContext() { hashFunctionContextInit(this, hashFunctionDefault()); } hashFunctionContext::hashFunctionContext(const hashFunction* h) { hashFunctionContextInit(this, h); } hashFunctionContext::~hashFunctionContext() { hashFunctionContextFree(this); } keyedHashFunctionContext::keyedHashFunctionContext() { keyedHashFunctionContextInit(this, keyedHashFunctionDefault()); } keyedHashFunctionContext::keyedHashFunctionContext(const keyedHashFunction* k) { keyedHashFunctionContextInit(this, k); } keyedHashFunctionContext::~keyedHashFunctionContext() { keyedHashFunctionContextFree(this); } randomGeneratorContext::randomGeneratorContext() { randomGeneratorContextInit(this, randomGeneratorDefault()); } randomGeneratorContext::randomGeneratorContext(const randomGenerator* rng) { randomGeneratorContextInit(this, rng); } randomGeneratorContext::~randomGeneratorContext() { randomGeneratorContextFree(this); } beecrypt-4.2.1/ChangeLog0000664000175000001440000000000010235656157012024 00000000000000beecrypt-4.2.1/ltmain.sh0000755000175000001440000073665011226133602012110 00000000000000# Generated from ltmain.m4sh. # ltmain.sh (GNU libtool) 2.2.6 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print informational messages (default) # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.2.6 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . PROGRAM=ltmain.sh PACKAGE=libtool VERSION=2.2.6 TIMESTAMP="" package_revision=1.3012 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # NLS nuisances: We save the old values to restore during execute mode. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done $lt_unset CDPATH : ${CP="cp -f"} : ${ECHO="echo"} : ${EGREP="/usr/bin/grep -E"} : ${FGREP="/usr/bin/grep -F"} : ${GREP="/usr/bin/grep"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SED="/opt/local/bin/gsed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } # Generated shell functions inserted here. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: # In the unlikely event $progname began with a '-', it would play havoc with # func_echo (imagine progname=-n), so we prepend ./ in that case: func_dirname_and_basename "$progpath" progname=$func_basename_result case $progname in -*) progname=./$progname ;; esac # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=: for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname${mode+: }$mode: $*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` done my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "X$my_tmpdir" | $Xsed } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "X$1" | $Xsed \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_version # Echo version message to standard output and exit. func_version () { $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED -n '/^# Usage:/,/# -h/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" $ECHO $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help # Echo long help message to standard output and exit. func_help () { $SED -n '/^# Usage:/,/# Report bugs to/ { s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p }' < "$progpath" exit $? } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } exit_cmd=: # Check that we have a working $ECHO. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then # Yippee, $ECHO works! : else # Restart under the correct shell, and then maybe $ECHO will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi # Same for EGREP, and just to be sure, do LTCC as well if test "x$EGREP" = x ; then EGREP=egrep fi if test "x$LTCC" = x ; then LTCC=${CC-gcc} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" opt_debug='set -x' $opt_debug ;; -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" shift ;; --dry-run | -n) opt_dry_run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; relink) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" opt_silent=: ;; --verbose| -v) preserve_args="$preserve_args $opt" opt_silent=false ;; --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: -dlopen=*|--mode=*|--tag=*) func_opt_split "$opt" set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} shift ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } ## ----------- ## ## Main. ## ## ----------- ## $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." } # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_ltwrapper_scriptname_result="" if func_ltwrapper_executable_p "$1"; then func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" fi } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case "$@ " in " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T <?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi removelist="$removelist $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist removelist="$removelist $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir command="$command -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $ECHO $ECHO "Try \`$progname --help' for more information about other modes." exit $? } # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $execute_dlfiles; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_quote_for_eval "$file" args="$args $func_quote_for_eval_result" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" $ECHO "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS $ECHO "X----------------------------------------------------------------------" | $Xsed $ECHO "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done $ECHO $ECHO "If you ever happen to want to link against installed libraries" $ECHO "in a given directory, LIBDIR, you must either use libtool, and" $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" $ECHO "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" $ECHO " during execution" fi if test -n "$runpath_var"; then $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" $ECHO " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $ECHO $ECHO "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" $ECHO "pages." ;; *) $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac $ECHO "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS } test "$mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $ECHO "X$nonopt" | $GREP shtool >/dev/null; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" install_prog="$install_prog$func_quote_for_eval_result" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" install_prog="$install_prog $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do func_verbose "extracting global C symbols from \`$progfile'" $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" } done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $ECHO >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; " case $host in *cygwin* | *mingw* | *cegcc* ) $ECHO >> "$output_objdir/$my_dlsyms" "\ /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */" lt_dlsym_const= ;; *osf5*) echo >> "$output_objdir/$my_dlsyms" "\ /* This system does not cope well with relocations in const data */" lt_dlsym_const= ;; *) lt_dlsym_const=const ;; esac $ECHO >> "$output_objdir/$my_dlsyms" "\ extern $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac $ECHO >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) symtab_cflags="$symtab_cflags $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper_part1 [arg=no] # # Emit the first part of a libtool wrapper script on stdout. # For more information, see the description associated with # func_emit_wrapper(), below. func_emit_wrapper_part1 () { func_emit_wrapper_part1_arg1=no if test -n "$1" ; then func_emit_wrapper_part1_arg1=$1 fi $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then ECHO=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then # Yippee, \$ECHO works! : else # Restart under the correct shell, and then maybe \$ECHO will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $ECHO "\ # Find the directory that this script lives in. thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done " } # end: func_emit_wrapper_part1 # func_emit_wrapper_part2 [arg=no] # # Emit the second part of a libtool wrapper script on stdout. # For more information, see the description associated with # func_emit_wrapper(), below. func_emit_wrapper_part2 () { func_emit_wrapper_part2_arg1=no if test -n "$1" ; then func_emit_wrapper_part2_arg1=$1 fi $ECHO "\ # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # end: func_emit_wrapper_part2 # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=no if test -n "$1" ; then func_emit_wrapper_arg1=$1 fi # split this up so that func_emit_cwrapperexe_src # can call each part independently. func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" } # func_to_host_path arg # # Convert paths to host format when used with build tools. # Intended for use with "native" mingw (where libtool itself # is running under the msys shell), or in the following cross- # build environments: # $build $host # mingw (msys) mingw [e.g. native] # cygwin mingw # *nix + wine mingw # where wine is equipped with the `winepath' executable. # In the native mingw case, the (msys) shell automatically # converts paths for any non-msys applications it launches, # but that facility isn't available from inside the cwrapper. # Similar accommodations are necessary for $host mingw and # $build cygwin. Calling this function does no harm for other # $host/$build combinations not listed above. # # ARG is the path (on $build) that should be converted to # the proper representation for $host. The result is stored # in $func_to_host_path_result. func_to_host_path () { func_to_host_path_result="$1" if test -n "$1" ; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' case $build in *mingw* ) # actually, msys # awkward: cmd appends spaces to result lt_sed_strip_trailing_spaces="s/[ ]*\$//" func_to_host_path_tmp1=`( cmd //c echo "$1" |\ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) func_to_host_path_tmp1=`cygpath -w "$1"` func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` ;; * ) # Unfortunately, winepath does not exit with a non-zero # error code, so we are forced to check the contents of # stdout. On the other hand, if the command is not # found, the shell will set an exit code of 127 and print # *an error message* to stdout. So we must check for both # error code of zero AND non-empty stdout, which explains # the odd construction: func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` else # Allow warning below. func_to_host_path_result="" fi ;; esac if test -z "$func_to_host_path_result" ; then func_error "Could not determine host path corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_path_result="$1" fi ;; esac fi } # end: func_to_host_path # func_to_host_pathlist arg # # Convert pathlists to host format when used with build tools. # See func_to_host_path(), above. This function supports the # following $build/$host combinations (but does no harm for # combinations not listed here): # $build $host # mingw (msys) mingw [e.g. native] # cygwin mingw # *nix + wine mingw # # Path separators are also converted from $build format to # $host format. If ARG begins or ends with a path separator # character, it is preserved (but converted to $host format) # on output. # # ARG is a pathlist (on $build) that should be converted to # the proper representation on $host. The result is stored # in $func_to_host_pathlist_result. func_to_host_pathlist () { func_to_host_pathlist_result="$1" if test -n "$1" ; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_to_host_pathlist_tmp2="$1" # Once set for this call, this variable should not be # reassigned. It is used in tha fallback case. func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e 's|^:*||' -e 's|:*$||'` case $build in *mingw* ) # Actually, msys. # Awkward: cmd appends spaces to result. lt_sed_strip_trailing_spaces="s/[ ]*\$//" func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e "$lt_sed_naive_backslashify"` ;; * ) # unfortunately, winepath doesn't convert pathlists func_to_host_pathlist_result="" func_to_host_pathlist_oldIFS=$IFS IFS=: for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do IFS=$func_to_host_pathlist_oldIFS if test -n "$func_to_host_pathlist_f" ; then func_to_host_path "$func_to_host_pathlist_f" if test -n "$func_to_host_path_result" ; then if test -z "$func_to_host_pathlist_result" ; then func_to_host_pathlist_result="$func_to_host_path_result" else func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" fi fi fi IFS=: done IFS=$func_to_host_pathlist_oldIFS ;; esac if test -z "$func_to_host_pathlist_result" ; then func_error "Could not determine the host path(s) corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This may break if $1 contains DOS-style drive # specifications. The fix is not to complicate the expression # below, but for the user to provide a working wine installation # with winepath so that path translation in the cross-to-mingw # case works properly. lt_replace_pathsep_nix_to_dos="s|:|;|g" func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ $SED -e "$lt_replace_pathsep_nix_to_dos"` fi # Now, add the leading and trailing path separators back case "$1" in :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" ;; esac case "$1" in *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" ;; esac ;; esac fi } # end: func_to_host_pathlist # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include # define setmode _setmode #else # include # include # ifdef __CYGWIN__ # include # define HAVE_SETENV # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif # endif #endif #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif #ifdef _MSC_VER # define S_IXUSR _S_IEXEC # define stat _stat # ifndef _INTPTR_T_DEFINED # define intptr_t int # endif #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifdef __CYGWIN__ # define FOPEN_WB "wb" #endif #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #undef LTWRAPPER_DEBUGPRINTF #if defined DEBUGWRAPPER # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args static void ltwrapper_debugprintf (const char *fmt, ...) { va_list args; va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } #else # define LTWRAPPER_DEBUGPRINTF(args) #endif const char *program_name = NULL; void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_fatal (const char *message, ...); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_opt_process_env_set (const char *arg); void lt_opt_process_env_prepend (const char *arg); void lt_opt_process_env_append (const char *arg); int lt_split_name_value (const char *arg, char** name, char** value); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); static const char *script_text_part1 = EOF func_emit_wrapper_part1 yes | $SED -e 's/\([\\"]\)/\\\1/g' \ -e 's/^/ "/' -e 's/$/\\n"/' echo ";" cat <"))); for (i = 0; i < newargc; i++) { LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); } EOF case $host_os in mingw*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); if (rval == -1) { /* failed to start process */ LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); return 127; } return rval; EOF ;; *) cat <<"EOF" execv (lt_argv_zero, newargz); return rval; /* =127, but avoids unused variable warning */ EOF ;; esac cat <<"EOF" } void * xmalloc (size_t num) { void *p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char) name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable (const char *path) { struct stat st; LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", tmp_pathspec)); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { char *errstr = strerror (errno); lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal ("Could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } void lt_setenv (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", (name ? name : ""), (value ? value : ""))); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } int lt_split_name_value (const char *arg, char** name, char** value) { const char *p; int len; if (!arg || !*arg) return 1; p = strchr (arg, (int)'='); if (!p) return 1; *value = xstrdup (++p); len = strlen (arg) - strlen (*value); *name = XMALLOC (char, len); strncpy (*name, arg, len-1); (*name)[len - 1] = '\0'; return 0; } void lt_opt_process_env_set (const char *arg) { char *name = NULL; char *value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); } lt_setenv (name, value); XFREE (name); XFREE (value); } void lt_opt_process_env_prepend (const char *arg) { char *name = NULL; char *value = NULL; char *new_value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); } new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); XFREE (name); XFREE (value); } void lt_opt_process_env_append (const char *arg) { char *name = NULL; char *value = NULL; char *new_value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); } new_value = lt_extend_str (getenv (name), value, 1); lt_setenv (name, new_value); XFREE (new_value); XFREE (name); XFREE (value); } void lt_update_exe_path (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", (name ? name : ""), (value ? value : ""))); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", (name ? name : ""), (value ? value : ""))); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF } # end: func_emit_cwrapperexe_src # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname '-L' '' "$arg" dir=$func_stripname_result if test -z "$dir"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot) compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" arg="$arg $wl$func_quote_for_eval_result" compiler_flags="$compiler_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" arg="$arg $wl$func_quote_for_eval_result" compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" linker_flags="$linker_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -F/path gives path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" compiler_flags="$compiler_flags $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *.la) func_source "$lib" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" dir=$func_stripname_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $ECHO $ECHO "*** Warning: Trying to link with static lib archive $deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because the file extensions .$libext of this argument makes me believe" $ECHO "*** that it is just a static archive that I should not use here." else $ECHO $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) temp_rpath="$temp_rpath$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded notinst_deplibs="$notinst_deplibs $lib" need_relink=no ;; *) if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $ECHO if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $ECHO $ECHO "*** And there doesn't seem to be a static archive available" $ECHO "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $ECHO $ECHO "*** Warning: This system can not link to static lib archive $lib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $ECHO "*** But as you try to build a module library, libtool will still create " $ECHO "*** a static module, that should work as long as the dlopening application" $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $ECHO $ECHO "*** However, this would only work if libtool was able to extract symbol" $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" $ECHO "*** not find such a program. So, this module is probably useless." $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) func_dirname "$deplib" "" "." dir="$func_dirname_result" # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $ECHO $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $ECHO $ECHO "*** Warning: linker path does not have real file for library $a_deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $ECHO $ECHO "*** Warning: linker path does not have real file for library $a_deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` done fi if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $ECHO if test "X$deplibs_check_method" = "Xnone"; then $ECHO "*** Warning: inter-library dependencies are not supported in this platform." else $ECHO "*** Warning: inter-library dependencies are not known to be supported." fi $ECHO "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $ECHO $ECHO "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" $ECHO "*** a static module, that should work as long as the dlopening" $ECHO "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $ECHO $ECHO "*** However, this would only work if libtool was able to extract symbol" $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" $ECHO "*** not find such a program. So, this module is probably useless." $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $ECHO "*** The inter-library dependencies that have been dropped here will be" $ECHO "*** automatically added whenever a program is linked with this library" $ECHO "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $ECHO $ECHO "*** Since this library must not contain undefined symbols," $ECHO "*** because either the platform does not support them or" $ECHO "*** it was explicitly requested with -no-undefined," $ECHO "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" delfiles="$delfiles $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" func_len " $cmd" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then func_show_eval "$cmd" 'exit $?' skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$ECHO "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" $ECHO 'INPUT (' > $output for obj in $save_libobjs do $ECHO "$obj" >> $output done $ECHO ')' >> $output delfiles="$delfiles $output" elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do $ECHO "$obj" >> $output done delfiles="$delfiles $output" output=$firstobj\"$file_list_spec$output\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=$obj func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi delfiles="$delfiles $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *cegcc) # Disable wrappers for cegcc, we are cross compiling anyway. wrappers_required=no ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $ECHO for shipping. if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else $ECHO "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" if test "x$EGREP" = x ; then EGREP=egrep fi # We do not want portage's install root ($D) present. Check only for # this if the .la is being installed. if test "$installed" = yes && test "$D"; then eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` else mynewdependency_lib="$libdir/$name" fi # Do not add duplicates if test "$mynewdependency_lib"; then my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` if test -z "$my_little_ninja_foo_1"; then newdependency_libs="$newdependency_libs $mynewdependency_lib" fi fi ;; *) if test "$installed" = yes; then # Rather use S=WORKDIR if our version of portage supports it. # This is because some ebuild (gcc) do not use $S as buildroot. if test "$PWORKDIR"; then S="$PWORKDIR" fi # We do not want portage's build root ($S) present. my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"` # We do not want portage's install root ($D) present. my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"` if test -n "$my_little_ninja_foo_2" && test "$S"; then mynewdependency_lib="" elif test -n "$my_little_ninja_foo_3" && test "$D"; then eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` else mynewdependency_lib="$deplib" fi else mynewdependency_lib="$deplib" fi # Do not add duplicates if test "$mynewdependency_lib"; then my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` if test -z "$my_little_ninja_foo_4"; then newdependency_libs="$newdependency_libs $mynewdependency_lib" fi fi ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac # Do not add duplicates if test "$installed" = yes && test "$D"; then install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` fi $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$mode" = link || test "$mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) RM="$RM $arg"; rmforce=yes ;; -*) RM="$RM $arg" ;; *) files="$files $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then objdir="$origobjdir" else objdir="$dir/$origobjdir" fi func_basename "$file" name="$func_basename_result" test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result rmfiles="$rmfiles $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$mode" = uninstall || test "$mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 beecrypt-4.2.1/COPYING0000664000175000001440000004311010063035775011312 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Hereny it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sectionbeecrypt-4.2.1/tests/0000777000175000001440000000000011226307271011477 500000000000000beecrypt-4.2.1/tests/testdsa.c0000664000175000001440000000702510503176344013236 00000000000000/* * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testdsa.c * \brief Unit test program for the DSA algorithm. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/beecrypt.h" #include "beecrypt/dlkp.h" #include "beecrypt/dsa.h" struct vector { const char* p; const char* q; const char* g; const char* y; const char* m; const char* r; const char* s; }; #define NVECTORS 2 struct vector table[NVECTORS] = { { "8df2a494492276aa3d25759bb06869cbeac0d83afb8d0cf7cbb8324f0d7882e5d0762fc5b7210eafc2e9adac32ab7aac49693dfbf83724c2ec0736ee31c80291", "c773218c737ec8ee993b4f2ded30f48edace915f", "626d027839ea0a13413163a55b4cb500299d5522956cefcb3bff10f399ce2c2e71cb9de5fa24babf58e5b79521925c9cc42e9f6f464b088cc572af53e6d78802", "19131871d75b1612a819f29d78d1b0d7346f7aa77bb62a859bfd6c5675da9d212d3a36ef1672ef660b8c7c255cc0ec74858fba33f44c06699630a76b030ee333", "a9993e364706816aba3e25717850c26c9cd0d89d", "8bac1ab66410435cb7181f95b16ab97c92b341c0", "41e2345f1f56df2458f426d155b4ba2db6dcd8c8" }, { "A62927E72F9F12CD31C50E30D0E9B580539C4F7CA2AC3E2EE244C834303B039A1A388FDE4DCD42B5402807047FBEC0DB09ECF897CD2B8546A893499B3A8A409C52476708EAD0124E43F31CA2495A950731D254F56F4F39AC379E0620E15A9CC5A8EA5100CD1137012093E11F73A1E38FAEB95588BB54A48913977D1A1EC6986F", "C4243BE451ECBA6F87F539A7F899D4047208B091", "9C8D21312FD7358D86D82E8F237E99A9DFC375529456420F159361C40A76A891DA8D6CEE8EB1BDEC97CA60CCBE921BED5EB29EC35A2EFCA295311585753EFABBADF599620EA0FB8489FBEE60EDE6D5A99DD3506F37CC21741D306BEE15BBB8EAA1261C2DC18221FB5C6A08602B3E1084029285DF161A2CB6B179830C31C351A3", "7602862B1A4F6F154BE21AFD86CF2AADD6393AE0EBBB5781CB82758C9A360A540BBCC3CBBF014509FD0ED2FC30C6ED0959C43954CF058854B8469DD4247AC463D4C10B6479C8B4FBE56E97067A7FC4E7F1A95507A0B6D70328534C37B590DB8ED12BB460FC3232758F9B64D7BD63BD320FF1FA635A3F77D13D71A8AD4E8B5469", "73F6679451E5F98CA60235E6B4C58FC14043C56D", "22EDDAD362C3209DF597070D144E8FDDB8B65E53", "3AB093E7A7CD30125036B384C6C114317F10E10D" } }; int main() { int i, failures = 0; dlkp_p keypair; mpnumber hm, r, s, k, e_r, e_s; for (i = 0; i < NVECTORS; i++) { dlkp_pInit(&keypair); mpbsethex(&keypair.param.p, table[i].p); mpbsethex(&keypair.param.q, table[i].q); mpnsethex(&keypair.param.g, table[i].g); mpnsethex(&keypair.y, table[i].y); mpnzero(&hm); mpnsethex(&hm, table[i].m); mpnzero(&e_r); mpnzero(&e_s); mpnsethex(&e_r, table[i].r); mpnsethex(&e_s, table[i].s); mpnzero(&r); mpnzero(&s); /* first test, verify the signature result from NIST FIPS 186-1 */ if (!dsavrfy(&keypair.param.p, &keypair.param.q, &keypair.param.g, &hm, &keypair.y, &e_r, &e_s)) failures++; mpnfree(&s); mpnfree(&r); mpnfree(&hm); mpnfree(&e_s); mpnfree(&e_r); dlkp_pFree(&keypair); } return failures; } beecrypt-4.2.1/tests/benchrsa.c0000664000175000001440000000513110503176557013356 00000000000000/* * Copyright (c) 2005 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file benchrsa.c * \brief Benchmark program for raw RSA performance. * \author Bob Deblier */ #include "beecrypt/beecrypt.h" #include "beecrypt/rsa.h" #include "beecrypt/timestamp.h" #include #define SECONDS 10 const char* hm = "0001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF03021300906052B0E03021A05000414993E364706816ABA3E25717850C26C9CD0D89D"; int main() { randomGeneratorContext rngc; rsakp pair; mpnumber m, c; jlong start, now; int iterations = 0; randomGeneratorContextInit(&rngc, randomGeneratorDefault()); rsakpInit(&pair); rsakpMake(&pair, &rngc, 1024); mpnzero(&m); mpnsethex(&m, hm); mpnzero(&c); mpnsetw(&c, 0); /* pub operation */ iterations = 0; start = timestamp(); do { rsapub(&pair.n, &pair.e, &m, &c); now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); printf("%d bits pub: %d times in %d seconds\n", (int) mpbits(pair.n.size, pair.n.modl), iterations, SECONDS); /* pri operation */ iterations = 0; start = timestamp(); do { rsapri(&pair.n, &pair.d, &m, &c); now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); printf("%d bits pri: %d times in %d seconds\n", (int) mpbits(pair.n.size, pair.n.modl), iterations, SECONDS); /* crt operation */ iterations = 0; start = timestamp(); do { rsapricrt(&pair.n, &pair.p, &pair.q, &pair.dp, &pair.dq, &pair.qi, &c, &m); now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); printf("%d bits crt: %d times in %d seconds\n", (int) mpbits(pair.n.size, pair.n.modl), iterations, SECONDS); rsakpFree(&pair); mpnfree(&c); mpnfree(&m); return 0; } beecrypt-4.2.1/tests/testaes.c0000664000175000001440000000534610503176225013241 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testaes.c * \brief Unit test program for the Blowfish cipher. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/aes.h" extern int fromhex(byte*, const char*); extern void hexdump(const byte*, size_t); struct vector { char* key; char* input; char* expect; cipherOperation op; }; #define NVECTORS 6 struct vector table[NVECTORS] = { { "000102030405060708090a0b0c0d0e0f", "00112233445566778899aabbccddeeff", "69c4e0d86a7b0430d8cdb78070b4c55a", ENCRYPT }, { "000102030405060708090a0b0c0d0e0f", "69c4e0d86a7b0430d8cdb78070b4c55a", "00112233445566778899aabbccddeeff", DECRYPT }, { "000102030405060708090a0b0c0d0e0f1011121314151617", "00112233445566778899aabbccddeeff", "dda97ca4864cdfe06eaf70a0ec0d7191", ENCRYPT }, { "000102030405060708090a0b0c0d0e0f1011121314151617", "dda97ca4864cdfe06eaf70a0ec0d7191", "00112233445566778899aabbccddeeff", DECRYPT }, { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", "00112233445566778899aabbccddeeff", "8ea2b7ca516745bfeafc49904b496089", ENCRYPT }, { "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", "8ea2b7ca516745bfeafc49904b496089", "00112233445566778899aabbccddeeff", DECRYPT } }; int main() { int i, failures = 0; aesParam param; byte key[32]; byte src[16]; byte dst[16]; byte chk[16]; size_t keybits; for (i = 0; i < NVECTORS; i++) { keybits = fromhex(key, table[i].key) << 3; if (aesSetup(¶m, key, keybits, table[i].op)) return -1; fromhex(src, table[i].input); fromhex(chk, table[i].expect); switch (table[i].op) { case ENCRYPT: if (aesEncrypt(¶m, (uint32_t*) dst, (const uint32_t*) src)) return -1; break; case DECRYPT: if (aesDecrypt(¶m, (uint32_t*) dst, (const uint32_t*) src)) return -1; break; } if (memcmp(dst, chk, 16)) { printf("failed vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/tests/testutil.c0000664000175000001440000000302410503176245013437 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "beecrypt/beecrypt.h" #include int fromhex(byte* data, const char* hexdata) { int length = strlen(hexdata); int count = 0, index = 0; byte b = 0; char ch; if (length & 1) count = 1; while (index++ < length) { ch = *(hexdata++); b <<= 4; if (ch >= '0' && ch <= '9') b += (ch - '0'); else if (ch >= 'A' && ch <= 'F') b += (ch - 'A') + 10; else if (ch >= 'a' && ch <= 'f') b += (ch - 'a') + 10; count++; if (count == 2) { *(data++) = b; b = 0; count = 0; } } return (length+1) >> 1; } int hexdump(const byte* data, size_t size) { size_t i; for (i = 0; i < size; i++) { printf("%02x", data[i]); if ((i & 0xf) == 0xf) printf("\n"); else printf(" "); } if ((i & 0xf)) printf("\n"); } beecrypt-4.2.1/tests/testripemd256.c0000644000175000001440000000466411216206767014215 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testripemd256.c * \brief Unit test program for the RIPEMD-256 algorithm. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/ripemd256.h" #include "beecrypt/memchunk.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[3] = { { 0, (byte*) "", (byte*) "\x02\xba\x4c\x4e\x5f\x8e\xcd\x18\x77\xfc\x52\xd6\x4d\x30\xe3\x7a\x2d\x97\x74\xfb\x1e\x5d\x02\x63\x80\xae\x01\x68\xe3\xc5\x52\x2d" }, { 3, (byte*) "abc", (byte*) "\xaf\xbd\x6e\x22\x8b\x9d\x8c\xbb\xce\xf5\xca\x2d\x03\xe6\xdb\xa1\x0a\xc0\xbc\x7d\xcb\xe4\x68\x0e\x1e\x42\xd2\xe9\x75\x45\x9b\x65" }, { 56, (byte*) "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", (byte*) "\x38\x43\x04\x55\x83\xaa\xc6\xc8\xc8\xd9\x12\x85\x73\xe7\xa9\x80\x9a\xfb\x2a\x0f\x34\xcc\xc3\x6e\xa9\xe7\x2f\x16\xf6\x36\x8e\x3f" } }; void hexdump(const byte* b, int count) { int i; for (i = 0; i < count; i++) { printf("%02x", b[i]); if ((i & 0xf) == 0xf) printf("\n"); } if (i & 0xf) printf("\n"); } int main() { int i, failures = 0; byte digest[32]; ripemd256Param param; for (i = 0; i < 1; i++) { if (ripemd256Reset(¶m)) return -1; if (ripemd256Update(¶m, table[i].input, table[i].input_size)) return -1; if (ripemd256Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 32)) { printf("failed test vector %d\n", i+1); printf("expected:\n"); hexdump(table[i].expect, 32); printf("got:\n"); hexdump(digest, 32); failures++; } } return failures; } beecrypt-4.2.1/tests/testdldp.c0000664000175000001440000000335010503176427013411 00000000000000/* * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testdldp.c * \brief Unit test program for discrete logarithm domain parameters. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/beecrypt.h" #include "beecrypt/dldp.h" int main() { int failures = 0; dldp_p params; randomGeneratorContext rngc; dldp_pInit(¶ms); if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0) { mpnumber gq; mpnzero(&gq); /* make parameters with p = 1024 bits, q = 160 bits, g of order (q) */ dldp_pgoqMake(¶ms, &rngc, 1024, 160, 1); /* we have the parameters, now see if g^q == 1 */ mpbnpowmod(¶ms.p, ¶ms.g, (mpnumber*) ¶ms.q, &gq); if (!mpisone(gq.size, gq.data)) { printf("failed test vector 1\n"); failures++; } mpnfree(&gq); dldp_pFree(¶ms); randomGeneratorContextFree(&rngc); } else { printf("random generator failure\n"); return -1; } return failures; } beecrypt-4.2.1/tests/testripemd160.c0000644000175000001440000000444411216170015014165 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testripemd160.c * \brief Unit test program for the RIPEMD-160 algorithm. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/ripemd160.h" #include "beecrypt/memchunk.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[3] = { { 0, (byte*) "", (byte*) "\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28\x08\x97\x7e\xe8\xf5\x48\xb2\x25\x8d\x31" }, { 3, (byte*) "abc", (byte*) "\x8e\xb2\x08\xf7\xe0\x5d\x98\x7a\x9b\x04\x4a\x8e\x98\xc6\xb0\x87\xf1\x5a\x0b\xfc" }, { 56, (byte*) "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", (byte*) "\x12\xa0\x53\x38\x4a\x9c\x0c\x88\xe4\x05\xa0\x6c\x27\xdc\xf4\x9a\xda\x62\xeb\x2b" } }; void hexdump(const byte* b, int count) { int i; for (i = 0; i < count; i++) { printf("%02x", b[i]); if ((i & 0xf) == 0xf) printf("\n"); } if (i & 0xf) printf("\n"); } int main() { int i, failures = 0; byte digest[20]; ripemd160Param param; for (i = 0; i < 1; i++) { if (ripemd160Reset(¶m)) return -1; if (ripemd160Update(¶m, table[i].input, table[i].input_size)) return -1; if (ripemd160Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 20)) { printf("failed test vector %d\n", i+1); printf("expected:\n"); hexdump(table[i].expect, 20); printf("got:\n"); hexdump(digest, 20); failures++; } } return failures; } beecrypt-4.2.1/tests/testmpinv.c0000664000175000001440000000506210503176324013615 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testmpinv.c * \brief Unit test program for the multi-precision modular inverse. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/beecrypt.h" #include "beecrypt/mpnumber.h" struct vector { const char* m; const char* k; const char* inv_k; }; #define NVECTORS 5 struct vector table[NVECTORS] = { { "c773218c737ec8ee993b4f2ded30f48edace915f", "358dad571462710f50e254cf1a376b2bdeaadfbf", "0d5167298202e49b4116ac104fc3f415ae52f917" }, { "fe95df16069b516859ba036ef0e563a7b6a86409", "eedd5539e982b570a5f8efc73f243a04f312920d", "f64a00a9ce43f4128e5eee1991b2e08c6008ba4e" }, { "fe95df16069b516859ba036ef0e563a7b6a86409", "d75f6d17eb243613eacc0dcbb41db4e5a3364b07", "e90aa0a992ebd4c9176f0e20a885101218111a73" }, { "fe95df16069b516859ba036ef0e563a7b6a86409", "759ea04b65f66184af22fcabfe99a1cda3a79236", "2c701a52078afe539a281cba7f35df34a7a125a4" }, { "80277b4855a39cb9a98b2107cc1efb29f1832f727df05931cdd4a64cd78363134bf2abe78723784d2013a26875afe13f04526399c6b0cee659abb60dc8263400", "10001", "6e5f92b24defc7ffafa20024b30ccbcce810d0408f6efda3035f6e8b27e224e66db6e78f54b89bd7f11477fff7bc2f071335d24a92f19c8090226f7d97303001" } }; int main() { int i, failures = 0; mpnumber m; mpnumber k; mpnumber inv_k; mpnumber inv; mpnzero(&m); mpnzero(&k); mpnzero(&inv_k); mpnzero(&inv); for (i = 0; i < NVECTORS; i++) { mpnsethex(&m, table[i].m); mpnsethex(&k, table[i].k); mpnsethex(&inv_k, table[i].inv_k); if (mpninv(&inv, &k, &m)) { if (mpnex(inv.size, inv.data, inv_k.size, inv_k.data)) { printf("mpninv return unexpected result\n"); failures++; } } else { printf("mpninv failed\n"); failures++; } } mpnfree(&m); mpnfree(&k); mpnfree(&inv_k); mpnfree(&inv); return failures; } beecrypt-4.2.1/tests/testsha256.c0000664000175000001440000000353010503176102013464 00000000000000/* * testsha256.c * * Unit test program for SHA-256; it implements the test vectors from the draft FIPS document. * * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include "beecrypt/sha256.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[2] = { { 3, (byte*) "abc", (byte*) "\xba\x78\x16\xbf\x8f\x01\xcf\xea\x41\x41\x40\xde\x5d\xae\x22\x23\xb0\x03\x61\xa3\x96\x17\x7a\x9c\xb4\x10\xff\x61\xf2\x00\x15\xad" }, { 56, (byte*) "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", (byte*) "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1" } }; int main() { int i, failures = 0; sha256Param param; byte digest[32]; for (i = 0; i < 2; i++) { if (sha256Reset(¶m)) return -1; if (sha256Update(¶m, table[i].input, table[i].input_size)) return -1; if (sha256Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 32)) { printf("failed test vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/tests/testsha512.c0000664000175000001440000000334510503176150013466 00000000000000/* * testsha512.c * * Unit test program for SHA-512; it implements the test vectors from FIPS 180-2. * * Copyright (c) 2004 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include "beecrypt/sha512.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[1] = { { 3, (byte*) "abc", (byte*) "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41\x31\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55\xd3\x9a\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3\xfe\xeb\xbd\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f\xa5\x4c\xa4\x9f" }, }; int main() { int i, failures = 0; sha512Param param; byte digest[64]; for (i = 0; i < 1; i++) { if (sha512Reset(¶m)) return -1; if (sha512Update(¶m, table[i].input, table[i].input_size)) return -1; if (sha512Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 64)) { printf("failed test vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/tests/Makefile.in0000644000175000001440000007164411226307162013473 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am's purpose is to build the unit test programs and benchmarks. # # Copyright (c) 2001, 2002, 2003 X-Way Rights BV # Copyright (c) 2009 Bob Deblier # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ TESTS = testmd5$(EXEEXT) testripemd128$(EXEEXT) testripemd160$(EXEEXT) \ testripemd256$(EXEEXT) testripemd320$(EXEEXT) \ testsha1$(EXEEXT) testsha224$(EXEEXT) testsha256$(EXEEXT) \ testsha384$(EXEEXT) testsha512$(EXEEXT) testhmacmd5$(EXEEXT) \ testhmacsha1$(EXEEXT) testaes$(EXEEXT) testblowfish$(EXEEXT) \ testmp$(EXEEXT) testmpinv$(EXEEXT) testdsa$(EXEEXT) \ testrsa$(EXEEXT) testrsacrt$(EXEEXT) testdldp$(EXEEXT) \ testelgamal$(EXEEXT) check_PROGRAMS = testmd5$(EXEEXT) testripemd128$(EXEEXT) \ testripemd160$(EXEEXT) testripemd256$(EXEEXT) \ testripemd320$(EXEEXT) testsha1$(EXEEXT) testsha224$(EXEEXT) \ testsha256$(EXEEXT) testsha384$(EXEEXT) testsha512$(EXEEXT) \ testhmacmd5$(EXEEXT) testhmacsha1$(EXEEXT) testaes$(EXEEXT) \ testblowfish$(EXEEXT) testmp$(EXEEXT) testmpinv$(EXEEXT) \ testdsa$(EXEEXT) testrsa$(EXEEXT) testrsacrt$(EXEEXT) \ testdldp$(EXEEXT) testelgamal$(EXEEXT) EXTRA_PROGRAMS = benchme$(EXEEXT) benchrsa$(EXEEXT) benchhf$(EXEEXT) \ benchbc$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_benchbc_OBJECTS = benchbc.$(OBJEXT) benchbc_OBJECTS = $(am_benchbc_OBJECTS) benchbc_LDADD = $(LDADD) benchbc_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_benchhf_OBJECTS = benchhf.$(OBJEXT) benchhf_OBJECTS = $(am_benchhf_OBJECTS) benchhf_LDADD = $(LDADD) benchhf_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_benchme_OBJECTS = benchme.$(OBJEXT) benchme_OBJECTS = $(am_benchme_OBJECTS) benchme_LDADD = $(LDADD) benchme_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_benchrsa_OBJECTS = benchrsa.$(OBJEXT) benchrsa_OBJECTS = $(am_benchrsa_OBJECTS) benchrsa_LDADD = $(LDADD) benchrsa_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testaes_OBJECTS = testaes.$(OBJEXT) testutil.$(OBJEXT) testaes_OBJECTS = $(am_testaes_OBJECTS) testaes_LDADD = $(LDADD) testaes_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testblowfish_OBJECTS = testblowfish.$(OBJEXT) testutil.$(OBJEXT) testblowfish_OBJECTS = $(am_testblowfish_OBJECTS) testblowfish_LDADD = $(LDADD) testblowfish_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testdldp_OBJECTS = testdldp.$(OBJEXT) testdldp_OBJECTS = $(am_testdldp_OBJECTS) testdldp_LDADD = $(LDADD) testdldp_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testdsa_OBJECTS = testdsa.$(OBJEXT) testdsa_OBJECTS = $(am_testdsa_OBJECTS) testdsa_LDADD = $(LDADD) testdsa_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testelgamal_OBJECTS = testelgamal.$(OBJEXT) testelgamal_OBJECTS = $(am_testelgamal_OBJECTS) testelgamal_LDADD = $(LDADD) testelgamal_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testhmacmd5_OBJECTS = testhmacmd5.$(OBJEXT) testhmacmd5_OBJECTS = $(am_testhmacmd5_OBJECTS) testhmacmd5_LDADD = $(LDADD) testhmacmd5_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testhmacsha1_OBJECTS = testhmacsha1.$(OBJEXT) testhmacsha1_OBJECTS = $(am_testhmacsha1_OBJECTS) testhmacsha1_LDADD = $(LDADD) testhmacsha1_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testmd5_OBJECTS = testmd5.$(OBJEXT) testmd5_OBJECTS = $(am_testmd5_OBJECTS) testmd5_LDADD = $(LDADD) testmd5_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testmp_OBJECTS = testmp.$(OBJEXT) testmp_OBJECTS = $(am_testmp_OBJECTS) testmp_LDADD = $(LDADD) testmp_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testmpinv_OBJECTS = testmpinv.$(OBJEXT) testmpinv_OBJECTS = $(am_testmpinv_OBJECTS) testmpinv_LDADD = $(LDADD) testmpinv_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testripemd128_OBJECTS = testripemd128.$(OBJEXT) testripemd128_OBJECTS = $(am_testripemd128_OBJECTS) testripemd128_LDADD = $(LDADD) testripemd128_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testripemd160_OBJECTS = testripemd160.$(OBJEXT) testripemd160_OBJECTS = $(am_testripemd160_OBJECTS) testripemd160_LDADD = $(LDADD) testripemd160_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testripemd256_OBJECTS = testripemd256.$(OBJEXT) testripemd256_OBJECTS = $(am_testripemd256_OBJECTS) testripemd256_LDADD = $(LDADD) testripemd256_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testripemd320_OBJECTS = testripemd320.$(OBJEXT) testripemd320_OBJECTS = $(am_testripemd320_OBJECTS) testripemd320_LDADD = $(LDADD) testripemd320_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testrsa_OBJECTS = testrsa.$(OBJEXT) testrsa_OBJECTS = $(am_testrsa_OBJECTS) testrsa_LDADD = $(LDADD) testrsa_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testrsacrt_OBJECTS = testrsacrt.$(OBJEXT) testrsacrt_OBJECTS = $(am_testrsacrt_OBJECTS) testrsacrt_LDADD = $(LDADD) testrsacrt_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testsha1_OBJECTS = testsha1.$(OBJEXT) testsha1_OBJECTS = $(am_testsha1_OBJECTS) testsha1_LDADD = $(LDADD) testsha1_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testsha224_OBJECTS = testsha224.$(OBJEXT) testsha224_OBJECTS = $(am_testsha224_OBJECTS) testsha224_LDADD = $(LDADD) testsha224_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testsha256_OBJECTS = testsha256.$(OBJEXT) testsha256_OBJECTS = $(am_testsha256_OBJECTS) testsha256_LDADD = $(LDADD) testsha256_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testsha384_OBJECTS = testsha384.$(OBJEXT) testsha384_OBJECTS = $(am_testsha384_OBJECTS) testsha384_LDADD = $(LDADD) testsha384_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_testsha512_OBJECTS = testsha512.$(OBJEXT) testsha512_OBJECTS = $(am_testsha512_OBJECTS) testsha512_LDADD = $(LDADD) testsha512_DEPENDENCIES = $(top_builddir)/libbeecrypt.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(benchbc_SOURCES) $(benchhf_SOURCES) $(benchme_SOURCES) \ $(benchrsa_SOURCES) $(testaes_SOURCES) $(testblowfish_SOURCES) \ $(testdldp_SOURCES) $(testdsa_SOURCES) $(testelgamal_SOURCES) \ $(testhmacmd5_SOURCES) $(testhmacsha1_SOURCES) \ $(testmd5_SOURCES) $(testmp_SOURCES) $(testmpinv_SOURCES) \ $(testripemd128_SOURCES) $(testripemd160_SOURCES) \ $(testripemd256_SOURCES) $(testripemd320_SOURCES) \ $(testrsa_SOURCES) $(testrsacrt_SOURCES) $(testsha1_SOURCES) \ $(testsha224_SOURCES) $(testsha256_SOURCES) \ $(testsha384_SOURCES) $(testsha512_SOURCES) DIST_SOURCES = $(benchbc_SOURCES) $(benchhf_SOURCES) \ $(benchme_SOURCES) $(benchrsa_SOURCES) $(testaes_SOURCES) \ $(testblowfish_SOURCES) $(testdldp_SOURCES) $(testdsa_SOURCES) \ $(testelgamal_SOURCES) $(testhmacmd5_SOURCES) \ $(testhmacsha1_SOURCES) $(testmd5_SOURCES) $(testmp_SOURCES) \ $(testmpinv_SOURCES) $(testripemd128_SOURCES) \ $(testripemd160_SOURCES) $(testripemd256_SOURCES) \ $(testripemd320_SOURCES) $(testrsa_SOURCES) \ $(testrsacrt_SOURCES) $(testsha1_SOURCES) \ $(testsha224_SOURCES) $(testsha256_SOURCES) \ $(testsha384_SOURCES) $(testsha512_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu no-dependencies INCLUDES = -I$(top_srcdir)/include LDADD = $(top_builddir)/libbeecrypt.la testmd5_SOURCES = testmd5.c testripemd128_SOURCES = testripemd128.c testripemd160_SOURCES = testripemd160.c testripemd256_SOURCES = testripemd256.c testripemd320_SOURCES = testripemd320.c testsha1_SOURCES = testsha1.c testsha224_SOURCES = testsha224.c testsha256_SOURCES = testsha256.c testsha384_SOURCES = testsha384.c testsha512_SOURCES = testsha512.c testhmacmd5_SOURCES = testhmacmd5.c testhmacsha1_SOURCES = testhmacsha1.c testaes_SOURCES = testaes.c testutil.c testblowfish_SOURCES = testblowfish.c testutil.c testmp_SOURCES = testmp.c testmpinv_SOURCES = testmpinv.c testdsa_SOURCES = testdsa.c testrsa_SOURCES = testrsa.c testrsacrt_SOURCES = testrsacrt.c testdldp_SOURCES = testdldp.c testelgamal_SOURCES = testelgamal.c benchme_SOURCES = benchme.c benchrsa_SOURCES = benchrsa.c benchhf_SOURCES = benchhf.c benchbc_SOURCES = benchbc.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list benchbc$(EXEEXT): $(benchbc_OBJECTS) $(benchbc_DEPENDENCIES) @rm -f benchbc$(EXEEXT) $(LINK) $(benchbc_OBJECTS) $(benchbc_LDADD) $(LIBS) benchhf$(EXEEXT): $(benchhf_OBJECTS) $(benchhf_DEPENDENCIES) @rm -f benchhf$(EXEEXT) $(LINK) $(benchhf_OBJECTS) $(benchhf_LDADD) $(LIBS) benchme$(EXEEXT): $(benchme_OBJECTS) $(benchme_DEPENDENCIES) @rm -f benchme$(EXEEXT) $(LINK) $(benchme_OBJECTS) $(benchme_LDADD) $(LIBS) benchrsa$(EXEEXT): $(benchrsa_OBJECTS) $(benchrsa_DEPENDENCIES) @rm -f benchrsa$(EXEEXT) $(LINK) $(benchrsa_OBJECTS) $(benchrsa_LDADD) $(LIBS) testaes$(EXEEXT): $(testaes_OBJECTS) $(testaes_DEPENDENCIES) @rm -f testaes$(EXEEXT) $(LINK) $(testaes_OBJECTS) $(testaes_LDADD) $(LIBS) testblowfish$(EXEEXT): $(testblowfish_OBJECTS) $(testblowfish_DEPENDENCIES) @rm -f testblowfish$(EXEEXT) $(LINK) $(testblowfish_OBJECTS) $(testblowfish_LDADD) $(LIBS) testdldp$(EXEEXT): $(testdldp_OBJECTS) $(testdldp_DEPENDENCIES) @rm -f testdldp$(EXEEXT) $(LINK) $(testdldp_OBJECTS) $(testdldp_LDADD) $(LIBS) testdsa$(EXEEXT): $(testdsa_OBJECTS) $(testdsa_DEPENDENCIES) @rm -f testdsa$(EXEEXT) $(LINK) $(testdsa_OBJECTS) $(testdsa_LDADD) $(LIBS) testelgamal$(EXEEXT): $(testelgamal_OBJECTS) $(testelgamal_DEPENDENCIES) @rm -f testelgamal$(EXEEXT) $(LINK) $(testelgamal_OBJECTS) $(testelgamal_LDADD) $(LIBS) testhmacmd5$(EXEEXT): $(testhmacmd5_OBJECTS) $(testhmacmd5_DEPENDENCIES) @rm -f testhmacmd5$(EXEEXT) $(LINK) $(testhmacmd5_OBJECTS) $(testhmacmd5_LDADD) $(LIBS) testhmacsha1$(EXEEXT): $(testhmacsha1_OBJECTS) $(testhmacsha1_DEPENDENCIES) @rm -f testhmacsha1$(EXEEXT) $(LINK) $(testhmacsha1_OBJECTS) $(testhmacsha1_LDADD) $(LIBS) testmd5$(EXEEXT): $(testmd5_OBJECTS) $(testmd5_DEPENDENCIES) @rm -f testmd5$(EXEEXT) $(LINK) $(testmd5_OBJECTS) $(testmd5_LDADD) $(LIBS) testmp$(EXEEXT): $(testmp_OBJECTS) $(testmp_DEPENDENCIES) @rm -f testmp$(EXEEXT) $(LINK) $(testmp_OBJECTS) $(testmp_LDADD) $(LIBS) testmpinv$(EXEEXT): $(testmpinv_OBJECTS) $(testmpinv_DEPENDENCIES) @rm -f testmpinv$(EXEEXT) $(LINK) $(testmpinv_OBJECTS) $(testmpinv_LDADD) $(LIBS) testripemd128$(EXEEXT): $(testripemd128_OBJECTS) $(testripemd128_DEPENDENCIES) @rm -f testripemd128$(EXEEXT) $(LINK) $(testripemd128_OBJECTS) $(testripemd128_LDADD) $(LIBS) testripemd160$(EXEEXT): $(testripemd160_OBJECTS) $(testripemd160_DEPENDENCIES) @rm -f testripemd160$(EXEEXT) $(LINK) $(testripemd160_OBJECTS) $(testripemd160_LDADD) $(LIBS) testripemd256$(EXEEXT): $(testripemd256_OBJECTS) $(testripemd256_DEPENDENCIES) @rm -f testripemd256$(EXEEXT) $(LINK) $(testripemd256_OBJECTS) $(testripemd256_LDADD) $(LIBS) testripemd320$(EXEEXT): $(testripemd320_OBJECTS) $(testripemd320_DEPENDENCIES) @rm -f testripemd320$(EXEEXT) $(LINK) $(testripemd320_OBJECTS) $(testripemd320_LDADD) $(LIBS) testrsa$(EXEEXT): $(testrsa_OBJECTS) $(testrsa_DEPENDENCIES) @rm -f testrsa$(EXEEXT) $(LINK) $(testrsa_OBJECTS) $(testrsa_LDADD) $(LIBS) testrsacrt$(EXEEXT): $(testrsacrt_OBJECTS) $(testrsacrt_DEPENDENCIES) @rm -f testrsacrt$(EXEEXT) $(LINK) $(testrsacrt_OBJECTS) $(testrsacrt_LDADD) $(LIBS) testsha1$(EXEEXT): $(testsha1_OBJECTS) $(testsha1_DEPENDENCIES) @rm -f testsha1$(EXEEXT) $(LINK) $(testsha1_OBJECTS) $(testsha1_LDADD) $(LIBS) testsha224$(EXEEXT): $(testsha224_OBJECTS) $(testsha224_DEPENDENCIES) @rm -f testsha224$(EXEEXT) $(LINK) $(testsha224_OBJECTS) $(testsha224_LDADD) $(LIBS) testsha256$(EXEEXT): $(testsha256_OBJECTS) $(testsha256_DEPENDENCIES) @rm -f testsha256$(EXEEXT) $(LINK) $(testsha256_OBJECTS) $(testsha256_LDADD) $(LIBS) testsha384$(EXEEXT): $(testsha384_OBJECTS) $(testsha384_DEPENDENCIES) @rm -f testsha384$(EXEEXT) $(LINK) $(testsha384_OBJECTS) $(testsha384_LDADD) $(LIBS) testsha512$(EXEEXT): $(testsha512_OBJECTS) $(testsha512_DEPENDENCIES) @rm -f testsha512$(EXEEXT) $(LINK) $(testsha512_OBJECTS) $(testsha512_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c .c.o: $(COMPILE) -c $< .c.obj: $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am # Run every benchmark test twice bench: benchme benchrsa benchhf benchbc ./benchme ./benchme ./benchrsa ./benchrsa ./benchhf MD5 ./benchhf MD5 ./benchhf SHA-1 ./benchhf SHA-1 ./benchhf SHA-256 ./benchhf SHA-256 ./benchhf SHA-512 ./benchhf SHA-512 ./benchbc AES 128 ./benchbc AES 128 ./benchbc Blowfish 128 ./benchbc Blowfish 128 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/tests/testblowfish.c0000664000175000001440000000457410503176262014311 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testblowfish.c * \brief Unit test program for the Blowfish cipher. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/blowfish.h" extern int fromhex(byte*, const char*); struct vector { char* key; char* input; char* expect; cipherOperation op; }; #define NVECTORS 4 struct vector table[NVECTORS] = { { "0000000000000000", "0000000000000000", "4ef997456198dd78", ENCRYPT }, { "ffffffffffffffff", "ffffffffffffffff", "51866fd5B85ecb8a", ENCRYPT }, { "3000000000000000", "1000000000000001", "7d856f9a613063f2", ENCRYPT }, { "1111111111111111", "1111111111111111", "2466dd878b963c9d", ENCRYPT } }; int main() { int i, failures = 0; blowfishParam param; byte key[56]; byte src[8]; byte dst[8]; byte chk[8]; size_t keybits; for (i = 0; i < NVECTORS; i++) { keybits = fromhex(key, table[i].key) << 3; if (blowfishSetup(¶m, key, keybits, table[i].op)) return -1; fromhex(src, table[i].input); fromhex(chk, table[i].expect); switch (table[i].op) { case ENCRYPT: if (blowfishEncrypt(¶m, (uint32_t*) dst, (const uint32_t*) src)) return -1; break; case DECRYPT: if (blowfishDecrypt(¶m, (uint32_t*) dst, (const uint32_t*) src)) return -1; break; } if (memcmp(dst, chk, 8)) { printf("failed vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/tests/testrsa.c0000644000175000001440000000744111216147024013247 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testrsa.c * \brief Unit test program for the RSA algorithm. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/beecrypt.h" #include "beecrypt/rsa.h" static const char* rsa_n = "bbf82f090682ce9c2338ac2b9da871f7368d07eed41043a440d6b6f07454f51fb8dfbaaf035c02ab61ea48ceeb6fcd4876ed520d60e1ec4619719d8a5b8b807fafb8e0a3dfc737723ee6b4b7d93a2584ee6a649d060953748834b2454598394ee0aab12d7b61a51f527a9a41f6c1687fe2537298ca2a8f5946f8e5fd091dbdcb"; static const char* rsa_e = "11"; static const char* rsa_p = "eecfae81b1b9b3c908810b10a1b5600199eb9f44aef4fda493b81a9e3d84f632124ef0236e5d1e3b7e28fae7aa040a2d5b252176459d1f397541ba2a58fb6599"; static const char* rsa_q = "c97fb1f027f453f6341233eaaad1d9353f6c42d08866b1d05a0f2035028b9d869840b41666b42e92ea0da3b43204b5cfce3352524d0416a5a441e700af461503"; static const char* rsa_d1 = "54494ca63eba0337e4e24023fcd69a5aeb07dddc0183a4d0ac9b54b051f2b13ed9490975eab77414ff59c1f7692e9a2e202b38fc910a474174adc93c1f67c981"; static const char* rsa_d2 = "471e0290ff0af0750351b7f878864ca961adbd3a8a7e991c5c0556a94c3146a7f9803f8f6f8ae342e931fd8ae47a220d1b99a495849807fe39f9245a9836da3d"; static const char* rsa_c = "b06c4fdabb6301198d265bdbae9423b380f271f73453885093077fcd39e2119fc98632154f5883b167a967bf402b4e9e2e0f9656e698ea3666edfb25798039f7"; static const char* rsa_m = "d436e99569fd32a7c8a05bbc90d32c49"; int main() { int failures = 0; rsakp keypair; mpnumber m, cipher, decipher; randomGeneratorContext rngc; if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0) { /* First we do the fixed value verification */ rsakpInit(&keypair); mpbsethex(&keypair.n, rsa_n); mpnsethex(&keypair.e, rsa_e); mpbsethex(&keypair.p, rsa_p); mpbsethex(&keypair.q, rsa_q); mpnsethex(&keypair.dp, rsa_d1); mpnsethex(&keypair.dq, rsa_d2); mpnsethex(&keypair.qi, rsa_c); mpnzero(&m); mpnzero(&cipher); mpnzero(&decipher); mpnsethex(&m, rsa_m); /* it's safe to cast the keypair to a public key */ if (rsapub(&keypair.n, &keypair.e, &m, &cipher)) failures++; if (rsapricrt(&keypair.n, &keypair.p, &keypair.q, &keypair.dp, &keypair.dq, &keypair.qi, &cipher, &decipher)) failures++; if (mpnex(m.size, m.data, decipher.size, decipher.data)) failures++; mpnfree(&decipher); mpnfree(&cipher); mpnfree(&m); rsakpFree(&keypair); mpnzero(&m); mpnzero(&cipher); mpnzero(&decipher); /* Now we generate a keypair and do some tests on it */ rsakpMake(&keypair, &rngc, 512); /* generate a random m in the range 0 < m < n */ mpbnrnd(&keypair.n, &rngc, &m); /* it's safe to cast the keypair to a public key */ if (rsapub(&keypair.n, &keypair.e, &m, &cipher)) failures++; if (rsapricrt(&keypair.n, &keypair.p, &keypair.q, &keypair.dp, &keypair.dq, &keypair.qi, &cipher, &decipher)) failures++; if (mpnex(m.size, m.data, decipher.size, decipher.data)) failures++; mpnfree(&m); mpnfree(&decipher); mpnfree(&cipher); rsakpFree(&keypair); randomGeneratorContextFree(&rngc); } return failures; } beecrypt-4.2.1/tests/testsha384.c0000664000175000001440000000324510503176124013475 00000000000000/* * testsha384.c * * Unit test program for SHA-384; it implements the test vectors from FIPS 180-2. * * Copyright (c) 2004 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include "beecrypt/sha384.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[1] = { { 3, (byte*) "abc", (byte*) "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b\xb5\xa0\x3d\x69\x9a\xc6\x50\x07\x27\x2c\x32\xab\x0e\xde\xd1\x63\x1a\x8b\x60\x5a\x43\xff\x5b\xed\x80\x86\x07\x2b\xa1\xe7\xcc\x23\x58\xba\xec\xa1\x34\xc8\x25\xa7" }, }; int main() { int i, failures = 0; sha384Param param; byte digest[48]; for (i = 0; i < 1; i++) { if (sha384Reset(¶m)) return -1; if (sha384Update(¶m, table[i].input, table[i].input_size)) return -1; if (sha384Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 48)) { printf("failed test vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/tests/Makefile.am0000644000175000001440000000536211216374002013450 00000000000000# # Makefile.am's purpose is to build the unit test programs and benchmarks. # # Copyright (c) 2001, 2002, 2003 X-Way Rights BV # Copyright (c) 2009 Bob Deblier # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # AUTOMAKE_OPTIONS = gnu no-dependencies INCLUDES = -I$(top_srcdir)/include LDADD = $(top_builddir)/libbeecrypt.la TESTS = testmd5 testripemd128 testripemd160 testripemd256 testripemd320 testsha1 testsha224 testsha256 testsha384 testsha512 testhmacmd5 testhmacsha1 testaes testblowfish testmp testmpinv testdsa testrsa testrsacrt testdldp testelgamal check_PROGRAMS = testmd5 testripemd128 testripemd160 testripemd256 testripemd320 testsha1 testsha224 testsha256 testsha384 testsha512 testhmacmd5 testhmacsha1 testaes testblowfish testmp testmpinv testdsa testrsa testrsacrt testdldp testelgamal testmd5_SOURCES = testmd5.c testripemd128_SOURCES = testripemd128.c testripemd160_SOURCES = testripemd160.c testripemd256_SOURCES = testripemd256.c testripemd320_SOURCES = testripemd320.c testsha1_SOURCES = testsha1.c testsha224_SOURCES = testsha224.c testsha256_SOURCES = testsha256.c testsha384_SOURCES = testsha384.c testsha512_SOURCES = testsha512.c testhmacmd5_SOURCES = testhmacmd5.c testhmacsha1_SOURCES = testhmacsha1.c testaes_SOURCES = testaes.c testutil.c testblowfish_SOURCES = testblowfish.c testutil.c testmp_SOURCES = testmp.c testmpinv_SOURCES = testmpinv.c testdsa_SOURCES = testdsa.c testrsa_SOURCES = testrsa.c testrsacrt_SOURCES = testrsacrt.c testdldp_SOURCES = testdldp.c testelgamal_SOURCES = testelgamal.c EXTRA_PROGRAMS = benchme benchrsa benchhf benchbc benchme_SOURCES = benchme.c benchrsa_SOURCES = benchrsa.c benchhf_SOURCES = benchhf.c benchbc_SOURCES = benchbc.c # Run every benchmark test twice bench: benchme benchrsa benchhf benchbc ./benchme ./benchme ./benchrsa ./benchrsa ./benchhf MD5 ./benchhf MD5 ./benchhf SHA-1 ./benchhf SHA-1 ./benchhf SHA-256 ./benchhf SHA-256 ./benchhf SHA-512 ./benchhf SHA-512 ./benchbc AES 128 ./benchbc AES 128 ./benchbc Blowfish 128 ./benchbc Blowfish 128 beecrypt-4.2.1/tests/testrsacrt.c0000664000175000001440000000735310503176411013764 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testrsa.c * \brief Unit test program for the RSA algorithm. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/beecrypt.h" #include "beecrypt/rsa.h" static const char* rsa_n = "91e0fc15be36c499f2e2e36d77619c646cacf0cf6657fa136fea748b8e153f1d0cc4d38104da5273655c771282c77fd63061f360d8031406f5c9899f5ca590a19ba07d0bb3cf28c21d6d5fbf27149d2f817353c875f171a4eca9fd427feb4fc9e5f073cd68208423936ed0c3e71ada976fbec43b435dcaa3cfa7fafd973d2eaf"; static const char* rsa_d = "54d7a9456c0fa66073270a66cc1bf53d63076236fdab0542f0c0477032fea06a60d6c8bc2cfa5d21c83df2f2cd250270ac4b0ba5b37c76d565760598ade58d2bcaefb61845002c5557911603cb13db23abd21a4b1981e49d74d4f37fe0d1ee83b98bca722e11aac9d268c014bbf18b276343d7a63ae8275fa21a43be76c241a1"; static const char* rsa_e = "10001"; static const char* rsa_p = "9c88d074a22c27770422f2cf13e497fce54eda094ef42aa3ace900981b21fe79bef26a7c58f6effb602aea5b9776a0a9b2a018d9807eec968e19c82a40674f53"; static const char* rsa_q = "ee92d84cd8925dceb67d9109f73ffd8472e46a137be772ccbe91acc33032e04787334f79c89d717a2f6ede2d3be833a2cb8659a4bf0a28b648727609abc763b5"; static const char* rsa_dp = "7e80668e4b5d098bba51100edf91b66e8f5639089ac0e210a2352ee0bdd4ac15f185711f0aba8d5885f048b33a6589137b22bcd25170c17c2e5c9191ebb851b7"; static const char* rsa_dq = "676abe5aa972e1392f40453415bae67198c04cff3f31b840eac70925df69de71033989d517d2b01330269626f396177415579ada6079cde61e8787856fb25215"; static const char* rsa_qi = "352b5d9d650e5e8ba1bf075e1b6ea6413cdcd419d16ae446a97f28a6b9f7aa38230b5834ee6daaf9adedee85ddc95fce36f16d4fd01eee9fdfefdcae7b152d8"; static const char* rsa_m = "0001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff003021300906052b0e03021a05000414da39a3ee5e6b4b0d3255bfef95601890afd80709"; int main() { int failures = 0; rsakp keypair; mpnumber m, sig, sigcrt; randomGeneratorContext rngc; if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0) { /* First we do the fixed value verification */ rsakpInit(&keypair); mpbsethex(&keypair.n, rsa_n); mpnsethex(&keypair.d, rsa_d); mpnsethex(&keypair.e, rsa_e); mpbsethex(&keypair.p, rsa_p); mpbsethex(&keypair.q, rsa_q); mpnsethex(&keypair.dp, rsa_dp); mpnsethex(&keypair.dq, rsa_dq); mpnsethex(&keypair.qi, rsa_qi); mpnzero(&m); mpnzero(&sig); mpnzero(&sigcrt); mpnsethex(&m, rsa_m); if (rsapri(&keypair.n, &keypair.d, &m, &sig)) { printf("rsapri failed\n"); failures++; } if (rsapricrt(&keypair.n, &keypair.p, &keypair.q, &keypair.dp, &keypair.dq, &keypair.qi, &m, &sigcrt)) { printf("rsapricrt failed\n"); failures++; } if (mpnex(sig.size, sig.data, sigcrt.size, sigcrt.data)) { mpprintln(sig.size, sig.data); mpprintln(sigcrt.size, sigcrt.data); failures++; } mpnfree(&sigcrt); mpnfree(&sig); mpnfree(&m); rsakpFree(&keypair); } return failures; } beecrypt-4.2.1/tests/benchbc.c0000664000175000001440000001221510503176522013146 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file benchbc.c * \brief Benchmark program for Block Ciphers. * \author Bob Deblier */ #include "beecrypt/beecrypt.h" #include "beecrypt/timestamp.h" #include #define SECONDS 10 void validnames() { int i; for (i = 0; i < blockCipherCount(); i++) { const blockCipher* tmp = blockCipherGet(i); if (tmp) fprintf(stderr, " %s", tmp->name); } fprintf(stderr, "\n"); } void usage() { fprintf(stderr, "Usage: benchbf []\n"); fprintf(stderr, " can be any of:"); validnames(); exit(1); } byte key[1024]; int benchmark(const blockCipher* bc, int keybits, int size) { blockCipherContext bcc; void* cleartext = (void*) malloc(size << 10); void* ciphertext = (void*) malloc(size << 10); if (blockCipherContextInit(&bcc, bc)) { fprintf(stderr, "blockCipherContextInit failed\n"); return -1; } if (cleartext && ciphertext) { double exact, speed; jlong start, now; int iterations, nblocks; /* calculcate how many block we need to process */ nblocks = (size << 10) / bc->blocksize; /* set up for encryption */ if (blockCipherContextSetup(&bcc, key, keybits, ENCRYPT)) { fprintf(stderr, "blockCipherContextSetup failed\n"); return -1; } /* ECB encrypt */ iterations = 0; start = timestamp(); do { if (blockCipherContextECB(&bcc, ciphertext, cleartext, nblocks)) { fprintf(stderr, "blockCipherContextECB failed\n"); return -1; } now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); exact = (now - start); exact /= ONE_SECOND; speed = (iterations * size) / exact; printf("ECB encrypted %d KB in %.2f seconds = %.2f KB/s\n", iterations * size, exact, speed); /* CBC encrypt */ iterations = 0; start = timestamp(); do { if (blockCipherContextCBC(&bcc, ciphertext, cleartext, nblocks)) { fprintf(stderr, "blockCipherContextCBC failed\n"); return -1; } now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); exact = (now - start); exact /= ONE_SECOND; speed = (iterations * size) / exact; printf("CBC encrypted %d KB in %.2f seconds = %.2f KB/s\n", iterations * size, exact, speed); /* CTR encrypt */ iterations = 0; start = timestamp(); do { if (blockCipherContextCTR(&bcc, ciphertext, cleartext, nblocks)) { fprintf(stderr, "blockCipherContextCBC failed\n"); return -1; } now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); exact = (now - start); exact /= ONE_SECOND; speed = (iterations * size) / exact; printf("CTR encrypted %d KB in %.2f seconds = %.2f KB/s\n", iterations * size, exact, speed); /* set up for decryption */ if (blockCipherContextSetup(&bcc, key, keybits, DECRYPT)) { fprintf(stderr, "blockCipherContextSetup failed\n"); return -1; } /* ECB decrypt */ iterations = 0; start = timestamp(); do { if (blockCipherContextECB(&bcc, cleartext, ciphertext, nblocks)) { fprintf(stderr, "blockCipherContextECB failed\n"); return -1; } now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); exact = (now - start); exact /= ONE_SECOND; speed = (iterations * size) / exact; printf("ECB decrypted %d KB in %.2f seconds = %.2f KB/s\n", iterations * size, exact, speed); /* CBC decrypt */ iterations = 0; start = timestamp(); do { if (blockCipherContextCBC(&bcc, cleartext, ciphertext, nblocks)) { fprintf(stderr, "blockCipherContextCBC failed\n"); return -1; } now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); exact = (now - start); exact /= ONE_SECOND; speed = (iterations * size) / exact; printf("CBC decrypted %d KB in %.2f seconds = %.2f KB/s\n", iterations * size, exact, speed); free(ciphertext); free(cleartext); } if (blockCipherContextFree(&bcc)) { fprintf(stderr, "blockCipherContextFree failed\n"); return -1; } return 0; } int main(int argc, char* argv[]) { const blockCipher* bc; int keybits; int size = 1024; if (argc < 3 || argc > 5) usage(); bc = blockCipherFind(argv[1]); keybits = atoi(argv[2]); if (!bc) { fprintf(stderr, "Illegal blockcipher name\n"); usage(); } if (argc == 4) { size = atoi(argv[2]); if (size <= 0) usage(); } return benchmark(bc, keybits, size); } beecrypt-4.2.1/tests/testripemd128.c0000644000175000001440000000436411216207052014174 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testripemd128.c * \brief Unit test program for the RIPEMD-128 algorithm. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/ripemd128.h" #include "beecrypt/memchunk.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[3] = { { 0, (byte*) "", (byte*) "\xcd\xf2\x62\x13\xa1\x50\xdc\x3e\xcb\x61\x0f\x18\xf6\xb3\x8b\x46" }, { 3, (byte*) "abc", (byte*) "\xc1\x4a\x12\x19\x9c\x66\xe4\xba\x84\x63\x6b\x0f\x69\x14\x4c\x77" }, { 56, (byte*) "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", (byte*) "\xa1\xaa\x06\x89\xd0\xfa\xfa\x2d\xdc\x22\xe8\x8b\x49\x13\x3a\x06" } }; void hexdump(const byte* b, int count) { int i; for (i = 0; i < count; i++) { printf("%02x", b[i]); if ((i & 0xf) == 0xf) printf("\n"); } if (i & 0xf) printf("\n"); } int main() { int i, failures = 0; byte digest[16]; ripemd128Param param; for (i = 0; i < 1; i++) { if (ripemd128Reset(¶m)) return -1; if (ripemd128Update(¶m, table[i].input, table[i].input_size)) return -1; if (ripemd128Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 16)) { printf("failed test vector %d\n", i+1); printf("expected:\n"); hexdump(table[i].expect, 16); printf("got:\n"); hexdump(digest, 16); failures++; } } return failures; } beecrypt-4.2.1/tests/testelgamal.c0000644000175000001440000000453011216102567014063 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testelgamal.c * \brief Unit test program for elgamal. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/beecrypt.h" #include "beecrypt/dldp.h" #include "beecrypt/dlkp.h" #include "beecrypt/elgamal.h" const char* message_to_sign = "73F6679451E5F98CA60235E6B4C58FC14043C56D"; int main() { int failures = 0; dldp_p params; randomGeneratorContext rngc; dldp_pInit(¶ms); if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0) { /* make parameters with p = 512 bits */ if (dldp_pgonMakeSafe(¶ms, &rngc, 512) == 0) { /* params contains both p and n=(p-1) */ dlkp_p keypair; dlkp_pInit(&keypair); if (dlkp_pPair(&keypair, &rngc, ¶ms) == 0) { mpnumber hm; mpnumber r; mpnumber s; mpnzero(&hm); mpnzero(&r); mpnzero(&s); mpnsethex(&hm, message_to_sign); /* try to sign hm */ if (elgv1sign(¶ms.p, ¶ms.n, ¶ms.g, &rngc, &hm, &keypair.x, &r, &s) == 0) { /* try the verification */ if (elgv1vrfy(¶ms.p, ¶ms.n, ¶ms.g, &hm, &keypair.y, &r, &s) == 0) { /* failure in verification */ failures++; } } else { /* failure in signing */ failures++; } mpnfree(&hm); mpnfree(&r); mpnfree(&s); dlkp_pFree(&keypair); } dldp_pFree(¶ms); } else { printf("safe parameter generation failure\n"); return -1; } randomGeneratorContextFree(&rngc); } else { printf("random generator failure\n"); return -1; } return failures; } beecrypt-4.2.1/tests/testmd5.c0000664000175000001440000000460510503176030013145 00000000000000/* * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testmd5.c * \brief Unit test program for the MD5 algorithm; it tests all vectors * specified by RFC 1321. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/md5.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[7] = { { 0, (byte*) "", (byte*) "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04\xe9\x80\x09\x98\xec\xf8\x42\x7e" }, { 1, (byte*) "a", (byte*) "\x0c\xc1\x75\xb9\xc0\xf1\xb6\xa8\x31\xc3\x99\xe2\x69\x77\x26\x61" }, { 3, (byte*) "abc", (byte*) "\x90\x01\x50\x98\x3c\xd2\x4f\xb0\xd6\x96\x3f\x7d\x28\xe1\x7f\x72" }, { 14, (byte*) "message digest", (byte*) "\xf9\x6b\x69\x7d\x7c\xb7\x93\x8d\x52\x5a\x2f\x31\xaa\xf1\x61\xd0" }, { 26, (byte*) "abcdefghijklmnopqrstuvwxyz", (byte*) "\xc3\xfc\xd3\xd7\x61\x92\xe4\x00\x7d\xfb\x49\x6c\xca\x67\xe1\x3b" }, { 62, (byte*) "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", (byte*) "\xd1\x74\xab\x98\xd2\x77\xd9\xf5\xa5\x61\x1c\x2c\x9f\x41\x9d\x9f" }, { 80, (byte*) "12345678901234567890123456789012345678901234567890123456789012345678901234567890", (byte*) "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55\xac\x49\xda\x2e\x21\x07\xb6\x7a" } }; int main() { int i, failures = 0; byte digest[16]; md5Param param; for (i = 0; i < 7; i++) { if (md5Reset(¶m)) return -1; if (md5Update(¶m, table[i].input, table[i].input_size)) return -1; if (md5Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 16)) { printf("failed test vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/tests/testripemd320.c0000644000175000001440000000502411216206767014174 00000000000000/* * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testripemd320.c * \brief Unit test program for the RIPEMD-320 algorithm. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/ripemd320.h" #include "beecrypt/memchunk.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[3] = { { 0, (byte*) "", (byte*) "\x22\xd6\x5d\x56\x61\x53\x6c\xdc\x75\xc1\xfd\xf5\xc6\xde\x7b\x41\xb9\xf2\x73\x25\xeb\xc6\x1e\x85\x57\x17\x7d\x70\x5a\x0e\xc8\x80\x15\x1c\x3a\x32\xa0\x08\x99\xb8" }, { 3, (byte*) "abc", (byte*) "\xde\x4c\x01\xb3\x05\x4f\x89\x30\xa7\x9d\x09\xae\x73\x8e\x92\x30\x1e\x5a\x17\x08\x5b\xef\xfd\xc1\xb8\xd1\x16\x71\x3e\x74\xf8\x2f\xa9\x42\xd6\x4c\xdb\xc4\x68\x2d" }, { 56, (byte*) "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", (byte*) "\xd0\x34\xa7\x95\x0c\xf7\x22\x02\x1b\xa4\xb8\x4d\xf7\x69\xa5\xde\x20\x60\xe2\x59\xdf\x4c\x9b\xb4\xa4\x26\x8c\x0e\x93\x5b\xbc\x74\x70\xa9\x69\xc9\xd0\x72\xa1\xac" } }; void hexdump(const byte* b, int count) { int i; for (i = 0; i < count; i++) { printf("%02x", b[i]); if ((i & 0xf) == 0xf) printf("\n"); } if (i & 0xf) printf("\n"); } int main() { int i, failures = 0; byte digest[40]; ripemd320Param param; for (i = 0; i < 1; i++) { if (ripemd320Reset(¶m)) return -1; if (ripemd320Update(¶m, table[i].input, table[i].input_size)) return -1; if (ripemd320Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 40)) { printf("failed test vector %d\n", i+1); printf("expected:\n"); hexdump(table[i].expect, 40); printf("got:\n"); hexdump(digest, 40); failures++; } } return failures; } beecrypt-4.2.1/tests/testmp.c0000664000175000001440000000352610503176301013076 00000000000000#include #include "beecrypt/beecrypt.h" #include "beecrypt/mp.h" #define INIT 0xdeadbeefU; static const mpw Z[4] = { 0U, 0U, 0U, 0U }; static const mpw F[4] = { MP_ALLMASK, MP_ALLMASK, MP_ALLMASK, MP_ALLMASK}; static const mpw P[8] = { MP_ALLMASK, MP_ALLMASK, MP_ALLMASK, MP_ALLMASK-1U, 0U, 0U, 0U, 1U }; static const mpw SM[5] = { MP_ALLMASK-1U, MP_ALLMASK, MP_ALLMASK, MP_ALLMASK, 1U }; int main() { int i, carry; mpw x[4]; /* mpw y[4]; */ mpw r[8]; for (i = 0; i < 4; i++) x[i] = INIT; mpcopy(4, x, Z); for (i = 0; i < 4; i++) { if (x[i] != 0) { printf("mpcopy failed\n"); return 1; } } if (!mpeq(4, x, Z)) { printf("mpeq failed\n"); return 1; } if (mpne(4, x, Z)) { printf("mpne failed\n"); return 1; } mpcopy(4, x, F); for (i = 0; i < 4; i++) { if (x[i] != ~((mpw) 0)) { printf("mpcopy failed\n"); return 1; } } if (!mpz(4, Z) || mpz(4, F)) { printf("mpz failed\n"); return 1; } if (mpnz(4, Z) || !mpnz(4, F)) { printf("mpnz failed\n"); return 1; } if (!mpeq(4, x, F)) { printf("mpeq failed\n"); return 1; } if (mpne(4, x, F)) { printf("mpne failed\n"); return 1; } mpcopy(4, x, F); carry = mpaddw(4, x, (mpw) 1U); if (!carry || mpne(4, x, Z)) { printf("mpaddw failed"); return 1; } carry = mpsubw(4, x, (mpw) 1U); if (!carry || mpne(4, x, F)) { printf("mpsubw failed"); return 1; } mpzero(5, r); r[0] = mpsetmul(4, r+1, F, MP_ALLMASK); if (!mpeq(5, r, SM)) { printf("mpsetmul failed"); return 1; } mpzero(5, r); r[0] = mpaddmul(4, r+1, F, MP_ALLMASK); if (!mpeq(5, r, SM)) { printf("mpaddmul failed"); return 1; } mpzero(8, r); mpmul(r, 4, F, 4, F); if (!mpeq(8, r, P)) { printf("mpmul failed\n"); return 1; } mpzero(8, r); mpsqr(r, 4, F); if (!mpeq(8, r, P)) { printf("mpsqr failed\n"); return 1; } return 0; } beecrypt-4.2.1/tests/testsha1.c0000664000175000001440000000352710503176061013322 00000000000000/* * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testsha1.c * \brief Unit test program for the SHA-1 algorithm ; it tests all but one of * the vectors specified by FIPS PUB 180-1. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/sha1.h" #include "beecrypt/memchunk.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[2] = { { 3, (byte*) "abc", (byte*) "\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E\x25\x71\x78\x50\xC2\x6C\x9C\xD0\xD8\x9D" }, { 56, (byte*) "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", (byte*) "\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE\x4A\xA1\xF9\x51\x29\xE5\xE5\x46\x70\xF1" } }; int main() { int i, failures = 0; byte digest[20]; sha1Param param; for (i = 0; i < 2; i++) { if (sha1Reset(¶m)) return -1; if (sha1Update(¶m, table[i].input, table[i].input_size)) return -1; if (sha1Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 20)) { printf("failed test vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/tests/testhmacsha1.c0000664000175000001440000001010510503176212014137 00000000000000/* * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testhmacsha1.c * \brief Unit test program for HMAC-SHA1; it tests all vectors specified * by RFC 2202. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/hmacsha1.h" struct vector { int keybits; byte* key; int input_size; byte* input; byte* expect; }; struct vector table[7] = { { 160, (byte*) "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", 8, (byte*) "Hi There", (byte*) "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00" }, { 32, (byte*) "Jefe", 28, (byte*) "what do ya want for nothing?", (byte*) "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79" }, { 160, (byte*) "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", 50, (byte*) "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", (byte*) "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3" }, { 200, (byte*) "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19", 50, (byte*) "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", (byte*) "\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda" }, { 160, (byte*) "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", 20, (byte*) "Test With Truncation", (byte*) "\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04" }, { 640, (byte*) "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", 54, (byte*) "Test Using Larger Than Block-Size Key - Hash Key First", (byte*) "\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12" }, { 640, (byte*) "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", 73, (byte*) "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", (byte*) "\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91" } }; int main() { int i, failures = 0; byte digest[20]; hmacsha1Param param; for (i = 0; i < 7; i++) { if (hmacsha1Setup(¶m, table[i].key, table[i].keybits)) return -1; if (hmacsha1Update(¶m, table[i].input, table[i].input_size)) return -1; if (hmacsha1Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 20)) { printf("failed test vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/tests/testhmacmd5.c0000664000175000001440000000763510503176166014016 00000000000000/* * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file testhmacmd5.c * \brief Unit test program for HMAC-MD5; it tests all vectors specified * by RFC 2202. * \author Bob Deblier * \ingroup UNIT_m */ #include #include "beecrypt/hmacmd5.h" struct vector { int keybits; byte* key; int input_size; byte* input; byte* expect; }; struct vector table[7] = { { 128, (byte*) "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", 8, (byte*) "Hi There", (byte*) "\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d" }, { 32, (byte*) "Jefe", 28, (byte*) "what do ya want for nothing?", (byte*) "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7\x38" }, { 128, (byte*) "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", 50, (byte*) "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", (byte*) "\x56\xbe\x34\x52\x1d\x14\x4c\x88\xdb\xb8\xc7\x33\xf0\xe8\xb3\xf6" }, { 200, (byte*) "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19", 50, (byte*) "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", (byte*) "\x69\x7e\xaf\x0a\xca\x3a\x3a\xea\x3a\x75\x16\x47\x46\xff\xaa\x79" }, { 128, (byte*) "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", 20, (byte*) "Test With Truncation", (byte*) "\x56\x46\x1e\xf2\x34\x2e\xdc\x00\xf9\xba\xb9\x95\x69\x0e\xfd\x4c"}, { 640, (byte*) "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", 54, (byte*) "Test Using Larger Than Block-Size Key - Hash Key First", (byte*) "\x6b\x1a\xb7\xfe\x4b\xd7\xbf\x8f\x0b\x62\xe6\xce\x61\xb9\xd0\xcd" }, { 640, (byte*) "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", 73, (byte*) "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", (byte*) "\x6f\x63\x0f\xad\x67\xcd\xa0\xee\x1f\xb1\xf5\x62\xdb\x3a\xa5\x3e" } }; int main() { int i, failures = 0; hmacmd5Param param; byte digest[16]; for (i = 0; i < 7; i++) { if (hmacmd5Setup(¶m, table[i].key, table[i].keybits)) return -1; if (hmacmd5Update(¶m, table[i].input, table[i].input_size)) return -1; if (hmacmd5Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 16)) { printf("failed test vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/tests/benchme.c0000664000175000001440000000545010503176506013170 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file benchme.c * \brief Benchmark program for Modular Exponentiation. * \author Bob Deblier */ #include "beecrypt/beecrypt.h" #include "beecrypt/dldp.h" #include "beecrypt/timestamp.h" #include #define SECONDS 10 static const char* hp = "d860d6c36ce3bd73c493e15113abd7ba6cc311d1365ddce4c194b65a96ac47ceab6a9ca7af9bfc871d341bf129e674b903533c7db1f8fad957d679ee14a3cbc5a73bf7f8173f33fb7b6a8a11c24652c2573276b214db3898f51cec3a6ff4263d0c5616502e91055bff6b9717d801c41f4b69eaed911fced89b601edfe73b1103"; static const char* hq = "ea6f6724b9b9152766d01adfee421f48012e4a35"; static const char* hg = "9b01e78dcaca5ae69656bb01c9a1f3b159f7cf8f77781146f916836dbca3a2ebc31cd73fbf7ea864ae5e8d0f24ead4332ce0f039ff5648a5f3514d84dd9632598def5b2da266f15391c031758855329ab15f87d3e612bee4f15ab3fd938a1da37992ea64ea90ceeeae654d9f3844e245951fd56a3c7919b3768c5719b43f3d3f"; int main() { dldp_p params; mpnumber gq; jlong start, now; int iterations = 0; dldp_pInit(¶ms); mpbsethex(¶ms.p, hp); mpbsethex(¶ms.q, hq); mpnsethex(¶ms.g, hg); mpnzero(&gq); /* get starting time */ iterations = 0; start = timestamp(); do { mpbnpowmod(¶ms.p, ¶ms.g, (mpnumber*) ¶ms.q, &gq); now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); printf("(%d bits ^ %d bits) mod (%d bits): %d times in %d seconds\n", (int) mpbits(params.g.size, params.g.data), (int) mpbits(params.q.size, params.q.modl), (int) mpbits(params.p.size, params.p.modl), iterations, SECONDS); /* get starting time */ iterations = 0; start = timestamp(); do { mpbnpowmod(¶ms.p, ¶ms.g, (mpnumber*) ¶ms.g, &gq); now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); printf("(%d bits ^ %d bits) mod (%d bits): %d times in %d seconds\n", (int) mpbits(params.g.size, params.g.data), (int) mpbits(params.g.size, params.g.data), (int) mpbits(params.p.size, params.p.modl), iterations, SECONDS); mpnfree(&gq); dldp_pFree(¶ms); return 0; } beecrypt-4.2.1/tests/benchhf.c0000664000175000001440000000461710254472405013170 00000000000000/* * Copyright (c) 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file benchhf.c * \brief Benchmark program for Hash Functions. * \author Bob Deblier */ #include "beecrypt/beecrypt.h" #include "beecrypt/timestamp.h" #include #define SECONDS 10 void validnames() { int i; for (i = 0; i < hashFunctionCount(); i++) { const hashFunction* tmp = hashFunctionGet(i); if (tmp) fprintf(stderr, " %s", tmp->name); } fprintf(stderr, "\n"); } void usage() { fprintf(stderr, "Usage: benchbf []\n"); fprintf(stderr, " can be any of:"); validnames(); exit(1); } int benchmark(const hashFunction* hf, int size) { hashFunctionContext hfc; void* data = (void*) malloc(size << 10); if (hashFunctionContextInit(&hfc, hf)) return -1; if (data) { double exact, speed; jlong start, now; int iterations = 0; /* get starting time */ start = timestamp(); do { if (hashFunctionContextUpdate(&hfc, data, size << 10)) return -1; now = timestamp(); iterations++; } while (now < (start + (SECONDS * ONE_SECOND))); exact = (now - start); exact /= ONE_SECOND; speed = (iterations * size) / exact; printf("hashed %d KB in %.2f seconds = %.2f KB/s\n", iterations * size, exact, speed); free(data); } if (hashFunctionContextFree(&hfc)) return -1; return 0; } int main(int argc, char* argv[]) { const hashFunction* hf; int size = 1024; if (argc < 2 || argc > 4) usage(); hf = hashFunctionFind(argv[1]); if (!hf) { fprintf(stderr, "Illegal hash function name\n"); usage(); } if (argc == 3) { size = atoi(argv[2]); if (size <= 0) usage(); } return benchmark(hf, size); } beecrypt-4.2.1/tests/testsha224.c0000644000175000001440000000345011216102623013455 00000000000000/* * testsha224.c * * Unit test program for SHA-224; it implements the test vectors from IETF RFC 3874. * * Copyright (c) 2009 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include "beecrypt/sha224.h" struct vector { int input_size; byte* input; byte* expect; }; struct vector table[2] = { { 3, (byte*) "abc", (byte*) "\x23\x09\x7d\x22\x34\x05\xd8\x22\x86\x42\xa4\x77\xbd\xa2\x55\xb3\x2a\xad\xbc\xe4\xbd\xa0\xb3\xf7\xe3\x6c\x9d\xa7" }, { 56, (byte*) "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", (byte*) "\x75\x38\x8b\x16\x51\x27\x76\xcc\x5d\xba\x5d\xa1\xfd\x89\x01\x50\xb0\xc6\x45\x5c\xb4\xf5\x8b\x19\x52\x52\x25\x25" } }; int main() { int i, failures = 0; sha224Param param; byte digest[32]; for (i = 0; i < 2; i++) { if (sha224Reset(¶m)) return -1; if (sha224Update(¶m, table[i].input, table[i].input_size)) return -1; if (sha224Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 28)) { printf("failed test vector %d\n", i+1); failures++; } } return failures; } beecrypt-4.2.1/blockpad.c0000644000175000001440000000474311216147021012176 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file blockpad.c * \brief Blockcipher padding algorithms. * \author Bob Deblier * \ingroup BC_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/blockpad.h" memchunk* pkcs5Pad(size_t blockbytes, memchunk* tmp) { if (tmp) { byte padvalue = blockbytes - (tmp->size % blockbytes); tmp = memchunkResize(tmp, tmp->size + padvalue); if (tmp) memset(tmp->data - padvalue, padvalue, padvalue); } return tmp; } memchunk* pkcs5Unpad(size_t blockbytes, memchunk* tmp) { if (tmp) { byte padvalue = tmp->data[tmp->size - 1]; unsigned int i; if (padvalue > blockbytes) return (memchunk*) 0; for (i = (tmp->size - padvalue); i < (tmp->size - 1); i++) { if (tmp->data[i] != padvalue) return (memchunk*) 0; } tmp->size -= padvalue; /* tmp->data = (byte*) realloc(tmp->data, tmp->size); */ } return tmp; } memchunk* pkcs5PadCopy(size_t blockbytes, const memchunk* src) { memchunk* tmp; byte padvalue = blockbytes - (src->size % blockbytes); if (src == (memchunk*) 0) return (memchunk*) 0; tmp = memchunkAlloc(src->size + padvalue); if (tmp) { memcpy(tmp->data, src->data, src->size); memset(tmp->data+src->size, padvalue, padvalue); } return tmp; } memchunk* pkcs5UnpadCopy(size_t blockbytes, const memchunk* src) { memchunk* tmp; byte padvalue; unsigned int i; if (src == (memchunk*) 0) return (memchunk*) 0; padvalue = src->data[src->size - 1]; for (i = (src->size - padvalue); i < (src->size - 1); i++) { if (src->data[i] != padvalue) return (memchunk*) 0; } tmp = memchunkAlloc(src->size - padvalue); if (tmp) memcpy(tmp->data, src->data, tmp->size); return tmp; } beecrypt-4.2.1/sha2k64.c0000644000175000001440000001142611216102377011602 00000000000000/* Copyright (c) 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha2k64.c * \brief SHA-512 and SHA-384 hash function constants, as specified by NIST FIPS 180-2. * \author Bob Deblier * \ingroup HASH_sha512_m HASH_sha_384_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha2k64.h" const uint64_t SHA2_64BIT_K[80] = { #if (SIZEOF_UNSIGNED_LONG == 8) || !HAVE_UNSIGNED_LONG_LONG 0x428a2f98d728ae22UL, 0x7137449123ef65cdUL, 0xb5c0fbcfec4d3b2fUL, 0xe9b5dba58189dbbcUL, 0x3956c25bf348b538UL, 0x59f111f1b605d019UL, 0x923f82a4af194f9bUL, 0xab1c5ed5da6d8118UL, 0xd807aa98a3030242UL, 0x12835b0145706fbeUL, 0x243185be4ee4b28cUL, 0x550c7dc3d5ffb4e2UL, 0x72be5d74f27b896fUL, 0x80deb1fe3b1696b1UL, 0x9bdc06a725c71235UL, 0xc19bf174cf692694UL, 0xe49b69c19ef14ad2UL, 0xefbe4786384f25e3UL, 0x0fc19dc68b8cd5b5UL, 0x240ca1cc77ac9c65UL, 0x2de92c6f592b0275UL, 0x4a7484aa6ea6e483UL, 0x5cb0a9dcbd41fbd4UL, 0x76f988da831153b5UL, 0x983e5152ee66dfabUL, 0xa831c66d2db43210UL, 0xb00327c898fb213fUL, 0xbf597fc7beef0ee4UL, 0xc6e00bf33da88fc2UL, 0xd5a79147930aa725UL, 0x06ca6351e003826fUL, 0x142929670a0e6e70UL, 0x27b70a8546d22ffcUL, 0x2e1b21385c26c926UL, 0x4d2c6dfc5ac42aedUL, 0x53380d139d95b3dfUL, 0x650a73548baf63deUL, 0x766a0abb3c77b2a8UL, 0x81c2c92e47edaee6UL, 0x92722c851482353bUL, 0xa2bfe8a14cf10364UL, 0xa81a664bbc423001UL, 0xc24b8b70d0f89791UL, 0xc76c51a30654be30UL, 0xd192e819d6ef5218UL, 0xd69906245565a910UL, 0xf40e35855771202aUL, 0x106aa07032bbd1b8UL, 0x19a4c116b8d2d0c8UL, 0x1e376c085141ab53UL, 0x2748774cdf8eeb99UL, 0x34b0bcb5e19b48a8UL, 0x391c0cb3c5c95a63UL, 0x4ed8aa4ae3418acbUL, 0x5b9cca4f7763e373UL, 0x682e6ff3d6b2b8a3UL, 0x748f82ee5defb2fcUL, 0x78a5636f43172f60UL, 0x84c87814a1f0ab72UL, 0x8cc702081a6439ecUL, 0x90befffa23631e28UL, 0xa4506cebde82bde9UL, 0xbef9a3f7b2c67915UL, 0xc67178f2e372532bUL, 0xca273eceea26619cUL, 0xd186b8c721c0c207UL, 0xeada7dd6cde0eb1eUL, 0xf57d4f7fee6ed178UL, 0x06f067aa72176fbaUL, 0x0a637dc5a2c898a6UL, 0x113f9804bef90daeUL, 0x1b710b35131c471bUL, 0x28db77f523047d84UL, 0x32caab7b40c72493UL, 0x3c9ebe0a15c9bebcUL, 0x431d67c49c100d4cUL, 0x4cc5d4becb3e42b6UL, 0x597f299cfc657e2aUL, 0x5fcb6fab3ad6faecUL, 0x6c44198c4a475817UL #else 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL #endif }; beecrypt-4.2.1/install-sh0000755000175000001440000003253711225166714012273 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: beecrypt-4.2.1/ripemd128.c0000644000175000001440000003017711216403125012132 00000000000000/* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file ripemd128.c * \brief RIPEMD-128 hash function. * \author Jeff Johnson * \author Bob Deblier * \ingroup HASH_m HASH_ripemd128_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/ripemd128.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_ripemd128_m * \{ */ /*@unchecked@*/ /*@observer@*/ static uint32_t ripemd128hinit[4] = { 0x67452301U, 0xefcdab89U, 0x98badcfeU, 0x10325476U }; /*@-sizeoftype@*/ /*@unchecked@*/ /*@observer@*/ const hashFunction ripemd128 = { .name = "RIPEMD-128", .paramsize = sizeof(ripemd128Param), .blocksize = 64, .digestsize = 16, .reset = (hashFunctionReset) ripemd128Reset, .update = (hashFunctionUpdate) ripemd128Update, .digest = (hashFunctionDigest) ripemd128Digest }; /*@=sizeoftype@*/ int ripemd128Reset(register ripemd128Param* mp) { /*@-sizeoftype@*/ memcpy(mp->h, ripemd128hinit, 4 * sizeof(uint32_t)); memset(mp->data, 0, 16 * sizeof(uint32_t)); /*@=sizeoftype@*/ #if (MP_WBITS == 64) mpzero(1, mp->length); #elif (MP_WBITS == 32) mpzero(2, mp->length); #else # error #endif mp->offset = 0; return 0; } #define LSR1(a, b, c, d, x, s) \ a = ROTL32((b^c^d) + a + x, s); #define LSR2(a, b, c, d, x, s) \ a = ROTL32(((b&c)|(~b&d)) + a + x + 0x5a827999U, s); #define LSR3(a, b, c, d, x, s) \ a = ROTL32(((b|~c)^d) + a + x + 0x6ed9eba1U, s); #define LSR4(a, b, c, d, x, s) \ a = ROTL32(((b&d)|(c&~d)) + a + x + 0x8f1bbcdcU, s); #define RSR4(a, b, c, d, x, s) \ a = ROTL32((b^c^d) + a + x, s); #define RSR3(a, b, c, d, x, s) \ a = ROTL32(((b&c)|(~b&d)) + a + x + 0x6d703ef3U, s); #define RSR2(a, b, c, d, x, s) \ a = ROTL32(((b|~c)^d) + a + x + 0x5c4dd124U, s); #define RSR1(a, b, c, d, x, s) \ a = ROTL32(((b&d)|(c&~d)) + a + x + 0x50a28be6U, s); #ifndef ASM_RIPEMD128PROCESS void ripemd128Process(ripemd128Param* mp) { register uint32_t la, lb, lc, ld; register uint32_t ra, rb, rc, rd; register uint32_t* x; #ifdef WORDS_BIGENDIAN register byte t; #endif x = mp->data; #ifdef WORDS_BIGENDIAN t = 16; while (t--) { register uint32_t temp = swapu32(*x); *(x++) = temp; } x = mp->data; #endif la = mp->h[0]; lb = mp->h[1]; lc = mp->h[2]; ld = mp->h[3]; ra = mp->h[0]; rb = mp->h[1]; rc = mp->h[2]; rd = mp->h[3]; /* In theory OpenMP would allows us to do the 'left' and 'right' sections in parallel, * but in practice the overhead make the code much slower */ /* left round 1 */ LSR1(la, lb, lc, ld, x[ 0], 11); LSR1(ld, la, lb, lc, x[ 1], 14); LSR1(lc, ld, la, lb, x[ 2], 15); LSR1(lb, lc, ld, la, x[ 3], 12); LSR1(la, lb, lc, ld, x[ 4], 5); LSR1(ld, la, lb, lc, x[ 5], 8); LSR1(lc, ld, la, lb, x[ 6], 7); LSR1(lb, lc, ld, la, x[ 7], 9); LSR1(la, lb, lc, ld, x[ 8], 11); LSR1(ld, la, lb, lc, x[ 9], 13); LSR1(lc, ld, la, lb, x[10], 14); LSR1(lb, lc, ld, la, x[11], 15); LSR1(la, lb, lc, ld, x[12], 6); LSR1(ld, la, lb, lc, x[13], 7); LSR1(lc, ld, la, lb, x[14], 9); LSR1(lb, lc, ld, la, x[15], 8); /* left round 2 */ LSR2(la, lb, lc, ld, x[ 7], 7); LSR2(ld, la, lb, lc, x[ 4], 6); LSR2(lc, ld, la, lb, x[13], 8); LSR2(lb, lc, ld, la, x[ 1], 13); LSR2(la, lb, lc, ld, x[10], 11); LSR2(ld, la, lb, lc, x[ 6], 9); LSR2(lc, ld, la, lb, x[15], 7); LSR2(lb, lc, ld, la, x[ 3], 15); LSR2(la, lb, lc, ld, x[12], 7); LSR2(ld, la, lb, lc, x[ 0], 12); LSR2(lc, ld, la, lb, x[ 9], 15); LSR2(lb, lc, ld, la, x[ 5], 9); LSR2(la, lb, lc, ld, x[ 2], 11); LSR2(ld, la, lb, lc, x[14], 7); LSR2(lc, ld, la, lb, x[11], 13); LSR2(lb, lc, ld, la, x[ 8], 12); /* left round 3 */ LSR3(la, lb, lc, ld, x[ 3], 11); LSR3(ld, la, lb, lc, x[10], 13); LSR3(lc, ld, la, lb, x[14], 6); LSR3(lb, lc, ld, la, x[ 4], 7); LSR3(la, lb, lc, ld, x[ 9], 14); LSR3(ld, la, lb, lc, x[15], 9); LSR3(lc, ld, la, lb, x[ 8], 13); LSR3(lb, lc, ld, la, x[ 1], 15); LSR3(la, lb, lc, ld, x[ 2], 14); LSR3(ld, la, lb, lc, x[ 7], 8); LSR3(lc, ld, la, lb, x[ 0], 13); LSR3(lb, lc, ld, la, x[ 6], 6); LSR3(la, lb, lc, ld, x[13], 5); LSR3(ld, la, lb, lc, x[11], 12); LSR3(lc, ld, la, lb, x[ 5], 7); LSR3(lb, lc, ld, la, x[12], 5); /* left round 4 */ LSR4(la, lb, lc, ld, x[ 1], 11); LSR4(ld, la, lb, lc, x[ 9], 12); LSR4(lc, ld, la, lb, x[11], 14); LSR4(lb, lc, ld, la, x[10], 15); LSR4(la, lb, lc, ld, x[ 0], 14); LSR4(ld, la, lb, lc, x[ 8], 15); LSR4(lc, ld, la, lb, x[12], 9); LSR4(lb, lc, ld, la, x[ 4], 8); LSR4(la, lb, lc, ld, x[13], 9); LSR4(ld, la, lb, lc, x[ 3], 14); LSR4(lc, ld, la, lb, x[ 7], 5); LSR4(lb, lc, ld, la, x[15], 6); LSR4(la, lb, lc, ld, x[14], 8); LSR4(ld, la, lb, lc, x[ 5], 6); LSR4(lc, ld, la, lb, x[ 6], 5); LSR4(lb, lc, ld, la, x[ 2], 12); /* right round 1 */ RSR1(ra, rb, rc, rd, x[ 5], 8); RSR1(rd, ra, rb, rc, x[14], 9); RSR1(rc, rd, ra, rb, x[ 7], 9); RSR1(rb, rc, rd, ra, x[ 0], 11); RSR1(ra, rb, rc, rd, x[ 9], 13); RSR1(rd, ra, rb, rc, x[ 2], 15); RSR1(rc, rd, ra, rb, x[11], 15); RSR1(rb, rc, rd, ra, x[ 4], 5); RSR1(ra, rb, rc, rd, x[13], 7); RSR1(rd, ra, rb, rc, x[ 6], 7); RSR1(rc, rd, ra, rb, x[15], 8); RSR1(rb, rc, rd, ra, x[ 8], 11); RSR1(ra, rb, rc, rd, x[ 1], 14); RSR1(rd, ra, rb, rc, x[10], 14); RSR1(rc, rd, ra, rb, x[ 3], 12); RSR1(rb, rc, rd, ra, x[12], 6); /* right round 2 */ RSR2(ra, rb, rc, rd, x[ 6], 9); RSR2(rd, ra, rb, rc, x[11], 13); RSR2(rc, rd, ra, rb, x[ 3], 15); RSR2(rb, rc, rd, ra, x[ 7], 7); RSR2(ra, rb, rc, rd, x[ 0], 12); RSR2(rd, ra, rb, rc, x[13], 8); RSR2(rc, rd, ra, rb, x[ 5], 9); RSR2(rb, rc, rd, ra, x[10], 11); RSR2(ra, rb, rc, rd, x[14], 7); RSR2(rd, ra, rb, rc, x[15], 7); RSR2(rc, rd, ra, rb, x[ 8], 12); RSR2(rb, rc, rd, ra, x[12], 7); RSR2(ra, rb, rc, rd, x[ 4], 6); RSR2(rd, ra, rb, rc, x[ 9], 15); RSR2(rc, rd, ra, rb, x[ 1], 13); RSR2(rb, rc, rd, ra, x[ 2], 11); /* right round 3 */ RSR3(ra, rb, rc, rd, x[15], 9); RSR3(rd, ra, rb, rc, x[ 5], 7); RSR3(rc, rd, ra, rb, x[ 1], 15); RSR3(rb, rc, rd, ra, x[ 3], 11); RSR3(ra, rb, rc, rd, x[ 7], 8); RSR3(rd, ra, rb, rc, x[14], 6); RSR3(rc, rd, ra, rb, x[ 6], 6); RSR3(rb, rc, rd, ra, x[ 9], 14); RSR3(ra, rb, rc, rd, x[11], 12); RSR3(rd, ra, rb, rc, x[ 8], 13); RSR3(rc, rd, ra, rb, x[12], 5); RSR3(rb, rc, rd, ra, x[ 2], 14); RSR3(ra, rb, rc, rd, x[10], 13); RSR3(rd, ra, rb, rc, x[ 0], 13); RSR3(rc, rd, ra, rb, x[ 4], 7); RSR3(rb, rc, rd, ra, x[13], 5); /* right round 4 */ RSR4(ra, rb, rc, rd, x[ 8], 15); RSR4(rd, ra, rb, rc, x[ 6], 5); RSR4(rc, rd, ra, rb, x[ 4], 8); RSR4(rb, rc, rd, ra, x[ 1], 11); RSR4(ra, rb, rc, rd, x[ 3], 14); RSR4(rd, ra, rb, rc, x[11], 14); RSR4(rc, rd, ra, rb, x[15], 6); RSR4(rb, rc, rd, ra, x[ 0], 14); RSR4(ra, rb, rc, rd, x[ 5], 6); RSR4(rd, ra, rb, rc, x[12], 9); RSR4(rc, rd, ra, rb, x[ 2], 12); RSR4(rb, rc, rd, ra, x[13], 9); RSR4(ra, rb, rc, rd, x[ 9], 12); RSR4(rd, ra, rb, rc, x[ 7], 5); RSR4(rc, rd, ra, rb, x[10], 15); RSR4(rb, rc, rd, ra, x[14], 8); /* combine results */ rd += lc + mp->h[1]; mp->h[1] = mp->h[2] + ld + ra; mp->h[2] = mp->h[3] + la + rb; mp->h[3] = mp->h[0] + lb + rc; mp->h[0] = rd; } #endif int ripemd128Update(ripemd128Param* mp, const byte* data, size_t size) { register uint32_t proclength; #if (MP_WBITS == 64) mpw add[1]; mpsetw(1, add, size); mplshift(1, add, 3); mpadd(1, mp->length, add); #elif (MP_WBITS == 32) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); (void) mpadd(2, mp->length, add); #else # error #endif while (size > 0) { proclength = ((mp->offset + size) > 64U) ? (64U - mp->offset) : size; /*@-mayaliasunique@*/ memcpy(((byte *) mp->data) + mp->offset, data, proclength); /*@=mayaliasunique@*/ size -= proclength; data += proclength; mp->offset += proclength; if (mp->offset == 64U) { ripemd128Process(mp); mp->offset = 0; } } return 0; } static void ripemd128Finish(ripemd128Param* mp) /*@modifies mp @*/ { register byte *ptr = ((byte *) mp->data) + mp->offset++; *(ptr++) = 0x80; if (mp->offset > 56) { while (mp->offset++ < 64) *(ptr++) = 0; ripemd128Process(mp); mp->offset = 0; } ptr = ((byte *) mp->data) + mp->offset; while (mp->offset++ < 56) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[0] = (byte)(mp->length[0] ); ptr[1] = (byte)(mp->length[0] >> 8); ptr[2] = (byte)(mp->length[0] >> 16); ptr[3] = (byte)(mp->length[0] >> 24); ptr[4] = (byte)(mp->length[0] >> 32); ptr[5] = (byte)(mp->length[0] >> 40); ptr[6] = (byte)(mp->length[0] >> 48); ptr[7] = (byte)(mp->length[0] >> 56); #elif (MP_WBITS == 32) ptr[0] = (byte)(mp->length[1] ); ptr[1] = (byte)(mp->length[1] >> 8); ptr[2] = (byte)(mp->length[1] >> 16); ptr[3] = (byte)(mp->length[1] >> 24); ptr[4] = (byte)(mp->length[0] ); ptr[5] = (byte)(mp->length[0] >> 8); ptr[6] = (byte)(mp->length[0] >> 16); ptr[7] = (byte)(mp->length[0] >> 24); #else # error #endif ripemd128Process(mp); mp->offset = 0; } /*@-protoparammatch@*/ int ripemd128Digest(ripemd128Param* mp, byte* data) { ripemd128Finish(mp); /* encode 4 integers little-endian style */ data[ 0] = (byte)(mp->h[0] ); data[ 1] = (byte)(mp->h[0] >> 8); data[ 2] = (byte)(mp->h[0] >> 16); data[ 3] = (byte)(mp->h[0] >> 24); data[ 4] = (byte)(mp->h[1] ); data[ 5] = (byte)(mp->h[1] >> 8); data[ 6] = (byte)(mp->h[1] >> 16); data[ 7] = (byte)(mp->h[1] >> 24); data[ 8] = (byte)(mp->h[2] ); data[ 9] = (byte)(mp->h[2] >> 8); data[10] = (byte)(mp->h[2] >> 16); data[11] = (byte)(mp->h[2] >> 24); data[12] = (byte)(mp->h[3] ); data[13] = (byte)(mp->h[3] >> 8); data[14] = (byte)(mp->h[3] >> 16); data[15] = (byte)(mp->h[3] >> 24); (void) ripemd128Reset(mp); return 0; } /*@=protoparammatch@*/ /*!\} */ beecrypt-4.2.1/dldp.c0000644000175000001440000002363211225165722011350 00000000000000/* * Copyright (c) 2000, 2001, 2002, 2003 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dldp.c * \brief Discrete Logarithm domain parameters. * \author Bob Deblier * \ingroup DL_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/dldp.h" #include "beecrypt/mp.h" #include "beecrypt/mpprime.h" /*!\addtogroup DL_m * \{ */ static int dldp_pgoqGenerator_w(dldp_p*, randomGeneratorContext*, mpw*); static int dldp_pgonGenerator_w(dldp_p*, randomGeneratorContext*, mpw*); int dldp_pPrivate(const dldp_p* dp, randomGeneratorContext* rgc, mpnumber* x) { /* * Note: the private key is randomly selected to be smaller than q * * This is the variant of Diffie-Hellman as described in IEEE P1363 */ mpbnrnd(&dp->q, rgc, x); return 0; } int dldp_pPrivate_s(const dldp_p* dp, randomGeneratorContext* rgc, mpnumber* x, size_t xbits) { /* * Note: the private key is randomly selected smaller than q with xbits < mpbits(q) * */ mpbnrnd(&dp->q, rgc, x); mpntrbits(x, xbits); return 0; } int dldp_pPublic(const dldp_p* dp, const mpnumber* x, mpnumber* y) { /* * Public key y is computed as g^x mod p */ mpbnpowmod(&dp->p, &dp->g, x, y); return 0; } int dldp_pPair(const dldp_p* dp, randomGeneratorContext* rgc, mpnumber* x, mpnumber* y) { /* * Combination of the two previous functions */ mpbnrnd(&dp->q, rgc, x); mpbnpowmod(&dp->p, &dp->g, x, y); return 0; } int dldp_pPair_s(const dldp_p* dp, randomGeneratorContext* rgc, mpnumber* x, mpnumber* y, size_t xbits) { mpbnrnd(&dp->q, rgc, x); mpntrbits(x, xbits); mpbnpowmod(&dp->p, &dp->g, x, y); return 0; } int dldp_pEqual(const dldp_p* a, const dldp_p* b) { return mpeqx(a->p.size, a->p.modl, b->p.size, b->p.modl) && mpeqx(a->q.size, a->q.modl, b->q.size, b->q.modl) && mpeqx(a->g.size, a->g.data, b->g.size, b->g.data); } /* * needs to make workspace of 8*size+2 */ int dldp_pValidate(const dldp_p* dp, randomGeneratorContext* rgc) { register size_t size = dp->p.size; register mpw* temp = (mpw*) malloc((8*size+2) * sizeof(mpw)); if (temp) { /* check that p > 2 and p odd, then run miller-rabin test with t 50 */ if (mpeven(dp->p.size, dp->p.modl)) { free(temp); return 0; } if (mppmilrab_w(&dp->p, rgc, 50, temp) == 0) { free(temp); return 0; } /* check that q > 2 and q odd, then run miller-rabin test with t 50 */ if (mpeven(dp->q.size, dp->q.modl)) { free(temp); return 0; } if (mppmilrab_w(&dp->q, rgc, 50, temp) == 0) { free(temp); return 0; } free(temp); /* check that 1 < g < p */ if (mpleone(dp->g.size, dp->g.data)) return 0; if (mpgex(dp->g.size, dp->g.data, dp->p.size, dp->p.modl)) return 0; return 1; } return -1; } int dldp_pInit(dldp_p* dp) { mpbzero(&dp->p); mpbzero(&dp->q); mpnzero(&dp->g); mpnzero(&dp->r); mpbzero(&dp->n); return 0; } int dldp_pFree(dldp_p* dp) { mpbfree(&dp->p); mpbfree(&dp->q); mpnfree(&dp->g); mpnfree(&dp->r); mpbfree(&dp->n); return 0; } int dldp_pCopy(dldp_p* dst, const dldp_p* src) { mpbcopy(&dst->p, &src->p); mpbcopy(&dst->q, &src->q); mpncopy(&dst->r, &src->r); mpncopy(&dst->g, &src->g); mpbcopy(&dst->n, &src->n); return 0; } int dldp_pgoqMake(dldp_p* dp, randomGeneratorContext* rgc, size_t pbits, size_t qbits, int cofactor) { /* * Generate parameters as described by IEEE P1363, A.16.1 */ register size_t psize = MP_BITS_TO_WORDS(pbits + MP_WBITS - 1); register mpw* temp = (mpw*) malloc((8*psize+2) * sizeof(mpw)); if (temp) { /* first generate q */ mpprnd_w(&dp->q, rgc, qbits, mpptrials(qbits), (const mpnumber*) 0, temp); /* generate p with the appropriate congruences */ mpprndconone_w(&dp->p, rgc, pbits, mpptrials(pbits), &dp->q, (const mpnumber*) 0, &dp->r, cofactor, temp); /* clear n */ mpbzero(&dp->n); /* clear g */ mpnzero(&dp->g); dldp_pgoqGenerator_w(dp, rgc, temp); free(temp); return 0; } return -1; } int dldp_pgoqMakeSafe(dldp_p* dp, randomGeneratorContext* rgc, size_t bits) { /* * Generate parameters with a safe prime; p = 2q+1 i.e. r=2 * */ register size_t size = MP_BITS_TO_WORDS(bits + MP_WBITS - 1); register mpw* temp = (mpw*) malloc((8*size+2) * sizeof(mpw)); if (temp) { /* generate p */ mpprndsafe_w(&dp->p, rgc, bits, mpptrials(bits), temp); /* set q */ mpcopy(size, temp, dp->p.modl); mpdivtwo(size, temp); mpbset(&dp->q, size, temp); /* set r = 2 */ mpnsetw(&dp->r, 2); /* clear n */ mpbzero(&dp->n); dldp_pgoqGenerator_w(dp, rgc, temp); free(temp); return 0; } return -1; } int dldp_pgoqGenerator_w(dldp_p* dp, randomGeneratorContext* rgc, mpw* wksp) { /* * Randomly determine a generator over the subgroup with order q */ register size_t size = dp->p.size; mpnfree(&dp->g); mpnsize(&dp->g, size); while (1) { /* get a random value h (stored into g) */ mpbrnd_w(&dp->p, rgc, dp->g.data, wksp); /* first compute h^r mod p (stored in g) */ mpbpowmod_w(&dp->p, size, dp->g.data, dp->r.size, dp->r.data, dp->g.data, wksp); if (mpisone(size, dp->g.data)) continue; return 0; } return -1; } int dldp_pgoqGenerator(dldp_p* dp, randomGeneratorContext* rgc) { register size_t size = dp->p.size; register mpw* temp = (mpw*) malloc((4*size+2)*sizeof(mpw)); if (temp) { dldp_pgoqGenerator_w(dp, rgc, temp); free(temp); return 0; } return -1; } int dldp_pgoqValidate(const dldp_p* dp, randomGeneratorContext* rgc, int cofactor) { register int rc = dldp_pValidate(dp, rgc); if (rc <= 0) return rc; /* check that g^q mod p = 1 */ /* if r != 0, then check that qr+1 = p */ /* if cofactor, then check that q does not divide (r) */ return 1; } int dldp_pgonMake(dldp_p* dp, randomGeneratorContext* rgc, size_t pbits, size_t qbits) { /* * Generate parameters with a prime p such that p = qr+1, with q prime, and r = 2s, with s prime */ register size_t psize = MP_BITS_TO_WORDS(pbits + MP_WBITS - 1); register mpw* temp = (mpw*) malloc((8*psize+2) * sizeof(mpw)); if (temp) { /* generate q */ mpprnd_w(&dp->q, rgc, qbits, mpptrials(qbits), (const mpnumber*) 0, temp); /* generate p with the appropriate congruences */ mpprndconone_w(&dp->p, rgc, pbits, mpptrials(pbits), &dp->q, (const mpnumber*) 0, &dp->r, 2, temp); /* set n */ mpbsubone(&dp->p, temp); mpbset(&dp->n, psize, temp); dldp_pgonGenerator_w(dp, rgc, temp); free(temp); return 0; } return -1; } int dldp_pgonMakeSafe(dldp_p* dp, randomGeneratorContext* rgc, size_t pbits) { /* * Generate parameters with a safe prime; i.e. p = 2q+1, where q is prime */ register size_t psize = MP_BITS_TO_WORDS(pbits + MP_WBITS - 1); register mpw* temp = (mpw*) malloc((8*psize+2) * sizeof(mpw)); if (temp) { /* generate safe p */ mpprndsafe_w(&dp->p, rgc, pbits, mpptrials(pbits), temp); /* set n */ mpbsubone(&dp->p, temp); mpbset(&dp->n, psize, temp); /* set q */ mpdivtwo(psize, temp); mpbset(&dp->q, psize, temp); /* set r = 2 */ mpnsetw(&dp->r, 2); dldp_pgonGenerator_w(dp, rgc, temp); free(temp); return 0; } return -1; } int dldp_pgonGenerator_w(dldp_p* dp, randomGeneratorContext* rgc, mpw* wksp) { register size_t size = dp->p.size; mpnfree(&dp->g); mpnsize(&dp->g, size); while (1) { mpbrnd_w(&dp->p, rgc, dp->g.data, wksp); if (mpistwo(dp->r.size, dp->r.data)) { /* * A little math here: the only element in the group which has order 2 is (p-1); * the two group elements raised to power two which result in 1 (mod p) are thus (p-1) and 1 * * mpbrnd_w doesn't return 1 or (p-1), so the test where g^2 mod p = 1 can be safely skipped */ /* check g^q mod p*/ mpbpowmod_w(&dp->p, size, dp->g.data, dp->q.size, dp->q.modl, wksp, wksp+size); if (mpisone(size, wksp)) continue; } else { /* we can either compute g^r, g^2q and g^(qr/2) or * we first compute s = r/2, and then compute g^2s, g^2q and g^qs * * hence we first compute t = g^s * then compute t^2 mod p, and test if one * then compute t^q mod p, and test if one * then compute (g^q mod p)^2 mod p, and test if one */ /* compute s = r/2 */ mpsetx(size, wksp, dp->r.size, dp->r.data); mpdivtwo(size, wksp); /* compute t = g^s mod p */ mpbpowmod_w(&dp->p, size, dp->g.data, size, wksp, wksp+size, wksp+2*size); /* compute t^2 mod p = g^2s mod p = g^r mod p*/ mpbsqrmod_w(&dp->p, size, wksp+size, wksp+size, wksp+2*size); if (mpisone(size, wksp+size)) continue; /* compute t^q mod p = g^qs mod p */ mpbpowmod_w(&dp->p, size, wksp, dp->q.size, dp->q.modl, wksp+size, wksp+2*size); if (mpisone(size, wksp+size)) continue; /* compute g^2q mod p */ mpbpowmod_w(&dp->p, size, dp->g.data, dp->q.size, dp->q.modl, wksp, wksp+size); mpbsqrmod_w(&dp->p, size, wksp, wksp+size, wksp+2*size); if (mpisone(size, wksp+size)) continue; } return 0; } return -1; } int dldp_pgonGenerator(dldp_p* dp, randomGeneratorContext* rgc) { register size_t psize = dp->p.size; register mpw* temp = (mpw*) malloc((8*psize+2) * sizeof(mpw)); if (temp) { dldp_pgonGenerator_w(dp, rgc, temp); free(temp); return 0; } return -1; } int dldp_pgonValidate(const dldp_p* dp, randomGeneratorContext* rgc) { return dldp_pValidate((const dldp_p*) dp, rgc); } /*!\} */ beecrypt-4.2.1/elgamal.c0000644000175000001440000001147111216147021012015 00000000000000/* * Copyright (c) 1999, 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file elgamal.c * \brief ElGamal algorithm. * \author Bob Deblier */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/elgamal.h" #include "beecrypt/dldp.h" int elgv1sign(const mpbarrett* p, const mpbarrett* n, const mpnumber* g, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnumber* r, mpnumber* s) { register size_t size = p->size; register mpw* temp = (mpw*) malloc((8*size+6)*sizeof(mpw)); if (temp) { /* get a random k, invertible modulo (p-1) */ mpbrndinv_w(n, rgc, temp, temp+size, temp+2*size); /* compute r = g^k mod p */ mpnfree(r); mpnsize(r, size); mpbpowmod_w(p, g->size, g->data, size, temp, r->data, temp+2*size); /* compute x*r mod n */ mpbmulmod_w(n, x->size, x->data, r->size, r->data, temp, temp+2*size); /* compute -(x*r) mod n */ mpneg(size, temp); mpadd(size, temp, n->modl); /* compute h(m) - x*r mod n */ mpbaddmod_w(n, hm->size, hm->data, size, temp, temp, temp+2*size); /* compute s = inv(k)*(h(m) - x*r) mod n */ mpnfree(s); mpnsize(s, size); mpbmulmod_w(n, size, temp, size, temp+size, s->data, temp+2*size); free(temp); return 0; } return -1; } int elgv1vrfy(const mpbarrett* p, const mpbarrett* n, const mpnumber* g, const mpnumber* hm, const mpnumber* y, const mpnumber* r, const mpnumber* s) { register size_t size = p->size; register mpw* temp; if (mpz(r->size, r->data)) return 0; if (mpgex(r->size, r->data, size, p->modl)) return 0; if (mpz(s->size, s->data)) return 0; if (mpgex(s->size, s->data, n->size, n->modl)) return 0; temp = (mpw*) malloc((6*size+2)*sizeof(mpw)); if (temp) { register int rc; /* compute u1 = y^r mod p */ mpbpowmod_w(p, y->size, y->data, r->size, r->data, temp, temp+2*size); /* compute u2 = r^s mod p */ mpbpowmod_w(p, r->size, r->data, s->size, s->data, temp+size, temp+2*size); /* compute v1 = u1*u2 mod p */ mpbmulmod_w(p, size, temp, size, temp+size, temp+size, temp+2*size); /* compute v2 = g^h(m) mod p */ mpbpowmod_w(p, g->size, g->data, hm->size, hm->data, temp, temp+2*size); rc = mpeq(size, temp, temp+size); free(temp); return rc; } return 0; } int elgv3sign(const mpbarrett* p, const mpbarrett* n, const mpnumber* g, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnumber* r, mpnumber* s) { register size_t size = p->size; register mpw* temp = (mpw*) malloc((6*size+2)*sizeof(mpw)); if (temp) { /* get a random k */ mpbrnd_w(p, rgc, temp, temp+2*size); /* compute r = g^k mod p */ mpnfree(r); mpnsize(r, size); mpbpowmod_w(p, g->size, g->data, size, temp, r->data, temp+2*size); /* compute u1 = x*r mod n */ mpbmulmod_w(n, x->size, x->data, size, r->data, temp+size, temp+2*size); /* compute u2 = k*h(m) mod n */ mpbmulmod_w(n, size, temp, hm->size, hm->data, temp, temp+2*size); /* compute s = u1+u2 mod n */ mpnfree(s); mpnsize(s, n->size); mpbaddmod_w(n, size, temp, size, temp+size, s->data, temp+2*size); free(temp); return 0; } return -1; } int elgv3vrfy(const mpbarrett* p, const mpbarrett* n, const mpnumber* g, const mpnumber* hm, const mpnumber* y, const mpnumber* r, const mpnumber* s) { register size_t size = p->size; register mpw* temp; if (mpz(r->size, r->data)) return 0; if (mpgex(r->size, r->data, size, p->modl)) return 0; if (mpz(s->size, s->data)) return 0; if (mpgex(s->size, s->data, n->size, n->modl)) return 0; temp = (mpw*) malloc((6*size+2)*sizeof(mpw)); if (temp) { register int rc; /* compute u1 = y^r mod p */ mpbpowmod_w(p, y->size, y->data, r->size, r->data, temp, temp+2*size); /* compute u2 = r^h(m) mod p */ mpbpowmod_w(p, r->size, r->data, hm->size, hm->data, temp+size, temp+2*size); /* compute v2 = u1*u2 mod p */ mpbmulmod_w(p, size, temp, size, temp+size, temp+size, temp+2*size); /* compute v1 = g^s mod p */ mpbpowmod_w(p, g->size, g->data, s->size, s->data, temp, temp+2*size); rc = mpeq(size, temp, temp+size); free(temp); return rc; } return 0; } /*!\} */ beecrypt-4.2.1/missing0000755000175000001440000002623311225166714011662 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: beecrypt-4.2.1/java/0000777000175000001440000000000011226307274011261 500000000000000beecrypt-4.2.1/java/beecrypt_provider_MD4.c0000644000175000001440000000474511225172102015533 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/md4.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_MD4.h" jlong JNICALL Java_beecrypt_provider_MD4_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(md4Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } md4Reset((md4Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_MD4_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(md4Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(md4Param)); return clone; } void JNICALL Java_beecrypt_provider_MD4_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_MD4_digest__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[16]; jbyteArray result = (*env)->NewByteArray(env, 16); md4Digest((md4Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 16, digest); return result; } jint JNICALL Java_beecrypt_provider_MD4_digest__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray buf, jint off, jint len) { if (len < 16) { jclass ex = (*env)->FindClass(env, "java/security/DigestException"); if (ex) (*env)->ThrowNew(env, ex, "len must be at least 16"); } else { jbyte digest[16]; md4Digest((md4Param*) param, digest); (*env)->SetByteArrayRegion(env, buf, off, 16, digest); return 16; } } void JNICALL Java_beecrypt_provider_MD4_reset(JNIEnv* env, jclass dummy, jlong param) { md4Reset((md4Param*) param); } void JNICALL Java_beecrypt_provider_MD4_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { md4Update((md4Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_MD4_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { md4Update((md4Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/src/0000777000175000001440000000000011226307274012050 500000000000000beecrypt-4.2.1/java/src/beecrypt/0000777000175000001440000000000011226307274013665 500000000000000beecrypt-4.2.1/java/src/beecrypt/provider/0000777000175000001440000000000011226307274015517 500000000000000beecrypt-4.2.1/java/src/beecrypt/provider/PKCS12.java0000744000175000001440000000450111226045232017173 00000000000000package beecrypt.provider; import java.io.*; import java.util.*; import java.security.*; import javax.crypto.*; import javax.crypto.interfaces.*; import javax.crypto.spec.*; import beecrypt.beeyond.*; public class PKCS12 { public static final byte ID_CIPHER = 0x1; public static final byte ID_IV = 0x2; public static final byte ID_MAC = 0x3; public static final byte[] deriveKey(MessageDigest md, int blockSize, int keyLength, byte id, byte[] password, byte[] salt, int iterations) { int remain; md.reset(); md.update(id); // hash a whole number of blocks filled with salt data if (salt.length > 0) { remain = ((salt.length / blockSize) + (salt.length % blockSize)) * blockSize; while (remain > 0) { int tmp = (remain > salt.length) ? salt.length : remain; md.update(salt, 0, tmp); remain -= tmp; } } // hash a whole number of blocks filled with password data if (password.length > 0) { remain = ((password.length / blockSize) + (password.length % blockSize)) * blockSize; while (remain > 0) { int tmp = (remain > password.length) ? password.length : remain; md.update(password, 0, tmp); remain -= tmp; } } while (iterations-- > 0) md.update(md.digest()); // compute the final digest byte[] digest = md.digest(); // allocate a key of the requested size byte[] key = new byte[keyLength]; if (keyLength > 0) { // fill the key with the result int offset = 0; remain = keyLength; while (remain > 0) { int tmp = (remain > digest.length) ? digest.length : remain; System.arraycopy(digest, 0, key, offset, tmp); offset += tmp; remain -= tmp; } } return key; } public static final byte[] deriveKey(MessageDigest md, int blockSize, int keyLength, byte id, PBEKey key) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); try { char[] tmp = key.getPassword(); if (tmp != null) for (int i = 0; i < tmp.length; i++) dos.writeChar(tmp[i]); dos.writeChar((char) 0); dos.close(); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } return deriveKey(md, blockSize, keyLength, id, bos.toByteArray(), key.getSalt(), key.getIterationCount()); } } beecrypt-4.2.1/java/src/beecrypt/provider/SHA1.java0000644000175000001440000000271511216147024016771 00000000000000package beecrypt.provider; import java.security.*; import java.nio.*; public final class SHA1 extends MessageDigestSpi { private long param; private static native long allocParam(); private static native long cloneParam(long param); private static native void freeParam(long param); private static native byte[] digest(long param); private static native int digest(long param, byte[] buf, int off, int len) throws DigestException; private static native void reset(long param); private static native void update(long param, byte input); private static native void update(long param, byte[] input, int off, int len); public SHA1() { param = allocParam(); } public SHA1(SHA1 copy) { param = cloneParam(copy.param); } public Object clone() throws CloneNotSupportedException { return new SHA1(this); } protected byte[] engineDigest() { return digest(param); } protected int engineDigest(byte[] buf, int off, int len) throws DigestException { return digest(param, buf, off, len); } protected int engineGetDigestLength() { return 20; } protected void engineReset() { reset(param); } protected void engineUpdate(byte input) { update(param, input); } protected void engineUpdate(byte[] input, int off, int len) { update(param, input, off, len); } protected void engineUpdate(ByteBuffer input) { update(param, input.array(), input.position(), input.remaining()); } protected void finalize() { freeParam(param); } } beecrypt-4.2.1/java/src/beecrypt/provider/BeeKeyStore.java0000644000175000001440000002320311216147024020451 00000000000000package beecrypt.provider; import java.io.*; import java.security.*; import java.security.cert.*; import java.security.cert.Certificate; import java.util.*; import javax.crypto.*; import beecrypt.beeyond.*; import beecrypt.io.*; public class BeeKeyStore extends KeyStoreSpi { private static final char[] EMPTY_PASSWORD = new char[0]; private static final int BKS_MAGIC = 0xbeecceec; private static final int BKS_VERSION_1 = 1; private static final int BKS_PRIVATEKEY_ENTRY = 1; private static final int BKS_CERTIFICATE_ENTRY = 2; static class Entry { protected Date date = new Date(); } static class KeyEntry extends Entry { byte[] encryptedKey; Certificate[] chain; KeyEntry() { this.encryptedKey = null; this.chain = null; } KeyEntry(byte[] key, Certificate[] chain) { this.encryptedKey = key; this.chain = (Certificate[]) chain.clone(); } } static class CertEntry extends Entry { Certificate cert; CertEntry() { this.cert = null; } CertEntry(Certificate cert) { this.cert = cert; } } private byte[] _bmac; private byte[] _salt; private int _iter; private Hashtable _entries = new Hashtable(); public Enumeration engineAliases() { return _entries.keys(); } public boolean engineContainsAlias(String alias) { return _entries.containsKey(alias); } public void engineDeleteEntry(String alias) { _entries.remove(alias); } public Date engineGetCreationDate(String alias) { Object o = _entries.get(alias); if (o instanceof Entry) return ((Entry) o).date; return null; } public Certificate engineGetCertificate(String alias) { Object o = _entries.get(alias); if (o instanceof CertEntry) return ((CertEntry) o).cert; if (o instanceof KeyEntry) return ((KeyEntry) o).chain[0]; return null; } public String engineGetCertificateAlias(Certificate cert) { Iterator it = _entries.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); Entry e = (Entry) me.getValue(); if (e instanceof CertEntry) if (cert.equals(((CertEntry) e).cert)) return (String) me.getKey(); } return null; } public Certificate[] engineGetCertificateChain(String alias) { Object o = _entries.get(alias); if (o instanceof KeyEntry) return ((KeyEntry) o).chain; return null; } public boolean engineIsCertificateEntry(String alias) { return (_entries.get(alias) instanceof CertEntry); } public void engineSetCertificateEntry(String alias, Certificate cert) throws KeyStoreException { _entries.put(alias, new CertEntry(cert)); } public Key engineGetKey(String alias, char[] password) throws NoSuchAlgorithmException, UnrecoverableKeyException { Object o = _entries.get(alias); if (o instanceof KeyEntry) { KeyEntry ke = (KeyEntry) o; PKCS12PBEKey pbekey = new PKCS12PBEKey(password, _salt, _iter); try { KeyProtector p = new KeyProtector(pbekey); return p.recover(ke.encryptedKey); } catch (NoSuchPaddingException e) { throw new NoSuchAlgorithmException(e.getMessage()); } catch (InvalidKeyException e) { throw new UnrecoverableKeyException(e.getMessage()); } } return null; } public boolean engineIsKeyEntry(String alias) { return (_entries.get(alias) instanceof KeyEntry); } public void engineSetKeyEntry(String alias, byte[] encryptedKey, Certificate[] chain) throws KeyStoreException { _entries.put(alias, new KeyEntry(encryptedKey, chain)); } public void engineSetKeyEntry(String alias, Key key, char[] password, Certificate[] chain) throws KeyStoreException { if (key instanceof PrivateKey) { PKCS12PBEKey pbekey = new PKCS12PBEKey(password, _salt, _iter); try { KeyProtector p = new KeyProtector(pbekey); byte[] tmp = p.protect((PrivateKey) key); if (tmp != null) engineSetKeyEntry(alias, tmp, chain); else throw new KeyStoreException("Failed to protect key"); } catch (NoSuchAlgorithmException e) { throw new KeyStoreException(e.getMessage()); } catch (InvalidKeyException e) { throw new KeyStoreException(e.getMessage()); } } else throw new KeyStoreException( "BeeKeyStore only supports storing of PrivateKey objects"); } public int engineSize() { return _entries.size(); } public void engineLoad(InputStream in, char[] password) throws IOException, CertificateException, NoSuchAlgorithmException { if (in == null) { _salt = SecureRandom.getSeed(64); _iter = 1024; } else { Mac m = Mac.getInstance("HmacSHA256"); MacInputStream mis = new MacInputStream(in, m); DataInputStream dis = new DataInputStream(mis); mis.on(false); int magic = dis.readInt(); int version = dis.readInt(); if (magic != BKS_MAGIC || version != BKS_VERSION_1) throw new IOException("Invalid BeeKeyStore format"); _entries.clear(); int saltSize = dis.readInt(); if (saltSize <= 0) throw new IOException("Invalid BeeKeyStore salt size"); _salt = new byte[saltSize]; dis.readFully(_salt); _iter = dis.readInt(); if (_iter <= 0) throw new IOException("Invalid BeeKeyStore iteration count"); PKCS12PBEKey pbekey = new PKCS12PBEKey( password == null ? EMPTY_PASSWORD : password, _salt, _iter); try { m.init(pbekey); } catch (InvalidKeyException e) { throw new ProviderException(e.getMessage()); } mis.on(true); int entryCount = dis.readInt(); if (entryCount <= 0) throw new IOException("Invalid BeeKeyStore entry count"); for (int i = 0; i < entryCount; i++) { String alias; switch (dis.readInt()) { case BKS_PRIVATEKEY_ENTRY: { alias = dis.readUTF(); KeyEntry e = new KeyEntry(); e.date.setTime(dis.readLong()); int keySize = dis.readInt(); if (keySize <= 0) throw new IOException( "Invalid BeeKeyStore encoded key size"); e.encryptedKey = new byte[keySize]; dis.readFully(e.encryptedKey); int certCount = dis.readInt(); if (certCount <= 0) throw new IOException( "Invalid BeeKeyStore certificate count"); e.chain = new Certificate[certCount]; for (int j = 0; j < certCount; j++) { String type = dis.readUTF(); CertificateFactory cf = CertificateFactory .getInstance(type); int certSize = dis.readInt(); if (certSize <= 0) throw new IOException( "Invalid BeeKeyStore encoded certificate size"); byte[] cert = new byte[certSize]; dis.readFully(cert); ByteArrayInputStream bis = new ByteArrayInputStream( cert); e.chain[j] = cf.generateCertificate(bis); } _entries.put(alias, e); } break; case BKS_CERTIFICATE_ENTRY: { alias = dis.readUTF(); CertEntry e = new CertEntry(); e.date.setTime(dis.readLong()); String type = dis.readUTF(); CertificateFactory cf = CertificateFactory .getInstance(type); int certSize = dis.readInt(); if (certSize <= 0) throw new IOException( "Invalid BeeKeyStore encoded certificate size"); byte[] cert = new byte[certSize]; dis.readFully(cert); ByteArrayInputStream bis = new ByteArrayInputStream(cert); e.cert = cf.generateCertificate(bis); _entries.put(alias, e); } break; default: throw new IOException("Invalid BeeKeyStore entry tag"); } } byte[] computedMac, originalMac; mis.on(false); int macSize = dis.available(); if (macSize <= 0) throw new IOException("Invalid BeeKeyStore MAC size"); computedMac = m.doFinal(); if (macSize != computedMac.length) throw new IOException( "BeeKeyStore has been tampered with, or password was incorrect (incorrect mac size)"); originalMac = new byte[macSize]; dis.readFully(originalMac); if (!Arrays.equals(computedMac, originalMac)) throw new IOException( "BeeKeyStore has been tampered with, or password was incorrect (incorrect mac)"); } } public void engineStore(OutputStream out, char[] password) throws IOException, CertificateException, NoSuchAlgorithmException { Mac m = Mac.getInstance("HmacSHA256"); PKCS12PBEKey pbekey = new PKCS12PBEKey( password == null ? EMPTY_PASSWORD : password, _salt, _iter); try { m.init(pbekey); } catch (InvalidKeyException e) { throw new ProviderException(e.getMessage()); } MacOutputStream mos = new MacOutputStream(out, m); DataOutputStream dos = new DataOutputStream(mos); mos.on(false); dos.writeInt(BKS_MAGIC); dos.writeInt(BKS_VERSION_1); dos.writeInt(_salt.length); dos.write(_salt); dos.writeInt(_iter); mos.on(true); dos.writeInt(_entries.size()); Iterator it = _entries.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); String alias = (String) me.getKey(); Object o = me.getValue(); if (o instanceof KeyEntry) { KeyEntry ke = (KeyEntry) o; dos.writeInt(BKS_PRIVATEKEY_ENTRY); dos.writeUTF(alias); dos.writeLong(ke.date.getTime()); dos.writeInt(ke.encryptedKey.length); dos.write(ke.encryptedKey); dos.writeInt(ke.chain.length); for (int i = 0; i < ke.chain.length; i++) { Certificate cert = ke.chain[i]; dos.writeUTF(cert.getType()); byte[] enc = cert.getEncoded(); dos.writeInt(enc.length); dos.write(enc); } continue; } if (o instanceof CertEntry) { CertEntry ce = (CertEntry) o; dos.writeInt(BKS_CERTIFICATE_ENTRY); dos.writeUTF(alias); dos.writeLong(ce.date.getTime()); dos.writeUTF(ce.cert.getType()); byte[] enc = ce.cert.getEncoded(); dos.writeInt(enc.length); dos.write(enc); continue; } throw new ProviderException( "entry is neither KeyEntry nor CertEntry"); } dos.flush(); mos.flush(); out.write(m.doFinal()); out.close(); } } beecrypt-4.2.1/java/src/beecrypt/provider/SHA512.java0000644000175000001440000000272711216147024017143 00000000000000package beecrypt.provider; import java.security.*; import java.nio.*; public final class SHA512 extends MessageDigestSpi { private long param; private static native long allocParam(); private static native long cloneParam(long param); private static native void freeParam(long param); private static native byte[] digest(long param); private static native int digest(long param, byte[] buf, int off, int len) throws DigestException; private static native void reset(long param); private static native void update(long param, byte input); private static native void update(long param, byte[] input, int off, int len); public SHA512() { param = allocParam(); } public SHA512(SHA512 copy) { param = cloneParam(copy.param); } public Object clone() throws CloneNotSupportedException { return new SHA512(this); } protected byte[] engineDigest() { return digest(param); } protected int engineDigest(byte[] buf, int off, int len) throws DigestException { return digest(param, buf, off, len); } protected int engineGetDigestLength() { return 64; } protected void engineReset() { reset(param); } protected void engineUpdate(byte input) { update(param, input); } protected void engineUpdate(byte[] input, int off, int len) { update(param, input, off, len); } protected void engineUpdate(ByteBuffer input) { update(param, input.array(), input.position(), input.remaining()); } protected void finalize() { freeParam(param); } } beecrypt-4.2.1/java/src/beecrypt/provider/SHA256.java0000644000175000001440000000272711216147024017150 00000000000000package beecrypt.provider; import java.security.*; import java.nio.*; public final class SHA256 extends MessageDigestSpi { private long param; private static native long allocParam(); private static native long cloneParam(long param); private static native void freeParam(long param); private static native byte[] digest(long param); private static native int digest(long param, byte[] buf, int off, int len) throws DigestException; private static native void reset(long param); private static native void update(long param, byte input); private static native void update(long param, byte[] input, int off, int len); public SHA256() { param = allocParam(); } public SHA256(SHA256 copy) { param = cloneParam(copy.param); } public Object clone() throws CloneNotSupportedException { return new SHA256(this); } protected byte[] engineDigest() { return digest(param); } protected int engineDigest(byte[] buf, int off, int len) throws DigestException { return digest(param, buf, off, len); } protected int engineGetDigestLength() { return 32; } protected void engineReset() { reset(param); } protected void engineUpdate(byte input) { update(param, input); } protected void engineUpdate(byte[] input, int off, int len) { update(param, input, off, len); } protected void engineUpdate(ByteBuffer input) { update(param, input.array(), input.position(), input.remaining()); } protected void finalize() { freeParam(param); } } beecrypt-4.2.1/java/src/beecrypt/provider/SHA224.java0000644000175000001440000000272711225172547017153 00000000000000package beecrypt.provider; import java.security.*; import java.nio.*; public final class SHA224 extends MessageDigestSpi { private long param; private static native long allocParam(); private static native long cloneParam(long param); private static native void freeParam(long param); private static native byte[] digest(long param); private static native int digest(long param, byte[] buf, int off, int len) throws DigestException; private static native void reset(long param); private static native void update(long param, byte input); private static native void update(long param, byte[] input, int off, int len); public SHA224() { param = allocParam(); } public SHA224(SHA224 copy) { param = cloneParam(copy.param); } public Object clone() throws CloneNotSupportedException { return new SHA224(this); } protected byte[] engineDigest() { return digest(param); } protected int engineDigest(byte[] buf, int off, int len) throws DigestException { return digest(param, buf, off, len); } protected int engineGetDigestLength() { return 24; } protected void engineReset() { reset(param); } protected void engineUpdate(byte input) { update(param, input); } protected void engineUpdate(byte[] input, int off, int len) { update(param, input, off, len); } protected void engineUpdate(ByteBuffer input) { update(param, input.array(), input.position(), input.remaining()); } protected void finalize() { freeParam(param); } } beecrypt-4.2.1/java/src/beecrypt/provider/KeyProtector.java0000644000175000001440000000626711216147024020735 00000000000000package beecrypt.provider; import java.io.*; import java.util.*; import java.security.*; import javax.crypto.*; import javax.crypto.interfaces.*; import javax.crypto.spec.*; import beecrypt.beeyond.*; public class KeyProtector { private SecretKeySpec _cipher_key; private SecretKeySpec _mac_key; private IvParameterSpec _iv; public KeyProtector(PBEKey key) throws InvalidKeyException, NoSuchAlgorithmException { byte[] rawKey = key.getEncoded(); if (rawKey == null) throw new InvalidKeyException("PBEKey must have an encoding"); byte[] salt = key.getSalt(); int iter = key.getIterationCount(); MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); _cipher_key = new SecretKeySpec(PKCS12.deriveKey(sha256, 64, 32, PKCS12.ID_CIPHER, rawKey, salt, iter), "RAW"); _mac_key = new SecretKeySpec(PKCS12.deriveKey(sha256, 64, 32, PKCS12.ID_MAC, rawKey, salt, iter), "RAW"); _iv = new IvParameterSpec(PKCS12.deriveKey(sha256, 64, 16, PKCS12.ID_IV, rawKey, salt, iter)); } byte[] protect(PrivateKey key) { if (key.getEncoded() == null) return null; if (key.getFormat() == null) return null; try { byte[] enc = key.getEncoded(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); dos.writeUTF(key.getAlgorithm()); dos.writeUTF(key.getFormat()); dos.writeInt(enc.length); dos.write(enc); dos.close(); byte[] clearText = bos.toByteArray(); Mac m = Mac.getInstance("HmacSHA256"); m.init(_mac_key); byte[] mac = m.doFinal(clearText); Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding"); c.init(Cipher.ENCRYPT_MODE, _cipher_key, _iv); return c.doFinal(clearText); } catch (Exception e) { return null; } } PrivateKey recover(byte[] encryptedKey) throws NoSuchAlgorithmException, NoSuchPaddingException, UnrecoverableKeyException { Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding"); Mac m = Mac.getInstance("HmacSHA256"); final int macLength = m.getMacLength(); final int cipherTextLength = encryptedKey.length - macLength; if (cipherTextLength <= 0) throw new UnrecoverableKeyException("encrypted data way too short"); try { c.init(Cipher.DECRYPT_MODE, _cipher_key, _iv); byte[] clearText = c.doFinal(encryptedKey, 0, cipherTextLength); m.init(_mac_key); byte[] computedMac = m.doFinal(clearText); byte[] originalMac = new byte[m.getMacLength()]; System.arraycopy(encryptedKey, cipherTextLength, originalMac, 0, macLength); if (!Arrays.equals(computedMac, originalMac)) throw new UnrecoverableKeyException( "mac of decrypted key didn't match"); ByteArrayInputStream bis = new ByteArrayInputStream(clearText); DataInputStream dis = new DataInputStream(bis); String algorithm = dis.readUTF(); String format = dis.readUTF(); int encSize = dis.readInt(); if (encSize <= 0) throw new IOException("key size < 0"); byte[] enc = new byte[encSize]; dis.readFully(enc); KeyFactory kf = KeyFactory.getInstance(algorithm); return kf.generatePrivate(new AnyEncodedKeySpec(format, enc)); } catch (Exception e) { } throw new UnrecoverableKeyException("unable to recover key"); } } beecrypt-4.2.1/java/src/beecrypt/provider/BaseProvider.java0000644000175000001440000000736111225165724020673 00000000000000package beecrypt.provider; import java.security.*; /** * This class specifies the set of algorithms defined by the BeeCrypt JCE 1.4 * Cryptography Provider. *

* * @author Bob Deblier <bob.deblier@telenet.be> */ public final class BaseProvider extends Provider { private static final String NAME = "BeeCrypt", INFO = "BeeCrypt JCE 1.4 Cryptography Provider"; private static final double VERSION = 4.2; static { System.loadLibrary("beecrypt"); System.loadLibrary("beecrypt_java"); } public BaseProvider() { super(NAME, VERSION, INFO); AccessController.doPrivileged(new java.security.PrivilegedAction() { public Object run() { // setProperty("AlgorithmParameterGenerator.DH", // "beecrypt.provider.DHParameterGenerator"); setProperty("AlgorithmParameters.DH", "beecrypt.provider.DHParameters"); setProperty("AlgorithmParameters.DHIES", "beecrypt.provider.DHIESParameters"); // setProperty("AlgorithmParameters.DSA", // "beecrypt.provider.DSAParameters"); setProperty("CertificateFactory.BEE", "beecrypt.provider.BeeCertificateFactory"); setProperty("CertPathValidator.BEE", "beecrypt.provider.BeeCertPathValidator"); setProperty("Cipher.AES", "beecrypt.provider.AES"); setProperty("Cipher.AES SupportKeyFormats", "RAW"); setProperty("Cipher.DHIES", "beecrypt.provider.DHIES"); setProperty("KeyFactory.DH", "beecrypt.provider.DHKeyFactory"); setProperty("KeyFactory.DSA", "beecrypt.provider.DSAKeyFactory"); setProperty("KeyFactory.RSA", "beecrypt.provider.RSAKeyFactory"); setProperty("KeyPairGenerator.DH", "beecrypt.provider.DHKeyPairGenerator"); setProperty("KeyPairGenerator.RSA", "beecrypt.provider.RSAKeyPairGenerator"); setProperty("KeyStore.BEE", "beecrypt.provider.BeeKeyStore"); setProperty("Mac.HmacMD5", "beecrypt.provider.HMACMD5"); setProperty("Mac.HmacSHA1", "beecrypt.provider.HMACSHA1"); setProperty("Mac.HmacSHA256", "beecrypt.provider.HMACSHA256"); setProperty("Mac.HmacSHA384", "beecrypt.provider.HMACSHA384"); setProperty("Mac.HmacSHA512", "beecrypt.provider.HMACSHA512"); setProperty("MessageDigest.MD4", "beecrypt.provider.MD4"); setProperty("MessageDigest.MD5", "beecrypt.provider.MD5"); setProperty("MessageDigest.SHA-1", "beecrypt.provider.SHA1"); setProperty("MessageDigest.SHA-224", "beecrypt.provider.SHA224"); setProperty("MessageDigest.SHA-256", "beecrypt.provider.SHA256"); setProperty("MessageDigest.SHA-384", "beecrypt.provider.SHA384"); setProperty("MessageDigest.SHA-512", "beecrypt.provider.SHA512"); setProperty( "Als.Alias.AlgorithmParameterGenerator.DiffieHellman", "AlgorithmParameterGenerator.DH"); setProperty("Als.Alias.AlgorithmParameters.DiffieHellman", "AlgorithmParameters.DH"); setProperty("Als.Alias.AlgorithmParameters.DHAES", "AlgorithmParameters.DHIES"); setProperty("Als.Alias.AlgorithmParameters.DHES", "AlgorithmParameters.DHIES"); setProperty("Als.Alias.Cipher.DHAES", "Cipher.DHIES"); setProperty("Als.Alias.Cipher.DHES", "Cipher.DHIES"); setProperty("Als.Alias.KeyFactory.DiffieHellman", "KeyFactory.DH"); setProperty("Als.Alias.KeyPairGenerator.DiffieHellman", "KeyPairGenerator.DH"); setProperty("Als.Alias.Mac.HMAC-MD5", "Mac.HmacMD5"); setProperty("Als.Alias.Mac.HMAC-SHA-1", "Mac.HmacSHA1"); setProperty("Als.Alias.Mac.HMAC-SHA-256", "Mac.HmacSHA256"); setProperty("Als.Alias.Mac.HMAC-SHA-384", "Mac.HmacSHA384"); setProperty("Als.Alias.Mac.HMAC-SHA-512", "Mac.HmacSHA512"); setProperty("Als.Alias.MessageDigest.SHA", "MessageDigest.SHA-1"); return null; } }); } } beecrypt-4.2.1/java/src/beecrypt/provider/DSAKeyFactory.java0000644000175000001440000000753211216147024020707 00000000000000package beecrypt.provider; import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.interfaces.*; import java.security.spec.*; import beecrypt.beeyond.*; import beecrypt.io.*; import beecrypt.security.*; public final class DSAKeyFactory extends KeyFactorySpi { private static DSAPrivateKey generatePrivate(byte[] enc) throws InvalidKeySpecException { try { ByteArrayInputStream bis = new ByteArrayInputStream(enc); BeeInputStream bee = new BeeInputStream(bis); BigInteger p, q, g, x; p = bee.readBigInteger(); q = bee.readBigInteger(); g = bee.readBigInteger(); x = bee.readBigInteger(); return new DSAPrivateKeyImpl(p, q, g, x); } catch (IOException e) { throw new InvalidKeySpecException("Invalid KeySpec encoding"); } } private static DSAPublicKey generatePublic(byte[] enc) throws InvalidKeySpecException { try { ByteArrayInputStream bis = new ByteArrayInputStream(enc); BeeInputStream bee = new BeeInputStream(bis); BigInteger p, q, g, y; p = bee.readBigInteger(); q = bee.readBigInteger(); g = bee.readBigInteger(); y = bee.readBigInteger(); return new DSAPublicKeyImpl(p, q, g, y); } catch (IOException e) { throw new InvalidKeySpecException("Invalid KeySpec encoding"); } } protected PrivateKey engineGeneratePrivate(KeySpec spec) throws InvalidKeySpecException { if (spec instanceof DSAPrivateKeySpec) { return new DSAPrivateKeyImpl((DSAPrivateKeySpec) spec); } if (spec instanceof EncodedKeySpec) { EncodedKeySpec enc = (EncodedKeySpec) spec; if (enc.getFormat().equals("BEE")) { return generatePrivate(enc.getEncoded()); } throw new InvalidKeySpecException("Unsupported KeySpec format"); } throw new InvalidKeySpecException("Unsupported KeySpec type"); } protected PublicKey engineGeneratePublic(KeySpec spec) throws InvalidKeySpecException { if (spec instanceof DSAPublicKeySpec) { return new DSAPublicKeyImpl((DSAPublicKeySpec) spec); } if (spec instanceof EncodedKeySpec) { EncodedKeySpec enc = (EncodedKeySpec) spec; if (enc.getFormat().equals("BEE")) { return generatePublic(enc.getEncoded()); } throw new InvalidKeySpecException("Unsupported KeySpec format"); } throw new InvalidKeySpecException("Unsupported KeySpec type"); } protected KeySpec engineGetKeySpec(Key key, Class keySpec) throws InvalidKeySpecException { if (key instanceof DSAPublicKey) { DSAPublicKey pub = (DSAPublicKey) key; if (keySpec.equals(KeySpec.class) || keySpec.equals(DSAPublicKeySpec.class)) { return new DSAPublicKeySpec(pub.getY(), pub.getParams().getP(), pub.getParams().getQ(), pub.getParams().getG()); } if (keySpec.equals(EncodedKeySpec.class)) { String format = pub.getFormat(); if (format != null) { byte[] enc = pub.getEncoded(); if (enc != null) return new AnyEncodedKeySpec(format, enc); } } } else if (key instanceof DSAPrivateKey) { DSAPrivateKey pri = (DSAPrivateKey) key; if (keySpec.equals(KeySpec.class) || keySpec.equals(DSAPrivateKeySpec.class)) { return new DSAPrivateKeySpec(pri.getX(), pri.getParams().getP(), pri.getParams().getQ(), pri .getParams().getG()); } if (keySpec.equals(EncodedKeySpec.class)) { String format = pri.getFormat(); if (format != null) { byte[] enc = pri.getEncoded(); if (enc != null) return new AnyEncodedKeySpec(format, enc); } } } throw new InvalidKeySpecException("Unsupported Key type"); } protected Key engineTranslateKey(Key key) throws InvalidKeyException { if (key instanceof DSAPublicKey) { return new DSAPublicKeyImpl((DSAPublicKey) key); } else if (key instanceof DSAPrivateKey) { return new DSAPrivateKeyImpl((DSAPrivateKey) key); } throw new InvalidKeyException("Unsupported Key type"); } public DSAKeyFactory() { } } beecrypt-4.2.1/java/src/beecrypt/provider/RSAKeyPairGenerator.java0000644000175000001440000000310611216147024022051 00000000000000package beecrypt.provider; import java.math.BigInteger; import java.security.*; import java.security.spec.*; import beecrypt.security.*; public final class RSAKeyPairGenerator extends KeyPairGeneratorSpi { private int _size = 1024; private byte[] _n = null; private byte[] _e = RSAKeyGenParameterSpec.F4.toByteArray(); private byte[] _d = null; private byte[] _p = null; private byte[] _q = null; private byte[] _dp = null; private byte[] _dq = null; private byte[] _qi = null; private SecureRandom _srng; private native void generate(); public KeyPair generateKeyPair() { generate(); BigInteger n = new BigInteger(_n); BigInteger e = new BigInteger(_e); return new KeyPair(new RSAPublicKeyImpl(n, e), new RSAPrivateCrtKeyImpl(n, e, new BigInteger(_d), new BigInteger(_p), new BigInteger(_q), new BigInteger( _dp), new BigInteger(_dq), new BigInteger(_qi))); } public void initialize(int keysize, SecureRandom random) throws InvalidParameterException { if (keysize < 768) throw new InvalidParameterException("minimum size is 768"); _size = keysize; _e = RSAKeyGenParameterSpec.F4.toByteArray(); _srng = random; } public void initialize(AlgorithmParameterSpec spec, SecureRandom random) throws InvalidAlgorithmParameterException { if (spec instanceof RSAKeyGenParameterSpec) { RSAKeyGenParameterSpec rs = (RSAKeyGenParameterSpec) spec; _size = rs.getKeysize(); _e = rs.getPublicExponent().toByteArray(); _srng = random; } else throw new InvalidAlgorithmParameterException( "not an RSAKeyGenParameterSpec"); } } beecrypt-4.2.1/java/src/beecrypt/provider/DHKeyFactory.java0000644000175000001440000001127111226044700020564 00000000000000package beecrypt.provider; import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.interfaces.*; import java.security.spec.*; import javax.crypto.interfaces.*; import javax.crypto.spec.*; // import beecrypt.asn1.*; // import beecrypt.asn1.x509.SubjectPublicKeyInfo; import beecrypt.beeyond.*; import beecrypt.crypto.*; import beecrypt.io.*; public final class DHKeyFactory extends KeyFactorySpi { private static DHPrivateKey generatePrivate(byte[] enc) throws InvalidKeySpecException { try { ByteArrayInputStream bis = new ByteArrayInputStream(enc); BeeInputStream bee = new BeeInputStream(bis); BigInteger p, g, x; p = bee.readBigInteger(); g = bee.readBigInteger(); x = bee.readBigInteger(); return new DHPrivateKeyImpl(p, g, x); } catch (IOException e) { throw new InvalidKeySpecException("Invalid KeySpec encoding"); } } private static DHPublicKey generatePublic(byte[] enc) throws InvalidKeySpecException { try { ByteArrayInputStream bis = new ByteArrayInputStream(enc); BeeInputStream bee = new BeeInputStream(bis); BigInteger p, g, y; p = bee.readBigInteger(); g = bee.readBigInteger(); y = bee.readBigInteger(); return new DHPublicKeyImpl(p, g, y); } catch (IOException e) { throw new InvalidKeySpecException("Invalid KeySpec encoding"); } } /* * private static DHPublicKey generatePublicX509(byte[] enc) throws * InvalidKeySpecException { try { DERDecoder d = new DERDecoder(); * * Any tmp = d.decode(enc, SubjectPublicKeyInfo.NAME); * * if (tmp instanceof SubjectPublicKeyInfo) { SubjectPublicKeyInfo spki = * (SubjectPublicKeyInfo) tmp; * * AlgorithmIdentifier aid = spki.getAlgorithmIdentifier(); * * ObjectIdentifier oid = aid.getAlgorithm(); } } catch (IOException e) { * throw new InvalidKeySpecException("invalid X.509 SubjectPublicKeyInfo"); * } catch (NoSuchTypeException e) { throw new * RuntimeException("ASN.1 X.509 module required"); } } */ protected PrivateKey engineGeneratePrivate(KeySpec spec) throws InvalidKeySpecException { if (spec instanceof DHPrivateKeySpec) { return new DHPrivateKeyImpl((DHPrivateKeySpec) spec); } if (spec instanceof EncodedKeySpec) { EncodedKeySpec enc = (EncodedKeySpec) spec; if (enc.getFormat().equals("BEE")) { return generatePrivate(enc.getEncoded()); } throw new InvalidKeySpecException("Unsupported KeySpec format"); } throw new InvalidKeySpecException("Unsupported KeySpec type"); } protected PublicKey engineGeneratePublic(KeySpec spec) throws InvalidKeySpecException { if (spec instanceof DHPublicKeySpec) { return new DHPublicKeyImpl((DHPublicKeySpec) spec); } /* * if (spec instanceof X509EncodedKeySpec) { X509EncodedKeySpec xspec = * (X509EncodedKeySpec) spec; * * return generatePublicX509(xspec.getEncoded()); } */ if (spec instanceof EncodedKeySpec) { EncodedKeySpec enc = (EncodedKeySpec) spec; if (enc.getFormat().equals("BEE")) { return generatePublic(enc.getEncoded()); } throw new InvalidKeySpecException("Unsupported KeySpec format"); } throw new InvalidKeySpecException("Unsupported KeySpec type"); } protected KeySpec engineGetKeySpec(Key key, Class keySpec) throws InvalidKeySpecException { if (keySpec.isAssignableFrom(DHPrivateKeySpec.class) && (key instanceof DHPrivateKey)) { DHPrivateKey pri = (DHPrivateKey) key; return new DHPrivateKeySpec(pri.getX(), pri.getParams().getP(), pri .getParams().getG()); } if (keySpec.isAssignableFrom(DHPublicKeySpec.class) && (key instanceof DHPublicKey)) { DHPublicKey pub = (DHPublicKey) key; return new DHPublicKeySpec(pub.getY(), pub.getParams().getP(), pub .getParams().getG()); } if (keySpec.isAssignableFrom(PKCS8EncodedKeySpec.class) && key.getFormat().equalsIgnoreCase("PKCS#8")) { return new PKCS8EncodedKeySpec(key.getEncoded()); } if (keySpec.isAssignableFrom(X509EncodedKeySpec.class) && key.getFormat().equalsIgnoreCase("X.509")) { return new PKCS8EncodedKeySpec(key.getEncoded()); } if (keySpec.equals(EncodedKeySpec.class)) { String format = key.getFormat(); if (format != null) { byte[] enc = key.getEncoded(); if (enc != null) return new AnyEncodedKeySpec(format, enc); } } throw new InvalidKeySpecException( "Unsupported KeySpec class for this key"); } protected Key engineTranslateKey(Key key) throws InvalidKeyException { if (key instanceof DHPublicKey) { return new DHPublicKeyImpl((DHPublicKey) key); } else if (key instanceof DHPrivateKey) { return new DHPrivateKeyImpl((DHPrivateKey) key); } throw new InvalidKeyException("Unsupported Key type"); } public DHKeyFactory() { } } beecrypt-4.2.1/java/src/beecrypt/provider/RSAKeyFactory.java0000644000175000001440000001121211216147024020713 00000000000000package beecrypt.provider; import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.interfaces.*; import java.security.spec.*; import javax.crypto.interfaces.*; import javax.crypto.spec.*; import beecrypt.beeyond.*; import beecrypt.io.*; import beecrypt.security.*; public final class RSAKeyFactory extends KeyFactorySpi { private static RSAPrivateKey generatePrivate(byte[] enc) throws InvalidKeySpecException { try { ByteArrayInputStream bis = new ByteArrayInputStream(enc); BeeInputStream bee = new BeeInputStream(bis); BigInteger n, d; n = bee.readBigInteger(); d = bee.readBigInteger(); if (bee.available() > 0) { BigInteger e, p, q, dp, dq, qi; e = bee.readBigInteger(); p = bee.readBigInteger(); q = bee.readBigInteger(); dp = bee.readBigInteger(); dq = bee.readBigInteger(); qi = bee.readBigInteger(); return new RSAPrivateCrtKeyImpl(n, e, d, p, q, dp, dq, qi); } return new RSAPrivateKeyImpl(n, d); } catch (IOException e) { throw new InvalidKeySpecException("Invalid KeySpec encoding"); } } private static RSAPublicKey generatePublic(byte[] enc) throws InvalidKeySpecException { try { ByteArrayInputStream bis = new ByteArrayInputStream(enc); BeeInputStream bee = new BeeInputStream(bis); BigInteger n, e; n = bee.readBigInteger(); e = bee.readBigInteger(); return new RSAPublicKeyImpl(n, e); } catch (IOException e) { throw new InvalidKeySpecException("Invalid KeySpec encoding"); } } protected PrivateKey engineGeneratePrivate(KeySpec spec) throws InvalidKeySpecException { if (spec instanceof RSAPrivateKeySpec) { if (spec instanceof RSAPrivateCrtKeySpec) return new RSAPrivateCrtKeyImpl((RSAPrivateCrtKeySpec) spec); return new RSAPrivateKeyImpl((RSAPrivateKeySpec) spec); } if (spec instanceof EncodedKeySpec) { EncodedKeySpec enc = (EncodedKeySpec) spec; if (enc.getFormat().equals("BEE")) { return generatePrivate(enc.getEncoded()); } throw new InvalidKeySpecException("Unsupported KeySpec format"); } throw new InvalidKeySpecException("Unsupported KeySpec type"); } protected PublicKey engineGeneratePublic(KeySpec spec) throws InvalidKeySpecException { if (spec instanceof RSAPublicKeySpec) { return new RSAPublicKeyImpl((RSAPublicKeySpec) spec); } if (spec instanceof EncodedKeySpec) { EncodedKeySpec enc = (EncodedKeySpec) spec; if (enc.getFormat().equals("BEE")) { return generatePublic(enc.getEncoded()); } throw new InvalidKeySpecException("Unsupported KeySpec format"); } throw new InvalidKeySpecException("Unsupported KeySpec type"); } protected KeySpec engineGetKeySpec(Key key, Class keySpec) throws InvalidKeySpecException { if (keySpec.isAssignableFrom(RSAPrivateCrtKeySpec.class) && (key instanceof RSAPrivateCrtKey)) { RSAPrivateCrtKey pri = (RSAPrivateCrtKey) key; return new RSAPrivateCrtKeySpec(pri.getModulus(), pri .getPublicExponent(), pri.getPrivateExponent(), pri .getPrimeP(), pri.getPrimeQ(), pri.getPrimeExponentP(), pri .getPrimeExponentQ(), pri.getCrtCoefficient()); } if (keySpec.isAssignableFrom(RSAPrivateKeySpec.class) && (key instanceof RSAPrivateKey)) { RSAPrivateKey pri = (RSAPrivateKey) key; return new RSAPrivateKeySpec(pri.getModulus(), pri .getPrivateExponent()); } if (keySpec.isAssignableFrom(RSAPublicKeySpec.class) && (key instanceof RSAPublicKey)) { RSAPublicKey pub = (RSAPublicKey) key; return new RSAPublicKeySpec(pub.getModulus(), pub .getPublicExponent()); } if (keySpec.isAssignableFrom(PKCS8EncodedKeySpec.class) && key.getFormat().equalsIgnoreCase("PKCS#8")) { return new PKCS8EncodedKeySpec(key.getEncoded()); } if (keySpec.isAssignableFrom(X509EncodedKeySpec.class) && key.getFormat().equalsIgnoreCase("X.509")) { return new X509EncodedKeySpec(key.getEncoded()); } if (keySpec.equals(EncodedKeySpec.class)) { String format = key.getFormat(); if (format != null) { byte[] enc = key.getEncoded(); if (enc != null) return new AnyEncodedKeySpec(format, enc); } } throw new InvalidKeySpecException( "Unsupported KeySpec class for this key"); } protected Key engineTranslateKey(Key key) throws InvalidKeyException { if (key instanceof RSAPublicKey) { return new RSAPublicKeyImpl((RSAPublicKey) key); } else if (key instanceof RSAPrivateCrtKey) { return new RSAPrivateCrtKeyImpl((RSAPrivateCrtKey) key); } else if (key instanceof RSAPrivateKey) { return new RSAPrivateKeyImpl((RSAPrivateKey) key); } throw new InvalidKeyException("Unsupported Key type"); } public RSAKeyFactory() { } } beecrypt-4.2.1/java/src/beecrypt/provider/DHIESParameters.java0000644000175000001440000000321311216147024021147 00000000000000package beecrypt.provider; import java.io.*; import java.security.*; import java.security.spec.*; import beecrypt.crypto.spec.*; public class DHIESParameters extends AlgorithmParametersSpi { private DHIESParameterSpec spec = null; private DHIESDecryptParameterSpec dspec = null; protected byte[] engineGetEncoded() throws IOException { throw new IOException("not implemented"); } protected byte[] engineGetEncoded(String format) throws IOException { throw new IOException("not implemented"); } protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec) throws InvalidParameterSpecException { if (paramSpec.isAssignableFrom(DHIESDecryptParameterSpec.class)) { if (dspec != null) return dspec; } if (paramSpec.isAssignableFrom(DHIESParameterSpec.class)) { if (spec != null) return spec; } throw new InvalidParameterSpecException(); } protected void engineInit(AlgorithmParameterSpec param) throws InvalidParameterSpecException { spec = null; dspec = null; if (param instanceof DHIESParameterSpec) { spec = (DHIESParameterSpec) param; if (spec instanceof DHIESDecryptParameterSpec) dspec = (DHIESDecryptParameterSpec) spec; } else throw new InvalidParameterSpecException( "Expected a DHIESParameterSpec"); } protected void engineInit(byte[] params) { throw new ProviderException("not implemented"); } protected void engineInit(byte[] params, String format) { throw new ProviderException("not implemented"); } protected String engineToString() { if (dspec != null) return dspec.toString(); if (spec != null) return spec.toString(); return "(uninitialized)"; } } beecrypt-4.2.1/java/src/beecrypt/provider/MD4.java0000644000175000001440000000271011225172505016656 00000000000000package beecrypt.provider; import java.security.*; import java.nio.*; public final class MD4 extends MessageDigestSpi { private long param; private static native long allocParam(); private static native long cloneParam(long param); private static native void freeParam(long param); private static native byte[] digest(long param); private static native int digest(long param, byte[] buf, int off, int len) throws DigestException; private static native void reset(long param); private static native void update(long param, byte input); private static native void update(long param, byte[] input, int off, int len); public MD4() { param = allocParam(); } public MD4(MD4 copy) { param = cloneParam(copy.param); } public Object clone() throws CloneNotSupportedException { return new MD4(this); } protected byte[] engineDigest() { return digest(param); } protected int engineDigest(byte[] buf, int off, int len) throws DigestException { return digest(param, buf, off, len); } protected int engineGetDigestLength() { return 16; } protected void engineReset() { reset(param); } protected void engineUpdate(byte input) { update(param, input); } protected void engineUpdate(byte[] input, int off, int len) { update(param, input, off, len); } protected void engineUpdate(ByteBuffer input) { update(param, input.array(), input.position(), input.remaining()); } protected void finalize() { freeParam(param); } } beecrypt-4.2.1/java/src/beecrypt/provider/SHA384.java0000644000175000001440000000272711216147024017152 00000000000000package beecrypt.provider; import java.security.*; import java.nio.*; public final class SHA384 extends MessageDigestSpi { private long param; private static native long allocParam(); private static native long cloneParam(long param); private static native void freeParam(long param); private static native byte[] digest(long param); private static native int digest(long param, byte[] buf, int off, int len) throws DigestException; private static native void reset(long param); private static native void update(long param, byte input); private static native void update(long param, byte[] input, int off, int len); public SHA384() { param = allocParam(); } public SHA384(SHA384 copy) { param = cloneParam(copy.param); } public Object clone() throws CloneNotSupportedException { return new SHA384(this); } protected byte[] engineDigest() { return digest(param); } protected int engineDigest(byte[] buf, int off, int len) throws DigestException { return digest(param, buf, off, len); } protected int engineGetDigestLength() { return 48; } protected void engineReset() { reset(param); } protected void engineUpdate(byte input) { update(param, input); } protected void engineUpdate(byte[] input, int off, int len) { update(param, input, off, len); } protected void engineUpdate(ByteBuffer input) { update(param, input.array(), input.position(), input.remaining()); } protected void finalize() { freeParam(param); } } beecrypt-4.2.1/java/src/beecrypt/provider/MD5.java0000644000175000001440000000271011216147024016655 00000000000000package beecrypt.provider; import java.security.*; import java.nio.*; public final class MD5 extends MessageDigestSpi { private long param; private static native long allocParam(); private static native long cloneParam(long param); private static native void freeParam(long param); private static native byte[] digest(long param); private static native int digest(long param, byte[] buf, int off, int len) throws DigestException; private static native void reset(long param); private static native void update(long param, byte input); private static native void update(long param, byte[] input, int off, int len); public MD5() { param = allocParam(); } public MD5(MD5 copy) { param = cloneParam(copy.param); } public Object clone() throws CloneNotSupportedException { return new MD5(this); } protected byte[] engineDigest() { return digest(param); } protected int engineDigest(byte[] buf, int off, int len) throws DigestException { return digest(param, buf, off, len); } protected int engineGetDigestLength() { return 16; } protected void engineReset() { reset(param); } protected void engineUpdate(byte input) { update(param, input); } protected void engineUpdate(byte[] input, int off, int len) { update(param, input, off, len); } protected void engineUpdate(ByteBuffer input) { update(param, input.array(), input.position(), input.remaining()); } protected void finalize() { freeParam(param); } } beecrypt-4.2.1/java/src/beecrypt/io/0000777000175000001440000000000011226307274014274 500000000000000beecrypt-4.2.1/java/src/beecrypt/io/MacInputStream.java0000644000175000001440000000124111216147024017737 00000000000000package beecrypt.io; import java.io.*; import javax.crypto.*; public class MacInputStream extends FilterInputStream { private boolean _on; protected Mac mac; public MacInputStream(InputStream in, Mac mac) { super(in); this.mac = mac; } public Mac getMac() { return mac; } public void on(boolean on) { _on = on; } public int read() throws IOException { int rc = in.read(); if (rc >= 0 && _on) mac.update((byte) rc); return rc; } public int read(byte[] b, int off, int len) throws IOException { int rc = in.read(b, off, len); if (rc >= 0 && _on) mac.update(b, off, rc); return rc; } public void setMac(Mac m) { mac = m; } } beecrypt-4.2.1/java/src/beecrypt/io/BeeOutputStream.java0000644000175000001440000000051311216147024020134 00000000000000package beecrypt.io; import java.io.*; import java.math.BigInteger; public class BeeOutputStream extends DataOutputStream { public BeeOutputStream(OutputStream out) { super(out); } public void writeBigInteger(BigInteger b) throws IOException { byte[] data = b.toByteArray(); writeInt(data.length); write(data); } } beecrypt-4.2.1/java/src/beecrypt/io/MacOutputStream.java0000644000175000001440000000105111216147024020137 00000000000000package beecrypt.io; import java.io.*; import javax.crypto.*; public class MacOutputStream extends FilterOutputStream { private boolean _on; protected Mac mac; public MacOutputStream(OutputStream out, Mac mac) { super(out); this.mac = mac; } public Mac getMac() { return mac; } public void on(boolean on) { _on = on; } public void write(byte[] b, int off, int len) throws IOException { if (len > 0) { out.write(b, off, len); if (_on) ; mac.update(b, off, len); } } public void setMac(Mac m) { mac = m; } } beecrypt-4.2.1/java/src/beecrypt/io/BeeInputStream.java0000644000175000001440000000064711216147024017743 00000000000000package beecrypt.io; import java.io.*; import java.math.BigInteger; public class BeeInputStream extends DataInputStream { public BeeInputStream(InputStream in) { super(in); } public BigInteger readBigInteger() throws IOException { int size = readInt(); if (size <= 0) throw new IOException("Invalid BigInteger size"); byte[] data = new byte[size]; readFully(data); return new BigInteger(data); } } beecrypt-4.2.1/java/src/beecrypt/beeyond/0000777000175000001440000000000011226307274015312 500000000000000beecrypt-4.2.1/java/src/beecrypt/beeyond/PKCS12PBEKey.java0000644000175000001440000000176111216147023017772 00000000000000package beecrypt.beeyond; import javax.crypto.interfaces.*; public class PKCS12PBEKey implements PBEKey { private char[] _pwd; private byte[] _salt; private int _iter; private byte[] _enc; public static byte[] encode(char[] password) { int i; byte[] result = new byte[(password.length + 1) * 2]; for (i = 0; i < password.length; i++) { char c = password[i]; result[2 * i] = (byte) (c >> 8); result[2 * i + 1] = (byte) c; } result[2 * i] = 0; result[2 * i + 1] = 0; return result; } public PKCS12PBEKey(char[] password, byte[] salt, int iterationCount) { _pwd = password; _salt = salt; _iter = iterationCount; } public String getAlgorithm() { return "PKCS#12/PBE"; } public byte[] getEncoded() { if (_enc == null) _enc = encode(_pwd); return _enc; } public String getFormat() { return "RAW"; } public int getIterationCount() { return _iter; } public char[] getPassword() { return _pwd; } public byte[] getSalt() { return _salt; } } beecrypt-4.2.1/java/src/beecrypt/beeyond/BeeEncodedKeySpec.java0000644000175000001440000000035311216147023021324 00000000000000package beecrypt.beeyond; import java.security.spec.*; public class BeeEncodedKeySpec extends EncodedKeySpec { public BeeEncodedKeySpec(byte[] encodedKey) { super(encodedKey); } public String getFormat() { return "BEE"; } } beecrypt-4.2.1/java/src/beecrypt/beeyond/BeeCertificate.java0000644000175000001440000002667711216147023020742 00000000000000package beecrypt.beeyond; import java.io.*; import java.security.*; import java.security.cert.*; import java.security.cert.Certificate; import java.security.spec.*; import java.util.*; public class BeeCertificate extends Certificate { public static final Date FOREVER = new Date(Long.MAX_VALUE); protected static abstract class Field { public int type; public abstract void decode(DataInputStream in) throws IOException; public abstract void encode(DataOutputStream out) throws IOException; } protected static class UnknownField extends Field implements Cloneable { byte[] encoding; public UnknownField() { } public UnknownField(int type, byte[] encoding) { this.type = type; this.encoding = encoding; } public Object clone() { return new UnknownField(type, encoding); } public void decode(DataInputStream in) throws IOException { encoding = new byte[in.available()]; in.readFully(encoding); } public void encode(DataOutputStream out) throws IOException { out.write(encoding); } } protected static class PublicKeyField extends Field implements Cloneable { public static final int FIELD_TYPE = 0x5055424b; public PublicKey pub; public PublicKeyField() { this.type = FIELD_TYPE; } public PublicKeyField(PublicKey pub) { this.type = FIELD_TYPE; this.pub = pub; } public Object clone() { return new PublicKeyField(pub); } public void decode(DataInputStream in) throws IOException { String algorithm = in.readUTF(); String format = in.readUTF(); int encsize = in.readInt(); if (encsize <= 0) throw new IOException("Invalid key encoding size"); byte[] enc = new byte[encsize]; in.readFully(enc); AnyEncodedKeySpec spec = new AnyEncodedKeySpec(format, enc); try { KeyFactory kf = KeyFactory.getInstance(algorithm); pub = kf.generatePublic(spec); } catch (InvalidKeySpecException e) { throw new IOException("Invalid key spec"); } catch (NoSuchAlgorithmException e) { throw new IOException("Invalid key format"); } } public void encode(DataOutputStream out) throws IOException { out.writeUTF(pub.getAlgorithm()); out.writeUTF(pub.getFormat()); byte[] enc = pub.getEncoded(); if (enc == null) throw new IOException("Couldn't encode key"); out.writeInt(enc.length); out.write(enc); } } protected static class ParentCertificateField extends Field { public static final int FIELD_TYPE = 0x43455254; public Certificate parent; public ParentCertificateField() { this.type = FIELD_TYPE; } public ParentCertificateField(Certificate parent) { this.type = FIELD_TYPE; this.parent = parent; } public Object clone() { return new ParentCertificateField(parent); } public void decode(DataInputStream in) throws IOException { String type = in.readUTF(); int encsize = in.readInt(); if (encsize <= 0) throw new IOException("Invalid key encoding size"); byte[] enc = new byte[encsize]; in.readFully(enc); ByteArrayInputStream bin = new ByteArrayInputStream(enc); try { CertificateFactory cf = CertificateFactory.getInstance(type); parent = cf.generateCertificate(bin); } catch (CertificateException e) { throw new IOException("Invalid certificate encoding or type"); } } public void encode(DataOutputStream out) throws IOException { out.writeUTF(parent.getType()); try { byte[] enc = parent.getEncoded(); out.writeInt(enc.length); out.write(enc); } catch (CertificateEncodingException e) { throw new IOException("Couldn't encoding certificate"); } } } protected static Field instantiateField(int type) { switch (type) { case PublicKeyField.FIELD_TYPE: return new PublicKeyField(); case ParentCertificateField.FIELD_TYPE: return new ParentCertificateField(); default: return new UnknownField(); } } private byte[] _enc; protected String issuer = null; protected String subject = null; protected Date created = null; protected Date expires = null; protected ArrayList fields = new ArrayList(); protected String signatureAlgorithm = null; protected byte[] signature = null; protected void encodeTBS(DataOutputStream out) throws IOException { out.writeUTF(issuer); out.writeUTF(subject); out.writeLong(created.getTime()); out.writeLong(expires.getTime()); out.writeInt(fields.size()); for (int i = 0; i < fields.size(); i++) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); Object obj = fields.get(i); if (obj instanceof Field) { Field f = (Field) obj; f.encode(dos); dos.close(); byte[] fenc = bos.toByteArray(); out.writeInt(f.type); out.writeInt(fenc.length); out.write(fenc); } } } protected byte[] encodeTBS() throws CertificateEncodingException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); try { encodeTBS(dos); dos.close(); } catch (IOException e) { throw new CertificateEncodingException(e.getMessage()); } return bos.toByteArray(); } protected BeeCertificate() { super("BEE"); } public BeeCertificate(BeeCertificate copy) { super("BEE"); issuer = copy.issuer; subject = copy.subject; created = new Date(copy.created.getTime()); expires = new Date(copy.expires.getTime()); fields.addAll(copy.fields); signatureAlgorithm = copy.signatureAlgorithm; if (copy.signature != null) signature = (byte[]) copy.signature.clone(); } public BeeCertificate(InputStream in) throws IOException { super("BEE"); DataInputStream din = new DataInputStream(in); issuer = din.readUTF(); subject = din.readUTF(); created = new Date(din.readLong()); expires = new Date(din.readLong()); int fieldCount = din.readInt(); if (fieldCount < 0) throw new IOException("field count < 0"); fields.ensureCapacity(fieldCount); for (int i = 0; i < fieldCount; i++) { int type = din.readInt(); int fieldSize = din.readInt(); if (fieldSize < 0) throw new IOException("field size < 0"); byte[] fenc = new byte[fieldSize]; din.readFully(fenc); ByteArrayInputStream bis = new ByteArrayInputStream(fenc); DataInputStream fis = new DataInputStream(bis); Field f = instantiateField(type); f.decode(fis); fields.add(f); } signatureAlgorithm = din.readUTF(); int sigSize = din.readInt(); if (sigSize < 0) throw new IOException("signature size < 0"); signature = new byte[sigSize]; din.readFully(signature); } public byte[] getEncoded() throws CertificateEncodingException { if (_enc == null) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); try { encodeTBS(dos); dos.writeUTF(signatureAlgorithm); dos.writeInt(signature.length); dos.write(signature); dos.close(); _enc = bos.toByteArray(); } catch (IOException e) { throw new CertificateEncodingException(e.getMessage()); } } return _enc; } public PublicKey getPublicKey() { for (int i = 0; i < fields.size(); i++) { Object obj = fields.get(i); if (obj instanceof PublicKeyField) return ((PublicKeyField) obj).pub; } return null; } public Certificate getParentCertificate() { for (int i = 0; i < fields.size(); i++) { Object obj = fields.get(i); if (obj instanceof ParentCertificateField) return ((ParentCertificateField) obj).parent; } return null; } public void verify(PublicKey pub) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { Signature sig = Signature.getInstance(signatureAlgorithm); sig.initVerify(pub); sig.update(encodeTBS()); if (!sig.verify(signature)) throw new CertificateException("signature doesn't match"); } public void verify(PublicKey pub, String algorithm) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { Signature sig = Signature.getInstance(algorithm); sig.initVerify(pub); sig.update(encodeTBS()); if (!sig.verify(signature)) throw new CertificateException("signature doesn't match"); } public String toString() { StringBuffer tmp = new StringBuffer(); tmp.append("BEE ").append(subject); if (issuer.length() > 0) tmp.append(" issued by ").append(issuer); tmp.append(" valid from ").append(created.toString()).append(" until ") .append(expires.equals(FOREVER) ? "-" : expires.toString()); /** todo add fields */ return tmp.toString(); } public void checkValidity() throws CertificateExpiredException, CertificateNotYetValidException { checkValidity(new Date()); } public void checkValidity(Date at) throws CertificateExpiredException, CertificateNotYetValidException { if (at.before(created)) throw new CertificateNotYetValidException(); if (!expires.equals(FOREVER)) if (at.after(expires)) throw new CertificateExpiredException(); if (hasParentCertificate()) { // parent certificate had to be valid when this one was created Certificate parent = getParentCertificate(); if (parent instanceof BeeCertificate) ((BeeCertificate) parent).checkValidity(created); } } public Date getNotAfter() { return expires; } public Date getNotBefore() { return created; } public byte[] getSignature() { return signature; } public String getSigAlgName() { return signatureAlgorithm; } public boolean hasPublicKey() { for (int i = 0; i < fields.size(); i++) { Object obj = fields.get(i); if (obj instanceof PublicKeyField) return true; } return false; } public boolean hasParentCertificate() { for (int i = 0; i < fields.size(); i++) { Object obj = fields.get(i); if (obj instanceof ParentCertificateField) return true; } return false; } public boolean isSelfSignedCertificate() { if (hasParentCertificate()) return false; if (!hasPublicKey()) return false; try { verify(getPublicKey()); return true; } catch (Exception e) { return false; } } public static BeeCertificate self(PublicKey publicKey, PrivateKey signKey, String signatureAlgorithm) throws InvalidKeyException, SignatureException, CertificateEncodingException, NoSuchAlgorithmException { if (publicKey.getEncoded() == null) throw new InvalidKeyException("PublicKey doesn't have an encoding"); Signature sig = Signature.getInstance(signatureAlgorithm); sig.initSign(signKey); BeeCertificate cert = new BeeCertificate(); cert.subject = "Public Key Certificate"; cert.expires = FOREVER; cert.signatureAlgorithm = signatureAlgorithm; cert.fields.add(new PublicKeyField(publicKey)); byte[] tmp = cert.encodeTBS(); sig.update(tmp); cert.signature = sig.sign(); return cert; } public BeeCertificate make(PublicKey publicKey, PrivateKey signKey, String signatureAlgorithm, Certificate parent) throws InvalidKeyException, CertificateEncodingException, SignatureException, NoSuchAlgorithmException { if (publicKey.getEncoded() == null) throw new InvalidKeyException("PublicKey doesn't have an encoding"); Signature sig = Signature.getInstance(signatureAlgorithm); sig.initSign(signKey); BeeCertificate cert = new BeeCertificate(); cert.subject = "Public Key Certificate"; cert.expires = FOREVER; cert.signatureAlgorithm = signatureAlgorithm; cert.fields.add(new PublicKeyField(publicKey)); cert.fields.add(new ParentCertificateField(parent)); byte[] tmp = cert.encodeTBS(); sig.update(tmp); cert.signature = sig.sign(); return cert; } } beecrypt-4.2.1/java/src/beecrypt/beeyond/AnyEncodedKeySpec.java0000644000175000001440000000044511216147023021362 00000000000000package beecrypt.beeyond; import java.security.spec.*; public class AnyEncodedKeySpec extends EncodedKeySpec { String format; public AnyEncodedKeySpec(String format, byte[] encodedKey) { super(encodedKey); this.format = format; } public String getFormat() { return format; } } beecrypt-4.2.1/java/src/beecrypt/crypto/0000777000175000001440000000000011226307274015205 500000000000000beecrypt-4.2.1/java/src/beecrypt/crypto/spec/0000777000175000001440000000000011226307274016137 500000000000000beecrypt-4.2.1/java/src/beecrypt/crypto/spec/DHIESDecryptParameterSpec.java0000644000175000001440000000116511216147023023555 00000000000000package beecrypt.crypto.spec; import java.math.BigInteger; import java.security.spec.*; public class DHIESDecryptParameterSpec extends DHIESParameterSpec { private BigInteger pub; private byte[] mac; public DHIESDecryptParameterSpec(DHIESParameterSpec copy, BigInteger pub, byte[] mac) { super(copy); this.pub = pub; this.mac = (byte[]) mac.clone(); } public DHIESDecryptParameterSpec(DHIESDecryptParameterSpec copy) { super(copy); this.pub = copy.pub; this.mac = (byte[]) copy.mac.clone(); } public BigInteger getEphemeralPublicKey() { return pub; } public byte[] getMac() { return mac; } } beecrypt-4.2.1/java/src/beecrypt/crypto/spec/DHIESParameterSpec.java0000644000175000001440000000561111216147024022223 00000000000000package beecrypt.crypto.spec; import java.security.spec.*; import java.util.regex.*; public class DHIESParameterSpec implements AlgorithmParameterSpec { private static final Pattern DHIESPAT = Pattern .compile("DHIES\\((\\w(?:\\w|\\d)*(?:-(?:\\w|\\d)*)*),(\\w(?:\\w|\\d)*(?:-(?:\\w|\\d)*)*),(\\w(?:\\w|\\d)*(?:-(?:\\w|\\d)*)*)(?:,(\\d+))?(?:,(\\d+))?\\)"); private String messageDigestAlgorithm; private String cipherAlgorithm; private String macAlgorithm; private int cipherKeyLength; private int macKeyLength; public DHIESParameterSpec(String description) throws IllegalArgumentException { Matcher m = DHIESPAT.matcher(description); if (!m.matches()) throw new IllegalArgumentException( "couldn't parse descriptor into DHIES(,,[,[,]])"); messageDigestAlgorithm = m.group(1); cipherAlgorithm = m.group(2); macAlgorithm = m.group(3); String tmp = m.group(4); if (tmp != null && tmp.length() > 0) cipherKeyLength = Integer.parseInt(tmp); else cipherKeyLength = 0; tmp = m.group(5); if (tmp != null && tmp.length() > 0) macKeyLength = Integer.parseInt(tmp); else macKeyLength = 0; } public DHIESParameterSpec(String messageDigestAlgorithm, String cipherAlgorithm, String macAlgorithm) { this(messageDigestAlgorithm, cipherAlgorithm, macAlgorithm, 0, 0); } public DHIESParameterSpec(String messageDigestAlgorithm, String cipherAlgorithm, String macAlgorithm, int cipherKeyLength, int macKeyLength) { if (cipherKeyLength < 0 || macKeyLength < 0) throw new IllegalArgumentException(); this.messageDigestAlgorithm = messageDigestAlgorithm; this.cipherAlgorithm = cipherAlgorithm; this.macAlgorithm = macAlgorithm; this.cipherKeyLength = cipherKeyLength; this.macKeyLength = macKeyLength; } public DHIESParameterSpec(DHIESParameterSpec copy) { this.messageDigestAlgorithm = copy.messageDigestAlgorithm; this.cipherAlgorithm = copy.cipherAlgorithm; this.macAlgorithm = copy.macAlgorithm; this.cipherKeyLength = copy.cipherKeyLength; this.macKeyLength = copy.macKeyLength; } public String getCipherAlgorithm() { return cipherAlgorithm; } public String getMacAlgorithm() { return macAlgorithm; } public String getMessageDigestAlgorithm() { return messageDigestAlgorithm; } public int getCipherKeyLength() { return cipherKeyLength; } public int getMacKeyLength() { return macKeyLength; } public String toString() { StringBuffer tmp = new StringBuffer(); tmp.append("DHIES(").append(messageDigestAlgorithm).append(',').append( cipherAlgorithm).append(',').append(macAlgorithm); if (macKeyLength > 0) { tmp.append(',').append(Integer.toString(cipherKeyLength)); tmp.append(',').append(Integer.toString(macKeyLength)); } else if (cipherKeyLength > 0) { tmp.append(',').append(Integer.toString(cipherKeyLength)); } return tmp.append(')').toString(); } } beecrypt-4.2.1/java/src/beecrypt/crypto/DHPublicKeyImpl.java0000644000175000001440000000346511216147023020712 00000000000000package beecrypt.crypto; import java.io.*; import java.math.BigInteger; import javax.crypto.*; import javax.crypto.interfaces.*; import javax.crypto.spec.*; import beecrypt.io.*; public class DHPublicKeyImpl implements DHPublicKey, Cloneable { private DHParameterSpec _params; private BigInteger _y; private byte[] _enc; public DHPublicKeyImpl(BigInteger p, BigInteger g, BigInteger y) { _params = new DHParameterSpec(p, g); _y = y; } public DHPublicKeyImpl(DHParameterSpec params, BigInteger y) { _params = params; _y = y; } public DHPublicKeyImpl(DHPublicKeySpec spec) { _params = new DHParameterSpec(spec.getP(), spec.getG()); _y = spec.getY(); } public DHPublicKeyImpl(DHPublicKey key) { _params = key.getParams(); _y = key.getY(); } public Object clone() { return new DHPublicKeyImpl(this); } public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof DHPublicKey) { DHPublicKey pri = (DHPublicKey) obj; if (!pri.getParams().getP().equals(_params.getP())) return false; if (!pri.getParams().getG().equals(_params.getG())) return false; if (!pri.getY().equals(_y)) return false; return true; } return false; } public DHParameterSpec getParams() { return _params; } public BigInteger getY() { return _y; } public byte[] getEncoded() { if (_enc == null) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); BeeOutputStream bee = new BeeOutputStream(bos); bee.writeBigInteger(_params.getP()); bee.writeBigInteger(_params.getG()); bee.writeBigInteger(_y); bee.close(); _enc = bos.toByteArray(); } catch (IOException e) { // shouldn't occur } } return _enc; } public String getAlgorithm() { return "DH"; } public String getFormat() { return "BEE"; } } beecrypt-4.2.1/java/src/beecrypt/crypto/DHPrivateKeyImpl.java0000644000175000001440000000350111216147023021075 00000000000000package beecrypt.crypto; import java.io.*; import java.math.BigInteger; import javax.crypto.*; import javax.crypto.interfaces.*; import javax.crypto.spec.*; import beecrypt.io.*; public class DHPrivateKeyImpl implements DHPrivateKey, Cloneable { private DHParameterSpec _params; private BigInteger _x; private byte[] _enc; public DHPrivateKeyImpl(BigInteger p, BigInteger g, BigInteger x) { _params = new DHParameterSpec(p, g); _x = x; } public DHPrivateKeyImpl(DHParameterSpec params, BigInteger x) { _params = params; _x = x; } public DHPrivateKeyImpl(DHPrivateKeySpec spec) { _params = new DHParameterSpec(spec.getP(), spec.getG()); _x = spec.getX(); } public DHPrivateKeyImpl(DHPrivateKey key) { _params = key.getParams(); _x = key.getX(); } public Object clone() { return new DHPrivateKeyImpl(this); } public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof DHPrivateKey) { DHPrivateKey pri = (DHPrivateKey) obj; if (!pri.getParams().getP().equals(_params.getP())) return false; if (!pri.getParams().getG().equals(_params.getG())) return false; if (!pri.getX().equals(_x)) return false; return true; } return false; } public DHParameterSpec getParams() { return _params; } public BigInteger getX() { return _x; } public byte[] getEncoded() { if (_enc == null) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); BeeOutputStream bee = new BeeOutputStream(bos); bee.writeBigInteger(_params.getP()); bee.writeBigInteger(_params.getG()); bee.writeBigInteger(_x); bee.close(); _enc = bos.toByteArray(); } catch (IOException e) { // shouldn't occur } } return _enc; } public String getAlgorithm() { return "DH"; } public String getFormat() { return "BEE"; } } beecrypt-4.2.1/java/src/beecrypt/security/0000777000175000001440000000000011226307274015534 500000000000000beecrypt-4.2.1/java/src/beecrypt/security/RSAPrivateCrtKeyImpl.java0000644000175000001440000000615711216147024022242 00000000000000package beecrypt.security; import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.interfaces.*; import java.security.spec.*; import beecrypt.io.*; public class RSAPrivateCrtKeyImpl implements RSAPrivateCrtKey, Cloneable { private BigInteger _n, _e, _d, _p, _q, _dp, _dq, _qi; private byte[] _enc; public RSAPrivateCrtKeyImpl(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent, BigInteger primeP, BigInteger primeQ, BigInteger primeExponentP, BigInteger primeExponentQ, BigInteger crtCoefficient) { _n = modulus; _e = publicExponent; _d = privateExponent; _p = primeP; _q = primeQ; _dp = primeExponentP; _dq = primeExponentQ; _qi = crtCoefficient; } public RSAPrivateCrtKeyImpl(RSAPrivateCrtKeySpec spec) { _n = spec.getModulus(); _e = spec.getPublicExponent(); _d = spec.getPrivateExponent(); _p = spec.getPrimeP(); _q = spec.getPrimeQ(); _dp = spec.getPrimeExponentP(); _dq = spec.getPrimeExponentQ(); _qi = spec.getCrtCoefficient(); } public RSAPrivateCrtKeyImpl(RSAPrivateCrtKey key) { _n = key.getModulus(); _e = key.getPublicExponent(); _d = key.getPrivateExponent(); _p = key.getPrimeP(); _q = key.getPrimeQ(); _dp = key.getPrimeExponentP(); _dq = key.getPrimeExponentQ(); _qi = key.getCrtCoefficient(); } public Object clone() { return new RSAPrivateCrtKeyImpl(this); } public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof RSAPrivateCrtKey) { RSAPrivateCrtKey pri = (RSAPrivateCrtKey) obj; if (!pri.getModulus().equals(_n)) return false; if (!pri.getPublicExponent().equals(_e)) return false; if (!pri.getPrivateExponent().equals(_d)) return false; if (!pri.getPrimeP().equals(_p)) return false; if (!pri.getPrimeQ().equals(_q)) return false; if (!pri.getPrimeExponentP().equals(_dp)) return false; if (!pri.getPrimeExponentQ().equals(_dq)) return false; if (!pri.getCrtCoefficient().equals(_qi)) return false; return true; } return false; } public BigInteger getModulus() { return _n; } public BigInteger getPublicExponent() { return _e; } public BigInteger getPrivateExponent() { return _d; } public BigInteger getPrimeP() { return _p; } public BigInteger getPrimeQ() { return _q; } public BigInteger getPrimeExponentP() { return _dp; } public BigInteger getPrimeExponentQ() { return _dq; } public BigInteger getCrtCoefficient() { return _qi; } public byte[] getEncoded() { if (_enc == null) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); BeeOutputStream bee = new BeeOutputStream(bos); bee.writeBigInteger(_n); bee.writeBigInteger(_d); bee.writeBigInteger(_e); bee.writeBigInteger(_p); bee.writeBigInteger(_q); bee.writeBigInteger(_dp); bee.writeBigInteger(_dq); bee.writeBigInteger(_qi); bee.close(); _enc = bos.toByteArray(); } catch (IOException e) { // shouldn't occur } } return _enc; } public String getAlgorithm() { return "RSA"; } public String getFormat() { return "BEE"; } } beecrypt-4.2.1/java/src/beecrypt/security/RSAPrivateKeyImpl.java0000644000175000001440000000311011216147024021553 00000000000000package beecrypt.security; import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.interfaces.*; import java.security.spec.*; import beecrypt.io.*; public class RSAPrivateKeyImpl implements RSAPrivateKey, Cloneable { private BigInteger _n, _d; private byte[] _enc; public RSAPrivateKeyImpl(BigInteger modulus, BigInteger privateExponent) { _n = modulus; _d = privateExponent; } public RSAPrivateKeyImpl(RSAPrivateKeySpec spec) { _n = spec.getModulus(); _d = spec.getPrivateExponent(); } public RSAPrivateKeyImpl(RSAPrivateKey key) { _n = key.getModulus(); _d = key.getPrivateExponent(); } public Object clone() { return new RSAPrivateKeyImpl(this); } public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof RSAPrivateKey) { RSAPrivateKey pri = (RSAPrivateKey) obj; if (!pri.getModulus().equals(_n)) return false; if (!pri.getPrivateExponent().equals(_d)) return false; return true; } return false; } public BigInteger getModulus() { return _n; } public BigInteger getPrivateExponent() { return _d; } public byte[] getEncoded() { if (_enc == null) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); BeeOutputStream bee = new BeeOutputStream(bos); bee.writeBigInteger(_n); bee.writeBigInteger(_d); bee.close(); _enc = bos.toByteArray(); } catch (IOException e) { // shouldn't occur } } return _enc; } public String getAlgorithm() { return "RSA"; } public String getFormat() { return "BEE"; } } beecrypt-4.2.1/java/src/beecrypt/security/DSAPublicKeyImpl.java0000644000175000001440000000405211216147024021347 00000000000000package beecrypt.security; import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.interfaces.*; import java.security.spec.*; import beecrypt.io.*; public class DSAPublicKeyImpl implements DSAPublicKey, Cloneable { private DSAParameterSpec _params; private BigInteger _y; private byte[] _enc; public DSAPublicKeyImpl(BigInteger p, BigInteger q, BigInteger g, BigInteger y) { _params = new DSAParameterSpec(p, q, g); _y = y; } public DSAPublicKeyImpl(DSAParameterSpec params, BigInteger y) { _params = params; _y = y; } public DSAPublicKeyImpl(DSAPublicKeySpec spec) { _params = new DSAParameterSpec(spec.getP(), spec.getQ(), spec.getG()); _y = spec.getY(); } public DSAPublicKeyImpl(DSAPublicKey key) { _params = new DSAParameterSpec(key.getParams().getP(), key.getParams() .getQ(), key.getParams().getG()); _y = key.getY(); } public Object clone() { return new DSAPublicKeyImpl(this); } public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof DSAPublicKey) { DSAPublicKey pri = (DSAPublicKey) obj; if (!pri.getParams().getP().equals(_params.getP())) return false; if (!pri.getParams().getQ().equals(_params.getQ())) return false; if (!pri.getParams().getG().equals(_params.getG())) return false; if (!pri.getY().equals(_y)) return false; return true; } return false; } public DSAParams getParams() { return _params; } public BigInteger getY() { return _y; } public byte[] getEncoded() { if (_enc == null) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); BeeOutputStream bee = new BeeOutputStream(bos); bee.writeBigInteger(_params.getP()); bee.writeBigInteger(_params.getQ()); bee.writeBigInteger(_params.getG()); bee.writeBigInteger(_y); bee.close(); _enc = bos.toByteArray(); } catch (IOException e) { // shouldn't occur } } return _enc; } public String getAlgorithm() { return "DSA"; } public String getFormat() { return "BEE"; } } beecrypt-4.2.1/java/src/beecrypt/security/DSAPrivateKeyImpl.java0000644000175000001440000000406611216147024021550 00000000000000package beecrypt.security; import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.interfaces.*; import java.security.spec.*; import beecrypt.io.*; public class DSAPrivateKeyImpl implements DSAPrivateKey, Cloneable { private DSAParameterSpec _params; private BigInteger _x; private byte[] _enc; public DSAPrivateKeyImpl(BigInteger p, BigInteger q, BigInteger g, BigInteger x) { _params = new DSAParameterSpec(p, q, g); _x = x; } public DSAPrivateKeyImpl(DSAParameterSpec params, BigInteger x) { _params = params; _x = x; } public DSAPrivateKeyImpl(DSAPrivateKeySpec spec) { _params = new DSAParameterSpec(spec.getP(), spec.getQ(), spec.getG()); _x = spec.getX(); } public DSAPrivateKeyImpl(DSAPrivateKey key) { _params = new DSAParameterSpec(key.getParams().getP(), key.getParams() .getQ(), key.getParams().getG()); _x = key.getX(); } public Object clone() { return new DSAPrivateKeyImpl(this); } public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof DSAPrivateKey) { DSAPrivateKey pri = (DSAPrivateKey) obj; if (!pri.getParams().getP().equals(_params.getP())) return false; if (!pri.getParams().getQ().equals(_params.getQ())) return false; if (!pri.getParams().getG().equals(_params.getG())) return false; if (!pri.getX().equals(_x)) return false; return true; } return false; } public DSAParams getParams() { return _params; } public BigInteger getX() { return _x; } public byte[] getEncoded() { if (_enc == null) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); BeeOutputStream bee = new BeeOutputStream(bos); bee.writeBigInteger(_params.getP()); bee.writeBigInteger(_params.getQ()); bee.writeBigInteger(_params.getG()); bee.writeBigInteger(_x); bee.close(); _enc = bos.toByteArray(); } catch (IOException e) { // shouldn't occur } } return _enc; } public String getAlgorithm() { return "DSA"; } public String getFormat() { return "BEE"; } } beecrypt-4.2.1/java/src/beecrypt/security/RSAPublicKeyImpl.java0000644000175000001440000000306711216147024021372 00000000000000package beecrypt.security; import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.interfaces.*; import java.security.spec.*; import beecrypt.io.*; public class RSAPublicKeyImpl implements RSAPublicKey, Cloneable { private BigInteger _n, _e; private byte[] _enc; public RSAPublicKeyImpl(BigInteger modulus, BigInteger publicExponent) { _n = modulus; _e = publicExponent; } public RSAPublicKeyImpl(RSAPublicKeySpec spec) { _n = spec.getModulus(); _e = spec.getPublicExponent(); } public RSAPublicKeyImpl(RSAPublicKey key) { _n = key.getModulus(); _e = key.getPublicExponent(); } public Object clone() { return new RSAPublicKeyImpl(this); } public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof RSAPublicKey) { RSAPublicKey pri = (RSAPublicKey) obj; if (!pri.getModulus().equals(_n)) return false; if (!pri.getPublicExponent().equals(_e)) return false; return true; } return false; } public BigInteger getModulus() { return _n; } public BigInteger getPublicExponent() { return _e; } public byte[] getEncoded() { if (_enc == null) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); BeeOutputStream bee = new BeeOutputStream(bos); bee.writeBigInteger(_n); bee.writeBigInteger(_e); bee.close(); _enc = bos.toByteArray(); } catch (IOException e) { // shouldn't occur } } return _enc; } public String getAlgorithm() { return "RSA"; } public String getFormat() { return "BEE"; } } beecrypt-4.2.1/java/beecrypt_provider_HMACMD5.c0000644000175000001440000000515610545710077016177 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacmd5.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_HMACMD5.h" jlong JNICALL Java_beecrypt_provider_HMACMD5_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(hmacmd5Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } md5Reset((md5Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_HMACMD5_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(hmacmd5Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(md5Param)); return clone; } void JNICALL Java_beecrypt_provider_HMACMD5_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_HMACMD5_doFinal__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[16]; jbyteArray result = (*env)->NewByteArray(env, 16); hmacmd5Digest((hmacmd5Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 16, digest); return result; } void JNICALL Java_beecrypt_provider_HMACMD5_init(JNIEnv* env, jclass dummy, jlong param, jbyteArray rawkey) { jbyte* data = (*env)->GetByteArrayElements(env, rawkey, 0); if (data) { jint len = (*env)->GetArrayLength(env, rawkey); hmacmd5Setup((hmacmd5Param*) param, data, len); (*env)->ReleaseByteArrayElements(env, rawkey, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } void JNICALL Java_beecrypt_provider_HMACMD5_reset(JNIEnv* env, jclass dummy, jlong param) { hmacmd5Reset((hmacmd5Param*) param); } void JNICALL Java_beecrypt_provider_HMACMD5_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { hmacmd5Update((hmacmd5Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_HMACMD5_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { hmacmd5Update((hmacmd5Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/beecrypt_provider_DHKeyPairGenerator.c0000644000175000001440000000403310545710070020572 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/dlkp.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_tools.h" #include "beecrypt/java/beecrypt_provider_DHKeyPairGenerator.h" /* need an adapter from SecureRandom to randomGenerator */ void JNICALL Java_beecrypt_provider_DHKeyPairGenerator_generate(JNIEnv* env, jobject obj) { jclass cls = (*env)->GetObjectClass(env, obj); jfieldID sid = (*env)->GetFieldID(env, cls, "_size", "I"); jfieldID fid; if (sid) { randomGeneratorContext rngc; dlkp_p pair; jint keybits = (*env)->GetIntField(env, obj, sid); jint pribits = keybits; randomGeneratorContextInit(&rngc, randomGeneratorDefault()); dlkp_pInit(&pair); fid = (*env)->GetFieldID(env, cls, "_p", "[B"); if (fid) { mpbsetbigint(&pair.param.p, env, (*env)->GetObjectField(env, obj, fid)); } fid = (*env)->GetFieldID(env, cls, "_g", "[B"); if (fid) { mpnsetbigint(&pair.param.g, env, (*env)->GetObjectField(env, obj, fid)); } fid = (*env)->GetFieldID(env, cls, "_l", "I"); if (fid) { pribits = (*env)->GetIntField(env, obj, fid); } if (mpz(pair.param.p.size, pair.param.p.modl) || mpz(pair.param.g.size, pair.param.g.data)) dldp_pgonMakeSafe(&pair.param, &rngc, keybits); dldp_pPair_s(&pair.param, &rngc, &pair.x, &pair.y, pribits); if ((fid = (*env)->GetFieldID(env, cls, "_p", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.param.p.size, pair.param.p.modl)); if ((fid = (*env)->GetFieldID(env, cls, "_g", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.param.g.size, pair.param.g.data)); if ((fid = (*env)->GetFieldID(env, cls, "_x", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.x.size, pair.x.data)); if ((fid = (*env)->GetFieldID(env, cls, "_y", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.y.size, pair.y.data)); dlkp_pFree(&pair); randomGeneratorContextFree(&rngc); } } #endif beecrypt-4.2.1/java/beecrypt_provider_SHA256.c0000644000175000001440000000506010545710153016016 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha256.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_SHA256.h" jlong JNICALL Java_beecrypt_provider_SHA256_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(sha256Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha256Reset((sha256Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_SHA256_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(sha256Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(sha256Param)); return clone; } void JNICALL Java_beecrypt_provider_SHA256_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_SHA256_digest__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[32]; jbyteArray result = (*env)->NewByteArray(env, 32); sha256Digest((sha256Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 32, digest); return result; } jint JNICALL Java_beecrypt_provider_SHA256_digest__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray buf, jint off, jint len) { if (len < 32) { jclass ex = (*env)->FindClass(env, "java/security/DigestException"); if (ex) (*env)->ThrowNew(env, ex, "len must be at least 32"); } else { jbyte digest[32]; sha256Digest((sha256Param*) param, digest); (*env)->SetByteArrayRegion(env, buf, off, 32, digest); return 32; } } void JNICALL Java_beecrypt_provider_SHA256_reset(JNIEnv* env, jclass dummy, jlong param) { sha256Reset((sha256Param*) param); } void JNICALL Java_beecrypt_provider_SHA256_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { sha256Update((sha256Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_SHA256_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { sha256Update((sha256Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/README0000644000175000001440000000047611216163021012051 00000000000000Assumptions made by the build system (which should be fixed, as soon as I can figure out the right options to make Ant run with gcj). The build system assumes that ant can be called; in a later phase, autoconf should check for the executable. The build system assumes the presence of 'java' and 'javac' executables. beecrypt-4.2.1/java/beecrypt_provider_HMACSHA384.c0000644000175000001440000000527110545710116016454 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha384.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_HMACSHA384.h" jlong JNICALL Java_beecrypt_provider_HMACSHA384_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(hmacsha384Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha384Reset((sha384Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_HMACSHA384_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(hmacsha384Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(sha384Param)); return clone; } void JNICALL Java_beecrypt_provider_HMACSHA384_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_HMACSHA384_doFinal__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[48]; jbyteArray result = (*env)->NewByteArray(env, 48); hmacsha384Digest((hmacsha384Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 48, digest); return result; } void JNICALL Java_beecrypt_provider_HMACSHA384_init(JNIEnv* env, jclass dummy, jlong param, jbyteArray rawkey) { jbyte* data = (*env)->GetByteArrayElements(env, rawkey, 0); if (data) { jint len = (*env)->GetArrayLength(env, rawkey); hmacsha384Setup((hmacsha384Param*) param, data, len); (*env)->ReleaseByteArrayElements(env, rawkey, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } void JNICALL Java_beecrypt_provider_HMACSHA384_reset(JNIEnv* env, jclass dummy, jlong param) { hmacsha384Reset((hmacsha384Param*) param); } void JNICALL Java_beecrypt_provider_HMACSHA384_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { hmacsha384Update((hmacsha384Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_HMACSHA384_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { hmacsha384Update((hmacsha384Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/Makefile.in0000644000175000001440000005063511226307162013247 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Copyright (c) 2003, 2005 X-Way Rights BV # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = java DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/build.xml.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = build.xml CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libaltdir)" LTLIBRARIES = $(libalt_LTLIBRARIES) libbeecrypt_java_la_DEPENDENCIES = $(top_builddir)/libbeecrypt.la am_libbeecrypt_java_la_OBJECTS = beecrypt_tools.lo \ beecrypt_provider_AES.lo beecrypt_provider_MD4.lo \ beecrypt_provider_MD5.lo beecrypt_provider_SHA1.lo \ beecrypt_provider_SHA224.lo beecrypt_provider_SHA256.lo \ beecrypt_provider_SHA384.lo beecrypt_provider_SHA512.lo \ beecrypt_provider_HMACMD5.lo beecrypt_provider_HMACSHA1.lo \ beecrypt_provider_HMACSHA256.lo \ beecrypt_provider_HMACSHA384.lo \ beecrypt_provider_HMACSHA512.lo \ beecrypt_provider_DHKeyPairGenerator.lo \ beecrypt_provider_RSAKeyPairGenerator.lo libbeecrypt_java_la_OBJECTS = $(am_libbeecrypt_java_la_OBJECTS) libbeecrypt_java_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libbeecrypt_java_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libbeecrypt_java_la_SOURCES) DIST_SOURCES = $(libbeecrypt_java_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu no-dependencies LIBBEECRYPT_JAVA_LT_CURRENT = 7 LIBBEECRYPT_JAVA_LT_AGE = 0 LIBBEECRYPT_JAVA_LT_REVISION = 0 INCLUDES = -I$(top_srcdir)/include libaltdir = $(prefix)/lib@LIBALT@ libalt_LTLIBRARIES = libbeecrypt_java.la libbeecrypt_java_la_SOURCES = \ beecrypt_tools.c \ beecrypt_provider_AES.c \ beecrypt_provider_MD4.c \ beecrypt_provider_MD5.c \ beecrypt_provider_SHA1.c \ beecrypt_provider_SHA224.c \ beecrypt_provider_SHA256.c \ beecrypt_provider_SHA384.c \ beecrypt_provider_SHA512.c \ beecrypt_provider_HMACMD5.c \ beecrypt_provider_HMACSHA1.c \ beecrypt_provider_HMACSHA256.c \ beecrypt_provider_HMACSHA384.c \ beecrypt_provider_HMACSHA512.c \ beecrypt_provider_DHKeyPairGenerator.c \ beecrypt_provider_RSAKeyPairGenerator.c libbeecrypt_java_la_LIBADD = $(top_builddir)/libbeecrypt.la libbeecrypt_java_la_LDFLAGS = -no-undefined -version-info $(LIBBEECRYPT_JAVA_LT_CURRENT):$(LIBBEECRYPT_JAVA_LT_REVISION):$(LIBBEECRYPT_JAVA_LT_AGE) EXTRA_DIST = \ src/beecrypt/beeyond/AnyEncodedKeySpec.java \ src/beecrypt/beeyond/BeeCertificate.java \ src/beecrypt/beeyond/BeeEncodedKeySpec.java \ src/beecrypt/beeyond/PKCS12PBEKey.java \ src/beecrypt/crypto/DHPrivateKeyImpl.java \ src/beecrypt/crypto/DHPublicKeyImpl.java \ src/beecrypt/crypto/spec/DHIESDecryptParameterSpec.java \ src/beecrypt/crypto/spec/DHIESParameterSpec.java \ src/beecrypt/io/BeeInputStream.java \ src/beecrypt/io/BeeOutputStream.java \ src/beecrypt/io/MacInputStream.java \ src/beecrypt/io/MacOutputStream.java \ src/beecrypt/provider/BaseProvider.java \ src/beecrypt/provider/BeeKeyStore.java \ src/beecrypt/provider/DHIESParameters.java \ src/beecrypt/provider/DHKeyFactory.java \ src/beecrypt/provider/DSAKeyFactory.java \ src/beecrypt/provider/KeyProtector.java \ src/beecrypt/provider/MD4.java \ src/beecrypt/provider/MD5.java \ src/beecrypt/provider/PKCS12.java \ src/beecrypt/provider/RSAKeyFactory.java \ src/beecrypt/provider/RSAKeyPairGenerator.java \ src/beecrypt/provider/SHA1.java \ src/beecrypt/provider/SHA224.java \ src/beecrypt/provider/SHA256.java \ src/beecrypt/provider/SHA384.java \ src/beecrypt/provider/SHA512.java \ src/beecrypt/security/DSAPrivateKeyImpl.java \ src/beecrypt/security/DSAPublicKeyImpl.java \ src/beecrypt/security/RSAPrivateCrtKeyImpl.java \ src/beecrypt/security/RSAPrivateKeyImpl.java \ src/beecrypt/security/RSAPublicKeyImpl.java all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu java/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu java/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): build.xml: $(top_builddir)/config.status $(srcdir)/build.xml.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libaltLTLIBRARIES: $(libalt_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libaltdir)" || $(MKDIR_P) "$(DESTDIR)$(libaltdir)" @list='$(libalt_LTLIBRARIES)'; test -n "$(libaltdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libaltdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libaltdir)"; \ } uninstall-libaltLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(libalt_LTLIBRARIES)'; test -n "$(libaltdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libaltdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libaltdir)/$$f"; \ done clean-libaltLTLIBRARIES: -test -z "$(libalt_LTLIBRARIES)" || rm -f $(libalt_LTLIBRARIES) @list='$(libalt_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libbeecrypt_java.la: $(libbeecrypt_java_la_OBJECTS) $(libbeecrypt_java_la_DEPENDENCIES) $(libbeecrypt_java_la_LINK) -rpath $(libaltdir) $(libbeecrypt_java_la_OBJECTS) $(libbeecrypt_java_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c .c.o: $(COMPILE) -c $< .c.obj: $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libaltdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libaltLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-libaltLTLIBRARIES install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libaltLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libaltLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am \ install-libaltLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-libaltLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/java/beecrypt_provider_SHA384.c0000644000175000001440000000506010545710161016017 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha384.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_SHA384.h" jlong JNICALL Java_beecrypt_provider_SHA384_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(sha384Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha384Reset((sha384Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_SHA384_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(sha384Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(sha384Param)); return clone; } void JNICALL Java_beecrypt_provider_SHA384_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_SHA384_digest__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[48]; jbyteArray result = (*env)->NewByteArray(env, 48); sha384Digest((sha384Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 48, digest); return result; } jint JNICALL Java_beecrypt_provider_SHA384_digest__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray buf, jint off, jint len) { if (len < 48) { jclass ex = (*env)->FindClass(env, "java/security/DigestException"); if (ex) (*env)->ThrowNew(env, ex, "len must be at least 48"); } else { jbyte digest[48]; sha384Digest((sha384Param*) param, digest); (*env)->SetByteArrayRegion(env, buf, off, 48, digest); return 48; } } void JNICALL Java_beecrypt_provider_SHA384_reset(JNIEnv* env, jclass dummy, jlong param) { sha384Reset((sha384Param*) param); } void JNICALL Java_beecrypt_provider_SHA384_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { sha384Update((sha384Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_SHA384_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { sha384Update((sha384Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/Makefile.am0000644000175000001440000000617011226045307013231 00000000000000# # Copyright (c) 2003, 2005 X-Way Rights BV # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # AUTOMAKE_OPTIONS = gnu no-dependencies LIBBEECRYPT_JAVA_LT_CURRENT = 7 LIBBEECRYPT_JAVA_LT_AGE = 0 LIBBEECRYPT_JAVA_LT_REVISION = 0 INCLUDES = -I$(top_srcdir)/include libaltdir=$(prefix)/lib@LIBALT@ libalt_LTLIBRARIES = libbeecrypt_java.la libbeecrypt_java_la_SOURCES = \ beecrypt_tools.c \ beecrypt_provider_AES.c \ beecrypt_provider_MD4.c \ beecrypt_provider_MD5.c \ beecrypt_provider_SHA1.c \ beecrypt_provider_SHA224.c \ beecrypt_provider_SHA256.c \ beecrypt_provider_SHA384.c \ beecrypt_provider_SHA512.c \ beecrypt_provider_HMACMD5.c \ beecrypt_provider_HMACSHA1.c \ beecrypt_provider_HMACSHA256.c \ beecrypt_provider_HMACSHA384.c \ beecrypt_provider_HMACSHA512.c \ beecrypt_provider_DHKeyPairGenerator.c \ beecrypt_provider_RSAKeyPairGenerator.c libbeecrypt_java_la_LIBADD = $(top_builddir)/libbeecrypt.la libbeecrypt_java_la_LDFLAGS = -no-undefined -version-info $(LIBBEECRYPT_JAVA_LT_CURRENT):$(LIBBEECRYPT_JAVA_LT_REVISION):$(LIBBEECRYPT_JAVA_LT_AGE) EXTRA_DIST = \ src/beecrypt/beeyond/AnyEncodedKeySpec.java \ src/beecrypt/beeyond/BeeCertificate.java \ src/beecrypt/beeyond/BeeEncodedKeySpec.java \ src/beecrypt/beeyond/PKCS12PBEKey.java \ src/beecrypt/crypto/DHPrivateKeyImpl.java \ src/beecrypt/crypto/DHPublicKeyImpl.java \ src/beecrypt/crypto/spec/DHIESDecryptParameterSpec.java \ src/beecrypt/crypto/spec/DHIESParameterSpec.java \ src/beecrypt/io/BeeInputStream.java \ src/beecrypt/io/BeeOutputStream.java \ src/beecrypt/io/MacInputStream.java \ src/beecrypt/io/MacOutputStream.java \ src/beecrypt/provider/BaseProvider.java \ src/beecrypt/provider/BeeKeyStore.java \ src/beecrypt/provider/DHIESParameters.java \ src/beecrypt/provider/DHKeyFactory.java \ src/beecrypt/provider/DSAKeyFactory.java \ src/beecrypt/provider/KeyProtector.java \ src/beecrypt/provider/MD4.java \ src/beecrypt/provider/MD5.java \ src/beecrypt/provider/PKCS12.java \ src/beecrypt/provider/RSAKeyFactory.java \ src/beecrypt/provider/RSAKeyPairGenerator.java \ src/beecrypt/provider/SHA1.java \ src/beecrypt/provider/SHA224.java \ src/beecrypt/provider/SHA256.java \ src/beecrypt/provider/SHA384.java \ src/beecrypt/provider/SHA512.java \ src/beecrypt/security/DSAPrivateKeyImpl.java \ src/beecrypt/security/DSAPublicKeyImpl.java \ src/beecrypt/security/RSAPrivateCrtKeyImpl.java \ src/beecrypt/security/RSAPrivateKeyImpl.java \ src/beecrypt/security/RSAPublicKeyImpl.java beecrypt-4.2.1/java/beecrypt_provider_HMACSHA512.c0000644000175000001440000000527110545710123016443 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha512.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_HMACSHA512.h" jlong JNICALL Java_beecrypt_provider_HMACSHA512_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(hmacsha512Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha512Reset((sha512Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_HMACSHA512_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(hmacsha512Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(sha512Param)); return clone; } void JNICALL Java_beecrypt_provider_HMACSHA512_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_HMACSHA512_doFinal__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[64]; jbyteArray result = (*env)->NewByteArray(env, 64); hmacsha512Digest((hmacsha512Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 64, digest); return result; } void JNICALL Java_beecrypt_provider_HMACSHA512_init(JNIEnv* env, jclass dummy, jlong param, jbyteArray rawkey) { jbyte* data = (*env)->GetByteArrayElements(env, rawkey, 0); if (data) { jint len = (*env)->GetArrayLength(env, rawkey); hmacsha512Setup((hmacsha512Param*) param, data, len); (*env)->ReleaseByteArrayElements(env, rawkey, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } void JNICALL Java_beecrypt_provider_HMACSHA512_reset(JNIEnv* env, jclass dummy, jlong param) { hmacsha512Reset((hmacsha512Param*) param); } void JNICALL Java_beecrypt_provider_HMACSHA512_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { hmacsha512Update((hmacsha512Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_HMACSHA512_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { hmacsha512Update((hmacsha512Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/beecrypt_provider_SHA512.c0000644000175000001440000000506010545710166016015 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha512.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_SHA512.h" jlong JNICALL Java_beecrypt_provider_SHA512_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(sha512Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha512Reset((sha512Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_SHA512_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(sha512Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(sha512Param)); return clone; } void JNICALL Java_beecrypt_provider_SHA512_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_SHA512_digest__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[64]; jbyteArray result = (*env)->NewByteArray(env, 64); sha512Digest((sha512Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 64, digest); return result; } jint JNICALL Java_beecrypt_provider_SHA512_digest__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray buf, jint off, jint len) { if (len < 64) { jclass ex = (*env)->FindClass(env, "java/security/DigestException"); if (ex) (*env)->ThrowNew(env, ex, "len must be at least 64"); } else { jbyte digest[64]; sha512Digest((sha512Param*) param, digest); (*env)->SetByteArrayRegion(env, buf, off, 64, digest); return 64; } } void JNICALL Java_beecrypt_provider_SHA512_reset(JNIEnv* env, jclass dummy, jlong param) { sha512Reset((sha512Param*) param); } void JNICALL Java_beecrypt_provider_SHA512_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { sha512Update((sha512Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_SHA512_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { sha512Update((sha512Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/beecrypt_provider_HMACSHA1.c0000644000175000001440000000520710545710104016272 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha1.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_HMACSHA1.h" jlong JNICALL Java_beecrypt_provider_HMACSHA1_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(hmacsha1Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha1Reset((sha1Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_HMACSHA1_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(hmacsha1Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(sha1Param)); return clone; } void JNICALL Java_beecrypt_provider_HMACSHA1_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_HMACSHA1_doFinal__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[20]; jbyteArray result = (*env)->NewByteArray(env, 20); hmacsha1Digest((hmacsha1Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 20, digest); return result; } void JNICALL Java_beecrypt_provider_HMACSHA1_init(JNIEnv* env, jclass dummy, jlong param, jbyteArray rawkey) { jbyte* data = (*env)->GetByteArrayElements(env, rawkey, 0); if (data) { jint len = (*env)->GetArrayLength(env, rawkey); hmacsha1Setup((hmacsha1Param*) param, data, len); (*env)->ReleaseByteArrayElements(env, rawkey, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } void JNICALL Java_beecrypt_provider_HMACSHA1_reset(JNIEnv* env, jclass dummy, jlong param) { hmacsha1Reset((hmacsha1Param*) param); } void JNICALL Java_beecrypt_provider_HMACSHA1_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { hmacsha1Update((hmacsha1Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_HMACSHA1_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { hmacsha1Update((hmacsha1Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/beecrypt_provider_MD5.c0000644000175000001440000000474510545710130015537 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/md5.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_MD5.h" jlong JNICALL Java_beecrypt_provider_MD5_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(md5Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } md5Reset((md5Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_MD5_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(md5Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(md5Param)); return clone; } void JNICALL Java_beecrypt_provider_MD5_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_MD5_digest__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[16]; jbyteArray result = (*env)->NewByteArray(env, 16); md5Digest((md5Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 16, digest); return result; } jint JNICALL Java_beecrypt_provider_MD5_digest__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray buf, jint off, jint len) { if (len < 16) { jclass ex = (*env)->FindClass(env, "java/security/DigestException"); if (ex) (*env)->ThrowNew(env, ex, "len must be at least 16"); } else { jbyte digest[16]; md5Digest((md5Param*) param, digest); (*env)->SetByteArrayRegion(env, buf, off, 16, digest); return 16; } } void JNICALL Java_beecrypt_provider_MD5_reset(JNIEnv* env, jclass dummy, jlong param) { md5Reset((md5Param*) param); } void JNICALL Java_beecrypt_provider_MD5_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { md5Update((md5Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_MD5_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { md5Update((md5Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/beecrypt_provider_RSAKeyPairGenerator.c0000644000175000001440000000420510545710137020731 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/rsakp.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_tools.h" #include "beecrypt/java/beecrypt_provider_RSAKeyPairGenerator.h" /* need an adapter from SecureRandom to randomGenerator */ void JNICALL Java_beecrypt_provider_RSAKeyPairGenerator_generate(JNIEnv* env, jobject obj) { jclass cls = (*env)->GetObjectClass(env, obj); jfieldID sid = (*env)->GetFieldID(env, cls, "_size", "I"); jfieldID fid; if (sid) { randomGeneratorContext rngc; rsakp pair; jint keybits = (*env)->GetIntField(env, obj, sid); randomGeneratorContextInit(&rngc, randomGeneratorDefault()); rsakpInit(&pair); fid = (*env)->GetFieldID(env, cls, "_e", "[B"); if (fid) { mpnsetbigint(&pair.e, env, (*env)->GetObjectField(env, obj, fid)); } rsakpMake(&pair, &rngc, (size_t) keybits); if ((fid = (*env)->GetFieldID(env, cls, "_n", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.n.size, pair.n.modl)); if ((fid = (*env)->GetFieldID(env, cls, "_e", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.e.size, pair.e.data)); if ((fid = (*env)->GetFieldID(env, cls, "_d", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.d.size, pair.d.data)); if ((fid = (*env)->GetFieldID(env, cls, "_p", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.p.size, pair.p.modl)); if ((fid = (*env)->GetFieldID(env, cls, "_q", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.q.size, pair.q.modl)); if ((fid = (*env)->GetFieldID(env, cls, "_dp", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.dp.size, pair.dp.data)); if ((fid = (*env)->GetFieldID(env, cls, "_dq", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.dq.size, pair.dq.data)); if ((fid = (*env)->GetFieldID(env, cls, "_qi", "[B"))) (*env)->SetObjectField(env, obj, fid, mp_to_bigint(env, pair.qi.size, pair.qi.data)); rsakpFree(&pair); randomGeneratorContextFree(&rngc); } } #endif beecrypt-4.2.1/java/beecrypt_provider_AES.c0000644000175000001440000000124210545710046015555 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/aes.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_AES.h" jlong JNICALL Java_beecrypt_provider_AES_allocParam(JNIEnv *env, jclass dummy) { jlong param = (jlong) malloc(sizeof(aesParam)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } return param; } void JNICALL Java_beecrypt_provider_AES_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } #endif beecrypt-4.2.1/java/beecrypt_provider_HMACSHA256.c0000644000175000001440000000527110545710112016446 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/hmacsha256.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_HMACSHA256.h" jlong JNICALL Java_beecrypt_provider_HMACSHA256_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(hmacsha256Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha256Reset((sha256Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_HMACSHA256_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(hmacsha256Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(sha256Param)); return clone; } void JNICALL Java_beecrypt_provider_HMACSHA256_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_HMACSHA256_doFinal__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[32]; jbyteArray result = (*env)->NewByteArray(env, 32); hmacsha256Digest((hmacsha256Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 32, digest); return result; } void JNICALL Java_beecrypt_provider_HMACSHA256_init(JNIEnv* env, jclass dummy, jlong param, jbyteArray rawkey) { jbyte* data = (*env)->GetByteArrayElements(env, rawkey, 0); if (data) { jint len = (*env)->GetArrayLength(env, rawkey); hmacsha256Setup((hmacsha256Param*) param, data, len); (*env)->ReleaseByteArrayElements(env, rawkey, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } void JNICALL Java_beecrypt_provider_HMACSHA256_reset(JNIEnv* env, jclass dummy, jlong param) { hmacsha256Reset((hmacsha256Param*) param); } void JNICALL Java_beecrypt_provider_HMACSHA256_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { hmacsha256Update((hmacsha256Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_HMACSHA256_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { hmacsha256Update((hmacsha256Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/build.xml.in0000644000175000001440000000605711225165724013434 00000000000000 beecrypt-4.2.1/java/beecrypt_provider_SHA224.c0000644000175000001440000000506011225172244016010 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha224.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_SHA224.h" jlong JNICALL Java_beecrypt_provider_SHA224_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(sha224Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha224Reset((sha224Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_SHA224_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(sha224Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(sha224Param)); return clone; } void JNICALL Java_beecrypt_provider_SHA224_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_SHA224_digest__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[24]; jbyteArray result = (*env)->NewByteArray(env, 24); sha224Digest((sha224Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 24, digest); return result; } jint JNICALL Java_beecrypt_provider_SHA224_digest__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray buf, jint off, jint len) { if (len < 24) { jclass ex = (*env)->FindClass(env, "java/security/DigestException"); if (ex) (*env)->ThrowNew(env, ex, "len must be at least 24"); } else { jbyte digest[24]; sha224Digest((sha224Param*) param, digest); (*env)->SetByteArrayRegion(env, buf, off, 24, digest); return 24; } } void JNICALL Java_beecrypt_provider_SHA224_reset(JNIEnv* env, jclass dummy, jlong param) { sha224Reset((sha224Param*) param); } void JNICALL Java_beecrypt_provider_SHA224_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { sha224Update((sha224Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_SHA224_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { sha224Update((sha224Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/java/beecrypt_tools.c0000644000175000001440000000217010545710025014371 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/api.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_tools.h" jbyteArray mp_to_bigint(JNIEnv* env, size_t size, mpw* data) { size_t sigbits = mpbits(size, data); size_t req = (sigbits + 8) >> 3; jbyteArray tmp = (*env)->NewByteArray(env, req); jbyte* tmpdata = (*env)->GetByteArrayElements(env, tmp, (jboolean*) 0); if (tmpdata) { int rc = i2osp(tmpdata, req, data, size); (*env)->ReleaseByteArrayElements(env, tmp, tmpdata, 0); return tmp; } return 0; } void mpnsetbigint(mpnumber* n, JNIEnv* env, jbyteArray val) { if (val) { jsize size = (*env)->GetArrayLength(env, val); jbyte* data = (*env)->GetByteArrayElements(env, val, (jboolean*) 0); mpnsetbin(n, data, size); } else mpnzero(n); } void mpbsetbigint(mpbarrett* b, JNIEnv* env, jbyteArray val) { if (val) { jsize size = (*env)->GetArrayLength(env, val); jbyte* data = (*env)->GetByteArrayElements(env, val, (jboolean*) 0); mpbsetbin(b, data, size); } else mpbzero(b); } #endif beecrypt-4.2.1/java/beecrypt_provider_SHA1.c0000644000175000001440000000477610545710145015660 00000000000000#if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha1.h" #if JAVAGLUE #if HAVE_STDLIB_H # include #endif #if HAVE_MALLOC_H # include #endif #include "beecrypt/java/beecrypt_provider_SHA1.h" jlong JNICALL Java_beecrypt_provider_SHA1_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(sha1Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha1Reset((sha1Param*) param); return param; } jlong JNICALL Java_beecrypt_provider_SHA1_cloneParam(JNIEnv* env, jclass dummy, jlong param) { jlong clone = (jlong) malloc(sizeof(sha1Param)); if (clone == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } memcpy((void*) clone, (void*) param, sizeof(sha1Param)); return clone; } void JNICALL Java_beecrypt_provider_SHA1_freeParam(JNIEnv* env, jclass dummy, jlong param) { if (param) free((void*) param); } jbyteArray JNICALL Java_beecrypt_provider_SHA1_digest__J(JNIEnv* env, jclass dummy, jlong param) { jbyte digest[20]; jbyteArray result = (*env)->NewByteArray(env, 20); sha1Digest((sha1Param*) param, digest); (*env)->SetByteArrayRegion(env, result, 0, 20, digest); return result; } jint JNICALL Java_beecrypt_provider_SHA1_digest__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray buf, jint off, jint len) { if (len < 20) { jclass ex = (*env)->FindClass(env, "java/security/DigestException"); if (ex) (*env)->ThrowNew(env, ex, "len must be at least 20"); } else { jbyte digest[20]; sha1Digest((sha1Param*) param, digest); (*env)->SetByteArrayRegion(env, buf, off, 20, digest); return 20; } } void JNICALL Java_beecrypt_provider_SHA1_reset(JNIEnv* env, jclass dummy, jlong param) { sha1Reset((sha1Param*) param); } void JNICALL Java_beecrypt_provider_SHA1_update__JB(JNIEnv* env, jclass dummy, jlong param, jbyte input) { sha1Update((sha1Param*) param, &input, 1); } void JNICALL Java_beecrypt_provider_SHA1_update__J_3BII(JNIEnv* env, jclass dummy, jlong param, jbyteArray input, jint off, jint len) { jbyte* data = (*env)->GetByteArrayElements(env, input, 0); if (data) { sha1Update((sha1Param*) param, data+off, len); (*env)->ReleaseByteArrayElements(env, input, data, JNI_ABORT); } else { jclass ex = (*env)->FindClass(env, "java/lang/NullPointerException"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } } #endif beecrypt-4.2.1/acinclude.m40000644000175000001440000011560511223624430012446 00000000000000dnl BeeCrypt specific autoconf macros dnl Copyright (c) 2003, 2004, 2005, 2006 Bob Deblier dnl dnl This file is part of the BeeCrypt crypto library dnl dnl dnl LGPL dnl BEE_EXPERT_MODE AC_DEFUN([BEE_EXPERT_MODE],[ # try to get the architecture from CFLAGS bc_target_arch=`echo $CFLAGS | awk '{for (i=1; i<=NF; i++) if (substr($i,0,7)=="-march=") print substr($i,8)}'` # examine the other flags for flag in `echo $CFLAGS` do case $flag in -mmmx) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_MMX" ;; -msse) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SSE" ;; -msse2) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SSE2" ;; -msse3) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SSE3" ;; esac done ]) dnl BEE_WITH_CPU AC_DEFUN([BEE_WITH_CPU],[ ac_with_cpu=yes bc_target_cpu=$withval case $target_cpu in i[[3456]]86) case $withval in i[[3456]]86 | \ pentium | pentium-m | pentium-mmx | pentiumpro | pentium[[234]] | \ athlon | athlon-tbird | athlon-4 | athlon-xp | athlon-mp | athlon-fx | athlon64 | k8) ;; *) AC_MSG_WARN([invalid cpu type]) bc_target_cpu=$target_cpu ;; esac ;; powerpc | powerpc64) case $withval in 403 | 505 | \ 60[[1234]] | 60[[34]]e | 6[[23]]0 | \ 7[[45]]0 | 74[[05]]0 | \ 801 | 82[[13]] | 860 | \ power | power2 | powerpc | powerpc64) ;; *) AC_MSG_WARN([invalid cpu type]) bc_target_cpu=$target_cpu ;; esac ;; sparc | sparc64) case $withval in sparcv8 | sparcv8plus | sparcv8plusa | sparcv9 | sparcv9a) ;; *) AC_MSG_WARN([invalid cpu type]) bc_target_cpu=$target_cpu ;; esac ;; x86) # QNX Neutrino doesn't list the exact cpu type case $withval in i[[3456]]86) ;; *) AC_MSG_WARN([unsupported or invalid cpu type]) bc_target_cpu=$target_cpu ;; esac ;; *) AC_MSG_WARN([unsupported or invalid cpu type]) bc_target_cpu=$target_cpu ;; esac ]) dnl BEE_WITHOUT_CPU AC_DEFUN([BEE_WITHOUT_CPU],[ ac_with_cpu=no bc_target_cpu=$target_cpu ]) dnl BEE_WITH_ARCH AC_DEFUN([BEE_WITH_ARCH],[ ac_with_arch=yes bc_target_arch=$withval case $target_cpu in i[[3456]]86) case $withval in em64t | \ i[[3456]]86 | \ pentium | pentium-m | pentium-mmx | pentiumpro | pentium[[234]] | \ athlon | athlon-tbird | athlon-4 | athlon-xp | athlon-mp | athlon64 | k8) if test "$ac_with_cpu" != yes; then bc_target_arch=$withval fi ;; esac ;; powerpc*) case $withval in powerpc) ;; powerpc64) ;; *) AC_MSG_WARN([unsupported on invalid arch type]) bc_target_arch=powerpc ;; esac ;; esac ]) dnl BEE_WITHOUT_ARCH AC_DEFUN([BEE_WITHOUT_ARCH],[ # if bc_target_arch hasn't been set (i.e. by expert mode) if test "X$bc_target_arch" = "X"; then ac_with_arch=no case $target_cpu in alpha*) bc_target_arch=alpha ;; arm*) bc_target_arch=arm ;; i[[3456]]86) bc_target_arch=i386 ;; ia64) bc_target_arch=ia64 ;; m68k) bc_target_arch=m68k ;; powerpc) bc_target_arch=powerpc ;; powerpc64) bc_target_arch=powerpc64 ;; s390x) bc_target_arch=s390x ;; sparc*) bc_target_arch=sparc ;; x86_64) bc_target_arch=x86_64 ;; esac fi ]) dnl BEE_INT_TYPES AC_DEFUN([BEE_INT_TYPES],[ AC_TYPE_SIZE_T bc_typedef_size_t= if test $ac_cv_type_size_t != yes; then bc_typedef_size_t="typedef unsigned size_t;" else AC_CHECK_SIZEOF([size_t]) fi AC_SUBST(TYPEDEF_SIZE_T,$bc_typedef_size_t) if test $ac_cv_header_inttypes_h = yes; then AC_SUBST(INCLUDE_INTTYPES_H,["#include "]) else AC_SUBST(INCLUDE_INTTYPES_H,[ ]) fi if test $ac_cv_header_stdint_h = yes; then AC_SUBST(INCLUDE_STDINT_H,["#include "]) else AC_SUBST(INCLUDE_STDINT_H,[ ]) fi AH_TEMPLATE([HAVE_INT64_T]) AH_TEMPLATE([HAVE_UINT64_T]) bc_typedef_int8_t= AC_CHECK_TYPE([int8_t],,[ AC_CHECK_SIZEOF([signed char]) if test $ac_cv_sizeof_signed_char -eq 1; then bc_typedef_int8_t="typedef signed char int8_t;" fi ]) AC_SUBST(TYPEDEF_INT8_T,$bc_typedef_int8_t) bc_typedef_int16_t= AC_CHECK_TYPE([int16_t],,[ AC_CHECK_SIZEOF([short]) if test $ac_cv_sizeof_short -eq 2; then bc_typedef_int16_t="typedef short int16_t;" fi ]) AC_SUBST(TYPEDEF_INT16_T,$bc_typedef_int16_t) bc_typedef_int32_t= AC_CHECK_TYPE([int32_t],,[ AC_CHECK_SIZEOF([int]) if test $ac_cv_sizeof_int -eq 4; then bc_typedef_int32_t="typedef int int32_t;" fi ]) AC_SUBST(TYPEDEF_INT32_T,$bc_typedef_int32_t) bc_typedef_int64_t= AC_CHECK_TYPE([int64_t],[ AC_DEFINE([HAVE_INT64_T],1) ],[ AC_CHECK_SIZEOF([long]) if test $ac_cv_sizeof_long -eq 8; then bc_typedef_int64_t="typedef long int64_t;" else AC_CHECK_SIZEOF([long long]) if test $ac_cv_sizeof_long_long -eq 8; then AC_DEFINE([HAVE_INT64_T],1) bc_typedef_int64_t="typedef long long int64_t;" fi fi ]) AC_SUBST(TYPEDEF_INT64_T,$bc_typedef_int64_t) bc_typedef_uint8_t= AC_CHECK_TYPE([uint8_t],,[ AC_CHECK_SIZEOF([unsigned char]) if test $ac_cv_sizeof_unsigned_char -eq 1; then bc_typedef_uint8_t="typedef unsigned char uint8_t;" fi ]) AC_SUBST(TYPEDEF_UINT8_T,$bc_typedef_uint8_t) bc_typedef_uint16_t= AC_CHECK_TYPE([uint16_t],,[ AC_CHECK_SIZEOF([unsigned short]) if test $ac_cv_sizeof_unsigned_short -eq 2; then bc_typedef_uint16_t="typedef unsigned short uint16_t;" fi ]) AC_SUBST(TYPEDEF_UINT16_T,$bc_typedef_uint16_t) bc_typedef_uint32_t= AC_CHECK_TYPE([uint32_t],,[ AC_CHECK_SIZEOF([unsigned int]) if test $ac_cv_sizeof_unsigned_int -eq 4; then bc_typedef_uint32_t="typedef unsigned int uint32_t;" fi ]) AC_SUBST(TYPEDEF_UINT32_T,$bc_typedef_uint32_t) bc_typedef_uint64_t= AC_CHECK_TYPE([uint64_t],[ AC_DEFINE([HAVE_UINT64_T],1) ],[ AC_CHECK_SIZEOF([unsigned long]) if test $ac_cv_sizeof_unsigned_long -eq 8; then bc_typedef_uint64_t="typedef unsigned long uint64_t;" else AC_CHECK_SIZEOF([unsigned long long]) if test $ac_cv_sizeof_unsigned_long_long -eq 8; then AC_DEFINE([HAVE_UINT64_T],1) bc_typedef_uint64_t="typedef unsigned long long uint64_t;" fi fi ]) AC_SUBST(TYPEDEF_UINT64_T,$bc_typedef_uint64_t) AH_TEMPLATE([HAVE_LONG_LONG]) AH_TEMPLATE([HAVE_UNSIGNED_LONG_LONG]) AC_CHECK_TYPE([long long],[ AC_DEFINE([HAVE_LONG_LONG],1) ],[ AC_DEFINE([HAVE_LONG_LONG],0) ]) AC_CHECK_TYPE([unsigned long long],[ AC_DEFINE([HAVE_UNSIGNED_LONG_LONG],1) ],[ AC_DEFINE([HAVE_UNSIGNED_LONG_LONG],0) ]) ]) dnl BEE_CPU_BITS AC_DEFUN([BEE_CPU_BITS],[ AC_CHECK_SIZEOF([unsigned long]) if test $ac_cv_sizeof_unsigned_long -eq 8; then AC_SUBST(MP_WBITS,64U) elif test $ac_cv_sizeof_unsigned_long -eq 4; then AC_SUBST(MP_WBITS,32U) else AC_MSG_ERROR([Illegal CPU word size]) fi ]) dnl BEE_WORKING_AIO AC_DEFUN([BEE_WORKING_AIO],[ AC_CHECK_HEADERS(aio.h) if test "$ac_cv_header_aio_h" = yes; then AC_SEARCH_LIBS([aio_read],[c rt aio posix4],[ AC_CACHE_CHECK([whether aio works],bc_cv_working_aio,[ cat > conftest.aio << EOF The quick brown fox jumps over the lazy dog. EOF AC_LANG_PUSH(C) AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ #if HAVE_ERRNO_H # include #endif #if HAVE_FCNTL_H # include #endif #if HAVE_STRING_H # include #endif #if HAVE_UNISTD_H # include #endif #include #include ]],[[ struct aiocb a; const struct aiocb* a_list = &a; struct timespec a_timeout; char buffer[32]; int i, rc, fd = open("conftest.aio", O_RDONLY); if (fd < 0) exit(1); memset(&a, 0, sizeof(struct aiocb)); a.aio_fildes = fd; a.aio_offset = 0; a.aio_reqprio = 0; a.aio_buf = buffer; a.aio_nbytes = sizeof(buffer); a.aio_sigevent.sigev_notify = SIGEV_NONE; a_timeout.tv_sec = 1; a_timeout.tv_nsec = 0; if (aio_read(&a) < 0) { perror("aio_read"); exit(1); } if (aio_suspend(&a_list, 1, &a_timeout) < 0) { #if HAVE_ERRNO_H /* some linux systems don't await timeout and return instantly */ if (errno == EAGAIN) { nanosleep(&a_timeout, (struct timespec*) 0); if (aio_suspend(&a_list, 1, &a_timeout) < 0) { perror("aio_suspend"); exit(1); } } else { perror("aio_suspend"); exit(1); } #else exit(1); #endif } if (aio_error(&a) < 0) exit(1); if (aio_return(&a) < 0) exit(1); exit(0); ]])],[bc_cv_working_aio=yes],[bc_cv_working_aio=no],[ case $target_os in linux* | solaris*) bc_cv_working_aio=yes ;; *) bc_cv_working_aio=no ;; esac ]) ],[ bc_cv_working_aio=no ]) AC_LANG_POP(C) ]) rm -fr conftest.aio fi ]) dnl BEE_AGGRESSIVE_OPT AC_DEFUN([BEE_AGGRESSIVE_OPT],[ if test "$CFLAGS" = ""; then bc_cv_c_aggressive_opt=yes else bc_cv_c_aggressive_opt=no fi if test "$CXXFLAGS" = ""; then bc_cv_cxx_aggressive_opt=yes else bc_cv_cxx_aggressive_opt=no fi ]) dnl BEE_CFLAGS_REM AC_DEFUN([BEE_CFLAGS_REM],[ if test "$CFLAGS" != ""; then CFLAGS_save="" for flag in $CFLAGS do if test "$flag" != "$1"; then CFLAGS_save="$CFLAGS_save $flag" fi done CFLAGS="$CFLAGS_save" fi ]) dnl BEE_CXXFLAGS_REM AC_DEFUN([BEE_CXXFLAGS_REM],[ if test "$CXXFLAGS" != ""; then CXXFLAGS_save="" for flag in $CXXFLAGS do if test "$flag" != "$1"; then CXXFLAGS_save="$CXXFLAGS_save $flag" fi done CXXFLAGS="$CXXFLAGS_save" fi ]) dnl BEE_GNU_CC_MTUNE AC_DEFUN([BEE_GNU_CC_MTUNE],[ AC_REQUIRE([AC_PROG_CC]) case $bc_target_arch in i[[3456]]86 | \ pentium | pentium-m | pentium-mmx | pentiumpro | pentium[[234]] | \ athlon | athlon-tbird | athlon-4 | athlon-xp | athlon-mp) AC_MSG_CHECKING([if gcc supports -mtune option]) AC_LANG_PUSH(C) AC_COMPILE_IFELSE([AC_LANG_SOURCE([[][int x;]])],[ bc_cv_gcc_mtune=yes ],[ bc_cv_gcc_mtune=no ]) AC_LANG_POP(C) AC_MSG_RESULT([$bc_cv_gcc_mtune]) ;; esac ]) dnl BEE_GNU_CXX_MTUNE AC_DEFUN([BEE_GNU_CXX_MTUNE],[ AC_REQUIRE([AC_PROG_CXX]) case $bc_target_arch in em64t | \ i[[3456]]86 | \ pentium | pentium-m | pentium-mmx | pentiumpro | pentium[[234]] | \ athlon | athlon-tbird | athlon-4 | athlon-xp | athlon-mp | athlon64 | k8) AC_MSG_CHECKING([if g++ supports -mtune option]) AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([AC_LANG_SOURCE([[][int x;]])],[ bc_cv_gxx_mtune=yes ],[ bc_cv_gxx_mtune=no ]) AC_LANG_POP(C++) ;; esac ]) dnl BEE_GNU_CC AC_DEFUN([BEE_GNU_CC],[ AC_REQUIRE([AC_PROG_CC]) if test "$OPENMP_CFLAGS" != ""; then AC_SUBST(OPENMP_LIBS,"-lgomp") fi case $bc_target_arch in x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona) CC="$CC -m64" ;; i[[3456]]86 | \ pentium* | \ athlon*) CC="$CC -m32" CCAS="$CCAS -m32" ;; ia64) case $target_os in # HP/UX on Itanium needs to be told that a long is 64-bit! hpux*) CFLAGS="$CFLAGS -mlp64" ;; esac ;; # PowerPC needs a signed char powerpc) CFLAGS="$CFLAGS -fsigned-char" ;; powerpc64) CFLAGS="$CFLAGS -fsigned-char" case $target_os in aix*) CC="$CC -maix64" ;; linux*) CC="$CC -m64" ;; esac ;; sparc | sparcv8*) CC="$CC -m32" ;; sparc64 | sparcv9*) CC="$CC -m64" ;; esac # Certain platforms needs special flags for multi-threaded code if test "$ac_enable_threads" = yes; then case $target_os in freebsd*) CFLAGS="$CFLAGS -pthread" CPPFLAGS="$CPPFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ;; osf*) CFLAGS="$CFLAGS -pthread" CPPFLAGS="$CPPFLAGS -pthread" ;; esac fi if test "$ac_enable_debug" = yes; then BEE_CFLAGS_REM([-O2]) CFLAGS="$CFLAGS -Wall -pedantic" else BEE_GNU_CC_MTUNE # Generic optimizations, including cpu tuning BEE_CFLAGS_REM([-g]) CFLAGS="$CFLAGS -DNDEBUG" if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in athlon64 | athlon-fx | k8 | opteron) # CFLAGS="$CFLAGS -mtune=k8" # -O3 degrades performance # -mcpu=athlon64 degrades performance ;; alpha*) BEE_CFLAGS_REM([-O2]) CFLAGS="$CFLAGS -O3" ;; athlon*) BEE_CFLAGS_REM([-O2]) if test "$bc_cv_gcc_mtune" = yes; then CFLAGS="$CFLAGS -O3 -mtune=pentiumpro" else CFLAGS="$CFLAGS -O3 -mcpu=pentiumpro" fi ;; i586) BEE_CFLAGS_REM([-O2]) if test "$bc_cv_gcc_mtune" = yes; then CFLAGS="$CFLAGS -O3 -mtune=pentium" else CFLAGS="$CFLAGS -O3 -mcpu=pentium" fi ;; i686) BEE_CFLAGS_REM([-O2]) if test "$bc_cv_gcc_mtune" = yes; then CFLAGS="$CFLAGS -O3 -mtune=pentiumpro" else CFLAGS="$CFLAGS -O3 -mcpu=pentiumpro" fi ;; ia64) # no -mcpu=... option on ia64 ;; pentium*) BEE_CFLAGS_REM([-O2]) if test "$bc_cv_gcc_mtune" = yes; then CFLAGS="$CFLAGS -O3 -mtune=$bc_target_arch" else CFLAGS="$CFLAGS -O3 -mcpu=$bc_target_arch" fi ;; powerpc*) ;; esac # Architecture-specific optimizations case $bc_target_arch in athlon64) CFLAGS="$CFLAGS -march=k8" # -march=athlon64 degrades performance # -msse2 also doesn't help ;; athlon*) CFLAGS="$CFLAGS -march=$bc_target_arch -mmmx" ;; em64t) CFLAGS="$CFLAGS -march=em64t" ;; i586 | pentium) CFLAGS="$CFLAGS -march=pentium" ;; i686 | pentiumpro) CFLAGS="$CFLAGS -march=pentiumpro" ;; pentium-m) CFLAGS="$CFLAGS -march=pentium-m -msse2" ;; pentium-mmx) CFLAGS="$CFLAGS -march=pentium-mmx -mmmx" ;; pentium2) CFLAGS="$CFLAGS -march=pentium2 -mmmx" ;; pentium3) CFLAGS="$CFLAGS -march=pentium3 -msse" ;; pentium4) CFLAGS="$CFLAGS -march=pentium4 -msse2" ;; powerpc | powerpc64) CFLAGS="$CFLAGS -mcpu=$bc_target_arch" ;; sparcv8) CFLAGS="$CFLAGS -mcpu=v8" ;; sparcv8plus) CFLAGS="$CFLAGS -mcpu=v9" ;; sparcv8plusa | sparcv9 | sparcv9a) CFLAGS="$CFLAGS -mcpu=ultrasparc" ;; esac fi fi ]) dnl BEE_GNU_CXX AC_DEFUN([BEE_GNU_CXX],[ AC_REQUIRE([AC_PROG_CXX]) case $bc_target_arch in x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona | core2) CXX="$CXX -m64" ;; i[[3456]]86 | \ pentium* | \ athlon*) CXX="$CXX -m32" ;; ia64) case $target_os in # HP/UX on Itanium needs to be told that a long is 64-bit! hpux*) CXXFLAGS="$CXXFLAGS -mlp64" ;; esac ;; # PowerPC needs a signed char powerpc) CXXFLAGS="$CXXFLAGS -fsigned-char" ;; powerpc64) CXXFLAGS="$CXXFLAGS -fsigned-char" case $target_os in aix*) CXX="$CXX -maix64" ;; linux*) CXX="$CXX -m64" ;; esac ;; sparc | sparcv8*) CXX="$CXX -m32" ;; sparc64 | sparcv9*) CXX="$CXX -m64" ;; esac # Certain platforms needs special flags for multi-threaded code if test "$ac_enable_threads" = yes; then case $target_os in freebsd*) CXXFLAGS="$CXXFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ;; osf*) CXXFLAGS="$CXXFLAGS -pthread" ;; esac fi if test "$ac_enable_debug" = yes; then BEE_CXXFLAGS_REM([-O2]) CXXFLAGS="$CXXFLAGS -Wall -pedantic" else # Generic optimizations, including cpu tuning BEE_GNU_CXX_MTUNE BEE_CXXFLAGS_REM([-g]) CXXFLAGS="$CXXFLAGS -DNDEBUG" if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in athlon*) CXXFLAGS="$CXXFLAGS -mcpu=pentiumpro"; ;; i586) CXXFLAGS="$CXXFLAGS -mcpu=pentium" ;; i686) CXXFLAGS="$CXXFLAGS -mcpu=pentiumpro" ;; ia64) # no -mcpu=... option on ia64 ;; pentium*) CXXFLAGS="$CXXFLAGS -mcpu=$bc_target_arch" ;; esac # Architecture-specific optimizations case $bc_target_arch in athlon*) CXXFLAGS="$CXXFLAGS -march=$bc_target_arch" ;; i586) CXXFLAGS="$CXXFLAGS -march=pentium" ;; i686) CXXFLAGS="$CXXFLAGS -march=pentiumpro" ;; pentium*) CXXFLAGS="$CXXFLAGS -march=$bc_target_arch" ;; powerpc | powerpc64) CXXFLAGS="$CXXFLAGS -mcpu=$bc_target_arch" ;; sparcv8) CXXFLAGS="$CXXFLAGS -mcpu=v8" ;; sparcv8plus) CXXFLAGS="$CXXFLAGS -mcpu=v9" ;; esac fi fi ]) dnl BEE_COMPAQ_CC AC_DEFUN([BEE_COMPAQ_CC],[ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CPP]) AC_CACHE_CHECK([whether we are using Compaq's C compiler],bc_cv_prog_COMPAQ_CC,[ AC_EGREP_CPP(yes,[ #ifdef __DECC yes; #endif ],bc_cv_prog_COMPAQ_CC=yes,bc_cv_prog_COMPAQ_CC=no) ]) if test "$bc_cv_prog_COMPAQ_CC" = yes; then if test "$ac_enable_threads" = yes; then CFLAGS="$CFLAGS -pthread" CPPFLAGS="$CPPFLAGS -pthread" fi if test "$ac_enable_debug" != yes; then BEE_CFLAGS_REM([-g]) if test "$bc_cv_c_aggressive_opt" = yes; then CFLAGS="$CFLAGS -fast" fi fi fi ]) dnl BEE_COMPAQ_CXX AC_DEFUN([BEE_COMPAQ_CXX],[ ]) dnl BEE_HPUX_CC AC_DEFUN([BEE_HPUX_CC],[ if test "$ac_enable_debug" != yes; then BEE_CFLAGS_REM([-g]) if test "$bc_cv_c_aggressive_opt" = yes; then CFLAGS="$CFLAGS -fast" fi fi ]) dnl BEE_HP_CXX AC_DEFUN([BEE_HP_CXX],[ ]) dnl BEE_IBM_CC AC_DEFUN([BEE_IBM_CC],[ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CPP]) AC_CACHE_CHECK([whether we are using IBM C],bc_cv_prog_IBM_CC,[ AC_EGREP_CPP(yes,[ #ifdef __IBMC__ yes; #endif ],bc_cv_prog_IBM_CC=yes,bc_cv_prog_IBM_CC=no) ]) if test "$bc_cv_prog_IBM_CC" = yes; then case $bc_target_arch in powerpc) CC="$CC -q32 -qarch=ppc" ;; powerpc64) CC="$CC -q64 -qarch=ppc64" ;; esac if test "$ac_enable_debug" != yes; then BEE_CFLAGS_REM([-g]) if test "$bc_cv_c_aggressive_opt" = yes; then if test "$ac_with_arch" = yes; then CFLAGS="$CFLAGS -O5" else CFLAGS="$CFLAGS -O3" fi fi fi # Version 5.0 doesn't have this, but 6.0 does AC_CHECK_FUNC([__rotatel4]) fi ]) dnl BEE_IBM_CXX AC_DEFUN([BEE_IBM_CXX],[ ]) dnl BEE_INTEL_CC AC_DEFUN([BEE_INTEL_CC],[ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CPP]) AC_CACHE_CHECK([whether we are using Intel C],bc_cv_prog_INTEL_CC,[ AC_EGREP_CPP(yes,[ #ifdef __INTEL_COMPILER yes; #endif ],bc_cv_prog_INTEL_CC=yes,bc_cv_prog_INTEL_CC=no) ]) if test "$bc_cv_prog_INTEL_CC" = yes; then if test "$ac_enable_debug" != yes; then BEE_CFLAGS_REM([-g]) if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in i586 | pentium | pentium-mmx) CFLAGS="$CFLAGS -mcpu=pentium" ;; i686 | pentiumpro | pentium[[23]]) CFLAGS="$CFLAGS -mcpu=pentiumpro" ;; pentium4 | pentium-m) CFLAGS="$CFLAGS -mcpu=pentium4" ;; esac case $bc_target_arch in i586 | pentium | pentium-mmx) CFLAGS="$CFLAGS -tpp5" ;; i686 | pentiumpro) CFLAGS="$CFLAGS -tpp6 -march=pentiumpro" ;; pentium2) CFLAGS="$CFLAGS -tpp6 -march=pentiumii" ;; pentium3) CFLAGS="$CFLAGS -tpp6 -march=pentiumiii" ;; pentium4 | pentium-m) CFLAGS="$CFLAGS -tpp7 -march=pentium4" ;; esac fi fi AC_CHECK_FUNC([_rotl]) AC_CHECK_FUNC([_rotr]) if test "$OPENMP_CFLAGS" != ""; then AC_SUBST(OPENMP_LIBS,"-liomp5") fi fi ]) dnl BEE_INTEL_CXX AC_DEFUN([BEE_INTEL_CXX],[ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CPP]) AC_CACHE_CHECK([whether we are using Intel C++],bc_cv_prog_INTEL_CXX,[ AC_EGREP_CPP(yes,[ #ifdef __INTEL_COMPILER yes; #endif ],bc_cv_prog_INTEL_CXX=yes,bc_cv_prog_INTEL_CXX=no) ]) if test "$bc_cv_prog_INTEL_CXX" = yes; then if test "$ac_enable_debug" != yes; then BEE_CXXFLAGS_REM([-g]) if test "$bc_cv_c_aggressive_opt" = yes; then case $bc_target_cpu in i586 | pentium | pentium-mmx) CXXFLAGS="$CXXFLAGS -mcpu=pentium" ;; i686 | pentiumpro | pentium[[23]]) CXXFLAGS="$CXXFLAGS -mcpu=pentiumpro" ;; pentium4 | pentium-m) CXXFLAGS="$CXXFLAGS -mcpu=pentium4" ;; esac case $bc_target_arch in i586 | pentium | pentium-mmx) CXXFLAGS="$CXXFLAGS -tpp5" ;; i686 | pentiumpro) CXXFLAGS="$CXXFLAGS -tpp6 -march=pentiumpro" ;; pentium2) CXXFLAGS="$CXXFLAGS -tpp6 -march=pentiumii" ;; pentium3) CXXFLAGS="$CXXFLAGS -tpp6 -march=pentiumiii" ;; pentium4) CXXFLAGS="$CXXFLAGS -tpp7 -march=pentium4" ;; esac fi fi fi ]) dnl BEE_SUN_FORTE_CC AC_DEFUN([BEE_SUN_FORTE_CC],[ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CPP]) AC_CACHE_CHECK([whether we are using Sun Forte C],bc_cv_prog_SUN_FORTE_CC,[ AC_LANG_PUSH(C) AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ ]],[[ #ifdef __SUNPRO_C return 0; #else return 1; #endif ]]) ],[bc_cv_prog_SUN_FORTE_CC=yes],[bc_cv_prog_SUN_FORTE_CC=no]) AC_LANG_POP(C) ]) if test "$bc_cv_prog_SUN_FORTE_CC" = yes; then if test "$ac_enable_threads" = yes; then CFLAGS="$CFLAGS -mt" fi if test "$ac_enable_debug" != yes; then BEE_CFLAGS_REM([-g]) if test "$bc_cv_c_aggressive_opt" = yes; then CFLAGS="$CFLAGS -fast" case $bc_target_arch in sparc) CFLAGS="$CFLAGS -m32 -xarch=generic" ;; sparcv8) CFLAGS="$CFLAGS -m32 -xarch=v8" ;; sparcv8plus*) CFLAGS="$CFLAGS -m32 -xarch=v8plus" ;; sparcv9*) CFLAGS="$CFLAGS -m64 -xarch=generic" ;; esac fi fi fi ]) dnl BEE_SUN_FORTE_CXX AC_DEFUN([BEE_SUN_FORTE_CXX],[ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CPP]) AC_CACHE_CHECK([whether we are using Sun Forte C++],bc_cv_prog_SUN_FORTE_CXX,[ AC_LANG_PUSH(C++) AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ ]],[[ #ifdef __SUNPRO_CC return 0; #else return 1; #endif ]]) ],[bc_cv_prog_SUN_FORTE_CXX=yes],[bc_cv_prog_SUN_FORTE_CXX=no]) AC_LANG_POP(C++) ]) if test "$bc_cv_prog_SUN_FORTE_CXX" = yes; then if test "$ac_enable_threads" = yes; then CXXFLAGS="$CXXFLAGS -mt" fi if test "$ac_enable_debug" != yes; then BEE_CFLAGS_REM([-g]) if test "$bc_cv_c_aggressive_opt" = yes; then CXXFLAGS="$CXXFLAGS -fast" case $bc_target_arch in sparc) CXXFLAGS="$CXXFLAGS -m32 -xarch=generic" ;; sparcv8) CXXFLAGS="$CXXFLAGS -m32 -xarch=v8" ;; sparcv8plus*) CXXFLAGS="$CXXFLAGS -m32 -xarch=v8plus" ;; sparcv9*) CXXFLAGS="$CXXFLAGS -m64 -xarch=generic" ;; esac fi fi fi ]) dnl BEE_CC AC_DEFUN([BEE_CC],[ # set flags for large file support case $target_os in linux* | solaris*) CPPFLAGS="$CPPFLAGS `getconf LFS_CFLAGS`" LDFLAGS="$LDFLAGS `getconf LFS_LDFLAGS`" ;; esac if test "$ac_cv_c_compiler_gnu" = yes; then # Intel's icc can be mistakenly identified as gcc case $target_os in linux*) BEE_INTEL_CC ;; esac if test "$bc_cv_prog_INTEL_CC" != yes; then BEE_GNU_CC fi else case $target_os in aix*) BEE_IBM_CC ;; hpux*) BEE_HPUX_CC ;; linux*) BEE_INTEL_CC ;; solaris*) BEE_SUN_FORTE_CC ;; osf*) BEE_COMPAQ_CC ;; esac fi ]) dnl BEE_CXX AC_DEFUN([BEE_CXX],[ if test "$ac_cv_cxx_compiler_gnu" = yes; then # Intel's icc can be mistakenly identified as gcc case $target_os in linux*) BEE_INTEL_CXX ;; esac if test "$bc_cv_prog_INTEL_CXX" != yes; then BEE_GNU_CXX fi else case $target_os in aix*) BEE_IBM_CXX ;; hpux*) BEE_HPUX_CXX ;; linux*) BEE_INTEL_CXX ;; solaris*) BEE_SUN_FORTE_CXX ;; osf*) BEE_COMPAQ_CXX ;; esac fi ]) dnl BEE_CC_NOEXECSTACK AC_DEFUN([BEE_CC_NOEXECSTACK],[ AC_CACHE_CHECK([whether we can use noexecstack flag in C],bc_cv_cc_noexecstack,[ CFLAGS_save=$CFLAGS if test "$bc_cv_prog_INTEL_CC" = yes; then CFLAGS="$CFLAGS -Qoption,asm,--noexecstack" else CFLAGS="$CFLAGS -Wa,--noexecstack" fi AC_LANG_PUSH(C) # first try to compile it AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[]],[[int x = 0]]) ],[ # did compile $CC -S $CFLAGS conftest.$ac_ext > /dev/null 2>&1 $CC -o conftest$ac_exeext $CFLAGS conftest.s > /dev/null 2>&1 if test $? -eq 0; then # did assemble bc_cv_cc_noexecstack=yes bc_gnu_stack=`$EGREP -e '\.section.*GNU-stack' conftest.s` else # didn't assemble CFLAGS=$CFLAGS_save bc_cv_cc_noexecstack=no bc_gnu_stack='' fi ],[ # didn't compile CFLAGS=$CFLAGS_save bc_cv_cc_noexecstack=no bc_gnu_stack='' ]) AC_LANG_POP(C) ]) ]) dnl BEE_CXX_NOEXECSTACK AC_DEFUN([BEE_CXX_NOEXECSTACK],[ AC_CACHE_CHECK([whether we can use noexecstack flag in C++],bc_cv_cxx_noexecstack,[ CXXFLAGS_save=$CXXFLAGS if test "$bc_cv_prog_INTEL_CXX" = yes; then CXXFLAGS="$CXXFLAGS -Qoption,asm,--noexecstack" else CXXFLAGS="$CXXFLAGS -Wa,--noexecstack" fi AC_LANG_PUSH(C++) # first try to compile it AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[]],[[int x = 0]]) ],[ # did compile $CXX -S $CXXFLAGS conftest.$ac_ext > /dev/null 2>&1 $CXX -o conftest$ac_exeext $CXXFLAGS conftest.s > /dev/null 2>&1 if test $? -eq 0; then # did assemble bc_cv_cxx_noexecstack=yes bc_gnu_stack=`$EGREP -e '\.section.*GNU-stack' conftest.s` else # didn't assemble CXXFLAGS=$CXXFLAGS_save bc_cv_cxx_noexecstack=no fi ],[ # didn't compile CXXFLAGS=$CXXFLAGS_save bc_cv_cxx_noexecstack=no ]) AC_LANG_POP(C++) ]) ]) dnl BEE_LIBTOOL AC_DEFUN([BEE_LIBTOOL],[ case $target_os in aix*) case $bc_target_arch in powerpc64) AR="ar -X64" NM="/usr/bin/nm -B -X64" ;; esac ;; solaris*) case $bc_target_arch in sparcv9*) LD="/usr/ccs/bin/ld" LDFLAGS="$LDFLAGS -Wl,-64" ;; esac ;; esac ]) dnl BEE_OS_DEFS AC_DEFUN([BEE_OS_DEFS],[ AH_TEMPLATE([AIX],[Define to 1 if you are using AIX]) AH_TEMPLATE([CYGWIN],[Define to 1 if you are using Cygwin]) AH_TEMPLATE([DARWIN],[Define to 1 if you are using Darwin/MacOS X]) AH_TEMPLATE([FREEBSD],[Define to 1 if you are using FreeBSD]) AH_TEMPLATE([HPUX],[Define to 1 if you are using HPUX]) AH_TEMPLATE([LINUX],[Define to 1 if you are using GNU/Linux]) AH_TEMPLATE([MINGW],[Define to 1 if you are using MinGW]) AH_TEMPLATE([NETBSD],[Define to 1 if you are using NetBSD]) AH_TEMPLATE([OPENBSD],[Define to 1 if you are using OpenBSD]) AH_TEMPLATE([OSF],[Define to 1 if you are using OSF]) AH_TEMPLATE([QNX],[Define to 1 if you are using QNX]) AH_TEMPLATE([SCO_UNIX],[Define to 1 if you are using SCO Unix]) AH_TEMPLATE([SOLARIS],[Define to 1 if you are using Solaris]) AH_VERBATIM([WIN32],[ #ifndef WIN32 #undef WIN32 #endif ]) case $target_os in aix*) AC_DEFINE([AIX]) ;; cygwin*) AC_DEFINE([CYGWIN]) AC_DEFINE([WIN32]) ;; darwin*) AC_DEFINE([DARWIN]) ;; freebsd*) AC_DEFINE([FREEBSD]) ;; hpux*) AC_DEFINE([HPUX]) ;; linux*) AC_DEFINE([LINUX]) ;; mingw*) AC_DEFINE([MINGW]) AC_DEFINE([WIN32]) ;; netbsd*) AC_DEFINE([NETBSD]) ;; openbsd*) AC_DEFINE([OPENBSD]) ;; osf*) AC_DEFINE([OSF]) ;; *qnx) AC_DEFINE([QNX]) ;; solaris*) AC_DEFINE([SOLARIS]) ;; sysv*uv*) AC_DEFINE([SCO_UNIX]) ;; *) AC_MSG_WARN([Operating system type $target_os currently not supported and/or tested]) ;; esac ]) dnl BEE_ASM_DEFS AC_DEFUN([BEE_ASM_DEFS],[ AC_SUBST(ASM_OS,$target_os) AC_SUBST(ASM_CPU,$bc_target_cpu) AC_SUBST(ASM_ARCH,$bc_target_arch) AC_SUBST(ASM_BIGENDIAN,$ac_cv_c_bigendian) AC_SUBST(ASM_GNU_STACK,$bc_gnu_stack) ]) dnl BEE_ASM_TEXTSEG AC_DEFUN([BEE_ASM_TEXTSEG],[ AC_CACHE_CHECK([how to switch to text segment], bc_cv_asm_textseg,[ case $target_os in aix*) bc_cv_asm_textseg=[".csect .text[PR]"] ;; hpux*) if test "$bc_target_arch" = ia64; then bc_cv_asm_textseg=[".section .text"] else bc_cv_asm_textseg=".code" fi ;; *) bc_cv_asm_textseg=".text" ;; esac ]) AC_SUBST(ASM_TEXTSEG,$bc_cv_asm_textseg) ]) dnl BEE_ASM_GLOBL AC_DEFUN([BEE_ASM_GLOBL],[ AC_CACHE_CHECK([how to declare a global symbol], bc_cv_asm_globl,[ case $target_os in hpux*) bc_cv_asm_globl=".export" ;; *) bc_cv_asm_globl=".globl" ;; esac ]) AC_SUBST(ASM_GLOBL,$bc_cv_asm_globl) ]) dnl BEE_ASM_GSYM_PREFIX AC_DEFUN([BEE_ASM_GSYM_PREFIX],[ AC_CACHE_CHECK([if global symbols need leading underscore], bc_cv_asm_gsym_prefix,[ case $target_os in cygwin* | mingw* | darwin*) bc_cv_asm_gsym_prefix="_" ;; *) bc_cv_asm_gsym_prefix="" ;; esac ]) AC_SUBST(ASM_GSYM_PREFIX,$bc_cv_asm_gsym_prefix) ]) dnl BEE_ASM_LSYM_PREFIX AC_DEFUN([BEE_ASM_LSYM_PREFIX],[ AC_CACHE_CHECK([how to declare a local symbol], bc_cv_asm_lsym_prefix,[ case $target_os in aix* | darwin*) bc_cv_asm_lsym_prefix="L" ;; hpux* | osf*) bc_cv_asm_lsym_prefix="$" ;; linux*) case $target_cpu in alpha*) bc_cv_asm_lsym_prefix="$" ;; *) bc_cv_asm_lsym_prefix=".L" ;; esac ;; *) bc_cv_asm_lsym_prefix=".L" ;; esac ]) AC_SUBST(ASM_LSYM_PREFIX,$bc_cv_asm_lsym_prefix) ]) dnl BEE_ASM_ALIGN AC_DEFUN([BEE_ASM_ALIGN],[ AC_CACHE_CHECK([how to align symbols], bc_cv_asm_align,[ case $target_cpu in alpha*) bc_cv_asm_align=".align 5" ;; x86_64 | athlon64 | em64t | k8) bc_cv_asm_align=".align 16" ;; i[[3456]]86 | athlon*) bc_cv_asm_align=".align 4" ;; ia64) bc_cv_asm_align=".align 16" ;; powerpc*) bc_cv_asm_align=".align 2" ;; s390x) bc_cv_asm_align=".align 4" ;; sparc*) bc_cv_asm_align=".align 4" ;; esac ]) AC_SUBST(ASM_ALIGN,$bc_cv_asm_align) ]) dnl BEE_ASM_SOURCES AC_DEFUN([BEE_ASM_SOURCES],[ echo > mpopt.s echo > blowfishopt.s echo > sha1opt.s if test "$ac_enable_debug" != yes; then case $bc_target_arch in arm) AC_CONFIG_COMMANDS([mpopt.arm],[ m4 $srcdir/gas/mpopt.arm.m4 > mpopt.s ]) ;; alpha*) AC_CONFIG_COMMANDS([mpopt.alpha],[ m4 $srcdir/gas/mpopt.alpha.m4 > mpopt.s ]) ;; x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona | core2) AC_CONFIG_COMMANDS([mpopt.x86_64],[ m4 $srcdir/gas/mpopt.x86_64.m4 > mpopt.s ]) ;; i[[3456]]86 | pentium* | \ athlon*) AC_CONFIG_COMMANDS([mpopt.x86],[ m4 $srcdir/gas/mpopt.x86.m4 > mpopt.s ]) AC_CONFIG_COMMANDS([sha1opt.x86],[ m4 $srcdir/gas/sha1opt.x86.m4 > sha1opt.s ]) ;; ia64) AC_CONFIG_COMMANDS([mpopt.ia64],[ m4 $srcdir/gas/mpopt.ia64.m4 > mpopt.s ]) ;; m68k) AC_CONFIG_COMMANDS([mpopt.m68k],[ m4 $srcdir/gas/mpopt.m68k.m4 > mpopt.s ]) ;; powerpc) AC_CONFIG_COMMANDS([mpopt.ppc],[ m4 $srcdir/gas/mpopt.ppc.m4 > mpopt.s ]) ;; powerpc64) AC_CONFIG_COMMANDS([mpopt.ppc64],[ m4 $srcdir/gas/mpopt.ppc64.m4 > mpopt.s ]) ;; s390x) AC_CONFIG_COMMANDS([mpopt.s390x],[ m4 $srcdir/gas/mpopt.s390x.m4 > mpopt.s ]) ;; sparcv8) AC_CONFIG_COMMANDS([mpopt.sparcv8],[ m4 $srcdir/gas/mpopt.sparcv8.m4 > mpopt.s ]) ;; sparcv8plus) AC_CONFIG_COMMANDS([mpopt.sparcv8plus],[ m4 $srcdir/gas/mpopt.sparcv8plus.m4 > mpopt.s ]) ;; esac case $bc_target_arch in x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona | core2) ;; i[[56]]86 | pentium* | athlon*) AC_CONFIG_COMMANDS([blowfishopt.i586],[ m4 $srcdir/gas/blowfishopt.i586.m4 > blowfishopt.s ]) ;; powerpc) AC_CONFIG_COMMANDS([blowfishopt.ppc],[ m4 $srcdir/gas/blowfishopt.ppc.m4 > blowfishopt.s ]) ;; esac fi ]) dnl BEE_DLFCN AC_DEFUN([BEE_DLFCN],[ AH_TEMPLATE([HAVE_DLFCN_H],[.]) AC_CHECK_HEADERS([dlfcn.h]) if test "$ac_cv_header_dlfcn_h" = yes; then AC_SEARCH_LIBS([dlopen],[dl dld],[ ]) fi ]) dnl BEE_MULTITHREAD AC_DEFUN([BEE_MULTITHREAD],[ AH_TEMPLATE([ENABLE_THREADS],[Define to 1 if you want to enable multithread support]) AH_TEMPLATE([HAVE_THREAD_H],[.]) AH_TEMPLATE([HAVE_PTHREAD_H],[.]) AH_TEMPLATE([HAVE_SYNCH_H],[.]) AH_TEMPLATE([HAVE_SEMAPHORE_H],[.]) AH_TEMPLATE([HAVE_SCHED_H],[.]) if test "$ac_enable_threads" = yes; then AC_CHECK_HEADERS([synch.h thread.h pthread.h semaphore.h sched.h]) fi bc_include_synch_h= bc_include_thread_h= bc_include_pthread_h= bc_include_semaphore_h= bc_include_sched_h= bc_typedef_bc_cond_t= bc_typedef_bc_mutex_t= bc_typedef_bc_sema_t= bc_typedef_bc_thread_t= bc_typedef_bc_threadid_t= if test "$ac_enable_threads" = yes; then if test "$ac_cv_header_thread_h" = yes -a "$ac_cv_header_synch_h" = yes; then bc_include_synch_h="#include " bc_include_thread_h="#include " bc_typedef_bc_cond_t="typedef cond_t bc_cond_t;" bc_typedef_bc_mutex_t="typedef mutex_t bc_mutex_t;" bc_typedef_bc_sema_t="typedef sema_t bc_sema_t;" bc_typedef_bc_thread_t="typedef thread_t bc_thread_t;" bc_typedef_bc_threadid_t="typedef thread_t bc_threadid_t;" AC_SEARCH_LIBS([mutex_lock],[thread],[ AC_DEFINE([ENABLE_THREADS],1) ]) else if test "$ac_cv_header_semaphore_h" = yes; then bc_include_semaphore_h="#include " bc_typedef_bc_sema_t="typedef sem_t bc_sema_t;" fi if test "$ac_cv_header_sched_h" = yes; then bc_include_sched_h="#include " fi if test "$ac_cv_header_pthread_h" = yes; then bc_include_pthread_h="#include " bc_typedef_bc_cond_t="typedef pthread_cond_t bc_cond_t;" bc_typedef_bc_mutex_t="typedef pthread_mutex_t bc_mutex_t;" bc_typedef_bc_thread_t="typedef pthread_t bc_thread_t;" bc_typedef_bc_threadid_t="typedef pthread_t bc_threadid_t;" # On most systems this tests will say 'none required', but that doesn't # mean that the linked code will work correctly! case $target_os in linux* | solaris* ) AC_DEFINE([ENABLE_THREADS],1) LIBS="-lpthread $LIBS" ;; osf*) AC_DEFINE([ENABLE_THREADS],1) LIBS="-lpthread -lmach -lexc $LIBS" ;; *) AC_SEARCH_LIBS([pthread_mutex_lock],[pthread],[ AC_DEFINE([ENABLE_THREADS],1) ]) ;; esac else case $target_os in mingw*) bc_typedef_bc_cond_t="typedef HANDLE bc_cond_t;" bc_typedef_bc_mutex_t="typedef HANDLE bc_mutex_t;" bc_typedef_bc_thread_t="typedef HANDLE bc_thread_t;" bc_typedef_bc_threadid_t="typedef DWORD bc_threadid_t;" ;; *) AC_MSG_WARN([Don't know which thread library to check for]) ;; esac fi fi fi AC_SUBST(INCLUDE_SYNCH_H,$bc_include_synch_h) AC_SUBST(INCLUDE_THREAD_H,$bc_include_thread_h) AC_SUBST(INCLUDE_PTHREAD_H,$bc_include_pthread_h) AC_SUBST(INCLUDE_SEMAPHORE_H,$bc_include_semaphore_h) AC_SUBST(INCLUDE_SCHED_H,$bc_include_sched_h) AC_SUBST(TYPEDEF_BC_COND_T,$bc_typedef_bc_cond_t) AC_SUBST(TYPEDEF_BC_MUTEX_T,$bc_typedef_bc_mutex_t) AC_SUBST(TYPEDEF_BC_THREAD_T,$bc_typedef_bc_thread_t) AC_SUBST(TYPEDEF_BC_THREADID_T,$bc_typedef_bc_threadid_t) ]) AH_BOTTOM([ #if ENABLE_THREADS # ifndef _REENTRANT # define _REENTRANT # endif # if LINUX # define _LIBC_REENTRANT # endif #else # ifdef _REENTRANT # undef _REENTRANT # endif #endif ]) dnl BEE_THREAD_LOCAL_STORAGE AC_DEFUN([BEE_THREAD_LOCAL_STORAGE],[ AH_TEMPLATE([ENABLE_THREAD_LOCAL_STORAGE],[Define to 1 if you want to enable thread-local-storage support]) if test "$ac_enable_threads" = yes; then AC_MSG_CHECKING([if your compiler supports thread-local-storage]) AC_COMPILE_IFELSE([__thread int a = 0;],[ AC_DEFINE([ENABLE_THREAD_LOCAL_STORAGE],1) AC_MSG_RESULT([yes]) ],[ AC_DEFINE([ENABLE_THREAD_LOCAL_STORAGE],0) AC_MSG_RESULT([no]) ]) else AC_DEFINE([ENABLE_THREAD_LOCAL_STORAGE],0) fi ]) AH_BOTTOM([ #if !ENABLE_THREAD_LOCAL_STORAGE # define __thread #endif ]) beecrypt-4.2.1/md4.c0000644000175000001440000001272611223573012011104 00000000000000/* * */ #include "beecrypt/md4.h" #include "beecrypt/endianness.h" /*@unchecked@*/ /*@observer@*/ static uint32_t md4hinit[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }; /*@-sizeoftype@*/ /*@unchecked@*/ /*@observer@*/ const hashFunction md4 = { .name = "MD4", .paramsize = sizeof(md4Param), .blocksize = 64, .digestsize = 16, .reset = (hashFunctionReset) md4Reset, .update = (hashFunctionUpdate) md4Update, .digest = (hashFunctionDigest) md4Digest, }; /*@=sizeoftype@*/ int md4Reset(md4Param* mp) { /*@-sizeoftype@*/ memcpy(mp->h, md4hinit, 4 * sizeof(uint32_t)); memset(mp->data, 0, 16 * sizeof(uint32_t)); /*@=sizeoftype@*/ #if (MP_WBITS == 64) mpzero(1, mp->length); #elif (MP_WBITS == 32) mpzero(2, mp->length); #else # error #endif mp->offset = 0; return 0; } #define F(x, y, z) (z ^ (x & (y ^ z))) #define G(x, y, z) ((x & y) | (z & (x | y))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define FF(a, b, c, d, w, s) \ a = ROTL32((d^(b&(c^d))) + a + w, s); #define GG(a, b, c, d, w, s) \ a = ROTL32(((b&c)|(d&(b|c))) + a + w + 0x5a827999U, s); #define HH(a, b, c, d, w, s) \ a = ROTL32((b^c^d) + a + w + 0x6ed9eba1U, s); #ifndef ASM_MD4PROCESS void md4Process(md4Param *mp) /*@modifies mp @*/ { uint32_t a, b, c, d; register uint32_t* w; #ifdef WORDS_BIGENDIAN register byte t; #endif w = mp->data; #ifdef WORDS_BIGENDIAN t = 16; while (t--) { register uint32_t temp = swapu32(*w); *(w++) = temp; } w = mp->data; #endif a = mp->h[0]; b = mp->h[1]; c = mp->h[2]; d = mp->h[3]; FF (a, b, c, d, w[ 0], 3); FF (d, a, b, c, w[ 1], 7); FF (c, d, a, b, w[ 2], 11); FF (b, c, d, a, w[ 3], 19); FF (a, b, c, d, w[ 4], 3); FF (d, a, b, c, w[ 5], 7); FF (c, d, a, b, w[ 6], 11); FF (b, c, d, a, w[ 7], 19); FF (a, b, c, d, w[ 8], 3); FF (d, a, b, c, w[ 9], 7); FF (c, d, a, b, w[10], 11); FF (b, c, d, a, w[11], 19); FF (a, b, c, d, w[12], 3); FF (d, a, b, c, w[13], 7); FF (c, d, a, b, w[14], 11); FF (b, c, d, a, w[15], 19); GG (a, b, c, d, w[ 0], 3); GG (d, a, b, c, w[ 4], 5); GG (c, d, a, b, w[ 8], 9); GG (b, c, d, a, w[12], 13); GG (a, b, c, d, w[ 1], 3); GG (d, a, b, c, w[ 5], 5); GG (c, d, a, b, w[ 9], 9); GG (b, c, d, a, w[13], 13); GG (a, b, c, d, w[ 2], 3); GG (d, a, b, c, w[ 6], 5); GG (c, d, a, b, w[10], 9); GG (b, c, d, a, w[14], 13); GG (a, b, c, d, w[ 3], 3); GG (d, a, b, c, w[ 7], 5); GG (c, d, a, b, w[11], 9); GG (b, c, d, a, w[15], 13); HH (a, b, c, d, w[ 0], 3); HH (d, a, b, c, w[ 8], 9); HH (c, d, a, b, w[ 4], 11); HH (b, c, d, a, w[12], 15); HH (a, b, c, d, w[ 2], 3); HH (d, a, b, c, w[10], 9); HH (c, d, a, b, w[ 6], 11); HH (b, c, d, a, w[14], 15); HH (a, b, c, d, w[ 1], 3); HH (d, a, b, c, w[ 9], 9); HH (c, d, a, b, w[ 5], 11); HH (b, c, d, a, w[13], 15); HH (a, b, c, d, w[ 3], 3); HH (d, a, b, c, w[11], 9); HH (c, d, a, b, w[ 7], 11); HH (b, c, d, a, w[15], 15); mp->h[0] += a; mp->h[1] += b; mp->h[2] += c; mp->h[3] += d; } #endif int md4Update(md4Param* mp, const byte* data, size_t size) { register uint32_t proclength; #if (MP_WBITS == 64) mpw add[1]; mpsetw(1, add, size); mplshift(1, add, 3); (void) mpadd(1, mp->length, add); #elif (MP_WBITS == 32) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); (void) mpadd(2, mp->length, add); #else # error #endif while (size > 0) { proclength = ((mp->offset + size) > 64U) ? (64U - mp->offset) : size; /*@-mayaliasunique@*/ memcpy(((byte *) mp->data) + mp->offset, data, proclength); /*@=mayaliasunique@*/ size -= proclength; data += proclength; mp->offset += proclength; if (mp->offset == 64U) { md4Process(mp); mp->offset = 0; } } return 0; } static void md4Finish(md4Param* mp) /*@modifies mp @*/ { register byte *ptr = ((byte *) mp->data) + mp->offset++; *(ptr++) = 0x80; if (mp->offset > 56) { while (mp->offset++ < 64) *(ptr++) = 0; md4Process(mp); mp->offset = 0; } ptr = ((byte *) mp->data) + mp->offset; while (mp->offset++ < 56) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[0] = (byte)(mp->length[0] ); ptr[1] = (byte)(mp->length[0] >> 8); ptr[2] = (byte)(mp->length[0] >> 16); ptr[3] = (byte)(mp->length[0] >> 24); ptr[4] = (byte)(mp->length[0] >> 32); ptr[5] = (byte)(mp->length[0] >> 40); ptr[6] = (byte)(mp->length[0] >> 48); ptr[7] = (byte)(mp->length[0] >> 56); #elif (MP_WBITS == 32) ptr[0] = (byte)(mp->length[1] ); ptr[1] = (byte)(mp->length[1] >> 8); ptr[2] = (byte)(mp->length[1] >> 16); ptr[3] = (byte)(mp->length[1] >> 24); ptr[4] = (byte)(mp->length[0] ); ptr[5] = (byte)(mp->length[0] >> 8); ptr[6] = (byte)(mp->length[0] >> 16); ptr[7] = (byte)(mp->length[0] >> 24); #else # error #endif md4Process(mp); mp->offset = 0; } /*@-protoparammatch@*/ int md4Digest(md4Param* mp, byte* data) { md4Finish(mp); /* encode 4 integers little-endian style */ data[ 0] = (byte)(mp->h[0] ); data[ 1] = (byte)(mp->h[0] >> 8); data[ 2] = (byte)(mp->h[0] >> 16); data[ 3] = (byte)(mp->h[0] >> 24); data[ 4] = (byte)(mp->h[1] ); data[ 5] = (byte)(mp->h[1] >> 8); data[ 6] = (byte)(mp->h[1] >> 16); data[ 7] = (byte)(mp->h[1] >> 24); data[ 8] = (byte)(mp->h[2] ); data[ 9] = (byte)(mp->h[2] >> 8); data[10] = (byte)(mp->h[2] >> 16); data[11] = (byte)(mp->h[2] >> 24); data[12] = (byte)(mp->h[3] ); data[13] = (byte)(mp->h[3] >> 8); data[14] = (byte)(mp->h[3] >> 16); data[15] = (byte)(mp->h[3] >> 24); (void) md4Reset(mp); return 0; } /*@=protoparammatch@*/ beecrypt-4.2.1/mpbarrett.c0000664000175000001440000004602410254472206012426 00000000000000/* * Copyright (c) 2002 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mpbarrett.c * \brief Multi-precision integer routines using Barrett modular reduction. * For more information on this algorithm, see: * "Handbook of Applied Cryptography", Chapter 14.3.3 * Menezes, van Oorschot, Vanstone * CRC Press * \author Bob Deblier * \ingroup MP__m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/beecrypt.h" #include "beecrypt/mpprime.h" #include "beecrypt/mpnumber.h" #include "beecrypt/mpbarrett.h" /* * mpbzero */ void mpbzero(mpbarrett* b) { b->size = 0; b->modl = b->mu = (mpw*) 0; } /* * mpbinit * \brief allocates the data words for an mpbarrett structure * will allocate 2*size+1 words */ void mpbinit(mpbarrett* b, size_t size) { b->size = size; b->modl = (mpw*) calloc(2*size+1, sizeof(mpw)); if (b->modl != (mpw*) 0) b->mu = b->modl+size; else b->mu = (mpw*) 0; } /* * mpbfree */ void mpbfree(mpbarrett* b) { if (b->modl != (mpw*) 0) { free(b->modl); b->modl = b->mu = (mpw*) 0; } b->size = 0; } void mpbcopy(mpbarrett* b, const mpbarrett* copy) { register size_t size = copy->size; if (size) { if (b->modl) { if (b->size != size) b->modl = (mpw*) realloc(b->modl, (2*size+1) * sizeof(mpw)); } else b->modl = (mpw*) malloc((2*size+1) * sizeof(mpw)); if (b->modl) { b->size = size; b->mu = b->modl+copy->size; mpcopy(2*size+1, b->modl, copy->modl); } else { b->size = 0; b->mu = (mpw*) 0; } } else if (b->modl) { free(b->modl); b->size = 0; b->modl = b->mu = (mpw*) 0; } } void mpbwipe(mpbarrett* b) { if (b->modl != (mpw*) 0) mpzero(2*(b->size)+1, b->modl); } /* * mpbset */ void mpbset(mpbarrett* b, size_t size, const mpw *data) { if (size > 0) { if (b->modl) { if (b->size != size) b->modl = (mpw*) realloc(b->modl, (2*size+1) * sizeof(mpw)); } else b->modl = (mpw*) malloc((2*size+1) * sizeof(mpw)); if (b->modl) { mpw* temp = (mpw*) malloc((6*size+4) * sizeof(mpw)); b->size = size; b->mu = b->modl+size; mpcopy(size, b->modl, data); mpbmu_w(b, temp); free(temp); } else { b->size = 0; b->mu = (mpw*) 0; } } } int mpbsetbin(mpbarrett* b, const byte* osdata, size_t ossize) { int rc = -1; size_t size; /* skip zero bytes */ while (!(*osdata) && ossize) { osdata++; ossize--; } size = MP_BYTES_TO_WORDS(ossize + MP_WBYTES - 1); if (b->modl) { if (b->size != size) b->modl = (mpw*) realloc(b->modl, (2*size+1) * sizeof(mpw)); } else b->modl = (mpw*) malloc((2*size+1) * sizeof(mpw)); if (b->modl) { register mpw* temp = (mpw*) malloc((6*size+4) * sizeof(mpw)); b->size = size; b->mu = b->modl+size; rc = os2ip(b->modl, size, osdata, ossize); mpbmu_w(b, temp); free(temp); } return rc; } int mpbsethex(mpbarrett* b, const char* hex) { int rc = -1; size_t len = strlen(hex); size_t size = MP_NIBBLES_TO_WORDS(len + MP_WNIBBLES - 1); if (b->modl) { if (b->size != size) b->modl = (mpw*) realloc(b->modl, (2*size+1) * sizeof(mpw)); } else b->modl = (mpw*) malloc((2*size+1) * sizeof(mpw)); if (b->modl) { register mpw* temp = (mpw*) malloc((6*size+4) * sizeof(mpw)); b->size = size; b->mu = b->modl+size; rc = hs2ip(b->modl, size, hex, len); mpbmu_w(b, temp); free(temp); } else { b->size = 0; b->mu = 0; } return rc; } /* * mpbmu_w * computes the Barrett 'mu' coefficient * needs workspace of (6*size+4) words */ void mpbmu_w(mpbarrett* b, mpw* wksp) { register size_t size = b->size; register size_t shift; register mpw* divmod = wksp; register mpw* dividend = divmod+(size*2+2); register mpw* workspace = dividend+(size*2+1); /* normalize modulus before division */ shift = mpnorm(size, b->modl); /* make the dividend, initialize first word to 1 (shifted); the rest is zero */ *dividend = ((mpw) MP_LSBMASK << shift); mpzero(size*2, dividend+1); mpndivmod(divmod, size*2+1, dividend, size, b->modl, workspace); mpcopy(size+1, b->mu, divmod+1); /* de-normalize */ mprshift(size, b->modl, shift); } /* * mpbrnd_w * generates a random number in the range 1 < r < b-1 * need workspace of (size) words */ void mpbrnd_w(const mpbarrett* b, randomGeneratorContext* rc, mpw* result, mpw* wksp) { size_t msz = mpmszcnt(b->size, b->modl); mpcopy(b->size, wksp, b->modl); mpsubw(b->size, wksp, 1); do { rc->rng->next(rc->param, (byte*) result, MP_WORDS_TO_BYTES(b->size)); result[0] &= (MP_ALLMASK >> msz); while (mpge(b->size, result, wksp)) mpsub(b->size, result, wksp); } while (mpleone(b->size, result)); } /* * mpbrndodd_w * generates a random odd number in the range 1 < r < b-1 * needs workspace of (size) words */ void mpbrndodd_w(const mpbarrett* b, randomGeneratorContext* rc, mpw* result, mpw* wksp) { size_t msz = mpmszcnt(b->size, b->modl); mpcopy(b->size, wksp, b->modl); mpsubw(b->size, wksp, 1); do { rc->rng->next(rc->param, (byte*) result, MP_WORDS_TO_BYTES(b->size)); result[0] &= (MP_ALLMASK >> msz); mpsetlsb(b->size, result); while (mpge(b->size, result, wksp)) { mpsub(b->size, result, wksp); mpsetlsb(b->size, result); } } while (mpleone(b->size, result)); } /* * mpbrndinv_w * generates a random invertible (modulo b) in the range 1 < r < b-1 * needs workspace of (6*size+6) words */ void mpbrndinv_w(const mpbarrett* b, randomGeneratorContext* rc, mpw* result, mpw* inverse, mpw* wksp) { register size_t size = b->size; do { if (mpeven(size, b->modl)) mpbrndodd_w(b, rc, result, wksp); else mpbrnd_w(b, rc, result, wksp); } while (mpextgcd_w(size, b->modl, result, inverse, wksp) == 0); } /* * mpbmod_w * computes the barrett modular reduction of a number x, which has twice the size of b * needs workspace of (2*size+2) words */ void mpbmod_w(const mpbarrett* b, const mpw* data, mpw* result, mpw* wksp) { register mpw rc; register size_t sp = 2; register const mpw* src = data+b->size+1; register mpw* dst = wksp+b->size+1; rc = mpsetmul(sp, dst, b->mu, *(--src)); *(--dst) = rc; while (sp <= b->size) { sp++; if ((rc = *(--src))) { rc = mpaddmul(sp, dst, b->mu, rc); *(--dst) = rc; } else *(--dst) = 0; } if ((rc = *(--src))) { rc = mpaddmul(sp, dst, b->mu, rc); *(--dst) = rc; } else *(--dst) = 0; sp = b->size; rc = 0; dst = wksp+b->size+1; src = dst; *dst = mpsetmul(sp, dst+1, b->modl, *(--src)); while (sp > 0) mpaddmul(sp--, dst, b->modl+(rc++), *(--src)); mpsetx(b->size+1, wksp, b->size*2, data); mpsub(b->size+1, wksp, wksp+b->size+1); while (mpgex(b->size+1, wksp, b->size, b->modl)) mpsubx(b->size+1, wksp, b->size, b->modl); mpcopy(b->size, result, wksp+1); } /* * mpbsubone * copies (b-1) into result */ void mpbsubone(const mpbarrett* b, mpw* result) { register size_t size = b->size; mpcopy(size, result, b->modl); mpsubw(size, result, 1); } /* * mpbneg * computes the negative (modulo b) of x, where x must contain a value between 0 and b-1 */ void mpbneg(const mpbarrett* b, const mpw* data, mpw* result) { register size_t size = b->size; mpcopy(size, result, data); mpneg(size, result); mpadd(size, result, b->modl); } /* * mpbaddmod_w * computes the sum (modulo b) of x and y * needs a workspace of (4*size+2) words */ void mpbaddmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, mpw* result, mpw* wksp) { /* xsize and ysize must be less than or equal to b->size */ register size_t size = b->size; register mpw* temp = wksp + size*2+2; mpsetx(2*size, temp, xsize, xdata); mpaddx(2*size, temp, ysize, ydata); mpbmod_w(b, temp, result, wksp); } /* * mpbsubmod_w * computes the difference (modulo b) of x and y * needs a workspace of (4*size+2) words */ void mpbsubmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, mpw* result, mpw* wksp) { /* xsize and ysize must be less than or equal to b->size */ register size_t size = b->size; register mpw* temp = wksp + size*2+2; mpsetx(2*size, temp, xsize, xdata); if (mpsubx(2*size, temp, ysize, ydata)) /* if there's carry, i.e. the result would be negative, add the modulus */ while (!mpaddx(2*size, temp, size, b->modl)); /* keep adding the modulus until we get a carry */ mpbmod_w(b, temp, result, wksp); } /* * mpmulmod_w * computes the product (modulo b) of x and y * needs a workspace of (4*size+2) words */ void mpbmulmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, mpw* result, mpw* wksp) { /* xsize and ysize must be <= b->size */ register size_t size = b->size; register size_t fill = size*2-xsize-ysize; register mpw* temp = wksp + size*2+2; if (fill) mpzero(fill, temp); mpmul(temp+fill, xsize, xdata, ysize, ydata); mpbmod_w(b, temp, result, wksp); } /* * mpbsqrmod_w * computes the square (modulo b) of x * needs a workspace of (4*size+2) words */ void mpbsqrmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, mpw* result, mpw* wksp) { /* xsize must be <= b->size */ register size_t size = b->size; register size_t fill = 2*(size-xsize); register mpw* temp = wksp + size*2+2; if (fill) mpzero(fill, temp); mpsqr(temp+fill, xsize, xdata); mpbmod_w(b, temp, result, wksp); } /* * Sliding Window Exponentiation technique, slightly altered from the method Applied Cryptography: * * First of all, the table with the powers of g can be reduced by about half; the even powers don't * need to be accessed or stored. * * Get up to K bits starting with a one, if we have that many still available * * Do the number of squarings of A in the first column, the multiply by the value in column two, * and finally do the number of squarings in column three. * * This table can be used for K=2,3,4 and can be extended * * 0 : - | - | - * 1 : 1 | g1 @ 0 | 0 * 10 : 1 | g1 @ 0 | 1 * 11 : 2 | g3 @ 1 | 0 * 100 : 1 | g1 @ 0 | 2 * 101 : 3 | g5 @ 2 | 0 * 110 : 2 | g3 @ 1 | 1 * 111 : 3 | g7 @ 3 | 0 * 1000 : 1 | g1 @ 0 | 3 * 1001 : 4 | g9 @ 4 | 0 * 1010 : 3 | g5 @ 2 | 1 * 1011 : 4 | g11 @ 5 | 0 * 1100 : 2 | g3 @ 1 | 2 * 1101 : 4 | g13 @ 6 | 0 * 1110 : 3 | g7 @ 3 | 1 * 1111 : 4 | g15 @ 7 | 0 * */ /* * mpbslide_w * precomputes the sliding window table for computing powers of x modulo b * needs workspace (4*size+2) */ void mpbslide_w(const mpbarrett* b, size_t xsize, const mpw* xdata, mpw* slide, mpw* wksp) { register size_t size = b->size; mpbsqrmod_w(b, xsize, xdata, slide , wksp); /* x^2 mod b, temp */ mpbmulmod_w(b, xsize, xdata, size, slide , slide+size , wksp); /* x^3 mod b */ mpbmulmod_w(b, size, slide, size, slide+size , slide+2*size, wksp); /* x^5 mod b */ mpbmulmod_w(b, size, slide, size, slide+2*size, slide+3*size, wksp); /* x^7 mod b */ mpbmulmod_w(b, size, slide, size, slide+3*size, slide+4*size, wksp); /* x^9 mod b */ mpbmulmod_w(b, size, slide, size, slide+4*size, slide+5*size, wksp); /* x^11 mod b */ mpbmulmod_w(b, size, slide, size, slide+5*size, slide+6*size, wksp); /* x^13 mod b */ mpbmulmod_w(b, size, slide, size, slide+6*size, slide+7*size, wksp); /* x^15 mod b */ mpsetx(size, slide, xsize, xdata); /* x^1 mod b */ } static byte mpbslide_presq[16] = { 0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 4, 2, 4, 3, 4 }; static byte mpbslide_mulg[16] = { 0, 0, 0, 1, 0, 2, 1, 3, 0, 4, 2, 5, 1, 6, 3, 7 }; static byte mpbslide_postsq[16] = { 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 }; /* * needs workspace of 4*size+2 words */ void mpbpowmod_w(const mpbarrett* b, size_t xsize, const mpw* xdata, size_t psize, const mpw* pdata, mpw* result, mpw* wksp) { /* * Modular exponention * * Uses sliding window exponentiation; needs extra storage: if K=3, needs 8*size, if K=4, needs 16*size * */ /* K == 4 for the first try */ size_t size = b->size; mpw temp; while (psize) { if ((temp = *(pdata++))) /* break when first non-zero word found */ break; psize--; } /* if temp is still zero, then we're trying to raise x to power zero, and result stays one */ if (temp) { mpw* slide = (mpw*) malloc((8*size)*sizeof(mpw)); mpbslide_w(b, xsize, xdata, slide, wksp); mpbpowmodsld_w(b, slide, psize, pdata-1, result, wksp); free(slide); } } void mpbpowmodsld_w(const mpbarrett* b, const mpw* slide, size_t psize, const mpw* pdata, mpw* result, mpw* wksp) { /* * Modular exponentiation with precomputed sliding window table, so no x is required * */ size_t size = b->size; mpw temp; mpsetw(size, result, 1); while (psize) { if ((temp = *(pdata++))) /* break when first non-zero word found in power */ break; psize--; } /* if temp is still zero, then we're trying to raise x to power zero, and result stays one */ if (temp) { short l = 0, n = 0, count = MP_WBITS; /* first skip bits until we reach a one */ while (count) { if (temp & MP_MSBMASK) break; temp <<= 1; count--; } while (psize) { while (count) { byte bit = (temp & MP_MSBMASK) ? 1 : 0; n <<= 1; n += bit; if (n) { if (l) l++; else if (bit) l = 1; if (l == 4) { byte s = mpbslide_presq[n]; while (s--) mpbsqrmod_w(b, size, result, result, wksp); mpbmulmod_w(b, size, result, size, slide+mpbslide_mulg[n]*size, result, wksp); s = mpbslide_postsq[n]; while (s--) mpbsqrmod_w(b, size, result, result, wksp); l = n = 0; } } else mpbsqrmod_w(b, size, result, result, wksp); temp <<= 1; count--; } if (--psize) { count = MP_WBITS; temp = *(pdata++); } } if (n) { byte s = mpbslide_presq[n]; while (s--) mpbsqrmod_w(b, size, result, result, wksp); mpbmulmod_w(b, size, result, size, slide+mpbslide_mulg[n]*size, result, wksp); s = mpbslide_postsq[n]; while (s--) mpbsqrmod_w(b, size, result, result, wksp); } } } /* * mpbtwopowmod_w * needs workspace of (4*size+2) words */ void mpbtwopowmod_w(const mpbarrett* b, size_t psize, const mpw* pdata, mpw* result, mpw* wksp) { /* * Modular exponention, 2^p mod modulus, special optimization * * Uses left-to-right exponentiation; needs no extra storage * */ /* this routine calls mpbmod, which needs (size*2+2), this routine needs (size*2) for sdata */ register size_t size = b->size; register mpw temp = 0; mpsetw(size, result, 1); while (psize) { if ((temp = *(pdata++))) /* break when first non-zero word found */ break; psize--; } /* if temp is still zero, then we're trying to raise x to power zero, and result stays one */ if (temp) { register int count = MP_WBITS; /* first skip bits until we reach a one */ while (count) { if (temp & MP_MSBMASK) break; temp <<= 1; count--; } while (psize--) { while (count) { /* always square */ mpbsqrmod_w(b, size, result, result, wksp); /* multiply by two if bit is 1 */ if (temp & MP_MSBMASK) { if (mpadd(size, result, result) || mpge(size, result, b->modl)) { /* there was carry, or the result is greater than the modulus, so we need to adjust */ mpsub(size, result, b->modl); } } temp <<= 1; count--; } count = MP_WBITS; temp = *(pdata++); } } } /* * needs workspace of (7*size+2) words */ int mpbpprime_w(const mpbarrett* b, randomGeneratorContext* r, int t, mpw* wksp) { /* * This test works for candidate probable primes >= 3, which are also not small primes. * * It assumes that b->modl contains the candidate prime * */ size_t size = b->size; /* first test if modl is odd */ if (mpodd(b->size, b->modl)) { /* * Small prime factor test: * * Tables in mpspprod contain multi-precision integers with products of small primes * If the greatest common divisor of this product and the candidate is not one, then * the candidate has small prime factors, or is a small prime. Neither is acceptable when * we are looking for large probable primes =) * */ if (size > SMALL_PRIMES_PRODUCT_MAX) { mpsetx(size, wksp+size, SMALL_PRIMES_PRODUCT_MAX, mpspprod[SMALL_PRIMES_PRODUCT_MAX-1]); mpgcd_w(size, b->modl, wksp+size, wksp, wksp+2*size); } else { mpgcd_w(size, b->modl, mpspprod[size-1], wksp, wksp+2*size); } if (mpisone(size, wksp)) { return mppmilrab_w(b, r, t, wksp); } } return 0; } void mpbnrnd(const mpbarrett* b, randomGeneratorContext* rc, mpnumber* result) { register size_t size = b->size; register mpw* temp = (mpw*) malloc(size * sizeof(mpw)); mpnfree(result); mpnsize(result, size); mpbrnd_w(b, rc, result->data, temp); free(temp); } void mpbnmulmod(const mpbarrett* b, const mpnumber* x, const mpnumber* y, mpnumber* result) { register size_t size = b->size; register mpw* temp = (mpw*) malloc((4*size+2) * sizeof(mpw)); /* xsize and ysize must be <= b->size */ register size_t fill = 2*size-x->size-y->size; register mpw* opnd = temp+size*2+2; mpnfree(result); mpnsize(result, size); if (fill) mpzero(fill, opnd); mpmul(opnd+fill, x->size, x->data, y->size, y->data); mpbmod_w(b, opnd, result->data, temp); free(temp); } void mpbnsqrmod(const mpbarrett* b, const mpnumber* x, mpnumber* result) { register size_t size = b->size; register mpw* temp = (mpw*) malloc(size * sizeof(mpw)); /* xsize must be <= b->size */ register size_t fill = 2*(size-x->size); register mpw* opnd = temp + size*2+2; if (fill) mpzero(fill, opnd); mpsqr(opnd+fill, x->size, x->data); mpnsize(result, size); mpbmod_w(b, opnd, result->data, temp); free(temp); } void mpbnpowmod(const mpbarrett* b, const mpnumber* x, const mpnumber* pow, mpnumber* y) { register size_t size = b->size; register mpw* temp = (mpw*) malloc((4*size+2) * sizeof(mpw)); mpnfree(y); mpnsize(y, size); mpbpowmod_w(b, x->size, x->data, pow->size, pow->data, y->data, temp); free(temp); } void mpbnpowmodsld(const mpbarrett* b, const mpw* slide, const mpnumber* pow, mpnumber* y) { register size_t size = b->size; register mpw* temp = (mpw*) malloc((4*size+2) * sizeof(mpw)); mpnfree(y); mpnsize(y, size); mpbpowmodsld_w(b, slide, pow->size, pow->data, y->data, temp); free(temp); } size_t mpbbits(const mpbarrett* b) { return mpbits(b->size, b->modl); } beecrypt-4.2.1/autogen.sh0000775000175000001440000000015510235656567012273 00000000000000#! /bin/sh export CFLAGS export LDFLAGS libtoolize --force --copy aclocal automake -a -c autoconf autoheader beecrypt-4.2.1/dhies.c0000644000175000001440000002074211216147021011510 00000000000000/* * Copyright (c) 2000, 2001, 2002, 2005 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dhies.c * \brief DHIES encryption scheme. * \author Bob Deblier * \ingroup DL_m DL_dh_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/dhies.h" #include "beecrypt/dlsvdp-dh.h" #include "beecrypt/blockmode.h" #include "beecrypt/blockpad.h" /* * Good combinations will be: * * For 128-bit encryption: * DHIES(SHA-256,AES,HMAC-SHA-256) * DHIES(SHA-256,Blowfish,HMAC-SHA-256) * * For 192-bit encryption: * DHIES(SHA-384,AES,HMAC-SHA-384) * DHIES(SHA-384,Blowfish,HMAC-SHA-384) * * For 256-bit encryption: * DHIES(SHA-512,AES,HMAC-SHA-512) * DHIES(SHA-512,Blowfish,HMAC-SHA-512) * */ int dhies_pUsable(const dhies_pParameters* params) { size_t keybits = (params->hash->digestsize << 3); /* digestsize in bytes times 8 bits */ size_t cipherkeybits = params->cipherkeybits; size_t mackeybits = params->mackeybits; /* test if keybits is a multiple of 32 */ if ((keybits & 31) != 0) return 0; /* test if cipherkeybits + mackeybits < keybits */ if ((cipherkeybits + mackeybits) > keybits) return 0; if (mackeybits == 0) { if (cipherkeybits == 0) cipherkeybits = mackeybits = (keybits >> 1); else mackeybits = keybits - cipherkeybits; } /* test if keybits length is appropriate for cipher */ if ((cipherkeybits < params->cipher->keybitsmin) || (cipherkeybits > params->cipher->keybitsmax)) return 0; if (((cipherkeybits - params->cipher->keybitsmin) % params->cipher->keybitsinc) != 0) return 0; /* test if keybits length is appropriate for mac */ if ((mackeybits < params->mac->keybitsmin) || (params->mackeybits > params->mac->keybitsmax)) return 0; if (((mackeybits - params->mac->keybitsmin) % params->mac->keybitsinc) != 0) return 0; return 1; } int dhies_pContextInit(dhies_pContext* ctxt, const dhies_pParameters* params) { if (ctxt == (dhies_pContext*) 0) return -1; if (params == (dhies_pParameters*) 0) return -1; if (params->param == (dldp_p*) 0) return -1; if (params->hash == (hashFunction*) 0) return -1; if (params->cipher == (blockCipher*) 0) return -1; if (params->mac == (keyedHashFunction*) 0) return -1; if (!dhies_pUsable(params)) return -1; dldp_pInit(&ctxt->param); dldp_pCopy(&ctxt->param, params->param); mpnzero(&ctxt->pub); mpnzero(&ctxt->pri); if (hashFunctionContextInit(&ctxt->hash, params->hash)) return -1; if (blockCipherContextInit(&ctxt->cipher, params->cipher)) return -1; if (keyedHashFunctionContextInit(&ctxt->mac, params->mac)) return -1; ctxt->cipherkeybits = params->cipherkeybits; ctxt->mackeybits = params->mackeybits; return 0; } int dhies_pContextInitDecrypt(dhies_pContext* ctxt, const dhies_pParameters* params, const mpnumber* pri) { if (dhies_pContextInit(ctxt, params)) return -1; mpncopy(&ctxt->pri, pri); return 0; } int dhies_pContextInitEncrypt(dhies_pContext* ctxt, const dhies_pParameters* params, const mpnumber* pub) { if (dhies_pContextInit(ctxt, params)) return -1; mpncopy(&ctxt->pub, pub); return 0; } int dhies_pContextFree(dhies_pContext* ctxt) { dldp_pFree(&ctxt->param); mpnfree(&ctxt->pub); mpnfree(&ctxt->pri); if (hashFunctionContextFree(&ctxt->hash)) return -1; if (blockCipherContextFree(&ctxt->cipher)) return -1; if (keyedHashFunctionContextFree(&ctxt->mac)) return -1; return 0; } static int dhies_pContextSetup(dhies_pContext* ctxt, const mpnumber* private, const mpnumber* public, const mpnumber* message, cipherOperation op) { register int rc; mpnumber secret; byte* digest = (byte*) malloc(ctxt->hash.algo->digestsize); if (digest == (byte*) 0) return -1; /* compute the shared secret, Diffie-Hellman style */ mpnzero(&secret); if (dlsvdp_pDHSecret(&ctxt->param, private, public, &secret)) { mpnfree(&secret); free(digest); return -1; } /* compute the hash of the message (ephemeral public) key and the shared secret */ hashFunctionContextReset (&ctxt->hash); hashFunctionContextUpdateMP(&ctxt->hash, message); hashFunctionContextUpdateMP(&ctxt->hash, &secret); hashFunctionContextDigest (&ctxt->hash, digest); /* we don't need the secret anymore */ mpnwipe(&secret); mpnfree(&secret); /* * NOTE: blockciphers and keyed hash functions take keys with sizes * specified in bits and key data passed in bytes. * * Both blockcipher and keyed hash function have a min and max key size. * * This function will split the digest of the shared secret in two halves, * and pad with zero bits or truncate if necessary to meet algorithm key * size requirements. */ if (ctxt->hash.algo->digestsize > 0) { byte* mackey = digest; byte* cipherkey = digest + ((ctxt->mackeybits + 7) >> 3); if ((rc = keyedHashFunctionContextSetup(&ctxt->mac, mackey, ctxt->mackeybits))) goto setup_end; if ((rc = blockCipherContextSetup(&ctxt->cipher, cipherkey, ctxt->cipherkeybits, op))) goto setup_end; rc = 0; } else rc = -1; setup_end: /* wipe digest for good measure */ memset(digest, 0, ctxt->hash.algo->digestsize); free(digest); return rc; } memchunk* dhies_pContextEncrypt(dhies_pContext* ctxt, mpnumber* ephemeralPublicKey, mpnumber* mac, const memchunk* cleartext, randomGeneratorContext* rng) { memchunk* ciphertext = (memchunk*) 0; memchunk* paddedtext; mpnumber ephemeralPrivateKey; /* make the ephemeral keypair */ mpnzero(&ephemeralPrivateKey); dldp_pPair(&ctxt->param, rng, &ephemeralPrivateKey, ephemeralPublicKey); /* Setup the key and initialize the mac and the blockcipher */ if (dhies_pContextSetup(ctxt, &ephemeralPrivateKey, &ctxt->pub, ephemeralPublicKey, ENCRYPT)) goto encrypt_end; /* add pkcs-5 padding */ paddedtext = pkcs5PadCopy(ctxt->cipher.algo->blocksize, cleartext); /* encrypt the memchunk in CBC mode */ if (blockEncryptCBC(ctxt->cipher.algo, ctxt->cipher.param, (uint32_t*) paddedtext->data, (const uint32_t*) paddedtext->data, paddedtext->size / ctxt->cipher.algo->blocksize)) { free(paddedtext->data); free(paddedtext); goto encrypt_end; } /* Compute the mac */ if (keyedHashFunctionContextUpdateMC(&ctxt->mac, paddedtext)) { free(paddedtext->data); free(paddedtext); goto encrypt_end; } if (keyedHashFunctionContextDigestMP(&ctxt->mac, mac)) { free(paddedtext->data); free(paddedtext); goto encrypt_end; } ciphertext = paddedtext; encrypt_end: mpnwipe(&ephemeralPrivateKey); mpnfree(&ephemeralPrivateKey); return ciphertext; } memchunk* dhies_pContextDecrypt(dhies_pContext* ctxt, const mpnumber* ephemeralPublicKey, const mpnumber* mac, const memchunk* ciphertext) { memchunk* cleartext = (memchunk*) 0; memchunk* paddedtext; /* Setup the key and initialize the mac and the blockcipher */ if (dhies_pContextSetup(ctxt, &ctxt->pri, ephemeralPublicKey, ephemeralPublicKey, DECRYPT)) goto decrypt_end; /* Verify the mac */ if (keyedHashFunctionContextUpdateMC(&ctxt->mac, ciphertext)) goto decrypt_end; if (keyedHashFunctionContextDigestMatch(&ctxt->mac, mac) == 0) goto decrypt_end; /* decrypt the memchunk with CBC mode */ paddedtext = (memchunk*) calloc(1, sizeof(memchunk)); if (paddedtext == (memchunk*) 0) goto decrypt_end; paddedtext->size = ciphertext->size; paddedtext->data = (byte*) malloc(ciphertext->size); if (paddedtext->data == (byte*) 0) { free(paddedtext); goto decrypt_end; } if (blockDecryptCBC(ctxt->cipher.algo, ctxt->cipher.param, (uint32_t*) paddedtext->data, (const uint32_t*) ciphertext->data, paddedtext->size / ctxt->cipher.algo->blocksize)) { free(paddedtext->data); free(paddedtext); goto decrypt_end; } /* remove pkcs-5 padding */ cleartext = pkcs5Unpad(ctxt->cipher.algo->blocksize, paddedtext); if (cleartext == (memchunk*) 0) { free(paddedtext->data); free(paddedtext); } decrypt_end: return cleartext; } beecrypt-4.2.1/mp.c0000644000175000001440000007033111216147021011027 00000000000000/* * Copyright (c) 2002, 2003 Bob Deblier * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file mp.c * \brief Multi-precision integer routines. * \author Bob Deblier * \ingroup MP_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/mp.h" #include "beecrypt/mpopt.h" #ifndef ASM_MPZERO void mpzero(size_t size, mpw* data) { while (size--) *(data++) = 0; } #endif #ifndef ASM_MPFILL void mpfill(size_t size, mpw* data, mpw fill) { while (size--) *(data++) = fill; } #endif #ifndef ASM_MPODD int mpodd(size_t size, const mpw* data) { return (int)(data[size-1] & 0x1); } #endif #ifndef ASM_MPEVEN int mpeven(size_t size, const mpw* data) { return !(int)(data[size-1] & 0x1); } #endif #ifndef ASM_MPZ int mpz(size_t size, const mpw* data) { while (size--) if (*(data++)) return 0; return 1; } #endif #ifndef ASM_MPNZ int mpnz(size_t size, const mpw* data) { while (size--) if (*(data++)) return 1; return 0; } #endif #ifndef ASM_MPEQ int mpeq(size_t size, const mpw* xdata, const mpw* ydata) { while (size--) { if (*xdata == *ydata) { xdata++; ydata++; } else return 0; } return 1; } #endif #ifndef ASM_MPEQX int mpeqx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) { if (xsize > ysize) { register size_t diff = xsize - ysize; return mpeq(ysize, xdata+diff, ydata) && mpz(diff, xdata); } else if (xsize < ysize) { register size_t diff = ysize - xsize; return mpeq(xsize, ydata+diff, xdata) && mpz(diff, ydata); } else return mpeq(xsize, xdata, ydata); } #endif #ifndef ASM_MPNE int mpne(size_t size, const mpw* xdata, const mpw* ydata) { while (size--) { if (*xdata == *ydata) { xdata++; ydata++; } else return 1; } return 0; } #endif #ifndef ASM_MPNEX int mpnex(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) { if (xsize > ysize) { register size_t diff = xsize - ysize; return mpnz(diff, xdata) || mpne(ysize, xdata+diff, ydata); } else if (xsize < ysize) { register size_t diff = ysize - xsize; return mpnz(diff, ydata) || mpne(xsize, ydata+diff, xdata); } else return mpne(xsize, xdata, ydata); } #endif #ifndef ASM_MPGT int mpgt(size_t size, const mpw* xdata, const mpw* ydata) { while (size--) { if (*xdata < *ydata) return 0; if (*xdata > *ydata) return 1; xdata++; ydata++; } return 0; } #endif #ifndef ASM_MPGTX int mpgtx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) { if (xsize > ysize) { register size_t diff = xsize - ysize; return mpnz(diff, xdata) || mpgt(ysize, xdata + diff, ydata); } else if (xsize < ysize) { register size_t diff = ysize - xsize; return mpz(diff, ydata) && mpgt(xsize, xdata, ydata + diff); } else return mpgt(xsize, xdata, ydata); } #endif #ifndef ASM_MPLT int mplt(size_t size, const mpw* xdata, const mpw* ydata) { while (size--) { if (*xdata > *ydata) return 0; if (*xdata < *ydata) return 1; xdata++; ydata++; } return 0; } #endif #ifndef ASM_MPLTX int mpltx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) { if (xsize > ysize) { register size_t diff = xsize - ysize; return mpz(diff, xdata) && mplt(ysize, xdata+diff, ydata); } else if (xsize < ysize) { register size_t diff = ysize - xsize; return mpnz(diff, ydata) || mplt(xsize, xdata, ydata+diff); } else return mplt(xsize, xdata, ydata); } #endif #ifndef ASM_MPGE int mpge(size_t size, const mpw* xdata, const mpw* ydata) { while (size--) { if (*xdata < *ydata) return 0; if (*xdata > *ydata) return 1; xdata++; ydata++; } return 1; } #endif #ifndef ASM_MPGEX int mpgex(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) { if (xsize > ysize) { register size_t diff = xsize - ysize; return mpnz(diff, xdata) || mpge(ysize, xdata+diff, ydata); } else if (xsize < ysize) { register size_t diff = ysize - xsize; return mpz(diff, ydata) && mpge(xsize, xdata, ydata+diff); } else return mpge(xsize, xdata, ydata); } #endif #ifndef ASM_MPLE int mple(size_t size, const mpw* xdata, const mpw* ydata) { while (size--) { if (*xdata < *ydata) return 1; if (*xdata > *ydata) return 0; xdata++; ydata++; } return 1; } #endif #ifndef ASM_MPLEX int mplex(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) { if (xsize > ysize) { register size_t diff = xsize - ysize; return mpz(diff, xdata) && mple(ysize, xdata+ diff, ydata); } else if (xsize < ysize) { register size_t diff = ysize - xsize; return mpnz(diff, ydata) || mple(xsize, xdata, ydata+diff); } else return mple(xsize, xdata, ydata); } #endif #ifndef ASM_MPCMP int mpcmp(size_t size, const mpw* xdata, const mpw* ydata) { while (size--) { if (*xdata < *ydata) return -1; else if (*xdata > *ydata) return 1; xdata++; ydata++; } return 0; } #endif #ifndef ASM_MPCMPX int mpcmpx(size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) { if (xsize > ysize) { register size_t diff = xsize - ysize; if (mpnz(diff, xdata)) return 1; xsize -= diff; xdata += diff; } else if (xsize < ysize) { register size_t diff = ysize - xsize; if (mpnz(diff, ydata)) return -1; ydata += diff; } return mpcmp(xsize, xdata, ydata); } #endif #ifndef ASM_MPISONE int mpisone(size_t size, const mpw* data) { data += size; if (*(--data) == 1) { while (--size) if (*(--data)) return 0; return 1; } return 0; } #endif #ifndef ASM_MPISTWO int mpistwo(size_t size, const mpw* data) { data += size; if (*(--data) == 2) { while (--size) if (*(--data)) return 0; return 1; } return 0; } #endif #ifndef ASM_MPEQMONE int mpeqmone(size_t size, const mpw* xdata, const mpw* ydata) { xdata += size; ydata += size; if (*(--xdata)+1 == *(--ydata)) { while (--size) if (*(--xdata) != *(--ydata)) return 0; return 1; } return 0; } #endif #ifndef ASM_MPLEONE int mpleone(size_t size, const mpw* data) { data += size; if (*(--data) > 1) return 0; else { while (--size) if (*(--data)) return 0; return 1; } } #endif #ifndef ASM_MPMSBSET int mpmsbset(size_t size, const mpw* data) { return (int)((*data) >> (MP_WBITS-1)); } #endif #ifndef ASM_MPLSBSET int mplsbset(size_t size, const mpw* data) { return (int)(data[size-1] & 0x1); } #endif #ifndef ASM_MPSETMSB void mpsetmsb(size_t size, mpw* data) { *data |= MP_MSBMASK; } #endif #ifndef ASM_MPSETLSB void mpsetlsb(size_t size, mpw* data) { data[size-1] |= MP_LSBMASK; } #endif #ifndef ASM_MPCLRMSB void mpclrmsb(size_t size, mpw* data) { *data &= ~ MP_MSBMASK; } #endif #ifndef ASM_MPCLRLSB void mpclrlsb(size_t size, mpw* data) { data[size-1] &= ~ MP_LSBMASK; } #endif #ifndef ASM_MPAND void mpand(size_t size, mpw* xdata, const mpw* ydata) { while (size--) xdata[size] &= ydata[size]; } #endif #ifndef ASM_MPOR void mpor(size_t size, mpw* xdata, const mpw* ydata) { while (size--) xdata[size] |= ydata[size]; } #endif #ifndef ASM_MPXOR void mpxor(size_t size, mpw* xdata, const mpw* ydata) { while (size--) xdata[size] ^= ydata[size]; } #endif #ifndef ASM_MPNOT void mpnot(size_t size, mpw* data) { while (size--) data[size] = ~data[size]; } #endif #ifndef ASM_MPSETW void mpsetw(size_t size, mpw* xdata, mpw y) { while (--size) *(xdata++) = 0; *(xdata++) = y; } #endif #ifndef ASM_MPSETWS void mpsetws(size_t size, mpw* xdata, size_t y) { while (size--) { xdata[size] = (mpw) y; #if (MP_WBYTES > SIZEOF_SIZE_T) y >>= MP_WBITS; #else y = 0; #endif } } #endif #ifndef ASM_MPSETX void mpsetx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata) { while (xsize > ysize) { xsize--; *(xdata++) = 0; } while (ysize > xsize) { ysize--; ydata++; } while (xsize--) *(xdata++) = *(ydata++); } #endif #ifndef ASM_MPADDW int mpaddw(size_t size, mpw* xdata, mpw y) { register mpw load, temp; register int carry = 0; xdata += size-1; load = *xdata; temp = load + y; *(xdata--) = temp; carry = (load > temp); while (--size && carry) { load = *xdata; temp = load + 1; *(xdata--) = temp; carry = (load > temp); } return carry; } #endif #ifndef ASM_MPADD int mpadd(size_t size, mpw* xdata, const mpw* ydata) { register mpw load, temp; register int carry = 0; xdata += size-1; ydata += size-1; while (size--) { temp = *(ydata--); load = *xdata; temp = carry ? (load + temp + 1) : (load + temp); *(xdata--) = temp; carry = carry ? (load >= temp) : (load > temp); } return carry; } #endif #ifndef ASM_MPADDX int mpaddx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata) { if (xsize > ysize) { register size_t diff = xsize - ysize; return mpaddw(diff, xdata, (mpw) mpadd(ysize, xdata+diff, ydata)); } else { register size_t diff = ysize - xsize; return mpadd(xsize, xdata, ydata+diff); } } #endif #ifndef ASM_MPSUBW int mpsubw(size_t size, mpw* xdata, mpw y) { register mpw load, temp; register int carry = 0; xdata += size-1; load = *xdata; temp = load - y; *(xdata--) = temp; carry = (load < temp); while (--size && carry) { load = *xdata; temp = load - 1; *(xdata--) = temp; carry = (load < temp); } return carry; } #endif #ifndef ASM_MPSUB int mpsub(size_t size, mpw* xdata, const mpw* ydata) { register mpw load, temp; register int carry = 0; xdata += size-1; ydata += size-1; while (size--) { temp = *(ydata--); load = *xdata; temp = carry ? (load - temp - 1) : (load - temp); *(xdata--) = temp; carry = carry ? (load <= temp) : (load < temp); } return carry; } #endif #ifndef ASM_MPSUBX int mpsubx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata) { if (xsize > ysize) { register size_t diff = xsize - ysize; return mpsubw(diff, xdata, (mpw) mpsub(ysize, xdata+diff, ydata)); } else { register size_t diff = ysize - xsize; return mpsub(xsize, xdata, ydata+diff); } } #endif #ifndef ASM_MPNEG void mpneg(size_t size, mpw* data) { mpnot(size, data); mpaddw(size, data, 1); } #endif #ifndef ASM_MPSETMUL mpw mpsetmul(size_t size, mpw* result, const mpw* data, mpw y) { #if HAVE_MPDW register mpdw temp; register mpw carry = 0; data += size; result += size; while (size--) { temp = *(--data); temp *= y; temp += carry; *(--result) = (mpw) temp; carry = (mpw)(temp >> MP_WBITS); } #else register mpw temp, load, carry = 0; register mphw ylo, yhi; ylo = (mphw) y; yhi = (mphw) (y >> MP_HWBITS); data += size; result += size; while (size--) { register mphw xlo, xhi; register mpw rlo, rhi; xlo = (mphw) (temp = *(--data)); xhi = (mphw) (temp >> MP_HWBITS); rlo = (mpw) xlo * ylo; rhi = (mpw) xhi * yhi; load = rlo; temp = (mpw) xhi * ylo; rlo += (temp << MP_HWBITS); rhi += (temp >> MP_HWBITS) + (load > rlo); load = rlo; temp = (mpw) xlo * yhi; rlo += (temp << MP_HWBITS); rhi += (temp >> MP_HWBITS) + (load > rlo); load = rlo; temp = rlo + carry; carry = rhi + (load > temp); *(--result) = temp; } #endif return carry; } #endif #ifndef ASM_MPADDMUL mpw mpaddmul(size_t size, mpw* result, const mpw* data, mpw y) { #if HAVE_MPDW register mpdw temp; register mpw carry = 0; data += size; result += size; while (size--) { temp = *(--data); temp *= y; temp += carry; temp += *(--result); *result = (mpw) temp; carry = (mpw)(temp >> MP_WBITS); } #else register mpw temp, load, carry = 0; register mphw ylo, yhi; ylo = (mphw) y; yhi = (mphw) (y >> MP_HWBITS); data += size; result += size; while (size--) { register mphw xlo, xhi; register mpw rlo, rhi; xlo = (mphw) (temp = *(--data)); xhi = (mphw) (temp >> MP_HWBITS); rlo = (mpw) xlo * ylo; rhi = (mpw) xhi * yhi; load = rlo; temp = (mpw) xhi * ylo; rlo += (temp << MP_HWBITS); rhi += (temp >> MP_HWBITS) + (load > rlo); load = rlo; temp = (mpw) xlo * yhi; rlo += (temp << MP_HWBITS); rhi += (temp >> MP_HWBITS) + (load > rlo); load = rlo; rlo += carry; temp = (load > rlo); load = rhi; rhi += temp; carry = (load > rhi); load = rlo; rlo += *(--result); *result = rlo; carry += rhi + (load > rlo); } #endif return carry; } #endif #ifndef ASM_MPMUL void mpmul(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata) { /* preferred passing of parameters is x the larger of the two numbers */ if (xsize >= ysize) { register mpw rc; result += ysize; ydata += ysize; rc = mpsetmul(xsize, result, xdata, *(--ydata)); *(--result) = rc; while (--ysize) { rc = mpaddmul(xsize, result, xdata, *(--ydata)); *(--result) = rc; } } else { register mpw rc; result += xsize; xdata += xsize; rc = mpsetmul(ysize, result, ydata, *(--xdata)); *(--result) = rc; while (--xsize) { rc = mpaddmul(ysize, result, ydata, *(--xdata)); *(--result) = rc; } } } #endif #ifndef ASM_MPADDSQRTRC void mpaddsqrtrc(size_t size, mpw* result, const mpw* data) { #if HAVE_MPDW register mpdw temp; register mpw load, carry = 0; result += (size << 1); while (size--) { temp = load = data[size]; temp *= load; temp += carry; temp += *(--result); *result = (mpw) temp; temp >>= MP_WBITS; temp += *(--result); *result = (mpw) temp; carry = (mpw)(temp >> MP_WBITS); } #else register mpw temp, load, carry = 0; result += (size << 1); while (size--) { register mphw xlo, xhi; register mpw rlo, rhi; xlo = (mphw) (temp = data[size]); xhi = (mphw) (temp >> MP_HWBITS); rlo = (mpw) xlo * xlo; rhi = (mpw) xhi * xhi; temp = (mpw) xhi * xlo; load = rlo; rlo += (temp << MP_HWBITS); rhi += (temp >> MP_HWBITS) + (load > rlo); load = rlo; rlo += (temp << MP_HWBITS); rhi += (temp >> MP_HWBITS) + (load > rlo); load = rlo; rlo += carry; rhi += (load > rlo); load = rlo; rlo += *(--result); *result = rlo; temp = (load > rlo); load = rhi; rhi += temp; carry = (load > rhi); load = rhi; rhi += *(--result); *result = rhi; carry += (load > rhi); } #endif } #endif #ifndef ASM_MPSQR void mpsqr(mpw* result, size_t size, const mpw* data) { register mpw rc; register size_t n = size-1; result += size; result[n] = 0; if (n) { rc = mpsetmul(n, result, data, data[n]); *(--result) = rc; while (--n) { rc = mpaddmul(n, result, data, data[n]); *(--result) = rc; } } *(--result) = 0; mpmultwo(size << 1, result); mpaddsqrtrc(size, result, data); } #endif #ifndef ASM_MPSIZE size_t mpsize(size_t size, const mpw* data) { while (size) { if (*data) return size; data++; size--; } return 0; } #endif #ifndef ASM_MPBITS size_t mpbits(size_t size, const mpw* data) { return MP_WORDS_TO_BITS(size) - mpmszcnt(size, data); } #endif #ifndef ASM_MPNORM size_t mpnorm(size_t size, mpw* data) { register size_t shift = mpmszcnt(size, data); mplshift(size, data, shift); return shift; } #endif #ifndef ASM_MPDIVTWO void mpdivtwo(size_t size, mpw* data) { register mpw temp, carry = 0; while (size--) { temp = *data; *(data++) = (temp >> 1) | carry; carry = (temp << (MP_WBITS-1)); } } #endif #ifndef ASM_MPSDIVTWO void mpsdivtwo(size_t size, mpw* data) { int carry = mpmsbset(size, data); mpdivtwo(size, data); if (carry) mpsetmsb(size, data); } #endif #ifndef ASM_MPMULTWO int mpmultwo(size_t size, mpw* data) { register mpw temp, carry = 0; data += size; while (size--) { temp = *(--data); *data = (temp << 1) | carry; carry = (temp >> (MP_WBITS-1)); } return (int) carry; } #endif #ifndef ASM_MPMSZCNT size_t mpmszcnt(size_t size, const mpw* data) { register size_t zbits = 0; register size_t i = 0; while (i < size) { register mpw temp = data[i++]; if (temp) { while (!(temp & MP_MSBMASK)) { zbits++; temp <<= 1; } break; } else zbits += MP_WBITS; } return zbits; } #endif #ifndef ASM_MPLSZCNT size_t mplszcnt(size_t size, const mpw* data) { register size_t zbits = 0; while (size--) { register mpw temp = data[size]; if (temp) { while (!(temp & MP_LSBMASK)) { zbits++; temp >>= 1; } break; } else zbits += MP_WBITS; } return zbits; } #endif #ifndef ASM_MPLSHIFT void mplshift(size_t size, mpw* data, size_t count) { register size_t words = MP_BITS_TO_WORDS(count); if (words < size) { register short lbits = (short) (count & (MP_WBITS-1)); /* first do the shifting, then do the moving */ if (lbits) { register mpw temp, carry = 0; register short rbits = MP_WBITS - lbits; register size_t i = size; while (i > words) { temp = data[--i]; data[i] = (temp << lbits) | carry; carry = (temp >> rbits); } } if (words) { mpmove(size-words, data, data+words); mpzero(words, data+size-words); } } else mpzero(size, data); } #endif #ifndef ASM_MPRSHIFT void mprshift(size_t size, mpw* data, size_t count) { register size_t words = MP_BITS_TO_WORDS(count); if (words < size) { register short rbits = (short) (count & (MP_WBITS-1)); /* first do the shifting, then do the moving */ if (rbits) { register mpw temp, carry = 0; register short lbits = MP_WBITS - rbits; register size_t i = 0; while (i < size-words) { temp = data[i]; data[i++] = (temp >> rbits) | carry; carry = (temp << lbits); } } if (words) { mpmove(size-words, data+words, data); mpzero(words, data); } } else mpzero(size, data); } #endif #ifndef ASM_MPRSHIFTLSZ size_t mprshiftlsz(size_t size, mpw* data) { register mpw* slide = data+size-1; register size_t zwords = 0; /* counter for 'all zero bit' words */ register short lbits, rbits = 0; /* counter for 'least significant zero' bits */ register mpw temp, carry = 0; data = slide; /* count 'all zero' words and move src pointer */ while (size--) { /* test if we have a non-zero word */ if ((carry = *(slide--))) { /* count 'least signification zero bits and set zbits counter */ while (!(carry & MP_LSBMASK)) { carry >>= 1; rbits++; } break; } zwords++; } if ((rbits == 0) && (zwords == 0)) return 0; /* prepare right-shifting of data */ lbits = MP_WBITS - rbits; /* shift data */ while (size--) { temp = *(slide--); *(data--) = (temp << lbits) | carry; carry = (temp >> rbits); } /* store the final carry */ *(data--) = carry; /* store the return value in size */ size = MP_WORDS_TO_BITS(zwords) + rbits; /* zero the (zwords) most significant words */ while (zwords--) *(data--) = 0; return size; } #endif /* try an alternate version here, with descending sizes */ /* also integrate lszcnt and rshift properly into one function */ #ifndef ASM_MPGCD_W /* * mpgcd_w * need workspace of (size) words */ void mpgcd_w(size_t size, const mpw* xdata, const mpw* ydata, mpw* result, mpw* wksp) { register size_t shift, temp; if (mpge(size, xdata, ydata)) { mpcopy(size, wksp, xdata); mpcopy(size, result, ydata); } else { mpcopy(size, wksp, ydata); mpcopy(size, result, xdata); } /* get the smallest returned values, and set shift to that */ shift = mprshiftlsz(size, wksp); temp = mprshiftlsz(size, result); if (shift > temp) shift = temp; while (mpnz(size, wksp)) { mprshiftlsz(size, wksp); mprshiftlsz(size, result); if (mpge(size, wksp, result)) mpsub(size, wksp, result); else mpsub(size, result, wksp); /* slide past zero words in both operands by increasing pointers and decreasing size */ if ((*wksp == 0) && (*result == 0)) { size--; wksp++; result++; } } /* figure out if we need to slide the result pointer back */ if ((temp = MP_BITS_TO_WORDS(shift))) { size += temp; result -= temp; } mplshift(size, result, shift); } #endif #ifndef ASM_MPEXTGCD_W /* needs workspace of (6*size+6) words */ /* used to compute the modular inverse */ int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ydata, mpw* result, mpw* wksp) { /* * For computing a modular inverse, pass the modulus as xdata and the number * to be inverted as ydata. * * Fact: if a element of Zn, then a is invertible if and only if gcd(a,n) = 1 * Hence: if n is even, then a must be odd, otherwise the gcd(a,n) >= 2 * * The calling routine must guarantee this condition. */ register size_t sizep = size+1; register int full; mpw* udata = wksp; mpw* vdata = udata+sizep; mpw* adata = vdata+sizep; mpw* bdata = adata+sizep; mpw* cdata = bdata+sizep; mpw* ddata = cdata+sizep; mpsetx(sizep, udata, size, xdata); mpsetx(sizep, vdata, size, ydata); mpzero(sizep, bdata); mpsetw(sizep, ddata, 1); if ((full = mpeven(sizep, udata))) { mpsetw(sizep, adata, 1); mpzero(sizep, cdata); } while (1) { while (mpeven(sizep, udata)) { mpdivtwo(sizep, udata); if (mpodd(sizep, bdata) || (full && mpodd(sizep, adata))) { if (full) mpaddx(sizep, adata, size, ydata); mpsubx(sizep, bdata, size, xdata); } if (full) mpsdivtwo(sizep, adata); mpsdivtwo(sizep, bdata); } while (mpeven(sizep, vdata)) { mpdivtwo(sizep, vdata); if (mpodd(sizep, ddata) || (full && mpodd(sizep, cdata))) { if (full) mpaddx(sizep, cdata, size, ydata); mpsubx(sizep, ddata, size, xdata); } if (full) mpsdivtwo(sizep, cdata); mpsdivtwo(sizep, ddata); } if (mpge(sizep, udata, vdata)) { mpsub(sizep, udata, vdata); if (full) mpsub(sizep, adata, cdata); mpsub(sizep, bdata, ddata); } else { mpsub(sizep, vdata, udata); if (full) mpsub(sizep, cdata, adata); mpsub(sizep, ddata, bdata); } if (mpz(sizep, udata)) { if (mpisone(sizep, vdata)) { if (result) { if (*ddata & MP_MSBMASK) { /* keep adding the modulus until we get a carry */ while (!mpaddx(sizep, ddata, size, xdata)); } else { /* in some computations, d ends up > x, hence: * keep subtracting n from d until d < x */ while (mpgtx(sizep, ddata, size, xdata)) mpsubx(sizep, ddata, size, xdata); } mpsetx(size, result, sizep, ddata); } return 1; } return 0; } } } #endif #ifndef ASM_MPPNDIV mpw mppndiv(mpw xhi, mpw xlo, mpw y) { register mpw result = 0; register short count = MP_WBITS; register int carry = 0; while (count--) { if (carry | (xhi >= y)) { xhi -= y; result++; } carry = (xhi >> (MP_WBITS-1)); xhi <<= 1; xhi |= (xlo >> (MP_WBITS-1)); xlo <<= 1; result <<= 1; } if (carry | (xhi >= y)) { xhi -= y; result++; } return result; } #endif #ifndef ASM_MPMOD void mpmod(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, mpw* workspace) { /* result size ysize, workspace size 2*ysize+1 */ mpw q, msw; mpw* rdata = result; mpw* ynorm = workspace+ysize+1; size_t shift, qsize = xsize-ysize; mpcopy(ysize, ynorm, ydata); shift = mpnorm(ysize, ynorm); msw = *ynorm; mpcopy(xsize, rdata, xdata); if (mpge(ysize, rdata, ynorm)) mpsub(ysize, rdata, ynorm); while (qsize--) { q = mppndiv(rdata[0], rdata[1], msw); *workspace = mpsetmul(ysize, workspace+1, ynorm, q); while (mplt(ysize+1, rdata, workspace)) { mpsubx(ysize+1, workspace, ysize, ynorm); q--; } mpsub(ysize+1, rdata, workspace); rdata++; } /* de-normalization steps */ while (shift--) { mpdivtwo(ysize, ynorm); if (mpge(ysize, rdata, ynorm)) mpsub(ysize, rdata, ynorm); } } #endif #ifndef ASM_MPNDIVMOD void mpndivmod(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, register mpw* workspace) { /* result must be xsize+1 in length */ /* workspace must be ysize+1 in length */ /* expect ydata to be normalized */ mpw q; mpw msw = *ydata; size_t qsize = xsize-ysize; *result = (mpge(ysize, xdata, ydata) ? 1 : 0); mpcopy(xsize, result+1, xdata); if (*result) (void) mpsub(ysize, result+1, ydata); result++; while (qsize--) { q = mppndiv(result[0], result[1], msw); *workspace = mpsetmul(ysize, workspace+1, ydata, q); while (mplt(ysize+1, result, workspace)) { mpsubx(ysize+1, workspace, ysize, ydata); q--; } mpsub(ysize+1, result, workspace); *(result++) = q; } } #endif void mpprint(size_t size, const mpw* data) { mpfprint(stdout, size, data); } void mpprintln(size_t size, const mpw* data) { mpfprintln(stdout, size, data); } void mpfprint(FILE* f, size_t size, const mpw* data) { if (data == (mpw*) 0) return; if (f == (FILE*) 0) return; while (size--) { #if (MP_WBITS == 32) fprintf(f, "%08x", (unsigned) *(data++)); #elif (MP_WBITS == 64) # if WIN32 fprintf(f, "%016I64x", *(data++)); # elif SIZEOF_UNSIGNED_LONG == 8 fprintf(f, "%016lx", *(data++)); # else fprintf(f, "%016llx", *(data++)); # endif #else # error #endif } fflush(f); } void mpfprintln(FILE* f, size_t size, const mpw* data) { if (data == (mpw*) 0) return; if (f == (FILE*) 0) return; while (size--) { #if (MP_WBITS == 32) fprintf(f, "%08x", *(data++)); #elif (MP_WBITS == 64) # if WIN32 fprintf(f, "%016I64x", *(data++)); # elif SIZEOF_UNSIGNED_LONG == 8 fprintf(f, "%016lx", *(data++)); # else fprintf(f, "%016llx", *(data++)); # endif #else # error #endif } fprintf(f, "\n"); fflush(f); } int i2osp(byte *osdata, size_t ossize, const mpw* idata, size_t isize) { #if WORDS_BIGENDIAN size_t max_bytes = MP_WORDS_TO_BYTES(isize); #endif size_t significant_bytes = (mpbits(isize, idata) + 7) >> 3; /* verify that ossize is large enough to contain the significant bytes */ if (ossize >= significant_bytes) { /* looking good; check if we have more space than significant bytes */ if (ossize > significant_bytes) { /* fill most significant bytes with zero */ memset(osdata, 0, ossize - significant_bytes); osdata += ossize - significant_bytes; } if (significant_bytes) { /* fill remaining bytes with endian-adjusted data */ #if !WORDS_BIGENDIAN mpw w = idata[--isize]; byte shift = 0; /* fill right-to-left; much easier than left-to-right */ do { osdata[--significant_bytes] = (byte)(w >> shift); shift += 8; if ((shift == MP_WBITS) && isize) { shift = 0; w = idata[--isize]; } } while (significant_bytes); #else /* just copy data past zero bytes */ memcpy(osdata, ((byte*) idata) + (max_bytes - significant_bytes), significant_bytes); #endif } return 0; } return -1; } int os2ip(mpw* idata, size_t isize, const byte* osdata, size_t ossize) { size_t required; /* skip non-significant leading zero bytes */ while (!(*osdata) && ossize) { osdata++; ossize--; } required = MP_BYTES_TO_WORDS(ossize + MP_WBYTES - 1); if (isize >= required) { /* yes, we have enough space and can proceed */ mpw w = 0; /* adjust counter so that the loop will start by skipping the proper * amount of leading bytes in the first significant word */ byte b = (byte) (ossize % MP_WBYTES); if (isize > required) { /* fill initials words with zero */ mpzero(isize-required, idata); idata += isize-required; } if (b == 0) b = MP_WBYTES; while (ossize--) { w <<= 8; w |= *(osdata++); b--; if (b == 0) { *(idata++) = w; w = 0; b = MP_WBYTES; } } return 0; } return -1; } int hs2ip(mpw* idata, size_t isize, const char* hsdata, size_t hssize) { size_t required = MP_NIBBLES_TO_WORDS(hssize + MP_WNIBBLES - 1); if (isize >= required) { register size_t i; if (isize > required) { /* fill initial words with zero */ for (i = required; i < isize; i++) *(idata++) = 0; } while (hssize) { register mpw w = 0; register size_t chunk = hssize & (MP_WNIBBLES - 1); register char ch; if (chunk == 0) chunk = MP_WNIBBLES; for (i = 0; i < chunk; i++) { ch = *(hsdata++); w <<= 4; if (ch >= '0' && ch <= '9') w += (ch - '0'); else if (ch >= 'A' && ch <= 'F') w += (ch - 'A') + 10; else if (ch >= 'a' && ch <= 'f') w += (ch - 'a') + 10; } *(idata++) = w; hssize -= chunk; } return 0; } return -1; } beecrypt-4.2.1/entropy.c0000644000175000001440000007070211216147021012115 00000000000000/* * Copyright (c) 1998, 1999, 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file entropy.c * \author Bob Deblier * \ingroup ES_m ES_audio_m ES_dsp_m ES_random_m ES_urandom_m ES_tty_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/entropy.h" #include "beecrypt/endianness.h" #if WIN32 # include # include # include #else # if HAVE_SYS_IOCTL_H # include # endif # if HAVE_SYS_STAT_H # include # include # endif # if TIME_WITH_SYS_TIME # include # include # else # if HAVE_SYS_TIME_H # include # elif HAVE_TIME_H # include # endif # endif # if HAVE_SYS_AUDIOIO_H # include # endif # if HAVE_SYS_SOUNDCARD_H # include # endif # if HAVE_TERMIOS_H # include # elif HAVE_TERMIO_H # include # endif # ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H # include # elif HAVE_PTHREAD_H # include # endif # endif # if HAVE_AIO_H # include # endif #endif #if HAVE_FCNTL_H # include #endif #if HAVE_ERRNO_H # include #endif #if WIN32 static HINSTANCE entropy_instance = (HINSTANCE) 0; static HANDLE entropy_wavein_lock; static HANDLE entropy_wavein_event; int entropy_provider_setup(HINSTANCE hInst) { if (!entropy_instance) { entropy_instance = hInst; if (!(entropy_wavein_lock = CreateMutex(NULL, FALSE, NULL))) return -1; if (!(entropy_wavein_event = CreateEvent(NULL, FALSE, FALSE, NULL))) return -1; } return 0; } int entropy_provider_cleanup() { if (entropy_wavein_lock) { CloseHandle(entropy_wavein_lock); entropy_wavein_lock = 0; } if (entropy_wavein_event) { CloseHandle(entropy_wavein_event); entropy_wavein_event = 0; } return 0; } #endif #if WIN32 || HAVE_DEV_AUDIO || HAVE_DEV_DSP /* * Mask the low-order bit of a bunch of sound samples, analyze them and * return an error in case they are all zeroes or ones. */ static int entropy_noise_filter(void* sampledata, int samplecount, int samplesize, int channels, int swap) { register int rc = 0, i; switch (samplesize) { case 1: { uint8_t* samples = (uint8_t*) sampledata; switch (channels) { case 1: { int zero_count = 0; int ones_count = 0; for (i = 0; i < samplecount; i++) { if (samples[i] &= 0x1) ones_count++; else zero_count++; } if ((zero_count == 0) || (ones_count == 0)) { #if HAVE_ERRNO_H errno = EIO; #endif rc = -1; } } break; case 2: { int zero_count_left = 0; int ones_count_left = 0; int zero_count_right = 0; int ones_count_right = 0; for (i = 0; i < samplecount; i++) { if (i & 1) { if (samples[i] &= 0x1) ones_count_left++; else zero_count_left++; } else { if (samples[i] &= 0x1) ones_count_right++; else zero_count_right++; } } if ((zero_count_left == 0) || (ones_count_left == 0) || (zero_count_right == 0) || (ones_count_right == 0)) { #if HAVE_ERRNO_H errno = EIO; #endif rc = -1; } } break; default: #if HAVE_ERRNO_H errno = EINVAL; #endif rc = -1; } } break; case 2: { uint16_t* samples = (uint16_t*) sampledata; switch (channels) { case 1: { int zero_count = 0; int ones_count = 0; for (i = 0; i < samplecount; i++) { if (swap) samples[i] = swapu16(samples[i]); if (samples[i] &= 0x1) ones_count++; else zero_count++; } if ((zero_count == 0) || (ones_count == 0)) { #if HAVE_ERRNO_H errno = EIO; #endif rc = -1; } } break; case 2: { int zero_count_left = 0; int ones_count_left = 0; int zero_count_right = 0; int ones_count_right = 0; for (i = 0; i < samplecount; i++) { if (swap) samples[i] = swapu16(samples[i]); if (i & 1) { if (samples[i] &= 0x1) ones_count_left++; else zero_count_left++; } else { if (samples[i] &= 0x1) ones_count_right++; else zero_count_right++; } } if ((zero_count_left == 0) || (ones_count_left == 0) || (zero_count_right == 0) || (ones_count_right == 0)) { #if HAVE_ERRNO_H errno = EIO; #endif rc = -1; } } break; default: #if HAVE_ERRNO_H errno = EINVAL; #endif rc = -1; } } break; default: #if HAVE_ERRNO_H errno = EINVAL; #endif rc = -1; } return 0; } /* bit deskewing technique: the classical Von Neumann method - only use the lsb bit of every sample - there is a chance of bias in 0 or 1 bits, so to deskew this: - look at two successive sampled bits - if they are the same, discard them - if they are different, they're either 0-1 or 1-0; use the first bit of the pair as output */ #if WIN32 static int entropy_noise_gather(HWAVEIN wavein, int samplesize, int channels, int swap, int timeout, byte* data, size_t size) #else static int entropy_noise_gather(int fd, int samplesize, int channels, int swap, int timeout, byte* data, size_t size) #endif { size_t randombits = size << 3; byte temp = 0; int rc, i; byte* sampledata = (byte*) malloc(1024 * samplesize * channels); #if WIN32 WAVEHDR header; /* first set up a wave header */ header.lpData = (LPSTR) sampledata; header.dwBufferLength = 1024 * samplesize * channels; header.dwFlags = 0; /* do error handling! */ waveInStart(wavein); /* the first event is the due to the opening of the wave */ ResetEvent(entropy_wavein_event); #else # if ENABLE_AIO struct aiocb my_aiocb; const struct aiocb* my_aiocb_list = &my_aiocb; # if HAVE_TIME_H struct timespec my_aiocb_timeout; # else # error # endif memset(&my_aiocb, 0, sizeof(struct aiocb)); my_aiocb.aio_fildes = fd; my_aiocb.aio_sigevent.sigev_notify = SIGEV_NONE; # endif #endif if (sampledata == (byte*) 0) { #if HAVE_ERRNO_H errno = ENOMEM; #endif return -1; } while (randombits) { #if WIN32 /* pass the buffer to the wavein and wait for the event */ waveInPrepareHeader(wavein, &header, sizeof(WAVEHDR)); waveInAddBuffer(wavein, &header, sizeof(WAVEHDR)); /* in case we have to wait more than the specified timeout, bail out */ if (WaitForSingleObject(entropy_wavein_event, timeout) == WAIT_OBJECT_0) { rc = header.dwBytesRecorded; } else { waveInStop(wavein); waveInReset(wavein); free(sampledata); return -1; } #else # if ENABLE_AIO my_aiocb.aio_buf = sampledata; my_aiocb.aio_nbytes = 1024 * samplesize * channels; rc = aio_read(&my_aiocb); # else rc = read(fd, sampledata, 1024 * samplesize * channels); # endif if (rc < 0) { free(sampledata); return -1; } # if ENABLE_AIO my_aiocb_timeout.tv_sec = (timeout / 1000); my_aiocb_timeout.tv_nsec = (timeout % 1000) * 1000000; rc = aio_suspend(&my_aiocb_list, 1, &my_aiocb_timeout); if (rc < 0) { #if HAVE_ERRNO_H if (errno == EAGAIN) { /* certain linux glibc versions are buggy and don't aio_suspend properly */ nanosleep(&my_aiocb_timeout, (struct timespec*) 0); my_aiocb_timeout.tv_sec = (timeout / 1000); my_aiocb_timeout.tv_nsec = (timeout % 1000) * 1000000; /* and try again */ rc = aio_suspend(&my_aiocb_list, 1, &my_aiocb_timeout); } #endif } if (rc < 0) { /* cancel any remaining reads */ while (rc != AIO_ALLDONE) { rc = aio_cancel(fd, (struct aiocb*) 0); if (rc == AIO_NOTCANCELED) { my_aiocb_timeout.tv_sec = (timeout / 1000); my_aiocb_timeout.tv_nsec = (timeout % 1000) * 1000000; nanosleep(&my_aiocb_timeout, (struct timespec*) 0); } if (rc < 0) break; } free(sampledata); return -1; } rc = aio_error(&my_aiocb); if (rc) { free(sampledata); return -1; } rc = aio_return(&my_aiocb); if (rc < 0) { free(sampledata); return -1; } # endif #endif if (entropy_noise_filter(sampledata, rc / samplesize, samplesize, channels, swap) < 0) { fprintf(stderr, "noise filter indicates too much bias in audio samples\n"); free(sampledata); return -1; } switch (samplesize) { case 1: { uint8_t* samples = (uint8_t*) sampledata; for (i = 0; randombits && (i < 1024); i += 2) { if (samples[i] ^ samples[i+1]) { temp <<= 1; temp |= samples[i]; randombits--; if (!(randombits & 0x7)) *(data++) = temp; } } } break; case 2: { uint16_t* samples = (uint16_t*) sampledata; for (i = 0; randombits && (i < 1024); i += 2) { if (samples[i] ^ samples[i+1]) { temp <<= 1; temp |= samples[i]; randombits--; if (!(randombits & 0x7)) *(data++) = temp; } } } break; default: free(sampledata); return -1; } } #if WIN32 waveInStop(wavein); waveInReset(wavein); #endif free(sampledata); return 0; } #endif #if WIN32 int entropy_wavein(byte* data, size_t size) { const char *timeout_env = getenv("BEECRYPT_ENTROPY_WAVEIN_TIMEOUT"); WAVEINCAPS waveincaps; WAVEFORMATEX waveformatex; HWAVEIN wavein; MMRESULT rc; rc = waveInGetDevCaps(WAVE_MAPPER, &waveincaps, sizeof(WAVEINCAPS)); if (rc != MMSYSERR_NOERROR) return -1; /* first go for the 16 bits samples -> more chance of noise bits */ switch (waveformatex.nChannels = waveincaps.wChannels) { case 1: /* mono */ if (waveincaps.dwFormats & WAVE_FORMAT_4M16) { waveformatex.nSamplesPerSec = 44100; waveformatex.wBitsPerSample = 16; } else if (waveincaps.dwFormats & WAVE_FORMAT_2M16) { waveformatex.nSamplesPerSec = 22050; waveformatex.wBitsPerSample = 16; } else if (waveincaps.dwFormats & WAVE_FORMAT_1M16) { waveformatex.nSamplesPerSec = 11025; waveformatex.wBitsPerSample = 16; } else if (waveincaps.dwFormats & WAVE_FORMAT_4M08) { waveformatex.nSamplesPerSec = 44100; waveformatex.wBitsPerSample = 8; } else if (waveincaps.dwFormats & WAVE_FORMAT_2M08) { waveformatex.nSamplesPerSec = 22050; waveformatex.wBitsPerSample = 8; } else if (waveincaps.dwFormats & WAVE_FORMAT_1M08) { waveformatex.nSamplesPerSec = 11025; waveformatex.wBitsPerSample = 8; } else return -1; break; case 2: /* stereo */ if (waveincaps.dwFormats & WAVE_FORMAT_4S16) { waveformatex.nSamplesPerSec = 44100; waveformatex.wBitsPerSample = 16; } else if (waveincaps.dwFormats & WAVE_FORMAT_2S16) { waveformatex.nSamplesPerSec = 22050; waveformatex.wBitsPerSample = 16; } else if (waveincaps.dwFormats & WAVE_FORMAT_1S16) { waveformatex.nSamplesPerSec = 11025; waveformatex.wBitsPerSample = 16; } else if (waveincaps.dwFormats & WAVE_FORMAT_4S08) { waveformatex.nSamplesPerSec = 44100; waveformatex.wBitsPerSample = 8; } else if (waveincaps.dwFormats & WAVE_FORMAT_2S08) { waveformatex.nSamplesPerSec = 22050; waveformatex.wBitsPerSample = 8; } else if (waveincaps.dwFormats & WAVE_FORMAT_1S08) { waveformatex.nSamplesPerSec = 11025; waveformatex.wBitsPerSample = 8; } else return -1; break; } waveformatex.wFormatTag = WAVE_FORMAT_PCM; waveformatex.nAvgBytesPerSec = (waveformatex.nSamplesPerSec * waveformatex.nChannels * waveformatex.wBitsPerSample) / 8; waveformatex.nBlockAlign = (waveformatex.nChannels * waveformatex.wBitsPerSample) / 8; waveformatex.cbSize = 0; /* we now have the wavein's capabilities hammered out; from here on we need to lock */ if (WaitForSingleObject(entropy_wavein_lock, INFINITE) != WAIT_OBJECT_0) return -1; rc = waveInOpen(&wavein, WAVE_MAPPER, &waveformatex, (DWORD_PTR) entropy_wavein_event, (DWORD) 0, CALLBACK_EVENT); if (rc != MMSYSERR_NOERROR) { fprintf(stderr, "waveInOpen failed!\n"); fflush(stderr); ReleaseMutex(entropy_wavein_lock); return -1; } rc = entropy_noise_gather(wavein, waveformatex.wBitsPerSample >> 3, waveformatex.nChannels, 0, timeout_env ? atoi(timeout_env) : 2000, data, size); waveInClose(wavein); ReleaseMutex(entropy_wavein_lock); return rc; } int entropy_console(byte* data, size_t size) { register size_t randombits = size << 3; HANDLE hStdin; DWORD inRet; INPUT_RECORD inEvent; LARGE_INTEGER hrtsample; hStdin = GetStdHandle(STD_INPUT_HANDLE); if (hStdin == INVALID_HANDLE_VALUE) { fprintf(stderr, "GetStdHandle error %d\n", GetLastError()); return -1; } printf("please press random keys on your keyboard\n"); fflush(stdout); while (randombits) { if (!ReadConsoleInput(hStdin, &inEvent, 1, &inRet)) { fprintf(stderr, "ReadConsoleInput failed\n"); fflush(stderr); return -1; } if ((inRet == 1) && (inEvent.EventType == KEY_EVENT) && inEvent.Event.KeyEvent.bKeyDown) { printf("."); fflush(stdout); if (!QueryPerformanceCounter(&hrtsample)) { fprintf(stderr, "QueryPerformanceCounter failed\n"); fflush(stderr); return -1; } /* get 8 bits from the sample */ /* discard the 2 lowest bits */ *(data++) = (byte)(hrtsample.LowPart >> 2); randombits -= 8; } } printf("\nthanks\n"); Sleep(1000); if (!FlushConsoleInputBuffer(hStdin)) { fprintf(stderr, "FlushConsoleInputBuffer failed\n"); fflush(stderr); return -1; } return 0; } int entropy_wincrypt(byte* data, size_t size) { HCRYPTPROV hCrypt; DWORD provType = PROV_RSA_FULL; BOOL rc; /* consider using getenv("BEECRYPT_ENTROPY_WINCRYPT_PROVTYPE") to set provType */ if (!CryptAcquireContext(&hCrypt, "BeeCrypt", NULL, provType, 0)) { #if defined(NTE_BAD_KEYSET) if (GetLastError() == NTE_BAD_KEYSET) { if (!CryptAcquireContext(&hCrypt, "BeeCrypt", NULL, provType, CRYPT_NEWKEYSET)) return -1; } else return -1; #else return -1; #endif } rc = CryptGenRandom(hCrypt, size, (BYTE*) data); CryptReleaseContext(hCrypt, 0); return rc ? 0 : -1; } #else #if HAVE_DEV_AUDIO /*!\addtogroup ES_audio_m * \{ */ static const char* name_dev_audio = "/dev/audio"; static int dev_audio_fd = -1; # ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H static mutex_t dev_audio_lock = DEFAULTMUTEX; # elif HAVE_PTHREAD_H static pthread_mutex_t dev_audio_lock = PTHREAD_MUTEX_INITIALIZER; # else # error Need locking mechanism # endif # endif /*!\} */ #endif #if HAVE_DEV_DSP /*!\addtogroup ES_dsp_m * \{ */ static const char* name_dev_dsp = "/dev/dsp"; static int dev_dsp_fd = -1; # ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H static mutex_t dev_dsp_lock = DEFAULTMUTEX; # elif HAVE_PTHREAD_H static pthread_mutex_t dev_dsp_lock = PTHREAD_MUTEX_INITIALIZER; # else # error Need locking mechanism # endif # endif /*!\} */ #endif #if HAVE_DEV_RANDOM /*!\addtogroup ES_random_m * \{ */ static const char* name_dev_random = "/dev/random"; static int dev_random_fd = -1; # ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H static mutex_t dev_random_lock = DEFAULTMUTEX; # elif HAVE_PTHREAD_H static pthread_mutex_t dev_random_lock = PTHREAD_MUTEX_INITIALIZER; # else # error Need locking mechanism # endif # endif /*!\} */ #endif #if HAVE_DEV_URANDOM /*!\addtogroup ES_urandom_m * \{ */ static const char* name_dev_urandom = "/dev/urandom"; static int dev_urandom_fd = -1; # ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H static mutex_t dev_urandom_lock = DEFAULTMUTEX; # elif HAVE_PTHREAD_H static pthread_mutex_t dev_urandom_lock = PTHREAD_MUTEX_INITIALIZER; # else # error Need locking mechanism # endif # endif /*!\} */ #endif #if HAVE_DEV_TTY /*!\addtogroup ES_tty_m * \{ */ static const char *dev_tty_name = "/dev/tty"; static int dev_tty_fd = -1; # ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H static mutex_t dev_tty_lock = DEFAULTMUTEX; # elif HAVE_PTHREAD_H static pthread_mutex_t dev_tty_lock = PTHREAD_MUTEX_INITIALIZER; # else # error Need locking mechanism # endif # endif /*!\} */ #endif #if HAVE_SYS_STAT_H static int statdevice(const char *device) { struct stat s; if (stat(device, &s) < 0) { #if HAVE_ERRNO_H && HAVE_STRING_H fprintf(stderr, "cannot stat %s: %s\n", device, strerror(errno)); #endif return -1; } if (!S_ISCHR(s.st_mode)) { fprintf(stderr, "%s is not a device\n", device); return -1; } return 0; } #endif static int opendevice(const char *device) { register int fd; if ((fd = open(device, O_RDONLY)) < 0) { #if HAVE_ERRNO_H && HAVE_STRING_H fprintf(stderr, "open of %s failed: %s\n", device, strerror(errno)); #endif return fd; } return fd; } #if HAVE_DEV_RANDOM || HAVE_DEV_URANDOM /* timeout is in milliseconds */ /*!\ingroup ES_random_m ES_urandom_m */ static int entropy_randombits(int fd, int timeout, byte* data, size_t size) { register int rc; #if ENABLE_AIO struct aiocb my_aiocb; const struct aiocb* my_aiocb_list = &my_aiocb; # if HAVE_TIME_H struct timespec my_aiocb_timeout; # else # error # endif memset(&my_aiocb, 0, sizeof(struct aiocb)); my_aiocb.aio_fildes = fd; my_aiocb.aio_sigevent.sigev_notify = SIGEV_NONE; #endif while (size) { #if ENABLE_AIO my_aiocb.aio_buf = data; my_aiocb.aio_nbytes = size; rc = aio_read(&my_aiocb); #else rc = read(fd, data, size); #endif if (rc < 0) return -1; #if ENABLE_AIO my_aiocb_timeout.tv_sec = (timeout / 1000); my_aiocb_timeout.tv_nsec = (timeout % 1000) * 1000000; rc = aio_suspend(&my_aiocb_list, 1, &my_aiocb_timeout); if (rc < 0) { #if HAVE_ERRNO_H if (errno == EAGAIN) { /* certain linux glibc versions are buggy and don't aio_suspend properly */ nanosleep(&my_aiocb_timeout, (struct timespec*) 0); my_aiocb_timeout.tv_sec = 0; my_aiocb_timeout.tv_nsec = 0; /* and try again */ rc = aio_suspend(&my_aiocb_list, 1, &my_aiocb_timeout); } #endif } if (rc < 0) { /* cancel any remaining reads */ while (rc != AIO_ALLDONE) { rc = aio_cancel(fd, (struct aiocb*) 0); if (rc == AIO_NOTCANCELED) { my_aiocb_timeout.tv_sec = (timeout / 1000); my_aiocb_timeout.tv_nsec = (timeout % 1000) * 1000000; nanosleep(&my_aiocb_timeout, (struct timespec*) 0); } if (rc < 0) break; } return -1; } rc = aio_error(&my_aiocb); if (rc < 0) return -1; rc = aio_return(&my_aiocb); if (rc < 0) return -1; #endif data += rc; size -= rc; } return 0; } #endif #if HAVE_DEV_TTY /*!\ingroup ES_tty_m */ static int entropy_ttybits(int fd, byte* data, size_t size) { byte dummy; #if HAVE_TERMIOS_H struct termios tio_save, tio_set; #elif HAVE_TERMIO_H struct termio tio_save, tio_set; #else # error need alternative #endif #if HAVE_GETHRTIME hrtime_t hrtsample; #elif HAVE_GETTIMEOFDAY struct timeval tvsample; #else # error need alternative high-precision timer #endif printf("please press random keys on your keyboard\n"); #if HAVE_TERMIOS_H if (tcgetattr(fd, &tio_save) < 0) { #if HAVE_ERRNO_H perror("tcgetattr failed"); #endif return -1; } tio_set = tio_save; tio_set.c_cc[VMIN] = 1; /* read 1 tty character at a time */ tio_set.c_cc[VTIME] = 0; /* don't timeout the read */ tio_set.c_iflag |= IGNBRK; /* ignore -c */ tio_set.c_lflag &= ~(ECHO|ICANON); /* don't echo characters */ /* change the tty settings, and flush input characters */ if (tcsetattr(fd, TCSAFLUSH, &tio_set) < 0) { #if HAVE_ERRNO_H perror("tcsetattr failed"); #endif return -1; } #elif HAVE_TERMIO_H if (ioctl(fd, TCGETA, &tio_save) < 0) { #if HAVE_ERRNO_H perror("ioctl TCGETA failed"); #endif return -1; } tio_set = tio_save; tio_set.c_cc[VMIN] = 1; /* read 1 tty character at a time */ tio_set.c_cc[VTIME] = 0; /* don't timeout the read */ tio_set.c_iflag |= IGNBRK; /* ignore -c */ tio_set.c_lflag &= ~(ECHO|ICANON); /* don't echo characters */ /* change the tty settings, and flush input characters */ if (ioctl(fd, TCSETAF, &tio_set) < 0) { #if HAVE_ERRNO_H perror("ioctl TCSETAF failed"); #endif return -1; } #else # error Need alternative tty control library #endif while (size) { if (read(fd, &dummy, 1) < 0) { #if HAVE_ERRNO_H perror("tty read failed"); #endif return -1; } printf("."); fflush(stdout); #if HAVE_GETHRTIME hrtsample = gethrtime(); /* discard the 10 lowest bits i.e. 1024 nanoseconds of a sample */ *(data++) = (byte)(hrtsample >> 10); size--; #elif HAVE_GETTIMEOFDAY /* discard the 4 lowest bits i.e. 4 microseconds */ gettimeofday(&tvsample, 0); /* get 8 bits from the sample */ *(data) = (byte)(tvsample.tv_usec >> 2); size--; #else # error Need alternative high-precision timer sample #endif } printf("\nthanks\n"); /* give the user 1 second to stop typing */ sleep(1); #if HAVE_TERMIOS_H /* change the tty settings, and flush input characters */ if (tcsetattr(fd, TCSAFLUSH, &tio_save) < 0) { #if HAVE_ERRNO_H perror("tcsetattr failed"); #endif return -1; } #elif HAVE_TERMIO_H /* restore the tty settings, and flush input characters */ if (ioctl(fd, TCSETAF, &tio_save) < 0) { #if HAVE_ERRNO_H perror("ioctl TCSETAF failed"); #endif return -1; } #else # error Need alternative tty control library #endif return 0; } #endif #if HAVE_DEV_AUDIO /*!\ingroup ES_audio_m */ int entropy_dev_audio(byte* data, size_t size) { const char* timeout_env = getenv("BEECRYPT_ENTROPY_AUDIO_TIMEOUT"); register int rc; #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_lock(&dev_audio_lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_lock(&dev_audio_lock)) return -1; # endif #endif #if HAVE_SYS_STAT_H if (statdevice(name_dev_audio) < 0) goto dev_audio_end; #endif if ((rc = dev_audio_fd = opendevice(name_dev_audio)) < 0) goto dev_audio_end; #if HAVE_SYS_AUDIOIO_H /* i.e. Solaris */ { struct audio_info info; AUDIO_INITINFO(&info); info.record.sample_rate = 48000; info.record.channels = 2; info.record.precision = 16; info.record.encoding = AUDIO_ENCODING_LINEAR; info.record.gain = AUDIO_MAX_GAIN; info.record.pause = 0; info.record.buffer_size = 4096; info.record.samples = 0; if ((rc = ioctl(dev_audio_fd, AUDIO_SETINFO, &info)) < 0) { if (errno == EINVAL) { /* use a conservative setting this time */ info.record.sample_rate = 22050; info.record.channels = 1; info.record.precision = 8; if ((rc = ioctl(dev_audio_fd, AUDIO_SETINFO, &info)) < 0) { #if HAVE_ERRNO_H perror("ioctl AUDIO_SETINFO failed"); #endif close(dev_audio_fd); goto dev_audio_end; } } else { #if HAVE_ERRNO_H perror("ioctl AUDIO_SETINFO failed"); #endif close(dev_audio_fd); goto dev_audio_end; } } rc = entropy_noise_gather(dev_audio_fd, info.record.precision >> 3, info.record.channels, 0, timeout_env ? atoi(timeout_env) : 1000, data, size); } #else # error Unknown type of /dev/audio interface #endif close(dev_audio_fd); dev_audio_end: #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H mutex_unlock(&dev_audio_lock); # elif HAVE_PTHREAD_H pthread_mutex_unlock(&dev_audio_lock); # endif #endif return rc; } #endif #if HAVE_DEV_DSP /*!\ingroup ES_dsp_m */ int entropy_dev_dsp(byte* data, size_t size) { const char* timeout_env = getenv("BEECRYPT_ENTROPY_DSP_TIMEOUT"); register int rc; #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_lock(&dev_dsp_lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_lock(&dev_dsp_lock)) return -1; # endif #endif #if HAVE_SYS_STAT_H if ((rc = statdevice(name_dev_dsp)) < 0) goto dev_dsp_end; #endif if ((rc = dev_dsp_fd = opendevice(name_dev_dsp)) < 0) goto dev_dsp_end; #if HAVE_SYS_SOUNDCARD_H /* i.e. Linux audio */ { int mask, format, samplesize, stereo, speed, swap; if ((rc = ioctl(dev_dsp_fd, SNDCTL_DSP_GETFMTS, &mask)) < 0) { #if HAVE_ERRNO_H perror("ioctl SNDCTL_DSP_GETFMTS failed"); #endif close (dev_dsp_fd); goto dev_dsp_end; } #if WORDS_BIGENDIAN if (mask & AFMT_S16_BE) { format = AFMT_S16_BE; samplesize = 2; swap = 0; } else if (mask & AFMT_S16_LE) { format = AFMT_S16_LE; samplesize = 2; swap = 1; } #else if (mask & AFMT_S16_LE) { format = AFMT_S16_LE; samplesize = 2; swap = 0; } else if (mask & AFMT_S16_BE) { format = AFMT_S16_BE; samplesize = 2; swap = 1; } #endif else if (mask & AFMT_S8) { format = AFMT_S8; samplesize = 1; swap = 0; } else { /* No linear audio format available */ rc = -1; close(dev_dsp_fd); goto dev_dsp_end; } if ((rc = ioctl(dev_dsp_fd, SNDCTL_DSP_SETFMT, &format)) < 0) { #if HAVE_ERRNO_H perror("ioctl SNDCTL_DSP_SETFMT failed"); #endif close(dev_dsp_fd); goto dev_dsp_end; } /* the next two commands are not critical */ stereo = 1; ioctl(dev_dsp_fd, SNDCTL_DSP_STEREO, &stereo); speed = 44100; ioctl(dev_dsp_fd, SNDCTL_DSP_SPEED, &speed); rc = entropy_noise_gather(dev_dsp_fd, samplesize, 2, swap, timeout_env ? atoi(timeout_env) : 1000, data, size); } #else # error Unknown type of /dev/dsp interface #endif close(dev_dsp_fd); dev_dsp_end: #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H mutex_unlock(&dev_dsp_lock); # elif HAVE_PTHREAD_H pthread_mutex_unlock(&dev_dsp_lock); # endif #endif return rc; } #endif #if HAVE_DEV_RANDOM /*!\ingroup ES_random_m */ int entropy_dev_random(byte* data, size_t size) { const char* timeout_env = getenv("BEECRYPT_ENTROPY_RANDOM_TIMEOUT"); int rc; #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_lock(&dev_random_lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_lock(&dev_random_lock)) return -1; # endif #endif #if HAVE_SYS_STAT_H if ((rc = statdevice(name_dev_random)) < 0) goto dev_random_end; #endif if ((rc = dev_random_fd = opendevice(name_dev_random)) < 0) goto dev_random_end; /* collect entropy, with timeout */ rc = entropy_randombits(dev_random_fd, timeout_env ? atoi(timeout_env) : 1000, data, size); close(dev_random_fd); dev_random_end: #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H mutex_unlock(&dev_random_lock); # elif HAVE_PTHREAD_H pthread_mutex_unlock(&dev_random_lock); # endif #endif return rc; } #endif #if HAVE_DEV_URANDOM /*!\ingroup ES_urandom_m */ int entropy_dev_urandom(byte* data, size_t size) { const char* timeout_env = getenv("BEECRYPT_ENTROPY_URANDOM_TIMEOUT"); register int rc; #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_lock(&dev_urandom_lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_lock(&dev_urandom_lock)) return -1; # endif #endif #if HAVE_SYS_STAT_H if ((rc = statdevice(name_dev_urandom)) < 0) goto dev_urandom_end; #endif if ((rc = dev_urandom_fd = opendevice(name_dev_urandom)) < 0) goto dev_urandom_end; /* collect entropy, with timeout */ rc = entropy_randombits(dev_urandom_fd, timeout_env ? atoi(timeout_env) : 1000, data, size); close(dev_urandom_fd); dev_urandom_end: #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H mutex_unlock(&dev_urandom_lock); # elif HAVE_PTHREAD_H pthread_mutex_unlock(&dev_urandom_lock); # endif #endif return rc; } #endif #if HAVE_DEV_TTY /*!\ingroup ES_tty_m */ int entropy_dev_tty(byte* data, size_t size) { register int rc; #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H if (mutex_lock(&dev_tty_lock)) return -1; # elif HAVE_PTHREAD_H if (pthread_mutex_lock(&dev_tty_lock)) return -1; # endif #endif #if HAVE_SYS_STAT_H if ((rc = statdevice(dev_tty_name)) < 0) goto dev_tty_end; #endif if ((rc = dev_tty_fd = opendevice(dev_tty_name)) < 0) goto dev_tty_end; rc = entropy_ttybits(dev_tty_fd, data, size); close(dev_tty_fd); dev_tty_end: #ifdef _REENTRANT # if HAVE_THREAD_H && HAVE_SYNCH_H mutex_unlock(&dev_tty_lock); # elif HAVE_PTHREAD_H pthread_mutex_unlock(&dev_tty_lock); # endif #endif return rc; } #endif #endif beecrypt-4.2.1/beecrypt.c0000644000175000001440000004646411223574571012256 00000000000000/* * Copyright (c) 1999, 2000, 2001, 2002, 2004 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*!\file beecrypt.c * \brief BeeCrypt API. * \author Bob Deblier * \ingroup ES_m PRNG_m HASH_m HMAC_m BC_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/beecrypt.h" #include "beecrypt/entropy.h" #include "beecrypt/fips186.h" #include "beecrypt/mtprng.h" #include "beecrypt/md4.h" #include "beecrypt/md5.h" #include "beecrypt/ripemd128.h" #include "beecrypt/ripemd160.h" #include "beecrypt/ripemd256.h" #include "beecrypt/ripemd320.h" #include "beecrypt/sha1.h" #include "beecrypt/sha224.h" #include "beecrypt/sha256.h" #include "beecrypt/sha384.h" #include "beecrypt/sha512.h" #include "beecrypt/hmacmd5.h" #include "beecrypt/hmacsha1.h" #include "beecrypt/hmacsha224.h" #include "beecrypt/hmacsha256.h" #include "beecrypt/hmacsha384.h" #include "beecrypt/hmacsha512.h" #include "beecrypt/aes.h" #include "beecrypt/blowfish.h" #include "beecrypt/blockmode.h" static entropySource entropySourceList[] = { #if WIN32 { "wincrypt", entropy_wincrypt }, { "console", entropy_console }, { "wavein", entropy_wavein }, #else # if HAVE_DEV_URANDOM { "urandom", entropy_dev_urandom }, # endif # if HAVE_DEV_RANDOM { "random", entropy_dev_random }, # endif # if HAVE_DEV_TTY { "tty", entropy_dev_tty }, # endif # if HAVE_DEV_AUDIO { "audio", entropy_dev_audio }, # endif # if HAVE_DEV_DSP { "dsp", entropy_dev_dsp }, # endif #endif }; #define ENTROPYSOURCES (sizeof(entropySourceList) / sizeof(entropySource)) int entropySourceCount() { return ENTROPYSOURCES; } const entropySource* entropySourceGet(int n) { if ((n < 0) || (n >= ENTROPYSOURCES)) return (const entropySource*) 0; return entropySourceList+n; } const entropySource* entropySourceFind(const char* name) { register int index; for (index = 0; index < ENTROPYSOURCES; index++) { if (strcmp(name, entropySourceList[index].name) == 0) return entropySourceList+index; } return (const entropySource*) 0; } const entropySource* entropySourceDefault() { const char* selection = getenv("BEECRYPT_ENTROPY"); if (selection) { return entropySourceFind(selection); } else if (ENTROPYSOURCES) { return entropySourceList+0; } return (const entropySource*) 0; } int entropyGatherNext(byte* data, size_t size) { const char* selection = getenv("BEECRYPT_ENTROPY"); if (selection) { const entropySource* ptr = entropySourceFind(selection); if (ptr) return ptr->next(data, size); } else { register int index; for (index = 0; index < ENTROPYSOURCES; index++) { if (entropySourceList[index].next(data, size) == 0) return 0; } } return -1; } static const randomGenerator* randomGeneratorList[] = { &fips186prng, &mtprng }; #define RANDOMGENERATORS (sizeof(randomGeneratorList) / sizeof(randomGenerator*)) int randomGeneratorCount() { return RANDOMGENERATORS; } const randomGenerator* randomGeneratorGet(int index) { if ((index < 0) || (index >= RANDOMGENERATORS)) return (const randomGenerator*) 0; return randomGeneratorList[index]; } const randomGenerator* randomGeneratorFind(const char* name) { register int index; for (index = 0; index < RANDOMGENERATORS; index++) { if (strcmp(name, randomGeneratorList[index]->name) == 0) return randomGeneratorList[index]; } return (const randomGenerator*) 0; } const randomGenerator* randomGeneratorDefault() { char* selection = getenv("BEECRYPT_RANDOM"); if (selection) return randomGeneratorFind(selection); else return &fips186prng; } int randomGeneratorContextInit(randomGeneratorContext* ctxt, const randomGenerator* rng) { if (ctxt == (randomGeneratorContext*) 0) return -1; if (rng == (randomGenerator*) 0) return -1; ctxt->rng = rng; if (rng->paramsize) { ctxt->param = (randomGeneratorParam*) calloc(rng->paramsize, 1); if (ctxt->param == (randomGeneratorParam*) 0) return -1; } else ctxt->param = (randomGeneratorParam*) 0; return ctxt->rng->setup(ctxt->param); } int randomGeneratorContextFree(randomGeneratorContext* ctxt) { register int rc = 0; if (ctxt == (randomGeneratorContext*) 0) return -1; if (ctxt->rng == (randomGenerator*) 0) return -1; if (ctxt->rng->paramsize) { if (ctxt->param == (randomGeneratorParam*) 0) return -1; rc = ctxt->rng->cleanup(ctxt->param); free(ctxt->param); ctxt->param = (randomGeneratorParam*) 0; } return rc; } int randomGeneratorContextNext(randomGeneratorContext* ctxt, byte* data, size_t size) { return ctxt->rng->next(ctxt->param, data, size); } int randomGeneratorContextSeed(randomGeneratorContext* ctxt, const byte* data, size_t size) { return ctxt->rng->seed(ctxt->param, data, size); } static const hashFunction* hashFunctionList[] = { &md4, &md5, &ripemd128, &ripemd160, &ripemd256, &ripemd320, &sha1, &sha224, &sha256, &sha384, &sha512 }; #define HASHFUNCTIONS (sizeof(hashFunctionList) / sizeof(hashFunction*)) int hashFunctionCount() { return HASHFUNCTIONS; } const hashFunction* hashFunctionDefault() { char* selection = getenv("BEECRYPT_HASH"); if (selection) return hashFunctionFind(selection); else return &sha1; } const hashFunction* hashFunctionGet(int index) { if ((index < 0) || (index >= HASHFUNCTIONS)) return (const hashFunction*) 0; return hashFunctionList[index]; } const hashFunction* hashFunctionFind(const char* name) { register int index; for (index = 0; index < HASHFUNCTIONS; index++) { if (strcmp(name, hashFunctionList[index]->name) == 0) return hashFunctionList[index]; } return (const hashFunction*) 0; } int hashFunctionContextInit(hashFunctionContext* ctxt, const hashFunction* hash) { if (ctxt == (hashFunctionContext*) 0) return -1; if (hash == (hashFunction*) 0) return -1; ctxt->algo = hash; ctxt->param = (hashFunctionParam*) calloc(hash->paramsize, 1); if (ctxt->param == (hashFunctionParam*) 0) return -1; return ctxt->algo->reset(ctxt->param); } int hashFunctionContextFree(hashFunctionContext* ctxt) { if (ctxt == (hashFunctionContext*) 0) return -1; if (ctxt->param == (hashFunctionParam*) 0) return -1; free(ctxt->param); ctxt->param = (hashFunctionParam*) 0; return 0; } int hashFunctionContextReset(hashFunctionContext* ctxt) { if (ctxt == (hashFunctionContext*) 0) return -1; if (ctxt->algo == (hashFunction*) 0) return -1; if (ctxt->param == (hashFunctionParam*) 0) return -1; return ctxt->algo->reset(ctxt->param); } int hashFunctionContextUpdate(hashFunctionContext* ctxt, const byte* data, size_t size) { if (ctxt == (hashFunctionContext*) 0) return -1; if (ctxt->algo == (hashFunction*) 0) return -1; if (ctxt->param == (hashFunctionParam*) 0) return -1; if (data == (const byte*) 0) return -1; return ctxt->algo->update(ctxt->param, data, size); } int hashFunctionContextUpdateMC(hashFunctionContext* ctxt, const memchunk* m) { if (ctxt == (hashFunctionContext*) 0) return -1; if (ctxt->algo == (hashFunction*) 0) return -1; if (ctxt->param == (hashFunctionParam*) 0) return -1; if (m == (memchunk*) 0) return -1; return ctxt->algo->update(ctxt->param, m->data, m->size); } int hashFunctionContextUpdateMP(hashFunctionContext* ctxt, const mpnumber* n) { if (ctxt == (hashFunctionContext*) 0) return -1; if (ctxt->algo == (hashFunction*) 0) return -1; if (ctxt->param == (hashFunctionParam*) 0) return -1; if (n != (mpnumber*) 0) { int rc; /* get the number of significant bits in the number */ size_t sigbits = mpbits(n->size, n->data); /* calculate how many bytes we need for a java-style encoding; * if the most significant bit of the most significant byte * is set, then we need to prefix a zero byte. */ size_t req = ((sigbits+8) >> 3); byte* tmp = (byte*) malloc(req); if (tmp == (byte*) 0) return -1; i2osp(tmp, req, n->data, n->size); rc = ctxt->algo->update(ctxt->param, tmp, req); free(tmp); return rc; } return -1; } int hashFunctionContextDigest(hashFunctionContext* ctxt, byte *digest) { if (ctxt == (hashFunctionContext*) 0) return -1; if (ctxt->algo == (hashFunction*) 0) return -1; if (ctxt->param == (hashFunctionParam*) 0) return -1; if (digest == (byte*) 0) return -1; return ctxt->algo->digest(ctxt->param, digest); } int hashFunctionContextDigestMP(hashFunctionContext* ctxt, mpnumber* d) { if (ctxt == (hashFunctionContext*) 0) return -1; if (ctxt->algo == (hashFunction*) 0) return -1; if (ctxt->param == (hashFunctionParam*) 0) return -1; if (d != (mpnumber*) 0) { int rc; byte *digest = (byte*) malloc(ctxt->algo->digestsize); if (digest == (byte*) 0) return -1; if (ctxt->algo->digest(ctxt->param, digest)) { free(digest); return -1; } rc = mpnsetbin(d, digest, ctxt->algo->digestsize); free(digest); return rc; } return -1; } int hashFunctionContextDigestMatch(hashFunctionContext* ctxt, const mpnumber* d) { int rc = 0; mpnumber match; mpnzero(&match); if (hashFunctionContextDigestMP(ctxt, &match) == 0) rc = mpeqx(d->size, d->data, match.size, match.data); mpnfree(&match); return rc; } static const keyedHashFunction* keyedHashFunctionList[] = { &hmacmd5, &hmacsha1, &hmacsha224, &hmacsha256, &hmacsha384, &hmacsha512 }; #define KEYEDHASHFUNCTIONS (sizeof(keyedHashFunctionList) / sizeof(keyedHashFunction*)) int keyedHashFunctionCount() { return KEYEDHASHFUNCTIONS; } const keyedHashFunction* keyedHashFunctionDefault() { char* selection = getenv("BEECRYPT_KEYEDHASH"); if (selection) return keyedHashFunctionFind(selection); else return &hmacsha1; } const keyedHashFunction* keyedHashFunctionGet(int index) { if ((index < 0) || (index >= KEYEDHASHFUNCTIONS)) return (const keyedHashFunction*) 0; return keyedHashFunctionList[index]; } const keyedHashFunction* keyedHashFunctionFind(const char* name) { register int index; for (index = 0; index < KEYEDHASHFUNCTIONS; index++) { if (strcmp(name, keyedHashFunctionList[index]->name) == 0) return keyedHashFunctionList[index]; } return (const keyedHashFunction*) 0; } int keyedHashFunctionContextInit(keyedHashFunctionContext* ctxt, const keyedHashFunction* mac) { if (ctxt == (keyedHashFunctionContext*) 0) return -1; if (mac == (keyedHashFunction*) 0) return -1; ctxt->algo = mac; ctxt->param = (keyedHashFunctionParam*) calloc(mac->paramsize, 1); if (ctxt->param == (keyedHashFunctionParam*) 0) return -1; return ctxt->algo->reset(ctxt->param); } int keyedHashFunctionContextFree(keyedHashFunctionContext* ctxt) { if (ctxt == (keyedHashFunctionContext*) 0) return -1; if (ctxt->algo == (keyedHashFunction*) 0) return -1; if (ctxt->param == (keyedHashFunctionParam*) 0) return -1; free(ctxt->param); ctxt->param = (keyedHashFunctionParam*) 0; return 0; } int keyedHashFunctionContextSetup(keyedHashFunctionContext* ctxt, const byte* key, size_t keybits) { if (ctxt == (keyedHashFunctionContext*) 0) return -1; if (ctxt->algo == (keyedHashFunction*) 0) return -1; if (ctxt->param == (keyedHashFunctionParam*) 0) return -1; if (key == (byte*) 0) return -1; return ctxt->algo->setup(ctxt->param, key, keybits); } int keyedHashFunctionContextReset(keyedHashFunctionContext* ctxt) { if (ctxt == (keyedHashFunctionContext*) 0) return -1; if (ctxt->algo == (keyedHashFunction*) 0) return -1; if (ctxt->param == (keyedHashFunctionParam*) 0) return -1; return ctxt->algo->reset(ctxt->param); } int keyedHashFunctionContextUpdate(keyedHashFunctionContext* ctxt, const byte* data, size_t size) { if (ctxt == (keyedHashFunctionContext*) 0) return -1; if (ctxt->algo == (keyedHashFunction*) 0) return -1; if (ctxt->param == (keyedHashFunctionParam*) 0) return -1; if (data == (byte*) 0) return -1; return ctxt->algo->update(ctxt->param, data, size); } int keyedHashFunctionContextUpdateMC(keyedHashFunctionContext* ctxt, const memchunk* m) { if (ctxt == (keyedHashFunctionContext*) 0) return -1; if (ctxt->algo == (keyedHashFunction*) 0) return -1; if (ctxt->param == (keyedHashFunctionParam*) 0) return -1; if (m == (memchunk*) 0) return -1; return ctxt->algo->update(ctxt->param, m->data, m->size); } int keyedHashFunctionContextUpdateMP(keyedHashFunctionContext* ctxt, const mpnumber* n) { if (ctxt == (keyedHashFunctionContext*) 0) return -1; if (ctxt->algo == (keyedHashFunction*) 0) return -1; if (ctxt->param == (keyedHashFunctionParam*) 0) return -1; if (n != (mpnumber*) 0) { int rc; /* get the number of significant bits in the number */ size_t sigbits = mpbits(n->size, n->data); /* calculate how many bytes we need a java-style encoding; if the * most significant bit of the most significant byte is set, then * we need to prefix a zero byte. */ size_t req = ((sigbits+8) >> 3); byte* tmp = (byte*) malloc(req); if (tmp == (byte*) 0) return -1; i2osp(tmp, req, n->data, n->size); rc = ctxt->algo->update(ctxt->param, tmp, req); free(tmp); return rc; } return -1; } int keyedHashFunctionContextDigest(keyedHashFunctionContext* ctxt, byte* digest) { if (ctxt == (keyedHashFunctionContext*) 0) return -1; if (ctxt->algo == (keyedHashFunction*) 0) return -1; if (ctxt->param == (keyedHashFunctionParam*) 0) return -1; if (digest == (byte*) 0) return -1; return ctxt->algo->digest(ctxt->param, digest); } int keyedHashFunctionContextDigestMP(keyedHashFunctionContext* ctxt, mpnumber* d) { if (ctxt == (keyedHashFunctionContext*) 0) return -1; if (ctxt->algo == (keyedHashFunction*) 0) return -1; if (ctxt->param == (keyedHashFunctionParam*) 0) return -1; if (d != (mpnumber*) 0) { int rc; byte *digest = (byte*) malloc(ctxt->algo->digestsize); if (digest == (byte*) 0) return -1; if (ctxt->algo->digest(ctxt->param, digest)) { free(digest); return -1; } rc = os2ip(d->data, d->size, digest, ctxt->algo->digestsize); free(digest); return rc; } return -1; } int keyedHashFunctionContextDigestMatch(keyedHashFunctionContext* ctxt, const mpnumber* d) { int rc = 0; mpnumber match; mpnzero(&match); if (keyedHashFunctionContextDigestMP(ctxt, &match) == 0) rc = mpeqx(d->size, d->data, match.size, match.data); mpnfree(&match); return rc; } static const blockCipher* blockCipherList[] = { &aes, &blowfish }; #define BLOCKCIPHERS (sizeof(blockCipherList) / sizeof(blockCipher*)) int blockCipherCount() { return BLOCKCIPHERS; } const blockCipher* blockCipherDefault() { char* selection = getenv("BEECRYPT_CIPHER"); if (selection) return blockCipherFind(selection); else return &aes; } const blockCipher* blockCipherGet(int index) { if ((index < 0) || (index >= BLOCKCIPHERS)) return (const blockCipher*) 0; return blockCipherList[index]; } const blockCipher* blockCipherFind(const char* name) { register int index; for (index = 0; index < BLOCKCIPHERS; index++) { if (strcmp(name, blockCipherList[index]->name) == 0) return blockCipherList[index]; } return (const blockCipher*) 0; } int blockCipherContextInit(blockCipherContext* ctxt, const blockCipher* ciph) { if (ctxt == (blockCipherContext*) 0) return -1; if (ciph == (blockCipher*) 0) return -1; ctxt->algo = ciph; ctxt->param = (blockCipherParam*) calloc(ciph->paramsize, 1); ctxt->op = NOCRYPT; if (ctxt->param == (blockCipherParam*) 0) return -1; return 0; } int blockCipherContextSetup(blockCipherContext* ctxt, const byte* key, size_t keybits, cipherOperation op) { if (ctxt == (blockCipherContext*) 0) return -1; if (ctxt->algo == (blockCipher*) 0) return -1; if (ctxt->param == (blockCipherParam*) 0) return -1; ctxt->op = op; if (key == (byte*) 0) return -1; return ctxt->algo->setup(ctxt->param, key, keybits, op); } int blockCipherContextSetIV(blockCipherContext* ctxt, const byte* iv) { if (ctxt == (blockCipherContext*) 0) return -1; if (ctxt->algo == (blockCipher*) 0) return -1; if (ctxt->param == (blockCipherParam*) 0) return -1; /* null is an allowed value for iv, so don't test it */ return ctxt->algo->setiv(ctxt->param, iv); } int blockCipherContextSetCTR(blockCipherContext* ctxt, const byte* nivz, size_t counter) { if (ctxt == (blockCipherContext*) 0) return -1; if (ctxt->algo == (blockCipher*) 0) return -1; if (ctxt->param == (blockCipherParam*) 0) return -1; return ctxt->algo->setctr(ctxt->param, nivz, counter); } int blockCipherContextFree(blockCipherContext* ctxt) { if (ctxt == (blockCipherContext*) 0) return -1; if (ctxt->param == (blockCipherParam*) 0) return -1; free(ctxt->param); ctxt->param = (blockCipherParam*) 0; return 0; } int blockCipherContextValidKeylen(blockCipherContext* ctxt, size_t bits) { if (ctxt == (blockCipherContext*) 0) return -1; if (ctxt->algo == (blockCipher*) 0) return -1; if (bits < ctxt->algo->keybitsmin || bits > ctxt->algo->keybitsmax) return 0; return ((bits - ctxt->algo->keybitsmin) % ctxt->algo->keybitsinc) == 0; } int blockCipherContextECB(blockCipherContext* ctxt, uint32_t* dst, const uint32_t* src, int nblocks) { switch (ctxt->op) { case NOCRYPT: memcpy(dst, src, nblocks * ctxt->algo->blocksize); return 0; case ENCRYPT: return (ctxt->algo->ecb.encrypt) ? ctxt->algo->ecb.encrypt(ctxt->param, dst, src, nblocks) : blockEncryptECB(ctxt->algo, ctxt->param, dst, src, nblocks); case DECRYPT: return (ctxt->algo->ecb.decrypt) ? ctxt->algo->ecb.decrypt(ctxt->param, dst, src, nblocks) : blockDecryptECB(ctxt->algo, ctxt->param, dst, src, nblocks); } return -1; } int blockCipherContextCBC(blockCipherContext* ctxt, uint32_t* dst, const uint32_t* src, int nblocks) { switch (ctxt->op) { case NOCRYPT: memcpy(dst, src, nblocks * ctxt->algo->blocksize); return 0; case ENCRYPT: return (ctxt->algo->cbc.encrypt) ? ctxt->algo->cbc.encrypt(ctxt->param, dst, src, nblocks) : blockEncryptCBC(ctxt->algo, ctxt->param, dst, src, nblocks); case DECRYPT: return (ctxt->algo->cbc.decrypt) ? ctxt->algo->cbc.decrypt(ctxt->param, dst, src, nblocks) : blockDecryptCBC(ctxt->algo, ctxt->param, dst, src, nblocks); } return -1; } int blockCipherContextCTR(blockCipherContext* ctxt, uint32_t* dst, const uint32_t* src, int nblocks) { switch (ctxt->op) { case NOCRYPT: memcpy(dst, src, nblocks * ctxt->algo->blocksize); return 0; case ENCRYPT: case DECRYPT: /* encrypt and decrypt are the same operation in ctr mode */ return (ctxt->algo->ctr.encrypt) ? ctxt->algo->ctr.encrypt(ctxt->param, dst, src, nblocks) : blockEncryptCTR(ctxt->algo, ctxt->param, dst, src, nblocks); } return -1; } #if WIN32 __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: entropy_provider_setup(hInst); break; case DLL_PROCESS_DETACH: entropy_provider_cleanup(); break; } return TRUE; } #endif beecrypt-4.2.1/pkcs12.c0000664000175000001440000000341410254472207011526 00000000000000#define BEECRYPT_DLL_EXPORT #include "beecrypt/pkcs12.h" int pkcs12_derive_key(const hashFunction* h, byte id, const byte* pdata, size_t psize, const byte* sdata, size_t ssize, size_t iterationcount, byte* ndata, size_t nsize) { int rc = -1; size_t i, remain; hashFunctionContext ctxt; byte *digest; digest = (byte*) malloc(h->digestsize); if (!digest) goto cleanup; if (hashFunctionContextInit(&ctxt, h)) goto cleanup; /* we start by hashing the diversifier; don't allocate a buffer for this */ for (i = 0; i < h->blocksize; i++) hashFunctionContextUpdate(&ctxt, &id, 1); /* next we hash the salt data, concatenating until we have a whole number of blocks */ if (ssize) { remain = ((ssize / h->blocksize) + (ssize % h->blocksize)) * h->blocksize; while (remain > 0) { size_t tmp = remain > ssize ? ssize : remain; hashFunctionContextUpdate(&ctxt, sdata, tmp); remain -= tmp; } } /* next we hash the password data, concatenating until we have a whole number of blocks */ if (psize) { remain = ((psize / h->blocksize) + (psize % h->blocksize)) * h->blocksize; while (remain > 0) { size_t tmp = remain > psize ? psize : remain; hashFunctionContextUpdate(&ctxt, pdata, tmp); remain -= tmp; } } /* now we iterate through the following loop */ while (iterationcount-- > 0) { hashFunctionContextDigest(&ctxt, digest); hashFunctionContextUpdate(&ctxt, digest, h->digestsize); } /* do the final digest */ hashFunctionContextDigest(&ctxt, digest); /* fill key */ while (nsize > 0) { size_t tmp = nsize > h->digestsize ? h->digestsize : nsize; memcpy(ndata, digest, tmp); ndata += tmp; nsize -= tmp; } if (hashFunctionContextFree(&ctxt)) goto cleanup; rc = 0; cleanup: if (digest) free(digest); return rc; } beecrypt-4.2.1/BENCHMARKS0000644000175000001440000001561411223571242011616 00000000000000Note: timings are average values and may vary under different conditions, i.e. the amount of free memory, swapped memory, amount of cpu cache, etc. I've tried to make them as accurate as possible, within limits. Note: many of the testing systems were provided by FSF France's GCC Compile Farm initiative (http://gcc.gnu.org/wiki/CompileFarm). Many thanks for allowing me to test BeeCrypt there! In the past I've used HP's TestDrive program (has been retired) and the SourceForge Compile Farm project (also retired). Note: to avoid religious wars, in the table below read GNU/Linux for Linux - I'm just a little cramped for space... BENCHmark Modular Exponentation (more is better): BeeCrypt 4.2.0 | gcc-4.4.0 | Debian Linux | Opteron 8354 2200 | 16 GB: 29373 [--with-arch=k8] BeeCrypt 4.2.0 | gcc-4.1.2 | Debian Linux | Opteron 8354 2200 | 16 GB: 27911 BeeCrypt 4.2.0 | gcc-4.4.0 | Debian Linux | Xeon X5450 3000 | 16 GB: 25677 BeeCrypt 4.2.0 | gcc-4.3.3 | Debian Linux | Xeon X5450 3000 | 16 GB: 25511 BeeCrypt 4.2.0 | gcc-4.0.0 | Fedora Core 4 | Athlon 64 3000+| 1 GB: 24910 BeeCrypt 4.0.0 | gcc-3.3.3 | Fedora Core 2 | Athlon 64 3000+| 1 GB: 24870 BeeCrypt 4.2.0 | gcc-3.4.3 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 24654 BeeCrypt 4.0.0 | gcc-3.2.2 | SuSE Enterprise 8 | Opteron 1600 | 1 GB: 19460 BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | Opteron MP 1600 | : 17230 BeeCrypt 3.1.0 | gcc-2.96 | RedHat AS 2.1 | Itanium 2 1400 | 1 GB: 11730 BeeCrypt 4.2.0 | gcc-3.4.6 | CentOS 4.x | P4 Xeon 3000 | 10 GB: 11648 BeeCrypt 4.2.0 | gcc-4.1.2 | Debian Linux | PPC 970 1800 | 512 MB: 10815 BeeCrypt 4.2.0 | gcc-3.3.3 | SuSE Enterprise 9 | POWER5 1650 | 1 GB: 10150 BeeCrypt 3.0.0 | gcc-3.2.2 | Debian Linux 3.0 | Itanium 2 900 | 12 GB: 7317 BeeCrypt 3.0.0 | gcc-3.3 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 6920 [--with-arch=pentium4] BeeCrypt 4.1.0 | gcc-3.3.3 | Fedora Core 2 | P4 Xeon 2400 | 1 GB: 6811 [--with-arch=pentium4] BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0 | Alpha EV6.7 666 | 2 GB: 5742 BeeCrypt 4.1.2 | gcc-3.3.3 | SuSE Enterprise 9 | POWER4 1000 | 16 GB: 5620 BeeCrypt 4.2.0 | gcc-4.3.1 | Debian Linux | PPC 7455 1333 | 1 GB: 3320 BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 3280 [--with-arch=pentiumpro] BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | POWER4+ 1200 | : 2592 BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | P3 Xeon 900 | : 2169 BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 1782 [--with-arch=powerpc64] BeeCrypt 3.0.0 | gcc-3.x | RedHat Linux | zSeries 900 | : 1687 (s390x) BeeCrypt 3.0.0 | gcc-3.3 | SuSE Linux 8.2 | Pentium 3 600 | 512 MB: 1447 [--with-arch=pentium3] BeeCrypt 3.0.0 | gcc-3.2.2 | AIX 5.1 | POWER3-II 333 | 512 MB: 756 BeeCrypt 3.0.0 | Forte C 5.1 | Solaris 8 | UltraSparc II 400 | 4 GB: 425 [--with-arch=sparcv8plus] BeeCrypt 3.0.0 | | Debian Linux 3.0 | StrongARM 1110 128 | 32 MB: 341 BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0r1 | M68040 33 | 52 MB: 24 BeeCrypt 3.0.0 | gcc-2.95.4 | Debian Linux 3.0r1 | M68030 25 | 36 MB: 8 BENCHmark Hash Function (more is better): MD5 BeeCrypt 4.2.0 | gcc-3.4.6 | CentOS 4.x | Xeon EM64T 3000 | 10 GB: 303.6 MB/s BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 190.5 MB/s BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 137.0 MB/s [--with-arch=pentiumpro] BeeCrypt 4.1.0 | gcc-3.3.3 | Fedora Core 2 | P4 Xeon 2400 | 1 GB: 97.2 MB/s [--with-arch=pentium4] BeeCrypt 4.1.2 | gcc-3.3.3 | SuSE Enterprise 9 | POWER4 1000 | 16 GB: 43.9 MB/s SHA-1 BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 117.4 MB/s BeeCrypt 4.2.0 | gcc-3.4.6 | CentOS 4.x | Xeon EM64T 3000 | 10 GB: 111.8 MB/s BeeCrypt 4.1.0 | gcc-3.3.3 | Fedora Core 2 | P4 Xeon 2400 | 1 GB: 81.9 MB/s [--with-arch=pentium4] BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 77.0 MB/s [--with-arch=pentiumpro] BeeCrypt 4.1.2 | gcc-3.3.3 | SuSE Enterprise 9 | POWER4 1000 | 16 GB: 51.2 MB/s SHA-256 BeeCrypt 4.2.0 | gcc-3.4.6 | CentOS 4.x | Xeon EM64T 3000 | 10 GB: 103.5 MB/s BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 85.1 MB/s BeeCrypt 4.1.0 | gcc-3.3.3 | Fedora Core 2 | P4 Xeon 2400 | 1 GB: 42.4 MB/s [--with-arch=pentium4] BeeCrypt 3.0.0 | gcc-2.96 | RedHat AS 2.1 | P4 Xeon 2400 | 4 GB: 37.8 MB/s [--with-arch=pentiumpro] BeeCrypt 4.1.2 | gcc-3.3.3 | SuSE Enterprise 9 | POWER4 1000 | 16 GB: 32.8 MB/s SHA-512 BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 129.6 MB/s BeeCrypt 4.2.0 | gcc-3.4.6 | CentOS 4.x | Xeon EM64T 3000 | 10 GB: 92.6 MB/s BeeCrypt 4.1.0 | gcc-3.3.3 | SuSE Enterprise 9 | POWER4 1000 | 16 GB: 57.6 MB/s BeeCrypt 4.1.0 | gcc-3.3.3 | Fedora Core 2 | P4 Xeon 2400 | 1 GB: 46.3 MB/s [--with-arch=pentium4] BeeCrypt 4.1.2 | gcc-3.3.3 | SuSE Enterprise 9 | POWER4 1000 | 16 GB: 57.9 MB/s BENCHmark Block Cipher (more is better): AES, 128 bits BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 97.0 MB/s [ECB encrypt] BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 93.5 MB/s [CBC encrypt] BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 104.6 MB/s [ECB decrypt] BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 99.2 MB/s [CBC decrypt] Blowfish, 128 bits BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 59.4 MB/s [ECB encrypt] BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 57.7 MB/s [CBC encrypt] BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 61.4 MB/s [ECB decrypt] BeeCrypt 4.1.0 | gcc-3.4.2 | Fedora Core 3 | Athlon 64 3000+| 1 GB: 59.3 MB/s [CBC decrypt] beecrypt-4.2.1/COPYING.LIB0000664000175000001440000006347410063036000011714 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! beecrypt-4.2.1/config.sub0000755000175000001440000010260311225166714012242 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2009-02-03' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx | dvp \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsEE* | ee | ps2) basic_machine=mips64r5900el-scei case $os in -linux*) ;; *) os=-elf ;; esac ;; iop) basic_machine=mipsel-scei os=-irx ;; dvp) basic_machine=dvp-scei os=-elf ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: beecrypt-4.2.1/sha256.c0000644000175000001440000002037311216402443011426 00000000000000/* * Copyright (c) 2000, 2001 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file sha256.c * \brief SHA-256 hash function, as specified by NIST DFIPS 180-2. * \author Bob Deblier * \ingroup HASH_m HASH_sha256_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/sha256.h" #include "beecrypt/sha2k32.h" #include "beecrypt/endianness.h" /*!\addtogroup HASH_sha256_m * \{ */ static const uint32_t hinit[8] = { 0x6a09e667U, 0xbb67ae85U, 0x3c6ef372U, 0xa54ff53aU, 0x510e527fU, 0x9b05688cU, 0x1f83d9abU, 0x5be0cd19U }; const hashFunction sha256 = { .name = "SHA-256", .paramsize = sizeof(sha256Param), .blocksize = 64, .digestsize = 32, .reset = (hashFunctionReset) sha256Reset, .update = (hashFunctionUpdate) sha256Update, .digest = (hashFunctionDigest) sha256Digest }; int sha256Reset(register sha256Param* sp) { memcpy(sp->h, hinit, 8 * sizeof(uint32_t)); memset(sp->data, 0, 64 * sizeof(uint32_t)); #if (MP_WBITS == 64) mpzero(1, sp->length); #elif (MP_WBITS == 32) mpzero(2, sp->length); #else # error #endif sp->offset = 0; return 0; } #define R(x,s) ((x) >> (s)) #define S(x,s) ROTR32(x, s) #define CH(x,y,z) ((x&(y^z))^z) #define MAJ(x,y,z) (((x|y)&z)|(x&y)) #define SIG0(x) (S(x,2) ^ S(x,13) ^ S(x,22)) #define SIG1(x) (S(x,6) ^ S(x,11) ^ S(x,25)) #define sig0(x) (S(x,7) ^ S(x,18) ^ R(x,3)) #define sig1(x) (S(x,17) ^ S(x,19) ^ R(x,10)) #define ROUND(a,b,c,d,e,f,g,h,w,k) \ temp = h + SIG1(e) + CH(e,f,g) + k + w; \ h = temp + SIG0(a) + MAJ(a,b,c); \ d += temp #ifndef ASM_SHA256PROCESS void sha256Process(register sha256Param* sp) { register uint32_t a, b, c, d, e, f, g, h, temp; register uint32_t *w; register const uint32_t *k; register byte t; #if WORDS_BIGENDIAN w = sp->data + 16; #else w = sp->data; t = 16; while (t--) { temp = swapu32(*w); *(w++) = temp; } #endif t = 48; while (t--) { temp = sig1(w[-2]) + w[-7] + sig0(w[-15]) + w[-16]; *(w++) = temp; } w = sp->data; a = sp->h[0]; b = sp->h[1]; c = sp->h[2]; d = sp->h[3]; e = sp->h[4]; f = sp->h[5]; g = sp->h[6]; h = sp->h[7]; k = SHA2_32BIT_K; ROUND(a,b,c,d,e,f,g,h,w[ 0],k[ 0]); ROUND(h,a,b,c,d,e,f,g,w[ 1],k[ 1]); ROUND(g,h,a,b,c,d,e,f,w[ 2],k[ 2]); ROUND(f,g,h,a,b,c,d,e,w[ 3],k[ 3]); ROUND(e,f,g,h,a,b,c,d,w[ 4],k[ 4]); ROUND(d,e,f,g,h,a,b,c,w[ 5],k[ 5]); ROUND(c,d,e,f,g,h,a,b,w[ 6],k[ 6]); ROUND(b,c,d,e,f,g,h,a,w[ 7],k[ 7]); ROUND(a,b,c,d,e,f,g,h,w[ 8],k[ 8]); ROUND(h,a,b,c,d,e,f,g,w[ 9],k[ 9]); ROUND(g,h,a,b,c,d,e,f,w[10],k[10]); ROUND(f,g,h,a,b,c,d,e,w[11],k[11]); ROUND(e,f,g,h,a,b,c,d,w[12],k[12]); ROUND(d,e,f,g,h,a,b,c,w[13],k[13]); ROUND(c,d,e,f,g,h,a,b,w[14],k[14]); ROUND(b,c,d,e,f,g,h,a,w[15],k[15]); ROUND(a,b,c,d,e,f,g,h,w[16],k[16]); ROUND(h,a,b,c,d,e,f,g,w[17],k[17]); ROUND(g,h,a,b,c,d,e,f,w[18],k[18]); ROUND(f,g,h,a,b,c,d,e,w[19],k[19]); ROUND(e,f,g,h,a,b,c,d,w[20],k[20]); ROUND(d,e,f,g,h,a,b,c,w[21],k[21]); ROUND(c,d,e,f,g,h,a,b,w[22],k[22]); ROUND(b,c,d,e,f,g,h,a,w[23],k[23]); ROUND(a,b,c,d,e,f,g,h,w[24],k[24]); ROUND(h,a,b,c,d,e,f,g,w[25],k[25]); ROUND(g,h,a,b,c,d,e,f,w[26],k[26]); ROUND(f,g,h,a,b,c,d,e,w[27],k[27]); ROUND(e,f,g,h,a,b,c,d,w[28],k[28]); ROUND(d,e,f,g,h,a,b,c,w[29],k[29]); ROUND(c,d,e,f,g,h,a,b,w[30],k[30]); ROUND(b,c,d,e,f,g,h,a,w[31],k[31]); ROUND(a,b,c,d,e,f,g,h,w[32],k[32]); ROUND(h,a,b,c,d,e,f,g,w[33],k[33]); ROUND(g,h,a,b,c,d,e,f,w[34],k[34]); ROUND(f,g,h,a,b,c,d,e,w[35],k[35]); ROUND(e,f,g,h,a,b,c,d,w[36],k[36]); ROUND(d,e,f,g,h,a,b,c,w[37],k[37]); ROUND(c,d,e,f,g,h,a,b,w[38],k[38]); ROUND(b,c,d,e,f,g,h,a,w[39],k[39]); ROUND(a,b,c,d,e,f,g,h,w[40],k[40]); ROUND(h,a,b,c,d,e,f,g,w[41],k[41]); ROUND(g,h,a,b,c,d,e,f,w[42],k[42]); ROUND(f,g,h,a,b,c,d,e,w[43],k[43]); ROUND(e,f,g,h,a,b,c,d,w[44],k[44]); ROUND(d,e,f,g,h,a,b,c,w[45],k[45]); ROUND(c,d,e,f,g,h,a,b,w[46],k[46]); ROUND(b,c,d,e,f,g,h,a,w[47],k[47]); ROUND(a,b,c,d,e,f,g,h,w[48],k[48]); ROUND(h,a,b,c,d,e,f,g,w[49],k[49]); ROUND(g,h,a,b,c,d,e,f,w[50],k[50]); ROUND(f,g,h,a,b,c,d,e,w[51],k[51]); ROUND(e,f,g,h,a,b,c,d,w[52],k[52]); ROUND(d,e,f,g,h,a,b,c,w[53],k[53]); ROUND(c,d,e,f,g,h,a,b,w[54],k[54]); ROUND(b,c,d,e,f,g,h,a,w[55],k[55]); ROUND(a,b,c,d,e,f,g,h,w[56],k[56]); ROUND(h,a,b,c,d,e,f,g,w[57],k[57]); ROUND(g,h,a,b,c,d,e,f,w[58],k[58]); ROUND(f,g,h,a,b,c,d,e,w[59],k[59]); ROUND(e,f,g,h,a,b,c,d,w[60],k[60]); ROUND(d,e,f,g,h,a,b,c,w[61],k[61]); ROUND(c,d,e,f,g,h,a,b,w[62],k[62]); ROUND(b,c,d,e,f,g,h,a,w[63],k[63]); sp->h[0] += a; sp->h[1] += b; sp->h[2] += c; sp->h[3] += d; sp->h[4] += e; sp->h[5] += f; sp->h[6] += g; sp->h[7] += h; } #endif int sha256Update(register sha256Param* sp, const byte* data, size_t size) { register uint32_t proclength; #if (MP_WBITS == 64) mpw add[1]; mpsetw(1, add, size); mplshift(1, add, 3); mpadd(1, sp->length, add); #elif (MP_WBITS == 32) mpw add[2]; mpsetw(2, add, size); mplshift(2, add, 3); mpadd(2, sp->length, add); #else # error #endif while (size > 0) { proclength = ((sp->offset + size) > 64U) ? (64U - sp->offset) : size; memcpy(((byte *) sp->data) + sp->offset, data, proclength); size -= proclength; data += proclength; sp->offset += proclength; if (sp->offset == 64U) { sha256Process(sp); sp->offset = 0; } } return 0; } static void sha256Finish(register sha256Param* sp) { register byte *ptr = ((byte *) sp->data) + sp->offset++; *(ptr++) = 0x80; if (sp->offset > 56) { while (sp->offset++ < 64) *(ptr++) = 0; sha256Process(sp); sp->offset = 0; } ptr = ((byte *) sp->data) + sp->offset; while (sp->offset++ < 56) *(ptr++) = 0; #if (MP_WBITS == 64) ptr[0] = (byte)(sp->length[0] >> 56); ptr[1] = (byte)(sp->length[0] >> 48); ptr[2] = (byte)(sp->length[0] >> 40); ptr[3] = (byte)(sp->length[0] >> 32); ptr[4] = (byte)(sp->length[0] >> 24); ptr[5] = (byte)(sp->length[0] >> 16); ptr[6] = (byte)(sp->length[0] >> 8); ptr[7] = (byte)(sp->length[0] ); #elif (MP_WBITS == 32) ptr[0] = (byte)(sp->length[0] >> 24); ptr[1] = (byte)(sp->length[0] >> 16); ptr[2] = (byte)(sp->length[0] >> 8); ptr[3] = (byte)(sp->length[0] ); ptr[4] = (byte)(sp->length[1] >> 24); ptr[5] = (byte)(sp->length[1] >> 16); ptr[6] = (byte)(sp->length[1] >> 8); ptr[7] = (byte)(sp->length[1] ); #else # error #endif sha256Process(sp); sp->offset = 0; } int sha256Digest(register sha256Param* sp, byte* data) { sha256Finish(sp); /* encode 8 integers big-endian style */ data[ 0] = (byte)(sp->h[0] >> 24); data[ 1] = (byte)(sp->h[0] >> 16); data[ 2] = (byte)(sp->h[0] >> 8); data[ 3] = (byte)(sp->h[0] >> 0); data[ 4] = (byte)(sp->h[1] >> 24); data[ 5] = (byte)(sp->h[1] >> 16); data[ 6] = (byte)(sp->h[1] >> 8); data[ 7] = (byte)(sp->h[1] >> 0); data[ 8] = (byte)(sp->h[2] >> 24); data[ 9] = (byte)(sp->h[2] >> 16); data[10] = (byte)(sp->h[2] >> 8); data[11] = (byte)(sp->h[2] >> 0); data[12] = (byte)(sp->h[3] >> 24); data[13] = (byte)(sp->h[3] >> 16); data[14] = (byte)(sp->h[3] >> 8); data[15] = (byte)(sp->h[3] >> 0); data[16] = (byte)(sp->h[4] >> 24); data[17] = (byte)(sp->h[4] >> 16); data[18] = (byte)(sp->h[4] >> 8); data[19] = (byte)(sp->h[4] >> 0); data[20] = (byte)(sp->h[5] >> 24); data[21] = (byte)(sp->h[5] >> 16); data[22] = (byte)(sp->h[5] >> 8); data[23] = (byte)(sp->h[5] >> 0); data[24] = (byte)(sp->h[6] >> 24); data[25] = (byte)(sp->h[6] >> 16); data[26] = (byte)(sp->h[6] >> 8); data[27] = (byte)(sp->h[6] >> 0); data[28] = (byte)(sp->h[7] >> 24); data[29] = (byte)(sp->h[7] >> 16); data[30] = (byte)(sp->h[7] >> 8); data[31] = (byte)(sp->h[7] >> 0); sha256Reset(sp); return 0; } /*!\} */ beecrypt-4.2.1/rsapk.c0000644000175000001440000000255311216147021011534 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file rsapk.c * \brief RSA public key. * \author Bob Deblier * \ingroup IF_m IF_rsa_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/rsapk.h" /*!\addtogroup IF_rsa_m * \{ */ int rsapkInit(rsapk* pk) { memset(pk, 0, sizeof(rsapk)); /* or mpbzero(&pk->n); mpnzero(&pk->e); */ return 0; } int rsapkFree(rsapk* pk) { mpbfree(&pk->n); mpnfree(&pk->e); return 0; } int rsapkCopy(rsapk* dst, const rsapk* src) { mpbcopy(&dst->n, &src->n); mpncopy(&dst->e, &src->e); return 0; } /*!\} */ beecrypt-4.2.1/config.m4.in0000664000175000001440000000075510121754251012373 00000000000000dnl config.m4 ifdef(`__CONFIG_M4_INCLUDED__',,` define(`CONFIG_TOP_SRCDIR',`@top_srcdir@') define(`ASM_OS',`@ASM_OS@') define(`ASM_CPU',`@ASM_CPU@') define(`ASM_ARCH',`@ASM_ARCH@') define(`ASM_BIGENDIAN',`@ASM_BIGENDIAN@') define(`ASM_SRCDIR',`@top_srcdir@/gas') define(`TEXTSEG',`@ASM_TEXTSEG@') define(`GLOBL',`@ASM_GLOBL@') define(`GSYM_PREFIX',`@ASM_GSYM_PREFIX@') define(`LSYM_PREFIX',`@ASM_LSYM_PREFIX@') define(`ALIGN',`@ASM_ALIGN@') define(`__CONFIG_M4_INCLUDED__') ') @ASM_GNU_STACK@ beecrypt-4.2.1/docs/0000777000175000001440000000000011226307271011265 500000000000000beecrypt-4.2.1/docs/Makefile.in0000644000175000001440000002760611226307161013257 00000000000000# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am's purpose is to add the documentation html files to the dist # # Copyright (c) 2001 X-Way Rights BV # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = docs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = depcomp = am__depfiles_maybe = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ ASM_ALIGN = @ASM_ALIGN@ ASM_ARCH = @ASM_ARCH@ ASM_BIGENDIAN = @ASM_BIGENDIAN@ ASM_CPU = @ASM_CPU@ ASM_GLOBL = @ASM_GLOBL@ ASM_GNU_STACK = @ASM_GNU_STACK@ ASM_GSYM_PREFIX = @ASM_GSYM_PREFIX@ ASM_LSYM_PREFIX = @ASM_LSYM_PREFIX@ ASM_OS = @ASM_OS@ ASM_TEXTSEG = @ASM_TEXTSEG@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLUDE_DLFCN_H = @INCLUDE_DLFCN_H@ INCLUDE_INTTYPES_H = @INCLUDE_INTTYPES_H@ INCLUDE_MALLOC_H = @INCLUDE_MALLOC_H@ INCLUDE_PTHREAD_H = @INCLUDE_PTHREAD_H@ INCLUDE_SCHED_H = @INCLUDE_SCHED_H@ INCLUDE_SEMAPHORE_H = @INCLUDE_SEMAPHORE_H@ INCLUDE_STDINT_H = @INCLUDE_STDINT_H@ INCLUDE_STDIO_H = @INCLUDE_STDIO_H@ INCLUDE_STDLIB_H = @INCLUDE_STDLIB_H@ INCLUDE_STRING_H = @INCLUDE_STRING_H@ INCLUDE_SYNCH_H = @INCLUDE_SYNCH_H@ INCLUDE_THREAD_H = @INCLUDE_THREAD_H@ INCLUDE_UNISTD_H = @INCLUDE_UNISTD_H@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MP_WBITS = @MP_WBITS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ OPENMP_LIBS = @OPENMP_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TYPEDEF_BC_COND_T = @TYPEDEF_BC_COND_T@ TYPEDEF_BC_MUTEX_T = @TYPEDEF_BC_MUTEX_T@ TYPEDEF_BC_THREADID_T = @TYPEDEF_BC_THREADID_T@ TYPEDEF_BC_THREAD_T = @TYPEDEF_BC_THREAD_T@ TYPEDEF_INT16_T = @TYPEDEF_INT16_T@ TYPEDEF_INT32_T = @TYPEDEF_INT32_T@ TYPEDEF_INT64_T = @TYPEDEF_INT64_T@ TYPEDEF_INT8_T = @TYPEDEF_INT8_T@ TYPEDEF_SIZE_T = @TYPEDEF_SIZE_T@ TYPEDEF_UINT16_T = @TYPEDEF_UINT16_T@ TYPEDEF_UINT32_T = @TYPEDEF_UINT32_T@ TYPEDEF_UINT64_T = @TYPEDEF_UINT64_T@ TYPEDEF_UINT8_T = @TYPEDEF_UINT8_T@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_have_gcj = @ac_cv_have_gcj@ ac_cv_have_gcjh = @ac_cv_have_gcjh@ ac_cv_have_java = @ac_cv_have_java@ ac_cv_have_javac = @ac_cv_have_javac@ ac_cv_have_javah = @ac_cv_have_javah@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ javac = @javac@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu no-dependencies all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docs/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: beecrypt-4.2.1/docs/Makefile.am0000644000175000001440000000164511216147022013236 00000000000000# # Makefile.am's purpose is to add the documentation html files to the dist # # Copyright (c) 2001 X-Way Rights BV # # Author: Bob Deblier # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # AUTOMAKE_OPTIONS = gnu no-dependencies beecrypt-4.2.1/dlkp.c0000644000175000001440000000333311216147021011343 00000000000000/* * Copyright (c) 2000, 2001, 2002 X-Way Rights BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*!\file dlkp.c * \brief Discrete Logarithm keypair. * \author Bob Deblier * \ingroup DL_m */ #define BEECRYPT_DLL_EXPORT #if HAVE_CONFIG_H # include "config.h" #endif #include "beecrypt/dlkp.h" int dlkp_pPair(dlkp_p* kp, randomGeneratorContext* rgc, const dldp_p* param) { /* copy the parameters */ if (dldp_pCopy(&kp->param, param) < 0) return -1; if (dldp_pPair(param, rgc, &kp->x, &kp->y) < 0) return -1; return 0; } int dlkp_pInit(dlkp_p* kp) { if (dldp_pInit(&kp->param) < 0) return -1; mpnzero(&kp->y); mpnzero(&kp->x); return 0; } int dlkp_pFree(dlkp_p* kp) { if (dldp_pFree(&kp->param) < 0) return -1; mpnfree(&kp->y); /* wipe secret key before freeing */ mpnwipe(&kp->x); mpnfree(&kp->x); return 0; } int dlkp_pCopy(dlkp_p* dst, const dlkp_p* src) { if (dldp_pCopy(&dst->param, &src->param) < 0) return -1; mpncopy(&dst->y, &src->y); mpncopy(&dst->x, &src->x); return 0; } beecrypt-4.2.1/configure.ac0000644000175000001440000004337211226307126012547 00000000000000# Process this file with autoconf to produce a configure script. AC_INIT([beecrypt],[4.2.1],[bob.deblier@telenet.be]) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR(include/beecrypt/beecrypt.h) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE # Checks for AWK - used by expert mode AC_PROG_AWK # Checks for package options AC_ARG_ENABLE(expert-mode, [ --enable-expert-mode follow user-defined CFLAGS settings [[default=no]]],[ ac_enable_expert_mode=yes ],[ if test "X$CFLAGS" != "X"; then echo "enabling expert mode" ac_enable_expert_mode=yes else ac_enable_expert_mode=no fi ]) AC_ARG_ENABLE(debug, [ --enable-debug creates debugging code [[default=no]]],[ if test "$ac_enable_expert_mode" = yes; then AC_MSG_ERROR([--enable-debug cannot be used in conjunction with --enable-expert-mode]) fi ac_enable_debug=yes ],[ ac_enable_debug=no ]) AC_ARG_WITH(cpu,[ --with-cpu optimize for specific cpu],[A if test "$ac_enable_expert_mode" = yes; then AC_MSG_ERROR([--with-cpu cannot be used in conjunction with --enable-expert-mode]) fi BEE_WITH_CPU ],[ BEE_WITHOUT_CPU ]) AC_ARG_WITH(arch,[ --with-arch optimize for specific architecture (may not run on other cpus of same family)],[ if test "$ac_enable_expert_mode" = yes; then AC_MSG_ERROR([--with-arch cannot be used in conjunction with --enable-expert-mode]) fi BEE_WITH_ARCH ],[ BEE_WITHOUT_ARCH ]) AC_ARG_ENABLE(threads,[ --enable-threads enables multithread support [[default=yes]]],[ if test "$enableval" = no; then ac_enable_threads=no else ac_enable_threads=yes fi ],[ac_enable_threads=yes]) AC_ARG_ENABLE(aio,[ --enable-aio enables asynchronous i/o for entropy gathering [[default=yes]]],[ if test "$enableval" = no; then ac_enable_aio=no else ac_enable_aio=yes fi ],[ac_enable_aio=yes]) AH_TEMPLATE([ENABLE_AIO],[Define to 1 if you want to enable asynchronous I/O support]) AC_ARG_WITH(mtmalloc,[ --with-mtmalloc links against the mtmalloc library [[default=no]]],[ if test "$withval" = no; then ac_with_mtmalloc=no else ac_with_mtmalloc=yes fi ],[ac_with_mtmalloc=no]) AC_ARG_WITH(cplusplus,[ --with-cplusplus creates the C++ API code [[default=yes]]],[ if test "$withval" = no; then ac_with_cplusplus=no else ac_with_cplusplus=yes fi ],[ac_with_cplusplus=yes]) AC_ARG_WITH(java,[ --with-java creates the Java glue code [[default=yes]]],[ if test "$withval" = no; then ac_with_java=no else ac_with_java=yes fi ],[ac_with_java=yes]) AC_ARG_WITH(python,[ --with-python[[=ARG]] creates the Python module [[default=yes]]; you can optionally specify the python executable],[ if test "$withval" = no; then ac_with_python=no else ac_with_python=yes ac_with_python_val=$withval fi ],[ ac_with_python_val=`which python` if test "X$ac_with_python_val" = "X"; then ac_with_python=no else ac_with_python=yes fi ]) # Check for expert mode if test "$ac_enable_expert_mode" = yes; then BEE_EXPERT_MODE fi # Check for aggressive optimization BEE_AGGRESSIVE_OPT # Check for Unix variants AC_AIX # Checks for C compiler and preprocessor AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AC_PROG_CXXCPP AM_PROG_AS AC_PROG_LD AC_PROG_LN_S AC_PROG_EGREP AC_PROG_INSTALL AC_PROG_LIBTOOL # Checks for OpenMP support AC_LANG_PUSH(C) AC_OPENMP AC_LANG_POP(C) AC_LANG_PUSH(C++) AC_OPENMP AC_LANG_POP(C++) # Checks for compiler characteristics and flags if test "$ac_enable_expert_mode" = no; then BEE_CC BEE_CXX fi # Check for stack protection BEE_CC_NOEXECSTACK BEE_CXX_NOEXECSTACK # Checks for program flags needed by libtool BEE_LIBTOOL # Predefines for autoheader BEE_OS_DEFS AH_TEMPLATE([HAVE_ASSERT_H],[.]) AH_TEMPLATE([HAVE_CTYPE_H],[.]) AH_TEMPLATE([HAVE_ERRNO_H],[.]) AH_TEMPLATE([HAVE_FCNTL_H],[.]) AH_TEMPLATE([HAVE_STDIO_H],[.]) AH_TEMPLATE([HAVE_TERMIO_H],[.]) AH_TEMPLATE([HAVE_TERMIOS_H],[.]) AH_TEMPLATE([HAVE_TIME_H],[.]) AH_TEMPLATE([HAVE_DLFCN_H],[.]) AH_TEMPLATE([HAVE_SYS_AUDIOIO_H],[.]) AH_TEMPLATE([HAVE_SYS_IOCTL_H],[.]) AH_TEMPLATE([HAVE_SYS_MMAN_H],[.]) AH_TEMPLATE([HAVE_SYS_SOUNDCARD_H],[.]) AH_TEMPLATE([HAVE_SYS_STAT_H],[.]) AH_TEMPLATE([HAVE_SYS_TIME_H],[.]) AH_TEMPLATE([HAVE_SYS_TYPES_H],[.]) AH_TEMPLATE([HAVE_ENDIAN_H],[.]) AH_TEMPLATE([HAVE_ASM_BYTEORDER_H],[.]) AH_TEMPLATE([HAVE_AIO_H],[.]) AH_TEMPLATE([HAVE_DEV_AUDIO],[Define to 1 if your system has device /dev/audio]) AH_TEMPLATE([HAVE_DEV_DSP],[Define to 1 if your system has device /dev/dsp]) AH_TEMPLATE([HAVE_DEV_RANDOM],[Define to 1 if your system has device /dev/random]) AH_TEMPLATE([HAVE_DEV_URANDOM],[Define to 1 if your system has device /dev/urandom]) AH_TEMPLATE([HAVE_DEV_TTY],[Define to 1 if your system has device /dev/tty]) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([time.h sys/time.h]) AC_HEADER_TIME AC_CHECK_HEADERS([assert.h ctype.h errno.h fcntl.h malloc.h stdio.h termio.h termios.h]) AC_CHECK_HEADERS([sys/ioctl.h sys/mman.h sys/audioio.h sys/soundcard.h]) AC_CHECK_HEADERS([endian.h sys/endian.h asm/byteorder.h]) bc_include_stdio_h= bc_include_stdlib_h= bc_include_malloc_h= bc_include_string_h= bc_include_unistd_h= bc_include_dlfcn_h= if test "$ac_cv_header_stdio_h" = yes; then bc_include_stdio_h="#include " fi if test "$ac_cv_header_stdlib_h" = yes; then bc_include_stdlib_h="#include " elif test "$ac_cv_header_malloc_h" = yes; then bc_include_malloc_h="#include " fi if test "$ac_with_mtmalloc" = yes; then AC_CHECK_HEADERS(mtmalloc.h) if test "$ac_cv_header_mtmalloc_h" = yes; then bc_include_stdlib_h= bc_include_malloc_h="#include " fi fi if test "$ac_cv_header_string_h" = yes; then bc_include_string_h="#include " fi if test "$ac_cv_header_unistd_h" = yes; then bc_include_unistd_h="#include " fi if test "$ac_cv_header_dlfcn_h" = yes; then bc_include_dlfcn_h="#include " fi AC_SUBST(INCLUDE_STDIO_H,$bc_include_stdio_h) AC_SUBST(INCLUDE_STDLIB_H,$bc_include_stdlib_h) AC_SUBST(INCLUDE_MALLOC_H,$bc_include_malloc_h) AC_SUBST(INCLUDE_STRING_H,$bc_include_string_h) AC_SUBST(INCLUDE_UNISTD_H,$bc_include_unistd_h) AC_SUBST(INCLUDE_DLFCN_H,$bc_include_dlfcn_h) BEE_DLFCN BEE_MULTITHREAD BEE_THREAD_LOCAL_STORAGE # Checks for libraries. if test "$ac_enable_aio" = yes; then BEE_WORKING_AIO if test "$bc_cv_aio_works" = yes; then AC_DEFINE([ENABLE_AIO],1) fi fi if test "$ac_with_mtmalloc" = yes; then if test "$ac_cv_have_mtmalloc_h" = yes; then AC_CHECK_LIB([mtmalloc],[main]) ac_cv_lib_mtmalloc=ac_cv_lib_mtmalloc_main fi fi case $target_os in cygwin* | mingw*) AC_CHECK_LIB([winmm],[main]) ac_cv_lib_winmm=ac_cv_lib_winmm_main ;; esac # Checks for typedefs, structures, and compiler characteristics. AC_C_BIGENDIAN AC_C_CONST AC_C_INLINE AH_TEMPLATE([HAVE_INLINE],[.]) if test "$ac_cv_c_inline" != no; then AC_DEFINE([HAVE_INLINE],1) fi # Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_FUNC_STAT AC_CHECK_FUNCS([memset memcmp memmove strcspn strerror strspn]) AH_TEMPLATE([HAVE_NANOSLEEP],[.]) AH_TEMPLATE([HAVE_GETHRTIME],[.]) AH_TEMPLATE([HAVE_GETTIMEOFDAY],[.]) if test "$ac_cv_header_sys_time_h" = yes; then AC_CHECK_FUNCS([nanosleep]) AC_CHECK_FUNCS([gethrtime]) # gettimeofday detection fails on HP/UX! AC_MSG_CHECKING([for gettimeofday]) AC_TRY_LINK([#include ],[ struct timeval dummy; gettimeofday(&dummy, (void*) 0); ],[ AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_GETTIMEOFDAY],1) ac_cv_func_gettimeofday=yes ],[ AC_MSG_RESULT([no]) AC_DEFINE([HAVE_GETTIMEOFDAY],0) ac_cv_func_gettimeofday=no ]) fi # Predefines and checks for C++ API support AH_TEMPLATE([CPPGLUE],[Define to 1 if you want to include the C++ code]) if test "$ac_with_cplusplus" = yes; then AC_MSG_CHECKING([for IBM's ICU library version >= 2.8]) AC_LANG_PUSH(C) AC_RUN_IFELSE([ AC_LANG_PROGRAM([[#include ]],[[ #if U_ICU_VERSION_MAJOR_NUM < 2 exit(1); #elif U_ICU_VERSION_MAJOR_NUM == 2 # if U_ICU_VERSION_MINOR_NUM < 8 exit(1); # else exit(0); # endif #else exit(0); #endif ]])],[ AC_MSG_RESULT([yes]) ],[ AC_MSG_RESULT([no]) AC_MSG_WARN([disabling cplusplus]) ac_with_cplusplus=no ]) AC_LANG_POP(C) fi AM_CONDITIONAL([WITH_CPLUSPLUS],[test "$ac_with_cplusplus" = yes]) if test "$ac_with_cplusplus" = yes ; then AC_DEFINE([CPPGLUE],1) fi # Predefines and checks for Java API support AH_TEMPLATE([JAVAGLUE],[Define to 1 if you want to include the Java code]) if test "$ac_with_java" = yes ; then AC_CHECK_PROG(ac_cv_have_gcj, gcj, yes, no) AC_CHECK_PROG(ac_cv_have_gcjh, gcjh, yes, no) if test "$ac_cv_have_gcj" = yes; then AC_SUBST(javac,gcj) AC_CACHE_CHECK([for java native interface headers], ac_cv_java_include, [ cat > conftest.java << EOF public class conftest { public static void main(String[[]] argv) { System.out.println(System.getProperty("java.home")); } } EOF java_home="`gcj --main=conftest -o conftest conftest.java; ./conftest`" if test X"$java_home" = X; then java_home=/usr fi if test -d "$java_home" -a -d "$java_home/include"; then ac_cv_java_headers=yes ac_cv_java_include="-I$java_home/include" gcjpath="$java_home/lib/gcc-lib/`gcj -dumpmachine`/`gcj -dumpversion`" if test -d "$gcjpath" -a -d "$gcjpath/include"; then ac_cv_java_include="$ac_cv_java_include -I$gcjpath/include" fi else # we have a non-working gcj ac_cv_have_gcj=no fi rm -fr conftest* ]) fi # gcj may have failed; in this case we want to try for a real java if test "$ac_cv_have_gcj" != yes; then AC_CHECK_PROG(ac_cv_have_java, java, yes, no) if test "$ac_cv_have_java" = yes; then AC_CHECK_PROG(ac_cv_have_javac, javac, yes, no) AC_CHECK_PROG(ac_cv_have_javah, javah, yes, no) if test "$ac_cv_have_javac" = yes; then AC_SUBST(javac,javac) AC_CACHE_CHECK([for java native interface headers],ac_cv_java_include,[ cat > conftest.java << EOF public class conftest { public static void main(String[[]] argv) { System.out.println(System.getProperty("java.home")); } } EOF java_home=`javac conftest.java; java -classpath . conftest` case $target_os in cygwin*) java_home=`cygpath -u -p "$java_home"` ;; esac if test -d "$java_home"; then case $target_os in darwin*) java_include="$java_home/../../../Headers" ;; *) java_include="$java_home"/../include ;; esac if test -d "$java_include"; then ac_cv_java_headers=yes ac_cv_java_include="-I$java_include" case $target_os in aix*) ac_cv_java_include="-I$java_include -I$java_include/aix" ;; cygwin*) ac_cv_java_include="-I$java_include -I$java_include/win32" ;; darwin*) ;; hpux*) ac_cv_java_include="-I$java_include -I$java_include/hpux" ;; linux*) ac_cv_java_include="-I$java_include -I$java_include/linux" ;; osf*) ac_cv_java_include="-I$java_include -I$java_include/osf" ;; solaris*) ac_cv_java_include="-I$java_include -I$java_include/solaris" ;; *) AC_MSG_WARN([please add appropriate -I$java_include/ flag]) ac_cv_java_include="-I$java_include" ;; esac else AC_MSG_WARN([java headers not found, disabling java]) ac_cv_java_headers=no ac_cv_java_include= ac_with_java=no fi fi rm -fr conftest* ]) else AC_MSG_WARN([javac not found, disabling java]) ac_cv_java_headers=no ac_cv_java_include= ac_with_java=no fi else AC_MSG_WARN([java not found, disabling java]) ac_cv_java_headers=no ac_with_java=no fi fi fi AM_CONDITIONAL([WITH_JAVA],[test "$ac_with_java" = yes]) if test "$ac_with_java" = yes ; then AC_DEFINE([JAVAGLUE],1) CPPFLAGS="$CPPFLAGS $ac_cv_java_include" fi # Predefines and checks for Python API support AH_TEMPLATE([PYTHONGLUE],[Define to 1 if you want to include the Python code]) if test "$ac_with_python" = yes ; then AC_PATH_PROG([PYTHON], `basename $ac_with_python_val`, [no], `AS_DIRNAME(["$ac_with_python_val"])`) if test "$PYTHON" = no; then ac_with_python=no else AC_CACHE_CHECK([for python headers], ac_cv_python_include, [ ac_cv_python_include="-I`$PYTHON -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_inc()'`" ]) AC_CACHE_CHECK([where to install python libraries], ac_cv_python_libdir, [ ac_cv_python_libdir=`$PYTHON -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()'` ]) fi fi AM_CONDITIONAL([WITH_PYTHON],[test "$ac_with_python" = yes]) if test "$ac_with_python" = yes; then AC_DEFINE([PYTHONGLUE],1) AC_SUBST(PYTHONINC,$ac_cv_python_include) AC_SUBST(PYTHONLIB,$ac_cv_python_libdir) fi # Checks for entropy sources. AC_MSG_CHECKING([for platform-specific entropy devices]) AC_MSG_RESULT() case $target_os in cygwin* | mingw*) AC_MSG_CHECKING([for wavein]) AC_MSG_RESULT(yes) AC_MSG_CHECKING([for wincrypt]) AC_MSG_RESULT(yes) AC_MSG_CHECKING([for console]) AC_MSG_RESULT(yes) ;; linux*) AC_CACHE_CHECK([for /dev/dsp],ac_cv_have_dev_dsp,[ if test -r /dev/dsp; then ac_cv_have_dev_dsp=yes else ac_cv_have_dev_dsp=no fi ]) if test "$ac_cv_have_dev_dsp" = yes; then AC_DEFINE([HAVE_DEV_DSP], 1) fi ;; solaris*) AC_CACHE_CHECK([for /dev/audio],ac_cv_have_dev_audio,[ if test -r /dev/audio; then ac_cv_have_dev_audio=yes else ac_cv_have_dev_audio=no fi ]) if test "$ac_cv_have_dev_audio" = yes; then AC_DEFINE([HAVE_DEV_AUDIO], 1) fi ;; *) AC_MSG_WARN(no specific entropy devices present) ;; esac case $target_os in cygwin* | mingw*) ;; *) AC_MSG_CHECKING([for generic entropy devices]) AC_MSG_RESULT() AC_CACHE_CHECK([for /dev/random],ac_cv_have_dev_random,[ if test -r /dev/random; then ac_cv_have_dev_random=yes else ac_cv_have_dev_random=no fi ]) AC_CACHE_CHECK([for /dev/urandom],ac_cv_have_dev_urandom,[ if test -r /dev/urandom; then ac_cv_have_dev_urandom=yes else ac_cv_have_dev_urandom=no fi ]) AC_CACHE_CHECK([for /dev/tty],ac_cv_have_dev_tty,[ if test -r /dev/tty; then ac_cv_have_dev_tty=yes else ac_cv_have_dev_tty=no fi ]) ;; esac if test "$ac_cv_have_dev_random" = yes; then AC_DEFINE([HAVE_DEV_RANDOM],1) fi if test "$ac_cv_have_dev_urandom" = yes; then AC_DEFINE([HAVE_DEV_URANDOM],1) fi if test "$ac_cv_have_dev_tty" = yes; then AC_DEFINE([HAVE_DEV_TTY],1) fi # Figure out extra flags if test "$ac_enable_debug" != yes; then case $bc_target_arch in alpha*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_ALPHA" ;; arm*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_ARM" ;; x86_64 | athlon64 | athlon-fx | k8 | opteron | em64t | nocona) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_X86_64" ;; athlon*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX" ;; i386) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I386" ;; i486) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I486" ;; i586) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I586" ;; i686) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686" ;; ia64) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_IA64" ;; m68k) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_M68K" ;; pentium) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I586" ;; pentium-m) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX -DOPTIMIZE_SSE -DOPTIMIZE_SSE2" ;; pentium-mmx) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I586 -DOPTIMIZE_MMX" ;; pentiumpro) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686" ;; pentium2) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX" ;; pentium3) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX -DOPTIMIZE_SSE" ;; pentium4) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_I686 -DOPTIMIZE_MMX -DOPTIMIZE_SSE -DOPTIMIZE_SSE2" ;; powerpc) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_POWERPC" ;; powerpc64) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_POWERPC64" ;; s390x) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_S390X" ;; sparcv8) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SPARCV8" ;; sparcv8plus*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SPARCV8PLUS" ;; sparcv9*) CPPFLAGS="$CPPFLAGS -DOPTIMIZE_SPARCV9" ;; esac fi if test "$ac_enable_debug" != yes; then # find out how to use assembler BEE_ASM_DEFS BEE_ASM_TEXTSEG BEE_ASM_GLOBL BEE_ASM_GSYM_PREFIX BEE_ASM_LSYM_PREFIX BEE_ASM_ALIGN fi # generate assembler source files from m4 files BEE_ASM_SOURCES # Check for standard types and integers of specific sizes BEE_INT_TYPES BEE_CPU_BITS # Generate output files. AC_CONFIG_FILES([ Makefile config.m4 include/Makefile include/beecrypt/Doxyfile include/beecrypt/c++/Doxyfile c++/Makefile c++/beeyond/Makefile c++/crypto/Makefile c++/crypto/spec/Makefile c++/io/Makefile c++/lang/Makefile c++/math/Makefile c++/nio/Makefile c++/provider/Makefile c++/security/Makefile c++/security/auth/Makefile c++/security/cert/Makefile c++/security/spec/Makefile c++/util/Makefile c++/util/concurrent/Makefile c++/util/concurrent/locks/Makefile docs/Makefile gas/Makefile java/Makefile java/build.xml masm/Makefile python/Makefile python/test/Makefile tests/Makefile ]) AC_CONFIG_FILES([gnu.h],[ cp gnu.h $ac_top_srcdir/include/beecrypt/gnu.h ]) AC_OUTPUT beecrypt-4.2.1/BUGS0000644000175000001440000000172111226045774010744 00000000000000Legend: - = open bug * = fixed bug 4.2.0: - Sparc / Solaris 64-bit with gcc fails during link of library with error due to wrong ELF class: this is actually a bug in Sun's gcc profiles, which tries to link 32-bit libraries in 64-bit mode. 4.1.0: - SuSE 9.2 (x86) compiler is buggy: the MMX-optimized version fails all test vectors. Since all other Linux distro's handle this perfectly it is up to them to fix this bug. 3.0.0: - Can't seem to generate 64-bit shared libraries on AIX; use --disable-shared on this platform for now. - Intel icc can't cope with gcj headers. There's also a problem in combination with aio.h; solution should be to not test gcj when using this compiler. As a workaround, you can specify --without-javaglue. - GCC 3.3 produces faster output for Blowfish on Pentium 4 than the included assembler source; try coding two Blowfish rounds (without swap) in C and compile to assembler to see how GCC accomplishes this.