diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/krb5/asn.1/asn1_decode.c | 4 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_decode.h | 2 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_k_decode.c | 59 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_k_decode.h | 5 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_k_decode_kdc.c | 14 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_k_decode_macros.h | 8 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_k_encode.c | 14 |
7 files changed, 57 insertions, 49 deletions
diff --git a/src/lib/krb5/asn.1/asn1_decode.c b/src/lib/krb5/asn.1/asn1_decode.c index 659fed86c..53e204549 100644 --- a/src/lib/krb5/asn.1/asn1_decode.c +++ b/src/lib/krb5/asn.1/asn1_decode.c @@ -153,11 +153,11 @@ asn1_decode_maybe_unsigned(asn1buf *buf, unsigned long *val) } asn1_error_code -asn1_decode_oid(asn1buf *buf, unsigned int *retlen, asn1_octet **val) +asn1_decode_oid(asn1buf *buf, unsigned int *retlen, char **val) { setup(); tag(ASN1_OBJECTIDENTIFIER); - retval = asn1buf_remove_octetstring(buf, length, val); + retval = asn1buf_remove_charstring(buf, length, val); if (retval) return retval; *retlen = length; cleanup(); diff --git a/src/lib/krb5/asn.1/asn1_decode.h b/src/lib/krb5/asn.1/asn1_decode.h index d495040c8..0e14491de 100644 --- a/src/lib/krb5/asn.1/asn1_decode.h +++ b/src/lib/krb5/asn.1/asn1_decode.h @@ -67,7 +67,7 @@ asn1_error_code asn1_decode_maybe_unsigned(asn1buf *buf, unsigned long *val); asn1_error_code asn1_decode_null(asn1buf *buf); asn1_error_code asn1_decode_oid(asn1buf *buf, unsigned int *retlen, - asn1_octet **val); + char **val); asn1_error_code asn1_decode_octetstring(asn1buf *buf, unsigned int *retlen, asn1_octet **val); asn1_error_code asn1_decode_generalstring(asn1buf *buf, unsigned int *retlen, diff --git a/src/lib/krb5/asn.1/asn1_k_decode.c b/src/lib/krb5/asn.1/asn1_k_decode.c index f1f4e734b..9d052ca37 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.c +++ b/src/lib/krb5/asn.1/asn1_k_decode.c @@ -1187,9 +1187,12 @@ asn1_decode_external_principal_identifier( val->subjectKeyIdentifier.data = NULL; { begin_structure(); - opt_implicit_octet_string(val->subjectName.length, val->subjectName.data, 0); - opt_implicit_octet_string(val->issuerAndSerialNumber.length, val->issuerAndSerialNumber.data, 1); - opt_implicit_octet_string(val->subjectKeyIdentifier.length, val->subjectKeyIdentifier.data, 2); + opt_implicit_charstring(val->subjectName.length, val->subjectName.data, + 0); + opt_implicit_charstring(val->issuerAndSerialNumber.length, + val->issuerAndSerialNumber.data, 1); + opt_implicit_charstring(val->subjectKeyIdentifier.length, + val->subjectKeyIdentifier.data, 2); end_structure(); } return 0; @@ -1305,12 +1308,14 @@ asn1_decode_trusted_ca(asn1buf *buf, krb5_trusted_ca *val) } else if (tagnum == choice_trusted_cas_caName) { val->choice = choice_trusted_cas_caName; val->u.caName.data = NULL; - get_implicit_octet_string(val->u.caName.length, val->u.caName.data, choice_trusted_cas_caName); + get_implicit_charstring(val->u.caName.length, val->u.caName.data, + choice_trusted_cas_caName); } else if (tagnum == choice_trusted_cas_issuerAndSerial) { val->choice = choice_trusted_cas_issuerAndSerial; val->u.issuerAndSerial.data = NULL; - get_implicit_octet_string(val->u.issuerAndSerial.length, val->u.issuerAndSerial.data, - choice_trusted_cas_issuerAndSerial); + get_implicit_charstring(val->u.issuerAndSerial.length, + val->u.issuerAndSerial.data, + choice_trusted_cas_issuerAndSerial); } else clean_return(ASN1_BAD_ID); end_choice(); } @@ -1349,9 +1354,9 @@ asn1_decode_sequence_of_trusted_ca(asn1buf *buf, krb5_trusted_ca ***val) } static asn1_error_code -asn1_decode_kdf_alg_id_ptr(asn1buf *buf, krb5_octet_data **valptr) +asn1_decode_kdf_alg_id_ptr(asn1buf *buf, krb5_data **valptr) { - decode_ptr(krb5_octet_data *, asn1_decode_kdf_alg_id); + decode_ptr(krb5_data *, asn1_decode_kdf_alg_id); } asn1_error_code @@ -1362,9 +1367,11 @@ asn1_decode_dh_rep_info(asn1buf *buf, krb5_dh_rep_info *val) val->serverDHNonce.data = NULL; val->kdfID = NULL; { begin_structure(); - get_implicit_octet_string(val->dhSignedData.length, val->dhSignedData.data, 0); + get_implicit_charstring(val->dhSignedData.length, + val->dhSignedData.data, 0); - opt_lenfield(val->serverDHNonce.length, val->serverDHNonce.data, 1, asn1_decode_octetstring); + opt_lenfield(val->serverDHNonce.length, val->serverDHNonce.data, 1, + asn1_decode_charstring); opt_field(val->kdfID, 2, asn1_decode_kdf_alg_id_ptr, NULL); end_structure(); } @@ -1372,7 +1379,7 @@ asn1_decode_dh_rep_info(asn1buf *buf, krb5_dh_rep_info *val) error_out: free(val->dhSignedData.data); free(val->serverDHNonce.data); - krb5_free_octet_data(NULL, val->kdfID); + krb5_free_data(NULL, val->kdfID); val->kdfID = NULL; val->dhSignedData.data = NULL; val->serverDHNonce.data = NULL; @@ -1451,8 +1458,8 @@ asn1_decode_algorithm_identifier(asn1buf *buf, krb5_algorithm_identifier *val) assert(subbuf.next >= subbuf.base); if (length > (size_t)(subbuf.next - subbuf.base)) { unsigned int size = length - (subbuf.next - subbuf.base); - retval = asn1buf_remove_octetstring(&subbuf, size, - &val->parameters.data); + retval = asn1buf_remove_charstring(&subbuf, size, + &val->parameters.data); if (retval) clean_return(retval); val->parameters.length = size; } @@ -1504,8 +1511,8 @@ asn1_decode_subject_pk_info(asn1buf *buf, krb5_subject_pk_info *val) val->subjectPublicKey.length = 0; val->subjectPublicKey.data = NULL; - retval = asn1buf_remove_octetstring(&subbuf, taglen, - &val->subjectPublicKey.data); + retval = asn1buf_remove_charstring(&subbuf, taglen, + &val->subjectPublicKey.data); if (retval) clean_return(retval); val->subjectPublicKey.length = taglen; /* @@ -1549,7 +1556,8 @@ asn1_decode_kdc_dh_key_info(asn1buf *buf, krb5_kdc_dh_key_info *val) setup(); val->subjectPublicKey.data = NULL; { begin_structure(); - retval = asn1buf_remove_octetstring(&subbuf, taglen, &val->subjectPublicKey.data); + retval = asn1buf_remove_charstring(&subbuf, taglen, + &val->subjectPublicKey.data); if (retval) clean_return(retval); val->subjectPublicKey.length = taglen; next_tag(); @@ -1641,8 +1649,9 @@ asn1_decode_pa_pk_as_rep(asn1buf *buf, krb5_pa_pk_as_rep *val) } else if (tagnum == choice_pa_pk_as_rep_encKeyPack) { val->choice = choice_pa_pk_as_rep_encKeyPack; val->u.encKeyPack.data = NULL; - get_implicit_octet_string(val->u.encKeyPack.length, val->u.encKeyPack.data, - choice_pa_pk_as_rep_encKeyPack); + get_implicit_charstring(val->u.encKeyPack.length, + val->u.encKeyPack.data, + choice_pa_pk_as_rep_encKeyPack); } else { val->choice = choice_pa_pk_as_rep_UNKNOWN; } @@ -1670,12 +1679,14 @@ asn1_decode_pa_pk_as_rep_draft9(asn1buf *buf, krb5_pa_pk_as_rep_draft9 *val) val->choice = choice_pa_pk_as_rep_draft9_dhSignedData; val->u.dhSignedData.data = NULL; get_lenfield(val->u.dhSignedData.length, val->u.dhSignedData.data, - choice_pa_pk_as_rep_draft9_dhSignedData, asn1_decode_octetstring); + choice_pa_pk_as_rep_draft9_dhSignedData, + asn1_decode_charstring); } else if (tagnum == choice_pa_pk_as_rep_draft9_encKeyPack) { val->choice = choice_pa_pk_as_rep_draft9_encKeyPack; val->u.encKeyPack.data = NULL; get_lenfield(val->u.encKeyPack.length, val->u.encKeyPack.data, - choice_pa_pk_as_rep_draft9_encKeyPack, asn1_decode_octetstring); + choice_pa_pk_as_rep_draft9_encKeyPack, + asn1_decode_charstring); } else { val->choice = choice_pa_pk_as_rep_draft9_UNKNOWN; } @@ -1692,7 +1703,7 @@ error_out: } asn1_error_code -asn1_decode_kdf_alg_id( asn1buf *buf, krb5_octet_data *val) +asn1_decode_kdf_alg_id( asn1buf *buf, krb5_data *val) { setup(); val->data = NULL; @@ -1707,11 +1718,9 @@ error_out: } asn1_error_code -asn1_decode_sequence_of_kdf_alg_id(asn1buf *buf, - krb5_octet_data ***val) +asn1_decode_sequence_of_kdf_alg_id(asn1buf *buf, krb5_data ***val) { - decode_array_body(krb5_octet_data, asn1_decode_kdf_alg_id_ptr, - krb5_free_octet_data); + decode_array_body(krb5_data, asn1_decode_kdf_alg_id_ptr, krb5_free_data); } #endif /* DISABLE_PKINIT */ diff --git a/src/lib/krb5/asn.1/asn1_k_decode.h b/src/lib/krb5/asn.1/asn1_k_decode.h index 7ce32956c..71eebb14a 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.h +++ b/src/lib/krb5/asn.1/asn1_k_decode.h @@ -277,10 +277,9 @@ asn1_error_code asn1_decode_iakerb_finished(asn1buf *buf, krb5_iakerb_finished *val); asn1_error_code -asn1_decode_kdf_alg_id(asn1buf *buf, krb5_octet_data *val); +asn1_decode_kdf_alg_id(asn1buf *buf, krb5_data *val); asn1_error_code -asn1_decode_sequence_of_kdf_alg_id(asn1buf *buf, - krb5_octet_data ***val); +asn1_decode_sequence_of_kdf_alg_id(asn1buf *buf, krb5_data ***val); #endif diff --git a/src/lib/krb5/asn.1/asn1_k_decode_kdc.c b/src/lib/krb5/asn.1/asn1_k_decode_kdc.c index 73abbd4c4..c340abcfd 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode_kdc.c +++ b/src/lib/krb5/asn.1/asn1_k_decode_kdc.c @@ -131,9 +131,9 @@ asn1_decode_pa_pk_as_req(asn1buf *buf, krb5_pa_pk_as_req *val) val->kdcPkId.data = NULL; { begin_structure(); - get_implicit_octet_string(val->signedAuthPack.length, val->signedAuthPack.data, 0); + get_implicit_charstring(val->signedAuthPack.length, val->signedAuthPack.data, 0); opt_field(val->trustedCertifiers, 1, asn1_decode_sequence_of_external_principal_identifier, NULL); - opt_implicit_octet_string(val->kdcPkId.length, val->kdcPkId.data, 2); + opt_implicit_charstring(val->kdcPkId.length, val->kdcPkId.data, 2); end_structure(); } return 0; @@ -167,10 +167,10 @@ asn1_decode_pa_pk_as_req_draft9(asn1buf *buf, krb5_pa_pk_as_req_draft9 *val) val->encryptionCert.data = NULL; val->trustedCertifiers = NULL; { begin_structure(); - get_implicit_octet_string(val->signedAuthPack.length, val->signedAuthPack.data, 0); + get_implicit_charstring(val->signedAuthPack.length, val->signedAuthPack.data, 0); opt_field(val->trustedCertifiers, 1, asn1_decode_sequence_of_trusted_ca, NULL); - opt_lenfield(val->kdcCert.length, val->kdcCert.data, 2, asn1_decode_octetstring); - opt_lenfield(val->encryptionCert.length, val->encryptionCert.data, 2, asn1_decode_octetstring); + opt_lenfield(val->kdcCert.length, val->kdcCert.data, 2, asn1_decode_charstring); + opt_lenfield(val->encryptionCert.length, val->encryptionCert.data, 2, asn1_decode_charstring); end_structure(); } return 0; @@ -238,7 +238,7 @@ asn1_decode_auth_pack(asn1buf *buf, krb5_auth_pack *val) next_tag(); } else val->supportedCMSTypes = NULL; } - opt_lenfield(val->clientDHNonce.length, val->clientDHNonce.data, 3, asn1_decode_octetstring); + opt_lenfield(val->clientDHNonce.length, val->clientDHNonce.data, 3, asn1_decode_charstring); opt_field(val->supportedKDFs, 4, asn1_decode_sequence_of_kdf_alg_id, NULL); end_structure(); } @@ -259,7 +259,7 @@ error_out: free(val->clientDHNonce.data); if (val->supportedKDFs) { for (i = 0; val->supportedKDFs[i]; i++) - krb5_free_octet_data(NULL, val->supportedKDFs[i]); + krb5_free_data(NULL, val->supportedKDFs[i]); free(val->supportedKDFs); val->supportedKDFs = NULL; } diff --git a/src/lib/krb5/asn.1/asn1_k_decode_macros.h b/src/lib/krb5/asn.1/asn1_k_decode_macros.h index e7c8a54eb..60da045ce 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode_macros.h +++ b/src/lib/krb5/asn.1/asn1_k_decode_macros.h @@ -202,20 +202,20 @@ asn1_get_eoc_tag (asn1buf *buf) /* * Deal with implicitly tagged fields */ -#define get_implicit_octet_string(len, var, tagexpect) \ +#define get_implicit_charstring(len, var, tagexpect) \ if (tagnum != (tagexpect)) clean_return(ASN1_MISSING_FIELD); \ if (asn1class != CONTEXT_SPECIFIC || construction != PRIMITIVE) \ clean_return(ASN1_BAD_ID); \ - retval = asn1buf_remove_octetstring(&subbuf, taglen, &(var)); \ + retval = asn1buf_remove_charstring(&subbuf, taglen, &(var)); \ if (retval) clean_return(retval); \ (len) = taglen; \ next_tag() -#define opt_implicit_octet_string(len, var, tagexpect) \ +#define opt_implicit_charstring(len, var, tagexpect) \ if (tagnum == (tagexpect)) { \ if (asn1class != CONTEXT_SPECIFIC || construction != PRIMITIVE) \ clean_return(ASN1_BAD_ID); \ - retval = asn1buf_remove_octetstring(&subbuf, taglen, &(var)); \ + retval = asn1buf_remove_charstring(&subbuf, taglen, &(var)); \ if (retval) clean_return(retval); \ (len) = taglen; \ next_tag(); \ diff --git a/src/lib/krb5/asn.1/asn1_k_encode.c b/src/lib/krb5/asn.1/asn1_k_encode.c index 018aae877..351281eeb 100644 --- a/src/lib/krb5/asn.1/asn1_k_encode.c +++ b/src/lib/krb5/asn.1/asn1_k_encode.c @@ -1622,15 +1622,15 @@ asn1_error_code asn1_encode_krb5_substructure(asn1buf *buf, #ifndef DISABLE_PKINIT DEFFNXTYPE(algorithm_identifier, krb5_algorithm_identifier, asn1_encode_algorithm_identifier); -DEFFNLENTYPE(object_identifier, asn1_octet *, asn1_encode_oid); -DEFFIELDTYPE(oid_data, krb5_octet_data, - FIELDOF_STRING(krb5_octet_data,object_identifier, data, length, -1)); +DEFFNLENTYPE(object_identifier, char *, asn1_encode_oid); +DEFFIELDTYPE(oid_data, krb5_data, + FIELDOF_STRING(krb5_data, object_identifier, data, length, -1)); DEFPTRTYPE(oid_data_ptr, oid_data); static const struct field_info kdf_alg_id_fields[] = { - FIELDOF_ENCODEAS(krb5_octet_data, oid_data, 0) + FIELDOF_ENCODEAS(krb5_data, oid_data, 0) }; -DEFSEQTYPE(kdf_alg_id, krb5_octet_data, kdf_alg_id_fields, NULL); +DEFSEQTYPE(kdf_alg_id, krb5_data, kdf_alg_id_fields, NULL); DEFPTRTYPE(kdf_alg_id_ptr, kdf_alg_id); DEFNONEMPTYNULLTERMSEQOFTYPE(supported_kdfs, kdf_alg_id_ptr); DEFPTRTYPE(supported_kdfs_ptr, supported_kdfs); @@ -1664,8 +1664,8 @@ DEFSEQTYPE(sp80056a_other_info, krb5_sp80056a_other_info, sp80056a_other_info_fi /* For PkinitSuppPubInfo, for pkinit agility */ static const struct field_info pkinit_supp_pub_info_fields[] = { FIELDOF_NORM(krb5_pkinit_supp_pub_info, int32, enctype, 0), - FIELDOF_STRING(krb5_pkinit_supp_pub_info, octetstring, as_req.data, as_req.length, 1), - FIELDOF_STRING(krb5_pkinit_supp_pub_info, octetstring, pk_as_rep.data, pk_as_rep.length, 2), + FIELDOF_STRING(krb5_pkinit_supp_pub_info, charstring, as_req.data, as_req.length, 1), + FIELDOF_STRING(krb5_pkinit_supp_pub_info, charstring, pk_as_rep.data, pk_as_rep.length, 2), }; DEFSEQTYPE(pkinit_supp_pub_info, krb5_pkinit_supp_pub_info, pkinit_supp_pub_info_fields, NULL); |