From 4446afe49c3cefcc91a7ab30335b819fb850ebfb Mon Sep 17 00:00:00 2001 From: Alexander Scheel Date: Wed, 24 Feb 2021 18:12:03 -0500 Subject: [PATCH] Switch to checking for AES_KEY_WRAP by default Signed-off-by: Alexander Scheel --- org/mozilla/jss/pkcs11/PK11KeyWrapper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/org/mozilla/jss/pkcs11/PK11KeyWrapper.c b/org/mozilla/jss/pkcs11/PK11KeyWrapper.c index f39a3796e..83bccc3ff 100644 --- a/org/mozilla/jss/pkcs11/PK11KeyWrapper.c +++ b/org/mozilla/jss/pkcs11/PK11KeyWrapper.c @@ -886,17 +886,17 @@ CK_MECHANISM_TYPE getSupportedWrappingMechanism(JNIEnv *env, jobject algObj, PK1 */ if ( mech == CKM_AES_KEY_WRAP || mech == CKM_NSS_AES_KEY_WRAP) { - if (!PK11_DoesMechanism(slot, CKM_AES_KEY_WRAP)) { - mech = CKM_NSS_AES_KEY_WRAP; - } else { + if (PK11_DoesMechanism(slot, CKM_AES_KEY_WRAP)) { mech = CKM_AES_KEY_WRAP; + } else { + mech = CKM_NSS_AES_KEY_WRAP; } } else if ( mech == CKM_AES_KEY_WRAP_PAD || mech == CKM_NSS_AES_KEY_WRAP_PAD) { - if (!PK11_DoesMechanism(slot, CKM_AES_KEY_WRAP_PAD)) { - mech = CKM_NSS_AES_KEY_WRAP_PAD; - } else { + if (PK11_DoesMechanism(slot, CKM_AES_KEY_WRAP_PAD)) { mech = CKM_AES_KEY_WRAP_PAD; + } else { + mech = CKM_NSS_AES_KEY_WRAP_PAD; } } return mech;