commit | b54979a297702014f12f50bf3b2652f2671737bb | [log] [tgz] |
---|---|---|
author | Gilles Peskine <Gilles.Peskine@arm.com> | Thu Jun 21 09:32:47 2018 +0200 |
committer | itayzafrir <itay.zafrir@arm.com> | Wed Sep 12 16:24:50 2018 +0300 |
tree | db0345bb252e84fd7ded7725bf75101bb49fc0bb | |
parent | 140855615fbac66e21a601657742f9693437430d [diff] |
Refuse non-byte-sized raw data keys Since the key size is stored in bytes, we can't have a key whose size isn't a whole number of bytes.
diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 90b4354..ba80912 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c
@@ -420,6 +420,8 @@ default: return( PSA_ERROR_NOT_SUPPORTED ); } + if( bits % 8 != 0 ) + return( PSA_ERROR_INVALID_ARGUMENT ); /* Allocate memory for the key */ raw->bytes = PSA_BITS_TO_BYTES( bits );