• Contact Us
  • Privacy Policy
  • Terms of Use
  • DMCA
  • Disclaimer
Tuesday, November 26, 2024
CryptoBangs.com
Advertisement
  • Home
  • Live Crypto Prices
  • Crypto News
    • Bitcoin
    • Ethereum
    • Ripple
    • Altcoin
    • NFT News
  • DeFi
  • Blockchain
  • Regulation
  • Shop
  • Blog
  • Calculator
No Result
View All Result
  • Home
  • Live Crypto Prices
  • Crypto News
    • Bitcoin
    • Ethereum
    • Ripple
    • Altcoin
    • NFT News
  • DeFi
  • Blockchain
  • Regulation
  • Shop
  • Blog
  • Calculator
No Result
View All Result
CryptoBangs.com
No Result
View All Result

Safegcd’s Implementation Formally Verified

November 25, 2024
in Bitcoin
Reading Time: 4 mins read
A A
Safegcd’s Implementation Formally Verified
ShareShareShareShareShare

Introduction

The security of Bitcoin, and other blockchains, such as Liquid, hinges on the use of digital signatures algorithms such as ECDSA and Schnorr signatures. A C library called libsecp256k1, named after the elliptic curve that the library operates on, is used by both Bitcoin Core and Liquid, to provide these digital signature algorithms. These algorithms make use of a mathematical computation called a modular inverse, which is a relatively expensive component of the computation.

Related articles

Bitcoin To Smash $100,000? Rapid Stablecoin Exchange Inflows Continue

Bitcoin To Smash $100,000? Rapid Stablecoin Exchange Inflows Continue

November 25, 2024
Can BTC Hit Six Digits? Exploring Bitcoin’s $100K Predictions With Kalshi and Polymarket Insights

Can BTC Hit Six Digits? Exploring Bitcoin’s $100K Predictions With Kalshi and Polymarket Insights

November 25, 2024

In “Fast constant-time gcd computation and modular inversion,” Daniel J. Bernstein and Bo-Yin Yang develop a new modular inversion algorithm. In 2021, this algorithm, referred to as “safegcd,” was implemented for libsecp256k1 by Peter Dettman. As part of the vetting process for this novel algorithm, Blockstream Research was the first to complete a formal verification of the algorithm’s design by using the Coq proof assistant to formally verify that the algorithm does indeed terminate with the correct modular inverse result on 256-bit inputs.

The Gap between Algorithm and Implementation

The formalization effort in 2021 only showed that the algorithm designed by Bernstein and Yang works correctly. However, using that algorithm in libsecp256k1 requires implementing the mathematical description of the safegcd algorithm within the C programming language. For example, the mathematical description of the algorithm performs matrix multiplication of vectors that can be as wide as 256 bit signed integers, however the C programming language will only natively provide integers up to 64 bits (or 128 bits with some language extensions).

Implementing the safegcd algorithm requires programming the matrix multiplication and other computations using C’s 64 bit integers. Additionally, many other optimizations have been added to make the implementation fast. In the end, there are four separate implementations of the safegcd algorithm in libsecp256k1: two constant time algorithms for signature generation, one optimized for 32-bit systems and one optimized for 64-bit systems, and two variable time algorithms for signature verification, again one for 32-bit systems and one for 64-bit systems.

Verifiable C

In order to verify the C code correctly implements the safegcd algorithm, all the implementation details must be checked. We use Verifiable C, part of the Verified Software Toolchain for reasoning about C code using the Coq theorem prover.

Verification proceeds by specifying preconditions and postconditions using separation logic for every function undergoing verification. Separation logic is a logic specialized for reasoning about subroutines, memory allocations, concurrency and more.

Once each function is given a specification, verification proceeds by starting from a function’s precondition, and establishing a new invariant after each statement in the body of the function, until finally establishing the post condition at the end of the function body or the end of each return statement. Most of the formalization effort is spent “between” the lines of code, using the invariants to translate the raw operations of each C expression into higher level statements about what the data structures being manipulated represent mathematically. For example, what the C language regards as an array of 64-bit integers may actually be a representation of a 256-bit integer.

The end result is a formal proof, verified by the Coq proof assistant, that libsecp256k1’s 64-bit variable time implementation of the safegcd modular inverse algorithm is functionally correct.

Limitations of the Verification

There are some limitations to the functional correctness proof. The separation logic used in Verifiable C implements what is known as partial correctness. That means it only proves the C code returns with the correct result if it returns, but it doesn’t prove termination itself. We mitigate this limitation by using our previous Coq proof of the bounds on the safegcd algorithm to prove that the loop counter value of the main loop in fact never exceeds 11 iterations.

