components/openstack/glance/patches/01-nopycrypto.patch
changeset 1944 56ac2df1785b
parent 1760 353323c7bdc1
child 3998 5bd484384122
--- a/components/openstack/glance/patches/01-nopycrypto.patch	Tue Jun 10 14:07:48 2014 -0700
+++ b/components/openstack/glance/patches/01-nopycrypto.patch	Wed Jun 11 17:13:12 2014 -0700
@@ -4,19 +4,8 @@
 Convert urlsafe_encrypt() and urlsafe_decrypt() to use M2Crypto instead
 of PyCrypto.
 
---- glance-2013.1.4/glance.egg-info/requires.txt.orig	Thu Jan 16 22:08:47 2014
-+++ glance-2013.1.4/glance.egg-info/requires.txt	Thu Jan 16 22:23:01 2014
-@@ -11,7 +11,7 @@
- sqlalchemy-migrate>=0.7
- httplib2
- kombu
--pycrypto>=2.1.0alpha1
-+M2Crypto>=0.21.1
- iso8601>=0.1.4
- oslo.config>=1.1.0
- python-swiftclient>=1.2,<2
---- glance-2013.1.4/glance/common/crypt.py.orig	Thu Oct 17 11:22:18 2013
-+++ glance-2013.1.4/glance/common/crypt.py	Thu Jan 16 22:42:41 2014
+--- glance-2013.2.3/glance/common/crypt.py.orig	2014-04-03 11:43:55.000000000 -0700
++++ glance-2013.2.3/glance/common/crypt.py	2014-05-19 03:47:07.005226253 -0700
 @@ -4,6 +4,8 @@
  # Copyright 2011 OpenStack LLC.
  # All Rights Reserved.
@@ -26,20 +15,20 @@
  #    Licensed under the Apache License, Version 2.0 (the "License"); you may
  #    not use this file except in compliance with the License. You may obtain
  #    a copy of the License at
-@@ -21,12 +23,27 @@
+@@ -21,10 +23,26 @@
  """
  
  import base64
 +import os
++
++from M2Crypto.EVP import Cipher
++
++from glance.common import exception
++
  
 -from Crypto.Cipher import AES
 -from Crypto import Random
 -from Crypto.Random import random
-+from M2Crypto.EVP import Cipher
- 
-+from glance.common import exception
- 
-+
 +def _key_to_alg(key):
 +    """Return a M2Crypto-compatible AES-CBC algorithm name given a key."""
 +    aes_algs = {
@@ -53,11 +42,10 @@
 +        msg = ('Invalid AES key length, %d bits') % keylen
 +        raise exception.Invalid(msg)
 +    return aes_algs[keylen]
-+
+ 
+ 
  def urlsafe_encrypt(key, plaintext, blocksize=16):
-     """
-     Encrypts plaintext. Resulting ciphertext will contain URL-safe characters
-@@ -36,20 +53,12 @@
+@@ -36,20 +54,12 @@
  
      :returns : Resulting ciphertext
      """
@@ -82,7 +70,7 @@
      return base64.urlsafe_b64encode(init_vector + padded)
  
  
-@@ -63,6 +72,7 @@
+@@ -63,6 +73,7 @@
      """
      # Cast from unicode
      ciphertext = base64.urlsafe_b64decode(str(ciphertext))
@@ -93,14 +81,3 @@
 +    padded = cipher.update(ciphertext[16:])
 +    padded = padded + cipher.final()
 +    return padded
---- glance-2013.1.4/tools/pip-requires.orig	Thu Oct 17 11:22:19 2013
-+++ glance-2013.1.4/tools/pip-requires	Thu Jan 16 22:22:56 2014
-@@ -15,7 +15,7 @@
- sqlalchemy-migrate>=0.7
- httplib2
- kombu
--pycrypto>=2.1.0alpha1
-+M2Crypto>=0.21.1
- iso8601>=0.1.4
- oslo.config>=1.1.0
-