diff options
author | Ben Laurie <ben@openssl.org> | 2002-01-18 16:51:05 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2002-01-18 16:51:05 +0000 |
commit | 9dd5ae65533ec43e66efe66e1bbcddce4cb05509 (patch) | |
tree | 7150828e2bcb1ac5c92435ddc3dee259facd72e7 /crypto | |
parent | e1e876072d813ac55a4a0b2c17ff55a0b27d1689 (diff) |
Constification, add config to /dev/crypto.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/aes/Makefile.ssl | 14 | ||||
-rw-r--r-- | crypto/asn1/Makefile.ssl | 15 | ||||
-rw-r--r-- | crypto/asn1/asn_moid.c | 2 | ||||
-rw-r--r-- | crypto/conf/conf.h | 41 | ||||
-rw-r--r-- | crypto/conf/conf_api.c | 17 | ||||
-rw-r--r-- | crypto/conf/conf_api.h | 12 | ||||
-rw-r--r-- | crypto/conf/conf_def.c | 12 | ||||
-rw-r--r-- | crypto/conf/conf_lib.c | 18 | ||||
-rw-r--r-- | crypto/conf/conf_mod.c | 36 | ||||
-rw-r--r-- | crypto/engine/Makefile.ssl | 1 | ||||
-rw-r--r-- | crypto/engine/hw_openbsd_dev_crypto.c | 16 | ||||
-rw-r--r-- | crypto/evp/digest.c | 2 | ||||
-rw-r--r-- | crypto/evp/evp_test.c | 2 |
13 files changed, 120 insertions, 68 deletions
diff --git a/crypto/aes/Makefile.ssl b/crypto/aes/Makefile.ssl index eb72cce71f..ea7dad5734 100644 --- a/crypto/aes/Makefile.ssl +++ b/crypto/aes/Makefile.ssl @@ -85,8 +85,12 @@ clean: # DO NOT DELETE THIS LINE -- make depend depends on it. -aes_cbc.o: ../../include/openssl/aes.h aes_cbc.c aes_locl.h -aes_core.o: ../../include/openssl/aes.h aes_core.c aes_locl.h -aes_ecb.o: ../../include/openssl/aes.h aes_ecb.c aes_locl.h -aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/opensslv.h -aes_misc.o: aes_locl.h aes_misc.c +aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h +aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c aes_locl.h +aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h +aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h +aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h +aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h +aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h +aes_misc.o: ../../include/openssl/opensslconf.h +aes_misc.o: ../../include/openssl/opensslv.h aes_locl.h aes_misc.c diff --git a/crypto/asn1/Makefile.ssl b/crypto/asn1/Makefile.ssl index 27c422c51e..09d4cb4896 100644 --- a/crypto/asn1/Makefile.ssl +++ b/crypto/asn1/Makefile.ssl @@ -363,6 +363,21 @@ asn1_par.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c +asn_moid.o: ../../e_os.h ../../include/openssl/asn1.h +asn_moid.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +asn_moid.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h +asn_moid.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h +asn_moid.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h +asn_moid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h +asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h +asn_moid.o: ../../include/openssl/opensslconf.h +asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h +asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h +asn_moid.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +asn_moid.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +asn_moid.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +asn_moid.o: ../cryptlib.h asn_moid.c asn_pack.o: ../../e_os.h ../../include/openssl/asn1.h asn_pack.o: ../../include/openssl/bio.h ../../include/openssl/bn.h asn_pack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h diff --git a/crypto/asn1/asn_moid.c b/crypto/asn1/asn_moid.c index e27b7affc2..b033787988 100644 --- a/crypto/asn1/asn_moid.c +++ b/crypto/asn1/asn_moid.c @@ -66,7 +66,7 @@ /* Simple ASN1 OID module: add all objects in a given section */ /* NOTE: doesn't do anything other than print debug messages yet... */ -static int oid_module_init(CONF_IMODULE *md, CONF *cnf) +static int oid_module_init(CONF_IMODULE *md, const CONF *cnf) { fprintf(stderr, "Called oid_module_init: name %s, value %s\n", CONF_imodule_get_name(md), CONF_imodule_get_value(md)); diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h index 41816d92f6..df84fa4de4 100644 --- a/crypto/conf/conf.h +++ b/crypto/conf/conf.h @@ -93,9 +93,9 @@ struct conf_method_st int (*destroy)(CONF *conf); int (*destroy_data)(CONF *conf); int (*load_bio)(CONF *conf, BIO *bp, long *eline); - int (*dump)(CONF *conf, BIO *bp); - int (*is_number)(CONF *conf, char c); - int (*to_int)(CONF *conf, char c); + int (*dump)(const CONF *conf, BIO *bp); + int (*is_number)(const CONF *conf, char c); + int (*to_int)(const CONF *conf, char c); int (*load)(CONF *conf, const char *name, long *eline); }; @@ -105,7 +105,7 @@ typedef struct conf_imodule_st CONF_IMODULE; typedef struct conf_module_st CONF_MODULE; /* DSO module function typedefs */ -typedef int conf_init_func(CONF_IMODULE *md, CONF *cnf); +typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); typedef void conf_finish_func(CONF_IMODULE *md); #define CONF_MFLAGS_IGNORE_ERRORS 0x1 @@ -120,9 +120,9 @@ LHASH *CONF_load(LHASH *conf,const char *file,long *eline); LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); #endif LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); -STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section); -char *CONF_get_string(LHASH *conf,char *group,char *name); -long CONF_get_number(LHASH *conf,char *group,char *name); +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section); +char *CONF_get_string(LHASH *conf,const char *group,const char *name); +long CONF_get_number(LHASH *conf,const char *group,const char *name); void CONF_free(LHASH *conf); int CONF_dump_fp(LHASH *conf, FILE *out); int CONF_dump_bio(LHASH *conf, BIO *out); @@ -153,11 +153,12 @@ int NCONF_load(CONF *conf,const char *file,long *eline); int NCONF_load_fp(CONF *conf, FILE *fp,long *eline); #endif int NCONF_load_bio(CONF *conf, BIO *bp,long *eline); -STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section); -char *NCONF_get_string(CONF *conf,char *group,char *name); -int NCONF_get_number_e(CONF *conf,char *group,char *name,long *result); -int NCONF_dump_fp(CONF *conf, FILE *out); -int NCONF_dump_bio(CONF *conf, BIO *out); +STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section); +char *NCONF_get_string(const CONF *conf,const char *group,const char *name); +int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, + long *result); +int NCONF_dump_fp(const CONF *conf, FILE *out); +int NCONF_dump_bio(const CONF *conf, BIO *out); #if 0 /* The following function has no error checking, and should therefore be avoided */ @@ -168,19 +169,21 @@ long NCONF_get_number(CONF *conf,char *group,char *name); /* Module functions */ -int CONF_modules_load(CONF *cnf, char *appname, unsigned long flags); -int CONF_modules_load_file(char *filename, char *appname, unsigned long flags); +int CONF_modules_load(const CONF *cnf, const char *appname, + unsigned long flags); +int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags); void CONF_modules_unload(int all); void CONF_modules_finish(void); int CONF_module_add(const char *name, conf_init_func *ifunc, conf_finish_func *ffunc); -char *CONF_imodule_get_name(CONF_IMODULE *md); -char *CONF_imodule_get_value(CONF_IMODULE *md); -void *CONF_imodule_get_usr_data(CONF_IMODULE *md); +const char *CONF_imodule_get_name(const CONF_IMODULE *md); +const char *CONF_imodule_get_value(const CONF_IMODULE *md); +void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); -CONF_MODULE *CONF_imodule_get_module(CONF_IMODULE *md); -unsigned long CONF_imodule_get_flags(CONF_IMODULE *md); +CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); +unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); void *CONF_module_get_usr_data(CONF_MODULE *pmod); void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); diff --git a/crypto/conf/conf_api.c b/crypto/conf/conf_api.c index 9615df5873..0032baa711 100644 --- a/crypto/conf/conf_api.c +++ b/crypto/conf/conf_api.c @@ -81,19 +81,20 @@ static unsigned long hash(const void *v_void); static int cmp_conf(const void *a_void,const void *b_void); /* Up until OpenSSL 0.9.5a, this was get_section */ -CONF_VALUE *_CONF_get_section(CONF *conf, char *section) +CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) { CONF_VALUE *v,vv; if ((conf == NULL) || (section == NULL)) return(NULL); vv.name=NULL; - vv.section=section; + vv.section=(char *)section; v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); return(v); } /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ -STACK_OF(CONF_VALUE) *_CONF_get_section_values(CONF *conf, char *section) +STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, + const char *section) { CONF_VALUE *v; @@ -128,7 +129,7 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) return 1; } -char *_CONF_get_string(CONF *conf, char *section, char *name) +char *_CONF_get_string(const CONF *conf, const char *section, const char *name) { CONF_VALUE *v,vv; char *p; @@ -138,8 +139,8 @@ char *_CONF_get_string(CONF *conf, char *section, char *name) { if (section != NULL) { - vv.name=name; - vv.section=section; + vv.name=(char *)name; + vv.section=(char *)section; v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); if (v != NULL) return(v->value); if (strcmp(section,"ENV") == 0) @@ -149,7 +150,7 @@ char *_CONF_get_string(CONF *conf, char *section, char *name) } } vv.section="default"; - vv.name=name; + vv.name=(char *)name; v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); if (v != NULL) return(v->value); @@ -273,7 +274,7 @@ static int cmp_conf(const void *a_void,const void *b_void) } /* Up until OpenSSL 0.9.5a, this was new_section */ -CONF_VALUE *_CONF_new_section(CONF *conf, char *section) +CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) { STACK *sk=NULL; int ok=0,i; diff --git a/crypto/conf/conf_api.h b/crypto/conf/conf_api.h index a5cc17b233..87a954aff6 100644 --- a/crypto/conf/conf_api.h +++ b/crypto/conf/conf_api.h @@ -67,15 +67,17 @@ extern "C" { #endif /* Up until OpenSSL 0.9.5a, this was new_section */ -CONF_VALUE *_CONF_new_section(CONF *conf, char *section); +CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); /* Up until OpenSSL 0.9.5a, this was get_section */ -CONF_VALUE *_CONF_get_section(CONF *conf, char *section); +CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ -STACK_OF(CONF_VALUE) *_CONF_get_section_values(CONF *conf, char *section); +STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, + const char *section); int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); -char *_CONF_get_string(CONF *conf, char *section, char *name); -long _CONF_get_number(CONF *conf, char *section, char *name); +char *_CONF_get_string(const CONF *conf, const char *section, + const char *name); +long _CONF_get_number(const CONF *conf, const char *section, const char *name); int _CONF_new_data(CONF *conf); void _CONF_free_data(CONF *conf); diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c index 6d12b40652..04d128bc75 100644 --- a/crypto/conf/conf_def.c +++ b/crypto/conf/conf_def.c @@ -83,9 +83,9 @@ static int def_destroy(CONF *conf); static int def_destroy_data(CONF *conf); static int def_load(CONF *conf, const char *name, long *eline); static int def_load_bio(CONF *conf, BIO *bp, long *eline); -static int def_dump(CONF *conf, BIO *bp); -static int def_is_number(CONF *conf, char c); -static int def_to_int(CONF *conf, char c); +static int def_dump(const CONF *conf, BIO *bp); +static int def_is_number(const CONF *conf, char c); +static int def_to_int(const CONF *conf, char c); const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT; @@ -716,18 +716,18 @@ static void dump_value(CONF_VALUE *a, BIO *out) static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE *, BIO *) -static int def_dump(CONF *conf, BIO *out) +static int def_dump(const CONF *conf, BIO *out) { lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), out); return 1; } -static int def_is_number(CONF *conf, char c) +static int def_is_number(const CONF *conf, char c) { return IS_NUMBER(conf,c); } -static int def_to_int(CONF *conf, char c) +static int def_to_int(const CONF *conf, char c) { return c - '0'; } diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c index 4f0c1c6fc7..7998f34c7b 100644 --- a/crypto/conf/conf_lib.c +++ b/crypto/conf/conf_lib.c @@ -137,7 +137,7 @@ LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline) return NULL; } -STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section) { if (conf == NULL) { @@ -151,7 +151,7 @@ STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) } } -char *CONF_get_string(LHASH *conf,char *group,char *name) +char *CONF_get_string(LHASH *conf,const char *group,const char *name) { if (conf == NULL) { @@ -165,7 +165,7 @@ char *CONF_get_string(LHASH *conf,char *group,char *name) } } -long CONF_get_number(LHASH *conf,char *group,char *name) +long CONF_get_number(LHASH *conf,const char *group,const char *name) { int status; long result = 0; @@ -294,7 +294,7 @@ int NCONF_load_bio(CONF *conf, BIO *bp,long *eline) return conf->meth->load_bio(conf, bp, eline); } -STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section) +STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section) { if (conf == NULL) { @@ -311,7 +311,7 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section) return _CONF_get_section_values(conf, section); } -char *NCONF_get_string(CONF *conf,char *group,char *name) +char *NCONF_get_string(const CONF *conf,const char *group,const char *name) { char *s = _CONF_get_string(conf, group, name); @@ -327,10 +327,12 @@ char *NCONF_get_string(CONF *conf,char *group,char *name) } CONFerr(CONF_F_NCONF_GET_STRING, CONF_R_NO_VALUE); + ERR_add_error_data(4,"group=",group," name=",name); return NULL; } -int NCONF_get_number_e(CONF *conf,char *group,char *name,long *result) +int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, + long *result) { char *str; @@ -355,7 +357,7 @@ int NCONF_get_number_e(CONF *conf,char *group,char *name,long *result) } #ifndef OPENSSL_NO_FP_API -int NCONF_dump_fp(CONF *conf, FILE *out) +int NCONF_dump_fp(const CONF *conf, FILE *out) { BIO *btmp; int ret; @@ -369,7 +371,7 @@ int NCONF_dump_fp(CONF *conf, FILE *out) } #endif -int NCONF_dump_bio(CONF *conf, BIO *out) +int NCONF_dump_bio(const CONF *conf, BIO *out) { if (conf == NULL) { diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index f1950ea16d..e2e357fe6a 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -108,16 +108,20 @@ static STACK_OF(CONF_IMODULE) *initialized_modules = NULL; static void module_free(CONF_MODULE *md); static void module_finish(CONF_IMODULE *imod); -static int module_run(CONF *cnf, char *name, char *value, unsigned long flags); +static int module_run(const CONF *cnf, char *name, char *value, + unsigned long flags); static CONF_MODULE *module_add(DSO *dso, const char *name, conf_init_func *ifunc, conf_finish_func *ffunc); static CONF_MODULE *module_find(char *name); -static int module_init(CONF_MODULE *pmod, char *name, char *value, CONF *cnf); -static CONF_MODULE *module_load_dso(CONF *cnf, char *name, char *value, unsigned long flags); +static int module_init(CONF_MODULE *pmod, char *name, char *value, + const CONF *cnf); +static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, + unsigned long flags); /* Main function: load modules from a CONF structure */ -int CONF_modules_load(CONF *cnf, char *appname, unsigned long flags) +int CONF_modules_load(const CONF *cnf, const char *appname, + unsigned long flags) { STACK_OF(CONF_VALUE) *values; CONF_VALUE *vl; @@ -155,7 +159,8 @@ int CONF_modules_load(CONF *cnf, char *appname, unsigned long flags) } -int CONF_modules_load_file(char *filename, char *appname, unsigned long flags) +int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags) { CONF *conf = NULL; int ret = 0; @@ -174,7 +179,8 @@ int CONF_modules_load_file(char *filename, char *appname, unsigned long flags) return ret; } -static int module_run(CONF *cnf, char *name, char *value, unsigned long flags) +static int module_run(const CONF *cnf, char *name, char *value, + unsigned long flags) { CONF_MODULE *md; int ret; @@ -212,7 +218,8 @@ static int module_run(CONF *cnf, char *name, char *value, unsigned long flags) } /* Load a module from a DSO */ -static CONF_MODULE *module_load_dso(CONF *cnf, char *name, char *value, unsigned long flags) +static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, + unsigned long flags) { DSO *dso = NULL; conf_init_func *ifunc; @@ -263,7 +270,7 @@ static CONF_MODULE *module_load_dso(CONF *cnf, char *name, char *value, unsigned /* add module to list */ static CONF_MODULE *module_add(DSO *dso, const char *name, - conf_init_func *ifunc, conf_finish_func *ffunc) + conf_init_func *ifunc, conf_finish_func *ffunc) { CONF_MODULE *tmod = NULL; if (supported_modules == NULL) @@ -318,7 +325,8 @@ static CONF_MODULE *module_find(char *name) } /* initialize a module */ -static int module_init(CONF_MODULE *pmod, char *name, char *value, CONF *cnf) +static int module_init(CONF_MODULE *pmod, char *name, char *value, + const CONF *cnf) { int ret = 1; int init_called = 0; @@ -467,17 +475,17 @@ void CONF_modules_free(void) /* Utility functions */ -char *CONF_imodule_get_name(CONF_IMODULE *md) +const char *CONF_imodule_get_name(const CONF_IMODULE *md) { return md->name; } -char *CONF_imodule_get_value(CONF_IMODULE *md) +const char *CONF_imodule_get_value(const CONF_IMODULE *md) { return md->value; } -void *CONF_imodule_get_usr_data(CONF_IMODULE *md) +void *CONF_imodule_get_usr_data(const CONF_IMODULE *md) { return md->usr_data; } @@ -487,12 +495,12 @@ void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data) md->usr_data = usr_data; } -CONF_MODULE *CONF_imodule_get_module(CONF_IMODULE *md) +CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md) { return md->pmod; } -unsigned long CONF_imodule_get_flags(CONF_IMODULE *md) +unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md) { return md->flags; } diff --git a/crypto/engine/Makefile.ssl b/crypto/engine/Makefile.ssl index 1c93e46d42..de82b08355 100644 --- a/crypto/engine/Makefile.ssl +++ b/crypto/engine/Makefile.ssl @@ -274,6 +274,7 @@ hw_nuron.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h hw_nuron.o: ../cryptlib.h hw_nuron.c hw_openbsd_dev_crypto.o: ../../include/openssl/asn1.h hw_openbsd_dev_crypto.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +hw_openbsd_dev_crypto.o: ../../include/openssl/conf.h hw_openbsd_dev_crypto.o: ../../include/openssl/crypto.h hw_openbsd_dev_crypto.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h hw_openbsd_dev_crypto.o: ../../include/openssl/e_os2.h diff --git a/crypto/engine/hw_openbsd_dev_crypto.c b/crypto/engine/hw_openbsd_dev_crypto.c index bf0b8ea161..8085323ed1 100644 --- a/crypto/engine/hw_openbsd_dev_crypto.c +++ b/crypto/engine/hw_openbsd_dev_crypto.c @@ -62,6 +62,7 @@ #else #include "../evp/evp_locl.h" #endif +#include <openssl/conf.h> #ifndef OPENSSL_OPENBSD_DEV_CRYPTO @@ -93,10 +94,23 @@ static int dev_crypto_digests(ENGINE *e, const EVP_MD **digest, static const char dev_crypto_id[] = "openbsd_dev_crypto"; static const char dev_crypto_name[] = "OpenBSD /dev/crypto"; +static long allow_misaligned; + +static int init_conf(CONF_IMODULE *md,const CONF *conf) + { + if(!NCONF_get_number(conf,CONF_imodule_get_value(md),"allow_misaligned", + &allow_misaligned)) + return 0; + printf("allow misaligned=%ld\n",allow_misaligned); + + return 1; + } + static ENGINE *engine_openbsd_dev_crypto(void) { ENGINE *engine=ENGINE_new(); + CONF_module_add(dev_crypto_id,init_conf,NULL); if(!ENGINE_set_id(engine, dev_crypto_id) || !ENGINE_set_name(engine, dev_crypto_name) || !ENGINE_set_ciphers(engine, dev_crypto_ciphers) || @@ -385,7 +399,7 @@ static int do_digest(int ses,unsigned char *md,const void *data,int len) if(ioctl(fd, CIOCCRYPT, &cryp) == -1) { - if(errno == EINVAL) /* buffer is misaligned */ + if(errno == EINVAL && allow_misaligned) /* buffer is misaligned */ { char *dcopy; diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index b0c8e0a968..798cf9d0aa 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -287,7 +287,7 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) * because sometimes only copies of the context are ever finalised. */ if (ctx->digest && ctx->digest->cleanup - && !EVP_MD_CTX_test_flags(ctx,EVP_MD_CTX_FLAG_CLEANED)) + && !EVP_MD_CTX_test_flags(ctx,EVP_MD_CTX_FLAG_CLEANED)) ctx->digest->cleanup(ctx); if (ctx->digest && ctx->digest->ctx_size && ctx->md_data) { diff --git a/crypto/evp/evp_test.c b/crypto/evp/evp_test.c index 5ef67699dd..ae14356dfe 100644 --- a/crypto/evp/evp_test.c +++ b/crypto/evp/evp_test.c @@ -51,6 +51,7 @@ #include <string.h> #include <openssl/evp.h> #include <openssl/engine.h> +#include <openssl/conf.h> static void hexdump(FILE *f,const char *title,const unsigned char *s,int l) { @@ -309,6 +310,7 @@ int main(int argc,char **argv) OpenSSL_add_all_digests(); /* Load all compiled-in ENGINEs */ ENGINE_load_builtin_engines(); + OPENSSL_config(); /* Register all available ENGINE implementations of ciphers and digests. * This could perhaps be changed to "ENGINE_register_all_complete()"? */ ENGINE_register_all_ciphers(); |