Commit 8900f3e3 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Convert X509* functions to use const getters

parent 5e6089f0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -221,7 +221,7 @@ int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id,
    return 1;
}

const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(EVP_PKEY *pkey)
const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey)
{
    return pkey->ameth;
}
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@

static void EVP_PKEY_free_it(EVP_PKEY *x);

int EVP_PKEY_bits(EVP_PKEY *pkey)
int EVP_PKEY_bits(const EVP_PKEY *pkey)
{
    if (pkey && pkey->ameth && pkey->ameth->pkey_bits)
        return pkey->ameth->pkey_bits(pkey);
+3 −3
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,
    }

    if (!(cflag & X509_FLAG_NO_SIGNAME)) {
        X509_ALGOR *tsig_alg = X509_get0_tbs_sigalg(x);
        const X509_ALGOR *tsig_alg = X509_get0_tbs_sigalg(x);
        if (X509_signature_print(bp, tsig_alg, NULL) <= 0)
            goto err;
    }
@@ -170,8 +170,8 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,
    }

    if (!(cflag & X509_FLAG_NO_IDS)) {
        ASN1_BIT_STRING *iuid, *suid;
        X509_get0_uids(&iuid, &suid, x);
        const ASN1_BIT_STRING *iuid, *suid;
        X509_get0_uids(x, &iuid, &suid);
        if (iuid != NULL) {
            if (BIO_printf(bp, "%8sIssuer Unique ID: ", "") <= 0)
                goto err;
+4 −3
Original line number Diff line number Diff line
@@ -135,12 +135,13 @@ X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x)
    return x->cert_info.key;
}

STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x)
const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x)
{
    return x->cert_info.extensions;
}

void X509_get0_uids(ASN1_BIT_STRING **piuid, ASN1_BIT_STRING **psuid, X509 *x)
void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid,
                    const ASN1_BIT_STRING **psuid)
{
    if (piuid != NULL)
        *piuid = x->cert_info.issuerUID;
@@ -148,7 +149,7 @@ void X509_get0_uids(ASN1_BIT_STRING **piuid, ASN1_BIT_STRING **psuid, X509 *x)
        *psuid = x->cert_info.subjectUID;
}

X509_ALGOR *X509_get0_tbs_sigalg(X509 *x)
const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x)
{
    return &x->cert_info.signature;
}
+2 −2
Original line number Diff line number Diff line
@@ -13,9 +13,9 @@
#include <openssl/objects.h>
#include <openssl/x509.h>

int X509_certificate_type(X509 *x, EVP_PKEY *pkey)
int X509_certificate_type(X509 *x, const EVP_PKEY *pkey)
{
    EVP_PKEY *pk;
    const EVP_PKEY *pk;
    int ret = 0, i;

    if (x == NULL)
Loading