-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[aes] Add signature conversion decorator to aes
#29973
Conversation
I'd rather remove `generate_aes_testdata.py`
I have the test just haven't added them yet. |
Why have the Is this halfway to refactoring the code with these functions as static methods of some class? The list |
There's no contradiction here, they are intended yo be private.
I wouldn't use static but, kind of yes. Moving functions into a class is secondary, but rewriting them to use byte instead of list of ints is.
Private functions are exposed here. |
def _aes_gcm_decrypt_and_verify(data, key, tag, nonce): | ||
""" | ||
Generate key schedule | ||
Decrypt with aes in GBM mode and checks authenticity using tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since #29201 is not merged, youtube-dl does not have any need for gcm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, since I did it I just want it out somewhere...
OK, now I see the new block (which after all is mentioned in the title of the PR!) that all makes sense, thanks. Making the lists of int internal certainly seems a good idea. The decorator mechanism is slick and functional, and systematises the code, even if it doesn't always reduce it by much. Eg AIUI these are equivalent?
vs
But some of the other interface signatures need more complex munging and so should be more simply expressed by the decorator. |
If you never need access to the original functions (even internally), yes. You can just put the decorator on the original without needing a wrapper |
My original assumption that using |
Before submitting a pull request make sure you have:
In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:
What is the purpose of your pull request?
Description of your pull request and other information
It starts an overhaul of
aes
.test_aes
to safeguard codeI'd like to mention @pukkandan and the help he gave me during the development of this code at yt-dlp/yt-dlp#938.