diff options
author | Jakub Jelen <jjelen@redhat.com> | 2018-09-11 15:24:44 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-09-17 16:39:38 +0200 |
commit | c04eac40f3fb0ba560301038afa4a18b1a4eb6d7 (patch) | |
tree | 9b32edfdd79e04baea10741e9e524ceeed2f7b93 /src/pki_crypto.c | |
parent | 8cc0672c0cf116221418626ca8b7b1234c31af43 (diff) | |
download | libssh-c04eac40f3fb0ba560301038afa4a18b1a4eb6d7.tar.gz libssh-c04eac40f3fb0ba560301038afa4a18b1a4eb6d7.tar.xz libssh-c04eac40f3fb0ba560301038afa4a18b1a4eb6d7.zip |
pki_crypto: Clarify that memory passed with set0 is managed by openssl objects
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/pki_crypto.c')
-rw-r--r-- | src/pki_crypto.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pki_crypto.c b/src/pki_crypto.c index 900e1a14..8cf029a6 100644 --- a/src/pki_crypto.c +++ b/src/pki_crypto.c @@ -260,6 +260,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote) goto fail; } + /* Memory management of np, nq and ng is transfered to DSA object */ rc = DSA_set0_pqg(new->dsa, np, nq, ng); if (rc == 0) { BN_free(np); @@ -274,6 +275,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote) goto fail; } + /* Memory management of npubkey is transfered to DSA object */ rc = DSA_set0_key(new->dsa, npub_key, NULL); if (rc == 0) { goto fail; @@ -285,6 +287,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote) goto fail; } + /* Memory management of npriv_key is transfered to DSA object */ rc = DSA_set0_key(new->dsa, NULL, npriv_key); if (rc == 0) { goto fail; @@ -321,6 +324,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote) goto fail; } + /* Memory management of nn and ne is transfered to RSA object */ rc = RSA_set0_key(new->rsa, nn, ne, NULL); if (rc == 0) { BN_free(nn); @@ -338,6 +342,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote) goto fail; } + /* Memory management of nd is transfered to RSA object */ rc = RSA_set0_key(new->rsa, NULL, NULL, nd); if (rc == 0) { goto fail; @@ -356,6 +361,7 @@ ssh_key pki_key_dup(const ssh_key key, int demote) goto fail; } + /* Memory management of np and nq is transfered to RSA object */ rc = RSA_set0_factors(new->rsa, np, nq); if (rc == 0) { BN_free(np); @@ -376,6 +382,8 @@ ssh_key pki_key_dup(const ssh_key key, int demote) goto fail; } + /* Memory management of ndmp1, ndmq1 and niqmp is transfered + * to RSA object */ rc = RSA_set0_crt_params(new->rsa, ndmp1, ndmq1, niqmp); if (rc == 0) { BN_free(ndmp1); @@ -910,11 +918,13 @@ int pki_pubkey_build_dss(ssh_key key, goto fail; } + /* Memory management of bp, bq and bg is transfered to DSA object */ rc = DSA_set0_pqg(key->dsa, bp, bq, bg); if (rc == 0) { goto fail; } + /* Memory management of npub_key is transfered to DSA object */ rc = DSA_set0_key(key->dsa, bpub_key, NULL); if (rc == 0) { goto fail; @@ -943,6 +953,7 @@ int pki_pubkey_build_rsa(ssh_key key, goto fail; } + /* Memory management of bn and be is transfered to RSA object */ rc = RSA_set0_key(key->rsa, bn, be, NULL); if (rc == 0) { goto fail; @@ -1500,6 +1511,8 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey, return NULL; } + /* Memory management of pr and ps is transfered to DSA signature + * object */ rc = DSA_SIG_set0(sig->dsa_sig, pr, ps); if (rc == 0) { ssh_signature_free(sig); @@ -1578,6 +1591,8 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey, return NULL; } + /* Memory management of pr and ps is transfered to + * ECDSA signature object */ rc = ECDSA_SIG_set0(sig->ecdsa_sig, pr, ps); if (rc == 0) { ssh_signature_free(sig); |