Latest update.
This commit is contained in:
+12
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -135,9 +135,12 @@ unsigned long X509_subject_name_hash_old(X509 *x)
|
||||
int X509_cmp(const X509 *a, const X509 *b)
|
||||
{
|
||||
int rv;
|
||||
|
||||
/* ensure hash is valid */
|
||||
X509_check_purpose((X509 *)a, -1, 0);
|
||||
X509_check_purpose((X509 *)b, -1, 0);
|
||||
if (X509_check_purpose((X509 *)a, -1, 0) != 1)
|
||||
return -2;
|
||||
if (X509_check_purpose((X509 *)b, -1, 0) != 1)
|
||||
return -2;
|
||||
|
||||
rv = memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
|
||||
if (rv)
|
||||
@@ -181,7 +184,7 @@ int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b)
|
||||
|
||||
}
|
||||
|
||||
unsigned long X509_NAME_hash(X509_NAME *x)
|
||||
unsigned long X509_NAME_hash(const X509_NAME *x)
|
||||
{
|
||||
unsigned long ret = 0;
|
||||
unsigned char md[SHA_DIGEST_LENGTH];
|
||||
@@ -204,7 +207,7 @@ unsigned long X509_NAME_hash(X509_NAME *x)
|
||||
* this is reasonably efficient.
|
||||
*/
|
||||
|
||||
unsigned long X509_NAME_hash_old(X509_NAME *x)
|
||||
unsigned long X509_NAME_hash_old(const X509_NAME *x)
|
||||
{
|
||||
EVP_MD *md5 = EVP_MD_fetch(NULL, OSSL_DIGEST_NAME_MD5, "-fips");
|
||||
EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
|
||||
@@ -232,8 +235,8 @@ unsigned long X509_NAME_hash_old(X509_NAME *x)
|
||||
#endif
|
||||
|
||||
/* Search a stack of X509 for a match */
|
||||
X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name,
|
||||
ASN1_INTEGER *serial)
|
||||
X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, const X509_NAME *name,
|
||||
const ASN1_INTEGER *serial)
|
||||
{
|
||||
int i;
|
||||
X509 x, *x509 = NULL;
|
||||
@@ -242,7 +245,7 @@ X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name,
|
||||
return NULL;
|
||||
|
||||
x.cert_info.serialNumber = *serial;
|
||||
x.cert_info.issuer = name;
|
||||
x.cert_info.issuer = (X509_NAME *)name; /* won't modify it */
|
||||
|
||||
for (i = 0; i < sk_X509_num(sk); i++) {
|
||||
x509 = sk_X509_value(sk, i);
|
||||
@@ -252,7 +255,7 @@ X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name)
|
||||
X509 *X509_find_by_subject(STACK_OF(X509) *sk, const X509_NAME *name)
|
||||
{
|
||||
X509 *x509;
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user