diff options
author | Simon Glass <sjg@chromium.org> | 2014-06-02 22:04:51 -0600 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-06-11 16:25:46 -0400 |
commit | 4f427a421fcba92b0325907fe79464c9791e85d5 (patch) | |
tree | 6b13739c671ea04f0e4e6a5f1f811aca1ecb8e08 /lib/rsa/rsa-sign.c | |
parent | 63b4b5bae52e48528876e13e858ef934ac2e4a3b (diff) | |
download | u-boot-imx-4f427a421fcba92b0325907fe79464c9791e85d5.zip u-boot-imx-4f427a421fcba92b0325907fe79464c9791e85d5.tar.gz u-boot-imx-4f427a421fcba92b0325907fe79464c9791e85d5.tar.bz2 |
fdt: Update functions which write to an FDT to return -ENOSPC
When writing values into an FDT it is possible that there will be
insufficient space. If the caller gets a useful error then it can
potentially deal with the situation.
Adjust these functions to return -ENOSPC when the FDT is full.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/rsa/rsa-sign.c')
-rw-r--r-- | lib/rsa/rsa-sign.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index ca8c120..48f3197 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -429,20 +429,30 @@ int rsa_add_verify_data(struct image_sign_info *info, void *keydest) ret = fdt_setprop_string(keydest, node, "key-name-hint", info->keyname); - ret |= fdt_setprop_u32(keydest, node, "rsa,num-bits", bits); - ret |= fdt_setprop_u32(keydest, node, "rsa,n0-inverse", n0_inv); - ret |= fdt_add_bignum(keydest, node, "rsa,modulus", modulus, bits); - ret |= fdt_add_bignum(keydest, node, "rsa,r-squared", r_squared, bits); - ret |= fdt_setprop_string(keydest, node, FIT_ALGO_PROP, - info->algo->name); + if (!ret) + ret = fdt_setprop_u32(keydest, node, "rsa,num-bits", bits); + if (!ret) + ret = fdt_setprop_u32(keydest, node, "rsa,n0-inverse", n0_inv); + if (!ret) { + ret = fdt_add_bignum(keydest, node, "rsa,modulus", modulus, + bits); + } + if (!ret) { + ret = fdt_add_bignum(keydest, node, "rsa,r-squared", r_squared, + bits); + } + if (!ret) { + ret = fdt_setprop_string(keydest, node, FIT_ALGO_PROP, + info->algo->name); + } if (info->require_keys) { - fdt_setprop_string(keydest, node, "required", - info->require_keys); + ret = fdt_setprop_string(keydest, node, "required", + info->require_keys); } BN_free(modulus); BN_free(r_squared); if (ret) - return -EIO; + return ret == FDT_ERR_NOSPACE ? -ENOSPC : -EIO; return 0; } |