diff options
| author | djm <> | 2009-01-09 12:14:11 +0000 |
|---|---|---|
| committer | djm <> | 2009-01-09 12:14:11 +0000 |
| commit | a0fdc9ec41594852f67ec77dfad9cb06bacc4186 (patch) | |
| tree | c43f6b3a4d93ad2cb3dcf93275295679d895a033 /src/lib/libcrypto/dh | |
| parent | 5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80 (diff) | |
| download | openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.tar.gz openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.tar.bz2 openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.zip | |
import openssl-0.9.8j
Diffstat (limited to 'src/lib/libcrypto/dh')
| -rw-r--r-- | src/lib/libcrypto/dh/dh.h | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/dh/dh_asn1.c | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/dh/dh_check.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/dh/dh_err.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/dh/dh_gen.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/dh/dh_key.c | 4 |
6 files changed, 29 insertions, 2 deletions
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h index ccdf35ae1c..10475ac4b3 100644 --- a/src/lib/libcrypto/dh/dh.h +++ b/src/lib/libcrypto/dh/dh.h | |||
| @@ -77,6 +77,8 @@ | |||
| 77 | # define OPENSSL_DH_MAX_MODULUS_BITS 10000 | 77 | # define OPENSSL_DH_MAX_MODULUS_BITS 10000 |
| 78 | #endif | 78 | #endif |
| 79 | 79 | ||
| 80 | #define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 | ||
| 81 | |||
| 80 | #define DH_FLAG_CACHE_MONT_P 0x01 | 82 | #define DH_FLAG_CACHE_MONT_P 0x01 |
| 81 | #define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH | 83 | #define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH |
| 82 | * implementation now uses constant time | 84 | * implementation now uses constant time |
| @@ -167,6 +169,11 @@ struct dh_st | |||
| 167 | 169 | ||
| 168 | const DH_METHOD *DH_OpenSSL(void); | 170 | const DH_METHOD *DH_OpenSSL(void); |
| 169 | 171 | ||
| 172 | #ifdef OPENSSL_FIPS | ||
| 173 | DH * FIPS_dh_new(void); | ||
| 174 | void FIPS_dh_free(DH *dh); | ||
| 175 | #endif | ||
| 176 | |||
| 170 | void DH_set_default_method(const DH_METHOD *meth); | 177 | void DH_set_default_method(const DH_METHOD *meth); |
| 171 | const DH_METHOD *DH_get_default_method(void); | 178 | const DH_METHOD *DH_get_default_method(void); |
| 172 | int DH_set_method(DH *dh, const DH_METHOD *meth); | 179 | int DH_set_method(DH *dh, const DH_METHOD *meth); |
| @@ -218,6 +225,9 @@ void ERR_load_DH_strings(void); | |||
| 218 | #define DH_F_DHPARAMS_PRINT 100 | 225 | #define DH_F_DHPARAMS_PRINT 100 |
| 219 | #define DH_F_DHPARAMS_PRINT_FP 101 | 226 | #define DH_F_DHPARAMS_PRINT_FP 101 |
| 220 | #define DH_F_DH_BUILTIN_GENPARAMS 106 | 227 | #define DH_F_DH_BUILTIN_GENPARAMS 106 |
| 228 | #define DH_F_DH_COMPUTE_KEY 107 | ||
| 229 | #define DH_F_DH_GENERATE_KEY 108 | ||
| 230 | #define DH_F_DH_GENERATE_PARAMETERS 109 | ||
| 221 | #define DH_F_DH_NEW_METHOD 105 | 231 | #define DH_F_DH_NEW_METHOD 105 |
| 222 | #define DH_F_GENERATE_KEY 103 | 232 | #define DH_F_GENERATE_KEY 103 |
| 223 | #define DH_F_GENERATE_PARAMETERS 104 | 233 | #define DH_F_GENERATE_PARAMETERS 104 |
| @@ -225,6 +235,7 @@ void ERR_load_DH_strings(void); | |||
| 225 | /* Reason codes. */ | 235 | /* Reason codes. */ |
| 226 | #define DH_R_BAD_GENERATOR 101 | 236 | #define DH_R_BAD_GENERATOR 101 |
| 227 | #define DH_R_INVALID_PUBKEY 102 | 237 | #define DH_R_INVALID_PUBKEY 102 |
| 238 | #define DH_R_KEY_SIZE_TOO_SMALL 104 | ||
| 228 | #define DH_R_MODULUS_TOO_LARGE 103 | 239 | #define DH_R_MODULUS_TOO_LARGE 103 |
| 229 | #define DH_R_NO_PRIVATE_VALUE 100 | 240 | #define DH_R_NO_PRIVATE_VALUE 100 |
| 230 | 241 | ||
diff --git a/src/lib/libcrypto/dh/dh_asn1.c b/src/lib/libcrypto/dh/dh_asn1.c index 769b5b68c5..76740af2bd 100644 --- a/src/lib/libcrypto/dh/dh_asn1.c +++ b/src/lib/libcrypto/dh/dh_asn1.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* dh_asn1.c */ | 1 | /* dh_asn1.c */ |
| 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
diff --git a/src/lib/libcrypto/dh/dh_check.c b/src/lib/libcrypto/dh/dh_check.c index b846913004..316cb9221d 100644 --- a/src/lib/libcrypto/dh/dh_check.c +++ b/src/lib/libcrypto/dh/dh_check.c | |||
| @@ -70,6 +70,8 @@ | |||
| 70 | * should hold. | 70 | * should hold. |
| 71 | */ | 71 | */ |
| 72 | 72 | ||
| 73 | #ifndef OPENSSL_FIPS | ||
| 74 | |||
| 73 | int DH_check(const DH *dh, int *ret) | 75 | int DH_check(const DH *dh, int *ret) |
| 74 | { | 76 | { |
| 75 | int ok=0; | 77 | int ok=0; |
| @@ -140,3 +142,5 @@ err: | |||
| 140 | if (q != NULL) BN_free(q); | 142 | if (q != NULL) BN_free(q); |
| 141 | return(ok); | 143 | return(ok); |
| 142 | } | 144 | } |
| 145 | |||
| 146 | #endif | ||
diff --git a/src/lib/libcrypto/dh/dh_err.c b/src/lib/libcrypto/dh/dh_err.c index a2d8196ecb..13263c81c1 100644 --- a/src/lib/libcrypto/dh/dh_err.c +++ b/src/lib/libcrypto/dh/dh_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/dh/dh_err.c */ | 1 | /* crypto/dh/dh_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -74,6 +74,9 @@ static ERR_STRING_DATA DH_str_functs[]= | |||
| 74 | {ERR_FUNC(DH_F_DHPARAMS_PRINT), "DHparams_print"}, | 74 | {ERR_FUNC(DH_F_DHPARAMS_PRINT), "DHparams_print"}, |
| 75 | {ERR_FUNC(DH_F_DHPARAMS_PRINT_FP), "DHparams_print_fp"}, | 75 | {ERR_FUNC(DH_F_DHPARAMS_PRINT_FP), "DHparams_print_fp"}, |
| 76 | {ERR_FUNC(DH_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"}, | 76 | {ERR_FUNC(DH_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"}, |
| 77 | {ERR_FUNC(DH_F_DH_COMPUTE_KEY), "DH_compute_key"}, | ||
| 78 | {ERR_FUNC(DH_F_DH_GENERATE_KEY), "DH_generate_key"}, | ||
| 79 | {ERR_FUNC(DH_F_DH_GENERATE_PARAMETERS), "DH_generate_parameters"}, | ||
| 77 | {ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"}, | 80 | {ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"}, |
| 78 | {ERR_FUNC(DH_F_GENERATE_KEY), "GENERATE_KEY"}, | 81 | {ERR_FUNC(DH_F_GENERATE_KEY), "GENERATE_KEY"}, |
| 79 | {ERR_FUNC(DH_F_GENERATE_PARAMETERS), "GENERATE_PARAMETERS"}, | 82 | {ERR_FUNC(DH_F_GENERATE_PARAMETERS), "GENERATE_PARAMETERS"}, |
| @@ -84,6 +87,7 @@ static ERR_STRING_DATA DH_str_reasons[]= | |||
| 84 | { | 87 | { |
| 85 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, | 88 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, |
| 86 | {ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, | 89 | {ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, |
| 90 | {ERR_REASON(DH_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, | ||
| 87 | {ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, | 91 | {ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, |
| 88 | {ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, | 92 | {ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, |
| 89 | {0,NULL} | 93 | {0,NULL} |
diff --git a/src/lib/libcrypto/dh/dh_gen.c b/src/lib/libcrypto/dh/dh_gen.c index cfd5b11868..999e1deb40 100644 --- a/src/lib/libcrypto/dh/dh_gen.c +++ b/src/lib/libcrypto/dh/dh_gen.c | |||
| @@ -66,6 +66,8 @@ | |||
| 66 | #include <openssl/bn.h> | 66 | #include <openssl/bn.h> |
| 67 | #include <openssl/dh.h> | 67 | #include <openssl/dh.h> |
| 68 | 68 | ||
| 69 | #ifndef OPENSSL_FIPS | ||
| 70 | |||
| 69 | static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_GENCB *cb); | 71 | static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_GENCB *cb); |
| 70 | 72 | ||
| 71 | int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb) | 73 | int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb) |
| @@ -173,3 +175,5 @@ err: | |||
| 173 | } | 175 | } |
| 174 | return ok; | 176 | return ok; |
| 175 | } | 177 | } |
| 178 | |||
| 179 | #endif | ||
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c index e7db440342..79dd331863 100644 --- a/src/lib/libcrypto/dh/dh_key.c +++ b/src/lib/libcrypto/dh/dh_key.c | |||
| @@ -62,6 +62,8 @@ | |||
| 62 | #include <openssl/rand.h> | 62 | #include <openssl/rand.h> |
| 63 | #include <openssl/dh.h> | 63 | #include <openssl/dh.h> |
| 64 | 64 | ||
| 65 | #ifndef OPENSSL_FIPS | ||
| 66 | |||
| 65 | static int generate_key(DH *dh); | 67 | static int generate_key(DH *dh); |
| 66 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); | 68 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); |
| 67 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, | 69 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, |
| @@ -261,3 +263,5 @@ static int dh_finish(DH *dh) | |||
| 261 | BN_MONT_CTX_free(dh->method_mont_p); | 263 | BN_MONT_CTX_free(dh->method_mont_p); |
| 262 | return(1); | 264 | return(1); |
| 263 | } | 265 | } |
| 266 | |||
| 267 | #endif | ||
