mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libekmfweb: Check length of JWK EC public key coordinates
RFC 7517 requires that the x and y coordinates of a ECC JSON Web Key (JWK) are specified in its full size of a coordinate for the curve used. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
faf26220a7
commit
bf5ca4367d
@@ -2254,11 +2254,21 @@ int json_web_key_as_pkey(json_object *jwk, int pkey_type, EVP_PKEY **pkey)
|
||||
rc = json_object_get_base64url(jwk, "x", x, &len);
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
if (len != prime_len) {
|
||||
/* RFC 7517: Must be full size of a coordinate */
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
len = prime_len;
|
||||
rc = json_object_get_base64url(jwk, "y", y, &len);
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
if (len != prime_len) {
|
||||
/* RFC 7517: Must be full size of a coordinate */
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = ecc_pub_key_as_pkey(nid, prime_len, x, y, pkey);
|
||||
if (rc != 0)
|
||||
|
||||
Reference in New Issue
Block a user