v3_alt.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/* v3_alt.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 GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
static GENERAL_NAMES *v2i_issuer_alt(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
X509V3_EXT_METHOD v3_alt[] = {
0,0,0,0,
0,0,
0,0,0,0,
0,0,
};
{
int i;
for(i = 0; i < sk_GENERAL_NAME_num(gens); i++) {
}
if(!ret) return sk_CONF_VALUE_new_null();
return ret;
}
{
unsigned char *p;
char oline[256];
{
case GEN_OTHERNAME:
break;
case GEN_X400:
break;
case GEN_EDIPARTY:
break;
case GEN_EMAIL:
break;
case GEN_DNS:
break;
case GEN_URI:
break;
case GEN_DIRNAME:
break;
case GEN_IPADD:
/* BUG: doesn't support IPV6 */
break;
}
"%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
break;
case GEN_RID:
break;
}
return ret;
}
{
unsigned char *p;
{
case GEN_OTHERNAME:
break;
case GEN_X400:
break;
case GEN_EDIPARTY:
/* Maybe fix this: it is supported now */
break;
case GEN_EMAIL:
break;
case GEN_DNS:
break;
case GEN_URI:
break;
case GEN_DIRNAME:
break;
case GEN_IPADD:
/* BUG: doesn't support IPV6 */
break;
}
break;
case GEN_RID:
break;
}
return 1;
}
{
int i;
if(!(gens = sk_GENERAL_NAME_new_null())) {
return NULL;
}
for(i = 0; i < sk_CONF_VALUE_num(nval); i++) {
} else {
goto err;
}
}
return gens;
err:
return NULL;
}
/* Append subject altname of issuer to issuer alt name of subject */
{
int i;
goto err;
}
if(i < 0) return 1;
goto err;
}
for(i = 0; i < sk_GENERAL_NAME_num(ialt); i++) {
goto err;
}
}
return 1;
err:
return 0;
}
{
int i;
if(!(gens = sk_GENERAL_NAME_new_null())) {
return NULL;
}
for(i = 0; i < sk_CONF_VALUE_num(nval); i++) {
} else {
goto err;
}
}
return gens;
err:
return NULL;
}
/* Copy any email addresses in a certificate or request to
* GENERAL_NAMES
*/
{
int i;
goto err;
}
/* Find the subject name */
/* Now add any email address(es) to STACK */
i = -1;
while((i = X509_NAME_get_index_by_NID(nm,
NID_pkcs9_emailAddress, i)) >= 0) {
if (move_p)
{
X509_NAME_delete_entry(nm, i);
i--;
}
goto err;
}
goto err;
}
}
return 1;
err:
return 0;
}
{
int i;
if(!(gens = sk_GENERAL_NAME_new_null())) {
return NULL;
}
for(i = 0; i < sk_CONF_VALUE_num(nval); i++) {
}
return gens;
err:
return NULL;
}
#if defined(_BOOT)
/* The reason I have implemented this instead of using sscanf is because
* Visual C 1.52c gives an unresolved external when linking a DLL :-( */
{
unsigned int tmp[4];
for (;;)
{
c= *(str++);
if ((c >= '0') && (c <= '9'))
{
ok=1;
}
else if (c == '.')
{
if (!ok) return(-1);
if (num == 3) return(0);
num++;
ok=0;
}
break;
else
return(0);
}
return(1);
}
#endif /* _BOOT */
{
char is_string = 0;
int type;
if(!value) {
return NULL;
}
if(!(gen = GENERAL_NAME_new())) {
return NULL;
}
is_string = 1;
is_string = 1;
is_string = 1;
goto err;
}
unsigned char ip[4];
#if defined(_BOOT)
#else /* _BOOT */
#endif /* _BOOT */
goto err;
}
goto err;
}
} else {
goto err;
}
if(is_string) {
goto err;
}
}
return gen;
err:
return NULL;
}