55 #if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_MD5)
62 #ifndef EVP_CIPH_FLAG_AEAD_CIPHER
63 #define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
64 #define EVP_CTRL_AEAD_TLS1_AAD 0x16
65 #define EVP_CTRL_AEAD_SET_MAC_KEY 0x17
69 #define EVP_RC4_KEY_SIZE 16
78 #define NO_PAYLOAD_LENGTH ((size_t)-1)
81 MD5_CTX *ctx,
const void *inp,
size_t blocks);
83 #define data(ctx) ((EVP_RC4_HMAC_MD5 *)(ctx)->cipher_data)
86 const unsigned char *inkey,
87 const unsigned char *iv,
int enc)
103 #if !defined(OPENSSL_NO_ASM) && ( \
104 defined(__x86_64) || defined(__x86_64__) || \
105 defined(_M_AMD64) || defined(_M_X64) || \
106 defined(__INTEL__) ) && \
107 !(defined(__APPLE__) && defined(__MACH__))
108 #define STITCHED_CALL
111 #if !defined(STITCHED_CALL)
116 static int rc4_hmac_md5_cipher(
EVP_CIPHER_CTX *ctx,
unsigned char *out,
117 const unsigned char *in,
size_t len)
120 #if defined(STITCHED_CALL)
133 #if defined(STITCHED_CALL)
138 (OPENSSL_ia32cap_P[0]&(1<<20))==0) {
140 RC4(&key->
ks,rc4_off,in,out);
147 key->
md.
Nh += blocks>>29;
148 key->
md.
Nl += blocks<<=3;
149 if (key->
md.
Nl<(
unsigned int)blocks) key->
md.
Nh++;
159 memcpy(out+rc4_off,in+rc4_off,plen-rc4_off);
167 RC4(&key->
ks,len-rc4_off,out+rc4_off,out+rc4_off);
169 RC4(&key->
ks,len-rc4_off,in+rc4_off,out+rc4_off);
173 #if defined(STITCHED_CALL)
178 if (len>rc4_off && (blocks=(len-rc4_off)/
MD5_CBLOCK) &&
179 (OPENSSL_ia32cap_P[0]&(1<<20))==0) {
180 RC4(&key->
ks,rc4_off,in,out);
188 l = (key->
md.
Nl+(blocks<<3))&0xffffffffU;
189 if (l<key->md.Nl) key->
md.
Nh++;
191 key->
md.
Nh += blocks>>29;
198 RC4(&key->
ks,len-rc4_off,in+rc4_off,out+rc4_off);
229 unsigned char hmac_key[64];
231 memset (hmac_key,0,
sizeof(hmac_key));
233 if (arg > (
int)
sizeof(hmac_key)) {
238 memcpy(hmac_key,ptr,arg);
241 for (i=0;i<
sizeof(hmac_key);i++)
246 for (i=0;i<
sizeof(hmac_key);i++)
247 hmac_key[i] ^= 0x36^0x5c;
255 unsigned char *
p=
ptr;
256 unsigned int len=p[arg-2]<<8|p[arg-1];
277 #ifdef NID_rc4_hmac_md5
284 rc4_hmac_md5_init_key,
296 return(&r4_hmac_md5_cipher);