Lines Matching +full:- +full:- +full:raw +full:- +full:output
6 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
349 unsigned char *output, in mbedtls_psa_get_random() argument
358 psa_status_t status = psa_generate_random(output, output_size); in mbedtls_psa_get_random()
371 * \brief Convert a single raw coordinate to DER ASN.1 format. The output der
374 * \param raw_buf Buffer containing the raw coordinate to be
379 * \param der_buf_end End of the buffer used to store the DER output.
385 * \return MBEDTLS_ERR_ASN1_INVALID_DATA if the input raw
388 * \warning Raw and der buffer must not be overlapping.
403 --raw_len; in convert_raw_to_der_single_int()
410 /* Copy the raw coordinate to the end of der_buf. */ in convert_raw_to_der_single_int()
411 if ((p - der_buf_start) < len) { in convert_raw_to_der_single_int()
414 p -= len; in convert_raw_to_der_single_int()
419 if ((p - der_buf_start) < 1) { in convert_raw_to_der_single_int()
422 --p; in convert_raw_to_der_single_int()
433 int mbedtls_ecdsa_raw_to_der(size_t bits, const unsigned char *raw, size_t raw_len, in mbedtls_ecdsa_raw_to_der() argument
449 /* Since raw and der buffers might overlap, dump r and s before starting in mbedtls_ecdsa_raw_to_der()
451 memcpy(r, raw, coordinate_len); in mbedtls_ecdsa_raw_to_der()
452 memcpy(s, raw + coordinate_len, coordinate_len); in mbedtls_ecdsa_raw_to_der()
460 p -= ret; in mbedtls_ecdsa_raw_to_der()
467 p -= ret; in mbedtls_ecdsa_raw_to_der()
484 * \brief Convert a single integer from ASN.1 DER format to raw.
489 * \param raw Output buffer that will be filled with the
493 * \param coordinate_size Size (in bytes) of a single coordinate in raw
501 * is null (i.e. all zeros) or if the output raw buffer
502 * is too small to contain the converted raw value.
504 * \warning Der and raw buffers must not be overlapping.
507 unsigned char *raw, size_t coordinate_size) in convert_der_to_raw_single_int() argument
521 * - unpadded_len == 0. in convert_der_to_raw_single_int()
522 * - MSb set without a leading 0x00 (leading 0x00 is checked below). */ in convert_der_to_raw_single_int()
530 unpadded_len--; in convert_der_to_raw_single_int()
543 padding_len = coordinate_size - unpadded_len; in convert_der_to_raw_single_int()
544 /* raw buffer was already zeroed by the calling function so zero-padding in convert_der_to_raw_single_int()
546 memcpy(raw + padding_len, p, unpadded_len); in convert_der_to_raw_single_int()
549 return (int) (p - der); in convert_der_to_raw_single_int()
553 unsigned char *raw, size_t raw_size, size_t *raw_len) in mbedtls_ecdsa_der_to_raw() argument
561 /* The output raw buffer should be at least twice the size of a raw in mbedtls_ecdsa_der_to_raw()
585 data_len -= ret; in mbedtls_ecdsa_der_to_raw()
594 data_len -= ret; in mbedtls_ecdsa_der_to_raw()
597 if ((size_t) (p - der) != der_len) { in mbedtls_ecdsa_der_to_raw()
601 memcpy(raw, raw_tmp, 2 * coordinate_size); in mbedtls_ecdsa_der_to_raw()