return X509_add_cert(*p_sk, cert, flags);
}
-int X509_add_cert(STACK_OF(X509) *sk, X509 *cert, int flags)
+int X509_add_cert(STACK_OF(X509) *sk, const X509 *cert, int flags)
{
if (sk == NULL) {
ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER);
if (ret != 0)
return ret > 0 ? 1 : 0;
}
- if ((flags & X509_ADD_FLAG_UP_REF) != 0 && !X509_up_ref(cert))
+ /*
+ * Note: We're technically mutating the cert here, but its just to up
+ * the reference count, so that should be safe, so cast away
+ */
+ if ((flags & X509_ADD_FLAG_UP_REF) != 0 && !X509_up_ref((X509 *)cert))
return 0;
- if (!sk_X509_insert(sk, cert,
+ if (!sk_X509_insert(sk, (X509 *)cert,
(flags & X509_ADD_FLAG_PREPEND) != 0 ? 0 : -1)) {
if ((flags & X509_ADD_FLAG_UP_REF) != 0)
- X509_free(cert);
+ X509_free((X509 *)cert);
ERR_raise(ERR_LIB_X509, ERR_R_CRYPTO_LIB);
return 0;
}
* to match issuer and subject names (i.e., the cert being self-issued) and any
* present authority key identifier to match the subject key identifier, etc.
*/
-int X509_self_signed(X509 *cert, int verify_signature)
+int X509_self_signed(const X509 *cert, int verify_signature)
{
EVP_PKEY *pkey;
ERR_raise(ERR_LIB_X509, X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY);
return -1;
}
- if (!ossl_x509v3_cache_extensions(cert))
+ if (!ossl_x509v3_cache_extensions((X509 *)cert))
return -1;
if ((cert->ex_flags & EXFLAG_SS) == 0)
return 0;
#include <openssl/x509.h>
- int X509_add_cert(STACK_OF(X509) *sk, X509 *cert, int flags);
+ int X509_add_cert(STACK_OF(X509) *sk, const X509 *cert, int flags);
int X509_add_certs(STACK_OF(X509) *sk, const STACK_OF(X509) *certs, int flags);
=head1 DESCRIPTION
The functions X509_add_cert() and X509_add_certs()
were added in OpenSSL 3.0.
+X509_add_cert() had its cert parameter converted to be I<const> in OpenSSL 4.0.
+
=head1 COPYRIGHT
Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved.
#include <openssl/x509.h>
int X509_verify(X509 *x, EVP_PKEY *pkey);
- int X509_self_signed(X509 *cert, int verify_signature);
+ int X509_self_signed(const X509 *cert, int verify_signature);
int X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
const char *propq);
X509_ACERT_verify() was added in OpenSSL 3.4.
+X509_self_signed() had its cert parameter modified to be I<const> in OpenSSL 4.0.
+
=head1 COPYRIGHT
Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved.
const char *X509_verify_cert_error_string(long n);
int X509_verify(const X509 *a, EVP_PKEY *r);
-int X509_self_signed(X509 *cert, int verify_signature);
+int X509_self_signed(const X509 *cert, int verify_signature);
int X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *r, OSSL_LIB_CTX *libctx,
const char *propq);
#define X509_ADD_FLAG_PREPEND 0x2
#define X509_ADD_FLAG_NO_DUP 0x4
#define X509_ADD_FLAG_NO_SS 0x8
-int X509_add_cert(STACK_OF(X509) *sk, X509 *cert, int flags);
+int X509_add_cert(STACK_OF(X509) *sk, const X509 *cert, int flags);
int X509_add_certs(STACK_OF(X509) *sk, const STACK_OF(X509) *certs, int flags);
int X509_cmp(const X509 *a, const X509 *b);