示例#1
0
文件: sha1msg2-2.c 项目: 0day-ci/gcc
static void
compute_sha1msg2 (int *s1, int *s2, int *r)
{
  int w13, w14, w15, w16, w17, w18, w19;

  w13 = s2[2];
  w14 = s2[1];
  w15 = s2[0];
  w16 = __rold (s1[3] ^ w13, 1);
  w17 = __rold (s1[2] ^ w14, 1);
  w18 = __rold (s1[1] ^ w15, 1);
  w19 = __rold (s1[0] ^ w16, 1);

  r[0] = w19;
  r[1] = w18;
  r[2] = w17;
  r[3] = w16;
}
示例#2
0
文件: sha1nexte-2.c 项目: pjump/gcc
static void
compute_sha1nexte (int *s1, int *s2, int *r)
{
    int tmp = __rold (s1[3], 30);

    r[0] = s2[0];
    r[1] = s2[1];
    r[2] = s2[2];
    r[3] = s2[3] + tmp;
}
示例#3
0
int
main ()
{
  a = 0x12345678U;
  a = __rold (a, 0);
  if (a != 0x12345678U)
    __builtin_abort ();
  a = __rold (a, 32);
  if (a != 0x12345678U)
    __builtin_abort ();
  a = __rold (a, -32);
  if (a != 0x12345678U)
    __builtin_abort ();
  a = __rold (a, 37);
  if (a != 0x468acf02U)
    __builtin_abort ();
  a = __rold (a, -5);
  if (a != 0x12345678U)
    __builtin_abort ();
  a = __rord (a, 0);
  if (a != 0x12345678U)
    __builtin_abort ();
  a = __rord (a, 32);
  if (a != 0x12345678U)
    __builtin_abort ();
  a = __rord (a, -32);
  if (a != 0x12345678U)
    __builtin_abort ();
  a = __rord (a, -37);
  if (a != 0x468acf02U)
    __builtin_abort ();
  a = __rord (a, 5);
  if (a != 0x12345678U)
    __builtin_abort ();
  c = 0;
  a = __rold (a, c);
  if (a != 0x12345678U)
    __builtin_abort ();
  c = 32;
  a = __rold (a, c);
  if (a != 0x12345678U)
    __builtin_abort ();
  c = -32;
  a = __rold (a, c);
  if (a != 0x12345678U)
    __builtin_abort ();
  c = 37;
  a = __rold (a, c);
  if (a != 0x468acf02U)
    __builtin_abort ();
  c = -5;
  a = __rold (a, c);
  if (a != 0x12345678U)
    __builtin_abort ();
  c = 0;
  a = __rord (a, c);
  if (a != 0x12345678U)
    __builtin_abort ();
  c = 32;
  a = __rord (a, c);
  if (a != 0x12345678U)
    __builtin_abort ();
  c = -32;
  a = __rord (a, c);
  if (a != 0x12345678U)
    __builtin_abort ();
  c = -37;
  a = __rord (a, c);
  if (a != 0x468acf02U)
    __builtin_abort ();
  c = 5;
  a = __rord (a, c);
  if (a != 0x12345678U)
    __builtin_abort ();
#ifdef __x86_64__
  b = 0x123456789abcdef1ULL;
  b = __rolq (b, 0);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  b = __rolq (b, 64);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  b = __rolq (b, -64);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  b = __rolq (b, 69);
  if (b != 0x468acf13579bde22ULL)
    __builtin_abort ();
  b = __rolq (b, -5);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  b = __rorq (b, 0);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  b = __rorq (b, 64);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  b = __rorq (b, -64);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  b = __rorq (b, -69);
  if (b != 0x468acf13579bde22ULL)
    __builtin_abort ();
  b = __rorq (b, 5);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  c = 0;
  b = __rolq (b, c);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  c = 64;
  b = __rolq (b, c);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  c = -64;
  b = __rolq (b, c);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  c = 69;
  b = __rolq (b, c);
  if (b != 0x468acf13579bde22ULL)
    __builtin_abort ();
  c = -5;
  b = __rolq (b, c);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  c = 0;
  b = __rorq (b, c);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  c = 64;
  b = __rorq (b, c);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  c = -64;
  b = __rorq (b, c);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
  c = -69;
  b = __rorq (b, c);
  if (b != 0x468acf13579bde22ULL)
    __builtin_abort ();
  c = 5;
  b = __rorq (b, c);
  if (b != 0x123456789abcdef1ULL)
    __builtin_abort ();
#endif
  return 0;
}