From 32c73807fa4e7cea0d2350c461cf5e3a714376fd Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 25 Apr 2008 18:17:29 +0000 Subject: [PATCH] Multiple assignments without sequence points invoke undefined behavior, even if the assignments all compute and store the same value. Don't put an assignment in the argument to macro ff(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20309 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/aes/aeskey.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lib/crypto/aes/aeskey.c b/src/lib/crypto/aes/aeskey.c index 970a26fca..60f766b8a 100644 --- a/src/lib/crypto/aes/aeskey.c +++ b/src/lib/crypto/aes/aeskey.c @@ -307,17 +307,23 @@ aes_rval aes_dec_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx kd4(cx->k_sch, 6); kd4(cx->k_sch, 7); kd4(cx->k_sch, 8); kdl4(cx->k_sch, 9); cx->n_rnd = 10; break; - case 24: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16)); - cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20)); + case 24: ss[4] = word_in(in_key + 16); + cx->k_sch[4] = ff(ss[4]); + ss[5] = word_in(in_key + 20); + cx->k_sch[5] = ff(ss[5]); kdf6(cx->k_sch, 0); kd6(cx->k_sch, 1); kd6(cx->k_sch, 2); kd6(cx->k_sch, 3); kd6(cx->k_sch, 4); kd6(cx->k_sch, 5); kd6(cx->k_sch, 6); kdl6(cx->k_sch, 7); cx->n_rnd = 12; break; - case 32: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16)); - cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20)); - cx->k_sch[6] = ff(ss[6] = word_in(in_key + 24)); - cx->k_sch[7] = ff(ss[7] = word_in(in_key + 28)); + case 32: ss[4] = word_in(in_key + 16); + cx->k_sch[4] = ff(ss[4]); + ss[5] = word_in(in_key + 20); + cx->k_sch[5] = ff(ss[5]); + ss[6] = word_in(in_key + 24); + cx->k_sch[6] = ff(ss[6]); + ss[7] = word_in(in_key + 28); + cx->k_sch[7] = ff(ss[7]); kdf8(cx->k_sch, 0); kd8(cx->k_sch, 1); kd8(cx->k_sch, 2); kd8(cx->k_sch, 3); kd8(cx->k_sch, 4); kd8(cx->k_sch, 5); -- 2.26.2