Another issue is that the C language itself has no formal specification. Instead the Verifiable C project uses the CompCert compiler project to provide a formal specification of a C language. This guarantees that when a verified C program is compiled with the CompCert compiler, the resulting assembly code will meet its specification (subject to the above limitation). However this doesn’t guarantee that the code generated by GCC, clang, or any other compiler will necessarily work. For example, C compilers are allowed to have different evaluation orders for arguments within a function call. And even if the C language had a formal specification any compiler that isn’t itself formally verified could still miscompile programs. This does occur in practice.

Lastly, Verifiable C doesn’t support passing structures, returning structures or assigning structures. While in libsecp256k1, structures are always passed by pointer (which is allowed in Verifiable C), there are a few occasions where structure assignment is used. For the modular inverse correctness proof, there were 3 assignments that had to be replaced by a specialized function call that performs the structure assignment field by field.

Summary

Blockstream Research has formally verified the correctness of libsecp256k1’s modular inverse function. This work provides further evidence that verification of C code is possible in practice. Using a general purpose proof assistant allows us to verify software built upon complex mathematical arguments.

Nothing prevents the rest of the functions implemented in libsecp256k1 from being verified as well. Thus it is possible for libsecp256k1 to obtain the highest possible software correctness guarantees.

This is a guest post by Russell O’Connor and Andrew Poelstra. Opinions expressed are entirely their own and do not necessarily reflect those of BTC Inc or Bitcoin Magazine.

Credit: Source link

ShareTweetSendPinShare
Previous Post

What $100 in Dogecoin Today Could Turn Into

Next Post

Python Audio Transcription Enhanced with AssemblyAI’s Universal-1

Related Posts

Bitcoin To Smash $100,000? Rapid Stablecoin Exchange Inflows Continue

Bitcoin To Smash $100,000? Rapid Stablecoin Exchange Inflows Continue

November 25, 2024

Este artículo también está disponible en español. On-chain data shows exchanges have continued to receive stablecoin deposits recently, a sign...

Can BTC Hit Six Digits? Exploring Bitcoin’s $100K Predictions With Kalshi and Polymarket Insights

Can BTC Hit Six Digits? Exploring Bitcoin’s $100K Predictions With Kalshi and Polymarket Insights

November 25, 2024

As bitcoin (BTC) trades under the $96,000 mark at 1 p.m. ET on Monday, prediction markets Kalshi and Polymarket reveal...

Dogecoin Price To $1.2 In 10-15 Days? What The Bull Pennant Says

Dogecoin Price To $1.2 In 10-15 Days? What The Bull Pennant Says

November 25, 2024

Recent movements of the Dogecoin price have seen the meme cryptocurrency breaking to the upside of a bull flag pattern....

Stellar Shines: XLM Rockets 180% In Just One Week

Stellar Shines: XLM Rockets 180% In Just One Week

November 25, 2024

Over the past week, Stellar native cryptocurrency, XLM, has experienced a solid 180% increase, causing a stir in the cryptocurrency...

China Unearths Massive Gold Veins That Could Reshape Global Markets

China Unearths Massive Gold Veins That Could Reshape Global Markets

November 25, 2024

A major gold discovery in China’s Hunan Province, valued at $83 billion and containing over 40 gold veins, is anticipated...

Load More
Next Post
Python Audio Transcription Enhanced with AssemblyAI’s Universal-1

Python Audio Transcription Enhanced with AssemblyAI's Universal-1

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

UK to introduce comprehensive crypto regulations in 2025 as global competition heats up

UK to introduce comprehensive crypto regulations in 2025 as global competition heats up

November 22, 2024
What to Expect from the Upcoming FIFA Rivals NFT Game

What to Expect from the Upcoming FIFA Rivals NFT Game

November 25, 2024
Acurx Pharmaceuticals Allocates $1 Million to Bitcoin as Reserve Asset, Shares Slide 26%

Acurx Pharmaceuticals Allocates $1 Million to Bitcoin as Reserve Asset, Shares Slide 26%

November 20, 2024
What’s Next for Crypto: SEC Examination Priorities in 2025

What’s Next for Crypto: SEC Examination Priorities in 2025

November 22, 2024
The Future of Fitness? WearFi and Web3 combine Health and Wealth

The Future of Fitness? WearFi and Web3 combine Health and Wealth

November 22, 2024
CryptoBangs.com

