Lines Matching refs:bkey
123 dh_genkey_pair(DHbytekey *bkey)
132 if (bkey == NULL)
136 if (bkey->prime_bits == 0 || bkey->prime == NULL ||
137 bkey->base_bytes == 0 || bkey->base == NULL)
140 prime_bytes = CRYPTO_BITS2BYTES(bkey->prime_bits);
151 if ((brv = DH_key_init(&dhkey, bkey->prime_bits)) != BIG_OK) {
162 bytestring2bignum(&(dhkey.p), bkey->prime, prime_bytes);
166 CHARLEN2BIGNUMLEN(bkey->base_bytes))) != BIG_OK) {
170 bytestring2bignum(&(dhkey.g), bkey->base, bkey->base_bytes);
187 if (bkey->value_bits == 0)
188 bkey->value_bits = primebit_len;
190 if (bkey->value_bits > primebit_len) {
196 if ((brv = big_extend(&(dhkey.x), BITLEN2BIGNUMLEN(bkey->value_bits)))
212 rf = bkey->rfunc;
221 if ((brv = big_random(&(dhkey.x), bkey->value_bits, rf)) != BIG_OK) {
236 bignum2bytestring(bkey->private_x, &(dhkey.x),
237 CRYPTO_BITS2BYTES(bkey->value_bits));
238 bignum2bytestring(bkey->public_y, &(dhkey.y), prime_bytes);
250 dh_key_derive(DHbytekey *bkey, uint32_t key_type, /* = CKK_KEY_TYPE */
263 if (bkey == NULL)
267 if (bkey->prime_bits == 0 || bkey->prime == NULL ||
268 bkey->value_bits == 0 || bkey->private_x == NULL ||
269 bkey->public_y == NULL)
276 prime_bytes = CRYPTO_BITS2BYTES(bkey->prime_bits);
277 value_bytes = CRYPTO_BITS2BYTES(bkey->value_bits);
283 if ((brv = DH_key_init(&dhkey, bkey->prime_bits)) != BIG_OK) {
294 bytestring2bignum(&(dhkey.p), bkey->prime, prime_bytes);
302 bytestring2bignum(&(dhkey.x), bkey->private_x, value_bytes);
310 bytestring2bignum(&(dhkey.y), bkey->public_y, prime_bytes);