mega-renaming to avoid exporting symbols not starting with MHD

This commit is contained in:
Christian Grothoff committed 2008-10-09 21:32:17 +00:00
1 parent 6ff7b62145
commit 8bee920d50
11 files changed
+73 -73

No files matched your search

+6 -6
View File
@@ -316,17 +316,17 @@ MHD_gc_cipher_setkey (MHD_gc_cipher_handle handle, size_t keylen, const char *ke
for (i = 0; i < keylen; i++)
sprintf (&keyMaterial[2 * i], "%02x", key[i] & 0xFF);
rc = rijndaelMakeKey (&ctx->aesEncKey, RIJNDAEL_DIR_ENCRYPT,
rc = MHD_rijndaelMakeKey (&ctx->aesEncKey, RIJNDAEL_DIR_ENCRYPT,
keylen * 8, keyMaterial);
if (rc < 0)
return GC_INVALID_CIPHER;
rc = rijndaelMakeKey (&ctx->aesDecKey, RIJNDAEL_DIR_DECRYPT,
rc = MHD_rijndaelMakeKey (&ctx->aesDecKey, RIJNDAEL_DIR_DECRYPT,
keylen * 8, keyMaterial);
if (rc < 0)
return GC_INVALID_CIPHER;
rc = rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_ECB, NULL);
rc = MHD_MHD_rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_ECB, NULL);
if (rc < 0)
return GC_INVALID_CIPHER;
}
@@ -374,7 +374,7 @@ MHD_gc_cipher_setiv (MHD_gc_cipher_handle handle, size_t ivlen, const char *iv)
for (i = 0; i < ivlen; i++)
sprintf (&ivMaterial[2 * i], "%02x", iv[i] & 0xFF);
rc = rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_CBC,
rc = MHD_MHD_rijndaelCipherInit (&ctx->aesContext, RIJNDAEL_MODE_CBC,
ivMaterial);
if (rc < 0)
return GC_INVALID_CIPHER;
@@ -449,7 +449,7 @@ MHD_gc_cipher_encrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *dat
{
int nblocks;
nblocks = rijndaelBlockEncrypt (&ctx->aesContext, &ctx->aesEncKey,
nblocks = MHD_rijndaelBlockEncrypt (&ctx->aesContext, &ctx->aesEncKey,
data, 8 * len, data);
if (nblocks < 0)
return GC_INVALID_CIPHER;
@@ -521,7 +521,7 @@ MHD_gc_cipher_decrypt_inline (MHD_gc_cipher_handle handle, size_t len, char *dat
{
int nblocks;
nblocks = rijndaelBlockDecrypt (&ctx->aesContext, &ctx->aesDecKey,
nblocks = MHD_rijndaelBlockDecrypt (&ctx->aesContext, &ctx->aesDecKey,
data, 8 * len, data);
if (nblocks < 0)
return GC_INVALID_CIPHER;
+5 -5
View File
@@ -762,7 +762,7 @@ static const uint32_t rcon[] = {
* @return the number of rounds for the given cipher key size.
*/
int
rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
MHD_rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
const char cipherKey[], size_t keyBits)
{
size_t i = 0;
@@ -857,14 +857,14 @@ rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
* @return the number of rounds for the given cipher key size.
*/
int
rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
MHD_rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
const char cipherKey[], size_t keyBits)
{
size_t Nr, i, j;
uint32_t temp;
/* expand the cipher key: */
Nr = rijndaelKeySetupEnc (rk, cipherKey, keyBits);
Nr = MHD_rijndaelKeySetupEnc (rk, cipherKey, keyBits);
/* invert the order of the round keys: */
for (i = 0, j = 4 * Nr; i < j; i += 4, j -= 4)
{
@@ -911,7 +911,7 @@ rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
}
void
rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
MHD_rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
const char pt[16], char ct[16])
{
uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
@@ -1002,7 +1002,7 @@ rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
}
void
rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
MHD_rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
const char ct[16], char pt[16])
{
uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
+4 -4
View File
@@ -55,13 +55,13 @@
#define RIJNDAEL_MAXKB (256/8)
#define RIJNDAEL_MAXNR 14
int rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
int MHD_rijndaelKeySetupEnc (uint32_t rk[ /*4*(Nr + 1) */ ],
const char cipherKey[], size_t keyBits);
int rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
int MHD_rijndaelKeySetupDec (uint32_t rk[ /*4*(Nr + 1) */ ],
const char cipherKey[], size_t keyBits);
void rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
void MHD_rijndaelEncrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
const char pt[16], char ct[16]);
void rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
void MHD_rijndaelDecrypt (const uint32_t rk[ /*4*(Nr + 1) */ ], size_t Nr,
const char ct[16], char pt[16]);
#endif /* __RIJNDAEL_ALG_FST_H */
+23 -23
View File
@@ -72,7 +72,7 @@
#include <string.h>
rijndael_rc
rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
MHD_rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
size_t keyLen, const char *keyMaterial)
{
size_t i;
@@ -138,18 +138,18 @@ rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
}
if (direction == RIJNDAEL_DIR_ENCRYPT)
{
key->Nr = rijndaelKeySetupEnc (key->rk, cipherKey, keyLen);
key->Nr = MHD_rijndaelKeySetupEnc (key->rk, cipherKey, keyLen);
}
else
{
key->Nr = rijndaelKeySetupDec (key->rk, cipherKey, keyLen);
key->Nr = MHD_rijndaelKeySetupDec (key->rk, cipherKey, keyLen);
}
rijndaelKeySetupEnc (key->ek, cipherKey, keyLen);
MHD_rijndaelKeySetupEnc (key->ek, cipherKey, keyLen);
return 0;
}
rijndael_rc
rijndaelCipherInit (rijndaelCipherInstance * cipher, rijndael_mode mode,
MHD_MHD_rijndaelCipherInit (rijndaelCipherInstance * cipher, rijndael_mode mode,
const char *IV)
{
if ((mode == RIJNDAEL_MODE_ECB) || (mode == RIJNDAEL_MODE_CBC)
@@ -199,7 +199,7 @@ rijndaelCipherInit (rijndaelCipherInstance * cipher, rijndael_mode mode,
}
int
rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
MHD_rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
const rijndaelKeyInstance * key,
const char *input, size_t inputLen, char *outBuffer)
{
@@ -222,7 +222,7 @@ rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
case RIJNDAEL_MODE_ECB:
for (i = numBlocks; i > 0; i--)
{
rijndaelEncrypt (key->rk, key->Nr, input, outBuffer);
MHD_rijndaelEncrypt (key->rk, key->Nr, input, outBuffer);
input += 16;
outBuffer += 16;
}
@@ -240,7 +240,7 @@ rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
((uint32_t *) iv)[2];
((uint32_t *) block)[3] = ((uint32_t *) input)[3] ^
((uint32_t *) iv)[3];
rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
MHD_rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
memcpy (cipher->IV, outBuffer, 16);
input += 16;
outBuffer += 16;
@@ -254,7 +254,7 @@ rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
memcpy (outBuffer, input, 16);
for (k = 0; k < 128; k++)
{
rijndaelEncrypt (key->ek, key->Nr, iv, block);
MHD_rijndaelEncrypt (key->ek, key->Nr, iv, block);
outBuffer[k >> 3] ^= (block[0] & 0x80U) >> (k & 7);
for (t = 0; t < 15; t++)
{
@@ -276,7 +276,7 @@ rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
}
int
rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
MHD_rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
const rijndaelKeyInstance * key,
const char *input, size_t inputOctets, char *outBuffer)
{
@@ -299,7 +299,7 @@ rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
case RIJNDAEL_MODE_ECB:
for (i = numBlocks; i > 0; i--)
{
rijndaelEncrypt (key->rk, key->Nr, input, outBuffer);
MHD_rijndaelEncrypt (key->rk, key->Nr, input, outBuffer);
input += 16;
outBuffer += 16;
}
@@ -307,7 +307,7 @@ rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
assert (padLen > 0 && padLen <= 16);
memcpy (block, input, 16 - padLen);
memset (block + 16 - padLen, padLen, padLen);
rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
MHD_rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
break;
case RIJNDAEL_MODE_CBC:
@@ -322,7 +322,7 @@ rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
((uint32_t *) iv)[2];
((uint32_t *) block)[3] = ((uint32_t *) input)[3] ^
((uint32_t *) iv)[3];
rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
MHD_rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
memcpy (cipher->IV, outBuffer, 16);
input += 16;
outBuffer += 16;
@@ -337,7 +337,7 @@ rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
{
block[i] = (char) padLen ^ iv[i];
}
rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
MHD_rijndaelEncrypt (key->rk, key->Nr, block, outBuffer);
memcpy (cipher->IV, outBuffer, 16);
break;
@@ -349,7 +349,7 @@ rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
}
int
rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
MHD_rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
const rijndaelKeyInstance * key,
const char *input, size_t inputLen, char *outBuffer)
{
@@ -375,7 +375,7 @@ rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
case RIJNDAEL_MODE_ECB:
for (i = numBlocks; i > 0; i--)
{
rijndaelDecrypt (key->rk, key->Nr, input, outBuffer);
MHD_rijndaelDecrypt (key->rk, key->Nr, input, outBuffer);
input += 16;
outBuffer += 16;
}
@@ -385,7 +385,7 @@ rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
iv = cipher->IV;
for (i = numBlocks; i > 0; i--)
{
rijndaelDecrypt (key->rk, key->Nr, input, block);
MHD_rijndaelDecrypt (key->rk, key->Nr, input, block);
((uint32_t *) block)[0] ^= ((uint32_t *) iv)[0];
((uint32_t *) block)[1] ^= ((uint32_t *) iv)[1];
((uint32_t *) block)[2] ^= ((uint32_t *) iv)[2];
@@ -404,7 +404,7 @@ rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
memcpy (outBuffer, input, 16);
for (k = 0; k < 128; k++)
{
rijndaelEncrypt (key->ek, key->Nr, iv, block);
MHD_rijndaelEncrypt (key->ek, key->Nr, iv, block);
for (t = 0; t < 15; t++)
{
iv[t] = (iv[t] << 1) | (iv[t + 1] >> 7);
@@ -425,7 +425,7 @@ rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
}
int
rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
MHD_rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
const rijndaelKeyInstance * key,
const char *input, size_t inputOctets, char *outBuffer)
{
@@ -453,12 +453,12 @@ rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
/* all blocks but last */
for (i = numBlocks - 1; i > 0; i--)
{
rijndaelDecrypt (key->rk, key->Nr, input, outBuffer);
MHD_rijndaelDecrypt (key->rk, key->Nr, input, outBuffer);
input += 16;
outBuffer += 16;
}
/* last block */
rijndaelDecrypt (key->rk, key->Nr, input, block);
MHD_rijndaelDecrypt (key->rk, key->Nr, input, block);
padLen = block[15];
if (padLen >= 16)
{
@@ -478,7 +478,7 @@ rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
/* all blocks but last */
for (i = numBlocks - 1; i > 0; i--)
{
rijndaelDecrypt (key->rk, key->Nr, input, block);
MHD_rijndaelDecrypt (key->rk, key->Nr, input, block);
((uint32_t *) block)[0] ^= ((uint32_t *) cipher->IV)[0];
((uint32_t *) block)[1] ^= ((uint32_t *) cipher->IV)[1];
((uint32_t *) block)[2] ^= ((uint32_t *) cipher->IV)[2];
@@ -489,7 +489,7 @@ rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
outBuffer += 16;
}
/* last block */
rijndaelDecrypt (key->rk, key->Nr, input, block);
MHD_rijndaelDecrypt (key->rk, key->Nr, input, block);
((uint32_t *) block)[0] ^= ((uint32_t *) cipher->IV)[0];
((uint32_t *) block)[1] ^= ((uint32_t *) cipher->IV)[1];
((uint32_t *) block)[2] ^= ((uint32_t *) cipher->IV)[2];
+14 -14
View File
@@ -137,7 +137,7 @@ typedef struct
from KEYMATERIAL, a hex string, of KEYLEN size. KEYLEN should be
128, 192 or 256. Returns 0 on success, or an error code. */
extern rijndael_rc
rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
MHD_rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
size_t keyLen, const char *keyMaterial);
/* Initialize cipher state CIPHER for encryption MODE (e.g.,
@@ -145,18 +145,18 @@ rijndaelMakeKey (rijndaelKeyInstance * key, rijndael_direction direction,
2*RIJNDAEL_MAX_IV_SIZE length. IV may be NULL for modes that do
not need an IV (i.e., RIJNDAEL_MODE_ECB). */
extern rijndael_rc
rijndaelCipherInit (rijndaelCipherInstance * cipher,
MHD_MHD_rijndaelCipherInit (rijndaelCipherInstance * cipher,
rijndael_mode mode, const char *IV);
/* Encrypt data in INPUT, of INPUTLEN/8 bytes length, placing the
output in the pre-allocated OUTBUFFER which must hold at least
INPUTLEN/8 bytes of data. The CIPHER is used as state, and must be
initialized with rijndaelCipherInit before calling this function.
The encryption KEY must be initialized with rijndaelMakeKey before
initialized with MHD_MHD_rijndaelCipherInit before calling this function.
The encryption KEY must be initialized with MHD_rijndaelMakeKey before
calling this function. Return the number of bits written, or a
negative rijndael_rc error code. */
extern int
rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
MHD_rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
const rijndaelKeyInstance * key,
const char *input, size_t inputLen, char *outBuffer);
@@ -165,24 +165,24 @@ rijndaelBlockEncrypt (rijndaelCipherInstance * cipher,
INPUTOCTETS aligned to the next block size boundary.
Ciphertext-Stealing as described in RFC 2040 is used to encrypt
partial blocks. The CIPHER is used as state, and must be
initialized with rijndaelCipherInit before calling this function.
The encryption KEY must be initialized with rijndaelMakeKey before
initialized with MHD_MHD_rijndaelCipherInit before calling this function.
The encryption KEY must be initialized with MHD_rijndaelMakeKey before
calling this function. Return the number of bits written, or a
negative rijndael_rc error code. */
extern int
rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
MHD_rijndaelPadEncrypt (rijndaelCipherInstance * cipher,
const rijndaelKeyInstance * key,
const char *input, size_t inputOctets, char *outBuffer);
/* Decrypt data in INPUT, of INPUTLEN/8 bytes length, placing the
output in the pre-allocated OUTBUFFER which must hold at least
INPUTLEN/8 bytes of data. The CIPHER is used as state, and must be
initialized with rijndaelCipherInit before calling this function.
The encryption KEY must be initialized with rijndaelMakeKey before
initialized with MHD_MHD_rijndaelCipherInit before calling this function.
The encryption KEY must be initialized with MHD_rijndaelMakeKey before
calling this function. Return the number of bits written, or a
negative rijndael_rc error code. */
extern int
rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
MHD_rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
const rijndaelKeyInstance * key,
const char *input, size_t inputLen, char *outBuffer);
@@ -191,12 +191,12 @@ rijndaelBlockDecrypt (rijndaelCipherInstance * cipher,
INPUTOCTETS aligned to the next block size boundary.
Ciphertext-Stealing as described in RFC 2040 is used to encrypt
partial blocks. The CIPHER is used as state, and must be
initialized with rijndaelCipherInit before calling this function.
The encryption KEY must be initialized with rijndaelMakeKey before
initialized with MHD_MHD_rijndaelCipherInit before calling this function.
The encryption KEY must be initialized with MHD_rijndaelMakeKey before
calling this function. Return the number of bits written, or a
negative rijndael_rc error code. */
extern int
rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
MHD_rijndaelPadDecrypt (rijndaelCipherInstance * cipher,
const rijndaelKeyInstance * key,
const char *input, size_t inputOctets, char *outBuffer);
+5 -5
View File
@@ -45,11 +45,11 @@
of `digit' even when the host does not conform to POSIX. */
#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
#undef __strverscmp
#undef strverscmp
#undef __MHD_strverscmp
#undef MHD_strverscmp
#ifndef weak_alias
# define __strverscmp strverscmp
# define __MHD_strverscmp MHD_strverscmp
#endif
/* Compare S1 and S2 as strings holding indices/version numbers,
@@ -58,7 +58,7 @@
*/
int
__strverscmp (const char *s1, const char *s2)
__MHD_strverscmp (const char *s1, const char *s2)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
@@ -126,5 +126,5 @@ __strverscmp (const char *s1, const char *s2)
}
#ifdef weak_alias
weak_alias (__strverscmp, strverscmp)
weak_alias (__MHD_strverscmp, MHD_strverscmp)
#endif
+1 -1
View File
@@ -19,6 +19,6 @@
#ifndef STRVERSCMP_H_
# define STRVERSCMP_H_
int strverscmp (const char *, const char *);
int MHD_strverscmp (const char *, const char *);
#endif /* not STRVERSCMP_H_ */