blob: 3f9540fbc72f33278dc7fe4918b811afba4d5e91
1 | /* ***** BEGIN LICENSE BLOCK ***** |
2 | * Source last modified: $Id: challenge.h,v 1.1.1.1.2.1 2005/05/04 18:20:57 hubbe Exp $ |
3 | * |
4 | * REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM |
5 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. |
6 | * All Rights Reserved. |
7 | * |
8 | * The contents of this file, and the files included with this file, |
9 | * are subject to the current version of the Real Format Source Code |
10 | * Porting and Optimization License, available at |
11 | * https://helixcommunity.org/2005/license/realformatsource (unless |
12 | * RealNetworks otherwise expressly agrees in writing that you are |
13 | * subject to a different license). You may also obtain the license |
14 | * terms directly from RealNetworks. You may not use this file except |
15 | * in compliance with the Real Format Source Code Porting and |
16 | * Optimization License. There are no redistribution rights for the |
17 | * source code of this file. Please see the Real Format Source Code |
18 | * Porting and Optimization License for the rights, obligations and |
19 | * limitations governing use of the contents of the file. |
20 | * |
21 | * RealNetworks is the developer of the Original Code and owns the |
22 | * copyrights in the portions it created. |
23 | * |
24 | * This file, and the files included with this file, is distributed and |
25 | * made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, |
26 | * EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL |
27 | * SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF |
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT |
29 | * OR NON-INFRINGEMENT. |
30 | * |
31 | * Technology Compatibility Kit Test Suite(s) Location: |
32 | * https://rarvcode-tck.helixcommunity.org |
33 | * |
34 | * Contributor(s): |
35 | * |
36 | * ***** END LICENSE BLOCK ***** */ |
37 | |
38 | #ifndef _CHALLENGE_H_ |
39 | #define _CHALLENGE_H_ |
40 | |
41 | #include "helix_types.h" |
42 | #include "helix_utils.h" |
43 | #include "rm_memory.h" |
44 | |
45 | |
46 | |
47 | /* |
48 | * The original Challange structure and methods. Used in the |
49 | * Old PNA and as the first round in the new RTSP Challenge. |
50 | */ |
51 | struct Challenge { |
52 | BYTE text[33]; |
53 | BYTE response[33]; |
54 | }; |
55 | |
56 | struct Challenge* CreateChallenge(INT32 k1, |
57 | INT32 k2, |
58 | BYTE* k3, |
59 | BYTE* k4); |
60 | |
61 | struct Challenge* CreateChallengeFromPool(INT32 k1, |
62 | INT32 k2, |
63 | BYTE* k3, |
64 | BYTE* k4, |
65 | rm_malloc_func_ptr fpMalloc, |
66 | void* pMemoryPool); |
67 | |
68 | BYTE* ChallengeResponse1(BYTE* k1, BYTE* k2, |
69 | INT32 k3, INT32 k4, |
70 | struct Challenge* ch); |
71 | BYTE* ChallengeResponse2(BYTE* k1, BYTE* k2, |
72 | INT32 k3, INT32 k4, |
73 | struct Challenge* ch); |
74 | |
75 | |
76 | |
77 | /* |
78 | * The new RTSP Challenge structure and methods |
79 | */ |
80 | struct RealChallenge { |
81 | BYTE challenge[33]; |
82 | BYTE response[41]; |
83 | BYTE trap[9]; |
84 | }; |
85 | |
86 | |
87 | struct RealChallenge* CreateRealChallenge(); |
88 | struct RealChallenge* CreateRealChallengeFromPool(rm_malloc_func_ptr fpMalloc, |
89 | void* pMemoryPool); |
90 | BYTE* RealChallengeResponse1(BYTE* k1, BYTE* k2, |
91 | INT32 k3, INT32 k4, |
92 | struct RealChallenge* rch); |
93 | BYTE* RealChallengeResponse2(BYTE* k1, BYTE* k2, |
94 | INT32 k3, INT32 k4, |
95 | struct RealChallenge* rch); |
96 | |
97 | |
98 | void CalcCompanyIDKey(const char* companyID, |
99 | const char* starttime, |
100 | const char* guid, |
101 | const char* challenge, |
102 | const char* copyright, |
103 | UCHAR* outputKey); |
104 | |
105 | INT32 BinTo64(const BYTE* pInBuf, INT32 len, char* pOutBuf); |
106 | |
107 | |
108 | /* Support constants and values */ |
109 | extern const INT32 G2_BETA_EXPIRATION; |
110 | |
111 | extern const INT32 RC_MAGIC1; |
112 | extern const INT32 RC_MAGIC2; |
113 | extern const INT32 RC_MAGIC3; |
114 | extern const INT32 RC_MAGIC4; |
115 | |
116 | extern const unsigned char pRCMagic1[]; |
117 | extern const unsigned char pRCMagic2[]; |
118 | |
119 | |
120 | // This UUID was added in the 5.0 player to allow us to identify |
121 | // players from Progressive Networks. Other companies licensing this |
122 | // code must be assigned a different UUID. |
123 | #define HX_COMPANY_ID "92c4d14a-fa51-4bcb-8a67-7ac286f0ff7e" |
124 | #define HX_COMPANY_ID_KEY_SIZE 16 |
125 | |
126 | |
127 | extern const unsigned char HX_MAGIC_TXT_1[]; |
128 | extern const char pMagic2[]; |
129 | |
130 | |
131 | |
132 | #endif /*_CHALLENGE_H_*/ |
133 |