crypto engine

Nikos Mavrogiannopoulos nmav at
Tue May 6 16:35:15 CEST 2008

Simon Josefsson wrote:

> #1:
>   I think that avoiding struct's in the public API would be a good idea
>   (struct alignment always seem to cause problems on weirder platforms),
>   so how about instead of doing something like this:
> typedef struct gnutls_crypto_rnd {
>   int (*init)( void** ctx);
>   int (*rnd) ( void* ctx, int /* gnutls_rnd_level_t */ level, void* data, int datasize);
>   void (*deinit)( void* ctx);
> } gnutls_crypto_rnd_st;
> int gnutls_crypto_rnd_register( int priority, gnutls_crypto_rnd_st* s);
>   do this instead:
> typedef int (*gnutls_rng_init_func)( void** ctx);
> typedef int (*gnutls_rng_rnd_func) ( void* ctx, gnutls_rnd_level_t level, void* data, int datasize);
> typedef void (*gnutls_rng_deinit_func)( void* ctx);
> int gnutls_crypto_rnd_register( int priority,
>                                 gnutls_rng_init_func init,
>                                 gnutls_rng_rnd_func rnd,
>                                 gnutls_rng_deinit_func deinit);

I'm really thinking doing this. The only bad thing is that because of
the many functions that need to be registered the API would be quite
ugly, but anyway it would allow us to maintain a stable api.


More information about the Gnutls-devel mailing list