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
@@ -1061,6 +1061,12 @@ int cca_import_key_from_json_web_key(const struct ekmf_cca_lib *cca_lib,
|
||||
pr_verbose(verbose, "Failed to get and decode x");
|
||||
goto out;
|
||||
}
|
||||
if (len != prime_len) {
|
||||
/* RFC 7517: Must be full size of a coordinate */
|
||||
pr_verbose(verbose, "x coordinate length is wrong");
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
len = prime_len;
|
||||
rc = json_object_get_base64url(jwk, "y", &q[1 + prime_len],
|
||||
@@ -1069,6 +1075,12 @@ int cca_import_key_from_json_web_key(const struct ekmf_cca_lib *cca_lib,
|
||||
pr_verbose(verbose, "Failed to get and decode y");
|
||||
goto out;
|
||||
}
|
||||
if (len != prime_len) {
|
||||
/* RFC 7517: Must be full size of a coordinate */
|
||||
pr_verbose(verbose, "y coordinate length is wrong");
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rule_array_count = 1;
|
||||
memcpy(rule_array, "ECC-PUBL", CCA_KEYWORD_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user