2
$\begingroup$

I was checking the libsodium library and was wondering why the library does not give users access to the field operations in $\mathbb{Z}_{2^{255}-19}$. There is an interface for using scalars in the interval [0,L[ , where L is the order of the main subgroup $(2^{252} + 27742317777372353535851937790883648493)$. But but the headers for working in $\mathbb{Z}_{2^{255}-19}$ seem to be private, e.g. this one.

Is there are reason for this? Or can I access this logic through some other interface?

$\endgroup$
1
  • 1
    $\begingroup$ Because you don't need it, the library handles all for you. If you want to access it, get the code and modify it... $\endgroup$
    – kelalaka
    Commented Sep 5 at 10:27

1 Answer 1

5
$\begingroup$

Is there are reason for this?

Well, as Maarten says, often these sorts of design decisions are best handled by the people who did the design - some design decisions are made for good reasons and some design decisions are just arbitrary choices. However, this one is pretty clear.

libsodium was designed for people who don't know crypto, but need to use it anyways. That is, it was deliberately designed to be easy to use securely, while not giving any functionality that might be misused.

Direct access to the field operations isn't needed to use it correctly; that is, you don't need it to generate private keys, or encrypt messages or decrypt them - libsodium handles all that internally. And, while the field operations could be used securely, they can also be used insecurely by someone who doesn't know what they're doing (which is what libsodium's target audience is), and so that access was not provided.

If you want something that gives you access to more general functionality, they are out there. However, using one of those packages would require you to know more about what you're doing (which is contrary to libsodium's design goal)

$\endgroup$
1
  • $\begingroup$ Yeah, I agree with the general gist that LibSodium was created as a somewhat higher level method of performing authenticated encryption, possibly by using public key cryptography. As such you'd expect a closed library. Some other libraries take another approach and either have a lot of functions that are publicly available (e.g. Bouncy Castle) or have a underlying library (e.g. Pythons hazmat approach, where the lower level functions are clearly labeled as "hazardous materials"). $\endgroup$
    – Maarten Bodewes
    Commented Sep 5 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.