Notepad3/crypto/crypto.h
Rainer Kottenhoff af4d1292f4 + raise Warning Level from 3 -> 4, and fix corresponding warnings
+ option: build-time: treat warning as error (build fails)
+ cleanups reported by CppCheck v.1.79  (except issue: 'variableScope')
+ remove _CRT_SECURE_NO_WARNINGS to see security warnings for deprecated functions;
+ remove macro-definition for BOOKMARK_EDITION (bookmarks are fixed component of NP3 now)
   (code has not been excaped by this MACRO consistently)
2017-08-11 14:18:39 +02:00

20 lines
748 B
C

#ifndef __CRYPTO_H__
#define __CRYPTO_H__
#define BUG1(a,b) { perror("a"); }
#define BUG(a) { perror("a"); }
#define PREAMBLE_SIZE 8 // 4 byte signature + 4 byte subfile type
#define KEY_BYTES 32 // 32 byts = 256 bits of key
#define PREAMBLE 0x01020304 // first 4 bytes of the file
#define FILEKEY_FORMAT 1 // next 4 bytes determine version/format
#define MASTERKEY_FORMAT 2 // format with master key
#define MASTER_KEY_OFFSET (PREAMBLE_SIZE+AES_MAX_IV_SIZE)
#define UNUSED(expr) (void)(expr)
BOOL EncryptAndWriteFile(HWND hwnd, HANDLE hFile, BYTE *data, DWORD size, DWORD *written);
BOOL ReadAndDecryptFile(HWND hwnd, HANDLE hFile, DWORD size, void** result, DWORD *resultlen);
BOOL GetFileKey(HWND hwnd);
void ResetEncryption();
#endif