From 74c466bee3adb64232f5aa3b613a54891558e40c Mon Sep 17 00:00:00 2001 From: Howard Yang Date: Wed, 29 Dec 2021 15:33:27 +0800 Subject: cr50: Fix x509_gen_u2f_cert_name Logical error introduced in crrev.com/c/3179708 that causes x509 gen u2f cert failed. Fix the incorrect interpretation of the `result` variable in an `if` statement. BUG=b:211820657 TEST=make buildall -j TEST=manual test, u2fd get g2f certificate doesn't fail anymore Change-Id: I37aaa5946c43896458c93a67352b5f2d92a1965a Signed-off-by: Howard Yang Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3360325 Reviewed-by: Vadim Sukhomlinov Commit-Queue: Vadim Sukhomlinov Tested-by: Vadim Sukhomlinov --- board/cr50/dcrypto/x509.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/cr50/dcrypto/x509.c b/board/cr50/dcrypto/x509.c index 2094f8dad4..4417f1701b 100644 --- a/board/cr50/dcrypto/x509.c +++ b/board/cr50/dcrypto/x509.c @@ -521,7 +521,7 @@ int DCRYPTO_x509_gen_u2f_cert_name(const p256_int *d, const p256_int *pk_x, hmac_drbg_init_rfc6979(&drbg, d, &h); result = dcrypto_p256_ecdsa_sign(&drbg, d, &h, &r, &s) - DCRYPTO_OK; drbg_exit(&drbg); - if (!result) + if (result) return 0; /* Append X509 signature */ -- cgit v1.2.1