From 723dfeb3dd9b8426c4c1d6236f4b22354c122dae Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Thu, 18 May 2017 14:27:36 +0200 Subject: trust: Simplify the check for the magic Instead of reusing the CKA_X_GENERATED attribute, check the file contents directly in the caller side. --- trust/parser.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'trust/parser.c') diff --git a/trust/parser.c b/trust/parser.c index abe86fc..f92cdc9 100644 --- a/trust/parser.c +++ b/trust/parser.c @@ -630,11 +630,10 @@ p11_parser_format_persist (p11_parser *parser, ret = p11_persist_read (parser->persist, parser->basename, data, length, objects); if (ret) { + if (!p11_persist_is_generated (data, length)) + modifiablev = CK_FALSE; for (i = 0; i < objects->num; i++) { - CK_BBOOL generatedv; - attrs = objects->elem[i]; - if (p11_attrs_find_bool (attrs, CKA_X_GENERATED, &generatedv) && generatedv) - attrs = p11_attrs_build (attrs, &modifiable, NULL); + attrs = p11_attrs_build (objects->elem[i], &modifiable, NULL); sink_object (parser, attrs); } } -- cgit v1.1