Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to prepare for ubuntu 22.04 CI #6635

Merged
merged 8 commits into from Apr 25, 2022

Conversation

Pentarctagon
Copy link
Member

No description provided.

@github-actions github-actions bot added the UI User interface issues, including both back-end and front-end issues. label Apr 24, 2022
@Vultraz
Copy link
Member

Vultraz commented Apr 24, 2022

The "Fix range-loop-construct warning" commit should be done by using either the s or sv string literals in the array ctor.

@Pentarctagon
Copy link
Member Author

The what?

@Vultraz
Copy link
Member

Vultraz commented Apr 24, 2022

If you want a string array:

using namespace std::string_literals;
static const std::array required {"id"s, "config_name"s, "create_map"s};

If you want a string_view array:

using namespace std::string_view_literals
static const std::array required {"id"sv, "config_name"sv, "create_map"sv};

Right now the compiler is deducing an array of const char*, but using the literals will make it an array of strings or string views, so you can use that type in the loop.

@Pentarctagon Pentarctagon changed the title Need to actually tell the CI to use the updated images. Changes to prepare for ubuntu 22.04 CI Apr 25, 2022
@Pentarctagon Pentarctagon merged commit 09ff164 into wesnoth:master Apr 25, 2022

static_assert(utils::md5::DIGEST_SIZE == MD5_DIGEST_LENGTH, "Constants mismatch");
static_assert(utils::sha1::DIGEST_SIZE == SHA_DIGEST_LENGTH, "Constants mismatch");
#include <openssl/evp.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the MD5 static_assert here but not in the Apple section? You should probably remove either both or neither.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the new evp header doesn't have the constant to compare against anymore, and the evp header isn't used on Apple systems.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well… how does it even know what the size is? Is it just hard-coded and will break if we ever change hash type?

Although, I guess if we change hash type we'd at least make a separate hashing class, so maybe that doesn't matter…

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't follow? Are there multiple types of MD5 hashes?

// TODO: use EVP_EncryptInit_ex2 once openssl 3.0 is more widespread
EVP_EncryptInit_ex(ctx, EVP_rc4(), NULL, key.data(), NULL);
EVP_EncryptUpdate(ctx, result.data(), &outlen, text.data(), text.size());
EVP_EncryptFinal_ex(ctx, result.data() + outlen, &tmplen);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check that outlen will always be equal to the input length?

It seems like a plausible assumption but I'm not sure if it's a correct one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't follow. The output length is a separate value from the input length?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah? I'm not sure how RC4 works, but some encryption schemes require padding to bring the ciphertext to a multiple of the block size.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous implementation doesn't seem to, at least. It calls RC4 with a length of block_size as many times as it can, then calls it again at the end with the size of any remaining characters that aren't enough to fill a block. So there's no padding being done.

@@ -623,7 +623,8 @@ class dispatcher
} else if constexpr(cat == event_category::text_input) {
return signal_text_input_queue_;
} else {
static_assert(utils::dependent_false_v<cat>, "No matching signal queue for category");
// "No matching signal queue for category"
utils::static_assert_false();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a negative change, as it loses the error message…

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was either this or remove it entirely, since Clang was rejecting the version that allowed an error message.

Copy link
Member

@Vultraz Vultraz Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a clang bug. You're supposed to be able to use a message. Or did it have a problem with dependent_false_v?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like it could have been solved with decltype(cat).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI User interface issues, including both back-end and front-end issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants