From 910e6c1a5d04e31f036d8623f5d11d012cc23924 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Fri, 1 Mar 2013 20:20:09 -0500 Subject: [PATCH] s/PKCS/PKI --- src/cipher.h | 2 +- src/commands.c | 28 ++++++++++++++-------------- src/crypto.c | 20 ++++++++++---------- src/crypto.h | 2 +- src/pwmd.c | 4 ++-- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/cipher.h b/src/cipher.h index 42b5cbb7..55163cb4 100644 --- a/src/cipher.h +++ b/src/cipher.h @@ -41,7 +41,7 @@ #define PWMD_FLAG_OFFSET (PWMD_CIPHER_OFFSET << 15) #define PWMD_FLAG(n) (PWMD_FLAG_OFFSET << n) -#define PWMD_FLAG_PKCS PWMD_FLAG (1) +#define PWMD_FLAG_PKI PWMD_FLAG (1) int cipher_string_to_gcrypt (const char *str); int cipher_to_gcrypt (int flags); diff --git a/src/commands.c b/src/commands.c index c16c818e..d698ed2d 100644 --- a/src/commands.c +++ b/src/commands.c @@ -286,7 +286,7 @@ open_finalize (assuan_context_t ctx, char *key, size_t keylen) goto done; } - if (!key && !IS_PKCS (client->crypto)) + if (!key && !IS_PKI (client->crypto)) { if (client->flags & FLAG_NO_PINENTRY) { @@ -307,7 +307,7 @@ open_finalize (assuan_context_t ctx, char *key, size_t keylen) } } - if (!IS_PKCS (client->crypto)) + if (!IS_PKI (client->crypto)) { algo = cipher_to_gcrypt (client->crypto->hdr.flags); rc = hash_key (algo, client->crypto->hdr.salt, @@ -367,7 +367,7 @@ open_finalize (assuan_context_t ctx, char *key, size_t keylen) client->crypto->plaintext_len, &cdata->doc, &cdata->doclen, &cache_iv, &cache_blocksize, 0); - if (!rc && !(client->flags & FLAG_NEW) && IS_PKCS (client->crypto)) + if (!rc && !(client->flags & FLAG_NEW) && IS_PKI (client->crypto)) { rc = gcry_sexp_build ((gcry_sexp_t *) & cdata->pubkey, NULL, "%S", client->crypto->pkey_sexp); @@ -379,7 +379,7 @@ open_finalize (assuan_context_t ctx, char *key, size_t keylen) cdata->sigkey = NULL; - if (!rc && IS_PKCS (client->crypto)) + if (!rc && IS_PKI (client->crypto)) rc = gcry_sexp_build ((gcry_sexp_t *) &cdata->sigkey, NULL, "%S", client->crypto->sigpkey_sexp); @@ -531,7 +531,7 @@ do_open (assuan_context_t ctx, const char *filename, const char *password) NULL, NULL); if (!rc) { - if (IS_PKCS (client->crypto)) + if (IS_PKI (client->crypto)) { gcry_sexp_build (&client->crypto->pkey_sexp, NULL, "%S", cdata->pubkey); @@ -583,7 +583,7 @@ do_open (assuan_context_t ctx, const char *filename, const char *password) return rc; } - if (password && IS_PKCS (client->crypto)) + if (password && IS_PKI (client->crypto)) { #ifdef WITH_AGENT rc = set_agent_passphrase (client->crypto, password, strlen (password)); @@ -665,7 +665,7 @@ open_command (assuan_context_t ctx, char *line) { password = req[1] && *req[1] ? req[1] : NULL; #ifdef WITH_AGENT - if (IS_PKCS (client->crypto)) + if (IS_PKI (client->crypto)) rc = set_pinentry_mode (client->crypto->agent, (client->flags & FLAG_NO_PINENTRY) ? "loopback" : "ask"); @@ -729,7 +729,7 @@ parse_save_opt_keygrip (void *data, void *value) { struct client_s *client = data; - if (!IS_PKCS (client->crypto)) + if (!IS_PKI (client->crypto)) return GPG_ERR_INV_ARG; #ifdef WITH_AGENT @@ -748,7 +748,7 @@ parse_save_opt_sign_keygrip (void *data, void *value) { struct client_s *client = data; - if (!IS_PKCS (client->crypto)) + if (!IS_PKI (client->crypto)) return GPG_ERR_INV_ARG; #ifdef WITH_AGENT @@ -814,7 +814,7 @@ save_finalize (assuan_context_t ctx) if (!use_agent || ((client->flags & FLAG_NEW) && (client->opts & OPT_NO_AGENT)) - || !(client->crypto->hdr.flags & PWMD_FLAG_PKCS)) + || !(client->crypto->hdr.flags & PWMD_FLAG_PKI)) { rc = export_common (ctx, client->flags & FLAG_NO_PINENTRY, client->crypto, xmlbuf, xmlbuflen, client->filename, @@ -955,8 +955,8 @@ save_command (assuan_context_t ctx, char *line) client->opts &= ~OPT_NO_AGENT; else if (client->opts & OPT_NO_AGENT) { - client->crypto->save.hdr.flags &= ~PWMD_FLAG_PKCS; - client->crypto->hdr.flags &= ~PWMD_FLAG_PKCS; + client->crypto->save.hdr.flags &= ~PWMD_FLAG_PKI; + client->crypto->hdr.flags &= ~PWMD_FLAG_PKI; } if ((client->opts & OPT_NO_PASSPHRASE) && !(client->flags & FLAG_NEW) @@ -3979,7 +3979,7 @@ passwd_command (assuan_context_t ctx, char *line) if (!rc) { - if (!IS_PKCS (client->crypto)) + if (!IS_PKI (client->crypto)) { struct crypto_s *crypto; @@ -4052,7 +4052,7 @@ keygrip_command (assuan_context_t ctx, char *line) { char *hexgrip = NULL; - if (!IS_PKCS (crypto)) + if (!IS_PKI (crypto)) { cleanup_crypto (&crypto); return send_error (ctx, GPG_ERR_NOT_SUPPORTED); diff --git a/src/crypto.c b/src/crypto.c index ed1ba674..96e7a895 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -62,7 +62,7 @@ set_header_defaults (file_header_t * hdr) #ifdef WITH_AGENT if (use_agent) - hdr->flags |= PWMD_FLAG_PKCS; + hdr->flags |= PWMD_FLAG_PKI; #endif } @@ -203,7 +203,7 @@ read_data_file (const char *filename, struct crypto_s * crypto) goto fail; } - if (crypto->hdr.flags & PWMD_FLAG_PKCS) + if (crypto->hdr.flags & PWMD_FLAG_PKI) { rlen = read (fd, crypto->grip, 20); if (rlen != 20) @@ -227,7 +227,7 @@ read_data_file (const char *filename, struct crypto_s * crypto) goto fail; } - if (!(crypto->hdr.flags & PWMD_FLAG_PKCS)) + if (!(crypto->hdr.flags & PWMD_FLAG_PKI)) goto fail; #ifndef WITH_AGENT @@ -352,7 +352,7 @@ decrypt_data (assuan_context_t ctx, struct crypto_s *crypto, size_t keylen = skeylen; gcry_sexp_t sig_sexp; - if (crypto->hdr.flags & PWMD_FLAG_PKCS) + if (crypto->hdr.flags & PWMD_FLAG_PKI) { rc = agent_extract_key (crypto, &key, &keylen); if (rc) @@ -455,7 +455,7 @@ decrypt_data (assuan_context_t ctx, struct crypto_s *crypto, #ifdef WITH_AGENT pthread_cleanup_pop (0); - if (crypto->hdr.flags & PWMD_FLAG_PKCS) + if (crypto->hdr.flags & PWMD_FLAG_PKI) gcry_free (key); else if (key) key[0] ^= 1; @@ -1100,7 +1100,7 @@ write_file (struct crypto_s *crypto, const char *filename, rc = write_header (crypto, fd); if (!rc) { - if (crypto->save.hdr.flags & PWMD_FLAG_PKCS) + if (crypto->save.hdr.flags & PWMD_FLAG_PKI) { unsigned char grip[20]; @@ -1455,7 +1455,7 @@ decrypt_common (assuan_context_t ctx, int inquire, struct crypto_s *crypto, } } - if (!key && !IS_PKCS (crypto) && inquire) + if (!key && !IS_PKI (crypto) && inquire) { rc = inquire_passphrase (ctx, "PASSPHRASE", (unsigned char **)&key, &keylen); @@ -1468,7 +1468,7 @@ decrypt_common (assuan_context_t ctx, int inquire, struct crypto_s *crypto, if (!keylen) keylen++; } - else if (!key && !IS_PKCS (crypto)) + else if (!key && !IS_PKI (crypto)) { rc = getpin_common (ctx, filename, PINENTRY_OPEN, &key, &keylen); if (rc) @@ -1478,7 +1478,7 @@ decrypt_common (assuan_context_t ctx, int inquire, struct crypto_s *crypto, } } #ifdef WITH_AGENT - else if (key && IS_PKCS (crypto)) + else if (key && IS_PKI (crypto)) { rc = set_agent_passphrase (crypto, key, keylen); if (rc) @@ -1490,7 +1490,7 @@ decrypt_common (assuan_context_t ctx, int inquire, struct crypto_s *crypto, } #endif - if (key && !IS_PKCS (crypto)) + if (key && !IS_PKI (crypto)) { rc = hash_key (algo, crypto->hdr.salt, sizeof(crypto->hdr.salt), key, keylen, &salted_key, &keysize); diff --git a/src/crypto.h b/src/crypto.h index 89411961..5cdc09af 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -81,7 +81,7 @@ struct crypto_s }; int use_agent; -#define IS_PKCS(crypto) (use_agent && (crypto->hdr.flags & PWMD_FLAG_PKCS)) +#define IS_PKI(crypto) (use_agent && (crypto->hdr.flags & PWMD_FLAG_PKI)) void cleanup_save (struct save_s *save); gpg_error_t encrypt_xml (assuan_context_t ctx, void *key, size_t keylen, int diff --git a/src/pwmd.c b/src/pwmd.c index b4f396d7..b3a11561 100644 --- a/src/pwmd.c +++ b/src/pwmd.c @@ -1277,7 +1277,7 @@ do_cache_push (const char *filename, struct crypto_s *crypto) rc = encrypt_xml (NULL, cache_key, cache_keysize, GCRY_CIPHER_AES, crypto->plaintext, crypto->plaintext_len, &cdata->doc, &cdata->doclen, &cache_iv, &cache_blocksize, 0); - if (!rc && !IS_PKCS (crypto)) + if (!rc && !IS_PKI (crypto)) { cdata->key = key; cdata->keylen = keylen; @@ -1294,7 +1294,7 @@ do_cache_push (const char *filename, struct crypto_s *crypto) } #ifdef WITH_AGENT - if (use_agent) + if (use_agent && IS_PKI (crypto)) { gcry_sexp_build ((gcry_sexp_t *) & cdata->pubkey, NULL, "%S", crypto->pkey_sexp); -- 2.11.4.GIT