From 559eb8b79afb03a3840b90f5070df692a693de05 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 6 Feb 2017 19:00:11 +0900 Subject: [PATCH] cert_create: merge successive i2d_ASN1_INTEGER() calls The ext_new_nvcounter() function calls i2d_ASN1_INTEGER() twice; the first call to get the return value "sz", and the second one for writing data into the buffer. This is actually redundant. We can do both by one function call. Signed-off-by: Masahiro Yamada --- tools/cert_create/src/ext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/cert_create/src/ext.c b/tools/cert_create/src/ext.c index 3f56edb75..b261951e2 100644 --- a/tools/cert_create/src/ext.c +++ b/tools/cert_create/src/ext.c @@ -262,8 +262,7 @@ X509_EXTENSION *ext_new_nvcounter(int nid, int crit, int value) /* Encode counter */ counter = ASN1_INTEGER_new(); ASN1_INTEGER_set(counter, value); - sz = i2d_ASN1_INTEGER(counter, NULL); - i2d_ASN1_INTEGER(counter, &p); + sz = i2d_ASN1_INTEGER(counter, &p); /* Create the extension */ ex = ext_new(nid, crit, p, sz);