In case anybody needs a portable MRF24J40 C driver with support for security, here is my contribution.
You can find the basic C driver at: https://github.com/briksoftware/mrf24j40
The higher-level transport protocol OSNP, which includes security can be found here: https://github.com/briksoftware/osnp
And finally an example project using these components: https://github.com/briksoftware/gradusnik
The Gradusnik project is being updated, to a more sane design, but the transport protocol remains the same. If there is interest I will post more details about that project as soon as I receive the new PCB and test that everything works.
This is part of a bigger open source project for home automation we (me and my wife) are working on, but it can also be used by itself.
OSNP is quite different from the Microchip's provided MiWi because is targeted to be used in a Master-Slave network architecture, where eventually many slaves exist (creating a start network). It is not meant to carry a lot of data in commands, and at the moment support for segmentation is not planned (but can be implemented at the higher level). The entire code of the example project, compiles to 9k including security, power management, device discovery, association, etc.
Both the MRF24J40 and OSNP code are platform agnostic. They have been tested with a PIC18, but they should work on anything providing the correct Hardware Abstraction Layer (it's really just a few functions).