Skip to content

error: initializer element is not constant #39

Description

@Arinerron

Trying to test it out by compiling the sample code, but I get an error:

test.c:4:8: error: initializer element is not constant
 struct NtruEncParams params = NTRU_DEFAULT_PARAMS_128_BITS; /*see section "Parameter Sets" below*/
        ^
test.c:7:1: error: expected identifier or ‘(’ beforeifif (ntru_rand_init(&rand_ctx_def, &rng_def) != NTRU_SUCCESS)
 ^
test.c:10:1: error: expected identifier or ‘(’ beforeifif (ntru_gen_key_pair(&params, &kp, &rand_ctx_def) != NTRU_SUCCESS)
 ^

the sample code is

#include "ntru.h"

/* key generation */
struct NtruEncParams params = NTRU_DEFAULT_PARAMS_128_BITS; /*see section "Parameter Sets" below*/
NtruRandGen rng_def = NTRU_RNG_DEFAULT;
NtruRandContext rand_ctx_def;
if (ntru_rand_init(&rand_ctx_def, &rng_def) != NTRU_SUCCESS)
    printf("rng fail\n");
NtruEncKeyPair kp;
if (ntru_gen_key_pair(&params, &kp, &rand_ctx_def) != NTRU_SUCCESS)
    printf("keygen fail\n");

Any idea of what to do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions