Harmonized behaviour when point length is invalid.
This commit is contained in:
parent
acc70b1be6
commit
dda1f8a0c4
4 changed files with 33 additions and 34 deletions
|
|
@ -2039,12 +2039,13 @@ api_mul(unsigned char *G, size_t Glen,
|
|||
p256_jacobian P;
|
||||
|
||||
(void)curve;
|
||||
if (Glen != 65) {
|
||||
return 0;
|
||||
}
|
||||
r = p256_decode(&P, G, Glen);
|
||||
p256_mul(&P, x, xlen);
|
||||
if (Glen >= 65) {
|
||||
p256_to_affine(&P);
|
||||
p256_encode(G, &P);
|
||||
}
|
||||
p256_to_affine(&P);
|
||||
p256_encode(G, &P);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -2059,16 +2060,6 @@ api_mulgen(unsigned char *R,
|
|||
p256_to_affine(&P);
|
||||
p256_encode(R, &P);
|
||||
return 65;
|
||||
|
||||
/*
|
||||
const unsigned char *G;
|
||||
size_t Glen;
|
||||
|
||||
G = api_generator(curve, &Glen);
|
||||
memcpy(R, G, Glen);
|
||||
api_mul(R, Glen, x, xlen, curve);
|
||||
return Glen;
|
||||
*/
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
|
|
@ -2081,6 +2072,9 @@ api_muladd(unsigned char *A, const unsigned char *B, size_t len,
|
|||
int i;
|
||||
|
||||
(void)curve;
|
||||
if (len != 65) {
|
||||
return 0;
|
||||
}
|
||||
r = p256_decode(&P, A, len);
|
||||
p256_mul(&P, x, xlen);
|
||||
if (B == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue