aren't needed for error creation any more) and do a better job of
translating function codes into names. The old 'ASN1 error code imbedded
in a comment' is no longer necessary and it doesn't use .err files which
- have now been deleted.
+ have now been deleted. Also the error code call doesn't have to appear all
+ on one line (which resulted in some large lines...).
[Steve Henson]
*) Change #include filenames from <foo.h> to <openssl/foo.h>.
CFLAGS= $(INCLUDE) $(CFLAG) -DCFLAGS="\"$(CC) $(CFLAG)\"" -DPLATFORM="\"$(PLATFORM)\""
-ERR=crypto
-ERRC=cpt_err
LIBS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=asn1
-ERRC=asn1_err
GENERAL=Makefile README
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=bio
-ERRC=bio_err
GENERAL=Makefile
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=bn
-ERRC=bn_err
GENERAL=Makefile
TEST=bntest.c exptest.c
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=buffer
-ERRC=buf_err
GENERAL=Makefile
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=comp
-ERRC=comp_err
GENERAL=Makefile
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=conf
-ERRC=conf_err
GENERAL=Makefile
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=dh
-ERRC=dh_err
GENERAL=Makefile
TEST= dhtest.c
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=dsa
-ERRC=dsa_err
GENERAL=Makefile
TEST=dsatest.c
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=evp
-ERRC=evp_err
GENERAL=Makefile
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=objects
-ERRC=obj_err
GENERAL=Makefile README
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=pem
-ERRC=pem_err
GENERAL=Makefile
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=pkcs12
-ERRC=pk12err
GENERAL=Makefile
TEST=
APPS=
{
PKCS12_SAFEBAG *bag;
if (!(bag = PKCS12_SAFEBAG_new())) {
- PKCS12err(PKCS12_F_PKCS12_MAKE_SAFEBAG, ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_MAKE_KEYBAG,ERR_R_MALLOC_FAILURE);
return NULL;
}
bag->type = OBJ_nid2obj(NID_keyBag);
{
PKCS7 *p7;
if (!(p7 = PKCS7_new())) {
- PKCS12err(PKCS12_F_PKCS12_PACK_P7_DATA, ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_PACK_P7DATA, ERR_R_MALLOC_FAILURE);
return NULL;
}
p7->type = OBJ_nid2obj(NID_pkcs7_data);
if (!(p7->d.data = ASN1_OCTET_STRING_new())) {
- PKCS12err(PKCS12_F_PKCS12_PACK_P7_DATA, ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_PACK_P7DATA, ERR_R_MALLOC_FAILURE);
return NULL;
}
unsigned char *uniname;
int ret, unilen;
if (!asc2uni(name, &uniname, &unilen)) {
- PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_ASC,ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC,
+ ERR_R_MALLOC_FAILURE);
return 0;
}
ret = PKCS12_add_friendlyname_uni (bag, uniname, unilen);
/* Zap ending double null if included */
if(!name[namelen - 1] && !name[namelen - 2]) namelen -= 2;
if (!(fname = ASN1_TYPE_new ())) {
- PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI,ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI,
+ ERR_R_MALLOC_FAILURE);
return 0;
}
fname->type = V_ASN1_BMPSTRING;
if (!(bmp = ASN1_BMPSTRING_new())) {
- PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI,ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI,
+ ERR_R_MALLOC_FAILURE);
return 0;
}
if (!(bmp->data = Malloc (namelen))) {
- PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI,ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI,
+ ERR_R_MALLOC_FAILURE);
return 0;
}
memcpy (bmp->data, name, namelen);
bmp->length = namelen;
fname->value.bmpstring = bmp;
if (!(attrib = X509_ATTRIBUTE_new ())) {
- PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI,ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI,
+ ERR_R_MALLOC_FAILURE);
return 0;
}
attrib->object = OBJ_nid2obj(NID_friendlyName);
if (!(attrib->value.set = sk_new(NULL))) {
- PKCS12err(PKCS12_F_ADD_FRIENDLYNAME,ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME,
+ ERR_R_MALLOC_FAILURE);
return 0;
}
sk_push (attrib->value.set, (char *)fname);
attrib->set = 1;
if (!bag->attrib && !(bag->attrib = sk_new (NULL))) {
- PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI, ERR_R_MALLOC_FAILURE);
+ PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI,
+ ERR_R_MALLOC_FAILURE);
return 0;
}
sk_push (bag->attrib, (char *)attrib);
if (!md_type) md_type = EVP_sha1();
if (PKCS12_setup_mac (p12, iter, salt, saltlen, md_type) ==
PKCS12_ERROR) {
- PKCS12err(PKCS12_F_PKCS12_SET_MAC, PKCS12_R_MAC_SETUP_ERROR);
+ PKCS12err(PKCS12_F_PKCS12_SET_MAC,PKCS12_R_MAC_SETUP_ERROR);
return 0;
}
if (!PKCS12_gen_mac (p12, pass, passlen, mac, &maclen)) {
- PKCS12err(PKCS12_F_PKCS12_SET_MAC, PKCS12_R_MAC_GENERATION_ERROR);
+ PKCS12err(PKCS12_F_PKCS12_SET_MAC,PKCS12_R_MAC_GENERATION_ERROR);
return 0;
}
if (!(ASN1_OCTET_STRING_set (p12->mac->dinfo->digest, mac, maclen))) {
- PKCS12err(PKCS12_F_PKCS12_PKCS12_SET_MAC,PKCS12_R_MAC_STRING_SET_ERROR);
+ PKCS12err(PKCS12_F_PKCS12_SET_MAC,PKCS12_R_MAC_STRING_SET_ERROR);
return 0;
}
return 1;
#ifndef NO_ERR
static ERR_STRING_DATA PKCS12_str_functs[]=
{
-{ERR_PACK(0,PKCS12_F_ADD_FRIENDLYNAME,0), "ADD_FRIENDLYNAME"},
-{ERR_PACK(0,PKCS12_F_ADD_FRIENDLYNAME_ASC,0), "ADD_FRIENDLYNAME_ASC"},
-{ERR_PACK(0,PKCS12_F_ADD_FRIENDLYNAME_UNI,0), "ADD_FRIENDLYNAME_UNI"},
{ERR_PACK(0,PKCS12_F_PARSE_BAGS,0), "PARSE_BAGS"},
+{ERR_PACK(0,PKCS12_F_PKCS12_ADD_FRIENDLYNAME,0), "PKCS12_ADD_FRIENDLYNAME"},
+{ERR_PACK(0,PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC,0), "PKCS12_add_friendlyname_asc"},
+{ERR_PACK(0,PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI,0), "PKCS12_add_friendlyname_uni"},
{ERR_PACK(0,PKCS12_F_PKCS12_ADD_LOCALKEYID,0), "PKCS12_add_localkeyid"},
{ERR_PACK(0,PKCS12_F_PKCS12_CREATE,0), "PKCS12_create"},
{ERR_PACK(0,PKCS12_F_PKCS12_DECRYPT_D2I,0), "PKCS12_decrypt_d2i"},
+{ERR_PACK(0,PKCS12_F_PKCS12_FRIENDLYNAME_ASC,0), "PKCS12_FRIENDLYNAME_ASC"},
{ERR_PACK(0,PKCS12_F_PKCS12_GEN_MAC,0), "PKCS12_gen_mac"},
{ERR_PACK(0,PKCS12_F_PKCS12_I2D_ENCRYPT,0), "PKCS12_i2d_encrypt"},
{ERR_PACK(0,PKCS12_F_PKCS12_INIT,0), "PKCS12_init"},
#endif
-void ERR_load_PKCS12_strings(void)
+#ifdef PKCS12_LIB_NAME
+static ERR_STRING_DATA PKCS12_lib_name[]=
+ {
+{0 ,PKCS12_LIB_NAME},
+{0,NULL}
+ };
+#endif
+
+
+int PKCS12_lib_error_code=0;
+
+void ERR_load_PKCS12_strings()
{
static int init=1;
+ if (PKCS12_lib_error_code == 0)
+ PKCS12_lib_error_code=ERR_get_next_error_library();
+
if (init)
{
init=0;
#ifndef NO_ERR
- ERR_load_strings(ERR_LIB_PKCS12,PKCS12_str_functs);
- ERR_load_strings(ERR_LIB_PKCS12,PKCS12_str_reasons);
+ ERR_load_strings(PKCS12_lib_error_code,PKCS12_str_functs);
+ ERR_load_strings(PKCS12_lib_error_code,PKCS12_str_reasons);
#endif
+#ifdef PKCS12_LIB_NAME
+ PKCS12_lib_name->error = ERR_PACK(PKCS12_lib_error_code,0,0);
+ ERR_load_strings(0,PKCS12_lib_name);
+#endif;
}
}
+
+void ERR_PKCS12_error(function,reason,file,line)
+int function;
+int reason;
+char *file;
+int line;
+ {
+ if (PKCS12_lib_error_code == 0)
+ PKCS12_lib_error_code=ERR_get_next_error_library();
+ ERR_PUT_error(PKCS12_lib_error_code,function,reason,file,line);
+ }
/* Error codes for the PKCS12 functions. */
/* Function codes. */
-#define PKCS12_F_ADD_FRIENDLYNAME 100
-#define PKCS12_F_ADD_FRIENDLYNAME_ASC 101
-#define PKCS12_F_ADD_FRIENDLYNAME_UNI 102
#define PKCS12_F_PARSE_BAGS 103
+#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME 100
+#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC 127
+#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI 102
#define PKCS12_F_PKCS12_ADD_LOCALKEYID 104
#define PKCS12_F_PKCS12_CREATE 105
#define PKCS12_F_PKCS12_DECRYPT_D2I 106
#define PKCS12_F_PKCS12_INIT 109
#define PKCS12_F_PKCS12_KEY_GEN_ASC 110
#define PKCS12_F_PKCS12_KEY_GEN_UNI 111
-#define PKCS12_F_PKCS12_MAKE_SAFEBAG 112
+#define PKCS12_F_PKCS12_MAKE_KEYBAG 112
#define PKCS12_F_PKCS12_MAKE_SHKEYBAG 113
#define PKCS12_F_PKCS12_PACK_P7DATA 114
#define PKCS12_F_PKCS12_PACK_P7ENCDATA 115
-#define PKCS12_F_PKCS12_PACK_P7_DATA 116
#define PKCS12_F_PKCS12_PACK_SAFEBAG 117
#define PKCS12_F_PKCS12_PARSE 118
#define PKCS12_F_PKCS12_PBE_CRYPT 119
#define PKCS12_F_PKCS12_PBE_KEYIVGEN 120
-#define PKCS12_F_PKCS12_PKCS12_SET_MAC 121
#define PKCS12_F_PKCS12_SETUP_MAC 122
#define PKCS12_F_PKCS12_SET_MAC 123
#define PKCS12_F_PKCS8_ADD_KEYUSAGE 124
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=pkcs7
-ERRC=pkcs7err
GENERAL=Makefile README
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=rsa
-ERRC=rsa_err
GENERAL=Makefile
TEST=rsa_oaep_test.c
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=x509
-ERRC=x509_err
GENERAL=Makefile README
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=x509v3
-ERRC=v3err
GENERAL=Makefile README
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=rsaref
-ERRC=rsar_err
GENERAL=Makefile
TEST=
APPS=
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=ssl
-ERRC=ssl_err
GENERAL=Makefile README
TEST=ssltest.c
APPS=
# oddly named structure BIO_F_CTX which needs to be ignored.
# If a code doesn't exist in list compiled from headers then mark it
# with the value "X" as a place holder to give it a value later.
+# Store all function and reason codes found in %ufcodes and %urcodes
+# so all those unreferenced can be printed out.
foreach $file (@source) {
next if exists $cskip{$file};
open(IN, "<$file") || die "Can't open source file $file\n";
while(<IN>) {
- if(/(([A-Z0-9]+)_F_[A-Z0-9_]+)/) {
+ if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) {
next unless exists $csrc{$2};
next if($1 eq "BIO_F_BUFFER_CTX");
+ $ufcodes{$1} = 1;
if(!exists $fcodes{$1}) {
$fcodes{$1} = "X";
$fnew{$2}++;
}
+ $notrans{$1} = 1 unless exists $ftrans{$3};
}
if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) {
next unless exists $csrc{$2};
+ $urcodes{$1} = 1;
if(!exists $rcodes{$1}) {
$rcodes{$1} = "X";
$rnew{$2}++;
$fn = $1;
if(exists $ftrans{$fn}) {
$fn = $ftrans{$fn};
- } else {
- push @notrans, $i;
}
print OUT "{ERR_PACK(0,$i,0),\t\"$fn\"},\n";
}
}
-if($debug && defined(@notrans)) {
+if($debug && defined(%notrans)) {
print STDERR "The following function codes were not translated:\n";
- foreach(@notrans)
+ foreach(sort keys %notrans)
+ {
+ print STDERR "$_\n";
+ }
+}
+
+# Make a list of unreferenced function and reason codes
+
+foreach (keys %fcodes) {
+ push (@funref, $_) unless exists $ufcodes{$_};
+}
+
+foreach (keys %rcodes) {
+ push (@runref, $_) unless exists $urcodes{$_};
+}
+
+if($debug && defined(@funref) ) {
+ print STDERR "The following function codes were not referenced:\n";
+ foreach(sort @funref)
+ {
+ print STDERR "$_\n";
+ }
+}
+
+if($debug && defined(@runref) ) {
+ print STDERR "The following reason codes were not referenced:\n";
+ foreach(sort @runref)
{
print STDERR "$_\n";
}