summaryrefslogtreecommitdiff
path: root/libkeyring
diff options
context:
space:
mode:
authorforsyth <forsyth@vitanuova.com>2009-07-30 19:33:32 +0100
committerforsyth <forsyth@vitanuova.com>2009-07-30 19:33:32 +0100
commit032c0afdfc6ec3ccf93e50f635a1105d69e0a716 (patch)
treea0ebc214dbb4b214d56709185ea4921309263c62 /libkeyring
parentea1a81b6f8df49918483d91781f2791edf95a523 (diff)
20090730-1933
Diffstat (limited to 'libkeyring')
-rw-r--r--libkeyring/dsaalg.c13
-rw-r--r--libkeyring/egalg.c12
-rw-r--r--libkeyring/rsaalg.c12
3 files changed, 37 insertions, 0 deletions
diff --git a/libkeyring/dsaalg.c b/libkeyring/dsaalg.c
index 2af1edc9..9845d5f0 100644
--- a/libkeyring/dsaalg.c
+++ b/libkeyring/dsaalg.c
@@ -25,6 +25,11 @@ dsa_str2sk(char *str, char **strp)
dsa->secret = base64tobig(p, &p);
if(strp)
*strp = p;
+ if(dsa->pub.p == nil || dsa->pub.q == nil ||
+ dsa->pub.alpha == nil || dsa->pub.key == nil || dsa->secret == nil){
+ dsaprivfree(dsa);
+ return nil;
+ }
return dsa;
}
@@ -41,6 +46,10 @@ dsa_str2pk(char *str, char **strp)
dsa->key = base64tobig(p, &p);
if(strp)
*strp = p;
+ if(dsa->p == nil || dsa->q == nil || dsa->alpha == nil || dsa->key == nil){
+ dsapubfree(dsa);
+ return nil;
+ }
return dsa;
}
@@ -55,6 +64,10 @@ dsa_str2sig(char *str, char **strp)
dsa->s = base64tobig(p, &p);
if(strp)
*strp = p;
+ if(dsa->r == nil || dsa->s == nil){
+ dsasigfree(dsa);
+ return nil;
+ }
return dsa;
}
diff --git a/libkeyring/egalg.c b/libkeyring/egalg.c
index 3a914d0f..0c6b88d1 100644
--- a/libkeyring/egalg.c
+++ b/libkeyring/egalg.c
@@ -24,6 +24,10 @@ eg_str2sk(char *str, char **strp)
eg->secret = base64tobig(p, &p);
if(strp)
*strp = p;
+ if(eg->pub.p == nil || eg->pub.alpha == nil || eg->pub.key == nil || eg->secret == nil){
+ egprivfree(eg);
+ return nil;
+ }
return eg;
}
@@ -39,6 +43,10 @@ eg_str2pk(char *str, char **strp)
eg->key = base64tobig(p, &p);
if(strp)
*strp = p;
+ if(eg->p == nil || eg->alpha == nil || eg->key == nil){
+ egpubfree(eg);
+ return nil;
+ }
return eg;
}
@@ -53,6 +61,10 @@ eg_str2sig(char *str, char **strp)
eg->s = base64tobig(p, &p);
if(strp)
*strp = p;
+ if(eg->r == nil || eg->s == nil){
+ egsigfree(eg);
+ return nil;
+ }
return eg;
}
diff --git a/libkeyring/rsaalg.c b/libkeyring/rsaalg.c
index 44c3c262..f522f485 100644
--- a/libkeyring/rsaalg.c
+++ b/libkeyring/rsaalg.c
@@ -28,6 +28,12 @@ rsa_str2sk(char *str, char **strp)
rsa->c2 = base64tobig(p, &p);
if(strp)
*strp = p;
+ if(rsa->pub.n == nil || rsa->pub.ek == nil ||
+ rsa->dk == nil || rsa->p == nil || rsa->q == nil ||
+ rsa->kp == nil || rsa->kq == nil || rsa->c2 == nil){
+ rsaprivfree(rsa);
+ return nil;
+ }
return rsa;
}
@@ -43,6 +49,10 @@ rsa_str2pk(char *str, char **strp)
rsa->ek = base64tobig(p, &p);
if(strp)
*strp = p;
+ if(rsa->n == nil || rsa->ek == nil){
+ rsapubfree(rsa);
+ return nil;
+ }
return rsa;
}
@@ -54,6 +64,8 @@ rsa_str2sig(char *str, char **strp)
char *p;
rsa = base64tobig(str, &p);
+ if(rsa == nil)
+ return nil;
if(strp)
*strp = p;
return rsa;