From 15ae48b4fe0a8f0d266b174f520dfc7e22f01a07 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Apr 07 2011 14:03:14 +0000 Subject: - rename various "KEYI" states to "KEYINFO" for readability --- diff --git a/doc/design.txt b/doc/design.txt index f10f874..176b359 100644 --- a/doc/design.txt +++ b/doc/design.txt @@ -41,8 +41,8 @@ Now with some arbitrarily-named states for our per-certificate state machine: States: NEED_GUIDANCE [*] * Getting our bearings States: NEWLY_ADDED, - NEWLY_ADDED_READING_KEYI [*], - NEWLY_ADDED_NEED_KEYI_READ_PIN, + NEWLY_ADDED_READING_KEYINFO [*], + NEWLY_ADDED_NEED_KEYINFO_READ_PIN, NEWLY_ADDED_START_READING_CERT, NEWLY_ADDED_READING_CERT [*], NEWLY_ADDED_DECIDING [*] @@ -304,38 +304,38 @@ State logic: NEWLY_ADDED: if key-storage-is-known - state_next = NEWLY_ADDED_START_READING_KEYI + state_next = NEWLY_ADDED_START_READING_KEYINFO state_transition = now else state_next = NEWLY_ADDED_START_READING_CERT state_transition = now break - NEWLY_ADDED_START_READING_KEYI: + NEWLY_ADDED_START_READING_KEYINFO: start-reading-key-information - state_next = NEWLY_ADDED_READING_KEYI + state_next = NEWLY_ADDED_READING_KEYINFO state_transition = now break - NEWLY_ADDED_READING_KEYI: + NEWLY_ADDED_READING_KEYINFO: if starting-up - state_next = NEWLY_ADDED_START_READING_KEYI + state_next = NEWLY_ADDED_START_READING_KEYINFO state_transition = now else if finished-reading-key-information state_next = NEWLY_ADDED_START_READING_CERT state_transition = now elseif key-store-needs-pin - state_next = NEWLY_ADDED_NEED_KEYI_READ_PIN + state_next = NEWLY_ADDED_NEED_KEYINFO_READ_PIN state_transition = now else state_next = NEWLY_ADDED_START_READING_CERT state_transition = now break - NEWLY_ADDED_NEED_KEYI_READ_PIN: + NEWLY_ADDED_NEED_KEYINFO_READ_PIN: if starting-up - state_next = NEWLY_ADDED_START_READING_KEYI + state_next = NEWLY_ADDED_START_READING_KEYINFO state_transition = now break diff --git a/src/getcert.c b/src/getcert.c index 96d8359..4f05a49 100644 --- a/src/getcert.c +++ b/src/getcert.c @@ -1808,9 +1808,9 @@ list(const char *argv0, int argc, char **argv) case CM_NEED_GUIDANCE: case CM_NEED_CA: case CM_NEWLY_ADDED: - case CM_NEWLY_ADDED_START_READING_KEYI: - case CM_NEWLY_ADDED_READING_KEYI: - case CM_NEWLY_ADDED_NEED_KEYI_READ_PIN: + case CM_NEWLY_ADDED_START_READING_KEYINFO: + case CM_NEWLY_ADDED_READING_KEYINFO: + case CM_NEWLY_ADDED_NEED_KEYINFO_READ_PIN: case CM_NEWLY_ADDED_START_READING_CERT: case CM_NEWLY_ADDED_READING_CERT: case CM_NEWLY_ADDED_DECIDING: diff --git a/src/iterate.c b/src/iterate.c index ffd16da..5083090 100644 --- a/src/iterate.c +++ b/src/iterate.c @@ -121,13 +121,13 @@ cm_entry_reset_state(struct cm_store_entry *entry) break; case CM_NEWLY_ADDED: break; - case CM_NEWLY_ADDED_START_READING_KEYI: + case CM_NEWLY_ADDED_START_READING_KEYINFO: break; - case CM_NEWLY_ADDED_READING_KEYI: - entry->cm_state = CM_NEWLY_ADDED_START_READING_KEYI; + case CM_NEWLY_ADDED_READING_KEYINFO: + entry->cm_state = CM_NEWLY_ADDED_START_READING_KEYINFO; break; - case CM_NEWLY_ADDED_NEED_KEYI_READ_PIN: - entry->cm_state = CM_NEWLY_ADDED_START_READING_KEYI; + case CM_NEWLY_ADDED_NEED_KEYINFO_READ_PIN: + entry->cm_state = CM_NEWLY_ADDED_START_READING_KEYINFO; break; case CM_NEWLY_ADDED_START_READING_CERT: break; @@ -372,12 +372,12 @@ cm_iterate(struct cm_store_entry *entry, struct cm_store_ca *ca, entry->cm_state = CM_HAVE_CSR; *when = cm_time_now; } else - if (cm_csrgen_need_pin(entry, + if (cm_csrgen_need_key(entry, state->cm_csrgen_state) == 0) { - /* Need a PIN; wait for it. */ + /* Need a key pair. */ cm_csrgen_done(entry, state->cm_csrgen_state); state->cm_csrgen_state = NULL; - entry->cm_state = CM_NEED_CSR_GEN_PIN; + entry->cm_state = CM_NEED_KEY_PAIR; *when = cm_time_now; } else { /* Failed to save CSR; try again. */ @@ -716,7 +716,7 @@ cm_iterate(struct cm_store_entry *entry, struct cm_store_ca *ca, * do to make things the way the user has specified that they * should be. */ if (entry->cm_key_storage_type != cm_key_storage_none) { - entry->cm_state = CM_NEWLY_ADDED_START_READING_KEYI; + entry->cm_state = CM_NEWLY_ADDED_START_READING_KEYINFO; *when = cm_time_now; } else { entry->cm_state = CM_NEWLY_ADDED_START_READING_CERT; @@ -724,11 +724,11 @@ cm_iterate(struct cm_store_entry *entry, struct cm_store_ca *ca, } break; - case CM_NEWLY_ADDED_START_READING_KEYI: + case CM_NEWLY_ADDED_START_READING_KEYINFO: /* Try to read information about the key. */ state->cm_keyiread_state = cm_keyiread_start(entry); if (state->cm_keyiread_state != NULL) { - entry->cm_state = CM_NEWLY_ADDED_READING_KEYI; + entry->cm_state = CM_NEWLY_ADDED_READING_KEYINFO; /* Note that we're reading information about * the key. */ *readfd = cm_keyiread_get_fd(entry, @@ -745,7 +745,7 @@ cm_iterate(struct cm_store_entry *entry, struct cm_store_ca *ca, } break; - case CM_NEWLY_ADDED_READING_KEYI: + case CM_NEWLY_ADDED_READING_KEYINFO: /* If we finished reading info about the key, move on to try * and read the certificate. */ if (cm_keyiread_ready(entry, state->cm_keyiread_state) == 0) { @@ -757,7 +757,7 @@ cm_iterate(struct cm_store_entry *entry, struct cm_store_ca *ca, if (cm_keyiread_need_pin(entry, state->cm_keyiread_state) == 0) { /* If we need the PIN, just hang on. */ - entry->cm_state = CM_NEWLY_ADDED_NEED_KEYI_READ_PIN; + entry->cm_state = CM_NEWLY_ADDED_NEED_KEYINFO_READ_PIN; *when = cm_time_now; } else { /* Otherwise try to move on. */ @@ -778,7 +778,7 @@ cm_iterate(struct cm_store_entry *entry, struct cm_store_ca *ca, } break; - case CM_NEWLY_ADDED_NEED_KEYI_READ_PIN: + case CM_NEWLY_ADDED_NEED_KEYINFO_READ_PIN: /* Revisit this later. */ *when = cm_time_no_time; break; diff --git a/src/store-gen.c b/src/store-gen.c index c63a376..2dd5214 100644 --- a/src/store-gen.c +++ b/src/store-gen.c @@ -60,13 +60,17 @@ static struct { {"NOTIFYING", CM_NOTIFYING}, {"NEED_GUIDANCE", CM_NEED_GUIDANCE}, {"NEWLY_ADDED", CM_NEWLY_ADDED}, - {"NEWLY_ADDED_START_READING_KEYI", CM_NEWLY_ADDED_START_READING_KEYI}, - {"NEWLY_ADDED_READING_KEYI", CM_NEWLY_ADDED_READING_KEYI}, - {"NEWLY_ADDED_NEED_KEYI_READ_PIN", CM_NEWLY_ADDED_NEED_KEYI_READ_PIN}, + {"NEWLY_ADDED_START_READING_KEYINFO", CM_NEWLY_ADDED_START_READING_KEYINFO}, + {"NEWLY_ADDED_READING_KEYINFO", CM_NEWLY_ADDED_READING_KEYINFO}, + {"NEWLY_ADDED_NEED_KEYINFO_READ_PIN", CM_NEWLY_ADDED_NEED_KEYINFO_READ_PIN}, {"NEWLY_ADDED_START_READING_CERT", CM_NEWLY_ADDED_START_READING_CERT}, {"NEWLY_ADDED_READING_CERT", CM_NEWLY_ADDED_READING_CERT}, {"NEWLY_ADDED_READING_CERT", CM_NEWLY_ADDED_READING_CERT}, {"NEWLY_ADDED_DECIDING", CM_NEWLY_ADDED_DECIDING}, + /* old names */ + {"NEWLY_ADDED_START_READING_KEYI", CM_NEWLY_ADDED_START_READING_KEYINFO}, + {"NEWLY_ADDED_READING_KEYI", CM_NEWLY_ADDED_READING_KEYINFO}, + {"NEWLY_ADDED_NEED_KEYI_READ_PIN", CM_NEWLY_ADDED_NEED_KEYINFO_READ_PIN}, }; const char * diff --git a/src/store-int.h b/src/store-int.h index 483c232..de926e0 100644 --- a/src/store-int.h +++ b/src/store-int.h @@ -104,9 +104,9 @@ struct cm_store_entry { CM_MONITORING, CM_NEED_TO_NOTIFY, CM_NOTIFYING, CM_NEED_GUIDANCE, CM_NEWLY_ADDED, - CM_NEWLY_ADDED_START_READING_KEYI, - CM_NEWLY_ADDED_READING_KEYI, - CM_NEWLY_ADDED_NEED_KEYI_READ_PIN, + CM_NEWLY_ADDED_START_READING_KEYINFO, + CM_NEWLY_ADDED_READING_KEYINFO, + CM_NEWLY_ADDED_NEED_KEYINFO_READ_PIN, CM_NEWLY_ADDED_START_READING_CERT, CM_NEWLY_ADDED_READING_CERT, CM_NEWLY_ADDED_DECIDING, diff --git a/src/tdbush.c b/src/tdbush.c index ee1b654..60f335e 100644 --- a/src/tdbush.c +++ b/src/tdbush.c @@ -1844,8 +1844,8 @@ request_get_status(DBusConnection *conn, DBusMessage *msg, case CM_NEED_TO_NOTIFY: case CM_NOTIFYING: case CM_NEWLY_ADDED: - case CM_NEWLY_ADDED_START_READING_KEYI: - case CM_NEWLY_ADDED_READING_KEYI: + case CM_NEWLY_ADDED_START_READING_KEYINFO: + case CM_NEWLY_ADDED_READING_KEYINFO: case CM_NEWLY_ADDED_START_READING_CERT: case CM_NEWLY_ADDED_READING_CERT: case CM_NEWLY_ADDED_DECIDING: @@ -1853,7 +1853,7 @@ request_get_status(DBusConnection *conn, DBusMessage *msg, break; case CM_NEED_KEY_GEN_PIN: case CM_NEED_CSR_GEN_PIN: - case CM_NEWLY_ADDED_NEED_KEYI_READ_PIN: + case CM_NEWLY_ADDED_NEED_KEYINFO_READ_PIN: case CM_NEED_GUIDANCE: case CM_NEED_CA: case CM_CA_REJECTED: