diff options
| author | markus <> | 2003-05-12 02:18:40 +0000 |
|---|---|---|
| committer | markus <> | 2003-05-12 02:18:40 +0000 |
| commit | d4fcd82bb7f6d603bd61e19a81ba97337b89dfca (patch) | |
| tree | d52e3a0f1f08f65ad283027e560e17ed0d720462 /src/lib/libcrypto/ec | |
| parent | 582bbd139cd2afd58d10dc051c5b0b989b441074 (diff) | |
| download | openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.gz openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.bz2 openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.zip | |
merge 0.9.7b with local changes; crank majors for libssl/libcrypto
Diffstat (limited to 'src/lib/libcrypto/ec')
| -rw-r--r-- | src/lib/libcrypto/ec/Makefile.ssl | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec.h | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_err.c | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_mult.c | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ectest.c | 11 |
6 files changed, 27 insertions, 9 deletions
diff --git a/src/lib/libcrypto/ec/Makefile.ssl b/src/lib/libcrypto/ec/Makefile.ssl index ed602b4a7f..a2805c47a2 100644 --- a/src/lib/libcrypto/ec/Makefile.ssl +++ b/src/lib/libcrypto/ec/Makefile.ssl | |||
| @@ -71,7 +71,7 @@ lint: | |||
| 71 | lint -DLINT $(INCLUDES) $(SRC)>fluff | 71 | lint -DLINT $(INCLUDES) $(SRC)>fluff |
| 72 | 72 | ||
| 73 | depend: | 73 | depend: |
| 74 | $(MAKEDEPEND) $(CFLAG) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) | 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) |
| 75 | 75 | ||
| 76 | dclean: | 76 | dclean: |
| 77 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | 77 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new |
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h index a52d4edf14..6d6a9b7127 100644 --- a/src/lib/libcrypto/ec/ec.h +++ b/src/lib/libcrypto/ec/ec.h | |||
| @@ -195,7 +195,6 @@ void ERR_load_EC_strings(void); | |||
| 195 | #define EC_F_EC_GROUP_GET0_GENERATOR 139 | 195 | #define EC_F_EC_GROUP_GET0_GENERATOR 139 |
| 196 | #define EC_F_EC_GROUP_GET_COFACTOR 140 | 196 | #define EC_F_EC_GROUP_GET_COFACTOR 140 |
| 197 | #define EC_F_EC_GROUP_GET_CURVE_GFP 130 | 197 | #define EC_F_EC_GROUP_GET_CURVE_GFP 130 |
| 198 | #define EC_F_EC_GROUP_GET_EXTRA_DATA 107 | ||
| 199 | #define EC_F_EC_GROUP_GET_ORDER 141 | 198 | #define EC_F_EC_GROUP_GET_ORDER 141 |
| 200 | #define EC_F_EC_GROUP_NEW 108 | 199 | #define EC_F_EC_GROUP_NEW 108 |
| 201 | #define EC_F_EC_GROUP_PRECOMPUTE_MULT 142 | 200 | #define EC_F_EC_GROUP_PRECOMPUTE_MULT 142 |
| @@ -232,7 +231,6 @@ void ERR_load_EC_strings(void); | |||
| 232 | #define EC_R_INVALID_FIELD 103 | 231 | #define EC_R_INVALID_FIELD 103 |
| 233 | #define EC_R_INVALID_FORM 104 | 232 | #define EC_R_INVALID_FORM 104 |
| 234 | #define EC_R_NOT_INITIALIZED 111 | 233 | #define EC_R_NOT_INITIALIZED 111 |
| 235 | #define EC_R_NO_SUCH_EXTRA_DATA 105 | ||
| 236 | #define EC_R_POINT_AT_INFINITY 106 | 234 | #define EC_R_POINT_AT_INFINITY 106 |
| 237 | #define EC_R_POINT_IS_NOT_ON_CURVE 107 | 235 | #define EC_R_POINT_IS_NOT_ON_CURVE 107 |
| 238 | #define EC_R_SLOT_FULL 108 | 236 | #define EC_R_SLOT_FULL 108 |
diff --git a/src/lib/libcrypto/ec/ec_err.c b/src/lib/libcrypto/ec/ec_err.c index 394cdc021f..d37b6aba87 100644 --- a/src/lib/libcrypto/ec/ec_err.c +++ b/src/lib/libcrypto/ec/ec_err.c | |||
| @@ -84,7 +84,6 @@ static ERR_STRING_DATA EC_str_functs[]= | |||
| 84 | {ERR_PACK(0,EC_F_EC_GROUP_GET0_GENERATOR,0), "EC_GROUP_get0_generator"}, | 84 | {ERR_PACK(0,EC_F_EC_GROUP_GET0_GENERATOR,0), "EC_GROUP_get0_generator"}, |
| 85 | {ERR_PACK(0,EC_F_EC_GROUP_GET_COFACTOR,0), "EC_GROUP_get_cofactor"}, | 85 | {ERR_PACK(0,EC_F_EC_GROUP_GET_COFACTOR,0), "EC_GROUP_get_cofactor"}, |
| 86 | {ERR_PACK(0,EC_F_EC_GROUP_GET_CURVE_GFP,0), "EC_GROUP_get_curve_GFp"}, | 86 | {ERR_PACK(0,EC_F_EC_GROUP_GET_CURVE_GFP,0), "EC_GROUP_get_curve_GFp"}, |
| 87 | {ERR_PACK(0,EC_F_EC_GROUP_GET_EXTRA_DATA,0), "EC_GROUP_get_extra_data"}, | ||
| 88 | {ERR_PACK(0,EC_F_EC_GROUP_GET_ORDER,0), "EC_GROUP_get_order"}, | 87 | {ERR_PACK(0,EC_F_EC_GROUP_GET_ORDER,0), "EC_GROUP_get_order"}, |
| 89 | {ERR_PACK(0,EC_F_EC_GROUP_NEW,0), "EC_GROUP_new"}, | 88 | {ERR_PACK(0,EC_F_EC_GROUP_NEW,0), "EC_GROUP_new"}, |
| 90 | {ERR_PACK(0,EC_F_EC_GROUP_PRECOMPUTE_MULT,0), "EC_GROUP_precompute_mult"}, | 89 | {ERR_PACK(0,EC_F_EC_GROUP_PRECOMPUTE_MULT,0), "EC_GROUP_precompute_mult"}, |
| @@ -124,7 +123,6 @@ static ERR_STRING_DATA EC_str_reasons[]= | |||
| 124 | {EC_R_INVALID_FIELD ,"invalid field"}, | 123 | {EC_R_INVALID_FIELD ,"invalid field"}, |
| 125 | {EC_R_INVALID_FORM ,"invalid form"}, | 124 | {EC_R_INVALID_FORM ,"invalid form"}, |
| 126 | {EC_R_NOT_INITIALIZED ,"not initialized"}, | 125 | {EC_R_NOT_INITIALIZED ,"not initialized"}, |
| 127 | {EC_R_NO_SUCH_EXTRA_DATA ,"no such extra data"}, | ||
| 128 | {EC_R_POINT_AT_INFINITY ,"point at infinity"}, | 126 | {EC_R_POINT_AT_INFINITY ,"point at infinity"}, |
| 129 | {EC_R_POINT_IS_NOT_ON_CURVE ,"point is not on curve"}, | 127 | {EC_R_POINT_IS_NOT_ON_CURVE ,"point is not on curve"}, |
| 130 | {EC_R_SLOT_FULL ,"slot full"}, | 128 | {EC_R_SLOT_FULL ,"slot full"}, |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 0cf485de60..deb522060f 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
| @@ -128,7 +128,7 @@ void EC_GROUP_clear_free(EC_GROUP *group) | |||
| 128 | 128 | ||
| 129 | EC_GROUP_clear_free_extra_data(group); | 129 | EC_GROUP_clear_free_extra_data(group); |
| 130 | 130 | ||
| 131 | memset(group, 0, sizeof *group); | 131 | OPENSSL_cleanse(group, sizeof *group); |
| 132 | OPENSSL_free(group); | 132 | OPENSSL_free(group); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| @@ -268,7 +268,9 @@ void *EC_GROUP_get_extra_data(const EC_GROUP *group, void *(*extra_data_dup_func | |||
| 268 | || (group->extra_data_free_func != extra_data_free_func) | 268 | || (group->extra_data_free_func != extra_data_free_func) |
| 269 | || (group->extra_data_clear_free_func != extra_data_clear_free_func)) | 269 | || (group->extra_data_clear_free_func != extra_data_clear_free_func)) |
| 270 | { | 270 | { |
| 271 | ECerr(EC_F_EC_GROUP_GET_EXTRA_DATA, EC_R_NO_SUCH_EXTRA_DATA); | 271 | #if 0 /* this was an error in 0.9.7, but that does not make a lot of sense */ |
| 272 | ECerr(..._F_EC_GROUP_GET_EXTRA_DATA, ..._R_NO_SUCH_EXTRA_DATA); | ||
| 273 | #endif | ||
| 272 | return NULL; | 274 | return NULL; |
| 273 | } | 275 | } |
| 274 | 276 | ||
| @@ -357,7 +359,7 @@ void EC_POINT_clear_free(EC_POINT *point) | |||
| 357 | point->meth->point_clear_finish(point); | 359 | point->meth->point_clear_finish(point); |
| 358 | else if (point->meth != NULL && point->meth->point_finish != 0) | 360 | else if (point->meth != NULL && point->meth->point_finish != 0) |
| 359 | point->meth->point_finish(point); | 361 | point->meth->point_finish(point); |
| 360 | memset(point, 0, sizeof *point); | 362 | OPENSSL_cleanse(point, sizeof *point); |
| 361 | OPENSSL_free(point); | 363 | OPENSSL_free(point); |
| 362 | } | 364 | } |
| 363 | 365 | ||
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c index 603ba31b81..4dbc931120 100644 --- a/src/lib/libcrypto/ec/ec_mult.c +++ b/src/lib/libcrypto/ec/ec_mult.c | |||
| @@ -209,6 +209,17 @@ int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
| 209 | EC_POINT ***val_sub = NULL; /* pointers to sub-arrays of 'val' */ | 209 | EC_POINT ***val_sub = NULL; /* pointers to sub-arrays of 'val' */ |
| 210 | int ret = 0; | 210 | int ret = 0; |
| 211 | 211 | ||
| 212 | if (group->meth != r->meth) | ||
| 213 | { | ||
| 214 | ECerr(EC_F_EC_POINTS_MUL, EC_R_INCOMPATIBLE_OBJECTS); | ||
| 215 | return 0; | ||
| 216 | } | ||
| 217 | |||
| 218 | if ((scalar == NULL) && (num == 0)) | ||
| 219 | { | ||
| 220 | return EC_POINT_set_to_infinity(group, r); | ||
| 221 | } | ||
| 222 | |||
| 212 | if (scalar != NULL) | 223 | if (scalar != NULL) |
| 213 | { | 224 | { |
| 214 | generator = EC_GROUP_get0_generator(group); | 225 | generator = EC_GROUP_get0_generator(group); |
diff --git a/src/lib/libcrypto/ec/ectest.c b/src/lib/libcrypto/ec/ectest.c index eab46cc080..345d3e4289 100644 --- a/src/lib/libcrypto/ec/ectest.c +++ b/src/lib/libcrypto/ec/ectest.c | |||
| @@ -55,6 +55,11 @@ | |||
| 55 | 55 | ||
| 56 | #include <stdio.h> | 56 | #include <stdio.h> |
| 57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
| 58 | #ifdef FLAT_INC | ||
| 59 | #include "e_os.h" | ||
| 60 | #else | ||
| 61 | #include "../e_os.h" | ||
| 62 | #endif | ||
| 58 | #include <string.h> | 63 | #include <string.h> |
| 59 | #include <time.h> | 64 | #include <time.h> |
| 60 | 65 | ||
| @@ -65,14 +70,16 @@ int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); retur | |||
| 65 | 70 | ||
| 66 | 71 | ||
| 67 | #include <openssl/ec.h> | 72 | #include <openssl/ec.h> |
| 73 | #ifndef OPENSSL_NO_ENGINE | ||
| 68 | #include <openssl/engine.h> | 74 | #include <openssl/engine.h> |
| 75 | #endif | ||
| 69 | #include <openssl/err.h> | 76 | #include <openssl/err.h> |
| 70 | 77 | ||
| 71 | #define ABORT do { \ | 78 | #define ABORT do { \ |
| 72 | fflush(stdout); \ | 79 | fflush(stdout); \ |
| 73 | fprintf(stderr, "%s:%d: ABORT\n", __FILE__, __LINE__); \ | 80 | fprintf(stderr, "%s:%d: ABORT\n", __FILE__, __LINE__); \ |
| 74 | ERR_print_errors_fp(stderr); \ | 81 | ERR_print_errors_fp(stderr); \ |
| 75 | exit(1); \ | 82 | EXIT(1); \ |
| 76 | } while (0) | 83 | } while (0) |
| 77 | 84 | ||
| 78 | #if 0 | 85 | #if 0 |
| @@ -623,7 +630,9 @@ int main(int argc, char *argv[]) | |||
| 623 | if (P_384) EC_GROUP_free(P_384); | 630 | if (P_384) EC_GROUP_free(P_384); |
| 624 | if (P_521) EC_GROUP_free(P_521); | 631 | if (P_521) EC_GROUP_free(P_521); |
| 625 | 632 | ||
| 633 | #ifndef OPENSSL_NO_ENGINE | ||
| 626 | ENGINE_cleanup(); | 634 | ENGINE_cleanup(); |
| 635 | #endif | ||
| 627 | CRYPTO_cleanup_all_ex_data(); | 636 | CRYPTO_cleanup_all_ex_data(); |
| 628 | ERR_free_strings(); | 637 | ERR_free_strings(); |
| 629 | ERR_remove_state(0); | 638 | ERR_remove_state(0); |
