[前][次][番号順一覧][スレッド一覧]

ruby-changes:43170

From: nobu <ko1@a...>
Date: Wed, 1 Jun 2016 15:05:26 +0900 (JST)
Subject: [ruby-changes:43170] nobu:r55244 (trunk): des_tables.c

nobu	2016-06-01 15:05:21 +0900 (Wed, 01 Jun 2016)

  New Revision: 55244

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55244

  Log:
    des_tables.c
    
    * missing/crypt_r.c: initialize DES tables statically.

  Added files:
    trunk/missing/des_tables.c
  Modified files:
    trunk/missing/crypt_r.c
Index: missing/crypt_r.c
===================================================================
--- missing/crypt_r.c	(revision 55243)
+++ missing/crypt_r.c	(revision 55244)
@@ -149,6 +149,7 @@ permute(const unsigned char *cp, C_block https://github.com/ruby/ruby/blob/trunk/missing/crypt_r.c#L149
 STATIC void prtab(const char *s, const unsigned char *t, int num_rows);
 #endif
 
+#ifdef DUMP
 /* =====  (mostly) Standard DES Tables ==================== */
 
 static const unsigned char IP[] = {	/* initial permutation */
@@ -186,11 +187,13 @@ static const unsigned char PC1[] = {	/* https://github.com/ruby/ruby/blob/trunk/missing/crypt_r.c#L187
 	14,  6, 61, 53, 45, 37, 29,
 	21, 13,  5, 28, 20, 12,  4,
 };
+#endif
 
 static const unsigned char Rotates[] = { /* PC1 rotation schedule */
 	1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1,
 };
 
+#ifdef DUMP
 /* note: each "row" of PC2 is left-padded with bits that make it invertible */
 static const unsigned char PC2[] = {	/* permuted choice table 2 */
 	 9, 18,    14, 17, 11, 24,  1,  5,
@@ -285,6 +288,7 @@ static const unsigned char CIFP[] = {	/* https://github.com/ruby/ruby/blob/trunk/missing/crypt_r.c#L288
 	41, 42, 43, 44,   57, 58, 59, 60,
 	45, 46, 47, 48,   61, 62, 63, 64,
 };
+#endif
 
 static const unsigned char itoa64[] =	/* 0..63 => ascii-64 */
 	"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -305,6 +309,7 @@ static const unsigned char a64toi[256] = https://github.com/ruby/ruby/blob/trunk/missing/crypt_r.c#L309
 	A64TOI64(0x00), A64TOI64(0x40),
 };
 
+#ifdef DUMP
 /* =====  Tables that are initialized at run time  ==================== */
 
 typedef struct {
@@ -327,8 +332,6 @@ typedef struct { https://github.com/ruby/ruby/blob/trunk/missing/crypt_r.c#L332
 } des_tables_t;
 static des_tables_t des_tables[1];
 
-static const C_block	constdatablock;	/* encryption constant */
-
 #define des_tables	((const des_tables_t *)des_tables)
 #define PC1ROT		(des_tables->PC1ROT)
 #define PC2ROT		(des_tables->PC2ROT)
@@ -336,13 +339,20 @@ static const C_block	constdatablock;	/* https://github.com/ruby/ruby/blob/trunk/missing/crypt_r.c#L339
 #define SPE		(des_tables->SPE)
 #define CF6464		(des_tables->CF6464)
 
+STATIC void init_des(void);
+STATIC void init_perm(C_block perm[64/CHUNKBITS][1<<CHUNKBITS], unsigned char p[64], int chars_in, int chars_out);
+
+#else
+#include "des_tables.c"
+#define init_des() ((void)0)
+#endif
+
+static const C_block	constdatablock;	/* encryption constant */
+
 #define KS	(data->KS)
 #define cryptresult (data->cryptresult)
 #define des_ready (data->initialized)
 
-STATIC void init_des(void);
-STATIC void init_perm(C_block perm[64/CHUNKBITS][1<<CHUNKBITS], unsigned char p[64], int chars_in, int chars_out);
-
 static void des_setkey_r(const unsigned char *key, struct crypt_data *data);
 static void des_cipher_r(const unsigned char *in, unsigned char *out, long salt, int num_iter, struct crypt_data *data);
 
@@ -600,6 +610,7 @@ des_cipher_r(const unsigned char *in, un https://github.com/ruby/ruby/blob/trunk/missing/crypt_r.c#L610
 #undef cryptresult
 #undef des_ready
 
+#ifdef DUMP
 /*
  * Initialize various tables.  This need only be done once.  It could even be
  * done at compile time, if the compiler were capable of that sort of thing.
@@ -764,6 +775,7 @@ init_perm(C_block perm[64/CHUNKBITS][1<< https://github.com/ruby/ruby/blob/trunk/missing/crypt_r.c#L775
 		}
 	}
 }
+#endif
 
 /*
  * "setkey" routine (for backwards compatibility)
@@ -840,3 +852,97 @@ prtab(const char *s, const unsigned char https://github.com/ruby/ruby/blob/trunk/missing/crypt_r.c#L852
 	(void)printf("\n");
 }
 #endif
+
+#ifdef DUMP
+#ifndef numberof
+#define numberof(array) (int )(sizeof(array) / sizeof((array)[0]))
+#endif
+void
+dump_block(const C_block *block)
+{
+	int i;
+	printf("{{");
+	for (i = 0; i < numberof(block->b); ++i) {
+		printf("%3d,", block->b[i]);
+	}
+	printf("}},\n");
+}
+
+int
+main(void)
+{
+	int i, j, k;
+	init_des();
+	printf("/* Initial key schedule permutation */\n");
+	printf("static const C_block	PC1ROT[64/CHUNKBITS][1<<CHUNKBITS] = {\n");
+	for (i = 0; i < numberof(PC1ROT); ++i) {
+		printf("\t{\n");
+		for (j = 0; j < numberof(PC1ROT[0]); ++j) {
+			printf("\t\t");
+			dump_block(&PC1ROT[i][j]);
+		}
+		printf("\t},\n");
+	}
+	printf("};\n\n");
+
+	printf("/* Subsequent key schedule rotation permutations */\n");
+	printf("static const C_block	PC2ROT[2][64/CHUNKBITS][1<<CHUNKBITS] = {\n");
+	for (i = 0; i < numberof(PC2ROT); ++i) {
+		printf("\t{\n");
+		for (j = 0; j < numberof(PC2ROT[0]); ++j) {
+			printf("\t\t{\n");
+			for (k = 0; k < numberof(PC2ROT[0][0]); ++k) {
+				printf("\t\t\t");
+				dump_block(&PC2ROT[i][j][k]);
+			}
+			printf("\t\t},\n");
+		}
+		printf("\t},\n");
+	}
+	printf("};\n\n");
+
+	printf("/* Initial permutation/expansion table */\n");
+	printf("static const C_block	IE3264[32/CHUNKBITS][1<<CHUNKBITS] = {\n");
+	for (i = 0; i < numberof(IE3264); ++i) {
+		printf("\t{\n");
+		for (j = 0; j < numberof(IE3264[0]); ++j) {
+			printf("\t\t");
+			dump_block(&IE3264[i][j]);
+		}
+		printf("\t},\n");
+	}
+	printf("};\n\n");
+
+	printf("/* Table that combines the S, P, and E operations.  */\n");
+	printf("static const long SPE[2][8][64] = {\n");
+	for (i = 0; i < numberof(SPE); ++i) {
+		printf("\t{\n");
+		for (j = 0; j < numberof(SPE[0]); ++j) {
+			int r = 0;
+			printf("\t\t{");
+			for (k = 0; k < numberof(SPE[0][0]); ++k) {
+				if (r == 0) printf("\n\t\t\t");
+				printf("%10ld,", SPE[i][j][k]);
+				if (++r == 4) r = 0;
+			}
+			printf("\n\t\t},\n");
+		}
+		printf("\t},\n");
+	}
+	printf("};\n\n");
+
+	printf("/* compressed/interleaved => final permutation table */\n");
+	printf("static const C_block CF6464[64/CHUNKBITS][1<<CHUNKBITS] = {\n");
+	for (i = 0; i < numberof(CF6464); ++i) {
+		printf("\t{\n");
+		for (j = 0; j < numberof(CF6464[0]); ++j) {
+			printf("\t\t");
+			dump_block(&CF6464[i][j]);
+		}
+		printf("\t},\n");
+	}
+	printf("};\n\n");
+
+	return 0;
+}
+#endif
Index: missing/des_tables.c
===================================================================
--- missing/des_tables.c	(revision 0)
+++ missing/des_tables.c	(revision 55244)
@@ -0,0 +1,1612 @@ https://github.com/ruby/ruby/blob/trunk/missing/des_tables.c#L1
+/* Initial key schedule permutation */
+static const C_block	PC1ROT[64/CHUNKBITS][1<<CHUNKBITS] = {
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  1,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  1,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  1,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  1,  0,  0,  0,  0,}},
+		{{  0,  0,  1,  1,  0,  0,  0,  0,}},
+		{{  0,  0,  1,  1,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0, 16,  0,  0,}},
+		{{  0,  0,  0,  0,  0, 16,  0,  0,}},
+		{{  0,  0,  1,  0,  0, 16,  0,  0,}},
+		{{  0,  0,  1,  0,  0, 16,  0,  0,}},
+		{{  0,  0,  0,  1,  0, 16,  0,  0,}},
+		{{  0,  0,  0,  1,  0, 16,  0,  0,}},
+		{{  0,  0,  1,  1,  0, 16,  0,  0,}},
+		{{  0,  0,  1,  1,  0, 16,  0,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,128,  0,  0,  0,}},
+		{{  0,  0,  4,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  4,  0,128,  0,  0,  0,}},
+		{{  0, 16,  0,  0,  0,  0,  0,  0,}},
+		{{  0, 16,  0,  0,128,  0,  0,  0,}},
+		{{  0, 16,  4,  0,  0,  0,  0,  0,}},
+		{{  0, 16,  4,  0,128,  0,  0,  0,}},
+		{{  0,  0,  0,  8,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  8,128,  0,  0,  0,}},
+		{{  0,  0,  4,  8,  0,  0,  0,  0,}},
+		{{  0,  0,  4,  8,128,  0,  0,  0,}},
+		{{  0, 16,  0,  8,  0,  0,  0,  0,}},
+		{{  0, 16,  0,  8,128,  0,  0,  0,}},
+		{{  0, 16,  4,  8,  0,  0,  0,  0,}},
+		{{  0, 16,  4,  8,128,  0,  0,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0, 64,  0,}},
+		{{  0,  0,  0,  0,  0,  0, 64,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  8,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  8,}},
+		{{  0,  0,  0,  0,  0,  0, 64,  8,}},
+		{{  0,  0,  0,  0,  0,  0, 64,  8,}},
+		{{  0,  0,  0,  0,  0,  0,  0, 16,}},
+		{{  0,  0,  0,  0,  0,  0,  0, 16,}},
+		{{  0,  0,  0,  0,  0,  0, 64, 16,}},
+		{{  0,  0,  0,  0,  0,  0, 64, 16,}},
+		{{  0,  0,  0,  0,  0,  0,  0, 24,}},
+		{{  0,  0,  0,  0,  0,  0,  0, 24,}},
+		{{  0,  0,  0,  0,  0,  0, 64, 24,}},
+		{{  0,  0,  0,  0,  0,  0, 64, 24,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  2,  0,  0,  0,  0,}},
+		{{  0,  1,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  1,  0,  2,  0,  0,  0,  0,}},
+		{{  4,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  4,  0,  0,  2,  0,  0,  0,  0,}},
+		{{  4,  1,  0,  0,  0,  0,  0,  0,}},
+		{{  4,  1,  0,  2,  0,  0,  0,  0,}},
+		{{  0, 32,  0,  0,  0,  0,  0,  0,}},
+		{{  0, 32,  0,  2,  0,  0,  0,  0,}},
+		{{  0, 33,  0,  0,  0,  0,  0,  0,}},
+		{{  0, 33,  0,  2,  0,  0,  0,  0,}},
+		{{  4, 32,  0,  0,  0,  0,  0,  0,}},
+		{{  4, 32,  0,  2,  0,  0,  0,  0,}},
+		{{  4, 33,  0,  0,  0,  0,  0,  0,}},
+		{{  4, 33,  0,  2,  0,  0,  0,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0, 64,  0,  0,}},
+		{{  0,  0,  0,  0,  0, 64,  0,  0,}},
+		{{  0,  0,  0,  0,  4,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  4,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  4, 64,  0,  0,}},
+		{{  0,  0,  0,  0,  4, 64,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  8,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  8,  0,}},
+		{{  0,  0,  0,  0,  0, 64,  8,  0,}},
+		{{  0,  0,  0,  0,  0, 64,  8,  0,}},
+		{{  0,  0,  0,  0,  4,  0,  8,  0,}},
+		{{  0,  0,  0,  0,  4,  0,  8,  0,}},
+		{{  0,  0,  0,  0,  4, 64,  8,  0,}},
+		{{  0,  0,  0,  0,  4, 64,  8,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,128,  0,}},
+		{{  0, 64,  0,  0,  0,  0,  0,  0,}},
+		{{  0, 64,  0,  0,  0,  0,128,  0,}},
+		{{  0,  0,  0, 64,  0,  0,  0,  0,}},
+		{{  0,  0,  0, 64,  0,  0,128,  0,}},
+		{{  0, 64,  0, 64,  0,  0,  0,  0,}},
+		{{  0, 64,  0, 64,  0,  0,128,  0,}},
+		{{128,  0,  0,  0,  0,  0,  0,  0,}},
+		{{128,  0,  0,  0,  0,  0,128,  0,}},
+		{{128, 64,  0,  0,  0,  0,  0,  0,}},
+		{{128, 64,  0,  0,  0,  0,128,  0,}},
+		{{128,  0,  0, 64,  0,  0,  0,  0,}},
+		{{128,  0,  0, 64,  0,  0,128,  0,}},
+		{{128, 64,  0, 64,  0,  0,  0,  0,}},
+		{{128, 64,  0, 64,  0,  0,128,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,128,}},
+		{{  0,  0,  0,  0,  0,  0,  0,128,}},
+		{{  0,  0,  0,  0,  0,  8,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  8,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  8,  0,128,}},
+		{{  0,  0,  0,  0,  0,  8,  0,128,}},
+		{{  0,  0,  0,  0,  0,128,  0,  0,}},
+		{{  0,  0,  0,  0,  0,128,  0,  0,}},
+		{{  0,  0,  0,  0,  0,128,  0,128,}},
+		{{  0,  0,  0,  0,  0,128,  0,128,}},
+		{{  0,  0,  0,  0,  0,136,  0,  0,}},
+		{{  0,  0,  0,  0,  0,136,  0,  0,}},
+		{{  0,  0,  0,  0,  0,136,  0,128,}},
+		{{  0,  0,  0,  0,  0,136,  0,128,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  8,  0,  0,  0,}},
+		{{  0,  0,  0, 32,  0,  0,  0,  0,}},
+		{{  0,  0,  0, 32,  8,  0,  0,  0,}},
+		{{  0,  0, 16,  0,  0,  0,  0,  0,}},
+		{{  0,  0, 16,  0,  8,  0,  0,  0,}},
+		{{  0,  0, 16, 32,  0,  0,  0,  0,}},
+		{{  0,  0, 16, 32,  8,  0,  0,  0,}},
+		{{  0,  0, 32,  0,  0,  0,  0,  0,}},
+		{{  0,  0, 32,  0,  8,  0,  0,  0,}},
+		{{  0,  0, 32, 32,  0,  0,  0,  0,}},
+		{{  0,  0, 32, 32,  8,  0,  0,  0,}},
+		{{  0,  0, 48,  0,  0,  0,  0,  0,}},
+		{{  0,  0, 48,  0,  8,  0,  0,  0,}},
+		{{  0,  0, 48, 32,  0,  0,  0,  0,}},
+		{{  0,  0, 48, 32,  8,  0,  0,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0, 16,  0,  0,  0,}},
+		{{  0,  0,  0,  0, 16,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0, 16,  0,}},
+		{{  0,  0,  0,  0,  0,  0, 16,  0,}},
+		{{  0,  0,  0,  0, 16,  0, 16,  0,}},
+		{{  0,  0,  0,  0, 16,  0, 16,  0,}},
+		{{  0,  0,  0,  0, 64,  0,  0,  0,}},
+		{{  0,  0,  0,  0, 64,  0,  0,  0,}},
+		{{  0,  0,  0,  0, 80,  0,  0,  0,}},
+		{{  0,  0,  0,  0, 80,  0,  0,  0,}},
+		{{  0,  0,  0,  0, 64,  0, 16,  0,}},
+		{{  0,  0,  0,  0, 64,  0, 16,  0,}},
+		{{  0,  0,  0,  0, 80,  0, 16,  0,}},
+		{{  0,  0,  0,  0, 80,  0, 16,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0, 16,  0,  0,  0,  0,}},
+		{{  0,  0,  8,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  8, 16,  0,  0,  0,  0,}},
+		{{ 16,  0,  0,  0,  0,  0,  0,  0,}},
+		{{ 16,  0,  0, 16,  0,  0,  0,  0,}},
+		{{ 16,  0,  8,  0,  0,  0,  0,  0,}},
+		{{ 16,  0,  8, 16,  0,  0,  0,  0,}},
+		{{  0,  4,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  4,  0, 16,  0,  0,  0,  0,}},
+		{{  0,  4,  8,  0,  0,  0,  0,  0,}},
+		{{  0,  4,  8, 16,  0,  0,  0,  0,}},
+		{{ 16,  4,  0,  0,  0,  0,  0,  0,}},
+		{{ 16,  4,  0, 16,  0,  0,  0,  0,}},
+		{{ 16,  4,  8,  0,  0,  0,  0,  0,}},
+		{{ 16,  4,  8, 16,  0,  0,  0,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  4,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  4,  0,  0,}},
+		{{  0,  0,  2,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  2,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  2,  0,  0,  4,  0,  0,}},
+		{{  0,  0,  2,  0,  0,  4,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  4,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  4,}},
+		{{  0,  0,  0,  0,  0,  4,  0,  4,}},
+		{{  0,  0,  0,  0,  0,  4,  0,  4,}},
+		{{  0,  0,  2,  0,  0,  0,  0,  4,}},
+		{{  0,  0,  2,  0,  0,  0,  0,  4,}},
+		{{  0,  0,  2,  0,  0,  4,  0,  4,}},
+		{{  0,  0,  2,  0,  0,  4,  0,  4,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0, 64,  0,  0,  0,  0,  0,}},
+		{{  2,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  2,  0, 64,  0,  0,  0,  0,  0,}},
+		{{  0,128,  0,  0,  0,  0,  0,  0,}},
+		{{  0,128, 64,  0,  0,  0,  0,  0,}},
+		{{  2,128,  0,  0,  0,  0,  0,  0,}},
+		{{  2,128, 64,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,128,  0,  0,  0,  0,}},
+		{{  0,  0, 64,128,  0,  0,  0,  0,}},
+		{{  2,  0,  0,128,  0,  0,  0,  0,}},
+		{{  2,  0, 64,128,  0,  0,  0,  0,}},
+		{{  0,128,  0,128,  0,  0,  0,  0,}},
+		{{  0,128, 64,128,  0,  0,  0,  0,}},
+		{{  2,128,  0,128,  0,  0,  0,  0,}},
+		{{  2,128, 64,128,  0,  0,  0,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0, 64,}},
+		{{  0,  0,  0,  0,  0,  0,  0, 64,}},
+		{{  0,  0,  0,  0, 32,  0,  0,  0,}},
+		{{  0,  0,  0,  0, 32,  0,  0,  0,}},
+		{{  0,  0,  0,  0, 32,  0,  0, 64,}},
+		{{  0,  0,  0,  0, 32,  0,  0, 64,}},
+		{{  0,  0,  0,  0,  0, 32,  0,  0,}},
+		{{  0,  0,  0,  0,  0, 32,  0,  0,}},
+		{{  0,  0,  0,  0,  0, 32,  0, 64,}},
+		{{  0,  0,  0,  0,  0, 32,  0, 64,}},
+		{{  0,  0,  0,  0, 32, 32,  0,  0,}},
+		{{  0,  0,  0,  0, 32, 32,  0,  0,}},
+		{{  0,  0,  0,  0, 32, 32,  0, 64,}},
+		{{  0,  0,  0,  0, 32, 32,  0, 64,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  2,  0,  0,  0,  0,  0,  0,}},
+		{{  8,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  8,  2,  0,  0,  0,  0,  0,  0,}},
+		{{  1,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  1,  2,  0,  0,  0,  0,  0,  0,}},
+		{{  9,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  9,  2,  0,  0,  0,  0,  0,  0,}},
+		{{ 64,  0,  0,  0,  0,  0,  0,  0,}},
+		{{ 64,  2,  0,  0,  0,  0,  0,  0,}},
+		{{ 72,  0,  0,  0,  0,  0,  0,  0,}},
+		{{ 72,  2,  0,  0,  0,  0,  0,  0,}},
+		{{ 65,  0,  0,  0,  0,  0,  0,  0,}},
+		{{ 65,  2,  0,  0,  0,  0,  0,  0,}},
+		{{ 73,  0,  0,  0,  0,  0,  0,  0,}},
+		{{ 73,  2,  0,  0,  0,  0,  0,  0,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  0,  0,  0, 32,  0,}},
+		{{  0,  0,  0,  0,  0,  0, 32,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  0, 32,}},
+		{{  0,  0,  0,  0,  0,  0,  0, 32,}},
+		{{  0,  0,  0,  0,  0,  0, 32, 32,}},
+		{{  0,  0,  0,  0,  0,  0, 32, 32,}},
+		{{  0,  0,  0,  0,  0,  0,  4,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  4,  0,}},
+		{{  0,  0,  0,  0,  0,  0, 36,  0,}},
+		{{  0,  0,  0,  0,  0,  0, 36,  0,}},
+		{{  0,  0,  0,  0,  0,  0,  4, 32,}},
+		{{  0,  0,  0,  0,  0,  0,  4, 32,}},
+		{{  0,  0,  0,  0,  0,  0, 36, 32,}},
+		{{  0,  0,  0,  0,  0,  0, 36, 32,}},
+	},
+	{
+		{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+		{{ 32,  0,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  0,  0,  4,  0,  0,  0,  0,}},
+		{{ 32,  0,  0,  4,  0,  0,  0,  0,}},
+		{{  0,  0,128,  0,  0,  0,  0,  0,}},
+		{{ 32,  0,128,  0,  0,  0,  0,  0,}},
+		{{  0,  0,128,  4,  0,  0,  0,  0,}},
+		{{ 32,  0,128,  4,  0,  0,  0,  0,}},
+		{{  0,  8,  0,  0,  0,  0,  0,  0,}},
+		{{ 32,  8,  0,  0,  0,  0,  0,  0,}},
+		{{  0,  8,  0,  4,  0,  0,  0,  0,}},
+		{{ 32,  8,  0,  4,  0,  0,  0,  0,}},
+		{{  0,  8,128,  0,  0,  0,  0,  0,}},
+		{{ 32,  8,128,  0,  0,  0,  0,  0,}},
+		{{  0,  8,128,  4,  0,  0,  0,  0,}},
+		{{ 32,  8,128,  4,  0,  0,  0,  0,}},
+	},
+};
+
+/* Subsequent key schedule rotation permutations */
+static const C_block	PC2ROT[2][64/CHUNKBITS][1<<CHUNKBITS] = {
+	{
+		{
+			{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+			{{  0,  0,128,  0,  0,  0,  0,  0,}},
+			{{  8,  0,  0,  0,  0,  0,  0,  0,}},
+			{{  8,  0,128,  0,  0,  0,  0,  0,}},
+			{{  0,  0,  0, 64,  0,  0,  0,  0,}},
+			{{  0,  0,128, 64,  0,  0,  0,  0,}},
+			{{  8,  0,  0, 64,  0,  0,  0,  0,}},
+			{{  8,  0,128, 64,  0,  0,  0,  0,}},
+			{{  0,  0,  0,  4,  0,  0,  0,  0,}},
+			{{  0,  0,128,  4,  0,  0,  0,  0,}},
+			{{  8,  0,  0,  4,  0,  0,  0,  0,}},
+			{{  8,  0,128,  4,  0,  0,  0,  0,}},
+			{{  0,  0,  0, 68,  0,  0,  0,  0,}},
+			{{  0,  0,128, 68,  0,  0,  0,  0,}},
+			{{  8,  0,  0, 68,  0,  0,  0,  0,}},
+			{{  8,  0,128, 68,  0,  0,  0,  0,}},
+		},
+		{
+			{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+			{{  0,128,  0,  0,  0,  0,  0,  0,}},
+			{{  0,  0,  4,  0,  0,  0,  0,  0,}},
+			{{  0,128,  4,  0,  0,  0,  0,  0,}},
+			{{  0,  8,  0,  0,  0,  0,  0,  0,}},
+			{{  0,136,  0,  0,  0,  0,  0,  0,}},
+			{{  0,  8,  4,  0,  0,  0,  0,  0,}},
+			{{  0,136,  4,  0,  0,  0,  0,  0,}},
+			{{  0,  0, 32,  0,  0,  0,  0,  0,}},
+			{{  0,128, 32,  0,  0,  0,  0,  0,}},
+			{{  0,  0, 36,  0,  0,  0,  0,  0,}},
+			{{  0,128, 36,  0,  0,  0,  0,  0,}},
+			{{  0,  8, 32,  0,  0,  0,  0,  0,}},
+			{{  0,136, 32,  0,  0,  0,  0,  0,}},
+			{{  0,  8, 36,  0,  0,  0,  0,  0,}},
+			{{  0,136, 36,  0,  0,  0,  0,  0,}},
+		},
+		{
+			{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+			{{  0, 64,  0,  0,  0,  0,  0,  0,}},
+			{{ 32,  0,  0,  0,  0,  0,  0,  0,}},
+			{{ 32, 64,  0,  0,  0,  0,  0,  0,}},
+			{{  0,  0,  0,128,  0,  0,  0,  0,}},
+			{{  0, 64,  0,128,  0,  0,  0,  0,}},
+			{{ 32,  0,  0,128,  0,  0,  0,  0,}},
+			{{ 32, 64,  0,128,  0,  0,  0,  0,}},
+			{{  0,  0,  0, 16,  0,  0,  0,  0,}},
+			{{  0, 64,  0, 16,  0,  0,  0,  0,}},
+			{{ 32,  0,  0, 16,  0,  0,  0,  0,}},
+			{{ 32, 64,  0, 16,  0,  0,  0,  0,}},
+			{{  0,  0,  0,144,  0,  0,  0,  0,}},
+			{{  0, 64,  0,144,  0,  0,  0,  0,}},
+			{{ 32,  0,  0,144,  0,  0,  0,  0,}},
+			{{ 32, 64,  0,144,  0,  0,  0,  0,}},
+		},
+		{
+			{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+			{{  4,  0,  0,  0,  0,  0,  0,  0,}},
+			{{128,  0,  0,  0,  0,  0,  0,  0,}},
+			{{132,  0,  0,  0,  0,  0,  0,  0,}},
+			{{  0,  0,  0, 32,  0,  0,  0,  0,}},
+			{{  4,  0,  0, 32,  0,  0,  0,  0,}},
+			{{128,  0,  0, 32,  0,  0,  0,  0,}},
+			{{132,  0,  0, 32,  0,  0,  0,  0,}},
+			{{  1,  0,  0,  0,  0,  0,  0,  0,}},
+			{{  5,  0,  0,  0,  0,  0,  0,  0,}},
+			{{129,  0,  0,  0,  0,  0,  0,  0,}},
+			{{133,  0,  0,  0,  0,  0,  0,  0,}},
+			{{  1,  0,  0, 32,  0,  0,  0,  0,}},
+			{{  5,  0,  0, 32,  0,  0,  0,  0,}},
+			{{129,  0,  0, 32,  0,  0,  0,  0,}},
+			{{133,  0,  0, 32,  0,  0,  0,  0,}},
+		},
+		{
+			{{  0,  0,  0,  0,  0,  0,  0,  0,}},
+			{{  0,  0,  0,  0,  0,  0, 64,  0,}},
+			{{  0,  0,  0,  0, 32,  0,  0,  0,}},
+			 (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]