diff --git a/lib/liboath/oath_key_alloc.c b/lib/liboath/oath_key_alloc.c index 7385732..b725fb2 100644 --- a/lib/liboath/oath_key_alloc.c +++ b/lib/liboath/oath_key_alloc.c @@ -53,9 +53,14 @@ struct oath_key * oath_key_alloc(void) { struct oath_key *key; + int prot, flags; - if ((key = mmap(NULL, sizeof *key, PROT_READ|PROT_WRITE, - MAP_ANON|MAP_NOCORE, -1, 0)) == NULL) { + prot = PROT_READ|PROT_WRITE; + flags = MAP_ANON; +#ifdef MAP_NOCORE + flags |= MAP_NOCORE; +#endif + if ((key = mmap(NULL, sizeof *key, prot, flags, -1, 0)) == NULL) { memset(key, 0, sizeof *key); key->mapped = 1; if (mlock(key, sizeof *key) == 0)