Lines Matching full:response

91 pack_key_ecdsa(struct sk_enroll_response *response)  in pack_key_ecdsa()  argument
102 response->public_key = NULL; in pack_key_ecdsa()
103 response->public_key_len = 0; in pack_key_ecdsa()
104 response->key_handle = NULL; in pack_key_ecdsa()
105 response->key_handle_len = 0; in pack_key_ecdsa()
122 response->public_key_len = EC_POINT_point2oct(g, q, in pack_key_ecdsa()
124 if (response->public_key_len == 0 || response->public_key_len > 2048) { in pack_key_ecdsa()
126 response->public_key_len); in pack_key_ecdsa()
129 if ((response->public_key = malloc(response->public_key_len)) == NULL) { in pack_key_ecdsa()
134 response->public_key, response->public_key_len, NULL) == 0) { in pack_key_ecdsa()
147 if ((response->key_handle = malloc(privlen)) == NULL) { in pack_key_ecdsa()
151 response->key_handle_len = (size_t)privlen; in pack_key_ecdsa()
152 memcpy(response->key_handle, privptr, response->key_handle_len); in pack_key_ecdsa()
157 if (response->public_key != NULL) { in pack_key_ecdsa()
158 memset(response->public_key, 0, in pack_key_ecdsa()
159 response->public_key_len); in pack_key_ecdsa()
160 free(response->public_key); in pack_key_ecdsa()
161 response->public_key = NULL; in pack_key_ecdsa()
163 if (response->key_handle != NULL) { in pack_key_ecdsa()
164 memset(response->key_handle, 0, in pack_key_ecdsa()
165 response->key_handle_len); in pack_key_ecdsa()
166 free(response->key_handle); in pack_key_ecdsa()
167 response->key_handle = NULL; in pack_key_ecdsa()
179 pack_key_ed25519(struct sk_enroll_response *response) in pack_key_ed25519() argument
185 response->public_key = NULL; in pack_key_ed25519()
186 response->public_key_len = 0; in pack_key_ed25519()
187 response->key_handle = NULL; in pack_key_ed25519()
188 response->key_handle_len = 0; in pack_key_ed25519()
194 response->public_key_len = sizeof(pk); in pack_key_ed25519()
195 if ((response->public_key = malloc(response->public_key_len)) == NULL) { in pack_key_ed25519()
199 memcpy(response->public_key, pk, sizeof(pk)); in pack_key_ed25519()
201 response->key_handle_len = sizeof(sk); in pack_key_ed25519()
202 if ((response->key_handle = malloc(response->key_handle_len)) == NULL) { in pack_key_ed25519()
206 memcpy(response->key_handle, sk, sizeof(sk)); in pack_key_ed25519()
211 free(response->public_key); in pack_key_ed25519()
238 struct sk_enroll_response *response = NULL; in sk_enroll() local
250 if ((response = calloc(1, sizeof(*response))) == NULL) { in sk_enroll()
251 skdebug(__func__, "calloc response failed"); in sk_enroll()
254 response->flags = flags; in sk_enroll()
257 if (pack_key_ecdsa(response) != 0) in sk_enroll()
261 if (pack_key_ed25519(response) != 0) in sk_enroll()
269 if ((response->signature = calloc(1, 1)) == NULL) { in sk_enroll()
273 response->signature_len = 0; in sk_enroll()
275 *enroll_response = response; in sk_enroll()
276 response = NULL; in sk_enroll()
279 if (response != NULL) { in sk_enroll()
280 free(response->public_key); in sk_enroll()
281 free(response->key_handle); in sk_enroll()
282 free(response->signature); in sk_enroll()
283 free(response->attestation_cert); in sk_enroll()
284 free(response); in sk_enroll()
311 struct sk_sign_response *response) in sig_ecdsa() argument
373 response->sig_r_len = BN_num_bytes(sig_r); in sig_ecdsa()
374 response->sig_s_len = BN_num_bytes(sig_s); in sig_ecdsa()
375 if ((response->sig_r = calloc(1, response->sig_r_len)) == NULL || in sig_ecdsa()
376 (response->sig_s = calloc(1, response->sig_s_len)) == NULL) { in sig_ecdsa()
380 BN_bn2bin(sig_r, response->sig_r); in sig_ecdsa()
381 BN_bn2bin(sig_s, response->sig_s); in sig_ecdsa()
389 free(response->sig_r); in sig_ecdsa()
390 free(response->sig_s); in sig_ecdsa()
391 response->sig_r = NULL; in sig_ecdsa()
392 response->sig_s = NULL; in sig_ecdsa()
407 struct sk_sign_response *response) in sig_ed25519() argument
461 response->sig_r_len = (size_t)(smlen - sizeof(signbuf)); in sig_ed25519()
462 if ((response->sig_r = calloc(1, response->sig_r_len)) == NULL) { in sig_ed25519()
466 memcpy(response->sig_r, sig, response->sig_r_len); in sig_ed25519()
467 dump("sig_r", response->sig_r, response->sig_r_len); in sig_ed25519()
475 free(response->sig_r); in sig_ed25519()
476 response->sig_r = NULL; in sig_ed25519()
487 struct sk_sign_response *response = NULL; in sk_sign() local
499 if ((response = calloc(1, sizeof(*response))) == NULL) { in sk_sign()
500 skdebug(__func__, "calloc response failed"); in sk_sign()
506 response->flags = flags; in sk_sign()
507 response->counter = 0x12345678; in sk_sign()
511 response->counter, flags, key_handle, key_handle_len, in sk_sign()
512 response) != 0) in sk_sign()
517 response->counter, flags, key_handle, key_handle_len, in sk_sign()
518 response) != 0) in sk_sign()
525 *sign_response = response; in sk_sign()
526 response = NULL; in sk_sign()
530 if (response != NULL) { in sk_sign()
531 free(response->sig_r); in sk_sign()
532 free(response->sig_s); in sk_sign()
533 free(response); in sk_sign()