Skip to content
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

k256: add Wycheproof test data #384

Merged
merged 1 commit into from
Jul 22, 2021

Conversation

daviddrysdale
Copy link
Contributor

No description provided.

@tarcieri
Copy link
Member

@daviddrysdale do you know offhand which vectors are failing (i.e. what is the description of the case being tested)?

@daviddrysdale
Copy link
Contributor Author

comment:

                    // - ECDSA case 304 [valid] edge case for signature malleability
                    // - ECDSA case 305 [valid] edge case for signature malleability

@daviddrysdale
Copy link
Contributor Author

daviddrysdale commented Jul 19, 2021

Original JSON fragment:

    {
      "key" : {
        "curve" : "secp256k1",
        "keySize" : 256,
        "type" : "EcPublicKey",
        "uncompressed" : "043a3150798c8af69d1e6e981f3a45402ba1d732f4be8330c5164f49e10ec555b4221bd842bc5e4d97eff37165f60e3998a424d72a450cf95ea477c78287d0343a",
        "wx" : "3a3150798c8af69d1e6e981f3a45402ba1d732f4be8330c5164f49e10ec555b4",
        "wy" : "221bd842bc5e4d97eff37165f60e3998a424d72a450cf95ea477c78287d0343a"
      },
      "keyDer" : "3056301006072a8648ce3d020106052b8104000a034200043a3150798c8af69d1e6e981f3a45402ba1d732f4be8330c5164f49e10ec555b4221bd842bc5e4d97eff37165f60e3998a424d72a450cf95ea477c78287d0343a",
      "keyPem" : "-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEOjFQeYyK9p0ebpgfOkVAK6HXMvS+gzDF\nFk9J4Q7FVbQiG9hCvF5Nl+/zcWX2DjmYpCTXKkUM+V6kd8eCh9A0Og==\n-----END PUBLIC KEY-----",
      "sha" : "SHA-256",
      "type" : "EcdsaVerify",
      "tests" : [
        {
          "tcId" : 304,
          "comment" : "edge case for signature malleability",
          "msg" : "313233343030",
          "sig" : "304402207fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a002207fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",
          "result" : "valid",
          "flags" : []
        }
      ]
    },
    {
      "key" : {
        "curve" : "secp256k1",
        "keySize" : 256,
        "type" : "EcPublicKey",
        "uncompressed" : "043b37df5fb347c69a0f17d85c0c7ca83736883a825e13143d0fcfc8101e851e800de3c090b6ca21ba543517330c04b12f948c6badf14a63abffdf4ef8c7537026",
        "wx" : "3b37df5fb347c69a0f17d85c0c7ca83736883a825e13143d0fcfc8101e851e80",
        "wy" : "0de3c090b6ca21ba543517330c04b12f948c6badf14a63abffdf4ef8c7537026"
      },
      "keyDer" : "3056301006072a8648ce3d020106052b8104000a034200043b37df5fb347c69a0f17d85c0c7ca83736883a825e13143d0fcfc8101e851e800de3c090b6ca21ba543517330c04b12f948c6badf14a63abffdf4ef8c7537026",
      "keyPem" : "-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEOzffX7NHxpoPF9hcDHyoNzaIOoJeExQ9\nD8/IEB6FHoAN48CQtsohulQ1FzMMBLEvlIxrrfFKY6v/3074x1NwJg==\n-----END PUBLIC KEY-----",
      "sha" : "SHA-256",
      "type" : "EcdsaVerify",
      "tests" : [
        {
          "tcId" : 305,
          "comment" : "edge case for signature malleability",
          "msg" : "313233343030",
          "sig" : "304402207fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a002207fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1",
          "result" : "valid",
          "flags" : []
        }
      ]
    },

@tarcieri
Copy link
Member

Interesting

@daviddrysdale
Copy link
Contributor Author

Looks like CI fails at least one extra test case compared to my local (macOS x86) box.

@tarcieri
Copy link
Member

