mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

Make bignum non-public

Open daverodgman opened this issue 2 years ago • 1 comments

Remove bignum.h from the public interface.

This probably requires defining a simple replacement interface for importing/exporting bignums to replace APIs that currently expose mbedtls_mpi. Structs with private fields of type mbedtls_mpi will need to reference an internal bignum header to get this type.

  • [ ] remove bignum.h from the public include folder
  • [ ] define simple public interface for importing/exporting bignums. Probably just an array of bytes with a guarantee about byte order.
  • [ ] asn1.h, asn1write.h: mbedtls_asn1_get_mpi, mbedtls_asn1_write_mpi - move to replacement interface
  • [x] dhm.h: this will be internal
  • [ ] ecp.h: this will be internal
  • [ ] pk.h: investigate MBEDTLS_PK_DEBUG_MPI
  • [x] rsa.h: will be internal
  • [x] ssl.h: some private mbedtls_mpi struct fields, only for DHM in TLS 1.2 which is being removed
  • [ ] x509_crt.h:remove mbedtls_x509write_crt_set_serial() (functionality covered by mbedtls_x509write_crt_set_serial_raw)

Other consequences:

  • https://github.com/Mbed-TLS/mbedtls/issues/9070

daverodgman avatar Sep 01 '23 18:09 daverodgman

  • ecp.h: this should probably be internal?

Note: we can't make ecp.h internal without a regression unless we've done #7292, #7293 and #7294 first. (To clarify, since those are investigation tasks: I'm not talking about just doing the investigations, but about actually executing the tasks that will result from those investigations.)

mpg avatar Oct 23 '23 10:10 mpg