summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2018-05-18 19:24:08 +0000
committertb <>2018-05-18 19:24:08 +0000
commit6d0ad79537e2da5fef8cb4f37397db382c5b87b4 (patch)
tree6db0f7c0ed034315d50f9d2f102d9090521328bf
parentf91d4aaae12c6f9d20b432592b82becaa8347a0c (diff)
downloadopenbsd-6d0ad79537e2da5fef8cb4f37397db382c5b87b4.tar.gz
openbsd-6d0ad79537e2da5fef8cb4f37397db382c5b87b4.tar.bz2
openbsd-6d0ad79537e2da5fef8cb4f37397db382c5b87b4.zip
Add const to both arguments of X509_check_private_key(3).
tested in a bulk build by sthen input & ok jsing
-rw-r--r--src/lib/libcrypto/x509/x509.h4
-rw-r--r--src/lib/libcrypto/x509/x509_cmp.c9
2 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h
index ec7887a928..e99e8e0238 100644
--- a/src/lib/libcrypto/x509/x509.h
+++ b/src/lib/libcrypto/x509/x509.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509.h,v 1.63 2018/05/18 19:21:33 tb Exp $ */ 1/* $OpenBSD: x509.h,v 1.64 2018/05/18 19:24:08 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1049,7 +1049,7 @@ int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
1049 1049
1050int X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey); 1050int X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey);
1051 1051
1052int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); 1052int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey);
1053 1053
1054int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); 1054int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
1055unsigned long X509_issuer_and_serial_hash(X509 *a); 1055unsigned long X509_issuer_and_serial_hash(X509 *a);
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c
index b8d1cd4680..6819c3b1f7 100644
--- a/src/lib/libcrypto/x509/x509_cmp.c
+++ b/src/lib/libcrypto/x509/x509_cmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_cmp.c,v 1.32 2018/05/13 10:36:35 tb Exp $ */ 1/* $OpenBSD: x509_cmp.c,v 1.33 2018/05/18 19:24:08 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -343,12 +343,12 @@ X509_get0_pubkey_bitstr(const X509 *x)
343} 343}
344 344
345int 345int
346X509_check_private_key(X509 *x, EVP_PKEY *k) 346X509_check_private_key(const X509 *x, const EVP_PKEY *k)
347{ 347{
348 EVP_PKEY *xk; 348 const EVP_PKEY *xk;
349 int ret; 349 int ret;
350 350
351 xk = X509_get_pubkey(x); 351 xk = X509_get0_pubkey(x);
352 352
353 if (xk) 353 if (xk)
354 ret = EVP_PKEY_cmp(xk, k); 354 ret = EVP_PKEY_cmp(xk, k);
@@ -367,7 +367,6 @@ X509_check_private_key(X509 *x, EVP_PKEY *k)
367 case -2: 367 case -2:
368 X509error(X509_R_UNKNOWN_KEY_TYPE); 368 X509error(X509_R_UNKNOWN_KEY_TYPE);
369 } 369 }
370 EVP_PKEY_free(xk);
371 if (ret > 0) 370 if (ret > 0)
372 return 1; 371 return 1;
373 return 0; 372 return 0;