1*4e4b8e58SAndroid Build Coastguard WorkerBouncy Castle on the Android platform. 2*4e4b8e58SAndroid Build Coastguard Worker--- 3*4e4b8e58SAndroid Build Coastguard Worker 4*4e4b8e58SAndroid Build Coastguard WorkerThe code in this directory is based on $BOUNCYCASTLE_VERSION in the 5*4e4b8e58SAndroid Build Coastguard Workerfile bouncycastle.version. See the in-file change markers for more information 6*4e4b8e58SAndroid Build Coastguard Workeron how the code differs from $BOUNCYCASTLE_VERSION. 7*4e4b8e58SAndroid Build Coastguard Worker 8*4e4b8e58SAndroid Build Coastguard WorkerPorting New Versions of Bouncy Castle. 9*4e4b8e58SAndroid Build Coastguard Worker-- 10*4e4b8e58SAndroid Build Coastguard Worker 11*4e4b8e58SAndroid Build Coastguard WorkerThe following steps are recommended for porting new Bouncy Castle versions. 12*4e4b8e58SAndroid Build Coastguard Worker 13*4e4b8e58SAndroid Build Coastguard Worker1) Retrieve the appropriate version of the Bouncy Castle source from 14*4e4b8e58SAndroid Build Coastguard Worker www.bouncycastle.org/latest_releases.html (both bcprov-jdk*-*.tar.gz 15*4e4b8e58SAndroid Build Coastguard Worker and bcpkix-jdk*-*.tar.gz files). 16*4e4b8e58SAndroid Build Coastguard Worker 17*4e4b8e58SAndroid Build Coastguard Worker Check the checksum (found at http://bouncycastle.org/checksums.html) with: 18*4e4b8e58SAndroid Build Coastguard Worker 19*4e4b8e58SAndroid Build Coastguard Worker md5sum bcprov-jdk*-*.tar.gz 20*4e4b8e58SAndroid Build Coastguard Worker sha1sum bcprov-jdk*-*.tar.gz 21*4e4b8e58SAndroid Build Coastguard Worker md5sum bcpkix-jdk*-*.tar.gz 22*4e4b8e58SAndroid Build Coastguard Worker sha1sum bcpkix-jdk*-*.tar.gz 23*4e4b8e58SAndroid Build Coastguard Worker 24*4e4b8e58SAndroid Build Coastguard Worker2) Submit the code to the upstream-master branch: 25*4e4b8e58SAndroid Build Coastguard Worker 26*4e4b8e58SAndroid Build Coastguard Worker a) Create a new branch tracking upstream-master 27*4e4b8e58SAndroid Build Coastguard Worker 28*4e4b8e58SAndroid Build Coastguard Worker git checkout -b upgrade-to-xxx --track aosp/upstream-master 29*4e4b8e58SAndroid Build Coastguard Worker 30*4e4b8e58SAndroid Build Coastguard Worker b) Update the variables in bouncycastle.version. 31*4e4b8e58SAndroid Build Coastguard Worker 32*4e4b8e58SAndroid Build Coastguard Worker c) Expand the source from the .tar.gz files 33*4e4b8e58SAndroid Build Coastguard Worker 34*4e4b8e58SAndroid Build Coastguard Worker d) Replace bc{prov,pkix}/src/main/java/org with the equivalent source 35*4e4b8e58SAndroid Build Coastguard Worker directory 36*4e4b8e58SAndroid Build Coastguard Worker 37*4e4b8e58SAndroid Build Coastguard Worker e) Ensure any new files are added 38*4e4b8e58SAndroid Build Coastguard Worker 39*4e4b8e58SAndroid Build Coastguard Worker git add bc{prov,pkix} 40*4e4b8e58SAndroid Build Coastguard Worker 41*4e4b8e58SAndroid Build Coastguard Worker f) Commit the change 42*4e4b8e58SAndroid Build Coastguard Worker 43*4e4b8e58SAndroid Build Coastguard Worker git commit -a -m 'bouncycastle: Android tree with upstream code for version X.XX' 44*4e4b8e58SAndroid Build Coastguard Worker 45*4e4b8e58SAndroid Build Coastguard Worker g) Get the change reviewed 46*4e4b8e58SAndroid Build Coastguard Worker 47*4e4b8e58SAndroid Build Coastguard Worker repo upload . -D upstream-master 48*4e4b8e58SAndroid Build Coastguard Worker 49*4e4b8e58SAndroid Build Coastguard Worker3) Merge the code into the master branch 50*4e4b8e58SAndroid Build Coastguard Worker 51*4e4b8e58SAndroid Build Coastguard Worker a) Create a new branch 52*4e4b8e58SAndroid Build Coastguard Worker 53*4e4b8e58SAndroid Build Coastguard Worker repo start merge-xxx 54*4e4b8e58SAndroid Build Coastguard Worker 55*4e4b8e58SAndroid Build Coastguard Worker b) Merge the changes in 56*4e4b8e58SAndroid Build Coastguard Worker 57*4e4b8e58SAndroid Build Coastguard Worker git fetch aosp upstream-master 58*4e4b8e58SAndroid Build Coastguard Worker git merge aosp/upstream-master 59*4e4b8e58SAndroid Build Coastguard Worker 60*4e4b8e58SAndroid Build Coastguard Worker c) Resolve any conflicts. Some common cases: 61*4e4b8e58SAndroid Build Coastguard Worker 62*4e4b8e58SAndroid Build Coastguard Worker * If upstream changed a file that's deleted locally, we probably don't 63*4e4b8e58SAndroid Build Coastguard Worker need it 64*4e4b8e58SAndroid Build Coastguard Worker * If upstream added a file to a directory we deleted, we probably don't 65*4e4b8e58SAndroid Build Coastguard Worker need it 66*4e4b8e58SAndroid Build Coastguard Worker 67*4e4b8e58SAndroid Build Coastguard Worker d) Update the list of exported APIs in proguard.flags, if necessary. 68*4e4b8e58SAndroid Build Coastguard Worker 69*4e4b8e58SAndroid Build Coastguard Worker Check this in particular if new algorithms are getting registered with 70*4e4b8e58SAndroid Build Coastguard Worker ConfigurableProvider.addAlgorithm or ConfigurableProvider.addPrivateAlgorithm. 71*4e4b8e58SAndroid Build Coastguard Worker 72*4e4b8e58SAndroid Build Coastguard Worker e) Confirm all changes 73*4e4b8e58SAndroid Build Coastguard Worker 74*4e4b8e58SAndroid Build Coastguard Worker git diff aosp/master 75*4e4b8e58SAndroid Build Coastguard Worker 76*4e4b8e58SAndroid Build Coastguard Worker f) Run the tests, commonly at least 77*4e4b8e58SAndroid Build Coastguard Worker 78*4e4b8e58SAndroid Build Coastguard Worker cts -m CtsLibcoreTestCases 79*4e4b8e58SAndroid Build Coastguard Worker cts -m CtsLibcoreFileIOTestCases 80*4e4b8e58SAndroid Build Coastguard Worker cts -m CtsLibcoreJsr166TestCases 81*4e4b8e58SAndroid Build Coastguard Worker cts -m CtsLibcoreOjTestCases 82*4e4b8e58SAndroid Build Coastguard Worker cts -m CtsLibcoreOkHttpTestCases 83*4e4b8e58SAndroid Build Coastguard Worker cts -m CtsLibcoreWycheproofBCTestCases 84*4e4b8e58SAndroid Build Coastguard Worker 85*4e4b8e58SAndroid Build Coastguard Worker g) Get the change reviewed 86*4e4b8e58SAndroid Build Coastguard Worker 87*4e4b8e58SAndroid Build Coastguard Worker repo upload . 88