Skip to content

Commit e979b1f

Browse files
committed
Update to OpenSSL 1.0.1e and include build script for future use.
1 parent 9e9e27b commit e979b1f

14 files changed

+152
-49
lines changed

OpenSSL.podspec

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
Pod::Spec.new do |s|
22
s.name = "OpenSSL"
3-
s.version = "1.0.1c"
3+
s.version = "1.0.1e"
44
s.summary = "Pre-built OpenSSL for iOS."
5-
s.description = <<-DESC
6-
Supports iPhone Simulator, armv7 and armv7s.
7-
DESC
8-
s.homepage = "https://github.com/yaakov-h/OpenSSL"
9-
s.license = 'OpenSSL (OpenSSL/SSLeay)'
5+
s.description = "Supports iPhone Simulator, armv7 and armv7s."
6+
s.homepage = "https://github.com/justinplouffe/OpenSSL"
7+
s.license = 'OpenSSL (OpenSSL/SSLeay)'
108

11-
s.author = 'Yaakov'
12-
s.source = { :git => "https://github.com/yaakov-h/OpenSSL.git", :tag => "1.0.1c" }
9+
s.author = 'Justin Plouffe'
10+
s.source = { :git => "https://github.com/justinplouffe/OpenSSL.git", :tag => "1.0.1e" }
1311

1412
s.platform = :ios, '6.0'
1513
s.source_files = 'include/openssl/**/*.h'

build.sh

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
# Yay shell scripting! This script builds a static version of
4+
# OpenSSL ${OPENSSL_VERSION} for iOS 5.1 that contains code for armv6, armv7 and i386.
5+
6+
set -x
7+
8+
# Setup paths to stuff we need
9+
10+
OPENSSL_VERSION="1.0.1c"
11+
12+
DEVELOPER="/Applications/Xcode.app/Contents/Developer"
13+
14+
SDK_VERSION="6.0"
15+
16+
IPHONEOS_PLATFORM="${DEVELOPER}/Platforms/iPhoneOS.platform"
17+
IPHONEOS_SDK="${IPHONEOS_PLATFORM}/Developer/SDKs/iPhoneOS${SDK_VERSION}.sdk"
18+
IPHONEOS_GCC="${IPHONEOS_PLATFORM}/Developer/usr/bin/gcc"
19+
20+
IPHONESIMULATOR_PLATFORM="${DEVELOPER}/Platforms/iPhoneSimulator.platform"
21+
IPHONESIMULATOR_SDK="${IPHONESIMULATOR_PLATFORM}/Developer/SDKs/iPhoneSimulator${SDK_VERSION}.sdk"
22+
IPHONESIMULATOR_GCC="${IPHONESIMULATOR_PLATFORM}/Developer/usr/bin/gcc"
23+
24+
# Clean up whatever was left from our previous build
25+
26+
rm -rf include lib
27+
rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*"
28+
rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*.log"
29+
30+
build()
31+
{
32+
ARCH=$1
33+
GCC=$2
34+
SDK=$3
35+
rm -rf "openssl-${OPENSSL_VERSION}"
36+
tar xfz "openssl-${OPENSSL_VERSION}.tar.gz"
37+
pushd .
38+
cd "openssl-${OPENSSL_VERSION}"
39+
./Configure BSD-generic32 --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
40+
perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
41+
perl -i -pe "s|^CC= gcc|CC= ${GCC} -arch ${ARCH}|g" Makefile
42+
perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDK} \$1|g" Makefile
43+
make &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
44+
make install &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
45+
popd
46+
rm -rf "openssl-${OPENSSL_VERSION}"
47+
}
48+
49+
build "armv7" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}"
50+
build "armv7s" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}"
51+
build "i386" "${IPHONESIMULATOR_GCC}" "${IPHONESIMULATOR_SDK}"
52+
53+
#
54+
55+
mkdir include
56+
cp -r /tmp/openssl-${OPENSSL_VERSION}-i386/include/openssl include/
57+
58+
mkdir lib
59+
lipo \
60+
"/tmp/openssl-${OPENSSL_VERSION}-armv7/lib/libcrypto.a" \
61+
"/tmp/openssl-${OPENSSL_VERSION}-armv7s/lib/libcrypto.a" \
62+
"/tmp/openssl-${OPENSSL_VERSION}-i386/lib/libcrypto.a" \
63+
-create -output lib/libcrypto.a
64+
lipo \
65+
"/tmp/openssl-${OPENSSL_VERSION}-armv7/lib/libssl.a" \
66+
"/tmp/openssl-${OPENSSL_VERSION}-armv7s/lib/libssl.a" \
67+
"/tmp/openssl-${OPENSSL_VERSION}-i386/lib/libssl.a" \
68+
-create -output lib/libssl.a
69+
70+
rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*"
71+
rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*.log"
72+

