| beecrypt.h | | beecrypt.h | |
| /* | | /* | |
| * beecrypt.h | | * beecrypt.h | |
| * | | * | |
| * Beecrypt library hooks & stubs, header | | * Beecrypt library hooks & stubs, header | |
| * | | * | |
|
| * Copyright (c) 1999, 2000 Virtual Unlimited B.V. | | * Copyright (c) 1999, 2000, 2001 Virtual Unlimited B.V. | |
| * | | * | |
| * Author: Bob Deblier <bob@virtualunlimited.com> | | * Author: Bob Deblier <bob@virtualunlimited.com> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * version 2.1 of the License, or (at your option) any later version. | |
| * | | * | |
| * This library is distributed in the hope that it will be useful, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 210 | | skipping to change at line 210 | |
| * The following functions can be used to initialize and free a | | * The following functions can be used to initialize and free a | |
| * randomGeneratorContext. Initializing will allocate a buffer of the size | | * randomGeneratorContext. Initializing will allocate a buffer of the size | |
| * required by the randomGenerator, freeing will deallocate that buffer. | | * required by the randomGenerator, freeing will deallocate that buffer. | |
| */ | | */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void randomGeneratorContextInit(randomGeneratorContext*, const randomGenera
tor*); | | int randomGeneratorContextInit(randomGeneratorContext*, const randomGenerat
or*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void randomGeneratorContextFree(randomGeneratorContext*); | | int randomGeneratorContextFree(randomGeneratorContext*); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| * Hash Functions | | * Hash Functions | |
| */ | | */ | |
| | | | |
| typedef void hashFunctionParam; | | typedef void hashFunctionParam; | |
| | | | |
| skipping to change at line 250 | | skipping to change at line 250 | |
| * int (*update)(hashFunctionParam* param, const byte* data, int size); | | * int (*update)(hashFunctionParam* param, const byte* data, int size); | |
| * | | * | |
| * This function updates the hash function with an array of bytes. | | * This function updates the hash function with an array of bytes. | |
| * Return value is 0 on success, or -1 on failure. | | * Return value is 0 on success, or -1 on failure. | |
| * | | * | |
| * int (*digest)(hashFunctionParam* param, uint32* data); | | * int (*digest)(hashFunctionParam* param, uint32* data); | |
| * | | * | |
| * This function computes the digest of all the data passed to the hash | | * This function computes the digest of all the data passed to the hash | |
| * function, and stores the result in data. | | * function, and stores the result in data. | |
| * Return value is 0 on success, or -1 on failure. | | * Return value is 0 on success, or -1 on failure. | |
|
| * NOTE: data must be at least have a bytesize of 'digestsize' as described | | * NOTE: data MUST have a size (in bytes) of at least 'digestsize' as descr
ibed | |
| * in the hashFunction struct. | | * in the hashFunction struct. | |
| * NOTE: for safety reasons, after calling digest, each specific implementa
tion | | * NOTE: for safety reasons, after calling digest, each specific implementa
tion | |
| * MUST reset itself so that previous values in the parameters are erased. | | * MUST reset itself so that previous values in the parameters are erased. | |
| */ | | */ | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| const char* name; | | const char* name; | |
| const unsigned int paramsize; /* in bytes
*/ | | const unsigned int paramsize; /* in bytes
*/ | |
|
| | | const unsigned int blocksize; /* in bytes
*/ | |
| const unsigned int digestsize; /* in bytes
*/ | | const unsigned int digestsize; /* in bytes
*/ | |
| const hashFunctionReset reset; | | const hashFunctionReset reset; | |
| const hashFunctionUpdate update; | | const hashFunctionUpdate update; | |
| const hashFunctionDigest digest; | | const hashFunctionDigest digest; | |
| } hashFunction; | | } hashFunction; | |
| | | | |
| /* | | /* | |
| * You can use the following functions to find hash functions implemented b
y | | * You can use the following functions to find hash functions implemented b
y | |
| * the library: | | * the library: | |
| * | | * | |
| | | | |
| skipping to change at line 319 | | skipping to change at line 320 | |
| * The following functions can be used to initialize and free a | | * The following functions can be used to initialize and free a | |
| * hashFunctionContext. Initializing will allocate a buffer of the size | | * hashFunctionContext. Initializing will allocate a buffer of the size | |
| * required by the hashFunction, freeing will deallocate that buffer. | | * required by the hashFunction, freeing will deallocate that buffer. | |
| */ | | */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void hashFunctionContextInit(hashFunctionContext*, const hashFunction*); | | int hashFunctionContextInit(hashFunctionContext*, const hashFunction*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void hashFunctionContextFree(hashFunctionContext*); | | int hashFunctionContextFree(hashFunctionContext*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int hashFunctionContextReset(hashFunctionContext*); | | int hashFunctionContextReset(hashFunctionContext*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int hashFunctionContextUpdate(hashFunctionContext*, const byte*, int); | | int hashFunctionContextUpdate(hashFunctionContext*, const byte*, int); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int hashFunctionContextUpdateMC(hashFunctionContext*, const memchunk*); | | int hashFunctionContextUpdateMC(hashFunctionContext*, const memchunk*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int hashFunctionContextUpdateMP32(hashFunctionContext*, const mp32number*); | | int hashFunctionContextUpdateMP32(hashFunctionContext*, const mp32number*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int hashFunctionContextDigest(hashFunctionContext*, mp32number*); | | int hashFunctionContextDigest(hashFunctionContext*, mp32number*); | |
|
| | | BEEDLLAPI | |
| | | int hashFunctionContextDigestMatch(hashFunctionContext*, const mp32number*) | |
| | | ; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| * Keyed Hash Functions, a.k.a. Message Authentication Codes | | * Keyed Hash Functions, a.k.a. Message Authentication Codes | |
| */ | | */ | |
| | | | |
| typedef void keyedHashFunctionParam; | | typedef void keyedHashFunctionParam; | |
| | | | |
| skipping to change at line 392 | | skipping to change at line 395 | |
| * NOTE: data must be at least have a bytesize of 'digestsize' as described | | * NOTE: data must be at least have a bytesize of 'digestsize' as described | |
| * in the keyedHashFunction struct. | | * in the keyedHashFunction struct. | |
| * NOTE: for safety reasons, after calling digest, each specific implementa
tion | | * NOTE: for safety reasons, after calling digest, each specific implementa
tion | |
| * MUST reset itself so that previous values in the parameters are erased. | | * MUST reset itself so that previous values in the parameters are erased. | |
| */ | | */ | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| const char* name; | | const char* name; | |
| const unsigned int paramsize; /* i
n bytes */ | | const unsigned int paramsize; /* i
n bytes */ | |
|
| | | const unsigned int blocksize; /* i
n bytes */ | |
| const unsigned int digestsize; /* i
n bytes */ | | const unsigned int digestsize; /* i
n bytes */ | |
| const unsigned int keybitsmin; /* i
n bits */ | | const unsigned int keybitsmin; /* i
n bits */ | |
| const unsigned int keybitsmax; /* i
n bits */ | | const unsigned int keybitsmax; /* i
n bits */ | |
| const unsigned int keybitsinc; /* i
n bits */ | | const unsigned int keybitsinc; /* i
n bits */ | |
| const keyedHashFunctionSetup setup; | | const keyedHashFunctionSetup setup; | |
| const keyedHashFunctionReset reset; | | const keyedHashFunctionReset reset; | |
| const keyedHashFunctionUpdate update; | | const keyedHashFunctionUpdate update; | |
| const keyedHashFunctionDigest digest; | | const keyedHashFunctionDigest digest; | |
| } keyedHashFunction; | | } keyedHashFunction; | |
| | | | |
| /* | | /* | |
| * You can use the following functions to find keyed hash functions impleme
nted | | * You can use the following functions to find keyed hash functions impleme
nted | |
| * by the library: | | * by the library: | |
| * | | * | |
| * keyedHashFunctionCount returns the number of keyed hash functions availa
ble. | | * keyedHashFunctionCount returns the number of keyed hash functions availa
ble. | |
| * | | * | |
|
| * keyedHashFunctionGet returns the random generator with a given index | | * keyedHashFunctionGet returns the keyed hash function with a given index | |
| * (starting at zero, up to keyedHashFunctionCount() - 1), or NULL if the i
ndex | | * (starting at zero, up to keyedHashFunctionCount() - 1), or NULL if the i
ndex | |
| * was out of bounds. | | * was out of bounds. | |
| * | | * | |
| * keyedHashFunctionFind returns the keyed hash function with the given nam
e, | | * keyedHashFunctionFind returns the keyed hash function with the given nam
e, | |
| * or NULL if no keyed hash function exists with that name. | | * or NULL if no keyed hash function exists with that name. | |
| */ | | */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 455 | | skipping to change at line 459 | |
| * The following functions can be used to initialize and free a | | * The following functions can be used to initialize and free a | |
| * keyedHashFunctionContext. Initializing will allocate a buffer of the siz
e | | * keyedHashFunctionContext. Initializing will allocate a buffer of the siz
e | |
| * required by the keyedHashFunction, freeing will deallocate that buffer. | | * required by the keyedHashFunction, freeing will deallocate that buffer. | |
| */ | | */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void keyedHashFunctionContextInit(keyedHashFunctionContext*, const keyedHas
hFunction*); | | int keyedHashFunctionContextInit(keyedHashFunctionContext*, const keyedHash
Function*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void keyedHashFunctionContextFree(keyedHashFunctionContext*); | | int keyedHashFunctionContextFree(keyedHashFunctionContext*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int keyedHashFunctionContextSetup(keyedHashFunctionContext*, const uint32*,
int); | | int keyedHashFunctionContextSetup(keyedHashFunctionContext*, const uint32*,
int); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int keyedHashFunctionContextReset(keyedHashFunctionContext*); | | int keyedHashFunctionContextReset(keyedHashFunctionContext*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int keyedHashFunctionContextUpdate(keyedHashFunctionContext*, const byte*,
int); | | int keyedHashFunctionContextUpdate(keyedHashFunctionContext*, const byte*,
int); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int keyedHashFunctionContextUpdateMC(keyedHashFunctionContext*, const memch
unk*); | | int keyedHashFunctionContextUpdateMC(keyedHashFunctionContext*, const memch
unk*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int keyedHashFunctionContextUpdateMP32(keyedHashFunctionContext*, const mp3
2number*); | | int keyedHashFunctionContextUpdateMP32(keyedHashFunctionContext*, const mp3
2number*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int keyedHashFunctionContextDigest(keyedHashFunctionContext*, mp32number*); | | int keyedHashFunctionContextDigest(keyedHashFunctionContext*, mp32number*); | |
|
| | | BEEDLLAPI | |
| | | int keyedHashFunctionContextDigestMatch(keyedHashFunctionContext*, const mp | |
| | | 32number*); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| * Block ciphers | | * Block ciphers | |
| */ | | */ | |
| | | | |
| typedef enum | | typedef enum | |
| | | | |
| skipping to change at line 609 | | skipping to change at line 615 | |
| * The following functions can be used to initialize and free a | | * The following functions can be used to initialize and free a | |
| * blockCipherContext. Initializing will allocate a buffer of the size | | * blockCipherContext. Initializing will allocate a buffer of the size | |
| * required by the blockCipher, freeing will deallocate that buffer. | | * required by the blockCipher, freeing will deallocate that buffer. | |
| */ | | */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void blockCipherContextInit(blockCipherContext*, const blockCipher*); | | int blockCipherContextInit(blockCipherContext*, const blockCipher*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void blockCipherContextSetup(blockCipherContext*, const uint32*, int, ciphe
rOperation); | | int blockCipherContextSetup(blockCipherContext*, const uint32*, int, cipher
Operation); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void blockCipherContextSetIV(blockCipherContext*, const uint32*); | | int blockCipherContextSetIV(blockCipherContext*, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void blockCipherContextFree(blockCipherContext*); | | int blockCipherContextFree(blockCipherContext*); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 17 change blocks. |
| 13 lines changed or deleted | | 21 lines changed or added | |
|
| dldp.h | | dldp.h | |
| /* | | /* | |
| * dldp.h | | * dldp.h | |
| * | | * | |
| * Discrete Logarithm Domain Parameters, header | | * Discrete Logarithm Domain Parameters, header | |
| * | | * | |
| * <conformance statement for IEEE P1363 needed here> | | * <conformance statement for IEEE P1363 needed here> | |
| * | | * | |
|
| * Copyright (c) 2000 Virtual Unlimited B.V. | | * Copyright (c) 2000, 2001 Virtual Unlimited B.V. | |
| * | | * | |
| * Author: Bob Deblier <bob@virtualunlimited.com> | | * Author: Bob Deblier <bob@virtualunlimited.com> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * version 2.1 of the License, or (at your option) any later version. | |
| * | | * | |
| * This library is distributed in the hope that it will be useful, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| | | | |
| #ifndef _DLDP_H | | #ifndef _DLDP_H | |
| #define _DLDP_H | | #define _DLDP_H | |
| | | | |
| #include "beecrypt.h" | | #include "beecrypt.h" | |
| #include "mp32barrett.h" | | #include "mp32barrett.h" | |
| | | | |
| /* | | /* | |
| * Discrete Logarithm Domain Parameters - Prime | | * Discrete Logarithm Domain Parameters - Prime | |
| * | | * | |
|
| * Standard definition where p = 2qr+1; in case where p=2q+1, r=1 | | * Standard definition where p = qr+1; in case where p=2q+1, r=2 | |
| * | | * | |
|
| * IEEE P1363 definition is p = rk+1 | | * In IEEE P1363 naming is p = rk+1 | |
| * | | * | |
|
| * Hence, IEEE r = q and IEEE cofactor k = 2 or k = 2r | | * Hence, IEEE prime r = q and cofactor k = r | |
| * | | * | |
| * Make sure q is large enough to foil Pohlig-Hellman attacks | | * Make sure q is large enough to foil Pohlig-Hellman attacks | |
| * See: "Handbook of Applied Cryptography", Chapter 3.6.4 | | * See: "Handbook of Applied Cryptography", Chapter 3.6.4 | |
| * | | * | |
| * g is either a generator of a subgroup of order q, or a generator of orde
r | | * g is either a generator of a subgroup of order q, or a generator of orde
r | |
| * n = (p-1) | | * n = (p-1) | |
| */ | | */ | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 68 | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| * Functions for setting up and copying | | * Functions for setting up and copying | |
| */ | | */ | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pInit(dldp_p*); | | int dldp_pInit(dldp_p*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pFree(dldp_p*); | | int dldp_pFree(dldp_p*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pCopy(dldp_p*, const dldp_p*); | | int dldp_pCopy(dldp_p*, const dldp_p*); | |
| | | | |
| /* | | /* | |
| * Functions for generating keys | | * Functions for generating keys | |
| */ | | */ | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pPrivate(const dldp_p*, randomGeneratorContext*, mp32number*); | | int dldp_pPrivate(const dldp_p*, randomGeneratorContext*, mp32number*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pPublic (const dldp_p*, const mp32number*, mp32number*); | | int dldp_pPublic (const dldp_p*, const mp32number*, mp32number*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pPair (const dldp_p*, randomGeneratorContext*, mp32number*, mp3
2number*); | | int dldp_pPair (const dldp_p*, randomGeneratorContext*, mp32number*, mp32
number*); | |
| | | | |
| /* | | /* | |
| * Function for comparing domain parameters | | * Function for comparing domain parameters | |
| */ | | */ | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| int dldp_pEqual (const dldp_p*, const dldp_p*); | | int dldp_pEqual (const dldp_p*, const dldp_p*); | |
| | | | |
| /* | | /* | |
| * Functions for generating and validating dldp_pgoq variant domain paramet
ers | | * Functions for generating and validating dldp_pgoq variant domain paramet
ers | |
| */ | | */ | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pgoqMake (dldp_p*, randomGeneratorContext*, uint32, uint32, i
nt); | | int dldp_pgoqMake (dldp_p*, randomGeneratorContext*, uint32, uint32, in
t); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pgoqMakeSafe (dldp_p*, randomGeneratorContext*, uint32); | | int dldp_pgoqMakeSafe (dldp_p*, randomGeneratorContext*, uint32); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pgoqGenerator(dldp_p*, randomGeneratorContext*); | | int dldp_pgoqGenerator(dldp_p*, randomGeneratorContext*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int dldp_pgoqValidate (const dldp_p*, randomGeneratorContext*, int); | | int dldp_pgoqValidate (const dldp_p*, randomGeneratorContext*, int); | |
| | | | |
| /* | | /* | |
| * Functions for generating and validating dldp_pgon variant domain paramet
ers | | * Functions for generating and validating dldp_pgon variant domain paramet
ers | |
| */ | | */ | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pgonMake (dldp_p*, randomGeneratorContext*, uint32, uint32); | | int dldp_pgonMake (dldp_p*, randomGeneratorContext*, uint32, uint32); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pgonMakeSafe (dldp_p*, randomGeneratorContext*, uint32); | | int dldp_pgonMakeSafe (dldp_p*, randomGeneratorContext*, uint32); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void dldp_pgonGenerator(dldp_p*, randomGeneratorContext*); | | int dldp_pgonGenerator(dldp_p*, randomGeneratorContext*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int dldp_pgonValidate (const dldp_p*, randomGeneratorContext*); | | int dldp_pgonValidate (const dldp_p*, randomGeneratorContext*); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 16 change blocks. |
| 16 lines changed or deleted | | 16 lines changed or added | |
|
| elgamal.h | | elgamal.h | |
| /* | | /* | |
| * elgamal.h | | * elgamal.h | |
| * | | * | |
| * ElGamal signature scheme, header | | * ElGamal signature scheme, header | |
| * | | * | |
|
| * Copyright (c) 2000 Virtual Unlimited B.V. | | * Copyright (c) 2000, 2001 Virtual Unlimited B.V. | |
| * | | * | |
| * Author: Bob Deblier <bob@virtualunlimited.com> | | * Author: Bob Deblier <bob@virtualunlimited.com> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * version 2.1 of the License, or (at your option) any later version. | |
| * | | * | |
| * This library is distributed in the hope that it will be useful, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _ELGAMAL_H | | #ifndef _ELGAMAL_H | |
| #define _ELGAMAL_H | | #define _ELGAMAL_H | |
| | | | |
|
| #include "mp32number.h" | | | |
| #include "mp32barrett.h" | | #include "mp32barrett.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void elgv1sign(const mp32barrett* p, const mp32barrett* n, const mp32number
* g, randomGeneratorContext*, const mp32number* hm, const mp32number* x, mp
32number* r, mp32number* s); | | int elgv1sign(const mp32barrett* p, const mp32barrett* n, const mp32number*
g, randomGeneratorContext*, const mp32number* hm, const mp32number* x, mp3
2number* r, mp32number* s); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void elgv3sign(const mp32barrett* p, const mp32barrett* n, const mp32number
* g, randomGeneratorContext*, const mp32number* hm, const mp32number* x, mp
32number* r, mp32number* s); | | int elgv3sign(const mp32barrett* p, const mp32barrett* n, const mp32number*
g, randomGeneratorContext*, const mp32number* hm, const mp32number* x, mp3
2number* r, mp32number* s); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| int elgv1vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number*
g, const mp32number* hm, const mp32number* y, const mp32number* r, const m
p32number* s); | | int elgv1vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number*
g, const mp32number* hm, const mp32number* y, const mp32number* r, const m
p32number* s); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int elgv3vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number*
g, const mp32number* hm, const mp32number* y, const mp32number* r, const m
p32number* s); | | int elgv3vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number*
g, const mp32number* hm, const mp32number* y, const mp32number* r, const m
p32number* s); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 3 lines changed or added | |
|
| endianness.h | | endianness.h | |
| /* | | /* | |
| * endianness.h | | * endianness.h | |
| * | | * | |
| * Endian-dependant encoding/decoding, header | | * Endian-dependant encoding/decoding, header | |
| * | | * | |
|
| * Copyright (c) 1998, 1999, 2000 Virtual Unlimited B.V. | | * Copyright (c) 1998, 1999, 2000, 2001 Virtual Unlimited B.V. | |
| * | | * | |
| * Author: Bob Deblier <bob@virtualunlimited.com> | | * Author: Bob Deblier <bob@virtualunlimited.com> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * version 2.1 of the License, or (at your option) any later version. | |
| * | | * | |
| * This library is distributed in the hope that it will be useful, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 78 | | skipping to change at line 78 | |
| #else | | #else | |
| return ( ((n & 0xffUL) << 24) | | | return ( ((n & 0xffUL) << 24) | | |
| ((n & 0xff00UL) << 8) | | | ((n & 0xff00UL) << 8) | | |
| ((n & 0xff0000UL) >> 8) | | | ((n & 0xff0000UL) >> 8) | | |
| ((n & 0xff000000UL) >> 24) ); | | ((n & 0xff000000UL) >> 24) ); | |
| #endif | | #endif | |
| } | | } | |
| | | | |
| inline int64 swap64(int64 n) | | inline int64 swap64(int64 n) | |
| { | | { | |
|
| #if (SIZEOF_LONG == 4) | | #if HAVE_LONG_LONG | |
| return ( ((n & 0xffLL) << 56) | | | return ( ((n & 0xffLL) << 56) | | |
| ((n & 0xff00LL) << 40) | | | ((n & 0xff00LL) << 40) | | |
| ((n & 0xff0000LL) << 24) | | | ((n & 0xff0000LL) << 24) | | |
| ((n & 0xff000000LL) << 8) | | | ((n & 0xff000000LL) << 8) | | |
| ((n & 0xff00000000LL) >> 8) | | | ((n & 0xff00000000LL) >> 8) | | |
| ((n & 0xff0000000000LL) >> 24) | | | ((n & 0xff0000000000LL) >> 24) | | |
| ((n & 0xff000000000000LL) >> 40) | | | ((n & 0xff000000000000LL) >> 40) | | |
| ((n & 0xff00000000000000LL) >> 56) ); | | ((n & 0xff00000000000000LL) >> 56) ); | |
| #else | | #else | |
| return ( ((n & 0xffL) << 56) | | | return ( ((n & 0xffL) << 56) | | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 129 | |
| BEEDLLAPI | | BEEDLLAPI | |
| int encodeChar(javachar, byte*); | | int encodeChar(javachar, byte*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int encodeFloat(javafloat, byte*); | | int encodeFloat(javafloat, byte*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int encodeDouble(javadouble, byte*); | | int encodeDouble(javadouble, byte*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| int encodeInts(const javaint*, byte*, int); | | int encodeInts(const javaint*, byte*, int); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| | | int encodeIntsPartial(const javaint*, byte*, int); | |
| | | BEEDLLAPI | |
| int encodeChars(const javachar*, byte*, int); | | int encodeChars(const javachar*, byte*, int); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| int decodeByte(javabyte*, const byte*); | | int decodeByte(javabyte*, const byte*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int decodeShort(javashort*, const byte*); | | int decodeShort(javashort*, const byte*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int decodeInt(javaint*, const byte*); | | int decodeInt(javaint*, const byte*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int decodeLong(javalong*, const byte*); | | int decodeLong(javalong*, const byte*); | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 4 lines changed or added | |
|
| mp32.h | | mp32.h | |
| | | | |
| skipping to change at line 97 | | skipping to change at line 97 | |
| BEEDLLAPI | | BEEDLLAPI | |
| int mp32ltx(uint32, const uint32*, uint32, const uint32*); | | int mp32ltx(uint32, const uint32*, uint32, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int mp32gex(uint32, const uint32*, uint32, const uint32*); | | int mp32gex(uint32, const uint32*, uint32, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int mp32lex(uint32, const uint32*, uint32, const uint32*); | | int mp32lex(uint32, const uint32*, uint32, const uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| int mp32isone(uint32, const uint32*); | | int mp32isone(uint32, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| | | int mp32istwo(uint32, const uint32*); | |
| | | BEEDLLAPI | |
| int mp32leone(uint32, const uint32*); | | int mp32leone(uint32, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int mp32eqmone(uint32, const uint32*, const uint32*); | | int mp32eqmone(uint32, const uint32*, const uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| int mp32msbset(uint32, const uint32*); | | int mp32msbset(uint32, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int mp32lsbset(uint32, const uint32*); | | int mp32lsbset(uint32, const uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| | | | |
| skipping to change at line 181 | | skipping to change at line 183 | |
| uint32 mp32addmul (uint32, uint32*, const uint32*, uint32); | | uint32 mp32addmul (uint32, uint32*, const uint32*, uint32); | |
| BEEDLLAPI | | BEEDLLAPI | |
| uint32 mp32addsqrtrc(uint32, uint32*, const uint32*); | | uint32 mp32addsqrtrc(uint32, uint32*, const uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32mul(uint32*, uint32, const uint32*, uint32, const uint32*); | | void mp32mul(uint32*, uint32, const uint32*, uint32, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32sqr(uint32*, uint32, const uint32*); | | void mp32sqr(uint32*, uint32, const uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32gcd(uint32*, uint32, const uint32*, const uint32*, uint32*); | | void mp32gcd_w(uint32, const uint32*, const uint32*, uint32*, uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| uint32 mp32nmodw(uint32*, uint32, const uint32*, uint32, uint32*); | | uint32 mp32nmodw(uint32*, uint32, const uint32*, uint32, uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32nmod(uint32*, uint32, const uint32*, uint32, const uint32*, uint32
*); | | void mp32nmod(uint32*, uint32, const uint32*, uint32, const uint32*, uint32
*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32ndivmod(uint32*, uint32, const uint32*, uint32, const uint32*, uin
t32*); | | void mp32ndivmod(uint32*, uint32, const uint32*, uint32, const uint32*, uin
t32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 3 lines changed or added | |
|
| mp32barrett.h | | mp32barrett.h | |
| /* | | /* | |
| * mp32barrett.h | | * mp32barrett.h | |
| * | | * | |
| * Barrett modular reduction, header | | * Barrett modular reduction, header | |
| * | | * | |
|
| * Copyright (c) 1997, 1998, 1999, 2000 Virtual Unlimited B.V. | | * Copyright (c) 1997, 1998, 1999, 2000, 2001 Virtual Unlimited B.V. | |
| * | | * | |
| * Author: Bob Deblier <bob@virtualunlimited.com> | | * Author: Bob Deblier <bob@virtualunlimited.com> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * version 2.1 of the License, or (at your option) any later version. | |
| * | | * | |
| * This library is distributed in the hope that it will be useful, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| | | | |
| #ifndef _MP32BARRETT_H | | #ifndef _MP32BARRETT_H | |
| #define _MP32BARRETT_H | | #define _MP32BARRETT_H | |
| | | | |
| #include "beecrypt.h" | | #include "beecrypt.h" | |
| #include "mp32number.h" | | #include "mp32number.h" | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| uint32 size; | | uint32 size; | |
|
| uint32* data; /* (size) words / allocated on one block of 9*size+5 | | uint32* modl; /* (size) words */ | |
| words and set the other pointers appropriately */ | | | |
| uint32* modl; /* (size+1) words */ | | | |
| uint32* mu; /* (size+1) words */ | | uint32* mu; /* (size+1) words */ | |
|
| uint32* wksp; /* (6*size+4) words */ | | | |
| } mp32barrett; | | } mp32barrett; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bzero (mp32barrett*); | | void mp32bzero(mp32barrett*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32binit (mp32barrett*, uint32); | | void mp32binit(mp32barrett*, uint32); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bfree (mp32barrett*); | | void mp32bfree(mp32barrett*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bset (mp32barrett*, uint32, const uint32*); | | void mp32bcopy(mp32barrett*, const mp32barrett*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bmu (mp32barrett*); | | void mp32bset(mp32barrett*, uint32, const uint32*); | |
| | | BEEDLLAPI | |
| | | void mp32bsethex(mp32barrett*, const char*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32brnd (const mp32barrett*, randomGeneratorContext*); | | void mp32bsubone(const mp32barrett*, uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32brndres (const mp32barrett*, uint32*, randomGeneratorContext*); | | void mp32bmu_w(mp32barrett*, uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32brndoddres(const mp32barrett*, uint32*, randomGeneratorContext*); | | void mp32brnd_w (const mp32barrett*, randomGeneratorContext*, uint32*, ui
nt32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32brndinvres(const mp32barrett*, uint32*, randomGeneratorContext*); | | void mp32brndodd_w(const mp32barrett*, randomGeneratorContext*, uint32*, ui | |
| | | nt32*); | |
| | | BEEDLLAPI | |
| | | void mp32brndinv_w(const mp32barrett*, randomGeneratorContext*, uint32*, ui | |
| | | nt32*, uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bmodsubone(const mp32barrett*); | | void mp32bneg_w(const mp32barrett*, const uint32*, uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bneg (const mp32barrett*); | | void mp32bmod_w(const mp32barrett*, const uint32*, uint32*, uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bmod (const mp32barrett*, uint32, const uint32*); | | void mp32baddmod_w(const mp32barrett*, uint32, const uint32*, uint32, const
uint32*, uint32*, uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32baddmod (const mp32barrett*, uint32, const uint32*, uint32, cons
t uint32*); | | void mp32bsubmod_w(const mp32barrett*, uint32, const uint32*, uint32, const
uint32*, uint32*, uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bsubmod (const mp32barrett*, uint32, const uint32*, uint32, cons | | void mp32bmulmod_w(const mp32barrett*, uint32, const uint32*, uint32, const | |
| t uint32*); | | uint32*, uint32*, uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bmulmodres(const mp32barrett*, uint32*, uint32, const uint32*, uin
t32, const uint32*); | | void mp32bsqrmod_w(const mp32barrett*, uint32, const uint32*, uint32*, uint
32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bsqrmodres(const mp32barrett*, uint32*, uint32, const uint32*); | | void mp32bpowmod_w(const mp32barrett*, uint32, const uint32*, uint32, const | |
| | | uint32*, uint32*, uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bmulmod (const mp32barrett*, uint32, const uint32*, uint32, cons
t uint32*); | | void mp32bpowmodsld_w(const mp32barrett*, const uint32*, uint32, const uint
32*, uint32*, uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bsqrmod (const mp32barrett*, uint32, const uint32*); | | void mp32btwopowmod_w(const mp32barrett*, uint32, const uint32*, uint32*, u
int32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bpowmod (const mp32barrett*, uint32, const uint32*, uint32, cons | | int mp32binv_w(const mp32barrett*, uint32, const uint32*, uint32*, uint32* | |
| t uint32*); | | ); | |
| BEEDLLAPI | | | |
| void mp32btwopowmod(const mp32barrett*, uint32, const uint32*); | | | |
| | | | |
| /* simultaneous multiple exponentiation, for use in dsa and elgamal signatu | | | |
| re verification */ | | | |
| | | | |
|
| | | /* To be added: | |
| | | * simultaneous multiple exponentiation, for use in dsa and elgamal signatu | |
| | | re verification | |
| | | */ | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32bsm2powmod(const mp32barrett*, const uint32*, const uint32*, const
uint32*, const uint32*); | | void mp32bsm2powmod(const mp32barrett*, const uint32*, const uint32*, const
uint32*, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32bsm3powmod(const mp32barrett*, const uint32*, const uint32*, const
uint32*, const uint32*, const uint32*, const uint32*); | | void mp32bsm3powmod(const mp32barrett*, const uint32*, const uint32*, const
uint32*, const uint32*, const uint32*, const uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| int mp32binv (const mp32barrett*, uint32, const uint32*); | | int mp32bpprime_w(const mp32barrett*, randomGeneratorContext*, int, uint32 | |
| | | *); | |
| BEEDLLAPI | | | |
| int mp32bpprime (const mp32barrett*, randomGeneratorContext*, int); | | | |
| | | | |
| /* the next routines take mp32numbers as parameters */ | | /* the next routines take mp32numbers as parameters */ | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bnmulmodres(const mp32barrett*, uint32*, const mp32number*, const | | void mp32bnrnd(const mp32barrett*, randomGeneratorContext*, mp32number*); | |
| mp32number*); | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bnsqrmodres(const mp32barrett*, uint32*, const mp32number*); | | void mp32bnmulmod(const mp32barrett*, const mp32number*, const mp32number*, | |
| | | mp32number*); | |
| | | BEEDLLAPI | |
| | | void mp32bnsqrmod(const mp32barrett*, const mp32number*, mp32number*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bnpowmod (const mp32barrett*, const mp32number*, const mp32numbe
r*); | | void mp32bnpowmod (const mp32barrett*, const mp32number*, const mp32numbe
r*, mp32number*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| void mp32bnsqrmod (const mp32barrett*, const mp32number*); | | void mp32bnpowmodsld(const mp32barrett*, const uint32*, const mp32number*,
mp32number*); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 28 change blocks. |
| 42 lines changed or deleted | | 46 lines changed or added | |
|
| mp32number.h | | mp32number.h | |
| /* | | /* | |
| * mp32number.h | | * mp32number.h | |
| * | | * | |
| * Multiprecision numbers, header | | * Multiprecision numbers, header | |
| * | | * | |
|
| * Copyright (c) 1997, 1998, 1999, 2000 Virtual Unlimited B.V. | | * Copyright (c) 1997, 1998, 1999, 2000, 2001 Virtual Unlimited B.V. | |
| * | | * | |
| * Author: Bob Deblier <bob@virtualunlimited.com> | | * Author: Bob Deblier <bob@virtualunlimited.com> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * version 2.1 of the License, or (at your option) any later version. | |
| * | | * | |
| * This library is distributed in the hope that it will be useful, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| #endif | | #endif | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32nzero(mp32number*); | | void mp32nzero(mp32number*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32nsize(mp32number*, uint32); | | void mp32nsize(mp32number*, uint32); | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32ninit(mp32number*, uint32, const uint32*); | | void mp32ninit(mp32number*, uint32, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32nfree(mp32number*); | | void mp32nfree(mp32number*); | |
|
| | | BEEDLLAPI | |
| | | void mp32ncopy(mp32number*, const mp32number*); | |
| | | BEEDLLAPI | |
| | | void mp32nwipe(mp32number*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32nset (mp32number*, uint32, const uint32*); | | void mp32nset (mp32number*, uint32, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32nsetw (mp32number*, uint32); | | void mp32nsetw (mp32number*, uint32); | |
| BEEDLLAPI | | BEEDLLAPI | |
| void mp32nsethex(mp32number*, const char*); | | void mp32nsethex(mp32number*, const char*); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 5 lines changed or added | |
|
| mp32opt.h | | mp32opt.h | |
| /* | | /* | |
| * mp32opt.h | | * mp32opt.h | |
| * | | * | |
| * Multiprecision integer assembler-optimized routined for 32 bit cpu, head
er | | * Multiprecision integer assembler-optimized routined for 32 bit cpu, head
er | |
| * | | * | |
|
| * Copyright (c) 1999, 2000 Virtual Unlimited B.V. | | * Copyright (c) 1999, 2000, 2001 Virtual Unlimited B.V. | |
| * | | * | |
| * Author: Bob Deblier <bob@virtualunlimited.com> | | * Author: Bob Deblier <bob@virtualunlimited.com> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * version 2.1 of the License, or (at your option) any later version. | |
| * | | * | |
| * This library is distributed in the hope that it will be useful, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| #ifndef _MP32OPT_H | | #ifndef _MP32OPT_H | |
| #define _MP32OPT_H | | #define _MP32OPT_H | |
| | | | |
| #include "beecrypt.h" | | #include "beecrypt.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| #if WIN32 | | #if WIN32 | |
|
| #if __INTEL__ && __MWERKS__ | | # if defined(_MSC_VER) && defined(_M_IX86) | |
| #define ASM_MP32ADDW | | # define ASM_MP32ADDW | |
| #define ASM_MP32ADD | | # define ASM_MP32ADD | |
| #define ASM_MP32SUBW | | # define ASM_MP32SUBW | |
| #define ASM_MP32SUB | | # define ASM_MP32SUB | |
| #define ASM_MP32MULTWO | | # define ASM_MP32MULTWO | |
| #define ASM_MP32SETMUL | | # define ASM_MP32SETMUL | |
| #define ASM_MP32ADDMUL | | # define ASM_MP32ADDMUL | |
| #define ASM_MP32ADDSQRTRC | | # define ASM_MP32ADDSQRTRC | |
| #endif | | # elif __INTEL__ && __MWERKS__ | |
| | | # define ASM_MP32ADDW | |
| | | # define ASM_MP32ADD | |
| | | # define ASM_MP32SUBW | |
| | | # define ASM_MP32SUB | |
| | | # define ASM_MP32MULTWO | |
| | | # define ASM_MP32SETMUL | |
| | | # define ASM_MP32ADDMUL | |
| | | # define ASM_MP32ADDSQRTRC | |
| | | # endif | |
| #endif | | #endif | |
| | | | |
| #if defined(__GNUC__) | | #if defined(__GNUC__) | |
|
| #if defined(i386) || defined(i486) || defined(i586) || defined(i686) | | # if defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE_I | |
| #define ASM_MP32ADDW | | 586) || defined(OPTIMIZE_I686) | |
| #define ASM_MP32ADD | | # define ASM_MP32ADDW | |
| #define ASM_MP32SUBW | | # define ASM_MP32ADD | |
| #define ASM_MP32SUB | | # define ASM_MP32SUBW | |
| #define ASM_MP32MULTWO | | # define ASM_MP32SUB | |
| #define ASM_MP32SETMUL | | # define ASM_MP32MULTWO | |
| #define ASM_MP32ADDMUL | | # define ASM_MP32SETMUL | |
| #define ASM_MP32ADDSQRTRC | | # define ASM_MP32ADDMUL | |
| #endif | | # define ASM_MP32ADDSQRTRC | |
| #if defined(ia64) | | # endif | |
| #define ASM_MP32ZERO | | # if defined(OPTIMIZE_IA64) | |
| #define ASM_MP32COPY | | # define ASM_MP32ZERO | |
| #define ASM_MP32ADD | | # define ASM_MP32COPY | |
| #define ASM_MP32SUB | | # define ASM_MP32ADD | |
| #define ASM_MP32SETMUL | | # define ASM_MP32SUB | |
| #define ASM_MP32ADDMUL | | # undef ASM_MP32SETMUL | |
| #endif | | # undef ASM_MP32ADDMUL | |
| #if defined(powerpc) | | # endif | |
| #define ASM_MP32ADDW | | # if defined(OPTIMIZE_POWERPC) | |
| #define ASM_MP32ADD | | # define ASM_MP32ADDW | |
| #define ASM_MP32SUBW | | # define ASM_MP32ADD | |
| #define ASM_MP32SUB | | # define ASM_MP32SUBW | |
| #define ASM_MP32SETMUL | | # define ASM_MP32SUB | |
| #define ASM_MP32ADDMUL | | # define ASM_MP32SETMUL | |
| #define ASM_MP32ADDSQRTRC | | # define ASM_MP32ADDMUL | |
| #endif | | # define ASM_MP32ADDSQRTRC | |
| #if defined(sparcv9) || defined(sparcv8plus) | | # endif | |
| #define ASM_MP32ADDW | | # if defined(OPTIMIZE_SPARCV8PLUS) || defined(OPTIMIZE_SPARCV9) | |
| #define ASM_MP32ADD | | # define ASM_MP32ADDW | |
| #define ASM_MP32SUBW | | # define ASM_MP32ADD | |
| #define ASM_MP32SUB | | # define ASM_MP32SUBW | |
| #define ASM_MP32SETMUL | | # define ASM_MP32SUB | |
| #define ASM_MP32ADDMUL | | # define ASM_MP32SETMUL | |
| #define ASM_MP32ADDSQRTRC | | # define ASM_MP32ADDMUL | |
| #endif | | # define ASM_MP32ADDSQRTRC | |
| | | # endif | |
| #endif | | #endif | |
| | | | |
| #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) | | #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) | |
|
| #if defined(sparcv9) || defined(sparcv8plus) | | # if defined(OPTIMIZE_SPARCV8PLUS) /* || defined(OPTIMIZE_SPARCV9) */ | |
| #define ASM_MP32ADDW | | # define ASM_MP32ADDW | |
| #define ASM_MP32ADD | | # define ASM_MP32ADD | |
| #define ASM_MP32SUBW | | # define ASM_MP32SUBW | |
| #define ASM_MP32SUB | | # define ASM_MP32SUB | |
| #define ASM_MP32SETMUL | | # define ASM_MP32SETMUL | |
| #define ASM_MP32ADDMUL | | # define ASM_MP32ADDMUL | |
| #define ASM_MP32ADDSQRTRC | | # define ASM_MP32ADDSQRTRC | |
| #endif | | # endif | |
| #if defined(i386) || defined(i486) || defined(i586) || defined(i686) | | # if defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE_I | |
| #define ASM_MP32ADDW | | 586) || defined(OPTIMIZE_I686) | |
| #define ASM_MP32ADD | | # define ASM_MP32ADDW | |
| #define ASM_MP32SUBW | | # define ASM_MP32ADD | |
| #define ASM_MP32SUB | | # define ASM_MP32SUBW | |
| #define ASM_MP32MULTWO | | # define ASM_MP32SUB | |
| #define ASM_MP32SETMUL | | # define ASM_MP32MULTWO | |
| #define ASM_MP32ADDMUL | | # define ASM_MP32SETMUL | |
| #define ASM_MP32ADDSQRTRC | | # define ASM_MP32ADDMUL | |
| #endif | | # define ASM_MP32ADDSQRTRC | |
| | | # endif | |
| #endif | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 66 lines changed or deleted | | 77 lines changed or added | |
|