Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-625

Pure Erlang alternative to crypto library

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • Infrastructure
    • None
    • Committers Level (Medium to Hard)

    Description

      On some platforms (in my case a SheevaPlug running on armv5te) it may be difficult or impossible to obtain a version of Erlang built with support for the crypto standard library. I grepped the CouchDB source and have attempted to reproduce the used crypto calls in pure Erlang.

      I have reproduced the start/0, rand_uniform/2, rand_bytes/1, sha/1, and sha_mac/2 functions, along with test_sha/1 and test_sha_mac/1 functions to validate the pure Erlang results against the crypto library's results. The public non-test functions attempt to first call into crypto if available, as it is the preferred implementation.

      As I'm not familiar with the build system, app system, etc. of Erlang I am only attaching the library implementation. I'm sure more work would be required to fully integrate it into CouchDB if accepted.

      As far as licensing goes, SHA1 is defined in NIST FIPS 180-2 (http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf), and according to the IETF, the patent covering the algorithm has been made royalty-free (https://datatracker.ietf.org/ipr/858).

      Attachments

        1. ccrypto.erl
          5 kB
          Jonathan D. Knezek
        2. ccrypto.erl
          6 kB
          Jonathan D. Knezek

        Activity

          People

            jchris John Christopher Anderson
            jdknezek Jonathan D. Knezek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: