mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
pki_gcrypt: Use SSS_STRING_FREE()
Fixes T183
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 4e2d85745f)
This commit is contained in:
@@ -139,7 +139,7 @@ static ssh_string asn1_get(ssh_buffer buffer, unsigned char want) {
|
||||
}
|
||||
|
||||
if (ssh_buffer_get_data(buffer, ssh_string_data(str), size) == 0) {
|
||||
ssh_string_free(str);
|
||||
SSH_STRING_FREE(str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -177,14 +177,14 @@ static ssh_string asn1_get_bit_string(ssh_buffer buffer)
|
||||
|
||||
len = ssh_buffer_get_data(buffer, &unused, 1);
|
||||
if (len == 0) {
|
||||
ssh_string_free(str);
|
||||
SSH_STRING_FREE(str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (unused == 0) {
|
||||
len = ssh_buffer_get_data(buffer, ssh_string_data(str), size);
|
||||
if (len == 0) {
|
||||
ssh_string_free(str);
|
||||
SSH_STRING_FREE(str);
|
||||
return NULL;
|
||||
}
|
||||
return str;
|
||||
@@ -197,7 +197,7 @@ static ssh_string asn1_get_bit_string(ssh_buffer buffer)
|
||||
|
||||
len = ssh_buffer_get_data(buffer, &c, 1);
|
||||
if (len == 0) {
|
||||
ssh_string_free(str);
|
||||
SSH_STRING_FREE(str);
|
||||
return NULL;
|
||||
}
|
||||
*p = last | (c >> unused);
|
||||
@@ -573,7 +573,7 @@ static int b64decode_rsa_privatekey(const char *pkey, gcry_sexp_t *r,
|
||||
|
||||
data = ssh_string_data(v);
|
||||
if (ssh_string_len(v) != 1 || data[0] != 0) {
|
||||
ssh_string_free(v);
|
||||
SSH_STRING_FREE(v);
|
||||
ssh_buffer_free(buffer);
|
||||
return 0;
|
||||
}
|
||||
@@ -608,20 +608,20 @@ static int b64decode_rsa_privatekey(const char *pkey, gcry_sexp_t *r,
|
||||
|
||||
error:
|
||||
ssh_string_burn(n);
|
||||
ssh_string_free(n);
|
||||
SSH_STRING_FREE(n);
|
||||
ssh_string_burn(e);
|
||||
ssh_string_free(e);
|
||||
SSH_STRING_FREE(e);
|
||||
ssh_string_burn(d);
|
||||
ssh_string_free(d);
|
||||
SSH_STRING_FREE(d);
|
||||
ssh_string_burn(p);
|
||||
ssh_string_free(p);
|
||||
SSH_STRING_FREE(p);
|
||||
ssh_string_burn(q);
|
||||
ssh_string_free(q);
|
||||
ssh_string_free(unused1);
|
||||
ssh_string_free(unused2);
|
||||
SSH_STRING_FREE(q);
|
||||
SSH_STRING_FREE(unused1);
|
||||
SSH_STRING_FREE(unused2);
|
||||
ssh_string_burn(u);
|
||||
ssh_string_free(u);
|
||||
ssh_string_free(v);
|
||||
SSH_STRING_FREE(u);
|
||||
SSH_STRING_FREE(v);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -656,7 +656,7 @@ static int b64decode_dsa_privatekey(const char *pkey, gcry_sexp_t *r, ssh_auth_c
|
||||
|
||||
data = ssh_string_data(v);
|
||||
if (ssh_string_len(v) != 1 || data[0] != 0) {
|
||||
ssh_string_free(v);
|
||||
SSH_STRING_FREE(v);
|
||||
ssh_buffer_free(buffer);
|
||||
return 0;
|
||||
}
|
||||
@@ -685,16 +685,16 @@ static int b64decode_dsa_privatekey(const char *pkey, gcry_sexp_t *r, ssh_auth_c
|
||||
|
||||
error:
|
||||
ssh_string_burn(p);
|
||||
ssh_string_free(p);
|
||||
SSH_STRING_FREE(p);
|
||||
ssh_string_burn(q);
|
||||
ssh_string_free(q);
|
||||
SSH_STRING_FREE(q);
|
||||
ssh_string_burn(g);
|
||||
ssh_string_free(g);
|
||||
SSH_STRING_FREE(g);
|
||||
ssh_string_burn(y);
|
||||
ssh_string_free(y);
|
||||
SSH_STRING_FREE(y);
|
||||
ssh_string_burn(x);
|
||||
ssh_string_free(x);
|
||||
ssh_string_free(v);
|
||||
SSH_STRING_FREE(x);
|
||||
SSH_STRING_FREE(v);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -917,12 +917,12 @@ static int b64decode_ecdsa_privatekey(const char *pkey, gcry_sexp_t *r,
|
||||
|
||||
error:
|
||||
ssh_buffer_free(buffer);
|
||||
ssh_string_free(v);
|
||||
SSH_STRING_FREE(v);
|
||||
ssh_string_burn(d);
|
||||
ssh_string_free(d);
|
||||
ssh_string_free(oi);
|
||||
SSH_STRING_FREE(d);
|
||||
SSH_STRING_FREE(oi);
|
||||
ssh_string_burn(q);
|
||||
ssh_string_free(q);
|
||||
SSH_STRING_FREE(q);
|
||||
|
||||
return valid;
|
||||
}
|
||||
@@ -1857,7 +1857,7 @@ ssh_string pki_signature_to_blob(const ssh_signature sig)
|
||||
}
|
||||
|
||||
rc = ssh_buffer_add_ssh_string(b, R);
|
||||
ssh_string_free(R);
|
||||
SSH_STRING_FREE(R);
|
||||
if (rc < 0) {
|
||||
ssh_buffer_free(b);
|
||||
return NULL;
|
||||
@@ -1871,7 +1871,7 @@ ssh_string pki_signature_to_blob(const ssh_signature sig)
|
||||
}
|
||||
|
||||
rc = ssh_buffer_add_ssh_string(b, S);
|
||||
ssh_string_free(S);
|
||||
SSH_STRING_FREE(S);
|
||||
if (rc < 0) {
|
||||
ssh_buffer_free(b);
|
||||
return NULL;
|
||||
@@ -2036,7 +2036,7 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey,
|
||||
ssh_buffer_free(b);
|
||||
if (s == NULL) {
|
||||
ssh_string_burn(r);
|
||||
ssh_string_free(r);
|
||||
SSH_STRING_FREE(r);
|
||||
ssh_signature_free(sig);
|
||||
return NULL;
|
||||
}
|
||||
@@ -2047,9 +2047,9 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey,
|
||||
"sigblob: %lu",
|
||||
(unsigned long)rlen);
|
||||
ssh_string_burn(r);
|
||||
ssh_string_free(r);
|
||||
SSH_STRING_FREE(r);
|
||||
ssh_string_burn(s);
|
||||
ssh_string_free(s);
|
||||
SSH_STRING_FREE(s);
|
||||
ssh_signature_free(sig);
|
||||
return NULL;
|
||||
}
|
||||
@@ -2067,9 +2067,9 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey,
|
||||
ssh_string_len(s),
|
||||
ssh_string_data(s));
|
||||
ssh_string_burn(r);
|
||||
ssh_string_free(r);
|
||||
SSH_STRING_FREE(r);
|
||||
ssh_string_burn(s);
|
||||
ssh_string_free(s);
|
||||
SSH_STRING_FREE(s);
|
||||
if (err) {
|
||||
ssh_signature_free(sig);
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user