Changeset View
Changeset View
Standalone View
Standalone View
b/g10/misc.c
Context not available. | |||||
void | void | ||||
print_digest_algo_note (digest_algo_t algo) | print_digest_algo_note (digest_algo_t algo) | ||||
{ | { | ||||
int deprecated = 0; | |||||
const enum gcry_md_algos galgo = map_md_openpgp_to_gcry (algo); | |||||
const struct weakhash *weak; | |||||
if(algo >= 100 && algo <= 110) | if(algo >= 100 && algo <= 110) | ||||
{ | { | ||||
static int warn=0; | static int warn=0; | ||||
Context not available. | |||||
warn=1; | warn=1; | ||||
es_fflush (es_stdout); | es_fflush (es_stdout); | ||||
log_info (_("WARNING: using experimental digest algorithm %s\n"), | log_info (_("WARNING: using experimental digest algorithm %s\n"), | ||||
gcry_md_algo_name (algo)); | gcry_md_algo_name (galgo)); | ||||
} | } | ||||
} | } | ||||
else if(algo==DIGEST_ALGO_MD5) | else if(algo == DIGEST_ALGO_MD5) | ||||
deprecated = 1; | |||||
else | |||||
for (weak = opt.additional_weak_digests; weak != NULL; weak = weak->next) | |||||
if (weak->algo == galgo) | |||||
deprecated = 1; | |||||
if (deprecated) | |||||
{ | { | ||||
es_fflush (es_stdout); | es_fflush (es_stdout); | ||||
log_info (_("WARNING: digest algorithm %s is deprecated\n"), | log_info (_("WARNING: digest algorithm %s is deprecated\n"), | ||||
gcry_md_algo_name (algo)); | gcry_md_algo_name (galgo)); | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
qbits /= 2; | qbits /= 2; | ||||
return qbits; | return qbits; | ||||
} | } | ||||
/* ignore signatures and certifications made over certain digest | |||||
algorithms by default, MD5 is considered weak. This allows users | |||||
to deprecate support for other algorithms as well. | |||||
*/ | |||||
void | |||||
additional_weak_digest (const char* digestname) | |||||
{ | |||||
struct weakhash *weak = NULL; | |||||
const enum gcry_md_algos algo = string_to_digest_algo(digestname); | |||||
if (algo == GCRY_MD_MD5) | |||||
return; /* MD5 is always considered weak, no need to add it */ | |||||
if (algo == GCRY_MD_NONE) | |||||
{ | |||||
log_error(_("Unknown weak digest '%s'\n"), digestname); | |||||
return; | |||||
} | |||||
/* check to ensure it's not already present */ | |||||
for (weak = opt.additional_weak_digests; weak != NULL; weak = weak->next) | |||||
{ | |||||
if (algo == weak->algo) | |||||
return; | |||||
} | |||||
/* add it to the head of the list */ | |||||
weak = xmalloc(sizeof(*weak)); | |||||
weak->algo = algo; | |||||
weak->next = opt.additional_weak_digests; | |||||
opt.additional_weak_digests = weak; | |||||
} | |||||
Context not available. |