You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1.8 KiB

  1. /* Copyright (c) 2014, Google Inc.
  2. *
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. *
  7. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  10. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
  14. #ifndef OPENSSL_HEADER_BYTESTRING_INTERNAL_H
  15. #define OPENSSL_HEADER_BYTESTRING_INTERNAL_H
  16. #include <openssl/base.h>
  17. #if defined(__cplusplus)
  18. extern "C" {
  19. #endif
  20. /* CBS_asn1_ber_to_der reads an ASN.1 structure from |in|. If it finds
  21. * indefinite-length elements then it attempts to convert the BER data to DER
  22. * and sets |*out| and |*out_length| to describe a malloced buffer containing
  23. * the DER data. Additionally, |*in| will be advanced over the ASN.1 data.
  24. *
  25. * If it doesn't find any indefinite-length elements then it sets |*out| to
  26. * NULL and |*in| is unmodified.
  27. *
  28. * A sufficiently complex ASN.1 structure will break this function because it's
  29. * not possible to generically convert BER to DER without knowledge of the
  30. * structure itself. However, this sufficies to handle the PKCS#7 and #12 output
  31. * from NSS.
  32. *
  33. * It returns one on success and zero otherwise. */
  34. OPENSSL_EXPORT int CBS_asn1_ber_to_der(CBS *in, uint8_t **out, size_t *out_len);
  35. #if defined(__cplusplus)
  36. } /* extern C */
  37. #endif
  38. #endif /* OPENSSL_HEADER_BYTESTRING_INTERNAL_H */