Skip to content

Commit 72ad7b3

Browse files
committed
Fix setting of parameter plaintext_header_size
The check of the parameter plaintext_header_size was not removed from the cipher allocation functions. Therefore a value of 0 was used, if the parameter value was not a multiple of 16.
1 parent 2c7fc84 commit 72ad7b3

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

src/cipher_aegis.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ AllocateAegisCipher(sqlite3* db)
187187
aegisCipher->m_keyLength = KEYLENGTH_AEGIS_256;
188188
aegisCipher->m_nonceLength = PAGE_NONCE_LEN_AEGIS_256;
189189
}
190-
int plaintextHeaderSize = sqlite3mcGetCipherParameter(cipherParams, "plaintext_header_size");
191-
aegisCipher->m_plaintextHeaderSize = (plaintextHeaderSize >=0 && plaintextHeaderSize <= 100 && plaintextHeaderSize % 16 == 0) ? plaintextHeaderSize : 0;
190+
aegisCipher->m_plaintextHeaderSize = sqlite3mcGetCipherParameter(cipherParams, "plaintext_header_size");
192191
}
193192
return aegisCipher;
194193
}

src/cipher_ascon.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ AllocateAscon128Cipher(sqlite3* db)
6464
{
6565
CipherParams* cipherParams = sqlite3mcGetCipherParams(db, CIPHER_NAME_ASCON128);
6666
ascon128Cipher->m_kdfIter = sqlite3mcGetCipherParameter(cipherParams, "kdf_iter");
67-
int plaintextHeaderSize = sqlite3mcGetCipherParameter(cipherParams, "plaintext_header_size");
68-
ascon128Cipher->m_plaintextHeaderSize = (plaintextHeaderSize >=0 && plaintextHeaderSize <= 100 && plaintextHeaderSize % 16 == 0) ? plaintextHeaderSize : 0;
67+
ascon128Cipher->m_plaintextHeaderSize = sqlite3mcGetCipherParameter(cipherParams, "plaintext_header_size");
6968
}
7069
return ascon128Cipher;
7170
}

src/cipher_chacha20.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ AllocateChaCha20Cipher(sqlite3* db)
8080
{
8181
chacha20Cipher->m_kdfIter = SQLEET_KDF_ITER;
8282
}
83-
int plaintextHeaderSize = sqlite3mcGetCipherParameter(cipherParams, "plaintext_header_size");
84-
chacha20Cipher->m_plaintextHeaderSize = (plaintextHeaderSize >=0 && plaintextHeaderSize <= 100 && plaintextHeaderSize % 16 == 0) ? plaintextHeaderSize : 0;
83+
chacha20Cipher->m_plaintextHeaderSize = sqlite3mcGetCipherParameter(cipherParams, "plaintext_header_size");
8584
}
8685
return chacha20Cipher;
8786
}

src/cipher_sqlcipher.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ AllocateSQLCipherCipher(sqlite3* db)
142142
sqlCipherCipher->m_hmacAlgorithmCompat = sqlite3mcGetCipherParameter(cipherParams, "hmac_algorithm_compat");
143143
if (sqlCipherCipher->m_legacy >= SQLCIPHER_VERSION_4)
144144
{
145-
int plaintextHeaderSize = sqlite3mcGetCipherParameter(cipherParams, "plaintext_header_size");
146-
sqlCipherCipher->m_plaintextHeaderSize = (plaintextHeaderSize >=0 && plaintextHeaderSize <= 100 && plaintextHeaderSize % 16 == 0) ? plaintextHeaderSize : 0;
145+
sqlCipherCipher->m_plaintextHeaderSize = sqlite3mcGetCipherParameter(cipherParams, "plaintext_header_size");
147146
}
148147
else
149148
{

0 commit comments

Comments
 (0)