Browse Source

Deprecated and replaced misspellings of 'compromised' and 'secret' in the API and constants. Nothing should be broken for existing implementations.

doc_update_sequoia
Krista Bennett 4 years ago
parent
commit
503bc6ae78
7 changed files with 62 additions and 27 deletions
  1. +5
    -5
      src/keymanagement.c
  2. +6
    -6
      src/message_api.c
  3. +27
    -11
      src/pEpEngine.c
  4. +20
    -2
      src/pEpEngine.h
  5. +1
    -1
      src/pEp_internal.h
  6. +1
    -1
      src/sync_impl.c
  7. +2
    -1
      test/test_util.cc

+ 5
- 5
src/keymanagement.c View File

@ -70,7 +70,7 @@ PEP_STATUS elect_pubkey(
return PEP_OUT_OF_MEMORY;
}
if (_comm_type_key != PEP_ct_compromized &&
if (_comm_type_key != PEP_ct_compromised &&
_comm_type_key != PEP_ct_unknown)
{
if (identity->comm_type == PEP_ct_unknown ||
@ -341,7 +341,7 @@ PEP_STATUS get_valid_pubkey(PEP_SESSION session,
case PEP_ct_key_revoked:
case PEP_ct_key_b0rken:
case PEP_ct_key_expired:
case PEP_ct_compromized:
case PEP_ct_compromised:
case PEP_ct_mistrusted:
// this only happens when it's all there is
status = first_reject_status;
@ -787,7 +787,7 @@ DYNAMIC_API PEP_STATUS update_identity(
// FIXME: This is legacy. I presume it's a notification for the caller...
// Revisit once I can talk to Volker
if (identity->comm_type != PEP_ct_compromized &&
if (identity->comm_type != PEP_ct_compromised &&
identity->comm_type < PEP_ct_strong_but_unconfirmed)
if (session->examine_identity)
session->examine_identity(identity, session->examine_management);
@ -845,7 +845,7 @@ PEP_STATUS elect_ownkey(
return PEP_OUT_OF_MEMORY;
}
if (_comm_type_key != PEP_ct_compromized &&
if (_comm_type_key != PEP_ct_compromised &&
_comm_type_key != PEP_ct_unknown)
{
if (identity->comm_type == PEP_ct_unknown ||
@ -1185,7 +1185,7 @@ DYNAMIC_API PEP_STATUS key_mistrusted(
if (status == PEP_STATUS_OK)
// cascade that mistrust for anyone using this key
status = mark_as_compromized(session, ident->fpr);
status = mark_as_compromised(session, ident->fpr);
if (status == PEP_STATUS_OK)
status = remove_fpr_as_default(session, ident->fpr);
if (status == PEP_STATUS_OK)


+ 6
- 6
src/message_api.c View File

@ -1059,7 +1059,7 @@ static PEP_rating _rating(PEP_comm_type ct, PEP_rating rating)
else if (ct == PEP_ct_key_not_found)
return PEP_rating_have_no_key;
else if (ct == PEP_ct_compromized)
else if (ct == PEP_ct_compromised)
return PEP_rating_under_attack;
else if (ct == PEP_ct_mistrusted)
@ -1259,8 +1259,8 @@ static PEP_comm_type _get_comm_type(
{
PEP_STATUS status = PEP_STATUS_OK;
if (max_comm_type == PEP_ct_compromized)
return PEP_ct_compromized;
if (max_comm_type == PEP_ct_compromised)
return PEP_ct_compromised;
if (max_comm_type == PEP_ct_mistrusted)
return PEP_ct_mistrusted;
@ -1271,8 +1271,8 @@ static PEP_comm_type _get_comm_type(
status = myself(session, ident);
if (status == PEP_STATUS_OK) {
if (ident->comm_type == PEP_ct_compromized)
return PEP_ct_compromized;
if (ident->comm_type == PEP_ct_compromised)
return PEP_ct_compromised;
else if (ident->comm_type == PEP_ct_mistrusted)
return PEP_ct_mistrusted;
else
@ -1889,7 +1889,7 @@ DYNAMIC_API PEP_STATUS encrypt_message_and_add_priv_key(
char* priv_key_data = NULL;
size_t priv_key_size = 0;
status = export_secrect_key(session, own_private_fpr, &priv_key_data,
status = export_secret_key(session, own_private_fpr, &priv_key_data,
&priv_key_size);
if (status != PEP_STATUS_OK)


+ 27
- 11
src/pEpEngine.c View File

@ -311,7 +311,7 @@ static const char *sql_least_trust =
" and comm_type != 0;"; // ignores PEP_ct_unknown
// returns PEP_ct_unknown only when no known trust is recorded
static const char *sql_mark_as_compromized =
static const char *sql_mark_as_compromised =
"update trust not indexed set comm_type = 15"
" where pgp_keypair_fpr = upper(replace(?1,' ','')) ;";
@ -1195,8 +1195,8 @@ DYNAMIC_API PEP_STATUS init(PEP_SESSION *session)
(int)strlen(sql_least_trust), &_session->least_trust, NULL);
assert(int_result == SQLITE_OK);
int_result = sqlite3_prepare_v2(_session->db, sql_mark_as_compromized,
(int)strlen(sql_mark_as_compromized), &_session->mark_compromized,
int_result = sqlite3_prepare_v2(_session->db, sql_mark_as_compromised,
(int)strlen(sql_mark_as_compromised), &_session->mark_compromised,
NULL);
assert(int_result == SQLITE_OK);
@ -1428,8 +1428,8 @@ DYNAMIC_API void release(PEP_SESSION session)
sqlite3_finalize(session->get_trust);
if (session->least_trust)
sqlite3_finalize(session->least_trust);
if (session->mark_compromized)
sqlite3_finalize(session->mark_compromized);
if (session->mark_compromised)
sqlite3_finalize(session->mark_compromised);
if (session->crashdump)
sqlite3_finalize(session->crashdump);
if (session->languagelist)
@ -2926,11 +2926,19 @@ PEP_STATUS get_main_user_fpr(PEP_SESSION session,
return status;
}
// Deprecated
DYNAMIC_API PEP_STATUS mark_as_compromized(
PEP_SESSION session,
const char *fpr
)
{
return mark_as_compromised(session, fpr);
}
DYNAMIC_API PEP_STATUS mark_as_compromised(
PEP_SESSION session,
const char *fpr
)
{
int result;
@ -2940,11 +2948,11 @@ DYNAMIC_API PEP_STATUS mark_as_compromized(
if (!(session && fpr && fpr[0]))
return PEP_ILLEGAL_VALUE;
sqlite3_reset(session->mark_compromized);
sqlite3_bind_text(session->mark_compromized, 1, fpr, -1,
sqlite3_reset(session->mark_compromised);
sqlite3_bind_text(session->mark_compromised, 1, fpr, -1,
SQLITE_STATIC);
result = sqlite3_step(session->mark_compromized);
sqlite3_reset(session->mark_compromized);
result = sqlite3_step(session->mark_compromised);
sqlite3_reset(session->mark_compromised);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_TRUST;
@ -3142,7 +3150,7 @@ DYNAMIC_API PEP_STATUS export_key(
key_data, size, false);
}
DYNAMIC_API PEP_STATUS export_secrect_key(
DYNAMIC_API PEP_STATUS export_secret_key(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size
)
{
@ -3162,6 +3170,14 @@ DYNAMIC_API PEP_STATUS export_secrect_key(
key_data, size, true);
}
// Deprecated
DYNAMIC_API PEP_STATUS export_secrect_key(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size
)
{
return export_secret_key(session, fpr, key_data, size);
}
DYNAMIC_API PEP_STATUS find_keys(
PEP_SESSION session, const char *pattern, stringlist_t **keylist
)


+ 20
- 2
src/pEpEngine.h View File

@ -431,7 +431,8 @@ typedef enum _PEP_comm_type {
PEP_ct_b0rken_crypto = 0x0b,
PEP_ct_key_too_short = 0x0c,
PEP_ct_compromized = 0x0e, // known compromized connection
PEP_ct_compromised = 0x0e, // known compromised connection
PEP_ct_compromized = 0x0e, // deprecated misspelling
PEP_ct_mistrusted = 0x0f, // known mistrusted key
// range 0x10 to 0x3f: unconfirmed encryption
@ -742,12 +743,21 @@ DYNAMIC_API PEP_STATUS unset_identity_flags(
identity_flags_t flags
);
// mark_as_compromized() - mark key in trust db as compromized
// mark_as_compromised() - mark key in trust db as compromised
//
// parameters:
// session (in) session handle
// fpr (in) fingerprint of key to mark
DYNAMIC_API PEP_STATUS mark_as_compromised(
PEP_SESSION session,
const char *fpr
);
// mark_as_compromized() - deprecated to fix misspelling. Please move to
// mark_as_compromised();
DYNAMIC_API PEP_STATUS mark_as_compromized(
PEP_SESSION session,
const char *fpr
@ -861,6 +871,14 @@ DYNAMIC_API PEP_STATUS export_key(
// the caller is responsible to free() it (on Windoze use pEp_free())
// beware of leaking secret key data - overwrite it in memory after use
DYNAMIC_API PEP_STATUS export_secret_key(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size
);
// export_secrect_key() - deprecated misspelled function. Please replace with
// export_secret_key
DYNAMIC_API PEP_STATUS export_secrect_key(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size
);


+ 1
- 1
src/pEp_internal.h View File

@ -150,7 +150,7 @@ struct _pEpSession {
sqlite3_stmt *update_trust_for_fpr;
sqlite3_stmt *get_trust;
sqlite3_stmt *least_trust;
sqlite3_stmt *mark_compromized;
sqlite3_stmt *mark_compromised;
sqlite3_stmt *reset_trust;
sqlite3_stmt *crashdump;
sqlite3_stmt *languagelist;


+ 1
- 1
src/sync_impl.c View File

@ -894,7 +894,7 @@ PEP_STATUS unicast_msg(
goto enomem;
char *key = NULL;
size_t size = 0;
status = export_secrect_key(session, fpr, &key, &size);
status = export_secret_key(session, fpr, &key, &size);
if (status != PEP_STATUS_OK)
goto error;
bloblist_t *bl = bloblist_add(_message->attachments,


+ 2
- 1
test/test_util.cc View File

@ -266,8 +266,9 @@ const char* tl_ct_string(PEP_comm_type ct) {
return "PEP_ct_b0rken_crypto";
case PEP_ct_key_too_short:
return "PEP_ct_key_too_short";
case PEP_ct_compromised:
case PEP_ct_compromized:
return "PEP_ct_compromized";
return "PEP_ct_compromised";
case PEP_ct_mistrusted:
return "PEP_ct_mistrusted";
case PEP_ct_unconfirmed_encryption:


Loading…
Cancel
Save