| 86 | constexpr int rsae_ = 65537; |
| 87 | |
| 88 | struct CryptoConstants |
| 89 | { |
| 90 | // DH/ElGamal |
| 91 | BIGNUM * elgp; |
| 92 | BIGNUM * elgg; |
| 93 | |
| 94 | // DSA |
| 95 | BIGNUM * dsap; |
| 96 | BIGNUM * dsaq; |
| 97 | BIGNUM * dsag; |
| 98 | |
| 99 | // RSA |
| 100 | BIGNUM * rsae; |
| 101 | |
| 102 | CryptoConstants (const uint8_t * elgp_, int elgg_, const uint8_t * dsap_, |
| 103 | const uint8_t * dsaq_, const uint8_t * dsag_, int rsae_) |
| 104 | { |
| 105 | elgp = BN_new (); |
| 106 | BN_bin2bn (elgp_, 256, elgp); |
| 107 | elgg = BN_new (); |
| 108 | BN_set_word (elgg, elgg_); |
| 109 | dsap = BN_new (); |
| 110 | BN_bin2bn (dsap_, 128, dsap); |
| 111 | dsaq = BN_new (); |
| 112 | BN_bin2bn (dsaq_, 20, dsaq); |
| 113 | dsag = BN_new (); |
| 114 | BN_bin2bn (dsag_, 128, dsag); |
| 115 | rsae = BN_new (); |
| 116 | BN_set_word (rsae, rsae_); |
| 117 | } |
| 118 | |
| 119 | ~CryptoConstants () |
| 120 | { |
| 121 | BN_free (elgp); BN_free (elgg); BN_free (dsap); BN_free (dsaq); BN_free (dsag); BN_free (rsae); |
| 122 | } |
| 123 | }; |
| 124 | |
| 125 | static const CryptoConstants& GetCryptoConstants () |
| 126 | { |
nothing calls this directly
no outgoing calls
no test coverage detected