|
From: | Brendan Doherty |
Subject: | c++ compatibility of crypto.h |
Date: | Tue, 7 Dec 2010 11:49:29 +1300 |
Hi, I’ve run into two problems when including gnutls/crypto.h into c++ code. - Missing extern "C" - Parameter names conflict with c++ keywords. The patch below fixes the two problems. Regards, Brendan Doherty Systems Architect Gentrack Ltd --- ../crypto.h 2010-12-07 11:46:25.000000000 +1300 +++ /gencore/gnutls-2.10.2/include/gnutls/crypto.h 2010-12-07 11:40:14.000000000 +1300 @@ -25,6 +25,11 @@ #ifndef GNUTLS_CRYPTO_H # define GNUTLS_CRYPTO_H +#ifdef __cplusplus +extern "C" +{ +#endif + typedef struct cipher_hd_st *gnutls_cipher_hd_t; int gnutls_cipher_init (gnutls_cipher_hd_t * handle, @@ -266,17 +271,17 @@ typedef struct gnutls_crypto_pk * parameters, depending on the operation */ int (*encrypt) (gnutls_pk_algorithm_t, gnutls_datum_t * ciphertext, const gnutls_datum_t * plaintext, - const gnutls_pk_params_st * public); + const gnutls_pk_params_st * pub); int (*decrypt) (gnutls_pk_algorithm_t, gnutls_datum_t * plaintext, const gnutls_datum_t * ciphertext, - const gnutls_pk_params_st * private); + const gnutls_pk_params_st * priv); int (*sign) (gnutls_pk_algorithm_t, gnutls_datum_t * signature, const gnutls_datum_t * data, - const gnutls_pk_params_st * private); + const gnutls_pk_params_st * priv); int (*verify) (gnutls_pk_algorithm_t, const gnutls_datum_t * data, const gnutls_datum_t * signature, - const gnutls_pk_params_st * public); + const gnutls_pk_params_st * pub); int (*generate) (gnutls_pk_algorithm_t, unsigned int nbits, gnutls_pk_params_st *); @@ -346,4 +351,8 @@ int gnutls_crypto_pk_register2 (int prio int gnutls_crypto_bigint_register2 (int priority, int version, const gnutls_crypto_bigint_st * s); +#ifdef __cplusplus +} +#endif + #endif |
[Prev in Thread] | Current Thread | [Next in Thread] |