diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2019-05-08 14:18:26 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2019-05-08 14:18:26 +0000 |
commit | 862cbb595e3cea5db1093ff4998e2f287e88fcbe (patch) | |
tree | 21566e750429a2b12b144cb9917b4b66b3dff3a0 /lib/libcrypto/modes | |
parent | 6fb545b692b16a3d5a15937338b087cbd6f6c2ef (diff) |
Make sure that the tag buffer size is equal to the tag size
in CRYPTO_ccm128_tag(). Otherwise the caller might end up
using the part of the tag buffer that was left uninitialized.
Issue found by Guido Vranken.
ok inoguchi
Diffstat (limited to 'lib/libcrypto/modes')
-rw-r--r-- | lib/libcrypto/modes/ccm128.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/modes/ccm128.c b/lib/libcrypto/modes/ccm128.c index 58cc4f44c6a..12c6e616593 100644 --- a/lib/libcrypto/modes/ccm128.c +++ b/lib/libcrypto/modes/ccm128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccm128.c,v 1.4 2015/02/10 09:46:30 miod Exp $ */ +/* $OpenBSD: ccm128.c,v 1.5 2019/05/08 14:18:25 tb Exp $ */ /* ==================================================================== * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * @@ -435,7 +435,7 @@ size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx,unsigned char *tag,size_t len) { unsigned int M = (ctx->nonce.c[0]>>3)&7; /* the M parameter */ M *= 2; M += 2; - if (len<M) return 0; + if (len != M) return 0; memcpy(tag,ctx->cmac.c,M); return M; } |