Commit 559eb8b7 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 762f1ebe
...@@ -262,8 +262,7 @@ X509_EXTENSION *ext_new_nvcounter(int nid, int crit, int value) ...@@ -262,8 +262,7 @@ X509_EXTENSION *ext_new_nvcounter(int nid, int crit, int value)
/* Encode counter */ /* Encode counter */
counter = ASN1_INTEGER_new(); counter = ASN1_INTEGER_new();
ASN1_INTEGER_set(counter, value); ASN1_INTEGER_set(counter, value);
sz = i2d_ASN1_INTEGER(counter, NULL); sz = i2d_ASN1_INTEGER(counter, &p);
i2d_ASN1_INTEGER(counter, &p);
/* Create the extension */ /* Create the extension */
ex = ext_new(nid, crit, p, sz); ex = ext_new(nid, crit, p, sz);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment