summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-02-06 19:00:11 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-02-11 12:59:25 +0900
commit559eb8b79afb03a3840b90f5070df692a693de05 (patch)
tree740a3dbf49269d99e3faee8719f50c2e5bdcd033 /tools
parent762f1ebe8d1b26e78cd4923f832a611c8a5f0a89 (diff)
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 <yamada.masahiro@socionext.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/cert_create/src/ext.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/cert_create/src/ext.c b/tools/cert_create/src/ext.c
index 3f56edb7..b261951e 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);