From 777b24fbb5322cc63fd68421d94c56ecf64295e0 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Mon, 26 Sep 2011 08:47:32 +0200 Subject: [PATCH] add krb5_is_enctype_weak --- lib/krb5/crypto.c | 20 ++++++++++++++++++++ lib/krb5/libkrb5-exports.def.in | 1 + lib/krb5/version-script.map | 1 + 3 files changed, 22 insertions(+) diff --git a/lib/krb5/crypto.c b/lib/krb5/crypto.c index 321e3dac9..8381ba5c0 100644 --- a/lib/krb5/crypto.c +++ b/lib/krb5/crypto.c @@ -2280,6 +2280,26 @@ krb5_allow_weak_crypto(krb5_context context, return 0; } +/** + * Returns is the encryption is strong or weak + * + * @param context Kerberos 5 context + * @param enctype encryption type to probe + * + * @return Returns true if encryption type is weak or is not supported. + * + * @ingroup krb5_crypto + */ + +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL +krb5_is_enctype_weak(krb5_context context, krb5_enctype enctype) +{ + struct _krb5_encryption_type *et = _krb5_find_enctype(enctype); + if(et == NULL || (et->flags & F_WEAK)) + return TRUE; + return FALSE; +} + static size_t wrapped_length (krb5_context context, krb5_crypto crypto, diff --git a/lib/krb5/libkrb5-exports.def.in b/lib/krb5/libkrb5-exports.def.in index b35238bd4..fbbd7b8f5 100644 --- a/lib/krb5/libkrb5-exports.def.in +++ b/lib/krb5/libkrb5-exports.def.in @@ -387,6 +387,7 @@ EXPORTS krb5_init_ets krb5_initlog krb5_is_config_principal + krb5_is_enctype_weak krb5_is_thread_safe #ifdef HAVE_KCM krb5_kcm_call diff --git a/lib/krb5/version-script.map b/lib/krb5/version-script.map index 818e6e071..dc39a10aa 100644 --- a/lib/krb5/version-script.map +++ b/lib/krb5/version-script.map @@ -387,6 +387,7 @@ HEIMDAL_KRB5_2.0 { krb5_init_ets; krb5_initlog; krb5_is_config_principal; + krb5_is_enctype_weak; krb5_is_thread_safe; krb5_kcm_call; krb5_kcm_storage_request; -- 2.11.4.GIT