Skip to content

Commit 47faa50

Browse files
fixes decryption failure on unreadable perms
1 parent 5a002f7 commit 47faa50

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/ppapi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include "ppconf.h"
1010

11-
#define pplib_version "v2.1"
11+
#define pplib_version "v2.2"
1212
#define pplib_author "p.jackowski@gust.org.pl"
1313

1414
/* types */

src/ppcrypt.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static int ppcrypt_password_encoding (uint8_t *password, size_t *passwordlength)
137137
{
138138
uint8_t *p, newpassword[PPCRYPT_MAX_PASSWORD], *n;
139139
const uint8_t *e;
140-
uint32_t unicode;
140+
uint32_t unicode = 0;
141141

142142
for (n = &newpassword[0], p = &password[0], e = p + *passwordlength; p < e; ++n)
143143
{
@@ -398,7 +398,10 @@ static ppcrypt_status ppcrypt_authenticate_permissions (ppcrypt *crypt, ppstring
398398
aes_decode_data(perms->data, perms->size, permsdata, crypt->filekey, crypt->filekeylength, nulliv, AES_NULL_PADDING);
399399

400400
if (permsdata[9] != 'a' || permsdata[10] != 'd' || permsdata[11] != 'b')
401-
return PPCRYPT_FAIL;
401+
{ /* if we get here, the password hash is correct, we don't need to fail because of unreadable perms (found such docs) */
402+
crypt->flags |= PPCRYPT_UNREADABLE_PERMISSIONS;
403+
return PPCRYPT_DONE;
404+
}
402405

403406
/* do not check/update permissions flags here; they might be different inside crypt string */
404407
if (0)

src/ppcrypt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ typedef struct {
4646
#define PPCRYPT_STRING_RC4 (1<<4)
4747
#define PPCRYPT_STREAM_AES (1<<5)
4848
#define PPCRYPT_STRING_AES (1<<6)
49+
#define PPCRYPT_UNREADABLE_PERMISSIONS (1<<7)
4950

5051
#define PPCRYPT_STREAM (PPCRYPT_STREAM_AES|PPCRYPT_STREAM_RC4)
5152
#define PPCRYPT_STRING (PPCRYPT_STRING_AES|PPCRYPT_STRING_RC4)

0 commit comments

Comments
 (0)