File: haslib1305.c

package info (click to toggle)
tinyssh 20250501-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,388 kB
  • sloc: ansic: 20,245; sh: 1,582; python: 1,449; makefile: 913
file content (19 lines) | stat: -rw-r--r-- 565 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <lib1305.h>

int main(int argc, char **argv) {
    int ret = 0;
    long long i;
    unsigned char k[poly1305_KEYBYTES] = {2};
    unsigned char m[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                           0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
    unsigned char a[poly1305_BYTES];
    unsigned char o[poly1305_BYTES] = {3};

    (void) argc;
    (void) argv;

    ret |= -poly1305_verify(0, m, sizeof m, k);
    poly1305(a, m, sizeof m, k);
    for (i = 0; i < poly1305_BYTES; ++i) ret |= (o[i] ^ a[i]);
    return ret;
}