Lines Matching refs:buf
139 unsigned char *buf, size_t buflen, in pem_des_decrypt() argument
154 des_iv, buf, buf ); in pem_des_decrypt()
167 unsigned char *buf, size_t buflen, in pem_des3_decrypt() argument
182 des3_iv, buf, buf ); in pem_des3_decrypt()
197 unsigned char *buf, size_t buflen, in pem_aes_decrypt() argument
212 aes_iv, buf, buf ); in pem_aes_decrypt()
231 unsigned char *buf; in mbedtls_pem_read_buffer() local
348 if( ( buf = mbedtls_calloc( 1, len ) ) == NULL ) in mbedtls_pem_read_buffer()
351 if( ( ret = mbedtls_base64_decode( buf, len, &len, s1, s2 - s1 ) ) != 0 ) in mbedtls_pem_read_buffer()
353 mbedtls_platform_zeroize( buf, len ); in mbedtls_pem_read_buffer()
354 mbedtls_free( buf ); in mbedtls_pem_read_buffer()
364 mbedtls_platform_zeroize( buf, len ); in mbedtls_pem_read_buffer()
365 mbedtls_free( buf ); in mbedtls_pem_read_buffer()
373 ret = pem_des3_decrypt( pem_iv, buf, len, pwd, pwdlen ); in mbedtls_pem_read_buffer()
375 ret = pem_des_decrypt( pem_iv, buf, len, pwd, pwdlen ); in mbedtls_pem_read_buffer()
380 ret = pem_aes_decrypt( pem_iv, 16, buf, len, pwd, pwdlen ); in mbedtls_pem_read_buffer()
382 ret = pem_aes_decrypt( pem_iv, 24, buf, len, pwd, pwdlen ); in mbedtls_pem_read_buffer()
384 ret = pem_aes_decrypt( pem_iv, 32, buf, len, pwd, pwdlen ); in mbedtls_pem_read_buffer()
389 mbedtls_free( buf ); in mbedtls_pem_read_buffer()
399 if( len <= 2 || buf[0] != 0x30 || buf[1] > 0x83 ) in mbedtls_pem_read_buffer()
401 mbedtls_platform_zeroize( buf, len ); in mbedtls_pem_read_buffer()
402 mbedtls_free( buf ); in mbedtls_pem_read_buffer()
406 mbedtls_platform_zeroize( buf, len ); in mbedtls_pem_read_buffer()
407 mbedtls_free( buf ); in mbedtls_pem_read_buffer()
413 ctx->buf = buf; in mbedtls_pem_read_buffer()
421 if ( ctx->buf != NULL ) in mbedtls_pem_free()
423 mbedtls_platform_zeroize( ctx->buf, ctx->buflen ); in mbedtls_pem_free()
424 mbedtls_free( ctx->buf ); in mbedtls_pem_free()
435 unsigned char *buf, size_t buf_len, size_t *olen ) in mbedtls_pem_write_buffer() argument
438 unsigned char *encode_buf = NULL, *c, *p = buf; in mbedtls_pem_write_buffer()
479 *olen = p - buf; in mbedtls_pem_write_buffer()
482 memset( buf + *olen, 0, buf_len - *olen ); in mbedtls_pem_write_buffer()