progress on name change

This commit is contained in:
Jacob Barthelmeh
2014-12-19 15:43:19 -07:00
parent 5107c6c12b
commit 77f167790d
5 changed files with 79 additions and 80 deletions

View File

@@ -22,8 +22,6 @@
/* wolfssl_cyassl compatibility layer */ /* wolfssl_cyassl compatibility layer */
#include <cyassl/ssl.h> #include <cyassl/ssl.h>
#include <wolfssl/wolfcrypt/arc4.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@@ -591,75 +589,75 @@ static int OpenNitroxDevice(int dma_mode,int dev_id)
#ifdef CYASSL_MD2 #ifdef CYASSL_MD2
int md2_test() int md2_test()
{ {
Md2 md2; // Md2 md2;
byte hash[MD2_DIGEST_SIZE]; // byte hash[MD2_DIGEST_SIZE];
//
testVector a, b, c, d, e, f, g; // testVector a, b, c, d, e, f, g;
testVector test_md2[7]; // testVector test_md2[7];
int times = sizeof(test_md2) / sizeof(testVector), i; // int times = sizeof(test_md2) / sizeof(testVector), i;
//
a.input = ""; // a.input = "";
a.output = "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69" // a.output = "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69"
"\x27\x73"; // "\x27\x73";
a.inLen = strlen(a.input); // a.inLen = strlen(a.input);
a.outLen = MD2_DIGEST_SIZE; // a.outLen = MD2_DIGEST_SIZE;
//
b.input = "a"; // b.input = "a";
b.output = "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0" // b.output = "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0"
"\xb5\xd1"; // "\xb5\xd1";
b.inLen = strlen(b.input); // b.inLen = strlen(b.input);
b.outLen = MD2_DIGEST_SIZE; // b.outLen = MD2_DIGEST_SIZE;
//
c.input = "abc"; // c.input = "abc";
c.output = "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde" // c.output = "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde"
"\xd6\xbb"; // "\xd6\xbb";
c.inLen = strlen(c.input); // c.inLen = strlen(c.input);
c.outLen = MD2_DIGEST_SIZE; // c.outLen = MD2_DIGEST_SIZE;
//
d.input = "message digest"; // d.input = "message digest";
d.output = "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe" // d.output = "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe"
"\x06\xb0"; // "\x06\xb0";
d.inLen = strlen(d.input); // d.inLen = strlen(d.input);
d.outLen = MD2_DIGEST_SIZE; // d.outLen = MD2_DIGEST_SIZE;
//
e.input = "abcdefghijklmnopqrstuvwxyz"; // e.input = "abcdefghijklmnopqrstuvwxyz";
e.output = "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47" // e.output = "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47"
"\x94\x0b"; // "\x94\x0b";
e.inLen = strlen(e.input); // e.inLen = strlen(e.input);
e.outLen = MD2_DIGEST_SIZE; // e.outLen = MD2_DIGEST_SIZE;
//
f.input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345" // f.input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
"6789"; // "6789";
f.output = "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03" // f.output = "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03"
"\x38\xcd"; // "\x38\xcd";
f.inLen = strlen(f.input); // f.inLen = strlen(f.input);
f.outLen = MD2_DIGEST_SIZE; // f.outLen = MD2_DIGEST_SIZE;
//
g.input = "1234567890123456789012345678901234567890123456789012345678" // g.input = "1234567890123456789012345678901234567890123456789012345678"
"9012345678901234567890"; // "9012345678901234567890";
g.output = "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3" // g.output = "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3"
"\xef\xd8"; // "\xef\xd8";
g.inLen = strlen(g.input); // g.inLen = strlen(g.input);
g.outLen = MD2_DIGEST_SIZE; // g.outLen = MD2_DIGEST_SIZE;
//
test_md2[0] = a; // test_md2[0] = a;
test_md2[1] = b; // test_md2[1] = b;
test_md2[2] = c; // test_md2[2] = c;
test_md2[3] = d; // test_md2[3] = d;
test_md2[4] = e; // test_md2[4] = e;
test_md2[5] = f; // test_md2[5] = f;
test_md2[6] = g; // test_md2[6] = g;
//
InitMd2(&md2); // InitMd2(&md2);
//
for (i = 0; i < times; ++i) { // for (i = 0; i < times; ++i) {
Md2Update(&md2, (byte*)test_md2[i].input, (word32)test_md2[i].inLen); // Md2Update(&md2, (byte*)test_md2[i].input, (word32)test_md2[i].inLen);
Md2Final(&md2, hash); // Md2Final(&md2, hash);
//
if (memcmp(hash, test_md2[i].output, MD2_DIGEST_SIZE) != 0) // if (memcmp(hash, test_md2[i].output, MD2_DIGEST_SIZE) != 0)
return -155 - i; // return -155 - i;
} // }
//
return 0; return 0;
} }
#endif #endif

View File

@@ -444,12 +444,12 @@
/* for md2 reverse compatibility */ /* for md2 reverse compatibility */
#define CYASSL_MD2 WOLFSSL_MD2 /* @TODO */ #define CYASSL_MD2 WOLFSSL_MD2 /* @TODO */
#ifdef WOLFSSL_MD2 //#ifdef WOLFSSL_MD2
#define InitMd2 wc_InitMd2 #define InitMd2 wc_InitMd2
#define Md2Update wc_Md2Update #define Md2Update wc_Md2Update
#define Md2Final wc_Md2Final #define Md2Final wc_Md2Final
#define Md2Hash wc_Md2Hash #define Md2Hash wc_Md2Hash
#endif //#endif
/* for md4 reverse compatibility */ /* for md4 reverse compatibility */

View File

@@ -24,9 +24,6 @@
#endif #endif
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>
//#include <cyassl/ctaocrypt/visibility.h>
//#undef WOLFSSL_API
//#define WOLFSSL_API CYASSL_API
#ifndef NO_RC4 #ifndef NO_RC4

View File

@@ -26,7 +26,8 @@
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>
#ifdef WOLFSSL_MD2 //#ifdef WOLFSSL_MD2
//@TODO
#include <wolfssl/wolfcrypt/md2.h> #include <wolfssl/wolfcrypt/md2.h>
#include <wolfssl/wolfcrypt/error-crypt.h> #include <wolfssl/wolfcrypt/error-crypt.h>
@@ -156,4 +157,5 @@ int wc_Md2Hash(const byte* data, word32 len, byte* hash)
} }
#endif /* WOLFSSL_MD2 */ //@TODO
//#endif /* WOLFSSL_MD2 */

View File

@@ -20,7 +20,8 @@
*/ */
#ifdef WOLFSSL_MD2 //#ifdef WOLFSSL_MD2
//@TODO
#ifndef WOLF_CRYPT_MD2_H #ifndef WOLF_CRYPT_MD2_H
#define WOLF_CRYPT_MD2_H #define WOLF_CRYPT_MD2_H
@@ -62,4 +63,5 @@ WOLFSSL_API int wc_Md2Hash(const byte*, word32, byte*);
#endif #endif
#endif /* CTAO_CRYPT_MD2_H */ #endif /* CTAO_CRYPT_MD2_H */
#endif /* CYASSL_MD2 */ //@TODO
//#endif /* CYASSL_MD2 */