diff options
Diffstat (limited to 'Build/source/libs/pplib/pplib-src/src/ppcrypt.h')
-rw-r--r-- | Build/source/libs/pplib/pplib-src/src/ppcrypt.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/Build/source/libs/pplib/pplib-src/src/ppcrypt.h b/Build/source/libs/pplib/pplib-src/src/ppcrypt.h index 98864f860c7..a7131adbb31 100644 --- a/Build/source/libs/pplib/pplib-src/src/ppcrypt.h +++ b/Build/source/libs/pplib/pplib-src/src/ppcrypt.h @@ -6,21 +6,25 @@ #include "utilcrypt.h" #include "utilcryptdef.h" +#define PPCRYPT_MAX_PASSWORD 127 +#define PPCRYPT_MAX_KEY 32 + typedef struct { - ppuint algorithm_variant; /* /V entry of encrypt dict */ - ppuint algorithm_revision; /* /R entry of encrypt dict */ - ppint permissions; /* /P entry of encrypt dict */ - ppdict *map; /* /CF filters map of encrypt dict */ - uint8_t userpass[32]; /* padded user password */ - size_t userpasslength; /* the length of unpadded user password */ - uint8_t ownerpass[32]; /* padded owner password */ - size_t ownerpasslength; /* the length of unpadded owner password */ - uint8_t filekey[32+5+4]; /* generated file key with extra space of 5..9 bytes for salt */ - size_t filekeylength; /* key length; usually 5, 16 or 32 bytes */ - uint8_t cryptkey[32]; /* final crypt key for a given reference */ - size_t cryptkeylength; /* final crypt key length; usually keylength + 5 */ - ppref *ref; /* currently loaded ref (each ref may have a different key) */ - union { /* cached crypt states for strings encrypted/decrypted with the same key */ + ppuint algorithm_variant; /* /V entry of encrypt dict */ + ppuint algorithm_revision; /* /R entry of encrypt dict */ + ppint permissions; /* /P entry of encrypt dict */ + ppdict *map; /* /CF filters map of encrypt dict */ + uint8_t userpass[PPCRYPT_MAX_PASSWORD]; /* user password */ + size_t userpasslength; /* user password length */ + uint8_t ownerpass[PPCRYPT_MAX_PASSWORD]; /* owner password */ + size_t ownerpasslength; /* owner password length */ + uint8_t filekey[PPCRYPT_MAX_KEY+5+4]; /* file key with an extra space for salt */ + size_t filekeylength; /* key length; usually 5, 16 or 32 bytes */ + uint8_t cryptkey[PPCRYPT_MAX_KEY]; /* crypt key for a recent reference */ + size_t cryptkeylength; /* crypt key length; usually keylength + 5 */ + //ppstring *cryptkeystring; /* todo: cached cryptkey string for V5, where all refs has the same */ + ppref *ref; /* recent reference */ + union { /* cached crypt states for strings encrypted/decrypted with the same key */ struct { rc4_state rc4state; rc4_map rc4map; @@ -42,7 +46,7 @@ typedef struct { #define PPCRYPT_STRING_RC4 (1<<4) #define PPCRYPT_STREAM_AES (1<<5) #define PPCRYPT_STRING_AES (1<<6) -#define PPCRYPT_OBSCURITY (1<<7) +#define PPCRYPT_UNREADABLE_PERMISSIONS (1<<7) #define PPCRYPT_STREAM (PPCRYPT_STREAM_AES|PPCRYPT_STREAM_RC4) #define PPCRYPT_STRING (PPCRYPT_STRING_AES|PPCRYPT_STRING_RC4) |