Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • fe7dd1a
  • /
  • test
  • /
  • test_common.c
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:079114df8309b6f9a8fed8839e7bf937e2300aca
directory badge Iframe embedding
swh:1:dir:afd609aa2aed1298dc68e73d964aeceb47031ec2
test_common.c
// SPDX-License-Identifier: Apache-2.0 AND MIT

#include "test_common.h"
#include <string.h>


void hexdump(const void *ptr, size_t len)
{
    const unsigned char *p = ptr;
    size_t i, j;

    for (i = 0; i < len; i += j) {
        for (j = 0; j < 16 && i + j < len; j++)
            printf("%s%02x", j? "" : " ", p[i + j]);
    }
    printf("\n");
}

#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
int alg_is_enabled(const char *algname) {
    char *alglist = getenv("OQS_SKIP_TESTS");
    char *comma = NULL;
    char totest[200];

    if (alglist == NULL) return 1;

    while((comma = strchr(alglist, ','))) {
        memcpy(totest, alglist, MIN(200,comma-alglist));
        totest[comma-alglist]='\0';
        if (strstr(algname, totest)) return 0;
        alglist = comma+1;
    }
    return strstr(algname, alglist) == NULL;
}

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top