diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-12-10 15:46:11 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-12-10 15:46:11 +0000 |
commit | 4716f7e10de3f64f3321072803ee536e8e70734f (patch) | |
tree | ebf4fa98798456aa77557ee2effb9df2e4ef28b9 | |
parent | f5a583526d1314d1e6f2b8079a8dd6d68f3d85a8 (diff) | |
download | gnutls-4716f7e10de3f64f3321072803ee536e8e70734f.tar.gz |
Included gnutls_1_0_0_patches.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | lib/gnutls.h.in.in | 10 | ||||
-rw-r--r-- | lib/gnutls_dh_primes.c | 7 | ||||
-rw-r--r-- | lib/gnutls_rsa_export.c | 51 | ||||
-rw-r--r-- | lib/gnutls_state.c | 2 |
6 files changed, 67 insertions, 10 deletions
@@ -1,7 +1,8 @@ -Version 1.0.1 +Version 1.0.1 (10/12/2003) - Some minor fixes in the makefiles. They now include CFLAGS from libgcrypt or opencdk if installed in a non standard directory. - Fixed the SRP detection test in gnutls-cli-debug. +- Added gnutls_rsa_params_export_pkcs1() and gnutls_rsa_params_import_pkcs1(). Version 1.0.0 (04/12/2003) - Exported the static SRP group parameters. diff --git a/configure.in b/configure.in index 42c267683e..e894a0dd1e 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ AC_DEFINE_UNQUOTED(T_OS, "$target_os", [OS name]) dnl Gnutls Version GNUTLS_MAJOR_VERSION=1 GNUTLS_MINOR_VERSION=0 -GNUTLS_MICRO_VERSION=0 +GNUTLS_MICRO_VERSION=1 GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION", [version of gnutls]) @@ -28,7 +28,7 @@ AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE dnl This is the library version -GNUTLS_MOST_RECENT_INTERFACE=10 +GNUTLS_MOST_RECENT_INTERFACE=11 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION GNUTLS_OLDEST_INTERFACE=10 diff --git a/lib/gnutls.h.in.in b/lib/gnutls.h.in.in index d57263d18b..1d89595bd1 100644 --- a/lib/gnutls.h.in.in +++ b/lib/gnutls.h.in.in @@ -319,6 +319,7 @@ int gnutls_credentials_clear( gnutls_session session); /* cred is a structure defined by the kx algorithm */ int gnutls_credentials_set( gnutls_session, gnutls_credentials_type type, void* cred); +#define gnutls_cred_set gnutls_credentials_set /* Credential structures for SRP - used in gnutls_credentials_set(); */ @@ -420,12 +421,12 @@ void gnutls_global_set_log_level( int level); int gnutls_dh_params_init( gnutls_dh_params*); void gnutls_dh_params_deinit( gnutls_dh_params); int gnutls_dh_params_import_raw(gnutls_dh_params dh_params, const gnutls_datum *prime, - const gnutls_datum* generator); + const gnutls_datum* generator); int gnutls_dh_params_import_pkcs3(gnutls_dh_params params, const gnutls_datum * pkcs3_params, gnutls_x509_crt_fmt format); int gnutls_dh_params_generate2(gnutls_dh_params params, int bits); int gnutls_dh_params_export_pkcs3( gnutls_dh_params params, - gnutls_x509_crt_fmt format, unsigned char* params_data, size_t* params_data_size); + gnutls_x509_crt_fmt format, unsigned char* params_data, size_t* params_data_size); int gnutls_dh_params_export_raw(gnutls_dh_params params, gnutls_datum * prime, gnutls_datum * generator, unsigned int *bits); @@ -443,6 +444,11 @@ int gnutls_rsa_params_export_raw(gnutls_rsa_params params, gnutls_datum * m, gnutls_datum *e, gnutls_datum *d, gnutls_datum *p, gnutls_datum* q, gnutls_datum* u, unsigned int *bits); +int gnutls_rsa_params_export_pkcs1( gnutls_rsa_params params, + gnutls_x509_crt_fmt format, unsigned char* params_data, + size_t* params_data_size); +int gnutls_rsa_params_import_pkcs1(gnutls_rsa_params params, + const gnutls_datum * pkcs1_params, gnutls_x509_crt_fmt format); /* Session stuff */ diff --git a/lib/gnutls_dh_primes.c b/lib/gnutls_dh_primes.c index 58d5c9bc1f..6bbd179b8a 100644 --- a/lib/gnutls_dh_primes.c +++ b/lib/gnutls_dh_primes.c @@ -268,8 +268,6 @@ int ret; * * This function will extract the DHParams found in a PKCS3 formatted * structure. This is the format generated by "openssl dhparam" tool. - * The output will be allocated using gnutls_malloc() and will be put - * in prime and generator structures. * * If the structure is PEM encoded, it should have a header * of "BEGIN DH PARAMETERS". @@ -474,7 +472,8 @@ int gnutls_dh_params_export_pkcs3( gnutls_dh_params params, return GNUTLS_E_MEMORY_ERROR; } - if ((result=asn1_der_coding( c2, "", tmp, &len, NULL)) != ASN1_SUCCESS) { + if ((result=asn1_der_coding( c2, "", tmp, &len, NULL)) != ASN1_SUCCESS) + { gnutls_assert(); gnutls_free( tmp); asn1_delete_structure(&c2); @@ -502,7 +501,7 @@ int gnutls_dh_params_export_pkcs3( gnutls_dh_params params, if ((uint)result + 1 > *params_data_size) { gnutls_assert(); gnutls_free(out); - *params_data_size = result; + *params_data_size = result + 1; return GNUTLS_E_SHORT_MEMORY_BUFFER; } diff --git a/lib/gnutls_rsa_export.c b/lib/gnutls_rsa_export.c index bc9bbeb990..bc7104fb92 100644 --- a/lib/gnutls_rsa_export.c +++ b/lib/gnutls_rsa_export.c @@ -220,6 +220,57 @@ int gnutls_rsa_params_generate2(gnutls_rsa_params params, unsigned int bits) } /** + * gnutls_rsa_params_import_pkcs1 - This function will import RSA params from a pkcs1 structure + * @params: A structure where the parameters will be copied to + * @pkcs1_params: should contain a PKCS1 RSAPublicKey structure PEM or DER encoded + * @format: the format of params. PEM or DER. + * + * This function will extract the RSAPublicKey found in a PKCS1 formatted + * structure. + * + * If the structure is PEM encoded, it should have a header + * of "BEGIN RSA PRIVATE KEY". + * + * In case of failure a negative value will be returned, and + * 0 on success. + * + **/ +int gnutls_rsa_params_import_pkcs1(gnutls_rsa_params params, + const gnutls_datum * pkcs1_params, gnutls_x509_crt_fmt format) +{ + return gnutls_x509_privkey_import( params, pkcs1_params, + format); +} + + +/** + * gnutls_rsa_params_export_pkcs1 - This function will export RSA params to a pkcs1 structure + * @params: Holds the RSA parameters + * @format: the format of output params. One of PEM or DER. + * @params_data: will contain a PKCS1 RSAPublicKey structure PEM or DER encoded + * @params_data_size: holds the size of params_data (and will be replaced by the actual size of parameters) + * + * This function will export the given RSA parameters to a PKCS1 + * RSAPublicKey structure. If the buffer provided is not long enough to + * hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. + * + * If the structure is PEM encoded, it will have a header + * of "BEGIN RSA PRIVATE KEY". + * + * In case of failure a negative value will be returned, and + * 0 on success. + * + **/ +int gnutls_rsa_params_export_pkcs1( gnutls_rsa_params params, + gnutls_x509_crt_fmt format, unsigned char* params_data, + size_t* params_data_size) +{ + return gnutls_x509_privkey_export( params, format, + params_data, params_data_size); +} + + +/** * gnutls_rsa_params_export_raw - This function will export the RSA parameters * @params: a structure that holds the rsa parameters * @m: will hold the modulus diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index a56a668077..310f159ccb 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -783,7 +783,7 @@ void gnutls_session_set_ptr(gnutls_session session, void* ptr) * protocol and is only useful if a prior gnutls function call (e.g. * gnutls_handshake()) was interrupted for some reason, that is, if a function * returned GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN. In such a case, you might - * want to call select() (or poll()) before calling the interrupted gnutls + * want to call select() or poll() before calling the interrupted gnutls * function again. To tell you whether a file descriptor should be selected * for either reading or writing, gnutls_record_get_direction() returns 0 if * the interrupted function was trying to read data, and 1 if it was trying to |