base
This commit is contained in:
+484
@@ -0,0 +1,484 @@
|
||||
/* This is an independent implementation of the encryption algorithm: */
|
||||
/* */
|
||||
/* LOKI97 by Brown and Pieprzyk */
|
||||
/* */
|
||||
/* which is a candidate algorithm in the Advanced Encryption Standard */
|
||||
/* programme of the US National Institute of Standards and Technology. */
|
||||
/* */
|
||||
/* Copyright in this implementation is held by Dr B R Gladman but I */
|
||||
/* hereby give permission for its free direct or derivative use subject */
|
||||
/* to acknowledgment of its origin and compliance with any conditions */
|
||||
/* that the originators of the algorithm place on its exploitation. */
|
||||
/* */
|
||||
/* Dr Brian Gladman (gladman@seven77.demon.co.uk) 14th January 1999 */
|
||||
|
||||
/* $Id: loki97.c,v 1.1 2007/07/19 06:11:48 pizon Exp $ */
|
||||
|
||||
/* modified in order to use the libmcrypt API by Nikos Mavroyanopoulos
|
||||
* All modifications are placed under the license of libmcrypt.
|
||||
*/
|
||||
|
||||
/* Timing data for LOKI97 (loki.c)
|
||||
|
||||
Core timing without I/O endian conversion:
|
||||
|
||||
128 bit key:
|
||||
Key Setup: 7430 cycles
|
||||
Encrypt: 2134 cycles = 12.0 mbits/sec
|
||||
Decrypt: 2192 cycles = 11.7 mbits/sec
|
||||
Mean: 2163 cycles = 11.8 mbits/sec
|
||||
|
||||
192 bit key:
|
||||
Key Setup: 7303 cycles
|
||||
Encrypt: 2138 cycles = 12.0 mbits/sec
|
||||
Decrypt: 2189 cycles = 11.7 mbits/sec
|
||||
Mean: 2164 cycles = 11.8 mbits/sec
|
||||
|
||||
256 bit key:
|
||||
Key Setup: 7166 cycles
|
||||
Encrypt: 2131 cycles = 12.0 mbits/sec
|
||||
Decrypt: 2184 cycles = 11.7 mbits/sec
|
||||
Mean: 2158 cycles = 11.9 mbits/sec
|
||||
|
||||
Full timing with I/O endian conversion:
|
||||
|
||||
128 bit key:
|
||||
Key Setup: 7582 cycles
|
||||
Encrypt: 2174 cycles = 11.8 mbits/sec
|
||||
Decrypt: 2235 cycles = 11.5 mbits/sec
|
||||
Mean: 2205 cycles = 11.6 mbits/sec
|
||||
|
||||
192 bit key:
|
||||
Key Setup: 7477 cycles
|
||||
Encrypt: 2167 cycles = 11.8 mbits/sec
|
||||
Decrypt: 2223 cycles = 11.5 mbits/sec
|
||||
Mean: 2195 cycles = 11.7 mbits/sec
|
||||
|
||||
256 bit key:
|
||||
Key Setup: 7365 cycles
|
||||
Encrypt: 2177 cycles = 11.8 mbits/sec
|
||||
Decrypt: 2194 cycles = 11.7 mbits/sec
|
||||
Mean: 2186 cycles = 11.7 mbits/sec
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <libdefs.h>
|
||||
|
||||
#include <mcrypt_modules.h>
|
||||
|
||||
#define _mcrypt_set_key loki97_LTX__mcrypt_set_key
|
||||
#define _mcrypt_encrypt loki97_LTX__mcrypt_encrypt
|
||||
#define _mcrypt_decrypt loki97_LTX__mcrypt_decrypt
|
||||
#define _mcrypt_get_size loki97_LTX__mcrypt_get_size
|
||||
#define _mcrypt_get_block_size loki97_LTX__mcrypt_get_block_size
|
||||
#define _is_block_algorithm loki97_LTX__is_block_algorithm
|
||||
#define _mcrypt_get_key_size loki97_LTX__mcrypt_get_key_size
|
||||
#define _mcrypt_get_supported_key_sizes loki97_LTX__mcrypt_get_supported_key_sizes
|
||||
#define _mcrypt_get_algorithms_name loki97_LTX__mcrypt_get_algorithms_name
|
||||
#define _mcrypt_self_test loki97_LTX__mcrypt_self_test
|
||||
#define _mcrypt_algorithm_version loki97_LTX__mcrypt_algorithm_version
|
||||
|
||||
#define byte(x,n) ((byte)((x) >> (8 * n)))
|
||||
|
||||
#define S1_SIZE 13
|
||||
#define S1_LEN (1 << S1_SIZE)
|
||||
#define S1_MASK (S1_LEN - 1)
|
||||
#define S1_HMASK (S1_MASK & ~0xff)
|
||||
#define S1_POLY 0x2911
|
||||
|
||||
#define S2_SIZE 11
|
||||
#define S2_LEN (1 << S2_SIZE)
|
||||
#define S2_MASK (S2_LEN - 1)
|
||||
#define S2_HMASK (S2_MASK & ~0xff)
|
||||
#define S2_POLY 0x0aa7
|
||||
|
||||
word32 delta[2] = { 0x7f4a7c15, 0x9e3779b9 };
|
||||
|
||||
byte sb1[S1_LEN]; /* GF(2^11) S box */
|
||||
byte sb2[S2_LEN]; /* GF(2^11) S box */
|
||||
word32 prm[256][2];
|
||||
word32 init_done = 0;
|
||||
|
||||
/* word32 l_key[96]; */
|
||||
|
||||
#define add_eq(x,y) (x)[1] += (y)[1] + (((x)[0] += (y)[0]) < (y)[0] ? 1 : 0)
|
||||
#define sub_eq(x,y) xs = (x)[0]; (x)[1] -= (y)[1] + (((x)[0] -= (y)[0]) > xs ? 1 : 0)
|
||||
|
||||
word32 ff_mult(word32 a, word32 b, word32 tpow, word32 mpol)
|
||||
{
|
||||
word32 r, s, m;
|
||||
|
||||
r = s = 0;
|
||||
m = (1 << tpow);
|
||||
|
||||
while (b) {
|
||||
if (b & 1)
|
||||
|
||||
s ^= a;
|
||||
|
||||
b >>= 1;
|
||||
a <<= 1;
|
||||
|
||||
if (a & m)
|
||||
|
||||
a ^= mpol;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void init_tables(void)
|
||||
{
|
||||
word32 i, j, v;
|
||||
|
||||
/* initialise S box 1 */
|
||||
|
||||
for (i = 0; i < S1_LEN; ++i) {
|
||||
j = v = i ^ S1_MASK;
|
||||
v = ff_mult(v, j, S1_SIZE, S1_POLY);
|
||||
sb1[i] = (byte) ff_mult(v, j, S1_SIZE, S1_POLY);
|
||||
}
|
||||
/* initialise S box 2 */
|
||||
|
||||
for (i = 0; i < S2_LEN; ++i) {
|
||||
j = v = i ^ S2_MASK;
|
||||
v = ff_mult(v, j, S2_SIZE, S2_POLY);
|
||||
sb2[i] = (byte) ff_mult(v, j, S2_SIZE, S2_POLY);
|
||||
}
|
||||
|
||||
/* initialise permutation table */
|
||||
|
||||
for (i = 0; i < 256; ++i) {
|
||||
prm[i][0] =
|
||||
((i & 1) << 7) | ((i & 2) << 14) | ((i & 4) << 21) |
|
||||
((i & 8) << 28);
|
||||
prm[i][1] =
|
||||
((i & 16) << 3) | ((i & 32) << 10) | ((i & 64) << 17) |
|
||||
((i & 128) << 24);
|
||||
}
|
||||
}
|
||||
|
||||
void f_fun(word32 res[2], const word32 in[2], const word32 key[2])
|
||||
{
|
||||
word32 i, tt[2], pp[2];
|
||||
|
||||
/* tt[0] = in[0] & ~key[0] | in[1] & key[0];
|
||||
* tt[1] = in[1] & ~key[0] | in[0] & key[0];
|
||||
*/
|
||||
tt[0] = (in[0] & ~key[0]) | (in[1] & key[0]);
|
||||
tt[1] = (in[1] & ~key[0]) | (in[0] & key[0]);
|
||||
|
||||
i = sb1[((tt[1] >> 24) | (tt[0] << 8)) & S1_MASK];
|
||||
pp[0] = prm[i][0] >> 7;
|
||||
pp[1] = prm[i][1] >> 7;
|
||||
i = sb2[(tt[1] >> 16) & S2_MASK];
|
||||
pp[0] |= prm[i][0] >> 6;
|
||||
pp[1] |= prm[i][1] >> 6;
|
||||
i = sb1[(tt[1] >> 8) & S1_MASK];
|
||||
pp[0] |= prm[i][0] >> 5;
|
||||
pp[1] |= prm[i][1] >> 5;
|
||||
i = sb2[tt[1] & S2_MASK];
|
||||
pp[0] |= prm[i][0] >> 4;
|
||||
pp[1] |= prm[i][1] >> 4;
|
||||
i = sb2[((tt[0] >> 24) | (tt[1] << 8)) & S2_MASK];
|
||||
pp[0] |= prm[i][0] >> 3;
|
||||
pp[1] |= prm[i][1] >> 3;
|
||||
i = sb1[(tt[0] >> 16) & S1_MASK];
|
||||
pp[0] |= prm[i][0] >> 2;
|
||||
pp[1] |= prm[i][1] >> 2;
|
||||
i = sb2[(tt[0] >> 8) & S2_MASK];
|
||||
pp[0] |= prm[i][0] >> 1;
|
||||
pp[1] |= prm[i][1] >> 1;
|
||||
i = sb1[tt[0] & S1_MASK];
|
||||
pp[0] |= prm[i][0];
|
||||
pp[1] |= prm[i][1];
|
||||
|
||||
/*
|
||||
res[0] ^= sb1[byte(pp[0], 0) | (key[1] << 8) & S1_HMASK]
|
||||
| (sb1[byte(pp[0], 1) | (key[1] << 3) & S1_HMASK] << 8)
|
||||
| (sb2[byte(pp[0], 2) | (key[1] >> 2) & S2_HMASK] << 16)
|
||||
| (sb2[byte(pp[0], 3) | (key[1] >> 5) & S2_HMASK] << 24);
|
||||
res[1] ^= sb1[byte(pp[1], 0) | (key[1] >> 8) & S1_HMASK]
|
||||
| (sb1[byte(pp[1], 1) | (key[1] >> 13) & S1_HMASK] << 8)
|
||||
| (sb2[byte(pp[1], 2) | (key[1] >> 18) & S2_HMASK] << 16)
|
||||
| (sb2[byte(pp[1], 3) | (key[1] >> 21) & S2_HMASK] << 24);
|
||||
*/
|
||||
res[0] ^= sb1[byte(pp[0], 0) | ((key[1] << 8) & S1_HMASK)]
|
||||
| ((sb1[byte(pp[0], 1) | ((key[1] << 3) & S1_HMASK)] << 8))
|
||||
| ((sb2[byte(pp[0], 2) | ((key[1] >> 2) & S2_HMASK)] << 16))
|
||||
| ((sb2[byte(pp[0], 3) | ((key[1] >> 5) & S2_HMASK)] << 24));
|
||||
res[1] ^= sb1[byte(pp[1], 0) | ((key[1] >> 8) & S1_HMASK)]
|
||||
| ((sb1[byte(pp[1], 1) | ((key[1] >> 13) & S1_HMASK)] << 8))
|
||||
| ((sb2[byte(pp[1], 2) | ((key[1] >> 18) & S2_HMASK)] << 16))
|
||||
| ((sb2[byte(pp[1], 3) | ((key[1] >> 21) & S2_HMASK)] << 24));
|
||||
|
||||
}
|
||||
|
||||
/* 256 bit version only */
|
||||
WIN32DLL_DEFINE
|
||||
int _mcrypt_set_key(word32 * l_key, const word32 in_key[],
|
||||
const word32 key_len)
|
||||
{
|
||||
word32 i, k1[2], k2[2], k3[2], k4[2], del[2], tt[2], sk[2];
|
||||
|
||||
if (!init_done) {
|
||||
init_tables();
|
||||
init_done = 1;
|
||||
}
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
k4[0] = byteswap32(in_key[1]);
|
||||
k4[1] = byteswap32(in_key[0]);
|
||||
k3[0] = byteswap32(in_key[3]);
|
||||
k3[1] = byteswap32(in_key[2]);
|
||||
#else
|
||||
k4[0] = (in_key[1]);
|
||||
k4[1] = (in_key[0]);
|
||||
k3[0] = (in_key[3]);
|
||||
k3[1] = (in_key[2]);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
k2[0] = byteswap32(in_key[5]);
|
||||
k2[1] = byteswap32(in_key[4]);
|
||||
k1[0] = byteswap32(in_key[7]);
|
||||
k1[1] = byteswap32(in_key[6]);
|
||||
#else
|
||||
k2[0] = (in_key[5]);
|
||||
k2[1] = (in_key[4]);
|
||||
k1[0] = (in_key[7]);
|
||||
k1[1] = (in_key[6]);
|
||||
#endif
|
||||
|
||||
del[0] = delta[0];
|
||||
del[1] = delta[1];
|
||||
|
||||
for (i = 0; i < 48; ++i) {
|
||||
tt[0] = k1[0];
|
||||
tt[1] = k1[1];
|
||||
add_eq(tt, k3);
|
||||
add_eq(tt, del);
|
||||
add_eq(del, delta);
|
||||
sk[0] = k4[0];
|
||||
sk[1] = k4[1];
|
||||
k4[0] = k3[0];
|
||||
k4[1] = k3[1];
|
||||
k3[0] = k2[0];
|
||||
k3[1] = k2[1];
|
||||
k2[0] = k1[0];
|
||||
k2[1] = k1[1];
|
||||
k1[0] = sk[0];
|
||||
k1[1] = sk[1];
|
||||
f_fun(k1, tt, k3);
|
||||
l_key[i + i] = k1[0];
|
||||
l_key[i + i + 1] = k1[1];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define r_fun(l,r,k) \
|
||||
add_eq((l),(k)); \
|
||||
f_fun((r),(l),(k) + 2); \
|
||||
add_eq((l), (k) + 4)
|
||||
|
||||
WIN32DLL_DEFINE void _mcrypt_encrypt(word32 * l_key, word32 * _blk)
|
||||
{
|
||||
word32 blk[4];
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
blk[3] = byteswap32(_blk[0]);
|
||||
blk[2] = byteswap32(_blk[1]);
|
||||
blk[1] = byteswap32(_blk[2]);
|
||||
blk[0] = byteswap32(_blk[3]);
|
||||
#else
|
||||
blk[3] = (_blk[0]);
|
||||
blk[2] = (_blk[1]);
|
||||
blk[1] = (_blk[2]);
|
||||
blk[0] = (_blk[3]);
|
||||
#endif
|
||||
|
||||
r_fun(blk, blk + 2, l_key + 0);
|
||||
r_fun(blk + 2, blk, l_key + 6);
|
||||
r_fun(blk, blk + 2, l_key + 12);
|
||||
r_fun(blk + 2, blk, l_key + 18);
|
||||
r_fun(blk, blk + 2, l_key + 24);
|
||||
r_fun(blk + 2, blk, l_key + 30);
|
||||
r_fun(blk, blk + 2, l_key + 36);
|
||||
r_fun(blk + 2, blk, l_key + 42);
|
||||
r_fun(blk, blk + 2, l_key + 48);
|
||||
r_fun(blk + 2, blk, l_key + 54);
|
||||
r_fun(blk, blk + 2, l_key + 60);
|
||||
r_fun(blk + 2, blk, l_key + 66);
|
||||
r_fun(blk, blk + 2, l_key + 72);
|
||||
r_fun(blk + 2, blk, l_key + 78);
|
||||
r_fun(blk, blk + 2, l_key + 84);
|
||||
r_fun(blk + 2, blk, l_key + 90);
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
_blk[3] = byteswap32(blk[2]);
|
||||
_blk[2] = byteswap32(blk[3]);
|
||||
_blk[1] = byteswap32(blk[0]);
|
||||
_blk[0] = byteswap32(blk[1]);
|
||||
#else
|
||||
_blk[3] = (blk[2]);
|
||||
_blk[2] = (blk[3]);
|
||||
_blk[1] = (blk[0]);
|
||||
_blk[0] = (blk[1]);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define ir_fun(l,r,k) \
|
||||
sub_eq((l),(k) + 4); \
|
||||
f_fun((r),(l),(k) + 2); \
|
||||
sub_eq((l),(k))
|
||||
|
||||
WIN32DLL_DEFINE void _mcrypt_decrypt(word32 * l_key, word32 * _blk)
|
||||
{
|
||||
word32 xs, blk[4];
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
blk[3] = byteswap32(_blk[0]);
|
||||
blk[2] = byteswap32(_blk[1]);
|
||||
blk[1] = byteswap32(_blk[2]);
|
||||
blk[0] = byteswap32(_blk[3]);
|
||||
#else
|
||||
blk[3] = (_blk[0]);
|
||||
blk[2] = (_blk[1]);
|
||||
blk[1] = (_blk[2]);
|
||||
blk[0] = (_blk[3]);
|
||||
#endif
|
||||
|
||||
ir_fun(blk, blk + 2, l_key + 90);
|
||||
ir_fun(blk + 2, blk, l_key + 84);
|
||||
ir_fun(blk, blk + 2, l_key + 78);
|
||||
ir_fun(blk + 2, blk, l_key + 72);
|
||||
ir_fun(blk, blk + 2, l_key + 66);
|
||||
ir_fun(blk + 2, blk, l_key + 60);
|
||||
ir_fun(blk, blk + 2, l_key + 54);
|
||||
ir_fun(blk + 2, blk, l_key + 48);
|
||||
ir_fun(blk, blk + 2, l_key + 42);
|
||||
ir_fun(blk + 2, blk, l_key + 36);
|
||||
ir_fun(blk, blk + 2, l_key + 30);
|
||||
ir_fun(blk + 2, blk, l_key + 24);
|
||||
ir_fun(blk, blk + 2, l_key + 18);
|
||||
ir_fun(blk + 2, blk, l_key + 12);
|
||||
ir_fun(blk, blk + 2, l_key + 6);
|
||||
ir_fun(blk + 2, blk, l_key);
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
_blk[3] = byteswap32(blk[2]);
|
||||
_blk[2] = byteswap32(blk[3]);
|
||||
_blk[1] = byteswap32(blk[0]);
|
||||
_blk[0] = byteswap32(blk[1]);
|
||||
#else
|
||||
_blk[3] = (blk[2]);
|
||||
_blk[2] = (blk[3]);
|
||||
_blk[1] = (blk[0]);
|
||||
_blk[0] = (blk[1]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
WIN32DLL_DEFINE int _mcrypt_get_size()
|
||||
{
|
||||
return 96 * sizeof(word32);
|
||||
}
|
||||
WIN32DLL_DEFINE int _mcrypt_get_block_size()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
WIN32DLL_DEFINE int _is_block_algorithm()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
WIN32DLL_DEFINE int _mcrypt_get_key_size()
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
static const int key_sizes[] = { 16, 24, 32 };
|
||||
WIN32DLL_DEFINE const int *_mcrypt_get_supported_key_sizes(int *len)
|
||||
{
|
||||
*len = sizeof(key_sizes)/sizeof(int);
|
||||
return key_sizes;
|
||||
|
||||
}
|
||||
|
||||
WIN32DLL_DEFINE char *_mcrypt_get_algorithms_name()
|
||||
{
|
||||
return "LOKI97";
|
||||
}
|
||||
|
||||
#define CIPHER "8cb28c958024bae27a94c698f96f12a9"
|
||||
|
||||
WIN32DLL_DEFINE int _mcrypt_self_test()
|
||||
{
|
||||
char *keyword;
|
||||
unsigned char plaintext[16];
|
||||
unsigned char ciphertext[16];
|
||||
int blocksize = _mcrypt_get_block_size(), j;
|
||||
void *key;
|
||||
unsigned char cipher_tmp[200];
|
||||
|
||||
keyword = calloc(1, _mcrypt_get_key_size());
|
||||
if (keyword == NULL)
|
||||
return -1;
|
||||
|
||||
for (j = 0; j < _mcrypt_get_key_size(); j++) {
|
||||
keyword[j] = ((j * 2 + 10) % 256);
|
||||
}
|
||||
|
||||
for (j = 0; j < blocksize; j++) {
|
||||
plaintext[j] = j % 256;
|
||||
}
|
||||
key = malloc(_mcrypt_get_size());
|
||||
if (key == NULL) {
|
||||
free(keyword);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(ciphertext, plaintext, blocksize);
|
||||
|
||||
_mcrypt_set_key(key, (void *) keyword, _mcrypt_get_key_size());
|
||||
free(keyword);
|
||||
|
||||
_mcrypt_encrypt(key, (void *) ciphertext);
|
||||
|
||||
for (j = 0; j < blocksize; j++) {
|
||||
sprintf(&((char *) cipher_tmp)[2 * j], "%.2x",
|
||||
ciphertext[j]);
|
||||
}
|
||||
|
||||
if (strcmp((char *) cipher_tmp, CIPHER) != 0) {
|
||||
printf("failed compatibility\n");
|
||||
printf("Expected: %s\nGot: %s\n", CIPHER,
|
||||
(char *) cipher_tmp);
|
||||
free(key);
|
||||
return -1;
|
||||
}
|
||||
_mcrypt_decrypt(key, (void *) ciphertext);
|
||||
free(key);
|
||||
|
||||
if (strcmp(ciphertext, plaintext) != 0) {
|
||||
printf("failed internally\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WIN32DLL_DEFINE word32 _mcrypt_algorithm_version()
|
||||
{
|
||||
return 20010801;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
# ifdef USE_LTDL
|
||||
WIN32DLL_DEFINE int main (void)
|
||||
{
|
||||
/* empty main function to avoid linker error (see cygwin FAQ) */
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
// ImplDispatch.cpp (IDispatch for Extending Dynamic HTML Object Model)
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ImpIDispatch.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// Hardcoded information for extending the Object Model
|
||||
// Typically this would be supplied through a TypeInfo
|
||||
// In this case the name "xxyyzz" maps to DISPID_Extend
|
||||
const WCHAR pszExtend[10]=L"xxyyzz";
|
||||
|
||||
#define DISPID_Extend 12345
|
||||
|
||||
CImpIDispatch::CImpIDispatch(void)
|
||||
{
|
||||
m_cRef = 0;
|
||||
}
|
||||
|
||||
CImpIDispatch::~CImpIDispatch(void)
|
||||
{
|
||||
ASSERT(m_cRef == 0);
|
||||
}
|
||||
|
||||
STDMETHODIMP CImpIDispatch::QueryInterface(REFIID riid, void **ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
|
||||
if (IID_IDispatch == riid)
|
||||
*ppv = this;
|
||||
|
||||
if (NULL != *ppv) {
|
||||
((LPUNKNOWN)*ppv)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP_(ULONG) CImpIDispatch::AddRef(void)
|
||||
{
|
||||
return ++m_cRef;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CImpIDispatch::Release(void)
|
||||
{
|
||||
return --m_cRef;
|
||||
}
|
||||
|
||||
STDMETHODIMP CImpIDispatch::GetTypeInfoCount(UINT* /*pctinfo*/)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP CImpIDispatch::GetTypeInfo(
|
||||
/* [in] */ UINT /*iTInfo*/,
|
||||
/* [in] */ LCID /*lcid*/,
|
||||
/* [out] */ ITypeInfo** /*ppTInfo*/)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP CImpIDispatch::GetIDsOfNames(
|
||||
/* [in] */ REFIID riid,
|
||||
/* [size_is][in] */ OLECHAR** rgszNames,
|
||||
/* [in] */ UINT cNames,
|
||||
/* [in] */ LCID lcid,
|
||||
/* [size_is][out] */ DISPID* rgDispId)
|
||||
{
|
||||
HRESULT hr = NOERROR;
|
||||
|
||||
// Hardcoded mapping for this sample
|
||||
// A more usual procedure would be to use a TypeInfo
|
||||
for (UINT i = 0; i < cNames; i++) {
|
||||
if (2 == CompareString(lcid, NORM_IGNOREWIDTH, (char*)pszExtend, 3, (char*)rgszNames[i], 3)) {
|
||||
rgDispId[i] = DISPID_Extend;
|
||||
}
|
||||
else {
|
||||
// One or more are unknown so set the return code accordingly
|
||||
hr = ResultFromScode(DISP_E_UNKNOWNNAME);
|
||||
rgDispId[i] = DISPID_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDMETHODIMP CImpIDispatch::Invoke(
|
||||
/* [in] */ DISPID dispIdMember,
|
||||
/* [in] */ REFIID /*riid*/,
|
||||
/* [in] */ LCID /*lcid*/,
|
||||
/* [in] */ WORD wFlags,
|
||||
/* [out][in] */ DISPPARAMS* pDispParams,
|
||||
/* [out] */ VARIANT* pVarResult,
|
||||
/* [out] */ EXCEPINFO* /*pExcepInfo*/,
|
||||
/* [out] */ UINT* puArgErr)
|
||||
{
|
||||
// For this sample we only support a Property Get on DISPID_Extend
|
||||
// returning a BSTR with "Wibble" as the value
|
||||
if (dispIdMember == DISPID_Extend) {
|
||||
if (wFlags & DISPATCH_PROPERTYGET) {
|
||||
if (pVarResult != NULL) {
|
||||
WCHAR buff[10] = L"Wibble";
|
||||
BSTR bstrRet = SysAllocString(buff);
|
||||
VariantInit(pVarResult);
|
||||
V_VT(pVarResult) = VT_BSTR;
|
||||
V_BSTR(pVarResult) = bstrRet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
+505
@@ -0,0 +1,505 @@
|
||||
/* Rijndael Cipher
|
||||
|
||||
Written by Mike Scott 21st April 1999
|
||||
Copyright (c) 1999 Mike Scott
|
||||
See rijndael documentation
|
||||
|
||||
Permission for free direct or derivative use is granted subject
|
||||
to compliance with any conditions that the originators of the
|
||||
algorithm place on its exploitation.
|
||||
|
||||
Inspiration from Brian Gladman's implementation is acknowledged.
|
||||
|
||||
Written for clarity, rather than speed.
|
||||
Full implementation.
|
||||
Endian indifferent.
|
||||
*/
|
||||
|
||||
/* modified in order to use the libmcrypt API by Nikos Mavroyanopoulos
|
||||
* All modifications are placed under the license of libmcrypt.
|
||||
*/
|
||||
|
||||
|
||||
/* $Id: rijndael-192.c,v 1.1 2007/07/19 06:11:48 pizon Exp $ */
|
||||
|
||||
#include <libdefs.h>
|
||||
|
||||
#include <mcrypt_modules.h>
|
||||
#include "rijndael.h"
|
||||
|
||||
#define _mcrypt_set_key rijndael_192_LTX__mcrypt_set_key
|
||||
#define _mcrypt_encrypt rijndael_192_LTX__mcrypt_encrypt
|
||||
#define _mcrypt_decrypt rijndael_192_LTX__mcrypt_decrypt
|
||||
#define _mcrypt_get_size rijndael_192_LTX__mcrypt_get_size
|
||||
#define _mcrypt_get_block_size rijndael_192_LTX__mcrypt_get_block_size
|
||||
#define _is_block_algorithm rijndael_192_LTX__is_block_algorithm
|
||||
#define _mcrypt_get_key_size rijndael_192_LTX__mcrypt_get_key_size
|
||||
#define _mcrypt_get_supported_key_sizes rijndael_192_LTX__mcrypt_get_supported_key_sizes
|
||||
#define _mcrypt_get_algorithms_name rijndael_192_LTX__mcrypt_get_algorithms_name
|
||||
#define _mcrypt_self_test rijndael_192_LTX__mcrypt_self_test
|
||||
#define _mcrypt_algorithm_version rijndael_192_LTX__mcrypt_algorithm_version
|
||||
|
||||
/* rotates x one bit to the left */
|
||||
|
||||
#define ROTL(x) (((x)>>7)|((x)<<1))
|
||||
|
||||
/* Rotates 32-bit word left by 1, 2 or 3 byte */
|
||||
|
||||
#define ROTL8(x) (((x)<<8)|((x)>>24))
|
||||
#define ROTL16(x) (((x)<<16)|((x)>>16))
|
||||
#define ROTL24(x) (((x)<<24)|((x)>>8))
|
||||
|
||||
/* Fixed Data */
|
||||
|
||||
static byte InCo[4] = { 0xB, 0xD, 0x9, 0xE }; /* Inverse Coefficients */
|
||||
|
||||
static byte fbsub[256];
|
||||
static byte rbsub[256];
|
||||
static byte ptab[256], ltab[256];
|
||||
static word32 ftable[256];
|
||||
static word32 rtable[256];
|
||||
static word32 rco[30];
|
||||
static int tables_ok = 0;
|
||||
|
||||
/* Parameter-dependent data */
|
||||
|
||||
/* in "rijndael.h" */
|
||||
|
||||
static word32 pack(byte * b)
|
||||
{ /* pack bytes into a 32-bit Word */
|
||||
return ((word32) b[3] << 24) | ((word32) b[2] << 16) | ((word32)
|
||||
b[1] << 8)
|
||||
| (word32) b[0];
|
||||
}
|
||||
|
||||
static void unpack(word32 a, byte * b)
|
||||
{ /* unpack bytes from a word */
|
||||
b[0] = (byte) a;
|
||||
b[1] = (byte) (a >> 8);
|
||||
b[2] = (byte) (a >> 16);
|
||||
b[3] = (byte) (a >> 24);
|
||||
}
|
||||
|
||||
static byte xtime(byte a)
|
||||
{
|
||||
byte b;
|
||||
if (a & 0x80)
|
||||
b = 0x1B;
|
||||
else
|
||||
b = 0;
|
||||
a <<= 1;
|
||||
a ^= b;
|
||||
return a;
|
||||
}
|
||||
|
||||
static byte bmul(byte x, byte y)
|
||||
{ /* x.y= AntiLog(Log(x) + Log(y)) */
|
||||
if (x && y)
|
||||
return ptab[(ltab[x] + ltab[y]) % 255];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static word32 SubByte(word32 a)
|
||||
{
|
||||
byte b[4];
|
||||
unpack(a, b);
|
||||
b[0] = fbsub[b[0]];
|
||||
b[1] = fbsub[b[1]];
|
||||
b[2] = fbsub[b[2]];
|
||||
b[3] = fbsub[b[3]];
|
||||
return pack(b);
|
||||
}
|
||||
|
||||
static byte product(word32 x, word32 y)
|
||||
{ /* dot product of two 4-byte arrays */
|
||||
byte xb[4], yb[4];
|
||||
unpack(x, xb);
|
||||
unpack(y, yb);
|
||||
return bmul(xb[0], yb[0]) ^ bmul(xb[1], yb[1]) ^ bmul(xb[2],
|
||||
yb[2]) ^
|
||||
bmul(xb[3], yb[3]);
|
||||
}
|
||||
|
||||
static word32 InvMixCol(word32 x)
|
||||
{ /* matrix Multiplication */
|
||||
word32 y, m;
|
||||
byte b[4];
|
||||
|
||||
m = pack(InCo);
|
||||
b[3] = product(m, x);
|
||||
m = ROTL24(m);
|
||||
b[2] = product(m, x);
|
||||
m = ROTL24(m);
|
||||
b[1] = product(m, x);
|
||||
m = ROTL24(m);
|
||||
b[0] = product(m, x);
|
||||
y = pack(b);
|
||||
return y;
|
||||
}
|
||||
|
||||
static byte ByteSub(byte x)
|
||||
{
|
||||
byte y = ptab[255 - ltab[x]]; /* multiplicative inverse */
|
||||
x = y;
|
||||
x = ROTL(x);
|
||||
y ^= x;
|
||||
x = ROTL(x);
|
||||
y ^= x;
|
||||
x = ROTL(x);
|
||||
y ^= x;
|
||||
x = ROTL(x);
|
||||
y ^= x;
|
||||
y ^= 0x63;
|
||||
return y;
|
||||
}
|
||||
|
||||
static void _mcrypt_rijndael_gentables(void)
|
||||
{ /* generate tables */
|
||||
int i;
|
||||
byte y, b[4];
|
||||
|
||||
/* use 3 as primitive root to generate power and log tables */
|
||||
|
||||
ltab[0] = 0;
|
||||
ptab[0] = 1;
|
||||
ltab[1] = 0;
|
||||
ptab[1] = 3;
|
||||
ltab[3] = 1;
|
||||
for (i = 2; i < 256; i++) {
|
||||
ptab[i] = ptab[i - 1] ^ xtime(ptab[i - 1]);
|
||||
ltab[ptab[i]] = i;
|
||||
}
|
||||
|
||||
/* affine transformation:- each bit is xored with itself shifted one bit */
|
||||
|
||||
fbsub[0] = 0x63;
|
||||
rbsub[0x63] = 0;
|
||||
for (i = 1; i < 256; i++) {
|
||||
y = ByteSub((byte) i);
|
||||
fbsub[i] = y;
|
||||
rbsub[y] = i;
|
||||
}
|
||||
|
||||
for (i = 0, y = 1; i < 30; i++) {
|
||||
rco[i] = y;
|
||||
y = xtime(y);
|
||||
}
|
||||
|
||||
/* calculate forward and reverse tables */
|
||||
for (i = 0; i < 256; i++) {
|
||||
y = fbsub[i];
|
||||
b[3] = y ^ xtime(y);
|
||||
b[2] = y;
|
||||
b[1] = y;
|
||||
b[0] = xtime(y);
|
||||
ftable[i] = pack(b);
|
||||
|
||||
y = rbsub[i];
|
||||
b[3] = bmul(InCo[0], y);
|
||||
b[2] = bmul(InCo[1], y);
|
||||
b[1] = bmul(InCo[2], y);
|
||||
b[0] = bmul(InCo[3], y);
|
||||
rtable[i] = pack(b);
|
||||
}
|
||||
}
|
||||
|
||||
WIN32DLL_DEFINE int _mcrypt_set_key(RI * rinst, byte * key, int nk)
|
||||
{ /* blocksize=32*nb bits. Key=32*nk bits */
|
||||
/* currently nb,bk = 4, 6 or 8 */
|
||||
/* key comes as 4*rinst->Nk bytes */
|
||||
/* Key Scheduler. Create expanded encryption key */
|
||||
int nb = 6; /* 192 block size */
|
||||
int i, j, k, m, N;
|
||||
int C1, C2, C3;
|
||||
word32 CipherKey[8];
|
||||
|
||||
nk /= 4;
|
||||
|
||||
if (tables_ok == 0) {
|
||||
_mcrypt_rijndael_gentables();
|
||||
tables_ok = 1;
|
||||
}
|
||||
|
||||
rinst->Nb = nb;
|
||||
rinst->Nk = nk;
|
||||
|
||||
/* rinst->Nr is number of rounds */
|
||||
if (rinst->Nb >= rinst->Nk)
|
||||
rinst->Nr = 6 + rinst->Nb;
|
||||
else
|
||||
rinst->Nr = 6 + rinst->Nk;
|
||||
|
||||
C1 = 1;
|
||||
if (rinst->Nb < 8) {
|
||||
C2 = 2;
|
||||
C3 = 3;
|
||||
} else {
|
||||
C2 = 3;
|
||||
C3 = 4;
|
||||
}
|
||||
|
||||
/* pre-calculate forward and reverse increments */
|
||||
for (m = j = 0; j < nb; j++, m += 3) {
|
||||
rinst->fi[m] = (j + C1) % nb;
|
||||
rinst->fi[m + 1] = (j + C2) % nb;
|
||||
rinst->fi[m + 2] = (j + C3) % nb;
|
||||
rinst->ri[m] = (nb + j - C1) % nb;
|
||||
rinst->ri[m + 1] = (nb + j - C2) % nb;
|
||||
rinst->ri[m + 2] = (nb + j - C3) % nb;
|
||||
}
|
||||
|
||||
N = rinst->Nb * (rinst->Nr + 1);
|
||||
|
||||
for (i = j = 0; i < rinst->Nk; i++, j += 4) {
|
||||
CipherKey[i] = pack(&key[j]);
|
||||
}
|
||||
for (i = 0; i < rinst->Nk; i++)
|
||||
rinst->fkey[i] = CipherKey[i];
|
||||
for (j = rinst->Nk, k = 0; j < N; j += rinst->Nk, k++) {
|
||||
rinst->fkey[j] =
|
||||
rinst->fkey[j -
|
||||
rinst->Nk] ^ SubByte(ROTL24(rinst->
|
||||
fkey[j -
|
||||
1])) ^
|
||||
rco[k];
|
||||
if (rinst->Nk <= 6) {
|
||||
for (i = 1; i < rinst->Nk && (i + j) < N; i++)
|
||||
rinst->fkey[i + j] =
|
||||
rinst->fkey[i + j -
|
||||
rinst->Nk] ^ rinst->
|
||||
fkey[i + j - 1];
|
||||
} else {
|
||||
for (i = 1; i < 4 && (i + j) < N; i++)
|
||||
rinst->fkey[i + j] =
|
||||
rinst->fkey[i + j -
|
||||
rinst->Nk] ^ rinst->
|
||||
fkey[i + j - 1];
|
||||
if ((j + 4) < N)
|
||||
rinst->fkey[j + 4] =
|
||||
rinst->fkey[j + 4 -
|
||||
rinst->
|
||||
Nk] ^ SubByte(rinst->
|
||||
fkey[j + 3]);
|
||||
for (i = 5; i < rinst->Nk && (i + j) < N; i++)
|
||||
rinst->fkey[i + j] =
|
||||
rinst->fkey[i + j -
|
||||
rinst->Nk] ^ rinst->
|
||||
fkey[i + j - 1];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* now for the expanded decrypt key in reverse order */
|
||||
|
||||
for (j = 0; j < rinst->Nb; j++)
|
||||
rinst->rkey[j + N - rinst->Nb] = rinst->fkey[j];
|
||||
for (i = rinst->Nb; i < N - rinst->Nb; i += rinst->Nb) {
|
||||
k = N - rinst->Nb - i;
|
||||
for (j = 0; j < rinst->Nb; j++)
|
||||
rinst->rkey[k + j] = InvMixCol(rinst->fkey[i + j]);
|
||||
}
|
||||
for (j = N - rinst->Nb; j < N; j++)
|
||||
rinst->rkey[j - N + rinst->Nb] = rinst->fkey[j];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* There is an obvious time/space trade-off possible here. *
|
||||
* Instead of just one ftable[], I could have 4, the other *
|
||||
* 3 pre-rotated to save the ROTL8, ROTL16 and ROTL24 overhead */
|
||||
|
||||
WIN32DLL_DEFINE void _mcrypt_encrypt(RI * rinst, byte * buff)
|
||||
{
|
||||
int i, j, k, m;
|
||||
word32 a[8], b[8], *x, *y, *t;
|
||||
|
||||
for (i = j = 0; i < rinst->Nb; i++, j += 4) {
|
||||
a[i] = pack(&buff[j]);
|
||||
a[i] ^= rinst->fkey[i];
|
||||
}
|
||||
k = rinst->Nb;
|
||||
x = a;
|
||||
y = b;
|
||||
|
||||
/* State alternates between a and b */
|
||||
for (i = 1; i < rinst->Nr; i++) { /* rinst->Nr is number of rounds. May be odd. */
|
||||
|
||||
/* if rinst->Nb is fixed - unroll this next
|
||||
loop and hard-code in the values of fi[] */
|
||||
|
||||
for (m = j = 0; j < rinst->Nb; j++, m += 3) { /* deal with each 32-bit element of the State */
|
||||
/* This is the time-critical bit */
|
||||
y[j] = rinst->fkey[k++] ^ ftable[(byte) x[j]] ^
|
||||
ROTL8(ftable[(byte) (x[rinst->fi[m]] >> 8)]) ^
|
||||
ROTL16(ftable
|
||||
[(byte) (x[rinst->fi[m + 1]] >> 16)]) ^
|
||||
ROTL24(ftable[x[rinst->fi[m + 2]] >> 24]);
|
||||
}
|
||||
t = x;
|
||||
x = y;
|
||||
y = t; /* swap pointers */
|
||||
}
|
||||
|
||||
/* Last Round - unroll if possible */
|
||||
for (m = j = 0; j < rinst->Nb; j++, m += 3) {
|
||||
y[j] = rinst->fkey[k++] ^ (word32) fbsub[(byte) x[j]] ^
|
||||
ROTL8((word32) fbsub[(byte) (x[rinst->fi[m]] >> 8)]) ^
|
||||
ROTL16((word32)
|
||||
fbsub[(byte) (x[rinst->fi[m + 1]] >> 16)]) ^
|
||||
ROTL24((word32) fbsub[x[rinst->fi[m + 2]] >> 24]);
|
||||
}
|
||||
for (i = j = 0; i < rinst->Nb; i++, j += 4) {
|
||||
unpack(y[i], &buff[j]);
|
||||
x[i] = y[i] = 0; /* clean up stack */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
WIN32DLL_DEFINE void _mcrypt_decrypt(RI * rinst, byte * buff)
|
||||
{
|
||||
int i, j, k, m;
|
||||
word32 a[8], b[8], *x, *y, *t;
|
||||
|
||||
for (i = j = 0; i < rinst->Nb; i++, j += 4) {
|
||||
a[i] = pack(&buff[j]);
|
||||
a[i] ^= rinst->rkey[i];
|
||||
}
|
||||
k = rinst->Nb;
|
||||
x = a;
|
||||
y = b;
|
||||
|
||||
/* State alternates between a and b */
|
||||
for (i = 1; i < rinst->Nr; i++) { /* rinst->Nr is number of rounds. May be odd. */
|
||||
|
||||
/* if rinst->Nb is fixed - unroll this next
|
||||
loop and hard-code in the values of ri[] */
|
||||
|
||||
for (m = j = 0; j < rinst->Nb; j++, m += 3) { /* This is the time-critical bit */
|
||||
y[j] = rinst->rkey[k++] ^ rtable[(byte) x[j]] ^
|
||||
ROTL8(rtable[(byte) (x[rinst->ri[m]] >> 8)]) ^
|
||||
ROTL16(rtable
|
||||
[(byte) (x[rinst->ri[m + 1]] >> 16)]) ^
|
||||
ROTL24(rtable[x[rinst->ri[m + 2]] >> 24]);
|
||||
}
|
||||
t = x;
|
||||
x = y;
|
||||
y = t; /* swap pointers */
|
||||
}
|
||||
|
||||
/* Last Round - unroll if possible */
|
||||
for (m = j = 0; j < rinst->Nb; j++, m += 3) {
|
||||
y[j] = rinst->rkey[k++] ^ (word32) rbsub[(byte) x[j]] ^
|
||||
ROTL8((word32) rbsub[(byte) (x[rinst->ri[m]] >> 8)]) ^
|
||||
ROTL16((word32)
|
||||
rbsub[(byte) (x[rinst->ri[m + 1]] >> 16)]) ^
|
||||
ROTL24((word32) rbsub[x[rinst->ri[m + 2]] >> 24]);
|
||||
}
|
||||
for (i = j = 0; i < rinst->Nb; i++, j += 4) {
|
||||
unpack(y[i], &buff[j]);
|
||||
x[i] = y[i] = 0; /* clean up stack */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WIN32DLL_DEFINE int _mcrypt_get_size()
|
||||
{
|
||||
return sizeof(RI);
|
||||
}
|
||||
WIN32DLL_DEFINE int _mcrypt_get_block_size()
|
||||
{
|
||||
return 24;
|
||||
}
|
||||
WIN32DLL_DEFINE int _is_block_algorithm()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
WIN32DLL_DEFINE int _mcrypt_get_key_size()
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
static const int key_sizes[] = { 16, 24, 32 };
|
||||
WIN32DLL_DEFINE const int *_mcrypt_get_supported_key_sizes(int *len)
|
||||
{
|
||||
*len = sizeof(key_sizes)/sizeof(int);
|
||||
return key_sizes;
|
||||
|
||||
}
|
||||
WIN32DLL_DEFINE char *_mcrypt_get_algorithms_name()
|
||||
{
|
||||
return "Rijndael-192";
|
||||
}
|
||||
|
||||
#define CIPHER "380ee49a5de1dbd4b9cc11af60b8c8ff669e367af8948a8a"
|
||||
|
||||
WIN32DLL_DEFINE int _mcrypt_self_test()
|
||||
{
|
||||
char *keyword;
|
||||
unsigned char plaintext[32];
|
||||
unsigned char ciphertext[32];
|
||||
int blocksize = _mcrypt_get_block_size(), j;
|
||||
void *key;
|
||||
unsigned char cipher_tmp[200];
|
||||
|
||||
keyword = calloc(1, _mcrypt_get_key_size());
|
||||
if (keyword == NULL)
|
||||
return -1;
|
||||
|
||||
for (j = 0; j < _mcrypt_get_key_size(); j++) {
|
||||
keyword[j] = ((j * 2 + 10) % 256);
|
||||
}
|
||||
|
||||
for (j = 0; j < blocksize; j++) {
|
||||
plaintext[j] = j % 256;
|
||||
}
|
||||
key = malloc(_mcrypt_get_size());
|
||||
if (key == NULL) {
|
||||
free(keyword);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(ciphertext, plaintext, blocksize);
|
||||
|
||||
_mcrypt_set_key(key, (void *) keyword, _mcrypt_get_key_size());
|
||||
free(keyword);
|
||||
|
||||
_mcrypt_encrypt(key, (void *) ciphertext);
|
||||
|
||||
for (j = 0; j < blocksize; j++) {
|
||||
sprintf(&((char *) cipher_tmp)[2 * j], "%.2x",
|
||||
ciphertext[j]);
|
||||
}
|
||||
|
||||
if (strcmp((char *) cipher_tmp, CIPHER) != 0) {
|
||||
printf("failed compatibility\n");
|
||||
printf("Expected: %s\nGot: %s\n", CIPHER,
|
||||
(char *) cipher_tmp);
|
||||
free(key);
|
||||
return -1;
|
||||
}
|
||||
_mcrypt_decrypt(key, (void *) ciphertext);
|
||||
free(key);
|
||||
|
||||
if (strcmp(ciphertext, plaintext) != 0) {
|
||||
printf("failed internally\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WIN32DLL_DEFINE word32 _mcrypt_algorithm_version()
|
||||
{
|
||||
return 20010801;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
# ifdef USE_LTDL
|
||||
WIN32DLL_DEFINE int main (void)
|
||||
{
|
||||
/* empty main function to avoid linker error (see cygwin FAQ) */
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user