diff options
| author | hshoexer <> | 2004-01-23 16:58:43 +0000 |
|---|---|---|
| committer | hshoexer <> | 2004-01-23 16:58:43 +0000 |
| commit | e94374beadb2a55e7aaa0132dc8ec1c43c534d13 (patch) | |
| tree | b6814a948bdffdb739e1d43bc747d4f23c2d38bf | |
| parent | d38f1c5ae0451bf3eab12bb23992d2c4b064757a (diff) | |
| download | openbsd-e94374beadb2a55e7aaa0132dc8ec1c43c534d13.tar.gz openbsd-e94374beadb2a55e7aaa0132dc8ec1c43c534d13.tar.bz2 openbsd-e94374beadb2a55e7aaa0132dc8ec1c43c534d13.zip | |
evp api and manual page for acss
ok deraadt@ markus@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/evp/e_acss.c | 85 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/evp/e_acss.c | 85 | ||||
| -rw-r--r-- | src/lib/libssl/src/doc/crypto/acss.pod | 66 |
3 files changed, 236 insertions, 0 deletions
diff --git a/src/lib/libcrypto/evp/e_acss.c b/src/lib/libcrypto/evp/e_acss.c new file mode 100644 index 0000000000..f4e55f1030 --- /dev/null +++ b/src/lib/libcrypto/evp/e_acss.c | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | /* $Id: e_acss.c,v 1.1 2004/01/23 16:58:43 hshoexer Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004 The OpenBSD project | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef OPENSSL_NO_ACSS | ||
| 19 | |||
| 20 | #include "cryptlib.h" | ||
| 21 | #include <openssl/evp.h> | ||
| 22 | #include <openssl/objects.h> | ||
| 23 | #include "evp_locl.h" | ||
| 24 | #include <openssl/acss.h> | ||
| 25 | |||
| 26 | typedef struct { | ||
| 27 | ACSS_KEY ks; | ||
| 28 | } EVP_ACSS_KEY; | ||
| 29 | |||
| 30 | #define data(ctx) EVP_C_DATA(EVP_ACSS_KEY,ctx) | ||
| 31 | |||
| 32 | static int acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 33 | const unsigned char *iv, int enc); | ||
| 34 | static int acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 35 | const unsigned char *in, unsigned int inl); | ||
| 36 | static int acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); | ||
| 37 | static const EVP_CIPHER acss_cipher = { | ||
| 38 | NID_undef, | ||
| 39 | 1,5,0, | ||
| 40 | 0, | ||
| 41 | acss_init_key, | ||
| 42 | acss_ciph, | ||
| 43 | NULL, | ||
| 44 | sizeof(EVP_ACSS_KEY), | ||
| 45 | NULL, | ||
| 46 | NULL, | ||
| 47 | acss_ctrl, | ||
| 48 | NULL | ||
| 49 | }; | ||
| 50 | |||
| 51 | const | ||
| 52 | EVP_CIPHER *EVP_acss(void) | ||
| 53 | { | ||
| 54 | return(&acss_cipher); | ||
| 55 | } | ||
| 56 | |||
| 57 | static int | ||
| 58 | acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 59 | const unsigned char *iv, int enc) | ||
| 60 | { | ||
| 61 | acss_setkey(&data(ctx)->ks,key,enc,ACSS_DATA); | ||
| 62 | return 1; | ||
| 63 | } | ||
| 64 | |||
| 65 | static int | ||
| 66 | acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, | ||
| 67 | unsigned int inl) | ||
| 68 | { | ||
| 69 | acss(&data(ctx)->ks,inl,in,out); | ||
| 70 | return 1; | ||
| 71 | } | ||
| 72 | |||
| 73 | static int | ||
| 74 | acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
| 75 | { | ||
| 76 | switch(type) { | ||
| 77 | case EVP_CTRL_SET_ACSS_MODE: | ||
| 78 | data(ctx)->ks.mode = arg; | ||
| 79 | return 1; | ||
| 80 | |||
| 81 | default: | ||
| 82 | return -1; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/evp/e_acss.c b/src/lib/libssl/src/crypto/evp/e_acss.c new file mode 100644 index 0000000000..f4e55f1030 --- /dev/null +++ b/src/lib/libssl/src/crypto/evp/e_acss.c | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | /* $Id: e_acss.c,v 1.1 2004/01/23 16:58:43 hshoexer Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004 The OpenBSD project | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef OPENSSL_NO_ACSS | ||
| 19 | |||
| 20 | #include "cryptlib.h" | ||
| 21 | #include <openssl/evp.h> | ||
| 22 | #include <openssl/objects.h> | ||
| 23 | #include "evp_locl.h" | ||
| 24 | #include <openssl/acss.h> | ||
| 25 | |||
| 26 | typedef struct { | ||
| 27 | ACSS_KEY ks; | ||
| 28 | } EVP_ACSS_KEY; | ||
| 29 | |||
| 30 | #define data(ctx) EVP_C_DATA(EVP_ACSS_KEY,ctx) | ||
| 31 | |||
| 32 | static int acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 33 | const unsigned char *iv, int enc); | ||
| 34 | static int acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 35 | const unsigned char *in, unsigned int inl); | ||
| 36 | static int acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); | ||
| 37 | static const EVP_CIPHER acss_cipher = { | ||
| 38 | NID_undef, | ||
| 39 | 1,5,0, | ||
| 40 | 0, | ||
| 41 | acss_init_key, | ||
| 42 | acss_ciph, | ||
| 43 | NULL, | ||
| 44 | sizeof(EVP_ACSS_KEY), | ||
| 45 | NULL, | ||
| 46 | NULL, | ||
| 47 | acss_ctrl, | ||
| 48 | NULL | ||
| 49 | }; | ||
| 50 | |||
| 51 | const | ||
| 52 | EVP_CIPHER *EVP_acss(void) | ||
| 53 | { | ||
| 54 | return(&acss_cipher); | ||
| 55 | } | ||
| 56 | |||
| 57 | static int | ||
| 58 | acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 59 | const unsigned char *iv, int enc) | ||
| 60 | { | ||
| 61 | acss_setkey(&data(ctx)->ks,key,enc,ACSS_DATA); | ||
| 62 | return 1; | ||
| 63 | } | ||
| 64 | |||
| 65 | static int | ||
| 66 | acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, | ||
| 67 | unsigned int inl) | ||
| 68 | { | ||
| 69 | acss(&data(ctx)->ks,inl,in,out); | ||
| 70 | return 1; | ||
| 71 | } | ||
| 72 | |||
| 73 | static int | ||
| 74 | acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
| 75 | { | ||
| 76 | switch(type) { | ||
| 77 | case EVP_CTRL_SET_ACSS_MODE: | ||
| 78 | data(ctx)->ks.mode = arg; | ||
| 79 | return 1; | ||
| 80 | |||
| 81 | default: | ||
| 82 | return -1; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | #endif | ||
diff --git a/src/lib/libssl/src/doc/crypto/acss.pod b/src/lib/libssl/src/doc/crypto/acss.pod new file mode 100644 index 0000000000..022a803be5 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/acss.pod | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | acss, acss_setkey - ACSS encryption | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/acss.h> | ||
| 10 | |||
| 11 | void acss_setkey(ACSS_KEY *key, const unsigned char *data, int enc, | ||
| 12 | int mode); | ||
| 13 | |||
| 14 | void acss(ACSS_KEY *key, unsigned long len, const unsigned char *in, | ||
| 15 | unsigned char *out); | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | This library implements the Alleged Content Scrambling System. It is believed | ||
| 20 | to be interoperable with CSS of the DVD Copy Control Association. | ||
| 21 | |||
| 22 | ACSS is a stream cipher with a fixed key length of 40 bit (5 byte). | ||
| 23 | |||
| 24 | ACSS consists of a key setup phase and the actual encryption or decryption | ||
| 25 | phase. | ||
| 26 | |||
| 27 | acss_setkey() sets up the B<ACSS_KEY> B<key> using the 40 bit key at B<data>. | ||
| 28 | If the flag B<enc> is set to B<1> B<key> will be used for encryption, | ||
| 29 | otherwise for decryption. The integer B<mode> denotes the mode to use. | ||
| 30 | Acceptible values are B<0> to B<3>. For any other value mode B<0> is used. | ||
| 31 | |||
| 32 | acss() encrypts or decrypts the B<len> bytes of B<in> using B<key> and places | ||
| 33 | the result at B<out>. | ||
| 34 | |||
| 35 | Applications should use the higher level functions | ||
| 36 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> etc. instead of calling the acss | ||
| 37 | functions directly. | ||
| 38 | |||
| 39 | =head1 RETURN VALUES | ||
| 40 | |||
| 41 | None of the functions presented here return any value. | ||
| 42 | |||
| 43 | =head1 NOTE | ||
| 44 | |||
| 45 | ACSS is considered as an insecure cipher. Therefore, use of ACSS is | ||
| 46 | discouraged. | ||
| 47 | |||
| 48 | =head1 SEE ALSO | ||
| 49 | |||
| 50 | RC4(3), arc4random(3) | ||
| 51 | |||
| 52 | =head1 History | ||
| 53 | |||
| 54 | A proprietary algorithm called CSS can be licensed from the DVD Copy Control | ||
| 55 | Association (DVD CCA). CSS is considered a trade secret and is not patented. | ||
| 56 | In October 1999 source code for CSS was posted anonymously to the LiViD | ||
| 57 | mailing list. Since then, several implementations and mathematical | ||
| 58 | descriptions of CSS are available and CSS has been subject to cryptanalysis. | ||
| 59 | The DVD CCA has repeatedly failed to sue individuals for publishing such | ||
| 60 | information about CSS. | ||
| 61 | |||
| 62 | ACSS is a stream cipher written from scratch and believed to be interoperable | ||
| 63 | with CSS. | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
