Use libsodium instead of OpenSSL for binary cache signing
Sodium's Ed25519 signatures are much shorter than OpenSSL's RSA signatures. Public keys are also much shorter, so they're now specified directly in the nix.conf option ‘binary-cache-public-keys’. The new command ‘nix-store --generate-binary-cache-key’ generates and prints a public and secret key.
This commit is contained in:
		
							parent
							
								
									0d1dafa0c4
								
							
						
					
					
						commit
						e0def5bc4b
					
				
					 15 changed files with 196 additions and 91 deletions
				
			
		|  | @ -925,18 +925,24 @@ std::vector<const char *> stringsToCharPtrs(const Strings & ss) | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| string runProgram(Path program, bool searchPath, const Strings & args) | ||||
| string runProgram(Path program, bool searchPath, const Strings & args, | ||||
|     const string & input) | ||||
| { | ||||
|     checkInterrupt(); | ||||
| 
 | ||||
|     /* Create a pipe. */ | ||||
|     Pipe pipe; | ||||
|     pipe.create(); | ||||
|     Pipe stdout, stdin; | ||||
|     stdout.create(); | ||||
|     if (!input.empty()) stdin.create(); | ||||
| 
 | ||||
|     /* Fork. */ | ||||
|     Pid pid = startProcess([&]() { | ||||
|         if (dup2(pipe.writeSide, STDOUT_FILENO) == -1) | ||||
|         if (dup2(stdout.writeSide, STDOUT_FILENO) == -1) | ||||
|             throw SysError("dupping stdout"); | ||||
|         if (!input.empty()) { | ||||
|             if (dup2(stdin.readSide, STDIN_FILENO) == -1) | ||||
|                 throw SysError("dupping stdin"); | ||||
|         } | ||||
| 
 | ||||
|         Strings args_(args); | ||||
|         args_.push_front(program); | ||||
|  | @ -950,9 +956,16 @@ string runProgram(Path program, bool searchPath, const Strings & args) | |||
|         throw SysError(format("executing ‘%1%’") % program); | ||||
|     }); | ||||
| 
 | ||||
|     pipe.writeSide.close(); | ||||
|     stdout.writeSide.close(); | ||||
| 
 | ||||
|     string result = drainFD(pipe.readSide); | ||||
|     /* FIXME: This can deadlock if the input is too long. */ | ||||
|     if (!input.empty()) { | ||||
|         stdin.readSide.close(); | ||||
|         writeFull(stdin.writeSide, input); | ||||
|         stdin.writeSide.close(); | ||||
|     } | ||||
| 
 | ||||
|     string result = drainFD(stdout.readSide); | ||||
| 
 | ||||
|     /* Wait for the child to finish. */ | ||||
|     int status = pid.wait(true); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue