diff options
author | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2004-01-23 16:58:44 +0000 |
---|---|---|
committer | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2004-01-23 16:58:44 +0000 |
commit | 8f91d064c141db1f678b9d73900b3a78217e6f41 (patch) | |
tree | dad842686985c66266478959b1c70d5ac8233171 | |
parent | 1ec006e552b15c821aa2d4871897f961cc30ee54 (diff) |
evp api and manual page for acss
ok deraadt@ markus@
-rw-r--r-- | lib/libssl/src/crypto/evp/e_acss.c | 85 | ||||
-rw-r--r-- | lib/libssl/src/doc/crypto/acss.pod | 66 |
2 files changed, 151 insertions, 0 deletions
diff --git a/lib/libssl/src/crypto/evp/e_acss.c b/lib/libssl/src/crypto/evp/e_acss.c new file mode 100644 index 00000000000..f4e55f1030c --- /dev/null +++ b/lib/libssl/src/crypto/evp/e_acss.c @@ -0,0 +1,85 @@ +/* $Id: e_acss.c,v 1.1 2004/01/23 16:58:43 hshoexer Exp $ */ +/* + * Copyright (c) 2004 The OpenBSD project + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef OPENSSL_NO_ACSS + +#include "cryptlib.h" +#include <openssl/evp.h> +#include <openssl/objects.h> +#include "evp_locl.h" +#include <openssl/acss.h> + +typedef struct { + ACSS_KEY ks; +} EVP_ACSS_KEY; + +#define data(ctx) EVP_C_DATA(EVP_ACSS_KEY,ctx) + +static int acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, + const unsigned char *iv, int enc); +static int acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, unsigned int inl); +static int acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); +static const EVP_CIPHER acss_cipher = { + NID_undef, + 1,5,0, + 0, + acss_init_key, + acss_ciph, + NULL, + sizeof(EVP_ACSS_KEY), + NULL, + NULL, + acss_ctrl, + NULL +}; + +const +EVP_CIPHER *EVP_acss(void) +{ + return(&acss_cipher); +} + +static int +acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, + const unsigned char *iv, int enc) +{ + acss_setkey(&data(ctx)->ks,key,enc,ACSS_DATA); + return 1; +} + +static int +acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, + unsigned int inl) +{ + acss(&data(ctx)->ks,inl,in,out); + return 1; +} + +static int +acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) +{ + switch(type) { + case EVP_CTRL_SET_ACSS_MODE: + data(ctx)->ks.mode = arg; + return 1; + + default: + return -1; + } +} +#endif diff --git a/lib/libssl/src/doc/crypto/acss.pod b/lib/libssl/src/doc/crypto/acss.pod new file mode 100644 index 00000000000..022a803be59 --- /dev/null +++ b/lib/libssl/src/doc/crypto/acss.pod @@ -0,0 +1,66 @@ +=pod + +=head1 NAME + +acss, acss_setkey - ACSS encryption + +=head1 SYNOPSIS + + #include <openssl/acss.h> + + void acss_setkey(ACSS_KEY *key, const unsigned char *data, int enc, + int mode); + + void acss(ACSS_KEY *key, unsigned long len, const unsigned char *in, + unsigned char *out); + +=head1 DESCRIPTION + +This library implements the Alleged Content Scrambling System. It is believed +to be interoperable with CSS of the DVD Copy Control Association. + +ACSS is a stream cipher with a fixed key length of 40 bit (5 byte). + +ACSS consists of a key setup phase and the actual encryption or decryption +phase. + +acss_setkey() sets up the B<ACSS_KEY> B<key> using the 40 bit key at B<data>. +If the flag B<enc> is set to B<1> B<key> will be used for encryption, +otherwise for decryption. The integer B<mode> denotes the mode to use. +Acceptible values are B<0> to B<3>. For any other value mode B<0> is used. + +acss() encrypts or decrypts the B<len> bytes of B<in> using B<key> and places +the result at B<out>. + +Applications should use the higher level functions +L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> etc. instead of calling the acss +functions directly. + +=head1 RETURN VALUES + +None of the functions presented here return any value. + +=head1 NOTE + +ACSS is considered as an insecure cipher. Therefore, use of ACSS is +discouraged. + +=head1 SEE ALSO + +RC4(3), arc4random(3) + +=head1 History + +A proprietary algorithm called CSS can be licensed from the DVD Copy Control +Association (DVD CCA). CSS is considered a trade secret and is not patented. +In October 1999 source code for CSS was posted anonymously to the LiViD +mailing list. Since then, several implementations and mathematical +descriptions of CSS are available and CSS has been subject to cryptanalysis. +The DVD CCA has repeatedly failed to sue individuals for publishing such +information about CSS. + +ACSS is a stream cipher written from scratch and believed to be interoperable +with CSS. + +=cut + |