| OLD | NEW |
| 1 /* crypto/dh/dh_key.c */ | 1 /* crypto/dh/dh_key.c */ |
| 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
| 6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
| 7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
| 8 * | 8 * |
| 9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
| 10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 * copied and put under another distribution licence | 55 * copied and put under another distribution licence |
| 56 * [including the GNU Public Licence.] | 56 * [including the GNU Public Licence.] |
| 57 */ | 57 */ |
| 58 | 58 |
| 59 #include <stdio.h> | 59 #include <stdio.h> |
| 60 #include "cryptlib.h" | 60 #include "cryptlib.h" |
| 61 #include <openssl/bn.h> | 61 #include <openssl/bn.h> |
| 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 | |
| 67 static int generate_key(DH *dh); | 65 static int generate_key(DH *dh); |
| 68 static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); | 66 static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); |
| 69 static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, | 67 static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, |
| 70 const BIGNUM *a, const BIGNUM *p, | 68 const BIGNUM *a, const BIGNUM *p, |
| 71 const BIGNUM *m, BN_CTX *ctx, | 69 const BIGNUM *m, BN_CTX *ctx, |
| 72 BN_MONT_CTX *m_ctx); | 70 BN_MONT_CTX *m_ctx); |
| 73 static int dh_init(DH *dh); | 71 static int dh_init(DH *dh); |
| 74 static int dh_finish(DH *dh); | 72 static int dh_finish(DH *dh); |
| 75 | 73 |
| 76 int DH_generate_key(DH *dh) | 74 int DH_generate_key(DH *dh) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 dh->flags |= DH_FLAG_CACHE_MONT_P; | 254 dh->flags |= DH_FLAG_CACHE_MONT_P; |
| 257 return(1); | 255 return(1); |
| 258 } | 256 } |
| 259 | 257 |
| 260 static int dh_finish(DH *dh) | 258 static int dh_finish(DH *dh) |
| 261 { | 259 { |
| 262 if(dh->method_mont_p) | 260 if(dh->method_mont_p) |
| 263 BN_MONT_CTX_free(dh->method_mont_p); | 261 BN_MONT_CTX_free(dh->method_mont_p); |
| 264 return(1); | 262 return(1); |
| 265 } | 263 } |
| 266 | |
| 267 #endif | |
| OLD | NEW |