Skip to content

oragono mkcerts should generate a 2048-bit RSA certificate #898

@slingamn

Description

@slingamn

The current default of an ECDSA certificate is extremely slow, for unclear reasons. This was one of the causes of #894. I tested with a self-signed 2048-bit RSA certificate and it's between 3x and 10x faster on Go 1.14.1:

# ecdsa
(pprof) top 40
Showing nodes accounting for 3.98s, 85.04% of 4.68s total
Dropped 133 nodes (cum <= 0.02s)
Showing top 40 nodes out of 159
      flat  flat%   sum%        cum   cum%
     1.06s 22.65% 22.65%      1.71s 36.54%  math/big.nat.divBasic
     0.42s  8.97% 31.62%      0.42s  8.97%  math/big.addMulVVW
     0.28s  5.98% 37.61%      0.28s  5.98%  math/big.subVV
     0.19s  4.06% 41.67%      0.19s  4.06%  math/big.mulAddVWW
     0.18s  3.85% 45.51%      0.24s  5.13%  runtime.scanobject
     0.17s  3.63% 49.15%      0.17s  3.63%  runtime.futex
     0.12s  2.56% 51.71%      0.68s 14.53%  runtime.mallocgc
     0.12s  2.56% 54.27%      0.12s  2.56%  runtime.memclrNoHeapPointers
     0.12s  2.56% 56.84%      0.12s  2.56%  runtime.procyield
     0.11s  2.35% 59.19%      0.11s  2.35%  runtime.findObject
     0.09s  1.92% 61.11%      0.49s 10.47%  math/big.basicMul
     0.09s  1.92% 63.03%      0.09s  1.92%  runtime.nextFreeFast (inline)
     0.08s  1.71% 64.74%      0.08s  1.71%  math/big.shlVU
     0.07s  1.50% 66.24%      0.07s  1.50%  syscall.Syscall
     0.06s  1.28% 67.52%      0.07s  1.50%  math/big.nat.norm
     0.06s  1.28% 68.80%      0.06s  1.28%  math/big.shrVU
     0.06s  1.28% 70.09%      0.22s  4.70%  runtime.gcWriteBarrier
     0.06s  1.28% 71.37%      0.06s  1.28%  runtime.markBits.isMarked (inline)
     0.05s  1.07% 72.44%      0.05s  1.07%  runtime.epollwait
     0.05s  1.07% 73.50%      0.05s  1.07%  runtime.usleep
     0.05s  1.07% 74.57%      0.16s  3.42%  runtime.wbBufFlush1
     0.04s  0.85% 75.43%      0.62s 13.25%  math/big.nat.make (inline)
     0.03s  0.64% 76.07%      2.42s 51.71%  crypto/elliptic.(*CurveParams).doubleJacobian

# 2048-bit rsa
(pprof) top 40
Showing nodes accounting for 1.28s, 100% of 1.28s total
Showing top 40 nodes out of 176
      flat  flat%   sum%        cum   cum%
     0.62s 48.44% 48.44%      0.62s 48.44%  math/big.addMulVVW
     0.18s 14.06% 62.50%      0.77s 60.16%  math/big.nat.montgomery
     0.10s  7.81% 70.31%      0.10s  7.81%  syscall.Syscall
     0.03s  2.34% 72.66%      0.80s 62.50%  math/big.nat.expNNMontgomery
     0.03s  2.34% 75.00%      0.03s  2.34%  math/big.subVV
     0.03s  2.34% 77.34%      0.03s  2.34%  runtime.nextFreeFast (inline)
     0.02s  1.56% 78.91%      0.02s  1.56%  crypto/sha256.block
     0.02s  1.56% 80.47%      0.04s  3.12%  math/big.nat.divBasic
     0.02s  1.56% 82.03%      0.02s  1.56%  runtime.futex
     0.02s  1.56% 83.59%      0.02s  1.56%  runtime.write1
     0.02s  1.56% 85.16%      0.02s  1.56%  vendor/golang.org/x/crypto/curve25519.ladderstep
     0.01s  0.78% 85.94%      0.01s  0.78%  crypto/aes.(*gcmAsm).Open
     0.01s  0.78% 86.72%      0.01s  0.78%  crypto/tls.(*certificateMsgTLS13).unmarshal
     0.01s  0.78% 87.50%      0.01s  0.78%  fmt.(*pp).doPrintf
     0.01s  0.78% 88.28%      0.06s  4.69%  github.com/oragono/oragono/irc.(*Socket).performWrite
     0.01s  0.78% 89.06%      0.01s  0.78%  indexbytebody
     0.01s  0.78% 89.84%      0.02s  1.56%  math/big.(*Int).Add
     0.01s  0.78% 90.62%      0.01s  0.78%  math/big.greaterThan (inline)
     0.01s  0.78% 91.41%      0.01s  0.78%  math/big.nat.mulAddWW
     0.01s  0.78% 92.19%      0.10s  7.81%  net.(*conn).Write

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions