| OLD | NEW |
| 1 /* crypto/dsa/dsa_key.c */ | 1 /* crypto/dsa/dsa_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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 */ | 57 */ |
| 58 | 58 |
| 59 #include <stdio.h> | 59 #include <stdio.h> |
| 60 #include <time.h> | 60 #include <time.h> |
| 61 #include "cryptlib.h" | 61 #include "cryptlib.h" |
| 62 #ifndef OPENSSL_NO_SHA | 62 #ifndef OPENSSL_NO_SHA |
| 63 #include <openssl/bn.h> | 63 #include <openssl/bn.h> |
| 64 #include <openssl/dsa.h> | 64 #include <openssl/dsa.h> |
| 65 #include <openssl/rand.h> | 65 #include <openssl/rand.h> |
| 66 | 66 |
| 67 #ifndef OPENSSL_FIPS | |
| 68 | |
| 69 static int dsa_builtin_keygen(DSA *dsa); | 67 static int dsa_builtin_keygen(DSA *dsa); |
| 70 | 68 |
| 71 int DSA_generate_key(DSA *dsa) | 69 int DSA_generate_key(DSA *dsa) |
| 72 { | 70 { |
| 73 if(dsa->meth->dsa_keygen) | 71 if(dsa->meth->dsa_keygen) |
| 74 return dsa->meth->dsa_keygen(dsa); | 72 return dsa->meth->dsa_keygen(dsa); |
| 75 return dsa_builtin_keygen(dsa); | 73 return dsa_builtin_keygen(dsa); |
| 76 } | 74 } |
| 77 | 75 |
| 78 static int dsa_builtin_keygen(DSA *dsa) | 76 static int dsa_builtin_keygen(DSA *dsa) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 dsa->pub_key=pub_key; | 119 dsa->pub_key=pub_key; |
| 122 ok=1; | 120 ok=1; |
| 123 | 121 |
| 124 err: | 122 err: |
| 125 if ((pub_key != NULL) && (dsa->pub_key == NULL)) BN_free(pub_key); | 123 if ((pub_key != NULL) && (dsa->pub_key == NULL)) BN_free(pub_key); |
| 126 if ((priv_key != NULL) && (dsa->priv_key == NULL)) BN_free(priv_key); | 124 if ((priv_key != NULL) && (dsa->priv_key == NULL)) BN_free(priv_key); |
| 127 if (ctx != NULL) BN_CTX_free(ctx); | 125 if (ctx != NULL) BN_CTX_free(ctx); |
| 128 return(ok); | 126 return(ok); |
| 129 } | 127 } |
| 130 #endif | 128 #endif |
| 131 | |
| 132 #endif | |
| OLD | NEW |