I'll go ahead and extract those as some unit/regression tests and see if I can find the issue.

@tarcieri
Copy link
Member

Some notes on this...

The first example (tcId: 304) has an s-component equal to the scalar modulus / 2, namely:

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0

Per BIP62 rules this should be valid:

https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki#Low_S_values_in_signatures

The value S in signatures must be between 0x1 and 0x7FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 5D576E73 57A4501D DFE92F46 681B20A0 (inclusive).

...however it is being rejected, so it seems this is being mishandled.

The second signature (tcId: 305) has an s-component equal to the scalar modulus / 2 + 1, namely:

7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1

This is outside of the range allowed under low-s normalization, so I'm confused why it says "result" : "valid", but also a bit confused why there would even be tests for malleability if they weren't using low-s normalization rules to begin with.

k256/src/ecdsa.rs Outdated Show resolved Hide resolved
@tarcieri
Copy link
Member

I opened #385 to fix the first test case.

I'm confused why these would be failing if they were low-S normalized. In #385 I made explicit regression tests cases for both and confirmed they were passing if explicitly normalized (but deleted tc: 305 as it's expected to be rejected).

@tarcieri
Copy link
Member

@daviddrysdale just landed #385 if you want to try rebasing, although I would expect both of those cases to have succeeded if the signature was low-S normalized even before that.

I also made a line note about a slightly more straightforward way to ensure the signature is normalized. That might help.

@codecov-commenter
Copy link

Codecov Report

Merging #384 (3f1a302) into master (3640681) will increase coverage by 0.25%.
The diff coverage is 90.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #384      +/-   ##
==========================================
+ Coverage   58.44%   58.70%   +0.25%     
==========================================
  Files          29       29              
  Lines        4096     4129      +33     
