-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
BBS+: add some checks on disclosed indexes array #949
Conversation
ahah!! so you read my email and blog !!!! <3 thanks a lot for taking the initiative !!! 👍🏽 |
src/lua/crypto_bbs.lua
Outdated
local disclosed_messages = {} | ||
local undisclosed_messages = {} | ||
for i, v in ipairs(disclosed_indexes) do | ||
if i > 1 and disclosed_indexes[i] == disclosed_indexes[i - 1] then |
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.
I am not sure that checking only adjacent values suffices here. There can be scattered duplicates.
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.
Arrays are always sorted in proof_gen (line 684) before being passed as input to core_proof_gen
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.
can you add this sentence as comment in that line of code?
src/lua/crypto_bbs.lua
Outdated
@@ -679,6 +682,7 @@ function bbs.proof_gen(ciphersuite, pk, signature, header, ph, messages, disclos | |||
header = header or O.empty() | |||
ph = ph or O.empty() | |||
table.sort(disclosed_indexes) -- make sure indexes are sorted | |||
if (disclosed_indexes[1] <= 0 or disclosed_indexes[#disclosed_indexes] > #messages) then error('disclosed indexes contains not valid integers', 2) end |
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.
It is best to separate this check in two and give a more accurate error message describing the cause.
many thanks! |
No description provided.