Skip to content

Commit a8bfde0

Browse files
committed
Throw error when using AES key share file of incorrect size
1 parent 333d571 commit a8bfde0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4960,6 +4960,10 @@ bool encrypt_command::execute(device_map &devices) {
49604960
aes_file->exceptions(std::iostream::failbit | std::iostream::badbit);
49614961

49624962
aes_key_share_t aes_key_share;
4963+
aes_file->seekg(0, std::ios::end);
4964+
if (aes_file->tellg() != 128) {
4965+
fail(ERROR_INCOMPATIBLE, "The AES key share must be a 128 byte file (the supplied file is %d bytes)", aes_file->tellg());
4966+
}
49634967
aes_file->read((char*)aes_key_share.bytes, sizeof(aes_key_share.bytes));
49644968

49654969
aes_key_t aes_key;

0 commit comments

Comments
 (0)