[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crypto engine

From: Nikos Mavrogiannopoulos
Subject: Re: crypto engine
Date: Tue, 06 May 2008 17:35:15 +0300
User-agent: Thunderbird (X11/20080227)

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]