aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2020-05-06 15:06:57 -0400
committerPaul Selkirk <paul@psgd.org>2020-05-06 15:06:57 -0400
commitaab1cf4d694b4d4fefa77f02b4c42d7683a2f43f (patch)
treef4dc0ea1499c67b9e7b0dda32f365570f51df134
parent392fa1ef6f9e5643eac0332a493fa02f3138de3c (diff)
If a hash core can't restore state, use a soft core instead.
-rw-r--r--hash.c8
1 files 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;
}