x509_cmp.c (openssl-1.1.1o) | : | x509_cmp.c (openssl-1.1.1p) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. | * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. | |||
* | * | |||
* Licensed under the OpenSSL license (the "License"). You may not use | * Licensed under the OpenSSL license (the "License"). You may not use | |||
* this file except in compliance with the License. You can obtain a copy | * this file except in compliance with the License. You can obtain a copy | |||
* in the file LICENSE in the source distribution or at | * in the file LICENSE in the source distribution or at | |||
* https://www.openssl.org/source/license.html | * https://www.openssl.org/source/license.html | |||
*/ | */ | |||
#include <stdio.h> | #include <stdio.h> | |||
#include "internal/cryptlib.h" | #include "internal/cryptlib.h" | |||
#include <openssl/asn1.h> | #include <openssl/asn1.h> | |||
skipping to change at line 37 | skipping to change at line 37 | |||
return i; | return i; | |||
return X509_NAME_cmp(ai->issuer, bi->issuer); | return X509_NAME_cmp(ai->issuer, bi->issuer); | |||
} | } | |||
#ifndef OPENSSL_NO_MD5 | #ifndef OPENSSL_NO_MD5 | |||
unsigned long X509_issuer_and_serial_hash(X509 *a) | unsigned long X509_issuer_and_serial_hash(X509 *a) | |||
{ | { | |||
unsigned long ret = 0; | unsigned long ret = 0; | |||
EVP_MD_CTX *ctx = EVP_MD_CTX_new(); | EVP_MD_CTX *ctx = EVP_MD_CTX_new(); | |||
unsigned char md[16]; | unsigned char md[16]; | |||
char *f; | char *f = NULL; | |||
if (ctx == NULL) | if (ctx == NULL) | |||
goto err; | goto err; | |||
f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0); | f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0); | |||
if (f == NULL) | if (f == NULL) | |||
goto err; | goto err; | |||
if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL)) | if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL)) | |||
goto err; | goto err; | |||
if (!EVP_DigestUpdate(ctx, (unsigned char *)f, strlen(f))) | if (!EVP_DigestUpdate(ctx, (unsigned char *)f, strlen(f))) | |||
goto err; | goto err; | |||
OPENSSL_free(f); | ||||
if (!EVP_DigestUpdate | if (!EVP_DigestUpdate | |||
(ctx, (unsigned char *)a->cert_info.serialNumber.data, | (ctx, (unsigned char *)a->cert_info.serialNumber.data, | |||
(unsigned long)a->cert_info.serialNumber.length)) | (unsigned long)a->cert_info.serialNumber.length)) | |||
goto err; | goto err; | |||
if (!EVP_DigestFinal_ex(ctx, &(md[0]), NULL)) | if (!EVP_DigestFinal_ex(ctx, &(md[0]), NULL)) | |||
goto err; | goto err; | |||
ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) | | ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) | | |||
((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L) | ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L) | |||
) & 0xffffffffL; | ) & 0xffffffffL; | |||
err: | err: | |||
OPENSSL_free(f); | ||||
EVP_MD_CTX_free(ctx); | EVP_MD_CTX_free(ctx); | |||
return ret; | return ret; | |||
} | } | |||
#endif | #endif | |||
int X509_issuer_name_cmp(const X509 *a, const X509 *b) | int X509_issuer_name_cmp(const X509 *a, const X509 *b) | |||
{ | { | |||
return X509_NAME_cmp(a->cert_info.issuer, b->cert_info.issuer); | return X509_NAME_cmp(a->cert_info.issuer, b->cert_info.issuer); | |||
} | } | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |