diff options
author | Ben Laurie <ben@openssl.org> | 2012-06-03 22:03:37 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2012-06-03 22:03:37 +0000 |
commit | 68d2cf51bcfc1c2c1d0deec9be21c3d743737656 (patch) | |
tree | 7b8ed6018e595520ff18873c4fc267228b552f85 /crypto | |
parent | 19eedffcafe5e703f28e015bad417bc50266c19b (diff) |
Reduce version skew: trivia (I hope).
Diffstat (limited to 'crypto')
73 files changed, 246 insertions, 202 deletions
diff --git a/crypto/aes/aes_misc.c b/crypto/aes/aes_misc.c index f083488ecb..6c181cae8d 100644 --- a/crypto/aes/aes_misc.c +++ b/crypto/aes/aes_misc.c @@ -50,7 +50,6 @@ */ #include <openssl/opensslv.h> -#include <openssl/crypto.h> #include <openssl/aes.h> #include "aes_locl.h" diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index e2eb9b243e..1cf8867573 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -196,3 +196,65 @@ int ASN1_TIME_set_string(ASN1_TIME *s, const char *str) return 1; } + +#if 0 +static int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *s) + { + const unsigned char *p; + + if (!ASN1_TIME_check(s)) + return 0; + + memset(tm, 0 ,sizeof tm); + p = s->data; + +#define g2(p) (((p)[0] - '0') * 10 + ((p)[1] - '0')) + if (s->type == V_ASN1_GENERALIZEDTIME) + { + int yr = g2(p) * 100 + g2(p + 2); + if (yr < 1900) + return 0; + tm->tm_year = yr - 1900; + p += 4; + } + else + { + tm->tm_year=g2(p); + if(tm->tm_year < 50) + tm->tm_year+=100; + p += 2; + } + tm->tm_mon=g2(p)-1; + tm->tm_mday=g2(p + 2); + tm->tm_hour=g2(p + 4); + tm->tm_min=g2(p + 6); + p += 8; + /* Seconds optional in UTCTime */ + if (s->type == V_ASN1_GENERALIZEDTIME || (*p >= '0' && *p <= '9')) + { + tm->tm_sec=g2(p); + p += 2; + } + else + tm->tm_sec = 0; + if (s->type == V_ASN1_GENERALIZEDTIME) + { + /* Skip any fractional seconds */ + if (*p == '.') + { + p++; + while (*p >= '0' && *p <= '9') + p++; + } + } + /* Timezone */ + if(*p != 'Z') + { + int off_sec = g2(p + 1) * 3600 + g2(p + 3) * 60; + if(*p == '-') + off_sec = -off_sec; + OPENSSL_gmtime_adj(tm, 0, off_sec); + } + return 1; + } +#endif diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c index 52b3304293..7b2403185e 100644 --- a/crypto/bn/bn_div.c +++ b/crypto/bn/bn_div.c @@ -141,6 +141,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, * * <appro@fy.chalmers.se> */ +#undef bn_div_words # define bn_div_words(n0,n1,d0) \ ({ asm volatile ( \ "divl %4" \ @@ -155,6 +156,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, * Same story here, but it's 128-bit by 64-bit division. Wow! * <appro@fy.chalmers.se> */ +# undef bn_div_words # define bn_div_words(n0,n1,d0) \ ({ asm volatile ( \ "divq %4" \ diff --git a/crypto/bn/bn_gcd.c b/crypto/bn/bn_gcd.c index 4a352119ba..a808f53178 100644 --- a/crypto/bn/bn_gcd.c +++ b/crypto/bn/bn_gcd.c @@ -205,6 +205,7 @@ err: /* solves ax == 1 (mod n) */ static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); + BIGNUM *BN_mod_inverse(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) { diff --git a/crypto/camellia/Makefile b/crypto/camellia/Makefile index 6ce6fc99cd..3c1af7aff2 100644 --- a/crypto/camellia/Makefile +++ b/crypto/camellia/Makefile @@ -96,11 +96,9 @@ cmll_ctr.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h cmll_ctr.o: ../../include/openssl/opensslconf.h cmll_ctr.c cmll_ecb.o: ../../include/openssl/camellia.h cmll_ecb.o: ../../include/openssl/opensslconf.h cmll_ecb.c cmll_locl.h -cmll_misc.o: ../../include/openssl/camellia.h ../../include/openssl/crypto.h -cmll_misc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h -cmll_misc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -cmll_misc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -cmll_misc.o: ../../include/openssl/symhacks.h cmll_locl.h cmll_misc.c +cmll_misc.o: ../../include/openssl/camellia.h +cmll_misc.o: ../../include/openssl/opensslconf.h +cmll_misc.o: ../../include/openssl/opensslv.h cmll_locl.h cmll_misc.c cmll_ofb.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h cmll_ofb.o: ../../include/openssl/opensslconf.h cmll_ofb.c cmll_utl.o: ../../include/openssl/camellia.h ../../include/openssl/crypto.h diff --git a/crypto/camellia/cmll_misc.c b/crypto/camellia/cmll_misc.c index f44d48564c..614b43b0b3 100644 --- a/crypto/camellia/cmll_misc.c +++ b/crypto/camellia/cmll_misc.c @@ -50,7 +50,6 @@ */ #include <openssl/opensslv.h> -#include <openssl/crypto.h> #include <openssl/camellia.h> #include "cmll_locl.h" diff --git a/crypto/cast/Makefile b/crypto/cast/Makefile index f3f4859886..0acc38f28d 100644 --- a/crypto/cast/Makefile +++ b/crypto/cast/Makefile @@ -95,8 +95,5 @@ c_ofb64.o: ../../e_os.h ../../include/openssl/cast.h c_ofb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h c_ofb64.o: c_ofb64.c cast_lcl.h c_skey.o: ../../e_os.h ../../include/openssl/cast.h -c_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h -c_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h -c_skey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h -c_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +c_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h c_skey.o: c_skey.c cast_lcl.h cast_s.h diff --git a/crypto/cast/c_skey.c b/crypto/cast/c_skey.c index cb6bf9fee3..3c18774447 100644 --- a/crypto/cast/c_skey.c +++ b/crypto/cast/c_skey.c @@ -56,7 +56,6 @@ * [including the GNU Public Licence.] */ -#include <openssl/crypto.h> #include <openssl/cast.h> #include "cast_lcl.h" #include "cast_s.h" diff --git a/crypto/cms/cms_enc.c b/crypto/cms/cms_enc.c index f873ce3794..bebeaf29c7 100644 --- a/crypto/cms/cms_enc.c +++ b/crypto/cms/cms_enc.c @@ -74,7 +74,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) X509_ALGOR *calg = ec->contentEncryptionAlgorithm; unsigned char iv[EVP_MAX_IV_LENGTH], *piv = NULL; unsigned char *tkey = NULL; - size_t tkeylen; + size_t tkeylen = 0; int ok = 0; diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c index f88e8f3b52..b62d1bfac0 100644 --- a/crypto/cms/cms_lib.c +++ b/crypto/cms/cms_lib.c @@ -411,9 +411,7 @@ int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain, * algorithm OID instead of digest. */ || EVP_MD_pkey_type(EVP_MD_CTX_md(mtmp)) == nid) - { return EVP_MD_CTX_copy_ex(mctx, mtmp); - } chain = BIO_next(chain); } } diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 766ea8cac7..97f0ddbbf8 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -704,6 +704,7 @@ void OPENSSL_cpuid_setup(void) } else vec = OPENSSL_ia32_cpuid(); + /* * |(1<<10) sets a reserved bit to signal that variable * was initialized already... This is to avoid interference diff --git a/crypto/cryptlib.h b/crypto/cryptlib.h index 1761f6b668..d26f9630ea 100644 --- a/crypto/cryptlib.h +++ b/crypto/cryptlib.h @@ -100,7 +100,7 @@ extern "C" { void OPENSSL_cpuid_setup(void); extern unsigned int OPENSSL_ia32cap_P[]; -void OPENSSL_showfatal(const char *,...); +void OPENSSL_showfatal(const char *fmta,...); void *OPENSSL_stderr(void); extern int OPENSSL_NONPIC_relocated; diff --git a/crypto/crypto.h b/crypto/crypto.h index 6aeda0a9ac..61605769bb 100644 --- a/crypto/crypto.h +++ b/crypto/crypto.h @@ -488,10 +488,10 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), long (**go)(void)); void *CRYPTO_malloc_locked(int num, const char *file, int line); -void CRYPTO_free_locked(void *); +void CRYPTO_free_locked(void *ptr); void *CRYPTO_malloc(int num, const char *file, int line); char *CRYPTO_strdup(const char *str, const char *file, int line); -void CRYPTO_free(void *); +void CRYPTO_free(void *ptr); void *CRYPTO_realloc(void *addr,int num, const char *file, int line); void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, int line); diff --git a/crypto/des/set_key.c b/crypto/des/set_key.c index d3e69ca8b5..da4d62e112 100644 --- a/crypto/des/set_key.c +++ b/crypto/des/set_key.c @@ -63,9 +63,8 @@ * 1.1 added norm_expand_bits * 1.0 First working version */ -#include "des_locl.h" - #include <openssl/crypto.h> +#include "des_locl.h" OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ diff --git a/crypto/des/str2key.c b/crypto/des/str2key.c index 9c2054bda6..1077f99d1b 100644 --- a/crypto/des/str2key.c +++ b/crypto/des/str2key.c @@ -56,8 +56,8 @@ * [including the GNU Public Licence.] */ -#include "des_locl.h" #include <openssl/crypto.h> +#include "des_locl.h" void DES_string_to_key(const char *str, DES_cblock *key) { diff --git a/crypto/dh/Makefile b/crypto/dh/Makefile index 00fd076fe0..9c9c0fe2a5 100644 --- a/crypto/dh/Makefile +++ b/crypto/dh/Makefile @@ -178,3 +178,11 @@ dh_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h dh_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h dh_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h dh_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_prn.c +dh_rfc5114.o: ../../e_os.h ../../include/openssl/bio.h +dh_rfc5114.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +dh_rfc5114.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h +dh_rfc5114.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +dh_rfc5114.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h +dh_rfc5114.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h +dh_rfc5114.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +dh_rfc5114.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_rfc5114.c diff --git a/crypto/ec/ec.h b/crypto/ec/ec.h index f7ac5aec6a..4db11cf9d6 100644 --- a/crypto/ec/ec.h +++ b/crypto/ec/ec.h @@ -274,10 +274,10 @@ int EC_GROUP_get_curve_name(const EC_GROUP *group); void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); int EC_GROUP_get_asn1_flag(const EC_GROUP *group); -void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t); +void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form); point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); -unsigned char *EC_GROUP_get0_seed(const EC_GROUP *); +unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); size_t EC_GROUP_get_seed_len(const EC_GROUP *); size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); @@ -628,8 +628,8 @@ int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *c */ int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); -int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *); -int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *); +int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); +int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx); /** Computes r = generator * n sum_{i=0}^num p[i] * m[i] * \param group underlying EC_GROUP object @@ -802,16 +802,16 @@ const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); unsigned EC_KEY_get_enc_flags(const EC_KEY *key); -void EC_KEY_set_enc_flags(EC_KEY *, unsigned int); -point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *); -void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t); +void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); +point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); +void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); /* functions to set/get method specific data */ -void *EC_KEY_get_key_method_data(EC_KEY *, +void *EC_KEY_get_key_method_data(EC_KEY *key, void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); -void EC_KEY_insert_key_method_data(EC_KEY *, void *data, +void EC_KEY_insert_key_method_data(EC_KEY *key, void *data, void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); /* wrapper functions for the underlying EC_GROUP object */ -void EC_KEY_set_asn1_flag(EC_KEY *, int); +void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); /** Creates a table of pre-computed multiples of the generator to * accelerate further EC_KEY operations. diff --git a/crypto/ec/ec_pmeth.c b/crypto/ec/ec_pmeth.c index de3466c4d6..b85f772be3 100644 --- a/crypto/ec/ec_pmeth.c +++ b/crypto/ec/ec_pmeth.c @@ -188,7 +188,7 @@ static int pkey_ec_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen) pubkey = EC_KEY_get0_public_key(ctx->peerkey->pkey.ec); - /* NB: unlike PKS#3 DH, if *outlen is less than maximum size this is + /* NB: unlike PKCS#3 DH, if *outlen is less than maximum size this is * not an error, the result is truncated. */ diff --git a/crypto/ec/ecp_mont.c b/crypto/ec/ecp_mont.c index 079e47431b..f04f132c7a 100644 --- a/crypto/ec/ecp_mont.c +++ b/crypto/ec/ecp_mont.c @@ -114,7 +114,6 @@ const EC_METHOD *EC_GFp_mont_method(void) ec_GFp_mont_field_decode, ec_GFp_mont_field_set_to_one }; - return &ret; #endif } diff --git a/crypto/ec/ectest.c b/crypto/ec/ectest.c index f107782de0..102eaa9b23 100644 --- a/crypto/ec/ectest.c +++ b/crypto/ec/ectest.c @@ -236,7 +236,7 @@ static void group_order_tests(EC_GROUP *group) } static void prime_field_tests(void) - { + { BN_CTX *ctx = NULL; BIGNUM *p, *a, *b; EC_GROUP *group; diff --git a/crypto/ecdh/Makefile b/crypto/ecdh/Makefile index 65d8904ee8..ba05fea05c 100644 --- a/crypto/ecdh/Makefile +++ b/crypto/ecdh/Makefile @@ -84,17 +84,12 @@ ech_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h ech_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h ech_err.o: ech_err.c ech_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h -ech_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h -ech_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h -ech_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h -ech_key.o: ../../include/openssl/engine.h ../../include/openssl/evp.h -ech_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h -ech_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -ech_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -ech_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h -ech_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -ech_key.o: ../../include/openssl/symhacks.h ../../include/op |