lib: clear secrets in set_protected_mgm

This commit is contained in:
Dave Pate
2019-01-22 07:38:36 -08:00
committed by Klas Lindfors
parent 7ff3007017
commit f37cf3f462
+3 -3
View File
@@ -1184,7 +1184,7 @@ ykpiv_rc ykpiv_util_set_protected_mgm(ykpiv_state *state, ykpiv_mgm *mgm) {
} }
} }
if (YKPIV_OK != (res = _ykpiv_begin_transaction(state))) return YKPIV_PCSC_ERROR; if (YKPIV_OK != (res = _ykpiv_begin_transaction(state))) { res = YKPIV_PCSC_ERROR; goto Cleanup; }
if (YKPIV_OK != (res = _ykpiv_ensure_application_selected(state))) goto Cleanup; if (YKPIV_OK != (res = _ykpiv_ensure_application_selected(state))) goto Cleanup;
/* try to set the mgm key as long as we don't encounter a fatal error */ /* try to set the mgm key as long as we don't encounter a fatal error */
@@ -1279,8 +1279,8 @@ ykpiv_rc ykpiv_util_set_protected_mgm(ykpiv_state *state, ykpiv_mgm *mgm) {
Cleanup: Cleanup:
memset(data, 0, sizeof(data)); yc_memzero(data, sizeof(data));
memset(mgm_key, 0, sizeof(mgm_key)); yc_memzero(mgm_key, sizeof(mgm_key));
_ykpiv_end_transaction(state); _ykpiv_end_transaction(state);
return res; return res;