Lines Matching refs:msg

20     OSSL_CMP_MSG *msg = NULL;  in OSSL_CMP_MSG_new()  local
22 msg = (OSSL_CMP_MSG *)ASN1_item_new_ex(ASN1_ITEM_rptr(OSSL_CMP_MSG), in OSSL_CMP_MSG_new()
24 if (!ossl_cmp_msg_set0_libctx(msg, libctx, propq)) { in OSSL_CMP_MSG_new()
25 OSSL_CMP_MSG_free(msg); in OSSL_CMP_MSG_new()
26 msg = NULL; in OSSL_CMP_MSG_new()
28 return msg; in OSSL_CMP_MSG_new()
31 void OSSL_CMP_MSG_free(OSSL_CMP_MSG *msg) in OSSL_CMP_MSG_free() argument
33 ASN1_item_free((ASN1_VALUE *)msg, ASN1_ITEM_rptr(OSSL_CMP_MSG)); in OSSL_CMP_MSG_free()
41 int ossl_cmp_msg_set0_libctx(OSSL_CMP_MSG *msg, OSSL_LIB_CTX *libctx, in ossl_cmp_msg_set0_libctx() argument
44 if (msg != NULL) { in ossl_cmp_msg_set0_libctx()
45 msg->libctx = libctx; in ossl_cmp_msg_set0_libctx()
46 OPENSSL_free(msg->propq); in ossl_cmp_msg_set0_libctx()
47 msg->propq = NULL; in ossl_cmp_msg_set0_libctx()
49 msg->propq = OPENSSL_strdup(propq); in ossl_cmp_msg_set0_libctx()
50 if (msg->propq == NULL) in ossl_cmp_msg_set0_libctx()
57 OSSL_CMP_PKIHEADER *OSSL_CMP_MSG_get0_header(const OSSL_CMP_MSG *msg) in OSSL_CMP_MSG_get0_header() argument
59 if (msg == NULL) { in OSSL_CMP_MSG_get0_header()
63 return msg->header; in OSSL_CMP_MSG_get0_header()
81 int ossl_cmp_msg_set_bodytype(OSSL_CMP_MSG *msg, int type) in ossl_cmp_msg_set_bodytype() argument
83 if (!ossl_assert(msg != NULL && msg->body != NULL)) in ossl_cmp_msg_set_bodytype()
86 msg->body->type = type; in ossl_cmp_msg_set_bodytype()
90 int OSSL_CMP_MSG_get_bodytype(const OSSL_CMP_MSG *msg) in OSSL_CMP_MSG_get_bodytype() argument
92 if (!ossl_assert(msg != NULL && msg->body != NULL)) in OSSL_CMP_MSG_get_bodytype()
95 return msg->body->type; in OSSL_CMP_MSG_get_bodytype()
98 X509_PUBKEY *OSSL_CMP_MSG_get0_certreq_publickey(const OSSL_CMP_MSG *msg) in OSSL_CMP_MSG_get0_certreq_publickey() argument
105 switch (OSSL_CMP_MSG_get_bodytype(msg)) { in OSSL_CMP_MSG_get0_certreq_publickey()
109 reqs = msg->body->value.ir; /* value.ir is same for cr and kur */ in OSSL_CMP_MSG_get0_certreq_publickey()
157 OSSL_CMP_MSG *msg = NULL; in ossl_cmp_msg_create() local
162 if ((msg = OSSL_CMP_MSG_new(ctx->libctx, ctx->propq)) == NULL) in ossl_cmp_msg_create()
164 if (!ossl_cmp_hdr_init(ctx, msg->header) in ossl_cmp_msg_create()
165 || !ossl_cmp_msg_set_bodytype(msg, bodytype)) in ossl_cmp_msg_create()
168 && !ossl_cmp_hdr_generalInfo_push1_items(msg->header, in ossl_cmp_msg_create()
176 if ((msg->body->value.ir = OSSL_CRMF_MSGS_new()) == NULL) in ossl_cmp_msg_create()
178 return msg; in ossl_cmp_msg_create()
185 if ((msg->body->value.p10cr = X509_REQ_dup(ctx->p10CSR)) == NULL) in ossl_cmp_msg_create()
187 return msg; in ossl_cmp_msg_create()
192 if ((msg->body->value.ip = OSSL_CMP_CERTREPMESSAGE_new()) == NULL) in ossl_cmp_msg_create()
194 return msg; in ossl_cmp_msg_create()
197 if ((msg->body->value.rr = sk_OSSL_CMP_REVDETAILS_new_null()) == NULL) in ossl_cmp_msg_create()
199 return msg; in ossl_cmp_msg_create()
201 if ((msg->body->value.rp = OSSL_CMP_REVREPCONTENT_new()) == NULL) in ossl_cmp_msg_create()
203 return msg; in ossl_cmp_msg_create()
206 if ((msg->body->value.certConf = in ossl_cmp_msg_create()
209 return msg; in ossl_cmp_msg_create()
211 if ((msg->body->value.pkiconf = ASN1_TYPE_new()) == NULL) in ossl_cmp_msg_create()
213 ASN1_TYPE_set(msg->body->value.pkiconf, V_ASN1_NULL, NULL); in ossl_cmp_msg_create()
214 return msg; in ossl_cmp_msg_create()
217 if ((msg->body->value.pollReq = sk_OSSL_CMP_POLLREQ_new_null()) == NULL) in ossl_cmp_msg_create()
219 return msg; in ossl_cmp_msg_create()
221 if ((msg->body->value.pollRep = sk_OSSL_CMP_POLLREP_new_null()) == NULL) in ossl_cmp_msg_create()
223 return msg; in ossl_cmp_msg_create()
227 if ((msg->body->value.genm = sk_OSSL_CMP_ITAV_new_null()) == NULL) in ossl_cmp_msg_create()
229 return msg; in ossl_cmp_msg_create()
232 if ((msg->body->value.error = OSSL_CMP_ERRORMSGCONTENT_new()) == NULL) in ossl_cmp_msg_create()
234 return msg; in ossl_cmp_msg_create()
242 OSSL_CMP_MSG_free(msg); in ossl_cmp_msg_create()
382 OSSL_CMP_MSG *msg; in ossl_cmp_certreq_new() local
398 if ((msg = ossl_cmp_msg_create(ctx, type)) == NULL) in ossl_cmp_certreq_new()
402 if (ctx->implicitConfirm && !ossl_cmp_hdr_set_implicitConfirm(msg->header)) in ossl_cmp_certreq_new()
430 if (!sk_OSSL_CRMF_MSG_push(msg->body->value.ir, local_crm)) in ossl_cmp_certreq_new()
435 if (!ossl_cmp_msg_protect(ctx, msg)) in ossl_cmp_certreq_new()
438 return msg; in ossl_cmp_certreq_new()
443 OSSL_CMP_MSG_free(msg); in ossl_cmp_certreq_new()
491 OSSL_CMP_MSG *msg = NULL; in ossl_cmp_certrep_new() local
499 if ((msg = ossl_cmp_msg_create(ctx, bodytype)) == NULL) in ossl_cmp_certrep_new()
501 repMsg = msg->body->value.ip; /* value.ip is same for cp and kup */ in ossl_cmp_certrep_new()
504 if (ctx->implicitConfirm && !ossl_cmp_hdr_set_implicitConfirm(msg->header)) in ossl_cmp_certrep_new()
551 && !ossl_x509_add_certs_new(&msg->extraCerts, chain, in ossl_cmp_certrep_new()
557 if (!ossl_cmp_msg_protect(ctx, msg)) in ossl_cmp_certrep_new()
560 return msg; in ossl_cmp_certrep_new()
565 OSSL_CMP_MSG_free(msg); in ossl_cmp_certrep_new()
571 OSSL_CMP_MSG *msg = NULL; in ossl_cmp_rr_new() local
612 if ((msg = ossl_cmp_msg_create(ctx, OSSL_CMP_PKIBODY_RR)) == NULL) in ossl_cmp_rr_new()
615 if (!sk_OSSL_CMP_REVDETAILS_push(msg->body->value.rr, rd)) in ossl_cmp_rr_new()
620 if (!ossl_cmp_msg_protect(ctx, msg)) in ossl_cmp_rr_new()
623 return msg; in ossl_cmp_rr_new()
627 OSSL_CMP_MSG_free(msg); in ossl_cmp_rr_new()
638 OSSL_CMP_MSG *msg = NULL; in ossl_cmp_rp_new() local
643 if ((msg = ossl_cmp_msg_create(ctx, OSSL_CMP_PKIBODY_RP)) == NULL) in ossl_cmp_rp_new()
645 rep = msg->body->value.rp; in ossl_cmp_rp_new()
665 if (!ossl_cmp_msg_protect(ctx, msg)) in ossl_cmp_rp_new()
668 return msg; in ossl_cmp_rp_new()
674 OSSL_CMP_MSG_free(msg); in ossl_cmp_rp_new()
680 OSSL_CMP_MSG *msg; in ossl_cmp_pkiconf_new() local
685 if ((msg = ossl_cmp_msg_create(ctx, OSSL_CMP_PKIBODY_PKICONF)) == NULL) in ossl_cmp_pkiconf_new()
687 if (ossl_cmp_msg_protect(ctx, msg)) in ossl_cmp_pkiconf_new()
688 return msg; in ossl_cmp_pkiconf_new()
692 OSSL_CMP_MSG_free(msg); in ossl_cmp_pkiconf_new()
696 int ossl_cmp_msg_gen_push0_ITAV(OSSL_CMP_MSG *msg, OSSL_CMP_ITAV *itav) in ossl_cmp_msg_gen_push0_ITAV() argument
700 if (!ossl_assert(msg != NULL && itav != NULL)) in ossl_cmp_msg_gen_push0_ITAV()
703 bodytype = OSSL_CMP_MSG_get_bodytype(msg); in ossl_cmp_msg_gen_push0_ITAV()
711 return OSSL_CMP_ITAV_push0_stack_item(&msg->body->value.genm, itav); in ossl_cmp_msg_gen_push0_ITAV()
714 int ossl_cmp_msg_gen_push1_ITAVs(OSSL_CMP_MSG *msg, in ossl_cmp_msg_gen_push1_ITAVs() argument
720 if (!ossl_assert(msg != NULL)) in ossl_cmp_msg_gen_push1_ITAVs()
726 || !ossl_cmp_msg_gen_push0_ITAV(msg, itav)) { in ossl_cmp_msg_gen_push1_ITAVs()
742 OSSL_CMP_MSG *msg = NULL; in gen_new() local
747 if ((msg = ossl_cmp_msg_create(ctx, body_type)) == NULL) in gen_new()
750 if (itavs != NULL && !ossl_cmp_msg_gen_push1_ITAVs(msg, itavs)) in gen_new()
753 if (!ossl_cmp_msg_protect(ctx, msg)) in gen_new()
756 return msg; in gen_new()
760 OSSL_CMP_MSG_free(msg); in gen_new()
781 OSSL_CMP_MSG *msg = NULL; in ossl_cmp_error_new() local
788 if ((msg = ossl_cmp_msg_create(ctx, OSSL_CMP_PKIBODY_ERROR)) == NULL) in ossl_cmp_error_new()
791 OSSL_CMP_PKISI_free(msg->body->value.error->pKIStatusInfo); in ossl_cmp_error_new()
792 if ((msg->body->value.error->pKIStatusInfo = OSSL_CMP_PKISI_dup(si)) in ossl_cmp_error_new()
795 if ((msg->body->value.error->errorCode = ASN1_INTEGER_new()) == NULL) in ossl_cmp_error_new()
797 if (!ASN1_INTEGER_set_int64(msg->body->value.error->errorCode, errorCode)) in ossl_cmp_error_new()
807 msg->body->value.error->errorDetails = ft; in ossl_cmp_error_new()
819 if (!unprotected && !ossl_cmp_msg_protect(ctx, msg)) in ossl_cmp_error_new()
821 return msg; in ossl_cmp_error_new()
825 OSSL_CMP_MSG_free(msg); in ossl_cmp_error_new()
847 OSSL_CMP_MSG *msg = NULL; in ossl_cmp_certConf_new() local
864 if ((msg = ossl_cmp_msg_create(ctx, OSSL_CMP_PKIBODY_CERTCONF)) == NULL) in ossl_cmp_certConf_new()
870 if (sk_OSSL_CMP_CERTSTATUS_push(msg->body->value.certConf, certStatus) < 1) { in ossl_cmp_certConf_new()
888 if (!ossl_cmp_hdr_set_pvno(msg->header, OSSL_CMP_PVNO_3)) in ossl_cmp_certConf_new()
913 if (!ossl_cmp_msg_protect(ctx, msg)) in ossl_cmp_certConf_new()
916 return msg; in ossl_cmp_certConf_new()
920 OSSL_CMP_MSG_free(msg); in ossl_cmp_certConf_new()
927 OSSL_CMP_MSG *msg = NULL; in ossl_cmp_pollReq_new() local
933 if ((msg = ossl_cmp_msg_create(ctx, OSSL_CMP_PKIBODY_POLLREQ)) == NULL) in ossl_cmp_pollReq_new()
938 || !sk_OSSL_CMP_POLLREQ_push(msg->body->value.pollReq, preq)) in ossl_cmp_pollReq_new()
942 if (!ossl_cmp_msg_protect(ctx, msg)) in ossl_cmp_pollReq_new()
945 return msg; in ossl_cmp_pollReq_new()
950 OSSL_CMP_MSG_free(msg); in ossl_cmp_pollReq_new()
957 OSSL_CMP_MSG *msg; in ossl_cmp_pollRep_new() local
963 if ((msg = ossl_cmp_msg_create(ctx, OSSL_CMP_PKIBODY_POLLREP)) == NULL) in ossl_cmp_pollRep_new()
967 if (!sk_OSSL_CMP_POLLREP_push(msg->body->value.pollRep, prep)) in ossl_cmp_pollRep_new()
974 if (!ossl_cmp_msg_protect(ctx, msg)) in ossl_cmp_pollRep_new()
976 return msg; in ossl_cmp_pollRep_new()
980 OSSL_CMP_MSG_free(msg); in ossl_cmp_pollRep_new()
1168 int OSSL_CMP_MSG_update_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg) in OSSL_CMP_MSG_update_transactionID() argument
1170 if (ctx == NULL || msg == NULL) { in OSSL_CMP_MSG_update_transactionID()
1174 if (!ossl_cmp_hdr_set_transactionID(ctx, msg->header)) in OSSL_CMP_MSG_update_transactionID()
1176 return msg->header->protectionAlg == NULL in OSSL_CMP_MSG_update_transactionID()
1177 || ossl_cmp_msg_protect(ctx, msg); in OSSL_CMP_MSG_update_transactionID()
1180 int OSSL_CMP_MSG_update_recipNonce(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg) in OSSL_CMP_MSG_update_recipNonce() argument
1182 if (ctx == NULL || msg == NULL || msg->header == NULL) { in OSSL_CMP_MSG_update_recipNonce()
1188 if (!ossl_cmp_asn1_octet_string_set1(&msg->header->recipNonce, in OSSL_CMP_MSG_update_recipNonce()
1191 return msg->header->protectionAlg == NULL || ossl_cmp_msg_protect(ctx, msg); in OSSL_CMP_MSG_update_recipNonce()
1197 OSSL_CMP_MSG *msg; in OSSL_CMP_MSG_read() local
1205 msg = OSSL_CMP_MSG_new(libctx, propq); in OSSL_CMP_MSG_read()
1206 if (msg == NULL) { in OSSL_CMP_MSG_read()
1212 || d2i_OSSL_CMP_MSG_bio(bio, &msg) == NULL) { in OSSL_CMP_MSG_read()
1213 OSSL_CMP_MSG_free(msg); in OSSL_CMP_MSG_read()
1214 msg = NULL; in OSSL_CMP_MSG_read()
1217 return msg; in OSSL_CMP_MSG_read()
1220 int OSSL_CMP_MSG_write(const char *file, const OSSL_CMP_MSG *msg) in OSSL_CMP_MSG_write() argument
1225 if (file == NULL || msg == NULL) { in OSSL_CMP_MSG_write()
1233 res = i2d_OSSL_CMP_MSG_bio(bio, msg); in OSSL_CMP_MSG_write()
1238 OSSL_CMP_MSG *d2i_OSSL_CMP_MSG(OSSL_CMP_MSG **msg, const unsigned char **in, in d2i_OSSL_CMP_MSG() argument
1244 if (msg != NULL && *msg != NULL) { in d2i_OSSL_CMP_MSG()
1245 libctx = (*msg)->libctx; in d2i_OSSL_CMP_MSG()
1246 propq = (*msg)->propq; in d2i_OSSL_CMP_MSG()
1249 return (OSSL_CMP_MSG *)ASN1_item_d2i_ex((ASN1_VALUE **)msg, in, len, in d2i_OSSL_CMP_MSG()
1254 int i2d_OSSL_CMP_MSG(const OSSL_CMP_MSG *msg, unsigned char **out) in i2d_OSSL_CMP_MSG() argument
1256 return ASN1_item_i2d((const ASN1_VALUE *)msg, out, in i2d_OSSL_CMP_MSG()
1260 OSSL_CMP_MSG *d2i_OSSL_CMP_MSG_bio(BIO *bio, OSSL_CMP_MSG **msg) in d2i_OSSL_CMP_MSG_bio() argument
1265 if (msg != NULL && *msg != NULL) { in d2i_OSSL_CMP_MSG_bio()
1266 libctx = (*msg)->libctx; in d2i_OSSL_CMP_MSG_bio()
1267 propq = (*msg)->propq; in d2i_OSSL_CMP_MSG_bio()
1270 return ASN1_item_d2i_bio_ex(ASN1_ITEM_rptr(OSSL_CMP_MSG), bio, msg, libctx, in d2i_OSSL_CMP_MSG_bio()
1274 int i2d_OSSL_CMP_MSG_bio(BIO *bio, const OSSL_CMP_MSG *msg) in i2d_OSSL_CMP_MSG_bio() argument
1276 return ASN1_i2d_bio_of(OSSL_CMP_MSG, i2d_OSSL_CMP_MSG, bio, msg); in i2d_OSSL_CMP_MSG_bio()
1279 int ossl_cmp_is_error_with_waiting(const OSSL_CMP_MSG *msg) in ossl_cmp_is_error_with_waiting() argument
1281 if (!ossl_assert(msg != NULL)) in ossl_cmp_is_error_with_waiting()
1284 return (OSSL_CMP_MSG_get_bodytype(msg) == OSSL_CMP_PKIBODY_ERROR in ossl_cmp_is_error_with_waiting()
1285 && ossl_cmp_pkisi_get_status(msg->body->value.error->pKIStatusInfo) in ossl_cmp_is_error_with_waiting()