| 1 |
#include <stdlib.h> |
| 2 |
#include "m256-check.h" |
| 3 |
|
| 4 |
static void sha512_test (void); |
| 5 |
|
| 6 |
static unsigned long long |
| 7 |
ror64 (unsigned long long w, int n) |
| 8 |
{ |
| 9 |
int count = n % 64; |
| 10 |
return ((w >> n) | (w << (64 - n))); |
| 11 |
} |
| 12 |
|
| 13 |
static unsigned long long |
| 14 |
shr64 (unsigned long long w, int n) |
| 15 |
{ |
| 16 |
return (w >> n); |
| 17 |
} |
| 18 |
|
| 19 |
static void |
| 20 |
__attribute__ ((noinline)) |
| 21 |
do_test(void) |
| 22 |
{ |
| 23 |
sha512_test (); |
| 24 |
} |
| 25 |
|
| 26 |
int |
| 27 |
main () |
| 28 |
{ |
| 29 |
/* Check CPU support for SHA512. */ |
| 30 |
if (__builtin_cpu_supports ("sha512")) |
| 31 |
{ |
| 32 |
do_test (); |
| 33 |
#ifdef DEBUG |
| 34 |
printf ("PASSED\n"); |
| 35 |
#endif |
| 36 |
return 0; |
| 37 |
} |
| 38 |
|
| 39 |
#ifdef DEBUG |
| 40 |
printf ("SKIPPED\n"); |
| 41 |
#endif |
| 42 |
return 0; |
| 43 |
} |