prot_part_der_len = (size_t)len;
pbm_str = (ASN1_STRING *)ppval;
- pbm_str_uc = pbm_str->data;
- pbm = d2i_OSSL_CRMF_PBMPARAMETER(NULL, &pbm_str_uc, pbm_str->length);
+ pbm_str_uc = ASN1_STRING_get0_data(pbm_str);
+ pbm = d2i_OSSL_CRMF_PBMPARAMETER(NULL, &pbm_str_uc, ASN1_STRING_length(pbm_str));
if (pbm == NULL) {
ERR_raise(ERR_LIB_CMP, CMP_R_WRONG_ALGORITHM_OID);
goto end;
if (!OSSL_CRMF_pbm_new(ctx->libctx, ctx->propq,
pbm, prot_part_der, prot_part_der_len,
- ctx->secretValue->data, ctx->secretValue->length,
+ ASN1_STRING_get0_data(ctx->secretValue), ASN1_STRING_length(ctx->secretValue),
&protection, &sig_len))
goto end;
#include "ct_local.h"
-#include <crypto/asn1.h>
-
int o2i_SCT_signature(SCT *sct, const unsigned char **in, size_t len)
{
size_t siglen;
if (d2i_ASN1_OCTET_STRING(&oct, &p, len) == NULL)
return NULL;
- p = oct->data;
- if ((sk = o2i_SCT_LIST(a, &p, oct->length)) != NULL)
+ p = ASN1_STRING_get0_data(oct);
+ if ((sk = o2i_SCT_LIST(a, &p, ASN1_STRING_length(oct))) != NULL)
*pp += len;
ASN1_OCTET_STRING_free(oct);
int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **out)
{
- ASN1_OCTET_STRING oct;
+ ASN1_OCTET_STRING *oct;
+ unsigned char *data = NULL;
int len;
- oct.data = NULL;
- if ((oct.length = i2o_SCT_LIST(a, &oct.data)) == -1)
+ if ((len = i2o_SCT_LIST(a, &data)) == -1)
return -1;
- len = i2d_ASN1_OCTET_STRING(&oct, out);
- OPENSSL_free(oct.data);
+ oct = ASN1_OCTET_STRING_new();
+ if (oct == NULL) {
+ OPENSSL_free(data);
+ return -1;
+ }
+ ASN1_STRING_set0(oct, data, len);
+ len = i2d_ASN1_OCTET_STRING(oct, out);
+ ASN1_OCTET_STRING_free(oct);
return len;
}
#include <openssl/asn1t.h>
#include <string.h>
-#include <crypto/asn1.h>
-
typedef struct SM2_Ciphertext_st SM2_Ciphertext;
DECLARE_ASN1_FUNCTIONS(SM2_Ciphertext)
return 0;
}
- *pt_size = sm2_ctext->C2->length;
+ *pt_size = ASN1_STRING_length(sm2_ctext->C2);
SM2_Ciphertext_free(sm2_ctext);
return 1;
goto done;
}
- if (sm2_ctext->C3->length != hash_size) {
+ if (ASN1_STRING_length(sm2_ctext->C3) != hash_size) {
ERR_raise(ERR_LIB_SM2, SM2_R_INVALID_ENCODING);
goto done;
}
- C2 = sm2_ctext->C2->data;
- C3 = sm2_ctext->C3->data;
- msg_len = sm2_ctext->C2->length;
+ C2 = ASN1_STRING_get0_data(sm2_ctext->C2);
+ C3 = ASN1_STRING_get0_data(sm2_ctext->C3);
+ msg_len = ASN1_STRING_length(sm2_ctext->C2);
if (*ptext_len < (size_t)msg_len) {
ERR_raise(ERR_LIB_SM2, SM2_R_BUFFER_TOO_SMALL);
goto done;
#include <openssl/asn1t.h>
#include "ts_local.h"
-#include <crypto/asn1.h>
-
ASN1_SEQUENCE(TS_MSG_IMPRINT) = {
ASN1_SIMPLE(TS_MSG_IMPRINT, hash_algo, X509_ALGOR),
ASN1_SIMPLE(TS_MSG_IMPRINT, hashed_msg, ASN1_OCTET_STRING)
return NULL;
}
tst_info_der = tst_info_wrapper->value.octet_string;
- p = tst_info_der->data;
- return d2i_TS_TST_INFO(NULL, &p, tst_info_der->length);
+ p = ASN1_STRING_get0_data(tst_info_der);
+ return d2i_TS_TST_INFO(NULL, &p, ASN1_STRING_length(tst_info_der));
}
#include "crypto/ess.h"
#include "ts_local.h"
-#include <crypto/asn1.h>
-
DEFINE_STACK_OF_CONST(EVP_MD)
static ASN1_INTEGER *def_serial_cb(struct TS_resp_ctx *, void *);
return 0;
}
digest = msg_imprint->hashed_msg;
- if (digest->length != md_size) {
+ if (ASN1_STRING_length(digest) != md_size) {
TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION,
"Bad message digest.");
TS_RESP_CTX_add_failure_info(ctx, TS_INFO_BAD_DATA_FORMAT);
#include "crypto/ess.h"
#include "ts_local.h"
-#include <crypto/asn1.h>
-
static int ts_verify_cert(X509_STORE *store, STACK_OF(X509) *untrusted,
X509 *signer, STACK_OF(X509) **chain);
static int ts_check_signing_certs(const PKCS7_SIGNER_INFO *si,
attr = PKCS7_get_signed_attribute(si, NID_id_smime_aa_signingCertificate);
if (attr == NULL || attr->type != V_ASN1_SEQUENCE)
return NULL;
- p = attr->value.sequence->data;
- return d2i_ESS_SIGNING_CERT(NULL, &p, attr->value.sequence->length);
+ p = ASN1_STRING_get0_data(attr->value.sequence);
+ return d2i_ESS_SIGNING_CERT(NULL, &p, ASN1_STRING_length(attr->value.sequence));
}
static ESS_SIGNING_CERT_V2 *ossl_ess_get_signing_cert_v2(const PKCS7_SIGNER_INFO *si)
attr = PKCS7_get_signed_attribute(si, NID_id_smime_aa_signingCertificateV2);
if (attr == NULL || attr->type != V_ASN1_SEQUENCE)
return NULL;
- p = attr->value.sequence->data;
- return d2i_ESS_SIGNING_CERT_V2(NULL, &p, attr->value.sequence->length);
+ p = ASN1_STRING_get0_data(attr->value.sequence);
+ return d2i_ESS_SIGNING_CERT_V2(NULL, &p, ASN1_STRING_length(attr->value.sequence));
}
static int ts_check_signing_certs(const PKCS7_SIGNER_INFO *si,