Skip to content

Commit

Permalink
Delete the unnecessary ERR and ERRC lines in makefiles, add some func…
Browse files Browse the repository at this point in the history
…tionality

to error code script: it can now find untranslatable function codes (usually
because the function is static and not defined in a header: occasionally because
of a typo...) and unreferenced function and reason codes. To see this try:
perl util/mkerr.pl -recurse -debug
Also fixed some typos in crypto/pkcs12 that this found :-)
Also tidy up some error calls that had to be all on one line: the old error
script couldn't find codes unless the call was all on one line.
  • Loading branch information
snhenson committed Apr 24, 1999
1 parent ad38bed commit 6e781e8
Show file tree
Hide file tree
Showing 26 changed files with 96 additions and 69 deletions.
3 changes: 2 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
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>.
Expand Down
2 changes: 0 additions & 2 deletions crypto/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ EX_LIBS=

CFLAGS= $(INCLUDE) $(CFLAG) -DCFLAGS="\"$(CC) $(CFLAG)\"" -DPLATFORM="\"$(PLATFORM)\""

ERR=crypto
ERRC=cpt_err

LIBS=

Expand Down
2 changes: 0 additions & 2 deletions crypto/asn1/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=asn1
ERRC=asn1_err
GENERAL=Makefile README
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/bio/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=bio
ERRC=bio_err
GENERAL=Makefile
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/bn/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ BN_ASM= bn_asm.o

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=bn
ERRC=bn_err
GENERAL=Makefile
TEST=bntest.c exptest.c
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/buffer/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=buffer
ERRC=buf_err
GENERAL=Makefile
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/comp/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=comp
ERRC=comp_err
GENERAL=Makefile
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/conf/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=conf
ERRC=conf_err
GENERAL=Makefile
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/dh/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=dh
ERRC=dh_err
GENERAL=Makefile
TEST= dhtest.c
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/dsa/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=dsa
ERRC=dsa_err
GENERAL=Makefile
TEST=dsatest.c
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/evp/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=evp
ERRC=evp_err
GENERAL=Makefile
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/objects/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=objects
ERRC=obj_err
GENERAL=Makefile README
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/pem/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=pem
ERRC=pem_err
GENERAL=Makefile
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/pkcs12/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=pkcs12
ERRC=pk12err
GENERAL=Makefile
TEST=
APPS=
Expand Down
6 changes: 3 additions & 3 deletions crypto/pkcs12/p12_add.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG (PKCS8_PRIV_KEY_INFO *p8)
{
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);
Expand Down Expand Up @@ -128,12 +128,12 @@ PKCS7 *PKCS12_pack_p7data (STACK *sk)
{
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;
}

Expand Down
21 changes: 14 additions & 7 deletions crypto/pkcs12/p12_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ int PKCS12_add_friendlyname_asc (PKCS12_SAFEBAG *bag, const char *name,
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);
Expand All @@ -169,34 +170,40 @@ int PKCS12_add_friendlyname_uni (PKCS12_SAFEBAG *bag,
/* 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);
Expand Down
6 changes: 3 additions & 3 deletions crypto/pkcs12/p12_mutl.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ int PKCS12_set_mac (PKCS12 *p12, const char *pass, int passlen,
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;
Expand Down
42 changes: 36 additions & 6 deletions crypto/pkcs12/pk12err.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@
#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"},
Expand Down Expand Up @@ -122,17 +123,46 @@ static ERR_STRING_DATA PKCS12_str_reasons[]=

#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);
}
10 changes: 4 additions & 6 deletions crypto/pkcs12/pkcs12.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@ PKCS12 *d2i_PKCS12_fp();
/* 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
Expand All @@ -333,16 +333,14 @@ PKCS12 *d2i_PKCS12_fp();
#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
Expand Down
2 changes: 0 additions & 2 deletions crypto/pkcs7/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=pkcs7
ERRC=pkcs7err
GENERAL=Makefile README
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/rsa/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=rsa
ERRC=rsa_err
GENERAL=Makefile
TEST=rsa_oaep_test.c
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/x509/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=x509
ERRC=x509_err
GENERAL=Makefile README
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions crypto/x509v3/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=x509v3
ERRC=v3err
GENERAL=Makefile README
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions rsaref/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=rsaref
ERRC=rsar_err
GENERAL=Makefile
TEST=
APPS=
Expand Down
2 changes: 0 additions & 2 deletions ssl/Makefile.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ AR= ar r

CFLAGS= $(INCLUDES) $(CFLAG)

ERR=ssl
ERRC=ssl_err
GENERAL=Makefile README
TEST=ssltest.c
APPS=
Expand Down

0 comments on commit 6e781e8

Please sign in to comment.