Remove superfluous SHA-1 dependency from EVP ECDSA code.
The documentation for |ECDSA_sign| and |ECDSA_verify| says that the |type| parameter should be zero. Change-Id: I875d3405455c5443f5a5a5c2960a9a9f486ca5bb Reviewed-on: https://boringssl-review.googlesource.com/5832 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
231cb82145
commit
1f5e9456a9
@ -125,9 +125,7 @@ static void pkey_ec_cleanup(EVP_PKEY_CTX *ctx) {
|
|||||||
|
|
||||||
static int pkey_ec_sign(EVP_PKEY_CTX *ctx, uint8_t *sig, size_t *siglen,
|
static int pkey_ec_sign(EVP_PKEY_CTX *ctx, uint8_t *sig, size_t *siglen,
|
||||||
const uint8_t *tbs, size_t tbslen) {
|
const uint8_t *tbs, size_t tbslen) {
|
||||||
int type;
|
|
||||||
unsigned int sltmp;
|
unsigned int sltmp;
|
||||||
EC_PKEY_CTX *dctx = ctx->data;
|
|
||||||
EC_KEY *ec = ctx->pkey->pkey.ec;
|
EC_KEY *ec = ctx->pkey->pkey.ec;
|
||||||
|
|
||||||
if (!sig) {
|
if (!sig) {
|
||||||
@ -138,12 +136,7 @@ static int pkey_ec_sign(EVP_PKEY_CTX *ctx, uint8_t *sig, size_t *siglen,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = NID_sha1;
|
if (!ECDSA_sign(0, tbs, tbslen, sig, &sltmp, ec)) {
|
||||||
if (dctx->md) {
|
|
||||||
type = EVP_MD_type(dctx->md);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ECDSA_sign(type, tbs, tbslen, sig, &sltmp, ec)) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*siglen = (size_t)sltmp;
|
*siglen = (size_t)sltmp;
|
||||||
@ -152,16 +145,7 @@ static int pkey_ec_sign(EVP_PKEY_CTX *ctx, uint8_t *sig, size_t *siglen,
|
|||||||
|
|
||||||
static int pkey_ec_verify(EVP_PKEY_CTX *ctx, const uint8_t *sig, size_t siglen,
|
static int pkey_ec_verify(EVP_PKEY_CTX *ctx, const uint8_t *sig, size_t siglen,
|
||||||
const uint8_t *tbs, size_t tbslen) {
|
const uint8_t *tbs, size_t tbslen) {
|
||||||
int type;
|
return ECDSA_verify(0, tbs, tbslen, sig, siglen, ctx->pkey->pkey.ec);
|
||||||
EC_PKEY_CTX *dctx = ctx->data;
|
|
||||||
EC_KEY *ec = ctx->pkey->pkey.ec;
|
|
||||||
|
|
||||||
type = NID_sha1;
|
|
||||||
if (dctx->md) {
|
|
||||||
type = EVP_MD_type(dctx->md);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ECDSA_verify(type, tbs, tbslen, sig, siglen, ec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pkey_ec_derive(EVP_PKEY_CTX *ctx, uint8_t *key,
|
static int pkey_ec_derive(EVP_PKEY_CTX *ctx, uint8_t *key,
|
||||||
|
Loading…
Reference in New Issue
Block a user