Lines Matching refs:cred
20 struct tlsv1_credentials *cred;
21 cred = os_zalloc(sizeof(*cred));
22 return cred;
26 void tlsv1_cred_free(struct tlsv1_credentials *cred)
28 if (cred == NULL)
31 x509_certificate_chain_free(cred->trusted_certs);
32 x509_certificate_chain_free(cred->cert);
33 crypto_private_key_free(cred->key);
34 os_free(cred->dh_p);
35 os_free(cred->dh_g);
36 os_free(cred);
182 * @cred: TLSv1 credentials from tlsv1_cred_alloc()
189 int tlsv1_set_ca_cert(struct tlsv1_credentials *cred, const char *cert,
193 if (tlsv1_set_cert_chain(&cred->trusted_certs, cert,
210 * @cred: TLSv1 credentials from tlsv1_cred_alloc()
216 int tlsv1_set_cert(struct tlsv1_credentials *cred, const char *cert,
219 return tlsv1_set_cert_chain(&cred->cert, cert,
291 static int tlsv1_set_key(struct tlsv1_credentials *cred,
294 cred->key = crypto_private_key_import(key, len, passwd);
295 if (cred->key == NULL)
296 cred->key = tlsv1_set_key_pem(key, len);
297 if (cred->key == NULL)
298 cred->key = tlsv1_set_key_enc_pem(key, len, passwd);
299 if (cred->key == NULL) {
309 * @cred: TLSv1 credentials from tlsv1_cred_alloc()
317 int tlsv1_set_private_key(struct tlsv1_credentials *cred,
323 crypto_private_key_free(cred->key);
324 cred->key = NULL;
327 return tlsv1_set_key(cred, private_key_blob,
343 ret = tlsv1_set_key(cred, buf, len, private_key_passwd);
352 static int tlsv1_set_dhparams_der(struct tlsv1_credentials *cred,
393 os_free(cred->dh_p);
394 cred->dh_p = os_malloc(hdr.length);
395 if (cred->dh_p == NULL)
397 os_memcpy(cred->dh_p, hdr.payload, hdr.length);
398 cred->dh_p_len = hdr.length;
415 os_free(cred->dh_g);
416 cred->dh_g = os_malloc(hdr.length);
417 if (cred->dh_g == NULL)
419 os_memcpy(cred->dh_g, hdr.payload, hdr.length);
420 cred->dh_g_len = hdr.length;
430 static int tlsv1_set_dhparams_blob(struct tlsv1_credentials *cred,
441 return tlsv1_set_dhparams_der(cred, buf, len);
461 if (tlsv1_set_dhparams_der(cred, der, der_len) < 0) {
476 * @cred: TLSv1 credentials from tlsv1_cred_alloc()
482 int tlsv1_set_dhparams(struct tlsv1_credentials *cred, const char *dh_file,
486 return tlsv1_set_dhparams_blob(cred, dh_blob, dh_blob_len);
500 ret = tlsv1_set_dhparams_blob(cred, buf, len);