Migrated x509_ocsp_response to INIT/METHOD macros
This commit is contained in:
@@ -148,14 +148,10 @@ static const chunk_t ASN1_response_content = chunk_from_chars(
|
|||||||
0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x01
|
0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x01
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
METHOD(ocsp_response_t, get_status, cert_validation_t,
|
||||||
* Implementaiton of ocsp_response_t.get_status
|
private_x509_ocsp_response_t *this, x509_t *subject, x509_t *issuer,
|
||||||
*/
|
time_t *revocation_time, crl_reason_t *revocation_reason,
|
||||||
static cert_validation_t get_status(private_x509_ocsp_response_t *this,
|
time_t *this_update, time_t *next_update)
|
||||||
x509_t *subject, x509_t *issuer,
|
|
||||||
time_t *revocation_time,
|
|
||||||
crl_reason_t *revocation_reason,
|
|
||||||
time_t *this_update, time_t *next_update)
|
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
single_response_t *response;
|
single_response_t *response;
|
||||||
@@ -236,10 +232,8 @@ static cert_validation_t get_status(private_x509_ocsp_response_t *this,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(ocsp_response_t, create_cert_enumerator, enumerator_t*,
|
||||||
* Implementation of ocsp_response_t.create_cert_enumerator.
|
private_x509_ocsp_response_t *this)
|
||||||
*/
|
|
||||||
static enumerator_t* create_cert_enumerator(private_x509_ocsp_response_t *this)
|
|
||||||
{
|
{
|
||||||
return this->certs->create_enumerator(this->certs);
|
return this->certs->create_enumerator(this->certs);
|
||||||
}
|
}
|
||||||
@@ -653,35 +647,26 @@ end:
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, get_type, certificate_type_t,
|
||||||
* Implementation of certificate_t.get_type
|
private_x509_ocsp_response_t *this)
|
||||||
*/
|
|
||||||
static certificate_type_t get_type(private_x509_ocsp_response_t *this)
|
|
||||||
{
|
{
|
||||||
return CERT_X509_OCSP_RESPONSE;
|
return CERT_X509_OCSP_RESPONSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, get_issuer, identification_t*,
|
||||||
* Implementation of certificate_t.get_issuer
|
private_x509_ocsp_response_t *this)
|
||||||
*/
|
|
||||||
static identification_t* get_issuer(private_x509_ocsp_response_t *this)
|
|
||||||
{
|
{
|
||||||
return this->responderId;
|
return this->responderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, has_issuer, id_match_t,
|
||||||
* Implementation of certificate_t.has_subject.
|
private_x509_ocsp_response_t *this, identification_t *issuer)
|
||||||
*/
|
|
||||||
static id_match_t has_issuer(private_x509_ocsp_response_t *this,
|
|
||||||
identification_t *issuer)
|
|
||||||
{
|
{
|
||||||
return this->responderId->matches(this->responderId, issuer);
|
return this->responderId->matches(this->responderId, issuer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, issued_by, bool,
|
||||||
* Implementation of certificate_t.issued_by
|
private_x509_ocsp_response_t *this, certificate_t *issuer)
|
||||||
*/
|
|
||||||
static bool issued_by(private_x509_ocsp_response_t *this, certificate_t *issuer)
|
|
||||||
{
|
{
|
||||||
public_key_t *key;
|
public_key_t *key;
|
||||||
signature_scheme_t scheme;
|
signature_scheme_t scheme;
|
||||||
@@ -736,19 +721,15 @@ static bool issued_by(private_x509_ocsp_response_t *this, certificate_t *issuer)
|
|||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, get_public_key, public_key_t*,
|
||||||
* Implementation of certificate_t.get_public_key
|
private_x509_ocsp_response_t *this)
|
||||||
*/
|
|
||||||
static public_key_t* get_public_key(private_x509_ocsp_response_t *this)
|
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, get_validity, bool,
|
||||||
* Implementation of certificate_t.get_validity.
|
private_x509_ocsp_response_t *this, time_t *when,
|
||||||
*/
|
time_t *not_before, time_t *not_after)
|
||||||
static bool get_validity(private_x509_ocsp_response_t *this, time_t *when,
|
|
||||||
time_t *not_before, time_t *not_after)
|
|
||||||
{
|
{
|
||||||
time_t t = when ? *when : time(NULL);
|
time_t t = when ? *when : time(NULL);
|
||||||
|
|
||||||
@@ -763,11 +744,9 @@ static bool get_validity(private_x509_ocsp_response_t *this, time_t *when,
|
|||||||
return (t < this->usableUntil);
|
return (t < this->usableUntil);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, get_encoding, bool,
|
||||||
* Implementation of certificate_t.get_encoding.
|
private_x509_ocsp_response_t *this, cred_encoding_type_t type,
|
||||||
*/
|
chunk_t *encoding)
|
||||||
static bool get_encoding(private_x509_ocsp_response_t *this,
|
|
||||||
cred_encoding_type_t type, chunk_t *encoding)
|
|
||||||
{
|
{
|
||||||
if (type == CERT_ASN1_DER)
|
if (type == CERT_ASN1_DER)
|
||||||
{
|
{
|
||||||
@@ -778,10 +757,8 @@ static bool get_encoding(private_x509_ocsp_response_t *this,
|
|||||||
CRED_PART_X509_OCSP_RES_ASN1_DER, this->encoding, CRED_PART_END);
|
CRED_PART_X509_OCSP_RES_ASN1_DER, this->encoding, CRED_PART_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, equals, bool,
|
||||||
* Implementation of certificate_t.equals.
|
private_x509_ocsp_response_t *this, certificate_t *other)
|
||||||
*/
|
|
||||||
static bool equals(private_x509_ocsp_response_t *this, certificate_t *other)
|
|
||||||
{
|
{
|
||||||
chunk_t encoding;
|
chunk_t encoding;
|
||||||
bool equal;
|
bool equal;
|
||||||
@@ -807,19 +784,15 @@ static bool equals(private_x509_ocsp_response_t *this, certificate_t *other)
|
|||||||
return equal;
|
return equal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, get_ref, certificate_t*,
|
||||||
* Implementation of certificate_t.get_ref
|
private_x509_ocsp_response_t *this)
|
||||||
*/
|
|
||||||
static private_x509_ocsp_response_t* get_ref(private_x509_ocsp_response_t *this)
|
|
||||||
{
|
{
|
||||||
ref_get(&this->ref);
|
ref_get(&this->ref);
|
||||||
return this;
|
return &this->public.interface.certificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(certificate_t, destroy, void,
|
||||||
* Implements ocsp_t.destroy.
|
private_x509_ocsp_response_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_x509_ocsp_response_t *this)
|
|
||||||
{
|
{
|
||||||
if (ref_put(&this->ref))
|
if (ref_put(&this->ref))
|
||||||
{
|
{
|
||||||
@@ -838,34 +811,35 @@ static x509_ocsp_response_t *load(chunk_t blob)
|
|||||||
{
|
{
|
||||||
private_x509_ocsp_response_t *this;
|
private_x509_ocsp_response_t *this;
|
||||||
|
|
||||||
this = malloc_thing(private_x509_ocsp_response_t);
|
INIT(this,
|
||||||
|
.public = {
|
||||||
this->public.interface.certificate.get_type = (certificate_type_t (*)(certificate_t *this))get_type;
|
.interface = {
|
||||||
this->public.interface.certificate.get_subject = (identification_t* (*)(certificate_t *this))get_issuer;
|
.certificate = {
|
||||||
this->public.interface.certificate.get_issuer = (identification_t* (*)(certificate_t *this))get_issuer;
|
.get_type = _get_type,
|
||||||
this->public.interface.certificate.has_subject = (id_match_t(*)(certificate_t*, identification_t *subject))has_issuer;
|
.get_subject = _get_issuer,
|
||||||
this->public.interface.certificate.has_issuer = (id_match_t(*)(certificate_t*, identification_t *issuer))has_issuer;
|
.get_issuer = _get_issuer,
|
||||||
this->public.interface.certificate.issued_by = (bool (*)(certificate_t *this, certificate_t *issuer))issued_by;
|
.has_subject = _has_issuer,
|
||||||
this->public.interface.certificate.get_public_key = (public_key_t* (*)(certificate_t *this))get_public_key;
|
.has_issuer = _has_issuer,
|
||||||
this->public.interface.certificate.get_validity = (bool(*)(certificate_t*, time_t *when, time_t *, time_t*))get_validity;
|
.issued_by = _issued_by,
|
||||||
this->public.interface.certificate.get_encoding = (bool(*)(certificate_t*,cred_encoding_type_t,chunk_t*))get_encoding;
|
.get_public_key = _get_public_key,
|
||||||
this->public.interface.certificate.equals = (bool(*)(certificate_t*, certificate_t *other))equals;
|
.get_validity = _get_validity,
|
||||||
this->public.interface.certificate.get_ref = (certificate_t* (*)(certificate_t *this))get_ref;
|
.get_encoding = _get_encoding,
|
||||||
this->public.interface.certificate.destroy = (void (*)(certificate_t *this))destroy;
|
.equals = _equals,
|
||||||
this->public.interface.get_status = (cert_validation_t(*)(ocsp_response_t*, x509_t *subject, x509_t *issuer, time_t *revocation_time,crl_reason_t *revocation_reason,time_t *this_update, time_t *next_update))get_status;
|
.get_ref = _get_ref,
|
||||||
this->public.interface.create_cert_enumerator = (enumerator_t*(*)(ocsp_response_t*))create_cert_enumerator;
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
this->ref = 1;
|
.get_status = _get_status,
|
||||||
this->encoding = chunk_clone(blob);
|
.create_cert_enumerator = _create_cert_enumerator,
|
||||||
this->tbsResponseData = chunk_empty;
|
},
|
||||||
this->responderId = NULL;
|
},
|
||||||
this->producedAt = UNDEFINED_TIME;
|
.ref = 1,
|
||||||
this->usableUntil = UNDEFINED_TIME;
|
.encoding = chunk_clone(blob),
|
||||||
this->responses = linked_list_create();
|
.producedAt = UNDEFINED_TIME,
|
||||||
this->nonce = chunk_empty;
|
.usableUntil = UNDEFINED_TIME,
|
||||||
this->signatureAlgorithm = OID_UNKNOWN;
|
.responses = linked_list_create(),
|
||||||
this->signature = chunk_empty;
|
.signatureAlgorithm = OID_UNKNOWN,
|
||||||
this->certs = linked_list_create();
|
.certs = linked_list_create(),
|
||||||
|
);
|
||||||
|
|
||||||
if (!parse_OCSPResponse(this))
|
if (!parse_OCSPResponse(this))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user