View | Details | Raw Unified | Return to bug 65862
Collapse All | Expand All

(-)include/cipher.h (+1 lines)
Lines 76-81 Link Here
76
    int keylen;
76
    int keylen;
77
    int algo_info_printed;
77
    int algo_info_printed;
78
    int use_mdc;
78
    int use_mdc;
79
    int symmetric;
79
    byte key[32]; /* this is the largest used keylen (256 bit) */
80
    byte key[32]; /* this is the largest used keylen (256 bit) */
80
} DEK;
81
} DEK;
81
82
(-)g10/mainproc.c (+2 lines)
Lines 317-322 Link Here
317
	c->dek = passphrase_to_dek( NULL, 0, algo, &enc->s2k, 0, NULL, NULL );
317
	c->dek = passphrase_to_dek( NULL, 0, algo, &enc->s2k, 0, NULL, NULL );
318
	if(c->dek)
318
	if(c->dek)
319
	  {
319
	  {
320
	    c->dek->symmetric=1;
321
320
	    /* FIXME: This doesn't work perfectly if a symmetric key
322
	    /* FIXME: This doesn't work perfectly if a symmetric key
321
	       comes before a public key in the message - if the user
323
	       comes before a public key in the message - if the user
322
	       doesn't know the passphrase, then there is a chance
324
	       doesn't know the passphrase, then there is a chance
(-)g10/encr-data.c (-1 / +1 lines)
Lines 120-126 Link Here
120
    cipher_sync( dfx.cipher_hd );
120
    cipher_sync( dfx.cipher_hd );
121
    p = temp;
121
    p = temp;
122
/* log_hexdump( "prefix", temp, nprefix+2 ); */
122
/* log_hexdump( "prefix", temp, nprefix+2 ); */
123
    if( p[nprefix-2] != p[nprefix] || p[nprefix-1] != p[nprefix+1] ) {
123
    if( dek->symmetric && (p[nprefix-2] != p[nprefix] || p[nprefix-1] != p[nprefix+1]) ) {
124
	rc = G10ERR_BAD_KEY;
124
	rc = G10ERR_BAD_KEY;
125
	goto leave;
125
	goto leave;
126
    }
126
    }
(-)include/cipher.h (+1 lines)
Lines 75-80 Link Here
75
    int keylen;
75
    int keylen;
76
    int algo_info_printed;
76
    int algo_info_printed;
77
    int use_mdc;
77
    int use_mdc;
78
    int symmetric;
78
    byte key[32]; /* this is the largest used keylen (256 bit) */
79
    byte key[32]; /* this is the largest used keylen (256 bit) */
79
} DEK;
80
} DEK;
80
81
(-)g10/mainproc.c (+2 lines)
Lines 330-335 Link Here
330
330
331
	    if(c->dek)
331
	    if(c->dek)
332
	      {
332
	      {
333
		c->dek->symmetric=1;
334
333
		/* FIXME: This doesn't work perfectly if a symmetric
335
		/* FIXME: This doesn't work perfectly if a symmetric
334
		   key comes before a public key in the message - if
336
		   key comes before a public key in the message - if
335
		   the user doesn't know the passphrase, then there is
337
		   the user doesn't know the passphrase, then there is
(-)g10/encr-data.c (-1 / +1 lines)
Lines 125-131 Link Here
125
    cipher_sync( dfx.cipher_hd );
125
    cipher_sync( dfx.cipher_hd );
126
    p = temp;
126
    p = temp;
127
/* log_hexdump( "prefix", temp, nprefix+2 ); */
127
/* log_hexdump( "prefix", temp, nprefix+2 ); */
128
    if( p[nprefix-2] != p[nprefix] || p[nprefix-1] != p[nprefix+1] ) {
128
    if( dek->symmetric && (p[nprefix-2] != p[nprefix] || p[nprefix-1] != p[nprefix+1]) ) {
129
	rc = G10ERR_BAD_KEY;
129
	rc = G10ERR_BAD_KEY;
130
	goto leave;
130
	goto leave;
131
    }
131
    }

Return to bug 65862