From f0c02e27c4c5dd84b865f0ed60354013621593a9 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Fri, 23 Nov 2012 15:48:30 +0100 Subject: [PATCH] Remove external build_encoding method in PKCS#9 --- src/libstrongswan/crypto/pkcs9.c | 9 +++++---- src/libstrongswan/crypto/pkcs9.h | 5 ----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/libstrongswan/crypto/pkcs9.c b/src/libstrongswan/crypto/pkcs9.c index 73dfdc447..15800d57d 100644 --- a/src/libstrongswan/crypto/pkcs9.c +++ b/src/libstrongswan/crypto/pkcs9.c @@ -145,8 +145,10 @@ static attribute_t *attribute_create(int oid, chunk_t value) return this; } -METHOD(pkcs9_t, build_encoding, void, - private_pkcs9_t *this) +/** + * Build encoding of the attribute list + */ +static void build_encoding(private_pkcs9_t *this) { enumerator_t *enumerator; attribute_t *attribute; @@ -188,7 +190,7 @@ METHOD(pkcs9_t, build_encoding, void, METHOD(pkcs9_t, get_encoding, chunk_t, private_pkcs9_t *this) { - if (this->encoding.ptr == NULL) + if (!this->encoding.len) { build_encoding(this); } @@ -255,7 +257,6 @@ static private_pkcs9_t *pkcs9_create_empty(void) INIT(this, .public = { - .build_encoding = _build_encoding, .get_encoding = _get_encoding, .get_attribute = _get_attribute, .set_attribute = _set_attribute, diff --git a/src/libstrongswan/crypto/pkcs9.h b/src/libstrongswan/crypto/pkcs9.h index c442d4441..2c60aaf5f 100644 --- a/src/libstrongswan/crypto/pkcs9.h +++ b/src/libstrongswan/crypto/pkcs9.h @@ -31,11 +31,6 @@ typedef struct pkcs9_t pkcs9_t; */ struct pkcs9_t { - /** - * Generate ASN.1 encoding of attribute list - */ - void (*build_encoding) (pkcs9_t *this); - /** * Gets ASN.1 encoding of PKCS#9 attribute list *