diff --git a/src/Mayaqua/Secure.c b/src/Mayaqua/Secure.c index 18078cd5..7ff81386 100644 --- a/src/Mayaqua/Secure.c +++ b/src/Mayaqua/Secure.c @@ -1313,14 +1313,6 @@ bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT si UINT object_class = CKO_DATA; CK_BBOOL b_true = true, b_false = false, b_private_obj = private_obj; UINT object; - CK_ATTRIBUTE a[] = - { - {CKA_TOKEN, &b_true, sizeof(b_true)}, - {CKA_CLASS, &object_class, sizeof(object_class)}, - {CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)}, - {CKA_LABEL, name, StrLen(name)}, - {CKA_VALUE, data, size}, - }; // Validate arguments if (sec == NULL) { @@ -1347,6 +1339,15 @@ bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT si return false; } + CK_ATTRIBUTE a[] = + { + {CKA_TOKEN, &b_true, sizeof(b_true)}, + {CKA_CLASS, &object_class, sizeof(object_class)}, + {CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)}, + {CKA_LABEL, name, StrLen(name)}, + {CKA_VALUE, data, size}, + }; + // Delete any objects with the same name if (CheckSecObject(sec, name, SEC_DATA)) {