2
0

ossl_DER_w_bn.pod 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. =pod
  2. =head1 NAME
  3. ossl_DER_w_boolean, ossl_DER_w_uint32, ossl_DER_w_bn, ossl_DER_w_null,
  4. ossl_DER_w_octet_string, ossl_DER_w_octet_string_uint32
  5. - internal DER writers for DER primitives
  6. =head1 SYNOPSIS
  7. #include "internal/der.h"
  8. int ossl_DER_w_boolean(WPACKET *pkt, int tag, int b);
  9. int ossl_DER_w_uint32(WPACKET *pkt, int tag, uint32_t v);
  10. int ossl_DER_w_bn(WPACKET *pkt, int tag, const BIGNUM *v);
  11. int ossl_DER_w_null(WPACKET *pkt, int tag);
  12. int ossl_DER_w_octet_string(WPACKET *pkt, int tag,
  13. const unsigned char *data, size_t data_n);
  14. int ossl_DER_w_octet_string_uint32(WPACKET *pkt, int tag, uint32_t value);
  15. =head1 DESCRIPTION
  16. All functions described here behave the same way, they prepend
  17. (remember that DER writers are used backwards) the DER encoding of
  18. their respective value to the already written output buffer held by
  19. I<pkt>.
  20. ossl_DER_w_boolean() writes the primitive BOOLEAN using the value I<b>.
  21. Any value that evaluates as true will render a B<true> BOOLEAN,
  22. otherwise a B<false> BOOLEAN.
  23. ossl_DER_w_uint32() and ossl_DER_w_bn() both write the primitive INTEGER using
  24. the value I<v>.
  25. =for comment Other similar functions for diverse C integers should be
  26. added.
  27. ossl_DER_w_null() writes the primitive NULL.
  28. ossl_DER_w_octet_string() writes the primitive OCTET STRING using the bytes
  29. from I<data> with a length of I<data_n>.
  30. ossl_DER_w_octet_string_uint32() writes the primitive OCTET STRING using a
  31. 32 bit value in I<value>.
  32. =head1 RETURN VALUES
  33. All the functions return 1 on success and 0 on failure. Failure may
  34. mean that the buffer held by the I<pkt> is too small, but may also
  35. mean that the values given to the functions are invalid, such as the provided
  36. I<tag> value being too large for the implementation.
  37. =head1 SEE ALSO
  38. L<DERlib(7)>
  39. =head1 COPYRIGHT
  40. Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  41. Licensed under the Apache License 2.0 (the "License"). You may not use
  42. this file except in compliance with the License. You can obtain a copy
  43. in the file LICENSE in the source distribution or at
  44. L<https://www.openssl.org/source/license.html>.
  45. =cut