diff options
Diffstat (limited to 'security/keys/trusted_defined.c')
-rw-r--r-- | security/keys/trusted_defined.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/security/keys/trusted_defined.c b/security/keys/trusted_defined.c index f7d06776faf0..2836c6dc18a3 100644 --- a/security/keys/trusted_defined.c +++ b/security/keys/trusted_defined.c | |||
@@ -150,17 +150,15 @@ static int TSS_authhmac(unsigned char *digest, const unsigned char *key, | |||
150 | data = va_arg(argp, unsigned char *); | 150 | data = va_arg(argp, unsigned char *); |
151 | if (!data) { | 151 | if (!data) { |
152 | ret = -EINVAL; | 152 | ret = -EINVAL; |
153 | va_end(argp); | 153 | break; |
154 | goto out; | ||
155 | } | 154 | } |
156 | ret = crypto_shash_update(&sdesc->shash, data, dlen); | 155 | ret = crypto_shash_update(&sdesc->shash, data, dlen); |
157 | if (ret < 0) { | 156 | if (ret < 0) |
158 | va_end(argp); | 157 | break; |
159 | goto out; | ||
160 | } | ||
161 | } | 158 | } |
162 | va_end(argp); | 159 | va_end(argp); |
163 | ret = crypto_shash_final(&sdesc->shash, paramdigest); | 160 | if (!ret) |
161 | ret = crypto_shash_final(&sdesc->shash, paramdigest); | ||
164 | if (!ret) | 162 | if (!ret) |
165 | ret = TSS_rawhmac(digest, key, keylen, SHA1_DIGEST_SIZE, | 163 | ret = TSS_rawhmac(digest, key, keylen, SHA1_DIGEST_SIZE, |
166 | paramdigest, TPM_NONCE_SIZE, h1, | 164 | paramdigest, TPM_NONCE_SIZE, h1, |
@@ -229,13 +227,12 @@ static int TSS_checkhmac1(unsigned char *buffer, | |||
229 | break; | 227 | break; |
230 | dpos = va_arg(argp, unsigned int); | 228 | dpos = va_arg(argp, unsigned int); |
231 | ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen); | 229 | ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen); |
232 | if (ret < 0) { | 230 | if (ret < 0) |
233 | va_end(argp); | 231 | break; |
234 | goto out; | ||
235 | } | ||
236 | } | 232 | } |
237 | va_end(argp); | 233 | va_end(argp); |
238 | ret = crypto_shash_final(&sdesc->shash, paramdigest); | 234 | if (!ret) |
235 | ret = crypto_shash_final(&sdesc->shash, paramdigest); | ||
239 | if (ret < 0) | 236 | if (ret < 0) |
240 | goto out; | 237 | goto out; |
241 | 238 | ||
@@ -323,13 +320,12 @@ static int TSS_checkhmac2(unsigned char *buffer, | |||
323 | break; | 320 | break; |
324 | dpos = va_arg(argp, unsigned int); | 321 | dpos = va_arg(argp, unsigned int); |
325 | ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen); | 322 | ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen); |
326 | if (ret < 0) { | 323 | if (ret < 0) |
327 | va_end(argp); | 324 | break; |
328 | goto out; | ||
329 | } | ||
330 | } | 325 | } |
331 | va_end(argp); | 326 | va_end(argp); |
332 | ret = crypto_shash_final(&sdesc->shash, paramdigest); | 327 | if (!ret) |
328 | ret = crypto_shash_final(&sdesc->shash, paramdigest); | ||
333 | if (ret < 0) | 329 | if (ret < 0) |
334 | goto out; | 330 | goto out; |
335 | 331 | ||