/[winpt]/trunk/Src/wptKeyCache.cpp
ViewVC logotype

Diff of /trunk/Src/wptKeyCache.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 42 by werner, Fri Oct 28 08:25:30 2005 UTC revision 121 by twoaday, Mon Dec 12 11:19:56 2005 UTC
# Line 17  Line 17 
17   * along with this program; if not, write to the Free Software   * along with this program; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19   */   */
20    
21  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
22  #include <config.h>  #include <config.h>
23  #endif  #endif
24    
25  #include <windows.h>  #include <windows.h>
 #include <windows.h>  
26  #include <stdio.h>  #include <stdio.h>
27  #include <string.h>  #include <string.h>
28  #include <malloc.h>  #include <malloc.h>
29  #include <ctype.h>  #include <ctype.h>
30  #include <assert.h>  #include <assert.h>
31    #include <gpgme.h>
32    
 #include "w32gpgme.h"  
33  #include "wptKeyCache.h"  #include "wptKeyCache.h"
34  #include "openpgp.h"  #include "openpgp.h"
35  #include "wptNLS.h"  #include "wptNLS.h"
# Line 37  Line 37 
37  #include "wptW32API.h"  #include "wptW32API.h"
38    
39    
40    #if 0
41  /* convert a binary buffer into its hex representation. */  /* convert a binary buffer into its hex representation. */
42  static void  static void
43  buffer_to_string (char *dst, size_t dlen, const byte *buf, size_t nbytes)  buffer_to_string (char *dst, size_t dlen, const byte *buf, size_t nbytes)
# Line 51  buffer_to_string (char *dst, size_t dlen Line 52  buffer_to_string (char *dst, size_t dlen
52          dlen -= 2;          dlen -= 2;
53      }      }
54  }  }
55    #endif
56    
57    
58  /* Parse the secret keyring and retrieve some additional information  /* Parse the secret keyring and retrieve some additional information
# Line 105  gpgme_error_t Line 107  gpgme_error_t
107  keycache_prepare2 (gpg_keycache_t ctx, const char *kid,  keycache_prepare2 (gpg_keycache_t ctx, const char *kid,
108                     const char *pubring, const char *secring)                     const char *pubring, const char *secring)
109  {  {
110      gpgme_error_t err;      gpgme_error_t err = gpg_error (GPG_ERR_NO_ERROR);
111      gpgme_key_t key = NULL;      gpgme_key_t key = NULL;
112      gpg_iobuf_t inp;      gpg_iobuf_t inp;
113      PACKET *pkt = (PACKET*)calloc (1, sizeof * pkt);      PACKET *pkt = (PACKET*)calloc (1, sizeof * pkt);
# Line 113  keycache_prepare2 (gpg_keycache_t ctx, c Line 115  keycache_prepare2 (gpg_keycache_t ctx, c
115      const byte *sym_prefs;      const byte *sym_prefs;
116      char keyid[16+1], *id = NULL;      char keyid[16+1], *id = NULL;
117      int key_seen = 0;      int key_seen = 0;
118      size_t nbytes = 0, nsym =0;      size_t nsym =0;
119    
120      if (secring) {      if (secring) {
121          parse_secring (ctx, kid, secring);          parse_secring (ctx, kid, secring);
# Line 176  keycache_prepare2 (gpg_keycache_t ctx, c Line 178  keycache_prepare2 (gpg_keycache_t ctx, c
178          }          }
179          if ((pkt->pkttype == PKT_USER_ID || pkt->pkttype == PKT_ATTRIBUTE)          if ((pkt->pkttype == PKT_USER_ID || pkt->pkttype == PKT_ATTRIBUTE)
180              && pkt->pkt.user_id->attrib_data && key) {              && pkt->pkt.user_id->attrib_data && key) {
181              PKT_user_id *id = pkt->pkt.user_id;              PKT_user_id *uid = pkt->pkt.user_id;
182              c->attrib.used = 1;              c->attrib.used = 1;
183              c->attrib.len = id->attrib_len;              c->attrib.len = uid->attrib_len;
184              c->attrib.d = (unsigned char*)calloc (1, id->attrib_len + 1);              c->attrib.d = (unsigned char*)calloc (1, uid->attrib_len + 1);
185              if (!c->attrib.d) {              if (!c->attrib.d) {
186                  err = gpg_error (GPG_ERR_ENOMEM);                  err = gpg_error (GPG_ERR_ENOMEM);
187                  goto fail;                  goto fail;
188              }              }
189              memcpy (c->attrib.d, id->attrib_data, id->attrib_len);              memcpy (c->attrib.d, uid->attrib_data, uid->attrib_len);
190              key = NULL;              key = NULL;
191              c = NULL;              c = NULL;
192          }          }

Legend:
Removed from v.42  
changed lines
  Added in v.121

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26