diff options
author | Ben Laurie <ben@openssl.org> | 1999-02-20 11:50:07 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 1999-02-20 11:50:07 +0000 |
commit | 4004dbb7f621bb771c695232ec2da602db19a3b9 (patch) | |
tree | c8be8b333627ca484b3602f0ddea61d7479d7922 /crypto/x509/x509_cmp.c | |
parent | c74f1eb9bde5c66be3d6685dcc395f39a53add55 (diff) |
Generate errors when public/private key check is done.
Diffstat (limited to 'crypto/x509/x509_cmp.c')
-rw-r--r-- | crypto/x509/x509_cmp.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c index 039a9f49f0..7d850184ca 100644 --- a/crypto/x509/x509_cmp.c +++ b/crypto/x509/x509_cmp.c @@ -271,27 +271,40 @@ EVP_PKEY *k; int ok=0; xk=X509_get_pubkey(x); - if (xk->type != k->type) goto err; + if (xk->type != k->type) + { + SSLerr(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_KEY_TYPE_MISMATCH); + goto err; + } switch (k->type) { #ifndef NO_RSA case EVP_PKEY_RSA: - if (BN_cmp(xk->pkey.rsa->n,k->pkey.rsa->n) != 0) goto err; - if (BN_cmp(xk->pkey.rsa->e,k->pkey.rsa->e) != 0) goto err; + if (BN_cmp(xk->pkey.rsa->n,k->pkey.rsa->n) != 0 + || BN_cmp(xk->pkey.rsa->e,k->pkey.rsa->e) != 0) + { + SSLerr(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_KEY_VALUES_MISMATCH); + goto err; + } break; #endif #ifndef NO_DSA case EVP_PKEY_DSA: if (BN_cmp(xk->pkey.dsa->pub_key,k->pkey.dsa->pub_key) != 0) - goto err; + { + SSLerr(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_KEY_VALUES_MISMATCH); + goto err; + } break; #endif #ifndef NO_DH case EVP_PKEY_DH: /* No idea */ + SSLerr(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_CANT_CHECK_DH_KEY); goto err; #endif default: + SSLerr(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_UNKNOWN_KEY_TYPE); goto err; } |