Re: [Openvpn-devel] [PATCH v2 3/9] Add crypto_pem_{encode, decode}()

2018-07-22 Thread Antonio Quartulli
Hi, On 22/07/18 17:53, Steffan Karger wrote: >>> +uint8_t *dst_data = buf_write_alloc(dst, data_read_len); >>> +if (!dst_data) >>> +{ >>> +dmsg(D_CRYPT_ERRORS, "%s: dst too small (%i, needs %li)", __func__, >>> + BCAP(dst), data_read_len); >>> +goto cleanup;

Re: [Openvpn-devel] [PATCH v2 3/9] Add crypto_pem_{encode, decode}()

2018-07-22 Thread Steffan Karger
Hi, On 20-07-18 13:20, Antonio Quartulli wrote: > Hi, > > On 05/07/18 01:53, Steffan Karger wrote: > [CUT] > >> +bool >> +crypto_pem_decode(const char *name, struct buffer *dst, >> + const struct buffer *src) >> +{ >> +bool ret = false; >> +BIO *bio; >> + >> +if (!(b

Re: [Openvpn-devel] [PATCH v2 3/9] Add crypto_pem_{encode, decode}()

2018-07-20 Thread Antonio Quartulli
Hi, On 05/07/18 01:53, Steffan Karger wrote: [CUT] > +bool > +crypto_pem_decode(const char *name, struct buffer *dst, > + const struct buffer *src) > +{ > +bool ret = false; > +BIO *bio; > + > +if (!(bio = BIO_new_mem_buf((char *)BPTR(src), BLEN(src minor style n

[Openvpn-devel] [PATCH v2 3/9] Add crypto_pem_{encode,decode}()

2018-07-04 Thread Steffan Karger
From: Steffan Karger Needed for tls-crypt-v2, but isolated enough to be reviewed as a separate patch. The encode API allocates memory, because it fits our typical gc-oriented code pattern and the caller does not have to do multiple calls or calculations to determine the required destination buff