From aab1cf4d694b4d4fefa77f02b4c42d7683a2f43f Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Wed, 6 May 2020 15:06:57 -0400 Subject: If a hash core can't restore state, use a soft core instead. --- hash.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hash.c b/hash.c index 2a63900..a496e87 100644 --- a/hash.c +++ b/hash.c @@ -4,8 +4,9 @@ * HAL interface to Cryptech hash cores. * * Authors: Joachim Strömbergson, Paul Selkirk, Rob Austein - * Copyright (c) 2014-2018, NORDUnet A/S - * All rights reserved. + * Copyright (c) 2014-2018, NORDUnet A/S All rights reserved. + * Copyright: 2020, The Commons Conservancy Cryptech Project + * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -384,7 +385,8 @@ static inline hal_error_t check_core(hal_core_t **core, if (*core != NULL) return HAL_OK; - if ((err = hal_core_alloc(descriptor->core_name, core, pomace)) == HAL_OK) { + if (descriptor->can_restore_state && + (err = hal_core_alloc(descriptor->core_name, core, pomace)) == HAL_OK) { *flags |= STATE_FLAG_FREE_CORE; return HAL_OK; } -- cgit v1.2.3