Beispiel #1
0
static void sha1_core(struct sha1_ctx * ctx)
{
	__m128i a, b, c, d, e;
	__m128i k0, k1, k2, k3;
	__m128i v1, w;
	SVAL buf[16];

	a = SET1(AA);
	b = SET1(BB);
	c = SET1(CC);
	d = SET1(DD);
	e = SET1(EE);

	k0 = SET1(K0);
	R20(SHA1R0, 0);

	k1 = SET1(K1);
	R20(SHA1R1, 20);

	k2 = SET1(K2);
	R20(SHA1R2, 40);

	k3 = SET1(K3);
	R16(SHA1R3, 60);
	if (!ssresult_check(ctx->sres, a)) return;
	R4(SHA1R3, 76);

	FINAL(0, a, AA);
	FINAL(1, b, BB);
	FINAL(2, c, CC);
	FINAL(3, d, DD);
	FINAL(4, e, EE);
	check_result(ctx);
}
TESTCASE() {

    ThreadVarPtr t_ip1 = CREATE_THREAD(insertpair_routine1, (void*)&multiset);
    ThreadVarPtr t_ip2 = CREATE_THREAD(insertpair_routine2, (void*)&multiset);
    ThreadVarPtr t_ip3 = CREATE_THREAD(insertpair_routine3, (void*)&multiset);

    ThreadVarPtr t_lu1 = CREATE_THREAD(lookup_routine1, (void*)&multiset);
    ThreadVarPtr t_lu2 = CREATE_THREAD(lookup_routine2, (void*)&multiset);
    ThreadVarPtr t_lu3 = CREATE_THREAD(lookup_routine3, (void*)&multiset);

    printf("=============================================\n"
           "=============================================\n");

    //----------------------------------------------------------------------------------
    //----------------------------------------------------------------------------------

    FORALL(t1, BY(t_ip1) || BY(t_ip2) || BY(t_ip3));
    RUN_UNTIL(BY(t1), ENDS(), __);

    FORALL(t2, (BY(t_ip1) || BY(t_ip2) || BY(t_ip3)) && NOT(t1));
    RUN_UNTIL(BY(t2), ENDS(), __);

    FORALL(t3, (BY(t_ip1) || BY(t_ip2) || BY(t_ip3)) && NOT(t1) && NOT(t2));
    RUN_UNTIL(BY(t3), ENDS(), __);

    RUN_UNTIL(BY(t_lu2), ENDS(), __);
    RUN_UNTIL(BY(t_lu1), ENDS(), __);
    RUN_UNTIL(BY(t_lu3), ENDS(), __);

    WHILE_STAR
    {
        EXISTS(t);
        RUN_UNTIL(PTRUE && !FINAL(), FINAL(t))

    }
    RUN_UNTIL(PTRUE, FINAL())
}
Beispiel #3
0
static void md5_core(SSE_CTX *ctx)
{
	const SVAL *X = ctx->buf;
	__m128i a, b, c, d;
	a = _mm_set1_epi32(AA);
	b = _mm_set1_epi32(BB);
	c = _mm_set1_epi32(CC);
	d = _mm_set1_epi32(DD);
	/* Round 1. */
	OP(F, a, b, c, d, 0, 7, 0xd76aa478);
	OP(F, d, a, b, c, 1, 12, 0xe8c7b756);
	OP(F, c, d, a, b, 2, 17, 0x242070db);
	OP(F, b, c, d, a, 3, 22, 0xc1bdceee);
	OP(F, a, b, c, d, 4, 7, 0xf57c0faf);
	OP(F, d, a, b, c, 5, 12, 0x4787c62a);
	OP(F, c, d, a, b, 6, 17, 0xa8304613);
	OP(F, b, c, d, a, 7, 22, 0xfd469501);
	OP(F, a, b, c, d, 8, 7, 0x698098d8);
	OP(F, d, a, b, c, 9, 12, 0x8b44f7af);
	OP(F, c, d, a, b, 10, 17, 0xffff5bb1);
	OP(F, b, c, d, a, 11, 22, 0x895cd7be);
	OP(F, a, b, c, d, 12, 7, 0x6b901122);
	OP(F, d, a, b, c, 13, 12, 0xfd987193);
	OP(F, c, d, a, b, 14, 17, 0xa679438e);
	OP(F, b, c, d, a, 15, 22, 0x49b40821);
	/* Round 2. */
	OP(G, a, b, c, d, 1, 5, 0xf61e2562);
	OP(G, d, a, b, c, 6, 9, 0xc040b340);
	OP(G, c, d, a, b, 11, 14, 0x265e5a51);
	OP(G, b, c, d, a, 0, 20, 0xe9b6c7aa);
	OP(G, a, b, c, d, 5, 5, 0xd62f105d);
	OP(G, d, a, b, c, 10, 9, 0x02441453);
	OP(G, c, d, a, b, 15, 14, 0xd8a1e681);
	OP(G, b, c, d, a, 4, 20, 0xe7d3fbc8);
	OP(G, a, b, c, d, 9, 5, 0x21e1cde6);
	OP(G, d, a, b, c, 14, 9, 0xc33707d6);
	OP(G, c, d, a, b, 3, 14, 0xf4d50d87);
	OP(G, b, c, d, a, 8, 20, 0x455a14ed);
	OP(G, a, b, c, d, 13, 5, 0xa9e3e905);
	OP(G, d, a, b, c, 2, 9, 0xfcefa3f8);
	OP(G, c, d, a, b, 7, 14, 0x676f02d9);
	OP(G, b, c, d, a, 12, 20, 0x8d2a4c8a);
	/* Round 3. */
	OP(H, a, b, c, d, 5, 4, 0xfffa3942);
	OP(H, d, a, b, c, 8, 11, 0x8771f681);
	OP(H, c, d, a, b, 11, 16, 0x6d9d6122);
	OP(H, b, c, d, a, 14, 23, 0xfde5380c);
	OP(H, a, b, c, d, 1, 4, 0xa4beea44);
	OP(H, d, a, b, c, 4, 11, 0x4bdecfa9);
	OP(H, c, d, a, b, 7, 16, 0xf6bb4b60);
	OP(H, b, c, d, a, 10, 23, 0xbebfbc70);
	OP(H, a, b, c, d, 13, 4, 0x289b7ec6);
	OP(H, d, a, b, c, 0, 11, 0xeaa127fa);
	OP(H, c, d, a, b, 3, 16, 0xd4ef3085);
	OP(H, b, c, d, a, 6, 23, 0x04881d05);
	OP(H, a, b, c, d, 9, 4, 0xd9d4d039);
	OP(H, d, a, b, c, 12, 11, 0xe6db99e5);
	OP(H, c, d, a, b, 15, 16, 0x1fa27cf8);
	OP(H, b, c, d, a, 2, 23, 0xc4ac5665);
	/* Round 4. */
	OP(I, a, b, c, d, 0, 6, 0xf4292244);
	OP(I, d, a, b, c, 7, 10, 0x432aff97);
	OP(I, c, d, a, b, 14, 15, 0xab9423a7);
	OP(I, b, c, d, a, 5, 21, 0xfc93a039);
	OP(I, a, b, c, d, 12, 6, 0x655b59c3);
	OP(I, d, a, b, c, 3, 10, 0x8f0ccc92);
	OP(I, c, d, a, b, 10, 15, 0xffeff47d);
	OP(I, b, c, d, a, 1, 21, 0x85845dd1);
	OP(I, a, b, c, d, 8, 6, 0x6fa87e4f);
	OP(I, d, a, b, c, 15, 10, 0xfe2ce6e0);
	OP(I, c, d, a, b, 6, 15, 0xa3014314);
	OP(I, b, c, d, a, 13, 21, 0x4e0811a1);
	OP(I, a, b, c, d, 4, 6, 0xf7537e82);
	if (!ssresult_check(ctx->sres, a)) return;
	OP(I, d, a, b, c, 11, 10, 0xbd3af235);
	OP(I, c, d, a, b, 2, 15, 0x2ad7d2bb);
	OP(I, b, c, d, a, 9, 21, 0xeb86d391);

	FINAL(0, a, AA);
	FINAL(1, b, BB);
	FINAL(2, c, CC);
	FINAL(3, d, DD);
	check_result(ctx);
}
Beispiel #4
0
unsigned long arc_hash_final(arc_hs *s, unsigned long len)
{
  s->s[2] += len << 3;
  FINAL(s->s[0], s->s[1], s->s[2]);
  return(s->s[2]);
}
Beispiel #5
0
  __asm push 0L          \
  __asm push 0L          \
  __asm mov esp, eax     \
}

void squareEncrypt (word32 text[4], squareKeySchedule roundKeys)
{ 
  INITIAL
  ENCRYPT_ROUND(1)
  ENCRYPT_ROUND(2)
  ENCRYPT_ROUND(3)
  ENCRYPT_ROUND(4)
  ENCRYPT_ROUND(5)
  ENCRYPT_ROUND(6)
  ENCRYPT_ROUND(7)
  FINAL(Se)
#ifdef DESTROY_TEMPORARIES
  BURN_STACK
#endif /* ?DESTROY_TEMPORARIES */
}

void squareDecrypt (word32 text[4], squareKeySchedule roundKeys)
{ 
  INITIAL
  DECRYPT_ROUND(1)
  DECRYPT_ROUND(2)
  DECRYPT_ROUND(3)
  DECRYPT_ROUND(4)
  DECRYPT_ROUND(5)
  DECRYPT_ROUND(6)
  DECRYPT_ROUND(7)