蔡佳誠
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # RIP-7212 Implementation Issue ## ETH Magician Source: https://ethereum-magicians.org/t/eip-7212-precompiled-for-secp256r1-curve-support/14789?page=5 ### Discussion - People argue that secp256r1 is not a safe ECC compared to ed25519 - Rumor has it that NSA [control](https://ethereum-magicians.org/t/eip-7212-precompiled-for-secp256r1-curve-support/14789/12) the seed for the algorithm (? - Big [tech](https://ethereum-magicians.org/t/eip-7212-precompiled-for-secp256r1-curve-support/14789/16) still use secp256r1 curve, and there is no strong evidence for the accusation. - [Interface issue](https://ethereum-magicians.org/t/eip-7212-precompiled-for-secp256r1-curve-support/14789/95) for invalid singature - ZkSync returns uint(0), while Polygon returns empty data - Root cause: EIP does not clearly specify the return value - Impact: Dev might be confused whether the failure result from nonexistent precompile or invalid signature ## Audit Finding ### Mantle Link: https://blog.openzeppelin.com/mantle-op-geth-op-stack-diff-audit#missing-signature-malleability-check > [Info] Insufficient documentation for signature malleability check **Descrption**: Missing Signature Malleability Check ECDSA signatures are inherently malleable because both `(r,s)` and `(r,−s)` are valid for the same message. To prevent this, implementations usually enforce 𝑠 ≤ 𝑁 /2, where 𝑁 is the curve order. However, the `p256Verify` precompile intentionally omits this malleability check to align with the NIST FIPS 186-5 specification, as stated in RIP-7212. The standard recommends that wrapper libraries should include the malleability check by default and clearly differentiate between functions that do or do not enforce it. **Solution** The Mantle team has explicitly documented this design decision, citing RIP-7212 as the rationale for omitting the check in the precompile. > [Info] Improved Efficiency of Input Validation **Description**: The newPublicKey function ensures that the provided (𝑥,𝑦) point: - Is not nil, nil - Lies on the P256 curve (checked via IsOnCurve(x, y)) Although it doesn't explicitly reject the point-at-infinity (0,0), this case is implicitly handled since (0,0) is not on the curve and is rejected by IsOnCurve. However, IsOnCurve is computationally expensive. To improve efficiency, it's suggested to add a preliminary range check on (𝑥,𝑦) (similar to ecrecover), verifying byte length and that the values fall within the curve’s order 𝑁. This would avoid unnecessary expensive calls to IsOnCurve for clearly invalid inputs. **Trade-off** Such a check introduces redundancy because IsOnCurve already includes these validations. Therefore, the benefit depends on how often IsOnCurve is called. Alternatively, modifying IsOnCurve to skip redundant checks could improve performance. **Recommendations**: - Consider adding a lightweight range check before calling IsOnCurve - Explicitly reject or document the implicit rejection of (0,0) for clarity ### kakarot Link: https://github.com/code-423n4/2024-09-kakarot-findings/issues/58 > [Info] p256verify precompile charges new account access gas The Kakarot EVM correctly keeps precompile addresses warm, with the goal of charging reduced "warm address access" gas for precompile calls. Because the 0x100 address is not cached, when the p256verify is called, the caller will be charged 2500 extra gas. This is also the case for the Kakarot cairo_precompile and cairo_message precompiles, however we report this impact with lower severity because unlike with p256verify there is no formal specification for these precompiles. ## Test Cases I examine all the client that uses the Wycheproof as test case, try to find out if there are additional cases added. | Project | Link | Test Case Number | |-----------|---------|------------------| | Wycheproof | [Link](https://github.com/C2SP/wycheproof/blob/main/testvectors/ecdsa_secp256r1_sha256_test.json) | 387 | | Go-eth | [Link](https://github.com/ethereum/go-ethereum/pull/27540) | 781 | | Op-Geth | [Link](https://github.com/mdehoog/op-geth/blob/1aa4e22e506592ea22a3cc1e5f9e785208524ebc/core/vm/testdata/precompiles/p256Verify.json) | 781 | | Polygon | [Link](https://github.com/erigontech/erigon/pull/8975/files) | 5 (???) | | Scroll | [Link](https://github.com/scroll-tech/go-ethereum/blob/91262060b77d99303c2af9bf93f5daadc8cab558/core/vm/testdata/precompiles/p256Verify.json) | 781 | | Daimo | [Link](https://github.com/daimo-eth/p256-verifier/blob/master/test-vectors/vectors_wycheproof.jsonl) | 778 |

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully