Removed chunk_from_buf() in favor of a simpler chunk_from_chars() macro
This commit is contained in:
@@ -153,30 +153,21 @@ struct private_x509_ac_t {
|
||||
refcount_t ref;
|
||||
};
|
||||
|
||||
static u_char ASN1_group_oid_str[] = {
|
||||
static chunk_t ASN1_group_oid = chunk_from_chars(
|
||||
0x06, 0x08,
|
||||
0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x0a ,0x04
|
||||
};
|
||||
|
||||
static const chunk_t ASN1_group_oid = chunk_from_buf(ASN1_group_oid_str);
|
||||
|
||||
static u_char ASN1_authorityKeyIdentifier_oid_str[] = {
|
||||
);
|
||||
static chunk_t ASN1_authorityKeyIdentifier_oid = chunk_from_chars(
|
||||
0x06, 0x03,
|
||||
0x55, 0x1d, 0x23
|
||||
};
|
||||
|
||||
static const chunk_t ASN1_authorityKeyIdentifier_oid =
|
||||
chunk_from_buf(ASN1_authorityKeyIdentifier_oid_str);
|
||||
|
||||
static u_char ASN1_noRevAvail_ext_str[] = {
|
||||
);
|
||||
static chunk_t ASN1_noRevAvail_ext = chunk_from_chars(
|
||||
0x30, 0x09,
|
||||
0x06, 0x03,
|
||||
0x55, 0x1d, 0x38,
|
||||
0x04, 0x02,
|
||||
0x05, 0x00
|
||||
};
|
||||
|
||||
static const chunk_t ASN1_noRevAvail_ext = chunk_from_buf(ASN1_noRevAvail_ext_str);
|
||||
);
|
||||
|
||||
/**
|
||||
* declaration of function implemented in x509_cert.c
|
||||
|
||||
@@ -171,10 +171,9 @@ struct private_x509_cert_t {
|
||||
refcount_t ref;
|
||||
};
|
||||
|
||||
static u_char ASN1_sAN_oid_buf[] = {
|
||||
static const chunk_t ASN1_subjectAltName_oid = chunk_from_chars(
|
||||
0x06, 0x03, 0x55, 0x1D, 0x11
|
||||
};
|
||||
static const chunk_t ASN1_subjectAltName_oid = chunk_from_buf(ASN1_sAN_oid_buf);
|
||||
);
|
||||
|
||||
/**
|
||||
* ASN.1 definition of a basicConstraints extension
|
||||
@@ -1341,16 +1340,16 @@ static bool generate(private_x509_cert_t *cert, certificate_t *sign_cert,
|
||||
|
||||
if (cert->flags & X509_CA)
|
||||
{
|
||||
chunk_t yes, keyid;
|
||||
chunk_t keyid;
|
||||
|
||||
yes = chunk_alloca(1);
|
||||
yes.ptr[0] = 0xFF;
|
||||
basicConstraints = asn1_wrap(ASN1_SEQUENCE, "mmm",
|
||||
asn1_build_known_oid(OID_BASIC_CONSTRAINTS),
|
||||
asn1_wrap(ASN1_BOOLEAN, "c", yes),
|
||||
asn1_wrap(ASN1_BOOLEAN, "c",
|
||||
chunk_from_chars(0xFF)),
|
||||
asn1_wrap(ASN1_OCTET_STRING, "m",
|
||||
asn1_wrap(ASN1_SEQUENCE, "m",
|
||||
asn1_wrap(ASN1_BOOLEAN, "c", yes))));
|
||||
asn1_wrap(ASN1_BOOLEAN, "c",
|
||||
chunk_from_chars(0xFF)))));
|
||||
/* add subjectKeyIdentifier to CA certificates */
|
||||
if (cert->public_key->get_fingerprint(cert->public_key,
|
||||
KEY_ID_PUBKEY_SHA1, &keyid))
|
||||
|
||||
@@ -81,29 +81,23 @@ struct private_x509_ocsp_request_t {
|
||||
refcount_t ref;
|
||||
};
|
||||
|
||||
static u_char ASN1_nonce_oid_str[] = {
|
||||
static const chunk_t ASN1_nonce_oid = chunk_from_chars(
|
||||
0x06, 0x09,
|
||||
0x2B, 0x06,
|
||||
0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x02
|
||||
};
|
||||
|
||||
static u_char ASN1_response_oid_str[] = {
|
||||
);
|
||||
static const chunk_t ASN1_response_oid = chunk_from_chars(
|
||||
0x06, 0x09,
|
||||
0x2B, 0x06,
|
||||
0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x04
|
||||
};
|
||||
|
||||
static u_char ASN1_response_content_str[] = {
|
||||
);
|
||||
static const chunk_t ASN1_response_content = chunk_from_chars(
|
||||
0x04, 0x0D,
|
||||
0x30, 0x0B,
|
||||
0x06, 0x09,
|
||||
0x2B, 0x06,
|
||||
0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x01
|
||||
};
|
||||
|
||||
static const chunk_t ASN1_nonce_oid = chunk_from_buf(ASN1_nonce_oid_str);
|
||||
static const chunk_t ASN1_response_oid = chunk_from_buf(ASN1_response_oid_str);
|
||||
static const chunk_t ASN1_response_content = chunk_from_buf(ASN1_response_content_str);
|
||||
);
|
||||
|
||||
/**
|
||||
* build requestorName
|
||||
|
||||
@@ -130,29 +130,23 @@ typedef struct {
|
||||
#define OCSP_BASIC_RESPONSE_VERSION 1
|
||||
|
||||
/* some OCSP specific prefabricated ASN.1 constants */
|
||||
static u_char ASN1_nonce_oid_str[] = {
|
||||
static const chunk_t ASN1_nonce_oid = chunk_from_chars(
|
||||
0x06, 0x09,
|
||||
0x2B, 0x06,
|
||||
0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x02
|
||||
};
|
||||
|
||||
static u_char ASN1_response_oid_str[] = {
|
||||
);
|
||||
static const chunk_t ASN1_response_oid = chunk_from_chars(
|
||||
0x06, 0x09,
|
||||
0x2B, 0x06,
|
||||
0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x04
|
||||
};
|
||||
|
||||
static u_char ASN1_response_content_str[] = {
|
||||
);
|
||||
static const chunk_t ASN1_response_content = chunk_from_chars(
|
||||
0x04, 0x0D,
|
||||
0x30, 0x0B,
|
||||
0x06, 0x09,
|
||||
0x2B, 0x06,
|
||||
0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x01
|
||||
};
|
||||
|
||||
static const chunk_t ASN1_nonce_oid = chunk_from_buf(ASN1_nonce_oid_str);
|
||||
static const chunk_t ASN1_response_oid = chunk_from_buf(ASN1_response_oid_str);
|
||||
static const chunk_t ASN1_response_content = chunk_from_buf(ASN1_response_content_str);
|
||||
);
|
||||
|
||||
/**
|
||||
* Implementaiton of ocsp_response_t.get_status
|
||||
|
||||
Reference in New Issue
Block a user