diff options
| author | schwarze <> | 2015-05-24 15:44:52 +0000 |
|---|---|---|
| committer | schwarze <> | 2015-05-24 15:44:52 +0000 |
| commit | 72138e7dd9423eb110e858e00b54b32be6b5aa87 (patch) | |
| tree | f40277888d65df9cdaf3fcbb7af8a4259f7f36f1 | |
| parent | fa94b8e0a497408306ccc4012ef60535fc46200a (diff) | |
| download | openbsd-72138e7dd9423eb110e858e00b54b32be6b5aa87.tar.gz openbsd-72138e7dd9423eb110e858e00b54b32be6b5aa87.tar.bz2 openbsd-72138e7dd9423eb110e858e00b54b32be6b5aa87.zip | |
Maximilian dot Fillinger at uni-duesseldorf dot de
starts helping with the pod2mdoc(1)-based conversion
of LibreSSL crypto manuals from perlpod(1) to mdoc(7).
Here comes the first file, slightly tweaked by me.
| -rw-r--r-- | src/lib/libcrypto/man/BUF_MEM_new.3 | 107 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 4 | ||||
| -rw-r--r-- | src/lib/libssl/src/doc/crypto/BUF_MEM_new.pod | 72 |
3 files changed, 109 insertions, 74 deletions
diff --git a/src/lib/libcrypto/man/BUF_MEM_new.3 b/src/lib/libcrypto/man/BUF_MEM_new.3 new file mode 100644 index 0000000000..a423d4e0bc --- /dev/null +++ b/src/lib/libcrypto/man/BUF_MEM_new.3 | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | .Dd $Mdocdate: May 24 2015 $ | ||
| 2 | .Dt BUF_MEM_NEW 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm BUF_MEM_new , | ||
| 6 | .Nm BUF_MEM_free , | ||
| 7 | .Nm BUF_MEM_grow , | ||
| 8 | .Nm BUF_strdup | ||
| 9 | .Nd simple character arrays structure | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/buffer.h | ||
| 12 | .Ft BUF_MEM * | ||
| 13 | .Fo BUF_MEM_new | ||
| 14 | .Fa void | ||
| 15 | .Fc | ||
| 16 | .Ft void | ||
| 17 | .Fo BUF_MEM_free | ||
| 18 | .Fa "BUF_MEM *a" | ||
| 19 | .Fc | ||
| 20 | .Ft int | ||
| 21 | .Fo BUF_MEM_grow | ||
| 22 | .Fa "BUF_MEM *str" | ||
| 23 | .Fa "size_t len" | ||
| 24 | .Fc | ||
| 25 | .Ft char * | ||
| 26 | .Fo BUF_strdup | ||
| 27 | .Fa "const char *str" | ||
| 28 | .Fc | ||
| 29 | .Sh DESCRIPTION | ||
| 30 | The buffer library handles simple character arrays. | ||
| 31 | Buffers are used for various purposes in the library, most notably | ||
| 32 | memory BIOs. | ||
| 33 | .Pp | ||
| 34 | The library uses the | ||
| 35 | .Vt BUF_MEM | ||
| 36 | structure defined in buffer.h: | ||
| 37 | .Bd -literal | ||
| 38 | typedef struct buf_mem_st | ||
| 39 | { | ||
| 40 | size_t length; /* current number of bytes */ | ||
| 41 | char *data; | ||
| 42 | size_t max; /* size of buffer */ | ||
| 43 | } BUF_MEM; | ||
| 44 | .Ed | ||
| 45 | .Pp | ||
| 46 | .Fa length | ||
| 47 | is the current size of the buffer in bytes, | ||
| 48 | .Fa max | ||
| 49 | is the amount of memory allocated to the buffer. | ||
| 50 | There are three functions which handle these and one | ||
| 51 | .Dq miscellaneous | ||
| 52 | function. | ||
| 53 | .Pp | ||
| 54 | .Fn BUF_MEM_new | ||
| 55 | allocates a new buffer of zero size. | ||
| 56 | .Pp | ||
| 57 | .Fn BUF_MEM_free | ||
| 58 | frees up an already existing buffer. | ||
| 59 | The data is zeroed before freeing up in case the buffer contains | ||
| 60 | sensitive data. | ||
| 61 | .Pp | ||
| 62 | .Fn BUF_MEM_grow | ||
| 63 | changes the size of an already existing buffer to | ||
| 64 | .Fa len . | ||
| 65 | Any data already in the buffer is preserved if it increases in size. | ||
| 66 | .Pp | ||
| 67 | .Fn BUF_strdup | ||
| 68 | copies a NUL terminated string into a block of allocated memory and | ||
| 69 | returns a pointer to the allocated block. | ||
| 70 | Unlike the system | ||
| 71 | .Xr strdup 3 | ||
| 72 | function, | ||
| 73 | .Fn BUF_strdup | ||
| 74 | will accept a | ||
| 75 | .Dv NULL | ||
| 76 | argument and will return | ||
| 77 | .Dv NULL | ||
| 78 | in that case. | ||
| 79 | Its use in new programes is discouraged. | ||
| 80 | .Pp | ||
| 81 | The memory allocated from | ||
| 82 | .Fn BUF_strdup | ||
| 83 | should be freed up using the | ||
| 84 | .Xr free 3 | ||
| 85 | function. | ||
| 86 | .Sh RETURN VALUES | ||
| 87 | .Fn BUF_MEM_new | ||
| 88 | returns the buffer or | ||
| 89 | .Dv NULL | ||
| 90 | on error. | ||
| 91 | .Pp | ||
| 92 | .Fn BUF_MEM_free | ||
| 93 | returns no value. | ||
| 94 | .Pp | ||
| 95 | .Fn BUF_MEM_grow | ||
| 96 | returns zero on error or the new size (i.e. | ||
| 97 | .Fa len Ns ). | ||
| 98 | .Sh SEE ALSO | ||
| 99 | .Xr bio 3 | ||
| 100 | .Sh HISTORY | ||
| 101 | .Fn BUF_MEM_new , | ||
| 102 | .Fn BUF_MEM_free | ||
| 103 | and | ||
| 104 | .Fn BUF_MEM_grow | ||
| 105 | are available in all versions of SSLeay and OpenSSL. | ||
| 106 | .Fn BUF_strdup | ||
| 107 | was added in SSLeay 0.8. | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index bce02f647f..872391db3e 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.19 2015/02/23 17:43:24 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.20 2015/05/24 15:44:52 schwarze Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> # for NOMAN | 3 | .include <bsd.own.mk> # for NOMAN |
| 4 | 4 | ||
| @@ -51,9 +51,9 @@ MAN= \ | |||
| 51 | BN_set_bit.3 \ | 51 | BN_set_bit.3 \ |
| 52 | BN_swap.3 \ | 52 | BN_swap.3 \ |
| 53 | BN_zero.3 \ | 53 | BN_zero.3 \ |
| 54 | BUF_MEM_new.3 \ | ||
| 54 | 55 | ||
| 55 | GENMAN= \ | 56 | GENMAN= \ |
| 56 | BUF_MEM_new.3 \ | ||
| 57 | CONF_modules_free.3 \ | 57 | CONF_modules_free.3 \ |
| 58 | CONF_modules_load_file.3 \ | 58 | CONF_modules_load_file.3 \ |
| 59 | CRYPTO_set_ex_data.3 \ | 59 | CRYPTO_set_ex_data.3 \ |
diff --git a/src/lib/libssl/src/doc/crypto/BUF_MEM_new.pod b/src/lib/libssl/src/doc/crypto/BUF_MEM_new.pod deleted file mode 100644 index 2805755869..0000000000 --- a/src/lib/libssl/src/doc/crypto/BUF_MEM_new.pod +++ /dev/null | |||
| @@ -1,72 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | BUF_MEM_new, BUF_MEM_free, BUF_MEM_grow, BUF_strdup - simple | ||
| 6 | character arrays structure | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | #include <openssl/buffer.h> | ||
| 11 | |||
| 12 | BUF_MEM *BUF_MEM_new(void); | ||
| 13 | |||
| 14 | void BUF_MEM_free(BUF_MEM *a); | ||
| 15 | |||
| 16 | int BUF_MEM_grow(BUF_MEM *str, size_t len); | ||
| 17 | |||
| 18 | char * BUF_strdup(const char *str); | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | The buffer library handles simple character arrays. Buffers are used for | ||
| 23 | various purposes in the library, most notably memory BIOs. | ||
| 24 | |||
| 25 | The library uses the BUF_MEM structure defined in buffer.h: | ||
| 26 | |||
| 27 | typedef struct buf_mem_st | ||
| 28 | { | ||
| 29 | size_t length; /* current number of bytes */ | ||
| 30 | char *data; | ||
| 31 | size_t max; /* size of buffer */ | ||
| 32 | } BUF_MEM; | ||
| 33 | |||
| 34 | B<length> is the current size of the buffer in bytes, B<max> is the amount of | ||
| 35 | memory allocated to the buffer. There are three functions which handle these | ||
| 36 | and one "miscellaneous" function. | ||
| 37 | |||
| 38 | BUF_MEM_new() allocates a new buffer of zero size. | ||
| 39 | |||
| 40 | BUF_MEM_free() frees up an already existing buffer. The data is zeroed | ||
| 41 | before freeing up in case the buffer contains sensitive data. | ||
| 42 | |||
| 43 | BUF_MEM_grow() changes the size of an already existing buffer to | ||
| 44 | B<len>. Any data already in the buffer is preserved if it increases in | ||
| 45 | size. | ||
| 46 | |||
| 47 | BUF_strdup() copies a null terminated string into a block of allocated memory | ||
| 48 | and returns a pointer to the allocated block. Unlike the system strdup() | ||
| 49 | function, BUF_strdup() will accept a NULL argument and will return NULL in | ||
| 50 | that case. Its use in new programes is discouraged. | ||
| 51 | |||
| 52 | The memory allocated from BUF_strdup() should be freed up using the | ||
| 53 | free() function. | ||
| 54 | |||
| 55 | =head1 RETURN VALUES | ||
| 56 | |||
| 57 | BUF_MEM_new() returns the buffer or NULL on error. | ||
| 58 | |||
| 59 | BUF_MEM_free() has no return value. | ||
| 60 | |||
| 61 | BUF_MEM_grow() returns zero on error or the new size (i.e. B<len>). | ||
| 62 | |||
| 63 | =head1 SEE ALSO | ||
| 64 | |||
| 65 | L<bio(3)|bio(3)> | ||
| 66 | |||
| 67 | =head1 HISTORY | ||
| 68 | |||
| 69 | BUF_MEM_new(), BUF_MEM_free() and BUF_MEM_grow() are available in all | ||
| 70 | versions of SSLeay and OpenSSL. BUF_strdup() was added in SSLeay 0.8. | ||
| 71 | |||
| 72 | =cut | ||
