Lines Matching refs:hdr
23 int ossl_cmp_hdr_set_pvno(OSSL_CMP_PKIHEADER *hdr, int pvno)
25 if (!ossl_assert(hdr != NULL))
27 return ASN1_INTEGER_set(hdr->pvno, pvno);
30 int ossl_cmp_hdr_get_pvno(const OSSL_CMP_PKIHEADER *hdr)
34 if (!ossl_assert(hdr != NULL))
36 if (!ASN1_INTEGER_get_int64(&pvno, hdr->pvno) || pvno < 0 || pvno > INT_MAX)
41 int ossl_cmp_hdr_get_protection_nid(const OSSL_CMP_PKIHEADER *hdr)
43 if (!ossl_assert(hdr != NULL)
44 || hdr->protectionAlg == NULL)
46 return OBJ_obj2nid(hdr->protectionAlg->algorithm);
50 OSSL_CMP_PKIHEADER *hdr)
52 if (hdr == NULL) {
56 return hdr->transactionID;
59 ASN1_OCTET_STRING *ossl_cmp_hdr_get0_senderNonce(const OSSL_CMP_PKIHEADER *hdr)
61 if (!ossl_assert(hdr != NULL))
63 return hdr->senderNonce;
66 ASN1_OCTET_STRING *OSSL_CMP_HDR_get0_recipNonce(const OSSL_CMP_PKIHEADER *hdr)
68 if (hdr == NULL) {
72 return hdr->recipNonce;
115 int ossl_cmp_hdr_set1_sender(OSSL_CMP_PKIHEADER *hdr, const X509_NAME *nm)
117 if (!ossl_assert(hdr != NULL))
119 return set1_general_name(&hdr->sender, nm);
122 int ossl_cmp_hdr_set1_recipient(OSSL_CMP_PKIHEADER *hdr, const X509_NAME *nm)
124 if (!ossl_assert(hdr != NULL))
126 return set1_general_name(&hdr->recipient, nm);
129 int ossl_cmp_hdr_update_messageTime(OSSL_CMP_PKIHEADER *hdr)
131 if (!ossl_assert(hdr != NULL))
133 if (hdr->messageTime == NULL
134 && (hdr->messageTime = ASN1_GENERALIZEDTIME_new()) == NULL)
136 return ASN1_GENERALIZEDTIME_set(hdr->messageTime, time(NULL)) != NULL;
153 int ossl_cmp_hdr_set1_senderKID(OSSL_CMP_PKIHEADER *hdr,
156 if (!ossl_assert(hdr != NULL))
158 return ossl_cmp_asn1_octet_string_set1(&hdr->senderKID, senderKID);
162 int ossl_cmp_hdr_push0_freeText(OSSL_CMP_PKIHEADER *hdr, ASN1_UTF8STRING *text)
164 if (!ossl_assert(hdr != NULL && text != NULL))
167 if (hdr->freeText == NULL
168 && (hdr->freeText = sk_ASN1_UTF8STRING_new_null()) == NULL)
171 return sk_ASN1_UTF8STRING_push(hdr->freeText, text);
174 int ossl_cmp_hdr_push1_freeText(OSSL_CMP_PKIHEADER *hdr, ASN1_UTF8STRING *text)
176 if (!ossl_assert(hdr != NULL && text != NULL))
179 if (hdr->freeText == NULL
180 && (hdr->freeText = sk_ASN1_UTF8STRING_new_null()) == NULL)
184 ossl_cmp_sk_ASN1_UTF8STRING_push_str(hdr->freeText, (char *)text->data,
188 int ossl_cmp_hdr_generalInfo_push0_item(OSSL_CMP_PKIHEADER *hdr,
191 if (!ossl_assert(hdr != NULL && itav != NULL))
193 return OSSL_CMP_ITAV_push0_stack_item(&hdr->generalInfo, itav);
196 int ossl_cmp_hdr_generalInfo_push1_items(OSSL_CMP_PKIHEADER *hdr,
202 if (!ossl_assert(hdr != NULL))
210 if (!ossl_cmp_hdr_generalInfo_push0_item(hdr, itav)) {
218 int ossl_cmp_hdr_set_implicitConfirm(OSSL_CMP_PKIHEADER *hdr)
223 if (!ossl_assert(hdr != NULL))
231 if (!ossl_cmp_hdr_generalInfo_push0_item(hdr, itav))
242 int ossl_cmp_hdr_has_implicitConfirm(const OSSL_CMP_PKIHEADER *hdr)
248 if (!ossl_assert(hdr != NULL))
251 itavCount = sk_OSSL_CMP_ITAV_num(hdr->generalInfo);
253 itav = sk_OSSL_CMP_ITAV_value(hdr->generalInfo, i);
271 int ossl_cmp_hdr_set_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_PKIHEADER *hdr)
287 return ossl_cmp_asn1_octet_string_set1(&hdr->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))
301 if (!ossl_cmp_hdr_set_pvno(hdr, OSSL_CMP_PVNO))
311 if (!ossl_cmp_hdr_set1_sender(hdr, sender))
325 if (!ossl_cmp_hdr_set1_recipient(hdr, rcp))
329 if (!ossl_cmp_hdr_update_messageTime(hdr))
333 && !ossl_cmp_asn1_octet_string_set1(&hdr->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))
365 && !ossl_cmp_hdr_push1_freeText(hdr, ctx->freeText))