REALITY config: mldsa65Seed and privateKey can not be the same value

Otherwise the point of using ML-DSA-65 is lost.
This commit is contained in:
RPRX 2025-07-26 08:36:58 +00:00 committed by GitHub
parent 10376f5b4d
commit 5f93ff6c3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -613,6 +613,9 @@ func (c *REALITYConfig) Build() (proto.Message, error) {
config.MaxTimeDiff = c.MaxTimeDiff config.MaxTimeDiff = c.MaxTimeDiff
if c.Mldsa65Seed != "" { if c.Mldsa65Seed != "" {
if c.Mldsa65Seed == c.PrivateKey {
return nil, errors.New(`"mldsa65Seed" and "privateKey" can not be the same value: `, c.Mldsa65Seed)
}
if config.Mldsa65Seed, err = base64.RawURLEncoding.DecodeString(c.Mldsa65Seed); err != nil || len(config.Mldsa65Seed) != 32 { if config.Mldsa65Seed, err = base64.RawURLEncoding.DecodeString(c.Mldsa65Seed); err != nil || len(config.Mldsa65Seed) != 32 {
return nil, errors.New(`invalid "mldsa65Seed": `, c.Mldsa65Seed) return nil, errors.New(`invalid "mldsa65Seed": `, c.Mldsa65Seed)
} }