1
0
Fork 0

Clean up includes in "front-end" application.

This commit is contained in:
LoRd_MuldeR 2022-09-20 21:52:23 +02:00
parent f665d1cf2a
commit 0c91cac7e4
Signed by: mulder
GPG Key ID: 2B5913365F57E03F
13 changed files with 49 additions and 55 deletions

View File

@ -11,10 +11,6 @@
https://blake2.net.
*/
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "blake2.h"
/* -------------------------------------------------------------------------- */

View File

@ -14,6 +14,8 @@
#ifndef INC_SLUNKAPP_BLAKE2_H
#define INC_SLUNKAPP_BLAKE2_H
#include "platform.h"
#define BLAKE2S_BLOCKBYTES 64
typedef struct _blake2s_t

View File

@ -3,18 +3,14 @@
/* 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 */
#include "crypt.h"
#include <slunkcrypt.h>
#include "utils.h"
#include "blake2.h"
/* Library */
#include <slunkcrypt.h>
/* CRT */
#include <time.h>
#include <inttypes.h>

View File

@ -7,7 +7,6 @@
#define INC_SLUNKAPP_CRYPT_H
#include "platform.h"
#include <stdint.h>
typedef struct
{

View File

@ -3,19 +3,15 @@
/* 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 */
#include <slunkcrypt.h>
#include "utils.h"
#include "crypt.h"
#include "pwgen.h"
#include "selftest.h"
/* Library */
#include <slunkcrypt.h>
/* CRT */
#include <string.h>
#include <time.h>

View File

@ -6,9 +6,28 @@
#ifndef 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 <stdio.h>
#include <stdint.h>
#include <string.h>
/* Required for _wfsopen() support */
#ifdef _WIN32
# include <share.h>
# ifndef _SH_SECURE
@ -86,12 +105,16 @@
# define STRRCHR(X,Y) wcsrchr((X),(Y))
# define STRTOUL(X) wcstoul((X), NULL, 0)
# define STRDUP(X) _wcsdup((X))
# define strdup(X) _strdup((X))
# define FPUTS(X,Y) fputws((X),(Y))
# define FPRINTF(X,Y,...) fwprintf((X),(Y),__VA_ARGS__)
# define REMOVE(X) _wremove((X))
# define FOPEN(X,Y) _wfsopen((X),_T(Y) L"S",_SH_SECURE)
# 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 "hs"
# define PRIwcs "ls"
@ -123,8 +146,4 @@
#define T(X) _T(X)
#ifdef _MSC_VER
# define strdup(X) _strdup((X))
#endif
#endif

View File

@ -3,17 +3,13 @@
/* 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 */
#include "pwgen.h"
#include <slunkcrypt.h>
#include "utils.h"
/* Library */
#include <slunkcrypt.h>
/* CRT */
#include <ctype.h>
#include <errno.h>

View File

@ -7,7 +7,6 @@
#define INC_SLUNKAPP_PWGEN_H
#include "platform.h"
#include <stdint.h>
char *read_passphrase(const CHR *const file_name);
int weak_passphrase(const char *str);

View File

@ -3,19 +3,16 @@
/* 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 */
#include "crypt.h"
#include <slunkcrypt.h>
#include "selftest.h"
#include "utils.h"
#include "crypt.h"
#include "test_data.h"
#include "blake2.h"
/* Library */
#include <slunkcrypt.h>
/* CRT */
#include <time.h>
#include <inttypes.h>

View File

@ -7,7 +7,6 @@
#define INC_SLUNKAPP_SELFTEST_H
#include "platform.h"
#include <stdint.h>
int run_selftest_routine(const size_t thread_count);

View File

@ -6,7 +6,7 @@
#ifndef 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_1;

View File

@ -3,15 +3,17 @@
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
/* Platform configuration */
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN 1
# define _CRT_SECURE_NO_WARNINGS 1
#else
# define _GNU_SOURCE 1
#endif
/* Internal */
#include "utils.h"
/* Library */
#include <slunkcrypt.h>
/* CRT */
@ -34,19 +36,13 @@
# define S_IFDIR _S_IFDIR
# define S_IFIFO _S_IFIFO
# ifndef _O_U8TEXT
# define _O_U8TEXT 0x40000
# define _O_U8TEXT 0x40000
# endif
#else
# include <unistd.h>
# if defined(__USE_LARGEFILE64) && (__USE_LARGEFILE64)
# define STAT_T struct stat64
# define STAT(X,Y) stat64((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 STAT_T struct stat
# define STAT(X,Y) stat((X),(Y))
# define FSTAT(X,Y) fstat((X),(Y))
# define FILENO(X) fileno((X))
#endif
@ -286,7 +282,7 @@ uint64_t get_size(FILE *const file)
STAT_T file_info;
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))
{
const int64_t size = file_info.st_size;

View File

@ -7,7 +7,6 @@
#define INC_SLUNKAPP_UTILS_H
#include "platform.h"
#include <stdint.h>
typedef void (signal_handler_t)(int);