mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Implement RSASHA256.
This commit is contained in:
committed by
Simon Kelley
parent
d1ca25ca7e
commit
02bff4f109
@@ -147,11 +147,9 @@ static int rsasha1_verify(VerifyAlgCtx *ctx_, struct keydata *key_data, unsigned
|
||||
VACTX_rsasha1 *ctx = (VACTX_rsasha1 *)ctx_;
|
||||
int validated = 0;
|
||||
|
||||
printf("OpenSSL RSA verification\n");
|
||||
RSA *rsa = RSA_new();
|
||||
rsa->e = BN_new();
|
||||
rsa->n = BN_new();
|
||||
|
||||
if (rsasha1_parse_key(rsa->e, rsa->n, key_data, key_len)
|
||||
&& RSA_verify(NID_sha1, ctx->digest, 20, ctx->sig, ctx->siglen, rsa))
|
||||
validated = 1;
|
||||
@@ -160,11 +158,20 @@ static int rsasha1_verify(VerifyAlgCtx *ctx_, struct keydata *key_data, unsigned
|
||||
return validated;
|
||||
}
|
||||
|
||||
static int rsasha256_verify(VerifyAlgCtx *ctx_, struct keydata *key, unsigned key_len)
|
||||
static int rsasha256_verify(VerifyAlgCtx *ctx_, struct keydata *key_data, unsigned key_len)
|
||||
{
|
||||
VACTX_rsasha256 *ctx = (VACTX_rsasha256 *)ctx_;
|
||||
(void)ctx;
|
||||
return 0;
|
||||
int validated = 0;
|
||||
|
||||
RSA *rsa = RSA_new();
|
||||
rsa->e = BN_new();
|
||||
rsa->n = BN_new();
|
||||
if (rsasha1_parse_key(rsa->e, rsa->n, key_data, key_len)
|
||||
&& RSA_verify(NID_sha256, ctx->digest, 32, ctx->sig, ctx->siglen, rsa))
|
||||
validated = 1;
|
||||
|
||||
RSA_free(rsa);
|
||||
return validated;
|
||||
}
|
||||
|
||||
#define DEFINE_VALG(alg) \
|
||||
|
||||
Reference in New Issue
Block a user