Lines Matching refs:ctx
140 static int set_random(ASN1_OCTET_STRING **tgt, OSSL_CMP_CTX *ctx, size_t len)
145 if (bytes == NULL || RAND_bytes_ex(ctx->libctx, bytes, len, 0) <= 0)
263 * set ctx->transactionID in CMP header
264 * if ctx->transactionID is NULL, a random one is created with 128 bit
271 int ossl_cmp_hdr_set_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_PKIHEADER *hdr)
273 if (ctx->transactionID == NULL) {
276 if (!set_random(&ctx->transactionID, ctx,
279 tid = OPENSSL_buf2hexstr(ctx->transactionID->data,
280 ctx->transactionID->length);
282 ossl_cmp_log1(DEBUG, ctx,
288 ctx->transactionID);
291 /* fill in all fields of the hdr according to the info given in ctx */
292 int ossl_cmp_hdr_init(OSSL_CMP_CTX *ctx, OSSL_CMP_PKIHEADER *hdr)
297 if (!ossl_assert(ctx != NULL && hdr != NULL))
308 sender = ctx->cert != NULL ? X509_get_subject_name(ctx->cert) :
309 ctx->oldCert != NULL ? X509_get_subject_name(ctx->oldCert) :
310 ctx->subjectName;
315 if (ctx->recipient != NULL)
316 rcp = ctx->recipient;
317 else if (ctx->srvCert != NULL)
318 rcp = X509_get_subject_name(ctx->srvCert);
319 else if (ctx->issuer != NULL)
320 rcp = ctx->issuer;
321 else if (ctx->oldCert != NULL)
322 rcp = X509_get_issuer_name(ctx->oldCert);
323 else if (ctx->cert != NULL)
324 rcp = X509_get_issuer_name(ctx->cert);
332 if (ctx->recipNonce != NULL
334 ctx->recipNonce))
337 if (!ossl_cmp_hdr_set_transactionID(ctx, hdr))
352 if (!set_random(&hdr->senderNonce, ctx, OSSL_CMP_SENDERNONCE_LENGTH))
356 if (!OSSL_CMP_CTX_set1_senderNonce(ctx, hdr->senderNonce))
364 if (ctx->freeText != NULL
365 && !ossl_cmp_hdr_push1_freeText(hdr, ctx->freeText))