summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-06-26 21:59:01 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-06-26 21:59:01 +0000
commit0dda86b26070c2ded6e9d8ae985539292146c7a4 (patch)
tree77c0b899cf3f1972e38472c8a2139739df8092b9 /lib
parent0c2575a5727ddf32aa597ad1de52941161d9ca90 (diff)
downloadgnutls-0dda86b26070c2ded6e9d8ae985539292146c7a4.tar.gz
some cleanups.
Diffstat (limited to 'lib')
-rw-r--r--lib/gnutls_state.c4
-rw-r--r--lib/pkix.asn3
-rw-r--r--lib/pkix_asn1_tab.c3
-rw-r--r--lib/x509/pkcs12_encr.c8
-rw-r--r--lib/x509/privkey_pkcs8.c2
5 files changed, 13 insertions, 7 deletions
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index 9ce65ae310..e58ac27f0c 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -213,8 +213,8 @@ int gnutls_init(gnutls_session * session, gnutls_connection_end con_end)
/* set the socket pointers to -1;
*/
- (*session)->internals.transport_recv_ptr = -1;
- (*session)->internals.transport_send_ptr = -1;
+ (*session)->internals.transport_recv_ptr = (gnutls_transport_ptr)-1;
+ (*session)->internals.transport_send_ptr = (gnutls_transport_ptr)-1;
/* set the default maximum record size for TLS
*/
diff --git a/lib/pkix.asn b/lib/pkix.asn
index b11e54da87..8933e7ae2d 100644
--- a/lib/pkix.asn
+++ b/lib/pkix.asn
@@ -1028,6 +1028,7 @@ pkcs-9-challengePassword ::= CHOICE {
printableString PrintableString (SIZE (1..pkcs-9-ub-challengePassword)),
utf8String UTF8String (SIZE (1..pkcs-9-ub-challengePassword)) }
+pkcs-9-localKeyId ::= OCTET STRING
-- PKCS #8 stuff
@@ -1162,7 +1163,7 @@ pkcs-12-CRLBag ::= SEQUENCE {
-- {OCTET STRING IDENTIFIED BY {pkcs-9-crlTypes 1}}
-- DER-encoded X.509 CRL stored in OCTET STRING
-pkcs-12-PKCS12Attribute ::= ANY
+pkcs-12-PKCS12Attribute ::= Attribute
-- PKCS #7 stuff (needed in PKCS 12)
diff --git a/lib/pkix_asn1_tab.c b/lib/pkix_asn1_tab.c
index 71615f716a..e5d9bbbd6c 100644
--- a/lib/pkix_asn1_tab.c
+++ b/lib/pkix_asn1_tab.c
@@ -928,6 +928,7 @@ const ASN1_ARRAY_TYPE pkix_asn1_tab[]={
{"pkcs-9-ub-challengePassword",524298,"1"},
{"utf8String",538968066,"UTF8String"},
{"pkcs-9-ub-challengePassword",524298,"1"},
+ {"pkcs-9-localKeyId",1073741831,0},
{"pkcs-8-PrivateKeyInfo",1610612741,0},
{"version",1073741826,"pkcs-8-Version"},
{"privateKeyAlgorithm",1073741826,"AlgorithmIdentifier"},
@@ -1030,7 +1031,7 @@ const ASN1_ARRAY_TYPE pkix_asn1_tab[]={
{"crlValue",541073421,0},
{0,1073743880,"0"},
{"crlId",1,0},
- {"pkcs-12-PKCS12Attribute",1073741837,0},
+ {"pkcs-12-PKCS12Attribute",1073741826,"Attribute"},
{"pkcs-7-data",1879048204,0},
{"iso",1073741825,"1"},
{"member-body",1073741825,"2"},
diff --git a/lib/x509/pkcs12_encr.c b/lib/x509/pkcs12_encr.c
index 50389f3ab4..36a664fdb3 100644
--- a/lib/x509/pkcs12_encr.c
+++ b/lib/x509/pkcs12_encr.c
@@ -46,7 +46,7 @@ _pkcs12_string_to_key (unsigned int id, const opaque *salt, unsigned int salt_si
cur_keylen = 0;
pwlen = strlen (pw);
- if (pwlen > 63/2 || salt_size > 8) {
+ if (pwlen > 63/2 || (salt_size % 8) != 0) {
gnutls_assert();
return GNUTLS_E_INVALID_REQUEST;
}
@@ -59,7 +59,7 @@ _pkcs12_string_to_key (unsigned int id, const opaque *salt, unsigned int salt_si
/* Store salt and password in BUF_I */
p = buf_i;
for(i=0; i < 64; i++)
- *p++ = salt [i%8];
+ *p++ = salt [i % salt_size];
for(i=j=0; i < 64; i += 2)
{
*p++ = 0;
@@ -73,6 +73,7 @@ _pkcs12_string_to_key (unsigned int id, const opaque *salt, unsigned int salt_si
md = gcry_md_open (GCRY_MD_SHA1, 0);
if (!md)
{
+ gnutls_assert();
return GNUTLS_E_DECRYPTION_FAILED;
}
for(i=0; i < 64; i++)
@@ -98,6 +99,7 @@ _pkcs12_string_to_key (unsigned int id, const opaque *salt, unsigned int salt_si
rc = gcry_mpi_scan (&num_b1, GCRYMPI_FMT_USG, buf_b, &n);
if (rc)
{
+ gnutls_assert();
return GNUTLS_E_DECRYPTION_FAILED;
}
gcry_mpi_add_ui (num_b1, num_b1, 1);
@@ -109,6 +111,7 @@ _pkcs12_string_to_key (unsigned int id, const opaque *salt, unsigned int salt_si
rc = gcry_mpi_scan (&num_ij, GCRYMPI_FMT_USG, buf_i + i, &n);
if (rc)
{
+ gnutls_assert();
return GNUTLS_E_DECRYPTION_FAILED;
}
gcry_mpi_add (num_ij, num_ij, num_b1);
@@ -117,6 +120,7 @@ _pkcs12_string_to_key (unsigned int id, const opaque *salt, unsigned int salt_si
rc = gcry_mpi_print (GCRYMPI_FMT_USG, buf_i + i, &n, num_ij);
if (rc)
{
+ gnutls_assert();
return GNUTLS_E_DECRYPTION_FAILED;
}
gcry_mpi_release (num_ij);
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c
index 6bce6c19c9..b54e935ce3 100644
--- a/lib/x509/privkey_pkcs8.c
+++ b/lib/x509/privkey_pkcs8.c
@@ -826,7 +826,7 @@ int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey key,
if (key->key == NULL) {
gnutls_assert();
- result = GNUTLS_E_ASN1_DER_ERROR;
+ result = GNUTLS_E_DECRYPTION_FAILED;
goto cleanup;
}