From 604f6eff31a3837abd3d96a2a41a3b269df757c4 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 15 Aug 2016 12:41:25 +0100 Subject: [PATCH] Convert X509_REVOKED* functions to use const getters Reviewed-by: Richard Levitte Reviewed-by: Stephen Henson --- crypto/asn1/f_int.c | 2 +- crypto/x509/x509cset.c | 6 +++--- doc/crypto/X509V3_get_d2i.pod | 2 +- doc/crypto/X509_CRL_get0_by_serial.pod | 4 ++-- include/openssl/asn1.h | 2 +- include/openssl/x509.h | 7 ++++--- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/crypto/asn1/f_int.c b/crypto/asn1/f_int.c index f1ed6bbe65..c2034809da 100644 --- a/crypto/asn1/f_int.c +++ b/crypto/asn1/f_int.c @@ -13,7 +13,7 @@ #include #include -int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a) +int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a) { int i, n = 0; static const char *h = "0123456789ABCDEF"; diff --git a/crypto/x509/x509cset.c b/crypto/x509/x509cset.c index e33caf729a..fedb2c58e6 100644 --- a/crypto/x509/x509cset.c +++ b/crypto/x509/x509cset.c @@ -139,7 +139,7 @@ int X509_CRL_get_signature_nid(const X509_CRL *crl) return OBJ_obj2nid(crl->sig_alg.algorithm); } -ASN1_TIME *X509_REVOKED_get0_revocationDate(X509_REVOKED *x) +const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x) { return x->revocationDate; } @@ -161,7 +161,7 @@ int X509_REVOKED_set_revocationDate(X509_REVOKED *x, ASN1_TIME *tm) return (in != NULL); } -ASN1_INTEGER *X509_REVOKED_get0_serialNumber(X509_REVOKED *x) +const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x) { return &x->serialNumber; } @@ -178,7 +178,7 @@ int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial) return 1; } -STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(const X509_REVOKED *r) +const STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(const X509_REVOKED *r) { return r->extensions; } diff --git a/doc/crypto/X509V3_get_d2i.pod b/doc/crypto/X509V3_get_d2i.pod index 9375a8edb5..ac560b21e9 100644 --- a/doc/crypto/X509V3_get_d2i.pod +++ b/doc/crypto/X509V3_get_d2i.pod @@ -34,7 +34,7 @@ X509_REVOKED_add1_ext_i2d - X509 extension decode and encode functions const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); - STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(const X509_REVOKED *r); + const STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(const X509_REVOKED *r); =head1 DESCRIPTION diff --git a/doc/crypto/X509_CRL_get0_by_serial.pod b/doc/crypto/X509_CRL_get0_by_serial.pod index add849038d..d9d4360fe0 100644 --- a/doc/crypto/X509_CRL_get0_by_serial.pod +++ b/doc/crypto/X509_CRL_get0_by_serial.pod @@ -18,8 +18,8 @@ functions STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); - ASN1_INTEGER *X509_REVOKED_get0_serialNumber(X509_REVOKED *r); - ASN1_TIME *X509_REVOKED_get0_revocationDate(X509_REVOKED *r); + const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *r); + const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *r); int X509_REVOKED_set_serialNumber(X509_REVOKED *r, ASN1_INTEGER *serial); int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h index d37a3fc793..afd3b1c587 100644 --- a/include/openssl/asn1.h +++ b/include/openssl/asn1.h @@ -629,7 +629,7 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE **out); int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); -int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); +int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); diff --git a/include/openssl/x509.h b/include/openssl/x509.h index 1a63ba571b..48de4de209 100644 --- a/include/openssl/x509.h +++ b/include/openssl/x509.h @@ -697,11 +697,12 @@ void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, int X509_CRL_get_signature_nid(const X509_CRL *crl); int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); -ASN1_INTEGER *X509_REVOKED_get0_serialNumber(X509_REVOKED *x); +const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); -ASN1_TIME *X509_REVOKED_get0_revocationDate(X509_REVOKED *x); +const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); -STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(const X509_REVOKED *r); +const STACK_OF(X509_EXTENSION) * +X509_REVOKED_get0_extensions(const X509_REVOKED *r); X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); -- GitLab