Clean up includes in "front-end" application.
This commit is contained in:
parent
f665d1cf2a
commit
0c91cac7e4
@ -11,10 +11,6 @@
|
|||||||
https://blake2.net.
|
https://blake2.net.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "blake2.h"
|
#include "blake2.h"
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#ifndef INC_SLUNKAPP_BLAKE2_H
|
#ifndef INC_SLUNKAPP_BLAKE2_H
|
||||||
#define INC_SLUNKAPP_BLAKE2_H
|
#define INC_SLUNKAPP_BLAKE2_H
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
#define BLAKE2S_BLOCKBYTES 64
|
#define BLAKE2S_BLOCKBYTES 64
|
||||||
|
|
||||||
typedef struct _blake2s_t
|
typedef struct _blake2s_t
|
||||||
|
@ -3,18 +3,14 @@
|
|||||||
/* This work has been released under the CC0 1.0 Universal license! */
|
/* This work has been released under the CC0 1.0 Universal license! */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
# define _CRT_SECURE_NO_WARNINGS 1
|
|
||||||
#else
|
|
||||||
# define _GNU_SOURCE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Internal */
|
/* Internal */
|
||||||
#include "crypt.h"
|
#include "crypt.h"
|
||||||
#include <slunkcrypt.h>
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "blake2.h"
|
#include "blake2.h"
|
||||||
|
|
||||||
|
/* Library */
|
||||||
|
#include <slunkcrypt.h>
|
||||||
|
|
||||||
/* CRT */
|
/* CRT */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#define INC_SLUNKAPP_CRYPT_H
|
#define INC_SLUNKAPP_CRYPT_H
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -3,19 +3,15 @@
|
|||||||
/* This work has been released under the CC0 1.0 Universal license! */
|
/* This work has been released under the CC0 1.0 Universal license! */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
# define _CRT_SECURE_NO_WARNINGS 1
|
|
||||||
#else
|
|
||||||
# define _GNU_SOURCE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Internal */
|
/* Internal */
|
||||||
#include <slunkcrypt.h>
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "crypt.h"
|
#include "crypt.h"
|
||||||
#include "pwgen.h"
|
#include "pwgen.h"
|
||||||
#include "selftest.h"
|
#include "selftest.h"
|
||||||
|
|
||||||
|
/* Library */
|
||||||
|
#include <slunkcrypt.h>
|
||||||
|
|
||||||
/* CRT */
|
/* CRT */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -6,9 +6,28 @@
|
|||||||
#ifndef INC_PLATFORM_H
|
#ifndef INC_PLATFORM_H
|
||||||
#define INC_PLATFORM_H
|
#define INC_PLATFORM_H
|
||||||
|
|
||||||
|
/* Platform configuration */
|
||||||
|
#ifndef _WIN32
|
||||||
|
# define _FILE_OFFSET_BITS 64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* MINGW32 support */
|
||||||
|
#if defined(_WIN32) && defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
||||||
|
# define __MSVCRT_VERSION__ 0x700
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Disable MSVC warnings */
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define _CRT_SECURE_NO_WARNINGS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Standatd library includes*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/* Required for _wfsopen() support */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <share.h>
|
# include <share.h>
|
||||||
# ifndef _SH_SECURE
|
# ifndef _SH_SECURE
|
||||||
@ -86,12 +105,16 @@
|
|||||||
# define STRRCHR(X,Y) wcsrchr((X),(Y))
|
# define STRRCHR(X,Y) wcsrchr((X),(Y))
|
||||||
# define STRTOUL(X) wcstoul((X), NULL, 0)
|
# define STRTOUL(X) wcstoul((X), NULL, 0)
|
||||||
# define STRDUP(X) _wcsdup((X))
|
# define STRDUP(X) _wcsdup((X))
|
||||||
|
# define strdup(X) _strdup((X))
|
||||||
# define FPUTS(X,Y) fputws((X),(Y))
|
# define FPUTS(X,Y) fputws((X),(Y))
|
||||||
# define FPRINTF(X,Y,...) fwprintf((X),(Y),__VA_ARGS__)
|
# define FPRINTF(X,Y,...) fwprintf((X),(Y),__VA_ARGS__)
|
||||||
# define REMOVE(X) _wremove((X))
|
# define REMOVE(X) _wremove((X))
|
||||||
# define FOPEN(X,Y) _wfsopen((X),_T(Y) L"S",_SH_SECURE)
|
# define FOPEN(X,Y) _wfsopen((X),_T(Y) L"S",_SH_SECURE)
|
||||||
# define STRERROR(X) _wcserror((X))
|
# define STRERROR(X) _wcserror((X))
|
||||||
# ifdef __USE_MINGW_ANSI_STDIO
|
# ifndef __USE_MINGW_ANSI_STDIO
|
||||||
|
# define __USE_MINGW_ANSI_STDIO 0
|
||||||
|
# endif
|
||||||
|
# if __USE_MINGW_ANSI_STDIO
|
||||||
# define PRISTR "ls"
|
# define PRISTR "ls"
|
||||||
# define PRIstr "hs"
|
# define PRIstr "hs"
|
||||||
# define PRIwcs "ls"
|
# define PRIwcs "ls"
|
||||||
@ -123,8 +146,4 @@
|
|||||||
|
|
||||||
#define T(X) _T(X)
|
#define T(X) _T(X)
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
# define strdup(X) _strdup((X))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,17 +3,13 @@
|
|||||||
/* This work has been released under the CC0 1.0 Universal license! */
|
/* This work has been released under the CC0 1.0 Universal license! */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
# define _CRT_SECURE_NO_WARNINGS 1
|
|
||||||
#else
|
|
||||||
# define _GNU_SOURCE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Internal */
|
/* Internal */
|
||||||
#include "pwgen.h"
|
#include "pwgen.h"
|
||||||
#include <slunkcrypt.h>
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
/* Library */
|
||||||
|
#include <slunkcrypt.h>
|
||||||
|
|
||||||
/* CRT */
|
/* CRT */
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#define INC_SLUNKAPP_PWGEN_H
|
#define INC_SLUNKAPP_PWGEN_H
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
char *read_passphrase(const CHR *const file_name);
|
char *read_passphrase(const CHR *const file_name);
|
||||||
int weak_passphrase(const char *str);
|
int weak_passphrase(const char *str);
|
||||||
|
@ -3,19 +3,16 @@
|
|||||||
/* This work has been released under the CC0 1.0 Universal license! */
|
/* This work has been released under the CC0 1.0 Universal license! */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
# define _CRT_SECURE_NO_WARNINGS 1
|
|
||||||
#else
|
|
||||||
# define _GNU_SOURCE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Internal */
|
/* Internal */
|
||||||
#include "crypt.h"
|
#include "selftest.h"
|
||||||
#include <slunkcrypt.h>
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "crypt.h"
|
||||||
#include "test_data.h"
|
#include "test_data.h"
|
||||||
#include "blake2.h"
|
#include "blake2.h"
|
||||||
|
|
||||||
|
/* Library */
|
||||||
|
#include <slunkcrypt.h>
|
||||||
|
|
||||||
/* CRT */
|
/* CRT */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#define INC_SLUNKAPP_SELFTEST_H
|
#define INC_SLUNKAPP_SELFTEST_H
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
int run_selftest_routine(const size_t thread_count);
|
int run_selftest_routine(const size_t thread_count);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#ifndef INC_SLUNKAPP_TEST_DATA_H
|
#ifndef INC_SLUNKAPP_TEST_DATA_H
|
||||||
#define INC_SLUNKAPP_TEST_DATA_H
|
#define INC_SLUNKAPP_TEST_DATA_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "platform.h"
|
||||||
|
|
||||||
extern const char* const TEST_DATA_0;
|
extern const char* const TEST_DATA_0;
|
||||||
extern const char* const TEST_DATA_1;
|
extern const char* const TEST_DATA_1;
|
||||||
|
@ -3,15 +3,17 @@
|
|||||||
/* This work has been released under the CC0 1.0 Universal license! */
|
/* This work has been released under the CC0 1.0 Universal license! */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Platform configuration */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define WIN32_LEAN_AND_MEAN 1
|
# define WIN32_LEAN_AND_MEAN 1
|
||||||
# define _CRT_SECURE_NO_WARNINGS 1
|
|
||||||
#else
|
#else
|
||||||
# define _GNU_SOURCE 1
|
# define _GNU_SOURCE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Internal */
|
/* Internal */
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
/* Library */
|
||||||
#include <slunkcrypt.h>
|
#include <slunkcrypt.h>
|
||||||
|
|
||||||
/* CRT */
|
/* CRT */
|
||||||
@ -34,19 +36,13 @@
|
|||||||
# define S_IFDIR _S_IFDIR
|
# define S_IFDIR _S_IFDIR
|
||||||
# define S_IFIFO _S_IFIFO
|
# define S_IFIFO _S_IFIFO
|
||||||
# ifndef _O_U8TEXT
|
# ifndef _O_U8TEXT
|
||||||
# define _O_U8TEXT 0x40000
|
# define _O_U8TEXT 0x40000
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# if defined(__USE_LARGEFILE64) && (__USE_LARGEFILE64)
|
# define STAT_T struct stat
|
||||||
# define STAT_T struct stat64
|
# define STAT(X,Y) stat((X),(Y))
|
||||||
# define STAT(X,Y) stat64((X),(Y))
|
# define FSTAT(X,Y) fstat((X),(Y))
|
||||||
# define FSTAT(X,Y) fstat64((X),(Y))
|
|
||||||
# else
|
|
||||||
# define STAT_T struct stat
|
|
||||||
# define STAT(X,Y) stat((X),(Y))
|
|
||||||
# define FSTAT(X,Y) fstat((X),(Y))
|
|
||||||
# endif
|
|
||||||
# define FILENO(X) fileno((X))
|
# define FILENO(X) fileno((X))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -286,7 +282,7 @@ uint64_t get_size(FILE *const file)
|
|||||||
STAT_T file_info;
|
STAT_T file_info;
|
||||||
if (FSTAT(FILENO(file), &file_info) == 0)
|
if (FSTAT(FILENO(file), &file_info) == 0)
|
||||||
{
|
{
|
||||||
const unsigned ftype = file_info.st_mode & S_IFMT;
|
const unsigned long ftype = file_info.st_mode & S_IFMT;
|
||||||
if ((ftype != S_IFDIR) && (ftype != S_IFIFO))
|
if ((ftype != S_IFDIR) && (ftype != S_IFIFO))
|
||||||
{
|
{
|
||||||
const int64_t size = file_info.st_size;
|
const int64_t size = file_info.st_size;
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#define INC_SLUNKAPP_UTILS_H
|
#define INC_SLUNKAPP_UTILS_H
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
typedef void (signal_handler_t)(int);
|
typedef void (signal_handler_t)(int);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user