mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-07 08:56:17 +08:00
Update serpenttest.c
This commit is contained in:
@@ -49,8 +49,11 @@
|
||||
|
||||
|
||||
|
||||
// test unit for serpent-256
|
||||
// Odzhan
|
||||
/* ======================
|
||||
* test unit for serpent-256
|
||||
* Odzhan
|
||||
*========================
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -58,6 +61,16 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../e_os.h"
|
||||
|
||||
#ifdef OPENSSL_NO_SERPENT
|
||||
int main(int argc. char **argv)
|
||||
{
|
||||
printf("No Serpent support\n");
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
#include <openssl/serpent.h>
|
||||
|
||||
char *plain[] =
|
||||
@@ -118,7 +131,7 @@ int main(void)
|
||||
plen = hex2bin(pt1, plain[i]);
|
||||
klen = hex2bin(key, keys[i]);
|
||||
|
||||
// set key
|
||||
/* set key */
|
||||
memset(&skey, 0, sizeof(skey));
|
||||
p = (uint32_t*)&skey.x[0][0];
|
||||
|
||||
@@ -126,11 +139,12 @@ int main(void)
|
||||
printf("\nkey=");
|
||||
|
||||
for (j = 0; j<sizeof(skey) / sizeof(serpent_subkey_t) * 4; j++) {
|
||||
if ((j % 8) == 0) putchar('\n');
|
||||
if ((j % 8) == 0)
|
||||
putchar('\n');
|
||||
printf("%08X ", p[j]);
|
||||
}
|
||||
|
||||
// encrypt
|
||||
/* encrypt */
|
||||
memcpy(ct2.b, pt1, SERPENT_BLK_LEN);
|
||||
|
||||
printf("\n\n");
|
||||
|
||||
Reference in New Issue
Block a user