diff options
Diffstat (limited to 'secure/lib/libcrypto/man/EVP_EncryptInit.3')
| -rw-r--r-- | secure/lib/libcrypto/man/EVP_EncryptInit.3 | 149 |
1 files changed, 59 insertions, 90 deletions
diff --git a/secure/lib/libcrypto/man/EVP_EncryptInit.3 b/secure/lib/libcrypto/man/EVP_EncryptInit.3 index 850aed46e3e0..8b70c681ba08 100644 --- a/secure/lib/libcrypto/man/EVP_EncryptInit.3 +++ b/secure/lib/libcrypto/man/EVP_EncryptInit.3 @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 +.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -25,11 +17,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -48,22 +40,25 @@ . ds R" '' 'br\} .\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.if \nF \{\ +.ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.hy 0 -.if n .na +.el \{\ +. de IX +.. +.\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -129,7 +124,11 @@ .\" ======================================================================== .\" .IX Title "EVP_EncryptInit 3" -.TH EVP_EncryptInit 3 "2010-03-24" "0.9.8n" "OpenSSL" +.TH EVP_EncryptInit 3 "2010-11-16" "0.9.8p" "OpenSSL" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh .SH "NAME" EVP_CIPHER_CTX_init, EVP_EncryptInit_ex, EVP_EncryptUpdate, EVP_EncryptFinal_ex, EVP_DecryptInit_ex, EVP_DecryptUpdate, @@ -150,97 +149,73 @@ EVP_CIPHER_CTX_set_padding \- EVP cipher routines .IX Header "SYNOPSIS" .Vb 1 \& #include <openssl/evp.h> -.Ve -.PP -.Vb 1 +\& \& void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); -.Ve -.PP -.Vb 6 +\& \& int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& ENGINE *impl, unsigned char *key, unsigned char *iv); \& int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, \& int *outl, unsigned char *in, int inl); \& int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, \& int *outl); -.Ve -.PP -.Vb 6 +\& \& int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& ENGINE *impl, unsigned char *key, unsigned char *iv); \& int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, \& int *outl, unsigned char *in, int inl); \& int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, \& int *outl); -.Ve -.PP -.Vb 6 +\& \& int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& ENGINE *impl, unsigned char *key, unsigned char *iv, int enc); \& int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, \& int *outl, unsigned char *in, int inl); \& int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, \& int *outl); -.Ve -.PP -.Vb 4 +\& \& int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& unsigned char *key, unsigned char *iv); \& int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, \& int *outl); -.Ve -.PP -.Vb 4 +\& \& int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& unsigned char *key, unsigned char *iv); \& int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, \& int *outl); -.Ve -.PP -.Vb 4 +\& \& int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, \& unsigned char *key, unsigned char *iv, int enc); \& int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, \& int *outl); -.Ve -.PP -.Vb 4 +\& \& int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *x, int padding); \& int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); \& int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); \& int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); -.Ve -.PP -.Vb 3 +\& \& const EVP_CIPHER *EVP_get_cipherbyname(const char *name); \& #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) \& #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) -.Ve -.PP -.Vb 7 -\& #define EVP_CIPHER_nid(e) ((e)->nid) -\& #define EVP_CIPHER_block_size(e) ((e)->block_size) -\& #define EVP_CIPHER_key_length(e) ((e)->key_len) -\& #define EVP_CIPHER_iv_length(e) ((e)->iv_len) -\& #define EVP_CIPHER_flags(e) ((e)->flags) -\& #define EVP_CIPHER_mode(e) ((e)->flags) & EVP_CIPH_MODE) +\& +\& #define EVP_CIPHER_nid(e) ((e)\->nid) +\& #define EVP_CIPHER_block_size(e) ((e)\->block_size) +\& #define EVP_CIPHER_key_length(e) ((e)\->key_len) +\& #define EVP_CIPHER_iv_length(e) ((e)\->iv_len) +\& #define EVP_CIPHER_flags(e) ((e)\->flags) +\& #define EVP_CIPHER_mode(e) ((e)\->flags) & EVP_CIPH_MODE) \& int EVP_CIPHER_type(const EVP_CIPHER *ctx); -.Ve -.PP -.Vb 10 -\& #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) -\& #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) -\& #define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) -\& #define EVP_CIPHER_CTX_key_length(e) ((e)->key_len) -\& #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) -\& #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) -\& #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) +\& +\& #define EVP_CIPHER_CTX_cipher(e) ((e)\->cipher) +\& #define EVP_CIPHER_CTX_nid(e) ((e)\->cipher\->nid) +\& #define EVP_CIPHER_CTX_block_size(e) ((e)\->cipher\->block_size) +\& #define EVP_CIPHER_CTX_key_length(e) ((e)\->key_len) +\& #define EVP_CIPHER_CTX_iv_length(e) ((e)\->cipher\->iv_len) +\& #define EVP_CIPHER_CTX_get_app_data(e) ((e)\->app_data) +\& #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)\->app_data=(char *)(d)) \& #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) -\& #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) -\& #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) -.Ve -.PP -.Vb 2 +\& #define EVP_CIPHER_CTX_flags(e) ((e)\->cipher\->flags) +\& #define EVP_CIPHER_CTX_mode(e) ((e)\->cipher\->flags & EVP_CIPH_MODE) +\& \& int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); \& int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); .Ve @@ -281,7 +256,7 @@ calls to \fIEVP_EncryptUpdate()\fR should be made. .PP If padding is disabled then \fIEVP_EncryptFinal_ex()\fR will not encrypt any more data and it will return an error if any data remains in a partial block: -that is if the total data length is not a multiple of the block size. +that is if the total data length is not a multiple of the block size. .PP \&\fIEVP_DecryptInit_ex()\fR, \fIEVP_DecryptUpdate()\fR and \fIEVP_DecryptFinal_ex()\fR are the corresponding decryption operations. \fIEVP_DecryptFinal()\fR will return an @@ -430,7 +405,7 @@ All algorithms have a fixed key length unless otherwise stated. Null cipher: does nothing. .IP "EVP_des_cbc(void), EVP_des_ecb(void), EVP_des_cfb(void), EVP_des_ofb(void)" 4 .IX Item "EVP_des_cbc(void), EVP_des_ecb(void), EVP_des_cfb(void), EVP_des_ofb(void)" -\&\s-1DES\s0 in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. +\&\s-1DES\s0 in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. .IP "EVP_des_ede_cbc(void), \fIEVP_des_ede()\fR, EVP_des_ede_ofb(void), EVP_des_ede_cfb(void)" 4 .IX Item "EVP_des_ede_cbc(void), EVP_des_ede(), EVP_des_ede_ofb(void), EVP_des_ede_cfb(void)" Two key triple \s-1DES\s0 in \s-1CBC\s0, \s-1ECB\s0, \s-1CFB\s0 and \s-1OFB\s0 modes respectively. @@ -545,12 +520,12 @@ Set the effective key length used in \s-1RC2:\s0 .PP Encrypt a string using blowfish: .PP -.Vb 14 +.Vb 10 \& int do_crypt(char *outfile) \& { \& unsigned char outbuf[1024]; \& int outlen, tmplen; -\& /* Bogus key and IV: we'd normally set these from +\& /* Bogus key and IV: we\*(Aqd normally set these from \& * another source. \& */ \& unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; @@ -560,9 +535,7 @@ Encrypt a string using blowfish: \& FILE *out; \& EVP_CIPHER_CTX_init(&ctx); \& EVP_EncryptInit_ex(&ctx, EVP_bf_cbc(), NULL, key, iv); -.Ve -.PP -.Vb 25 +\& \& if(!EVP_EncryptUpdate(&ctx, outbuf, &outlen, intext, strlen(intext))) \& { \& /* Error */ @@ -594,32 +567,30 @@ The ciphertext from the above example can be decrypted using the \fBopenssl\fR utility with the command line: .PP .Vb 1 -\& S<openssl bf -in cipher.bin -K 000102030405060708090A0B0C0D0E0F -iv 0102030405060708 -d> +\& S<openssl bf \-in cipher.bin \-K 000102030405060708090A0B0C0D0E0F \-iv 0102030405060708 \-d> .Ve .PP General encryption, decryption function example using \s-1FILE\s0 I/O and \s-1RC2\s0 with an 80 bit key: .PP -.Vb 16 +.Vb 10 \& int do_crypt(FILE *in, FILE *out, int do_encrypt) \& { \& /* Allow enough space in output buffer for additional block */ \& inbuf[1024], outbuf[1024 + EVP_MAX_BLOCK_LENGTH]; \& int inlen, outlen; -\& /* Bogus key and IV: we'd normally set these from +\& /* Bogus key and IV: we\*(Aqd normally set these from \& * another source. \& */ \& unsigned char key[] = "0123456789"; \& unsigned char iv[] = "12345678"; -\& /* Don't set key or IV because we will modify the parameters */ +\& /* Don\*(Aqt set key or IV because we will modify the parameters */ \& EVP_CIPHER_CTX_init(&ctx); \& EVP_CipherInit_ex(&ctx, EVP_rc2(), NULL, NULL, NULL, do_encrypt); \& EVP_CIPHER_CTX_set_key_length(&ctx, 10); \& /* We finished modifying parameters so now we can set key and IV */ \& EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, do_encrypt); -.Ve -.PP -.Vb 19 +\& \& for(;;) \& { \& inlen = fread(inbuf, 1, 1024, in); @@ -639,9 +610,7 @@ General encryption, decryption function example using \s-1FILE\s0 I/O and \s-1RC \& return 0; \& } \& fwrite(outbuf, 1, outlen, out); -.Ve -.PP -.Vb 3 +\& \& EVP_CIPHER_CTX_cleanup(&ctx); \& return 1; \& } |
