/****************************************************************************** * (c)2011 Broadcom Corporation * * This program is the proprietary software of Broadcom Corporation and/or its licensors, * and may only be used, duplicated, modified or distributed pursuant to the terms and * conditions of a separate, written license agreement executed between you and Broadcom * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants * no license (express or implied), right to use, or waiver of any kind with respect to the * Software, and Broadcom expressly reserves all rights in and to the Software and all * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. * * Except as expressly set forth in the Authorized License, * * 1. This program, including its structure, sequence and organization, constitutes the valuable trade * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, * and to use this information only in connection with your use of Broadcom integrated circuit products. * * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF * USE OR PERFORMANCE OF THE SOFTWARE. * * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF * ANY LIMITED REMEDY. * * $brcm_Workfile: ecc.h $ * $brcm_Revision: 1 $ * $brcm_Date: 11/8/11 2:43p $ * * Module Description: * * Revision History: * * $brcm_Log: /nexus/lib/dtcp_ip/include/ecc.h $ * * 1 11/8/11 2:43p leisun * SWSECURITY-86: Including original license term for bcrypt * *****************************************************************************/ /****************************************************************************** * ECC implementation is from "FreeMe" open source, see bellow for license term. A license???? For anonymously published software? Yes! The purpose here is to outline how I would like the software used. Putting together all this has been a lot of work, and I hope people can respect the purpose behind the software, as spelled out here. 1. The purpose of this software is to re-assert your rights over fair use of audio files that you have legally purchased or otherwise obtained legally. Please use it for that purpose only. Do not use it to unprotect files you don't have a legal right to, or to unprotect legal files for the purpose of re-distributing them to others who do not have a legal right to the content. In other words, in use of this software obey traditional copyright laws -- but the DMCA may be completely ignored as far as this license concerned (although you must accept responsibility for ignoring this law, since it is enforceable). 2. This is free software, without any warranties, guarantees, or any assurance that it will work as described. It relies on certain other software (from Microsoft) operating as it currently does, so I don't take any responsibility for what happens if Microsoft updates their software to render this useless, or even if they put bombs in their new software to erase all your files if they detect this software. But I sure hope they wouldn't do that. *********************************************************************/ /* * If the "neg" field of the BIGNUM struct is set, then this point is * the identity. This is a terrible way to do this, since it's not * clear what the future of this flag is -- however, for now it works, * and it's fast... */ typedef struct eccpt_st { BIGNUM *x, *y; } ECCpt; typedef struct eccparam_st { BIGNUM *modulus; /* Curve is over Z_modulus */ BIGNUM *a, *b; /* Curve coefficients */ BIGNUM *n; /* Order of Generator */ ECCpt generator; /* Generator for our operations */ ECCpt pubkey; /* Public key */ BIGNUM *privkey; /* Corresponding private key */ } ECC; ECC *ECC_new_set(BIGNUM * p, BIGNUM * a, BIGNUM * b, ECCpt g, BIGNUM *n); void ECC_free(ECC * ecc); void ECCpt_init(ECCpt * pt); void ECCpt_free(ECCpt * pt); int ECCpt_is_valid_pt(ECCpt * a, ECC * ecc); int ECCpt_is_equal(ECCpt * a, ECCpt * b); void ECCpt_add(ECCpt * r, ECCpt * a, ECCpt * b, ECC * ecc); void ECCpt_mul(ECCpt * r, ECCpt * a, BIGNUM * n, ECC * ecc);