include/openssl/crypto.h

+9-2
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,10 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
488488
long (**go)(void));
489489

490490
void *CRYPTO_malloc_locked(int num, const char *file, int line);
491-
void CRYPTO_free_locked(void *);
491+
void CRYPTO_free_locked(void *ptr);
492492
void *CRYPTO_malloc(int num, const char *file, int line);
493493
char *CRYPTO_strdup(const char *str, const char *file, int line);
494-
void CRYPTO_free(void *);
494+
void CRYPTO_free(void *ptr);
495495
void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
496496
void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
497497
int line);
@@ -574,6 +574,13 @@ void OPENSSL_init(void);
574574
#define fips_cipher_abort(alg) while(0)
575575
#endif
576576

577+
/* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
578+
* takes an amount of time dependent on |len|, but independent of the contents
579+
* of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
580+
* defined order as the return value when a != b is undefined, other than to be
581+
* non-zero. */
582+
int CRYPTO_memcmp(const void *a, const void *b, size_t len);
583+
577584
/* BEGIN ERROR CODES */
578585
/* The following lines are auto generated by the script mkerr.pl. Any changes
579586
* made after this point may be overwritten when the script is next run.

include/openssl/dtls1.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
*
5858
*/
5959

60-
#ifndef HEADER_DTLS1_H
61-
#define HEADER_DTLS1_H
60+
#ifndef HEADER_DTLS1_H
61+
#define HEADER_DTLS1_H
6262

6363
#include <openssl/buffer.h>
6464
#include <openssl/pqueue.h>
@@ -72,8 +72,12 @@
7272
#elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_)
7373
#include <sys/timeval.h>
7474
#else
75+
#if defined(OPENSSL_SYS_VXWORKS)
76+
#include <sys/times.h>
77+
#else
7578
#include <sys/time.h>
7679
#endif
80+
#endif
7781

7882
#ifdef __cplusplus
7983
extern "C" {

include/openssl/ec.h

+18-10
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@ int EC_GROUP_get_curve_name(const EC_GROUP *group);
274274
void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
275275
int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
276276

277-
void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t);
277+
void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form);
278278
point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);
279279

280-
unsigned char *EC_GROUP_get0_seed(const EC_GROUP *);
280+
unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x);
281281
size_t EC_GROUP_get_seed_len(const EC_GROUP *);
282282
size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
283283

@@ -626,8 +626,8 @@ int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *c
626626
*/
627627
int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);
628628

629-
int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *);
630-
int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *);
629+
int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx);
630+
int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx);
631631

