Skip to content

Commit 299e2f9

Browse files
JakujeNIIBE Yutaka
authored andcommitted
tests: Replace custom bit with more generic flags
* tests/basic.c (global): New flag FLAG_SPECIAL (check_pubkey_crypt): Change to use bitfield flags -- GnuPG-bug-id: 5918 Signed-off-by: Jakub Jelen <jjelen@redhat.com>
1 parent c7709f7 commit 299e2f9

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tests/basic.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ typedef struct test_spec_pubkey
5555
}
5656
test_spec_pubkey_t;
5757

58-
#define FLAG_CRYPT (1 << 0)
59-
#define FLAG_SIGN (1 << 1)
60-
#define FLAG_GRIP (1 << 2)
61-
#define FLAG_NOFIPS (1 << 3)
62-
#define FLAG_CFB8 (1 << 4)
58+
#define FLAG_CRYPT (1 << 0)
59+
#define FLAG_SIGN (1 << 1)
60+
#define FLAG_GRIP (1 << 2)
61+
#define FLAG_NOFIPS (1 << 3)
62+
#define FLAG_CFB8 (1 << 4)
63+
#define FLAG_SPECIAL (1 << 5)
6364

6465
static int in_fips_mode;
6566

@@ -15558,7 +15559,7 @@ check_pubkey_crypt (int n, gcry_sexp_t skey, gcry_sexp_t pkey, int algo,
1555815559
int unpadded;
1555915560
int encrypt_expected_rc;
1556015561
int decrypt_expected_rc;
15561-
int special;
15562+
int flags;
1556215563
} datas[] =
1556315564
{
1556415565
{ GCRY_PK_RSA,
@@ -15642,14 +15643,14 @@ check_pubkey_crypt (int n, gcry_sexp_t skey, gcry_sexp_t pkey, int algo,
1564215643
"(flags oaep)",
1564315644
1,
1564415645
0,
15645-
GPG_ERR_ENCODING_PROBLEM, 1 },
15646+
GPG_ERR_ENCODING_PROBLEM, FLAG_SPECIAL },
1564615647
{ GCRY_PK_RSA,
1564715648
"(data\n (flags oaep)\n"
1564815649
" (value #11223344556677889900AA#))\n",
1564915650
"(flags pkcs1)",
1565015651
1,
1565115652
0,
15652-
GPG_ERR_ENCODING_PROBLEM, 1 },
15653+
GPG_ERR_ENCODING_PROBLEM, FLAG_SPECIAL },
1565315654
{ 0,
1565415655
"(data\n (flags pss)\n"
1565515656
" (value #11223344556677889900AA#))\n",
@@ -15725,7 +15726,7 @@ check_pubkey_crypt (int n, gcry_sexp_t skey, gcry_sexp_t pkey, int algo,
1572515726
ciph = list;
1572615727
}
1572715728
rc = gcry_pk_decrypt (&plain, ciph, skey);
15728-
if (!rc && datas[dataidx].special == 1)
15729+
if (!rc && (datas[dataidx].flags & FLAG_SPECIAL))
1572915730
{
1573015731
/* It may happen that OAEP formatted data which is
1573115732
decrypted as pkcs#1 data returns a valid pkcs#1

0 commit comments

Comments
 (0)