-
Notifications
You must be signed in to change notification settings - Fork 324
feat(bls-12-381): add test vectors for BLS-12-381 #224
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
Open
tob-scott-a
wants to merge
5
commits into
C2SP:main
Choose a base branch
from
tob-scott-a:bls-12-381-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bc78a31
feat(bls-12-381): add test vectors for BLS-12-381
tob-scott-a 9e7d522
fix: no unicode
tob-scott-a a3af9c5
bls-12-381: add tests for boundary conditions
tob-scott-a f56780c
fix: unescape >= in BLS vector comments
tob-scott-a 3faed65
fix(bls-12-381): address initial PR feedback
tob-scott-a File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| { | ||
| "type": "object", | ||
| "definitions": { | ||
| "BlsAggregateVerifyTestGroup": { | ||
| "type": "object", | ||
| "properties": { | ||
| "type": { | ||
| "enum": [ | ||
| "BlsAggregateVerify" | ||
| ] | ||
| }, | ||
| "source": { | ||
| "$ref": "common.json#/definitions/Source" | ||
| }, | ||
| "ciphersuite": { | ||
| "type": "string", | ||
| "description": "The BLS ciphersuite identifier" | ||
| }, | ||
| "tests": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "#/definitions/BlsAggregateVerifyTestVector" | ||
| } | ||
| } | ||
| }, | ||
| "required": ["type", "source", "ciphersuite", "tests"], | ||
| "additionalProperties": false | ||
| }, | ||
| "BlsAggregateVerifyTestVector": { | ||
| "type": "object", | ||
| "properties": { | ||
| "tcId": { | ||
| "type": "integer", | ||
| "description": "Identifier of the test case" | ||
| }, | ||
| "comment": { | ||
| "type": "string", | ||
| "description": "A brief description of the test case" | ||
| }, | ||
| "pubkeys": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "format": "HexBytes" | ||
| }, | ||
| "description": "The compressed public keys" | ||
| }, | ||
| "messages": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "format": "HexBytes" | ||
| }, | ||
| "description": "The messages that were signed" | ||
| }, | ||
| "sig": { | ||
| "type": "string", | ||
| "format": "HexBytes", | ||
| "description": "The aggregated BLS signature in compressed form" | ||
| }, | ||
| "result": { | ||
| "$ref": "common.json#/definitions/Result" | ||
| }, | ||
| "flags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "description": "A list of flags" | ||
| } | ||
| }, | ||
| "additionalProperties": false, | ||
| "required": ["tcId", "comment", "pubkeys", "messages", "sig", "result", "flags"] | ||
| } | ||
| }, | ||
| "properties": { | ||
| "algorithm": { | ||
| "type": "string", | ||
| "description": "The primitive tested in the test file" | ||
| }, | ||
| "header": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "description": "Additional documentation" | ||
| }, | ||
| "notes": { | ||
| "$ref": "common.json#/definitions/Notes" | ||
| }, | ||
| "numberOfTests": { | ||
| "type": "integer", | ||
| "description": "The number of test vectors in this test" | ||
| }, | ||
| "schema": { | ||
| "enum": [ | ||
| "bls_aggregate_verify_schema_v1.json" | ||
| ] | ||
| }, | ||
| "testGroups": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "#/definitions/BlsAggregateVerifyTestGroup" | ||
| } | ||
| } | ||
| }, | ||
| "required": ["algorithm", "header", "notes", "numberOfTests", "schema", "testGroups"], | ||
| "additionalProperties": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| { | ||
| "type": "object", | ||
| "definitions": { | ||
| "BlsHashToG2TestGroup": { | ||
| "type": "object", | ||
| "properties": { | ||
| "type": { | ||
| "enum": [ | ||
| "BlsHashToG2" | ||
| ] | ||
| }, | ||
| "source": { | ||
| "$ref": "common.json#/definitions/Source" | ||
| }, | ||
| "dst": { | ||
| "type": "string", | ||
| "description": "The domain separation tag used for hash_to_curve" | ||
| }, | ||
| "tests": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "#/definitions/BlsHashToG2TestVector" | ||
| } | ||
| } | ||
| }, | ||
| "required": ["type", "source", "dst", "tests"], | ||
| "additionalProperties": false | ||
| }, | ||
| "BlsHashToG2TestVector": { | ||
| "type": "object", | ||
| "properties": { | ||
| "tcId": { | ||
| "type": "integer", | ||
| "description": "Identifier of the test case" | ||
| }, | ||
| "comment": { | ||
| "type": "string", | ||
| "description": "A brief description of the test case" | ||
| }, | ||
| "msg": { | ||
| "type": "string", | ||
| "format": "HexBytes", | ||
| "description": "The input message" | ||
| }, | ||
| "expected": { | ||
| "type": "string", | ||
| "format": "HexBytes", | ||
| "description": "The expected hash-to-curve output point in compressed form" | ||
| }, | ||
| "result": { | ||
| "$ref": "common.json#/definitions/Result" | ||
| }, | ||
| "flags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "description": "A list of flags" | ||
| } | ||
| }, | ||
| "additionalProperties": false, | ||
| "required": ["tcId", "comment", "msg", "expected", "result", "flags"] | ||
| } | ||
| }, | ||
| "properties": { | ||
| "algorithm": { | ||
| "type": "string", | ||
| "description": "The primitive tested in the test file" | ||
| }, | ||
| "header": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "description": "Additional documentation" | ||
| }, | ||
| "notes": { | ||
| "$ref": "common.json#/definitions/Notes" | ||
| }, | ||
| "numberOfTests": { | ||
| "type": "integer", | ||
| "description": "The number of test vectors in this test" | ||
| }, | ||
| "schema": { | ||
| "enum": [ | ||
| "bls_hash_to_g2_schema_v1.json" | ||
| ] | ||
| }, | ||
| "testGroups": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "#/definitions/BlsHashToG2TestGroup" | ||
| } | ||
| } | ||
| }, | ||
| "required": ["algorithm", "header", "notes", "numberOfTests", "schema", "testGroups"], | ||
| "additionalProperties": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| { | ||
| "type": "object", | ||
| "definitions": { | ||
| "BlsSigVerifyTestGroup": { | ||
| "type": "object", | ||
| "properties": { | ||
| "type": { | ||
| "enum": [ | ||
| "BlsSigVerify" | ||
| ] | ||
| }, | ||
| "source": { | ||
| "$ref": "common.json#/definitions/Source" | ||
| }, | ||
| "ciphersuite": { | ||
| "type": "string", | ||
| "description": "The BLS ciphersuite identifier, e.g. BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_" | ||
| }, | ||
| "publicKey": { | ||
| "$ref": "#/definitions/BlsPublicKey" | ||
| }, | ||
| "tests": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "#/definitions/BlsSigVerifyTestVector" | ||
| } | ||
| } | ||
| }, | ||
| "required": ["type", "source", "ciphersuite", "publicKey", "tests"], | ||
| "additionalProperties": false | ||
| }, | ||
| "BlsPublicKey": { | ||
| "type": "object", | ||
| "properties": { | ||
| "pk": { | ||
| "type": "string", | ||
| "format": "HexBytes", | ||
| "description": "The compressed public key" | ||
| }, | ||
| "group": { | ||
| "type": "string", | ||
| "enum": ["G1", "G2"], | ||
| "description": "The group the public key belongs to" | ||
| }, | ||
| "keySize": { | ||
| "type": "integer", | ||
| "description": "The size of the public key in bytes" | ||
| } | ||
| }, | ||
| "required": ["pk", "group", "keySize"], | ||
| "additionalProperties": false | ||
| }, | ||
| "BlsSigVerifyTestVector": { | ||
| "type": "object", | ||
| "properties": { | ||
| "tcId": { | ||
| "type": "integer", | ||
| "description": "Identifier of the test case" | ||
| }, | ||
| "comment": { | ||
| "type": "string", | ||
| "description": "A brief description of the test case" | ||
| }, | ||
| "msg": { | ||
| "type": "string", | ||
| "format": "HexBytes", | ||
| "description": "The message that was signed" | ||
| }, | ||
| "sig": { | ||
| "type": "string", | ||
| "format": "HexBytes", | ||
| "description": "The BLS signature in compressed form" | ||
| }, | ||
| "result": { | ||
| "$ref": "common.json#/definitions/Result" | ||
| }, | ||
| "flags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "description": "A list of flags" | ||
| } | ||
| }, | ||
| "additionalProperties": false, | ||
| "required": ["tcId", "comment", "msg", "sig", "result", "flags"] | ||
| } | ||
| }, | ||
| "properties": { | ||
| "algorithm": { | ||
| "type": "string", | ||
| "description": "The primitive tested in the test file" | ||
| }, | ||
| "header": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "description": "Additional documentation" | ||
| }, | ||
| "notes": { | ||
| "$ref": "common.json#/definitions/Notes" | ||
| }, | ||
| "numberOfTests": { | ||
| "type": "integer", | ||
| "description": "The number of test vectors in this test" | ||
| }, | ||
| "schema": { | ||
| "enum": [ | ||
| "bls_sig_verify_schema_v1.json" | ||
| ] | ||
| }, | ||
| "testGroups": { | ||
| "type": "array", | ||
| "items": { | ||
| "$ref": "#/definitions/BlsSigVerifyTestGroup" | ||
| } | ||
| } | ||
| }, | ||
| "required": ["algorithm", "header", "notes", "numberOfTests", "schema", "testGroups"], | ||
| "additionalProperties": false | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.