Delete extra ;
[oweals/openssl.git] / crypto / evp / evp_lib.c
index 6b677fdf6f266615a9afc9cb336797a85c8d364f..a431945ef5c4e7df70b9b0db1720d369d7661e8d 100644 (file)
@@ -110,3 +110,33 @@ int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
                }
        return(i);
        }
+
+/* Convert the various cipher NIDs and dummies to a proper OID NID */
+int EVP_CIPHER_type(const EVP_CIPHER *ctx)
+{
+       int nid;
+       ASN1_OBJECT *otmp;
+       nid = EVP_CIPHER_nid(ctx);
+
+       switch(nid) {
+
+               case NID_rc2_cbc:
+               case NID_rc2_64_cbc:
+               case NID_rc2_40_cbc:
+
+               return NID_rc2_cbc;
+
+               case NID_rc4:
+               case NID_rc4_40:
+
+               return NID_rc4;
+
+               default:
+               /* Check it has an OID and it is valid */
+               otmp = OBJ_nid2obj(nid);
+               if(!otmp || !otmp->data) nid = NID_undef;
+               ASN1_OBJECT_free(otmp);
+               return nid;
+       }
+}
+