MSP curve is hardcoded in constructor, ignoring IdemixMSPConfig.CurveId #85#86
Merged
adecaro merged 2 commits intoJul 8, 2026
Conversation
ale-linux
previously approved these changes
Jul 8, 2026
ale-linux
left a comment
Collaborator
There was a problem hiding this comment.
LGTM overall - just a couple of Qs
Comment on lines
+257
to
+265
| if msp.aries { | ||
| switch curveID { | ||
| case "", curveIDBLS12_381_BBS: | ||
| curveID = curveIDBLS12_381_BBS | ||
| case curveIDBLS12_381_BBS_GURVY: | ||
| // accepted | ||
| default: | ||
| return fmt.Errorf("setup error: aries MSP requires a BBS curve, got %q", curveID) | ||
| } |
Collaborator
There was a problem hiding this comment.
We only support these 2?
Member
Author
There was a problem hiding this comment.
if you explicitly called NewIdemixMspAries, then we enforce this because the constructor was enforcing that curve
| @@ -0,0 +1 @@ | |||
| @AGENTS.md No newline at end of file | |||
Collaborator
There was a problem hiding this comment.
is this expected? We have CLAUDE.md pointing to @AGENTS.md, and AGENTS.md whose first line is CLAUDE.md?
Comment on lines
+44
to
+45
| | `BLS12_381` | Kilic | | | ||
| | `BLS12_381_BBS` | Kilic | Default for Aries | |
Collaborator
There was a problem hiding this comment.
this is no longer correct right?
…urveId Signed-off-by: Angelo De Caro <adc@zurich.ibm.com> # Conflicts: # msp/idemixmsp.go
dc79876 to
3b51521
Compare
ale-linux
approved these changes
Jul 8, 2026
ale-linux
left a comment
Collaborator
There was a problem hiding this comment.
LGTM - please squash-merge and don't rebase :)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…urveId## Summary
Setup, driven byIdemixMSPConfig.CurveId.Setupnow enforces that the config type matches the constructor used.NewIdemixMspWithLogger/NewIdemixMspAriesWithLoggeradded for custom-logger injection.Motivation
IdemixMSPConfighas carried acurve_idstring since idemixgen began writing it, butSetupnever read the field — the curve was hardcoded per constructor. This meant loadinga config generated with
idemixgen --curve BLS12_381throughNewIdemixMspwould silentlyparse keys against the wrong curve and fail with a cryptographic error rather than a clear
message. There was also no guard against mixing a dlog constructor with an Aries config.
Changes
msp/idemixmsp.goIdemixmspstruct — two new fields:aries bool— set by the constructor to record which scheme was chosen.exportable bool— carries the (always-true) exportable flag into the deferred BCCSP build.Constructors —
NewIdemixMspandNewIdemixMspAriesno longer build a BCCSP eagerly.They return a lightweight struct and delegate to the new
WithLoggervariants:Passing
nilas the logger falls back to the default zap-based logger.curveAndTranslatorhelper — mapscurve_idstrings to(*math.Curve, Translator),mirroring the switch in
tools/idemixgen/main.go. Supported values:FP256BN_AMCL,BN254,FP256BN_AMCL_MIRACL,BLS12_377_GURVY,BLS12_381_GURVY,BLS12_381,BLS12_381_BBS,BLS12_381_BBS_GURVY.Setup— after unmarshalling the config:IDEMIX↔ dlog,IDEMIX_ARIES↔ Aries).curve_idwith per-scheme defaults and restrictions:FP256BN_AMCL.BLS12_381_BBSorBLS12_381_BBS_GURVY; empty →BLS12_381_BBS.idemix.Neworidemix.NewAries) with the resolved curve.msp/idemixmsp_test.goUpdated
TestSetupBad: the error string check for a wrong config type is relaxed to"setup error:"to match the now-more-descriptive message.README.mdAdded an "MSP Usage" section documenting the two constructors, the curve-selection
mechanism, the full
curve_idtable, and the enforcement rules.Backward compatibility
All existing callers are unaffected:
NewIdemixMsp/NewIdemixMspAriessignatures are unchanged.curve_idin a config falls back to the same curve that was previously hardcoded.