comparison gcm.c @ 1705:5b701bf529aa

Fix ChaCha20 on 32-bit platforms (#99) * Fix ChaCha20 on 32-bit platforms On 32-bit platforms with old compiler STORE64H() parameter is not auto-expanded to 64-bit value, causing wrong IV data. Spotted on BCM4706 MIPS32r2 with GCC 4.2.4: Exit before auth: Integrity error (bad packet size 2065808956) * Fix Chacha20-Poly1305 and AES-GCM debug messages Functions were renamed earlier and trace messages - not.
author Vladislav Grishenko <themiron@users.noreply.github.com>
date Fri, 29 May 2020 18:26:22 +0500
parents 3a97f14c0235
children
comparison
equal deleted inserted replaced
1704:d384bc2e5af3 1705:5b701bf529aa
98 } 98 }
99 99
100 static int dropbear_gcm_getlength(unsigned int UNUSED(seq), 100 static int dropbear_gcm_getlength(unsigned int UNUSED(seq),
101 const unsigned char *in, unsigned int *outlen, 101 const unsigned char *in, unsigned int *outlen,
102 unsigned long len, dropbear_gcm_state* UNUSED(state)) { 102 unsigned long len, dropbear_gcm_state* UNUSED(state)) {
103 TRACE2(("enter dropbear_gcm_parse")) 103 TRACE2(("enter dropbear_gcm_getlength"))
104 104
105 if (len < 4) { 105 if (len < 4) {
106 return CRYPT_ERROR; 106 return CRYPT_ERROR;
107 } 107 }
108 108
109 LOAD32H(*outlen, in); 109 LOAD32H(*outlen, in);
110 110
111 TRACE2(("leave dropbear_gcm_parse")) 111 TRACE2(("leave dropbear_gcm_getlength"))
112 return CRYPT_OK; 112 return CRYPT_OK;
113 } 113 }
114 114
115 const struct dropbear_cipher_mode dropbear_mode_gcm = 115 const struct dropbear_cipher_mode dropbear_mode_gcm =
116 {(void *)dropbear_gcm_start, NULL, NULL, 116 {(void *)dropbear_gcm_start, NULL, NULL,