Latest update - pre9
This commit is contained in:
@@ -329,10 +329,7 @@ static int get_cert_by_subject(X509_LOOKUP *xl, X509_LOOKUP_TYPE type,
|
||||
*/
|
||||
CRYPTO_THREAD_write_lock(ctx->lock);
|
||||
j = sk_X509_OBJECT_find(xl->store_ctx->objs, &stmp);
|
||||
if (j != -1)
|
||||
tmp = sk_X509_OBJECT_value(xl->store_ctx->objs, j);
|
||||
else
|
||||
tmp = NULL;
|
||||
tmp = sk_X509_OBJECT_value(xl->store_ctx->objs, j);
|
||||
CRYPTO_THREAD_unlock(ctx->lock);
|
||||
|
||||
/* If a CRL, update the last file suffix added for this */
|
||||
@@ -343,11 +340,10 @@ static int get_cert_by_subject(X509_LOOKUP *xl, X509_LOOKUP_TYPE type,
|
||||
* Look for entry again in case another thread added an entry
|
||||
* first.
|
||||
*/
|
||||
if (!hent) {
|
||||
if (hent == NULL) {
|
||||
htmp.hash = h;
|
||||
idx = sk_BY_DIR_HASH_find(ent->hashes, &htmp);
|
||||
if (idx >= 0)
|
||||
hent = sk_BY_DIR_HASH_value(ent->hashes, idx);
|
||||
hent = sk_BY_DIR_HASH_value(ent->hashes, idx);
|
||||
}
|
||||
if (hent == NULL) {
|
||||
hent = OPENSSL_malloc(sizeof(*hent));
|
||||
|
||||
@@ -619,17 +619,18 @@ STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *ctx, X509_NAME *nm)
|
||||
X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
|
||||
X509_OBJECT *x)
|
||||
{
|
||||
int idx, i;
|
||||
int idx, i, num;
|
||||
X509_OBJECT *obj;
|
||||
|
||||
idx = sk_X509_OBJECT_find(h, x);
|
||||
if (idx == -1)
|
||||
if (idx < 0)
|
||||
return NULL;
|
||||
if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
|
||||
return sk_X509_OBJECT_value(h, idx);
|
||||
for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
|
||||
for (i = idx, num = sk_X509_OBJECT_num(h); i < num; i++) {
|
||||
obj = sk_X509_OBJECT_value(h, i);
|
||||
if (x509_object_cmp
|
||||
((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))
|
||||
if (x509_object_cmp((const X509_OBJECT **)&obj,
|
||||
(const X509_OBJECT **)&x))
|
||||
return NULL;
|
||||
if (x->type == X509_LU_X509) {
|
||||
if (!X509_cmp(obj->data.x509, x->data.x509))
|
||||
|
||||
@@ -98,13 +98,14 @@ int X509_TRUST_get_by_id(int id)
|
||||
{
|
||||
X509_TRUST tmp;
|
||||
int idx;
|
||||
|
||||
if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
|
||||
return id - X509_TRUST_MIN;
|
||||
tmp.trust = id;
|
||||
if (!trtable)
|
||||
if (trtable == NULL)
|
||||
return -1;
|
||||
tmp.trust = id;
|
||||
idx = sk_X509_TRUST_find(trtable, &tmp);
|
||||
if (idx == -1)
|
||||
if (idx < 0)
|
||||
return -1;
|
||||
return idx + X509_TRUST_COUNT;
|
||||
}
|
||||
|
||||
@@ -555,10 +555,9 @@ int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param)
|
||||
return 0;
|
||||
} else {
|
||||
idx = sk_X509_VERIFY_PARAM_find(param_table, param);
|
||||
if (idx != -1) {
|
||||
ptmp = sk_X509_VERIFY_PARAM_value(param_table, idx);
|
||||
if (idx >= 0) {
|
||||
ptmp = sk_X509_VERIFY_PARAM_delete(param_table, idx);
|
||||
X509_VERIFY_PARAM_free(ptmp);
|
||||
(void)sk_X509_VERIFY_PARAM_delete(param_table, idx);
|
||||
}
|
||||
}
|
||||
if (!sk_X509_VERIFY_PARAM_push(param_table, param))
|
||||
@@ -588,9 +587,9 @@ const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name)
|
||||
X509_VERIFY_PARAM pm;
|
||||
|
||||
pm.name = (char *)name;
|
||||
if (param_table) {
|
||||
if (param_table != NULL) {
|
||||
idx = sk_X509_VERIFY_PARAM_find(param_table, &pm);
|
||||
if (idx != -1)
|
||||
if (idx >= 0)
|
||||
return sk_X509_VERIFY_PARAM_value(param_table, idx);
|
||||
}
|
||||
return OBJ_bsearch_table(&pm, default_table, OSSL_NELEM(default_table));
|
||||
|
||||
@@ -26,8 +26,8 @@ int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len)
|
||||
return X509_NAME_get_text_by_OBJ(name, obj, buf, len);
|
||||
}
|
||||
|
||||
int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, char *buf,
|
||||
int len)
|
||||
int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj,
|
||||
char *buf, int len)
|
||||
{
|
||||
int i;
|
||||
const ASN1_STRING *data;
|
||||
@@ -36,9 +36,11 @@ int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, char *buf
|
||||
if (i < 0)
|
||||
return -1;
|
||||
data = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i));
|
||||
i = (data->length > (len - 1)) ? (len - 1) : data->length;
|
||||
if (buf == NULL)
|
||||
return data->length;
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
i = (data->length > (len - 1)) ? (len - 1) : data->length;
|
||||
memcpy(buf, data->data, i);
|
||||
buf[i] = '\0';
|
||||
return i;
|
||||
|
||||
+7
-3
@@ -383,8 +383,11 @@ static int def_crl_lookup(X509_CRL *crl,
|
||||
X509_NAME *issuer)
|
||||
{
|
||||
X509_REVOKED rtmp, *rev;
|
||||
int idx;
|
||||
rtmp.serialNumber = *serial;
|
||||
int idx, num;
|
||||
|
||||
if (crl->crl.revoked == NULL)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Sort revoked into serial number order if not already sorted. Do this
|
||||
* under a lock to avoid race condition.
|
||||
@@ -394,11 +397,12 @@ static int def_crl_lookup(X509_CRL *crl,
|
||||
sk_X509_REVOKED_sort(crl->crl.revoked);
|
||||
CRYPTO_THREAD_unlock(crl->lock);
|
||||
}
|
||||
rtmp.serialNumber = *serial;
|
||||
idx = sk_X509_REVOKED_find(crl->crl.revoked, &rtmp);
|
||||
if (idx < 0)
|
||||
return 0;
|
||||
/* Need to look for matching name */
|
||||
for (; idx < sk_X509_REVOKED_num(crl->crl.revoked); idx++) {
|
||||
for (num = sk_X509_REVOKED_num(crl->crl.revoked); idx < num; idx++) {
|
||||
rev = sk_X509_REVOKED_value(crl->crl.revoked, idx);
|
||||
if (ASN1_INTEGER_cmp(&rev->serialNumber, serial))
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user