632632
/** Computes r = generator * n sum_{i=0}^num p[i] * m[i]
633633
* \param group underlying EC_GROUP object
@@ -800,16 +800,24 @@ const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
800800
int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
801801

802802
unsigned EC_KEY_get_enc_flags(const EC_KEY *key);
803-
void EC_KEY_set_enc_flags(EC_KEY *, unsigned int);
804-
point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *);
805-
void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);
803+
void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);
804+
point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key);
805+
void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform);
806806
/* functions to set/get method specific data */
807-
void *EC_KEY_get_key_method_data(EC_KEY *,
807+
void *EC_KEY_get_key_method_data(EC_KEY *key,
808808
void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
809-
void EC_KEY_insert_key_method_data(EC_KEY *, void *data,
809+
/** Sets the key method data of an EC_KEY object, if none has yet been set.
810+
* \param key EC_KEY object
811+
* \param data opaque data to install.
812+
* \param dup_func a function that duplicates |data|.
813+
* \param free_func a function that frees |data|.
814+
* \param clear_free_func a function that wipes and frees |data|.
815+
* \return the previously set data pointer, or NULL if |data| was inserted.
816+
*/
817+
void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
810818
void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
811819
/* wrapper functions for the underlying EC_GROUP object */
812-
void EC_KEY_set_asn1_flag(EC_KEY *, int);
820+
void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag);
813821

814822
/** Creates a table of pre-computed multiples of the generator to
815823
* accelerate further EC_KEY operations.

include/openssl/evp.h

+11-4
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ struct evp_cipher_st
402402
/* Length of tag for TLS */
403403
#define EVP_GCM_TLS_TAG_LEN 16
404404

405-
406405
typedef struct evp_cipher_info_st
407406
{
408407
const EVP_CIPHER *cipher;
@@ -789,8 +788,8 @@ const EVP_CIPHER *EVP_aes_128_cfb128(void);
789788
# define EVP_aes_128_cfb EVP_aes_128_cfb128
790789
const EVP_CIPHER *EVP_aes_128_ofb(void);
791790
const EVP_CIPHER *EVP_aes_128_ctr(void);
792-
const EVP_CIPHER *EVP_aes_128_gcm(void);
793791
const EVP_CIPHER *EVP_aes_128_ccm(void);
792+
const EVP_CIPHER *EVP_aes_128_gcm(void);
794793
const EVP_CIPHER *EVP_aes_128_xts(void);
795794
const EVP_CIPHER *EVP_aes_192_ecb(void);
796795
const EVP_CIPHER *EVP_aes_192_cbc(void);
@@ -800,8 +799,8 @@ const EVP_CIPHER *EVP_aes_192_cfb128(void);
800799
# define EVP_aes_192_cfb EVP_aes_192_cfb128
801800
const EVP_CIPHER *EVP_aes_192_ofb(void);
802801
const EVP_CIPHER *EVP_aes_192_ctr(void);
803-
const EVP_CIPHER *EVP_aes_192_gcm(void);
804802
const EVP_CIPHER *EVP_aes_192_ccm(void);
803+
const EVP_CIPHER *EVP_aes_192_gcm(void);
805804
const EVP_CIPHER *EVP_aes_256_ecb(void);
806805
const EVP_CIPHER *EVP_aes_256_cbc(void);
807806
const EVP_CIPHER *EVP_aes_256_cfb1(void);
@@ -810,8 +809,8 @@ const EVP_CIPHER *EVP_aes_256_cfb128(void);
810809
# define EVP_aes_256_cfb EVP_aes_256_cfb128
811810
const EVP_CIPHER *EVP_aes_256_ofb(void);
812811
const EVP_CIPHER *EVP_aes_256_ctr(void);
813-
const EVP_CIPHER *EVP_aes_256_gcm(void);
814812
const EVP_CIPHER *EVP_aes_256_ccm(void);
813+
const EVP_CIPHER *EVP_aes_256_gcm(void);
815814
const EVP_CIPHER *EVP_aes_256_xts(void);
816815
#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
817816
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
@@ -1243,6 +1242,8 @@ void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
12431242
int (*ctrl_str)(EVP_PKEY_CTX *ctx,
12441243
const char *type, const char *value));
12451244

1245+
void EVP_add_alg_module(void);
1246+
12461247
/* BEGIN ERROR CODES */
12471248
/* The following lines are auto generated by the script mkerr.pl. Any changes
12481249
* made after this point may be overwritten when the script is next run.
@@ -1257,6 +1258,7 @@ void ERR_load_EVP_strings(void);
12571258
#define EVP_F_AES_INIT_KEY 133
12581259
#define EVP_F_AES_XTS 172
12591260
#define EVP_F_AES_XTS_CIPHER 175
1261+
#define EVP_F_ALG_MODULE_INIT 177
12601262
#define EVP_F_CAMELLIA_INIT_KEY 159
12611263
#define EVP_F_CMAC_INIT 173
12621264
#define EVP_F_D2I_PKEY 100
@@ -1350,15 +1352,19 @@ void ERR_load_EVP_strings(void);
13501352
#define EVP_R_DIFFERENT_PARAMETERS 153
13511353
#define EVP_R_DISABLED_FOR_FIPS 163
13521354
#define EVP_R_ENCODE_ERROR 115
1355+
#define EVP_R_ERROR_LOADING_SECTION 165
1356+
#define EVP_R_ERROR_SETTING_FIPS_MODE 166
13531357
#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119
13541358
#define EVP_R_EXPECTING_AN_RSA_KEY 127
13551359
#define EVP_R_EXPECTING_A_DH_KEY 128
13561360
#define EVP_R_EXPECTING_A_DSA_KEY 129
13571361
#define EVP_R_EXPECTING_A_ECDSA_KEY 141
13581362
#define EVP_R_EXPECTING_A_EC_KEY 142
1363+
#define EVP_R_FIPS_MODE_NOT_SUPPORTED 167
13591364
#define EVP_R_INITIALIZATION_ERROR 134
13601365
#define EVP_R_INPUT_NOT_INITIALIZED 111
13611366
#define EVP_R_INVALID_DIGEST 152
1367+
#define EVP_R_INVALID_FIPS_MODE 168
13621368
#define EVP_R_INVALID_KEY_LENGTH 130
13631369
#define EVP_R_INVALID_OPERATION 148
13641370
#define EVP_R_IV_TOO_LARGE 102
@@ -1383,6 +1389,7 @@ void ERR_load_EVP_strings(void);
13831389
#define EVP_R_TOO_LARGE 164
13841390
#define EVP_R_UNKNOWN_CIPHER 160
13851391
#define EVP_R_UNKNOWN_DIGEST 161
1392+
#define EVP_R_UNKNOWN_OPTION 169
13861393
#define EVP_R_UNKNOWN_PBE_ALGORITHM 121
13871394
#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135
13881395
#define EVP_R_UNSUPPORTED_ALGORITHM 156

include/openssl/opensslconf.h

+7-10
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
33

44
/* OpenSSL was configured with the following options: */
5-
#ifndef OPENSSL_SYSNAME_iOS
6-
# define OPENSSL_SYSNAME_iOS
7-
#endif
85
#ifndef OPENSSL_DOING_MAKEDEPEND
96

107

@@ -86,8 +83,8 @@
8683

8784
#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
8885
#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
89-
#define ENGINESDIR "/Users/yaakov/Development/SKSteamKit/External/OpenSSL-for-iPhone/bin/iPhoneSimulator6.0-i386.sdk/lib/engines"
90-
#define OPENSSLDIR "/Users/yaakov/Development/SKSteamKit/External/OpenSSL-for-iPhone/bin/iPhoneSimulator6.0-i386.sdk"
86+
#define ENGINESDIR "/tmp/openssl-1.0.1e-i386/lib/engines"
87+
#define OPENSSLDIR "/tmp/openssl-1.0.1e-i386"
9188
#endif
9289
#endif
9390

@@ -118,22 +115,22 @@
118115
* - Intel P6 because partial register stalls are very expensive;
119116
* - elder Alpha because it lacks byte load/store instructions;
120117
*/
121-
#define RC4_INT unsigned char
118+
#define RC4_INT unsigned int
122119
#endif
123120
#if !defined(RC4_CHUNK)
124121
/*
125122
* This enables code handling data aligned at natural CPU word
126123
* boundary. See crypto/rc4/rc4_enc.c for further details.
127124
*/
128-
#define RC4_CHUNK unsigned long
125+
#undef RC4_CHUNK
129126
#endif
130127
#endif
131128

132129
#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
133130
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
134131
* %20 speed up (longs are 8 bytes, int's are 4). */
135132
#ifndef DES_LONG
136-
#define DES_LONG unsigned long
133+
#define DES_LONG unsigned int
137134
#endif
138135
#endif
139136

@@ -153,12 +150,12 @@
153150
#define CONFIG_HEADER_RC4_LOCL_H
154151
/* if this is defined data[i] is used instead of *data, this is a %20
155152
* speedup on x86 */
156-
#undef RC4_INDEX
153+
#define RC4_INDEX
157154
#endif
158155

159156
#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
160157
#define CONFIG_HEADER_BF_LOCL_H
161-
#define BF_PTR
158+
#undef BF_PTR
162159
#endif /* HEADER_BF_LOCL_H */
163160

164161
#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)

include/openssl/opensslv.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
2626
* major minor fix final patch/beta)
2727
*/
28-
#define OPENSSL_VERSION_NUMBER 0x1000103fL
28+
#define OPENSSL_VERSION_NUMBER 0x1000105fL
2929
#ifdef OPENSSL_FIPS
30-
#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c-fips 10 May 2012"
30+
#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1e-fips 11 Feb 2013"
3131
#else
32-
#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c 10 May 2012"
32+
#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1e 11 Feb 2013"
3333
#endif
3434
#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
3535

include/openssl/rsa.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ struct rsa_st
280280

281281
RSA * RSA_new(void);
282282
RSA * RSA_new_method(ENGINE *engine);
283-
int RSA_size(const RSA *);
283+
int RSA_size(const RSA *rsa);
284284

285285
/* Deprecated version */
286286
#ifndef OPENSSL_NO_DEPRECATED

0 commit comments

Comments
 (0)