summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-03-21 17:52:14 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-03-21 17:52:14 +0000
commit5d4ffbbeec12016b874d80590f49d3dfe25805b0 (patch)
tree6e42fea84278bb2ee573d8e719008a2468a0760b
parent90e79a4ffdcb4833c91bc9312c5b7f7ec9abc00b (diff)
downloadgnutls-5d4ffbbeec12016b874d80590f49d3dfe25805b0.tar.gz
*** empty log message ***
-rw-r--r--NEWS2
-rw-r--r--includes/gnutls/x509.h2
-rw-r--r--lib/gnutls_mpi.c32
-rw-r--r--lib/gnutls_mpi.h3
-rw-r--r--lib/x509/mpi.c32
-rw-r--r--lib/x509/mpi.h2
-rw-r--r--lib/x509/privkey_pkcs8.c3
7 files changed, 39 insertions, 37 deletions
diff --git a/NEWS b/NEWS
index 8fb567a906..cf222abcaf 100644
--- a/NEWS
+++ b/NEWS
@@ -8,7 +8,7 @@ Version 0.9.3
the plain RSA.
- The RSA premaster secret version check can no longer be disabled.
- Implemented the counter measure discussed in the paper "Attacking
- RSA-based Sessions in SSL/TLS", against the attack discussed in the
+ RSA-based Sessions in SSL/TLS", against the attack described in the
same paper.
- Added the functions: gnutls_handshake_get_last_in(),
gnutls_handshake_get_last_out().
diff --git a/includes/gnutls/x509.h b/includes/gnutls/x509.h
index 88bdbcd446..84a1c2e1bc 100644
--- a/includes/gnutls/x509.h
+++ b/includes/gnutls/x509.h
@@ -198,6 +198,8 @@ int gnutls_x509_privkey_init(gnutls_x509_privkey * key);
void gnutls_x509_privkey_deinit(gnutls_x509_privkey key);
int gnutls_x509_privkey_import(gnutls_x509_privkey key, const gnutls_datum * data,
gnutls_x509_crt_fmt format);
+int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey key, const gnutls_datum * data,
+ gnutls_x509_crt_fmt format, char * pass);
int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey privkey,
const gnutls_datum *m, const gnutls_datum *e,
const gnutls_datum *d, const gnutls_datum *p, const gnutls_datum *q,
diff --git a/lib/gnutls_mpi.c b/lib/gnutls_mpi.c
index 8406a6fb21..64d885ce24 100644
--- a/lib/gnutls_mpi.c
+++ b/lib/gnutls_mpi.c
@@ -26,7 +26,6 @@
#include <gnutls_int.h>
#include <libtasn1.h>
#include <gnutls_errors.h>
-#include <gnutls_num.h>
/* Functions that refer to the libgcrypt library.
*/
@@ -107,37 +106,6 @@ size_t s_len;
return 0;
}
-/* this function reads a (small) unsigned integer
- * from asn1 structs. Combines the read and the convertion
- * steps.
- */
-int _gnutls_x509_read_ui( ASN1_TYPE node, const char* value,
- opaque* tmpstr, int tmpstr_size, unsigned int* ret)
-{
-int len, result;
-
- len = tmpstr_size;
- result = asn1_read_value( node, value, tmpstr, &len);
- if (result != ASN1_SUCCESS) {
- return _gnutls_asn2err(result);
- }
-
- if (len == 1)
- *ret = tmpstr[0];
- else if (len == 2)
- *ret = _gnutls_read_uint16(tmpstr);
- else if (len == 3)
- *ret = _gnutls_read_uint24(tmpstr);
- else if (len == 4)
- *ret = _gnutls_read_uint32(tmpstr);
- else {
- gnutls_assert();
- return GNUTLS_E_UNIMPLEMENTED_FEATURE;
- }
-
- return 0;
-}
-
/* Writes the specified integer into the specified node.
*/
int _gnutls_x509_write_int( ASN1_TYPE node, const char* value, GNUTLS_MPI mpi)
diff --git a/lib/gnutls_mpi.h b/lib/gnutls_mpi.h
index 33f0836e44..4e0ab1ebf1 100644
--- a/lib/gnutls_mpi.h
+++ b/lib/gnutls_mpi.h
@@ -39,7 +39,4 @@ int _gnutls_x509_read_int( ASN1_TYPE node, const char* value,
char* tmpstr, int tmpstr_size, GNUTLS_MPI* ret_mpi);
int _gnutls_x509_write_int( ASN1_TYPE node, const char* value, GNUTLS_MPI mpi);
-int _gnutls_x509_read_ui( ASN1_TYPE node, const char* value,
- opaque* tmpstr, int tmpstr_size, unsigned int* ret);
-
#endif
diff --git a/lib/x509/mpi.c b/lib/x509/mpi.c
index 8e8cb69c5e..a534af160b 100644
--- a/lib/x509/mpi.c
+++ b/lib/x509/mpi.c
@@ -25,6 +25,7 @@
#include <libtasn1.h>
#include "common.h"
#include "x509.h"
+#include <gnutls_num.h>
#include "mpi.h"
/*
@@ -322,3 +323,34 @@ int _gnutls_x509_write_rsa_params( GNUTLS_MPI * params, int params_size,
return 0;
}
+
+/* this function reads a (small) unsigned integer
+ * from asn1 structs. Combines the read and the convertion
+ * steps.
+ */
+int _gnutls_x509_read_ui( ASN1_TYPE node, const char* value,
+ opaque* tmpstr, int tmpstr_size, unsigned int* ret)
+{
+int len, result;
+
+ len = tmpstr_size;
+ result = asn1_read_value( node, value, tmpstr, &len);
+ if (result != ASN1_SUCCESS) {
+ return _gnutls_asn2err(result);
+ }
+
+ if (len == 1)
+ *ret = tmpstr[0];
+ else if (len == 2)
+ *ret = _gnutls_read_uint16(tmpstr);
+ else if (len == 3)
+ *ret = _gnutls_read_uint24(tmpstr);
+ else if (len == 4)
+ *ret = _gnutls_read_uint32(tmpstr);
+ else {
+ gnutls_assert();
+ return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+ }
+
+ return 0;
+}
diff --git a/lib/x509/mpi.h b/lib/x509/mpi.h
index 4ea3bb1b1c..827d15953a 100644
--- a/lib/x509/mpi.h
+++ b/lib/x509/mpi.h
@@ -9,3 +9,5 @@ int _gnutls_x509_read_dsa_params(opaque * der, int dersize, GNUTLS_MPI * params)
int _gnutls_x509_write_rsa_params( GNUTLS_MPI * params, int params_size,
opaque * der, int* dersize);
+int _gnutls_x509_read_ui( ASN1_TYPE node, const char* value,
+ opaque* tmpstr, int tmpstr_size, unsigned int* ret);
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c
index 45abbb0e0d..c0613cbd3a 100644
--- a/lib/x509/privkey_pkcs8.c
+++ b/lib/x509/privkey_pkcs8.c
@@ -32,6 +32,7 @@
#include <pkcs5.h>
#include <privkey.h>
#include <extensions.h>
+#include <mpi.h>
#include <gnutls_algorithms.h>
struct pbkdf2_params {
@@ -301,7 +302,7 @@ static ASN1_TYPE decode_private_key_info( const gnutls_datum* der, gnutls_x509_p
* @format: One of DER or PEM
* @pass: the password to decode
*
- * This function will convert the given DER or PEM encoded PKCS8 encrypted key
+ * This function will convert the given DER or PEM encoded PKCS8 2.0 encrypted key
* to the native gnutls_x509_privkey format. The output will be stored in 'key'.
*
* If the Certificate is PEM encoded it should have a header of "ENCRYPTED PRIVATE KEY".