==========================================
+ Hits         2394     2424      +30     
- Misses       1702     1705       +3     
Impacted Files Coverage Δ
k256/src/ecdsa.rs 90.00% <90.90%> (+4.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3640681...3f1a302. Read the comment docs.

@tarcieri
Copy link
Member

@daviddrysdale which one is failing now? it looks like a different signature than the previous two

@daviddrysdale
Copy link
Contributor Author

I think the CI failure is this one:

    {
      "key" : {
        "curve" : "secp256k1",
        "keySize" : 256,
        "type" : "EcPublicKey",
        "uncompressed" : "04464f4ff715729cae5072ca3bd801d3195b67aec65e9b01aad20a2943dcbcb584b1afd29d31a39a11d570aa1597439b3b2d1971bf2f1abf15432d0207b10d1d08",
        "wx" : "464f4ff715729cae5072ca3bd801d3195b67aec65e9b01aad20a2943dcbcb584",
        "wy" : "00b1afd29d31a39a11d570aa1597439b3b2d1971bf2f1abf15432d0207b10d1d08"
      },
      "keyDer" : "3056301006072a8648ce3d020106052b8104000a03420004464f4ff715729cae5072ca3bd801d3195b67aec65e9b01aad20a2943dcbcb584b1afd29d31a39a11d570aa1597439b3b2d1971bf2f1abf15432d0207b10d1d08",
      "keyPem" : "-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAERk9P9xVynK5Qcso72AHTGVtnrsZemwGq\n0gopQ9y8tYSxr9KdMaOaEdVwqhWXQ5s7LRlxvy8avxVDLQIHsQ0dCA==\n-----END PUBLIC KEY-----",
      "sha" : "SHA-256",
      "type" : "EcdsaVerify",
      "tests" : [
        {
          "tcId" : 296,
          "comment" : "smallish r and s^-1",
          "msg" : "313233343030",
          "sig" : "302c02072d9b4d347952cc022100fcbc5103d0da267477d1791461cf2aa44bf9d43198f79507bd8779d69a13108e",
          "result" : "valid",
          "flags" : []
        }
      ]
    },

(BTW, the test passes for me on Linux and macOS, both x86_64)

@daviddrysdale
Copy link
Contributor Author

Test 294 / tcId=296 seems to be the only failure, and it only fails with --target i686-unknown-linux-gnu – x86_64 passes.

@tarcieri
Copy link
Member

Looks like this caught a legitimate bug in the 32-bit field arithmetic backend. It's triggering a debug assert during lazy normalization.

Thanks for the help @daviddrysdale!

@tarcieri
Copy link
Member

Opened #386 which adds that test vector in isolation.

@tarcieri
Copy link
Member

Note: #388 should address the bug caught by tcId=296

@tarcieri
Copy link
Member

tarcieri commented Jul 21, 2021

@daviddrysdale I think #388 should address the only remaining test failure.

Can you rebase?

Generated with the tool from RustCrypto/utils#280
using:
  cargo run ~/src/tink-rust/wycheproof/ secp256k1 0 secp256k1.blb secp256k1.txt

This uses a manual expansion of the new_wycheproof_test! macro because an
extra call to normalize_s() is needed.

Contents of secp256k1.txt:

ECDSA case 1 [valid] signature malleability
ECDSA case 3 [valid] valid
ECDSA case 4 [invalid] long form encoding of length of sequence
ECDSA case 5 [invalid] length of sequence contains leading 0
ECDSA case 6 [invalid] wrong length of sequence
ECDSA case 7 [invalid] wrong length of sequence
ECDSA case 8 [invalid] uint32 overflow in length of sequence
ECDSA case 9 [invalid] uint64 overflow in length of sequence
ECDSA case 10 [invalid] length of sequence = 2**31 - 1
ECDSA case 11 [invalid] length of sequence = 2**32 - 1
ECDSA case 12 [invalid] length of sequence = 2**40 - 1
ECDSA case 13 [invalid] length of sequence = 2**64 - 1
ECDSA case 14 [invalid] incorrect length of sequence
ECDSA case 15 [invalid] indefinite length without termination
ECDSA case 16 [invalid] indefinite length without termination
ECDSA case 17 [invalid] indefinite length without termination
ECDSA case 18 [invalid] removing sequence
ECDSA case 19 [invalid] lonely sequence tag
ECDSA case 20 [invalid] appending 0's to sequence
ECDSA case 21 [invalid] prepending 0's to sequence
ECDSA case 22 [invalid] appending unused 0's to sequence
ECDSA case 23 [invalid] appending null value to sequence
ECDSA case 24 [invalid] including garbage
ECDSA case 25 [invalid] including garbage
ECDSA case 26 [invalid] including garbage
ECDSA case 27 [invalid] including garbage
ECDSA case 28 [invalid] including garbage
ECDSA case 29 [invalid] including garbage
ECDSA case 30 [invalid] including garbage
ECDSA case 31 [invalid] including garbage
ECDSA case 32 [invalid] including garbage
ECDSA case 33 [invalid] including undefined tags
ECDSA case 34 [invalid] including undefined tags
ECDSA case 35 [invalid] including undefined tags
ECDSA case 36 [invalid] including undefined tags
ECDSA case 37 [invalid] including undefined tags
ECDSA case 38 [invalid] including undefined tags
ECDSA case 39 [invalid] truncated length of sequence
ECDSA case 40 [invalid] using composition with indefinite length
ECDSA case 41 [invalid] using composition with indefinite length
ECDSA case 42 [invalid] using composition with indefinite length
ECDSA case 43 [invalid] using composition with wrong tag
ECDSA case 44 [invalid] using composition with wrong tag
ECDSA case 45 [invalid] using composition with wrong tag
ECDSA case 46 [invalid] Replacing sequence with NULL
ECDSA case 47 [invalid] changing tag value of sequence
ECDSA case 48 [invalid] changing tag value of sequence
ECDSA case 49 [invalid] changing tag value of sequence
ECDSA case 50 [invalid] changing tag value of sequence
ECDSA case 51 [invalid] changing tag value of sequence
ECDSA case 52 [invalid] dropping value of sequence
ECDSA case 53 [invalid] using composition for sequence
ECDSA case 54 [invalid] truncated sequence
ECDSA case 55 [invalid] truncated sequence
ECDSA case 56 [invalid] indefinite length
ECDSA case 57 [invalid] indefinite length with truncated delimiter
ECDSA case 58 [invalid] indefinite length with additional element
ECDSA case 59 [invalid] indefinite length with truncated element
ECDSA case 60 [invalid] indefinite length with garbage
ECDSA case 61 [invalid] indefinite length with nonempty EOC
ECDSA case 62 [invalid] prepend empty sequence
ECDSA case 63 [invalid] append empty sequence
ECDSA case 64 [invalid] append garbage with high tag number
ECDSA case 65 [invalid] sequence of sequence
ECDSA case 66 [invalid] truncated sequence: removed last 1 elements
ECDSA case 67 [invalid] repeating element in sequence
ECDSA case 68 [invalid] long form encoding of length of integer
ECDSA case 69 [invalid] long form encoding of length of integer
ECDSA case 70 [invalid] length of integer contains leading 0
ECDSA case 71 [invalid] length of integer contains leading 0
ECDSA case 72 [invalid] wrong length of integer
ECDSA case 73 [invalid] wrong length of integer
ECDSA case 74 [invalid] wrong length of integer
ECDSA case 75 [invalid] wrong length of integer
ECDSA case 76 [invalid] uint32 overflow in length of integer
ECDSA case 77 [invalid] uint32 overflow in length of integer
ECDSA case 78 [invalid] uint64 overflow in length of integer
ECDSA case 79 [invalid] uint64 overflow in length of integer
ECDSA case 80 [invalid] length of integer = 2**31 - 1
ECDSA case 81 [invalid] length of integer = 2**31 - 1
ECDSA case 82 [invalid] length of integer = 2**32 - 1
ECDSA case 83 [invalid] length of integer = 2**32 - 1
ECDSA case 84 [invalid] length of integer = 2**40 - 1
ECDSA case 85 [invalid] length of integer = 2**40 - 1
ECDSA case 86 [invalid] length of integer = 2**64 - 1
ECDSA case 87 [invalid] length of integer = 2**64 - 1
ECDSA case 88 [invalid] incorrect length of integer
ECDSA case 89 [invalid] incorrect length of integer
ECDSA case 90 [invalid] removing integer
ECDSA case 91 [invalid] lonely integer tag
ECDSA case 92 [invalid] lonely integer tag
ECDSA case 93 [invalid] appending 0's to integer
ECDSA case 94 [invalid] appending 0's to integer
ECDSA case 95 [invalid] prepending 0's to integer
ECDSA case 96 [invalid] prepending 0's to integer
ECDSA case 97 [invalid] appending unused 0's to integer
ECDSA case 98 [invalid] appending null value to integer
ECDSA case 99 [invalid] appending null value to integer
ECDSA case 100 [invalid] truncated length of integer
ECDSA case 101 [invalid] truncated length of integer
ECDSA case 102 [invalid] Replacing integer with NULL
ECDSA case 103 [invalid] Replacing integer with NULL
ECDSA case 104 [invalid] changing tag value of integer
ECDSA case 105 [invalid] changing tag value of integer
ECDSA case 106 [invalid] changing tag value of integer
ECDSA case 107 [invalid] changing tag value of integer
ECDSA case 108 [invalid] changing tag value of integer
ECDSA case 109 [invalid] changing tag value of integer
ECDSA case 110 [invalid] changing tag value of integer
ECDSA case 111 [invalid] changing tag value of integer
ECDSA case 112 [invalid] changing tag value of integer
ECDSA case 113 [invalid] changing tag value of integer
ECDSA case 114 [invalid] dropping value of integer
ECDSA case 115 [invalid] dropping value of integer
ECDSA case 116 [invalid] using composition for integer
ECDSA case 117 [invalid] using composition for integer
ECDSA case 118 [invalid] modify first byte of integer
ECDSA case 119 [invalid] modify first byte of integer
ECDSA case 120 [invalid] modify last byte of integer
ECDSA case 121 [invalid] modify last byte of integer
ECDSA case 122 [invalid] truncated integer
ECDSA case 123 [invalid] truncated integer
ECDSA case 124 [invalid] truncated integer
ECDSA case 125 [invalid] leading ff in integer
ECDSA case 126 [invalid] leading ff in integer
ECDSA case 127 [invalid] replaced integer by infinity
ECDSA case 128 [invalid] replaced integer by infinity
ECDSA case 129 [invalid] replacing integer with zero
ECDSA case 130 [invalid] replacing integer with zero
ECDSA case 131 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 132 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 133 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 134 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 135 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 136 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 137 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 138 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 139 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 140 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 141 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 142 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 143 [invalid] Modified r or s, e.g. by adding or subtracting the order of the group
ECDSA case 144 [invalid] Signature with special case values for r and s
ECDSA case 145 [invalid] Signature with special case values for r and s
ECDSA case 146 [invalid] Signature with special case values for r and s
ECDSA case 147 [invalid] Signature with special case values for r and s
ECDSA case 148 [invalid] Signature with special case values for r and s
ECDSA case 149 [invalid] Signature with special case values for r and s
ECDSA case 150 [invalid] Signature with special case values for r and s
ECDSA case 151 [invalid] Signature with special case values for r and s
ECDSA case 152 [invalid] Signature with special case values for r and s
ECDSA case 153 [invalid] Signature with special case values for r and s
ECDSA case 154 [invalid] Signature with special case values for r and s
ECDSA case 155 [invalid] Signature with special case values for r and s
ECDSA case 156 [invalid] Signature with special case values for r and s
ECDSA case 157 [invalid] Signature with special case values for r and s
ECDSA case 158 [invalid] Signature with special case values for r and s
ECDSA case 159 [invalid] Signature with special case values for r and s
ECDSA case 160 [invalid] Signature with special case values for r and s
ECDSA case 161 [invalid] Signature with special case values for r and s
ECDSA case 162 [invalid] Signature with special case values for r and s
ECDSA case 163 [invalid] Signature with special case values for r and s
ECDSA case 164 [invalid] Signature with special case values for r and s
ECDSA case 165 [invalid] Signature with special case values for r and s
ECDSA case 166 [invalid] Signature with special case values for r and s
ECDSA case 167 [invalid] Signature with special case values for r and s
ECDSA case 168 [invalid] Signature with special case values for r and s
ECDSA case 169 [invalid] Signature with special case values for r and s
ECDSA case 170 [invalid] Signature with special case values for r and s
ECDSA case 171 [invalid] Signature with special case values for r and s
ECDSA case 172 [invalid] Signature with special case values for r and s
ECDSA case 173 [invalid] Signature with special case values for r and s
ECDSA case 174 [invalid] Signature with special case values for r and s
ECDSA case 175 [invalid] Signature with special case values for r and s
ECDSA case 176 [invalid] Signature with special case values for r and s
ECDSA case 177 [invalid] Signature with special case values for r and s
ECDSA case 178 [invalid] Signature with special case values for r and s
ECDSA case 179 [invalid] Signature with special case values for r and s
ECDSA case 180 [invalid] Signature with special case values for r and s
ECDSA case 181 [invalid] Signature with special case values for r and s
ECDSA case 182 [invalid] Signature with special case values for r and s
ECDSA case 183 [invalid] Signature with special case values for r and s
ECDSA case 184 [invalid] Signature with special case values for r and s
ECDSA case 185 [invalid] Signature with special case values for r and s
ECDSA case 186 [invalid] Signature with special case values for r and s
ECDSA case 187 [invalid] Signature with special case values for r and s
ECDSA case 188 [invalid] Signature with special case values for r and s
ECDSA case 189 [invalid] Signature with special case values for r and s
ECDSA case 190 [invalid] Signature with special case values for r and s
ECDSA case 191 [invalid] Signature with special case values for r and s
ECDSA case 192 [invalid] Signature with special case values for r and s
ECDSA case 193 [invalid] Signature with special case values for r and s
ECDSA case 194 [invalid] Signature with special case values for r and s
ECDSA case 195 [invalid] Signature with special case values for r and s
ECDSA case 196 [invalid] Signature with special case values for r and s
ECDSA case 197 [invalid] Signature with special case values for r and s
ECDSA case 198 [invalid] Signature with special case values for r and s
ECDSA case 199 [invalid] Signature with special case values for r and s
ECDSA case 200 [invalid] Signature with special case values for r and s
ECDSA case 201 [invalid] Signature with special case values for r and s
ECDSA case 202 [invalid] Signature with special case values for r and s
ECDSA case 203 [invalid] Signature with special case values for r and s
ECDSA case 204 [invalid] Signature with special case values for r and s
ECDSA case 205 [invalid] Signature with special case values for r and s
ECDSA case 206 [invalid] Signature with special case values for r and s
ECDSA case 207 [invalid] Signature with special case values for r and s
ECDSA case 208 [invalid] Signature with special case values for r and s
ECDSA case 209 [invalid] Signature with special case values for r and s
ECDSA case 210 [invalid] Signature with special case values for r and s
ECDSA case 211 [invalid] Signature with special case values for r and s
ECDSA case 212 [invalid] Signature with special case values for r and s
ECDSA case 213 [invalid] Signature with special case values for r and s
ECDSA case 214 [invalid] Signature with special case values for r and s
ECDSA case 215 [invalid] Signature with special case values for r and s
ECDSA case 216 [invalid] Signature with special case values for r and s
ECDSA case 217 [invalid] Signature with special case values for r and s
ECDSA case 218 [invalid] Signature with special case values for r and s
ECDSA case 219 [invalid] Signature with special case values for r and s
ECDSA case 220 [invalid] Signature with special case values for r and s
ECDSA case 221 [invalid] Signature with special case values for r and s
ECDSA case 222 [invalid] Signature with special case values for r and s
ECDSA case 223 [invalid] Signature with special case values for r and s
ECDSA case 224 [invalid] Signature encoding contains wrong types.
ECDSA case 225 [invalid] Signature encoding contains wrong types.
ECDSA case 226 [invalid] Signature encoding contains wrong types.
ECDSA case 227 [invalid] Signature encoding contains wrong types.
ECDSA case 228 [invalid] Signature encoding contains wrong types.
ECDSA case 229 [invalid] Signature encoding contains wrong types.
ECDSA case 230 [valid] Edge case for Shamir multiplication
ECDSA case 231 [valid] special case hash
ECDSA case 232 [valid] special case hash
ECDSA case 233 [valid] special case hash
ECDSA case 234 [valid] special case hash
ECDSA case 235 [valid] special case hash
ECDSA case 236 [valid] special case hash
ECDSA case 237 [valid] special case hash
ECDSA case 238 [valid] special case hash
ECDSA case 239 [valid] special case hash
ECDSA case 240 [valid] special case hash
ECDSA case 241 [valid] special case hash
ECDSA case 242 [valid] special case hash
ECDSA case 243 [valid] special case hash
ECDSA case 244 [valid] special case hash
ECDSA case 245 [valid] special case hash
ECDSA case 246 [valid] special case hash
ECDSA case 247 [valid] special case hash
ECDSA case 248 [valid] special case hash
ECDSA case 249 [valid] special case hash
ECDSA case 250 [valid] special case hash
ECDSA case 251 [valid] special case hash
ECDSA case 252 [valid] special case hash
ECDSA case 253 [valid] special case hash
ECDSA case 254 [valid] special case hash
ECDSA case 255 [valid] special case hash
ECDSA case 256 [valid] special case hash
ECDSA case 257 [valid] special case hash
ECDSA case 258 [valid] special case hash
ECDSA case 259 [valid] special case hash
ECDSA case 260 [valid] special case hash
ECDSA case 261 [valid] special case hash
ECDSA case 262 [valid] special case hash
ECDSA case 263 [valid] special case hash
ECDSA case 264 [valid] special case hash
ECDSA case 265 [valid] special case hash
ECDSA case 266 [valid] special case hash
ECDSA case 267 [valid] special case hash
ECDSA case 268 [valid] special case hash
ECDSA case 269 [valid] special case hash
ECDSA case 270 [valid] special case hash
ECDSA case 271 [valid] special case hash
ECDSA case 272 [valid] special case hash
ECDSA case 273 [valid] special case hash
ECDSA case 274 [valid] special case hash
ECDSA case 275 [valid] special case hash
ECDSA case 276 [valid] special case hash
ECDSA case 277 [valid] special case hash
ECDSA case 278 [valid] special case hash
ECDSA case 279 [valid] special case hash
ECDSA case 280 [valid] special case hash
ECDSA case 281 [valid] special case hash
ECDSA case 282 [valid] special case hash
ECDSA case 283 [valid] special case hash
ECDSA case 284 [valid] special case hash
ECDSA case 285 [valid] k*G has a large x-coordinate
ECDSA case 286 [invalid] r too large
ECDSA case 287 [valid] r,s are large
ECDSA case 288 [valid] r and s^-1 have a large Hamming weight
ECDSA case 289 [valid] r and s^-1 have a large Hamming weight
ECDSA case 290 [valid] small r and s
ECDSA case 291 [valid] small r and s
ECDSA case 292 [valid] small r and s
ECDSA case 293 [invalid] r is larger than n
ECDSA case 294 [invalid] s is larger than n
ECDSA case 295 [valid] small r and s^-1
ECDSA case 296 [valid] smallish r and s^-1
ECDSA case 297 [valid] 100-bit r and small s^-1
ECDSA case 298 [valid] small r and 100 bit s^-1
ECDSA case 299 [valid] 100-bit r and s^-1
ECDSA case 300 [valid] r and s^-1 are close to n
ECDSA case 301 [valid] s == 1
ECDSA case 302 [invalid] s == 0
ECDSA case 303 [invalid] point at infinity during verify
ECDSA case 304 [valid] edge case for signature malleability
ECDSA case 305 [valid] edge case for signature malleability
ECDSA case 306 [valid] u1 == 1
ECDSA case 307 [valid] u1 == n - 1
ECDSA case 308 [valid] u2 == 1
ECDSA case 309 [valid] u2 == n - 1
ECDSA case 310 [valid] edge case for u1
ECDSA case 311 [valid] edge case for u1
ECDSA case 312 [valid] edge case for u1
ECDSA case 313 [valid] edge case for u1
ECDSA case 314 [valid] edge case for u1
ECDSA case 315 [valid] edge case for u1
ECDSA case 316 [valid] edge case for u1
ECDSA case 317 [valid] edge case for u1
ECDSA case 318 [valid] edge case for u1
ECDSA case 319 [valid] edge case for u1
ECDSA case 320 [valid] edge case for u1
ECDSA case 321 [valid] edge case for u1
ECDSA case 322 [valid] edge case for u1
ECDSA case 323 [valid] edge case for u1
ECDSA case 324 [valid] edge case for u1
ECDSA case 325 [valid] edge case for u2
ECDSA case 326 [valid] edge case for u2
ECDSA case 327 [valid] edge case for u2
ECDSA case 328 [valid] edge case for u2
ECDSA case 329 [valid] edge case for u2
ECDSA case 330 [valid] edge case for u2
ECDSA case 331 [valid] edge case for u2
ECDSA case 332 [valid] edge case for u2
ECDSA case 333 [valid] edge case for u2
ECDSA case 334 [valid] edge case for u2
ECDSA case 335 [valid] edge case for u2
ECDSA case 336 [valid] edge case for u2
ECDSA case 337 [valid] edge case for u2
ECDSA case 338 [valid] edge case for u2
ECDSA case 339 [valid] edge case for u2
ECDSA case 340 [valid] point duplication during verification
ECDSA case 341 [invalid] duplication bug
ECDSA case 342 [invalid] comparison with point at infinity
ECDSA case 343 [valid] extreme value for k and edgecase s
ECDSA case 344 [valid] extreme value for k and s^-1
ECDSA case 345 [valid] extreme value for k and s^-1
ECDSA case 346 [valid] extreme value for k and s^-1
ECDSA case 347 [valid] extreme value for k and s^-1
ECDSA case 348 [valid] extreme value for k
ECDSA case 349 [valid] extreme value for k and edgecase s
ECDSA case 350 [valid] extreme value for k and s^-1
ECDSA case 351 [valid] extreme value for k and s^-1
ECDSA case 352 [valid] extreme value for k and s^-1
ECDSA case 353 [valid] extreme value for k and s^-1
ECDSA case 354 [valid] extreme value for k
ECDSA case 355 [invalid] testing point duplication
ECDSA case 356 [invalid] testing point duplication
ECDSA case 357 [invalid] testing point duplication
ECDSA case 358 [invalid] testing point duplication
ECDSA case 359 [valid] pseudorandom signature
ECDSA case 360 [valid] pseudorandom signature
ECDSA case 361 [valid] pseudorandom signature
ECDSA case 362 [valid] pseudorandom signature
ECDSA case 363 [valid] y-coordinate of the public key is small
ECDSA case 364 [valid] y-coordinate of the public key is small
ECDSA case 365 [valid] y-coordinate of the public key is small
ECDSA case 366 [valid] y-coordinate of the public key is large
ECDSA case 367 [valid] y-coordinate of the public key is large
ECDSA case 368 [valid] y-coordinate of the public key is large
ECDSA case 369 [valid] x-coordinate of the public key is small
ECDSA case 370 [valid] x-coordinate of the public key is small
ECDSA case 371 [valid] x-coordinate of the public key is small
ECDSA case 372 [valid] x-coordinate of the public key has many trailing 1's
ECDSA case 373 [valid] x-coordinate of the public key has many trailing 1's
ECDSA case 374 [valid] x-coordinate of the public key has many trailing 1's
ECDSA case 375 [valid] y-coordinate of the public key has many trailing 1's
ECDSA case 376 [valid] y-coordinate of the public key has many trailing 1's
ECDSA case 377 [valid] y-coordinate of the public key has many trailing 1's
ECDSA case 378 [valid] x-coordinate of the public key has many trailing 0's
ECDSA case 379 [valid] x-coordinate of the public key has many trailing 0's
ECDSA case 380 [valid] x-coordinate of the public key has many trailing 0's
@daviddrysdale daviddrysdale marked this pull request as ready for review July 22, 2021 06:56
@daviddrysdale daviddrysdale changed the title [WIP] Add Wycheproof test data Add Wycheproof test data Jul 22, 2021
@tarcieri
Copy link
Member

Nice, looks like everything is passing now

@daviddrysdale
Copy link
Contributor Author

Is it worth updating the new_wycheproof_test! macro to always normalize_s()?

@tarcieri
Copy link
Member

For now, at least, it will only work with k256.

I can look at making it work with p256 as well.

@tarcieri tarcieri merged commit fe3e1e4 into RustCrypto:master Jul 22, 2021
@tarcieri
Copy link
Member

Thank you!

@tarcieri tarcieri mentioned this pull request Jul 22, 2021
@daviddrysdale daviddrysdale deleted the k256-wycheproof branch July 22, 2021 13:57
@tarcieri tarcieri changed the title Add Wycheproof test data k256: add Wycheproof test data Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants