Lines Matching defs:secret
22 * to the other peer. A peer can then derive the same shared secret using their
32 unsigned char *secret; /* allocated shared secret buffer */
109 unsigned char *secret = NULL;
126 * optionally using a X963KDF to expand the secret data. This can be done
144 * Note: After the secret is generated below, the peer could alternatively
145 * pass the secret to a KDF to derive additional key data from the secret.
146 * See demos/kdf/hkdf.c for an example (where ikm is the secret key)
149 /* Calculate the size of the secret and allocate space */
152 secret = (unsigned char *)OPENSSL_malloc(secretlen);
153 if (secret == NULL)
157 * Derive the shared secret. In this example 32 bytes are generated.
158 * For EC curves the secret size is related to the degree of the curve
161 if (EVP_PKEY_derive(derivectx, secret, &secretlen) <= 0)
163 peerA->secret = secret;
166 printf("Shared secret (%s):\n", peerA->name);
167 BIO_dump_indent_fp(stdout, peerA->secret, peerA->secretlen, 2);
172 OPENSSL_free(secret);
180 /* Initialise the 2 peers that will share a secret */
198 * derive a shared secret
208 || CRYPTO_memcmp(peer1.secret, peer2.secret, peer1.secretlen) != 0) {