corecrypto/ccrng/crypto_test/crypto_test_rng.h

46 lines
1.5 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Copyright (c) (2010-2013,2015,2016,2018-2020) Apple Inc. All rights reserved.
*
* corecrypto is licensed under Apple Inc.s Internal Use License Agreement (which
* is contained in the License.txt file distributed with corecrypto) and only to
* people who accept that license. IMPORTANT: Any license rights granted to you by
* Apple Inc. (if any) are limited to internal use within your organization only on
* devices and computers you own or control, for the sole purpose of verifying the
* security characteristics and correct functioning of the Apple Software. You may
* not, directly or indirectly, redistribute the Apple Software or any portions thereof.
*/
#ifndef crypto_test_rng_h
#define crypto_test_rng_h
#include <corecrypto/ccrng.h>
#include <stddef.h>
#define THREAD_RESULT_ARRAY_LEN 64
int csprng_test_kat(void);
int fortuna_test_kat(void);
int multi_thread_test(struct ccrng_state* rng);
int find_duplicate_uint64(uint64_t *array, size_t array_size);
#if defined(_WIN32)
#include <windows.h>
HANDLE winthread_create(LPTHREAD_START_ROUTINE start_address, LPVOID param);
DWORD WINAPI gen_routine(LPVOID p);
int test_rng_win(struct ccrng_state* rng);
#else
void *gen_routine(void *p);
#endif
struct gen_thread_data {
struct ccrng_state* rng;
uint64_t *results;//in the current test function, it holds an array of size THREAD_RESULT_ARRAY_LEN
int status;
#if defined(_WIN32)
SYNCHRONIZATION_BARRIER *barrier;
#endif
};
int test_rng_uniform(void);
#endif /* crypto_test_rng_h */