Add more __attribute__((malloc)) where appropriate.

This commit is contained in:
Guus Sliepen 2013-05-10 20:15:27 +02:00
parent 0acdce222f
commit 45063953fd
9 changed files with 20 additions and 20 deletions

View file

@ -26,9 +26,9 @@
typedef struct cipher cipher_t;
extern cipher_t *cipher_open_by_name(const char *);
extern cipher_t *cipher_open_by_nid(int);
extern cipher_t *cipher_open_blowfish_ofb(void);
extern cipher_t *cipher_open_by_name(const char *) __attribute__ ((__malloc__));
extern cipher_t *cipher_open_by_nid(int) __attribute__ ((__malloc__));
extern cipher_t *cipher_open_blowfish_ofb(void) __attribute__ ((__malloc__));
extern void cipher_close(cipher_t *);
extern size_t cipher_keylength(const cipher_t *);
extern void cipher_get_key(const cipher_t *, void *);

View file

@ -24,9 +24,9 @@
typedef struct digest digest_t;
extern digest_t *digest_open_by_name(const char *name, int maclength);
extern digest_t *digest_open_by_nid(int nid, int maclength);
extern digest_t *digest_open_sha1(int maclength);
extern digest_t *digest_open_by_name(const char *name, int maclength) __attribute__ ((__malloc__));
extern digest_t *digest_open_by_nid(int nid, int maclength) __attribute__ ((__malloc__));
extern digest_t *digest_open_sha1(int maclength) __attribute__ ((__malloc__));
extern void digest_close(digest_t *);
extern bool digest_create(digest_t *, const void *indata, size_t inlen, void *outdata);
extern bool digest_verify(digest_t *, const void *indata, size_t inlen, const void *digestdata);

View file

@ -27,7 +27,7 @@
typedef struct ecdh ecdh_t;
#endif
extern ecdh_t *ecdh_generate_public(void *pubkey);
extern ecdh_t *ecdh_generate_public(void *pubkey) __attribute__ ((__malloc__));
extern bool ecdh_compute_shared(ecdh_t *ecdh, const void *pubkey, void *shared);
extern void ecdh_free(ecdh_t *ecdh);

View file

@ -24,10 +24,10 @@
typedef struct ecdsa ecdsa_t;
#endif
extern ecdsa_t *ecdsa_set_base64_public_key(const char *p);
extern ecdsa_t *ecdsa_set_base64_public_key(const char *p) __attribute__ ((__malloc__));
extern char *ecdsa_get_base64_public_key(ecdsa_t *ecdsa);
extern ecdsa_t *ecdsa_read_pem_public_key(FILE *fp);
extern ecdsa_t *ecdsa_read_pem_private_key(FILE *fp);
extern ecdsa_t *ecdsa_read_pem_public_key(FILE *fp) __attribute__ ((__malloc__));
extern ecdsa_t *ecdsa_read_pem_private_key(FILE *fp) __attribute__ ((__malloc__));
extern size_t ecdsa_size(ecdsa_t *ecdsa);
extern bool ecdsa_sign(ecdsa_t *ecdsa, const void *in, size_t inlen, void *out);
extern bool ecdsa_verify(ecdsa_t *ecdsa, const void *in, size_t inlen, const void *out);

View file

@ -22,7 +22,7 @@
#include "ecdsa.h"
extern ecdsa_t *ecdsa_generate(void);
extern ecdsa_t *ecdsa_generate(void) __attribute__ ((__malloc__));
extern bool ecdsa_write_pem_public_key(ecdsa_t *ecdsa, FILE *fp);
extern bool ecdsa_write_pem_private_key(ecdsa_t *ecdsa, FILE *fp);

View file

@ -25,10 +25,10 @@
extern bool hostnames;
extern struct addrinfo *str2addrinfo(const char *, const char *, int);
extern struct addrinfo *str2addrinfo(const char *, const char *, int) __attribute__ ((__malloc__));
extern sockaddr_t str2sockaddr(const char *, const char *);
extern void sockaddr2str(const sockaddr_t *, char **, char **);
extern char *sockaddr2hostname(const sockaddr_t *);
extern char *sockaddr2hostname(const sockaddr_t *) __attribute__ ((__malloc__));
extern int sockaddrcmp(const sockaddr_t *, const sockaddr_t *);
extern int sockaddrcmp_noport(const sockaddr_t *, const sockaddr_t *);
extern void sockaddrunmap(sockaddr_t *);

View file

@ -25,10 +25,10 @@ typedef struct rsa rsa_t;
#endif
extern void rsa_free(rsa_t *rsa);
extern rsa_t *rsa_set_hex_public_key(char *n, char *e);
extern rsa_t *rsa_set_hex_private_key(char *n, char *e, char *d);
extern rsa_t *rsa_read_pem_public_key(FILE *fp);
extern rsa_t *rsa_read_pem_private_key(FILE *fp);
extern rsa_t *rsa_set_hex_public_key(char *n, char *e) __attribute__ ((__malloc__));
extern rsa_t *rsa_set_hex_private_key(char *n, char *e, char *d) __attribute__ ((__malloc__));
extern rsa_t *rsa_read_pem_public_key(FILE *fp) __attribute__ ((__malloc__));
extern rsa_t *rsa_read_pem_private_key(FILE *fp) __attribute__ ((__malloc__));
extern size_t rsa_size(rsa_t *rsa);
extern bool rsa_public_encrypt(rsa_t *rsa, void *in, size_t len, void *out);
extern bool rsa_private_decrypt(rsa_t *rsa, void *in, size_t len, void *out);

View file

@ -22,7 +22,7 @@
#include "rsa.h"
extern rsa_t *rsa_generate(size_t bits, unsigned long exponent);
extern rsa_t *rsa_generate(size_t bits, unsigned long exponent) __attribute__ ((__malloc__));
extern bool rsa_write_pem_public_key(rsa_t *rsa, FILE *fp);
extern bool rsa_write_pem_private_key(rsa_t *rsa, FILE *fp);

View file

@ -64,10 +64,10 @@ typedef struct splay_tree_t {
/* (De)constructors */
extern splay_tree_t *splay_alloc_tree(splay_compare_t, splay_action_t);
extern splay_tree_t *splay_alloc_tree(splay_compare_t, splay_action_t) __attribute__ ((__malloc__));
extern void splay_free_tree(splay_tree_t *);
extern splay_node_t *splay_alloc_node(void);
extern splay_node_t *splay_alloc_node(void) __attribute__ ((__malloc__));
extern void splay_free_node(splay_tree_t *tree, splay_node_t *);
/* Insertion and deletion */