CryptoBangs.com is an online news portal that aims to share the latest crypto news, bitcoin, altcoin, blockchain, nft news and much more stuff like that.

What’s New Here!

  • Shiba Inu and PEPE Whales Move Millions to RCO Finance, Citing 23,402% Gains Predicted in 2025
  • Bitcoin Price to Target $137,000 After New ATH, Why This is Great for the Emerging AI Altcoin RCOF 8000x Rally
  • Web3 vs. Traditional Gaming: Projected Market Growth and Future Trends
  • Justin Sun’s Tron network invests $30 million in Trump family-backed World Liberty Financial

Newsletter

Don't miss a beat and stay up to date with our Newsletter!
Loading

  • Contact Us
  • Privacy Policy
  • Terms of Use
  • DMCA
  • Disclaimer

© 2023 - CryptoBangs.com - All Rights Reserved!

No Result
View All Result
  • Home
  • Live Crypto Prices
  • Crypto News
    • Bitcoin
    • Ethereum
    • Ripple
    • Altcoin
    • NFT News
  • DeFi
  • Blockchain
  • Regulation
  • Shop
  • Blog
  • Calculator

© 2018 JNews by Jegtheme.

  • bitcoinBitcoin(BTC)$94,671.00-2.23%
  • ethereumEthereum(ETH)$3,468.423.79%
  • tetherTether(USDT)$1.00-0.23%
  • solanaSolana(SOL)$237.96-4.94%
  • binancecoinBNB(BNB)$639.17-2.53%
  • rippleXRP(XRP)$1.442.00%
  • dogecoinDogecoin(DOGE)$0.399796-5.56%
  • usd-coinUSDC(USDC)$1.00-0.22%
  • cardanoCardano(ADA)$0.98-2.33%
  • staked-etherLido Staked Ether(STETH)$3,466.133.75%
  • avalanche-2Avalanche(AVAX)$42.394.04%
  • tronTRON(TRX)$0.197610-4.36%
  • the-open-networkToncoin(TON)$6.191.37%
  • stellarStellar(XLM)$0.50-11.83%
  • shiba-inuShiba Inu(SHIB)$0.0000261.13%
  • Wrapped stETHWrapped stETH(WSTETH)$4,110.633.87%
  • wrapped-bitcoinWrapped Bitcoin(WBTC)$94,183.00-2.45%
  • polkadotPolkadot(DOT)$8.42-3.28%
  • chainlinkChainlink(LINK)$17.781.66%
  • WETHWETH(WETH)$3,464.823.68%
  • bitcoin-cashBitcoin Cash(BCH)$501.59-1.44%
  • suiSui(SUI)$3.17-5.29%
  • nearNEAR Protocol(NEAR)$6.680.65%
  • PepePepe(PEPE)$0.000019-4.08%
  • leo-tokenLEO Token(LEO)$8.21-2.91%
  • litecoinLitecoin(LTC)$94.32-2.45%
  • uniswapUniswap(UNI)$11.426.84%
  • Wrapped eETHWrapped eETH(WEETH)$3,647.633.80%
  • aptosAptos(APT)$12.05-0.83%
  • internet-computerInternet Computer(ICP)$11.834.12%
  • USDSUSDS(USDS)$1.000.07%
  • hedera-hashgraphHedera(HBAR)$0.136239-6.34%
  • crypto-com-chainCronos(CRO)$0.182607-3.30%
  • POL (ex-MATIC)POL (ex-MATIC)(POL)$0.572.77%
  • ethereum-classicEthereum Classic(ETC)$30.447.28%
  • BittensorBittensor(TAO)$542.746.99%
  • render-tokenRender(RENDER)$7.69-2.03%
  • Ethena USDeEthena USDe(USDE)$1.00-0.23%
  • arbitrumArbitrum(ARB)$0.9412.50%
  • kaspaKaspa(KAS)$0.1515080.11%
  • fetch-aiArtificial Superintelligence Alliance(FET)$1.45-3.54%
  • daiDai(DAI)$1.00-0.19%
  • CelestiaCelestia(TIA)$8.083.48%
  • WhiteBIT CoinWhiteBIT Coin(WBT)$23.94-1.36%
  • filecoinFilecoin(FIL)$5.600.42%
  • vechainVeChain(VET)$0.041354-4.28%
  • BonkBonk(BONK)$0.000044-6.92%
  • blockstackStacks(STX)$2.169.36%
  • dogwifhatdogwifhat(WIF)$3.213.18%
  • okbOKB(OKB)$53.45-1.50%
WP Twitter Auto Publish Powered By : XYZScripts.com