Blame SOURCES/libsodium-1.0.18/test/default/scalarmult6.c

ca16be
ca16be
#define TEST_NAME "scalarmult6"
ca16be
#include "cmptest.h"
ca16be
ca16be
static unsigned char bobsk_[crypto_scalarmult_SCALARBYTES] = {
ca16be
    0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1, 0x7f,
ca16be
    0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 0x18,
ca16be
    0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88, 0xe0, 0xeb
ca16be
};
ca16be
ca16be
static unsigned char alicepk_[crypto_scalarmult_SCALARBYTES] = {
ca16be
    0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b, 0x7d,
ca16be
    0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38,
ca16be
    0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a
ca16be
};
ca16be
ca16be
int
ca16be
main(void)
ca16be
{
ca16be
    unsigned char *k;
ca16be
    unsigned char *bobsk;
ca16be
    unsigned char *alicepk;
ca16be
    int            i;
ca16be
    int            ret;
ca16be
ca16be
    k       = (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES);
ca16be
    bobsk   = (unsigned char *) sodium_malloc(crypto_scalarmult_SCALARBYTES);
ca16be
    alicepk = (unsigned char *) sodium_malloc(crypto_scalarmult_SCALARBYTES);
ca16be
    assert(k != NULL && bobsk != NULL && alicepk != NULL);
ca16be
ca16be
    memcpy(bobsk, bobsk_, crypto_scalarmult_SCALARBYTES);
ca16be
    memcpy(alicepk, alicepk_, crypto_scalarmult_SCALARBYTES);
ca16be
ca16be
    ret = crypto_scalarmult(k, bobsk, alicepk);
ca16be
    assert(ret == 0);
ca16be
ca16be
    sodium_free(alicepk);
ca16be
    sodium_free(bobsk);
ca16be
ca16be
    for (i = 0; i < 32; ++i) {
ca16be
        if (i > 0) {
ca16be
            printf(",");
ca16be
        } else {
ca16be
            printf(" ");
ca16be
        }
ca16be
        printf("0x%02x", (unsigned int) k[i]);
ca16be
        if (i % 8 == 7) {
ca16be
            printf("\n");
ca16be
        }
ca16be
    }
ca16be
    sodium_free(k);
ca16be
ca16be
    return 0;
ca16be
}