x509_trs.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/* x509_trs.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project 1999.
*/
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <stdio.h>
#include "cryptlib.h"
static int tr_cmp(const X509_TRUST * const *a,
const X509_TRUST * const *b);
static void trtable_free(X509_TRUST *p);
/* WARNING: the following table should be kept in order of trust
* and without any gaps so we can just subtract the minimum trust
* value to get an index into the table
*/
static X509_TRUST trstandard[] = {
};
static int tr_cmp(const X509_TRUST * const *a,
const X509_TRUST * const *b)
{
}
{
return oldtrust;
}
{
X509_TRUST *pt;
int idx;
}
int X509_TRUST_get_count(void)
{
if(!trtable) return X509_TRUST_COUNT;
}
{
}
int X509_TRUST_get_by_id(int id)
{
int idx;
return id - X509_TRUST_MIN;
if(!trtable) return -1;
return idx + X509_TRUST_COUNT;
}
int X509_TRUST_set(int *t, int trust)
{
return 0;
}
*t = trust;
return 1;
}
{
int idx;
/* This is set according to what we change: application can't set it */
flags &= ~X509_TRUST_DYNAMIC;
/* This will always be set for application modified trust entries */
/* Get existing entry if any */
/* Need a new entry */
if(idx == -1) {
return 0;
}
/* OPENSSL_free existing name if dynamic */
/* dup supplied name */
return 0;
}
/* Keep the dynamic flag of existing entry */
/* Set all other flags */
/* If its a new entry manage the dynamic table */
if(idx == -1) {
return 0;
}
return 0;
}
}
return 1;
}
static void trtable_free(X509_TRUST *p)
{
if(!p) return;
if (p->flags & X509_TRUST_DYNAMIC)
{
if (p->flags & X509_TRUST_DYNAMIC_NAME)
OPENSSL_free(p->name);
OPENSSL_free(p);
}
}
void X509_TRUST_cleanup(void)
{
int i;
}
{
}
{
}
{
}
{
/* we don't have any trust settings: for compatibility
* we return trusted if it is self signed
*/
}
{
return X509_TRUST_UNTRUSTED;
}
{
X509_check_purpose(x, -1, 0);
else return X509_TRUST_UNTRUSTED;
}
{
int i;
if(!ax) return X509_TRUST_UNTRUSTED;
}
}
}
}
return X509_TRUST_UNTRUSTED;
}