Lines Matching defs:pkt
34 * length of cont_len bytes to pkt. The maximum supported content length is
39 int ossl_encode_der_length(WPACKET *pkt, size_t cont_len)
45 if (!WPACKET_put_bytes_u8(pkt, 0x82)
46 || !WPACKET_put_bytes_u16(pkt, cont_len))
50 && !WPACKET_put_bytes_u8(pkt, 0x81))
52 if (!WPACKET_put_bytes_u8(pkt, cont_len))
60 * Outputs the DER encoding of a positive ASN.1 INTEGER to pkt.
66 int ossl_encode_der_integer(WPACKET *pkt, const BIGNUM *n)
85 if (!WPACKET_start_sub_packet(pkt)
86 || !WPACKET_put_bytes_u8(pkt, ID_INTEGER)
87 || !ossl_encode_der_length(pkt, cont_len)
88 || !WPACKET_allocate_bytes(pkt, cont_len, &bnbytes)
89 || !WPACKET_close(pkt))
100 * Outputs the DER encoding of a DSA-Sig-Value or ECDSA-Sig-Value to pkt. pkt
101 * may be initialised with a NULL buffer which enables pkt to be used to
106 int ossl_encode_der_dsa_sig(WPACKET *pkt, const BIGNUM *r, const BIGNUM *s)
110 int isnull = WPACKET_is_null_buf(pkt);
112 if (!WPACKET_start_sub_packet(pkt))
121 dummypkt = pkt;
135 if (!WPACKET_put_bytes_u8(pkt, ID_SEQUENCE)
136 || !ossl_encode_der_length(pkt, cont_len)
138 * Really encode the integers. We already wrote to the main pkt
141 || (!isnull && !ossl_encode_der_integer(pkt, r))
142 || (!isnull && !ossl_encode_der_integer(pkt, s))
143 || !WPACKET_close(pkt))
150 * Decodes the DER length octets in pkt and initialises subpkt with the
155 int ossl_decode_der_length(PACKET *pkt, PACKET *subpkt)
159 if (!PACKET_get_1(pkt, &byte))
163 return PACKET_get_sub_packet(pkt, subpkt, (size_t)byte);
165 return PACKET_get_length_prefixed_1(pkt, subpkt);
167 return PACKET_get_length_prefixed_2(pkt, subpkt);
174 * Decodes a single ASN.1 INTEGER value from pkt, which must be DER encoded,
178 * pkt must not be NULL.
187 int ossl_decode_der_integer(PACKET *pkt, BIGNUM *n)
193 if (!PACKET_get_1(pkt, &tag)
195 || !ossl_decode_der_length(pkt, &contpkt))
237 PACKET pkt, contpkt;
240 if (!PACKET_buf_init(&pkt, *ppin, len)
241 || !PACKET_get_1(&pkt, &tag)
243 || !ossl_decode_der_length(&pkt, &contpkt)
249 consumed = PACKET_data(&pkt) - *ppin;