diff options
| author | forsyth <forsyth@vitanuova.com> | 2009-07-30 19:33:32 +0100 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2009-07-30 19:33:32 +0100 |
| commit | 032c0afdfc6ec3ccf93e50f635a1105d69e0a716 (patch) | |
| tree | a0ebc214dbb4b214d56709185ea4921309263c62 /libkeyring/rsaalg.c | |
| parent | ea1a81b6f8df49918483d91781f2791edf95a523 (diff) | |
20090730-1933
Diffstat (limited to 'libkeyring/rsaalg.c')
| -rw-r--r-- | libkeyring/rsaalg.c | 12 |
1 files changed, 12 insertions, 0 deletions
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; |
