|
| 1 | +# Signature Test Example |
| 2 | + |
| 3 | +Demonstrates using a hash digest to sign and verify a signature using ECC |
| 4 | + |
| 5 | +First, set the path to wolfssl directory to variable WOLFROOT in the Makefile. |
| 6 | +## Building |
| 7 | + |
| 8 | +### Build example |
| 9 | + |
| 10 | +``` |
| 11 | +make |
| 12 | +``` |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | +``` |
| 17 | +./ecc_sign_verify |
| 18 | +Key size is 112, byteField = 14, maxSigSz = 44 |
| 19 | +Successfully verified signature w/ ecc key size 112! |
| 20 | +Key size is 128, byteField = 16, maxSigSz = 48 |
| 21 | +Successfully verified signature w/ ecc key size 128! |
| 22 | +Key size is 160, byteField = 20, maxSigSz = 56 |
| 23 | +Successfully verified signature w/ ecc key size 160! |
| 24 | +Key size is 192, byteField = 24, maxSigSz = 64 |
| 25 | +Successfully verified signature w/ ecc key size 192! |
| 26 | +Key size is 224, byteField = 28, maxSigSz = 72 |
| 27 | +Successfully verified signature w/ ecc key size 224! |
| 28 | +Key size is 239, byteField = 36, maxSigSz = 88 |
| 29 | +Successfully verified signature w/ ecc key size 239! |
| 30 | +Key size is 256, byteField = 32, maxSigSz = 80 |
| 31 | +Successfully verified signature w/ ecc key size 256! |
| 32 | +Key size is 320, byteField = 40, maxSigSz = 96 |
| 33 | +Successfully verified signature w/ ecc key size 320! |
| 34 | +Key size is 384, byteField = 48, maxSigSz = 112 |
| 35 | +Successfully verified signature w/ ecc key size 384! |
| 36 | +Key size is 512, byteField = 64, maxSigSz = 144 |
| 37 | +Successfully verified signature w/ ecc key size 512! |
| 38 | +Key size is 521, byteField = 66, maxSigSz = 148 |
| 39 | +Successfully verified signature w/ ecc key size 521! |
| 40 | +``` |
| 41 | + |
| 42 | +NOTE: Also an option to dump out the signatures. For more verbose output |
| 43 | + uncomment define in example "SHOW_SIGS_IN_EXAMPLE" |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +# Signature verification Benchmark |
| 48 | + |
| 49 | +You can generate benchmark program to compare the speed of signature verification between TFM and SP |
| 50 | +### SP |
| 51 | +Faster math library |
| 52 | + |
| 53 | +If you build for x86_64 system: |
| 54 | +``` |
| 55 | +make bench math=sp arch=x64 |
| 56 | +``` |
| 57 | +else if Aarch64 system: |
| 58 | +``` |
| 59 | +make bench math=sp arch=arm64 |
| 60 | +``` |
| 61 | +then a benchmark program is generated. |
| 62 | +### TFM |
| 63 | + |
| 64 | +``` |
| 65 | +make bench math=tfm |
| 66 | +``` |
| 67 | +NOTE: When using TFM, No Architecture specification is required. |
| 68 | + |
| 69 | +## Example Output |
| 70 | +built with the option `math=sp arch=arm64` |
| 71 | +``` |
| 72 | +./bench |
| 73 | +--------------------------------------------------------------- |
| 74 | +Enabled WOLFSSL_SP_ARM64 |
| 75 | +--------------------------------------------------------------- |
| 76 | +Running ECC Sign Verify Benchmarks... |
| 77 | +ECC Key Size 112 1275.78 Cycles/sec |
| 78 | +ECC Key Size 128 1351.68 Cycles/sec |
| 79 | +ECC Key Size 160 1368.65 Cycles/sec |
| 80 | +ECC Key Size 192 1382.20 Cycles/sec |
| 81 | +ECC Key Size 224 1385.06 Cycles/sec |
| 82 | +ECC Key Size 239 1401.38 Cycles/sec |
| 83 | +ECC Key Size 256 12830.67 Cycles/sec |
| 84 | +ECC Key Size 320 626.52 Cycles/sec |
| 85 | +ECC Key Size 384 634.85 Cycles/sec |
| 86 | +ECC Key Size 512 279.71 Cycles/sec |
| 87 | +ECC Key Size 521 279.15 Cycles/sec |
| 88 | +``` |
| 89 | + |
| 90 | +# Tracking memory |
| 91 | +To see a stack and heap memory usage. |
| 92 | + |
| 93 | +``` |
| 94 | +make mem |
| 95 | +``` |
| 96 | +## Example Output |
| 97 | +``` |
| 98 | +./ecc_sign_verify |
| 99 | +Key size is 112, byteField = 14 |
| 100 | +Successfully verified signature w/ ecc key size 112! |
| 101 | +Key size is 128, byteField = 16 |
| 102 | +Successfully verified signature w/ ecc key size 128! |
| 103 | +Key size is 160, byteField = 20 |
| 104 | +Successfully verified signature w/ ecc key size 160! |
| 105 | +Key size is 192, byteField = 24 |
| 106 | +Successfully verified signature w/ ecc key size 192! |
| 107 | +Key size is 224, byteField = 28 |
| 108 | +Successfully verified signature w/ ecc key size 224! |
| 109 | +Key size is 239, byteField = 30 |
| 110 | +Successfully verified signature w/ ecc key size 239! |
| 111 | +Key size is 256, byteField = 32 |
| 112 | +Successfully verified signature w/ ecc key size 256! |
| 113 | +Key size is 320, byteField = 40 |
| 114 | +Successfully verified signature w/ ecc key size 320! |
| 115 | +Key size is 384, byteField = 48 |
| 116 | +Successfully verified signature w/ ecc key size 384! |
| 117 | +Key size is 512, byteField = 64 |
| 118 | +Successfully verified signature w/ ecc key size 512! |
| 119 | +Key size is 521, byteField = 66 |
| 120 | +Successfully verified signature w/ ecc key size 521! |
| 121 | +
|
| 122 | +total Allocs = 522 |
| 123 | +total Deallocs = 522 |
| 124 | +total Bytes = 225047 |
| 125 | +peak Bytes = 5161 |
| 126 | +current Bytes = 0 |
| 127 | +stack used = 16752 |
| 128 | +``` |
| 129 | + |
| 130 | + |
| 131 | +Best wishes in all your testing! |
| 132 | + |
| 133 | +- The wolfSSL Team |
0 commit comments